diff --git a/Examples/restcomm-olympus/restcomm-olympus/Utils.m b/Examples/restcomm-olympus/restcomm-olympus/Utils.m
index 3c22a4a..c03067e 100644
--- a/Examples/restcomm-olympus/restcomm-olympus/Utils.m
+++ b/Examples/restcomm-olympus/restcomm-olympus/Utils.m
@@ -84,14 +84,14 @@ + (void) setupUserDefaults
],
},
};
-
+
[[NSUserDefaults standardUserDefaults] registerDefaults:basicDefaults];
}
+ (NSArray*)messagesForSipUri:(NSString*)sipUri
{
NSMutableArray *messages = [[NSMutableArray alloc] init];
-
+
NSUserDefaults* appDefaults = [NSUserDefaults standardUserDefaults];
if ([appDefaults dictionaryForKey:@"chat-history"] && [[appDefaults dictionaryForKey:@"chat-history"] objectForKey:sipUri]) {
return [[appDefaults dictionaryForKey:@"chat-history"] objectForKey:sipUri];
@@ -106,15 +106,15 @@ + (void)addMessageForSipUri:(NSString*)sipUri text:(NSString*)text type:(NSStrin
if (![appDefaults dictionaryForKey:@"chat-history"]) {
return;
}
-
+
NSMutableDictionary * messages = [[appDefaults dictionaryForKey:@"chat-history"] mutableCopy];
if ([messages objectForKey:sipUri]) {
aliasMessages = [[messages objectForKey:sipUri] mutableCopy];
}
-
+
[aliasMessages addObject:[NSDictionary dictionaryWithObjectsAndKeys:text, @"text", type, @"type", nil]];
[messages setObject:aliasMessages forKey:sipUri];
-
+
[appDefaults setObject:messages forKey:@"chat-history"];
}
@@ -135,7 +135,7 @@ + (int)indexForContact:(NSString*)alias
{
NSUserDefaults* appDefaults = [NSUserDefaults standardUserDefaults];
NSArray * contacts = [appDefaults arrayForKey:@"contacts"];
-
+
for (int i = 0; i < [contacts count]; i++) {
NSArray * contact = [contacts objectAtIndex:i];
if ([[contact objectAtIndex:0] isEqualToString:alias]) {
@@ -151,14 +151,14 @@ + (int)indexForContact:(NSString*)sipUri
{
NSUserDefaults* appDefaults = [NSUserDefaults standardUserDefaults];
NSArray * contacts = [appDefaults arrayForKey:@"contacts"];
-
+
for (int i = 0; i < [contacts count]; i++) {
NSArray * contact = [contacts objectAtIndex:i];
if ([[contact objectAtIndex:1] isEqualToString:sipUri]) {
return i;
}
}
-
+
return -1;
}
@@ -166,14 +166,14 @@ + (NSString*)sipUri2Alias:(NSString*)sipUri
{
NSUserDefaults* appDefaults = [NSUserDefaults standardUserDefaults];
NSArray * contacts = [appDefaults arrayForKey:@"contacts"];
-
+
for (int i = 0; i < [contacts count]; i++) {
NSArray * contact = [contacts objectAtIndex:i];
if ([[contact objectAtIndex:1] isEqualToString:sipUri]) {
return [contact objectAtIndex:0];
}
}
-
+
return @"";
}
@@ -257,7 +257,7 @@ + (int)contactCount
+ (NSString*) genericType:(NSString*)type forLevel:(NSNumber*)level;
{
NSUserDefaults* appDefaults = [NSUserDefaults standardUserDefaults];
-
+
if ([appDefaults dictionaryForKey:type]) {
if([[appDefaults dictionaryForKey:type] objectForKey:[level stringValue]]) {
return [[[appDefaults dictionaryForKey:type] objectForKey:[level stringValue]] stringValue];
@@ -271,7 +271,7 @@ + (NSString*) genericType:(NSString*)type forLevel:(NSNumber*)level;
+ (void)addContact:(NSArray*)contact
{
NSUserDefaults* appDefaults = [NSUserDefaults standardUserDefaults];
-
+
NSMutableArray * mutable = nil;
if ([appDefaults arrayForKey:@"contacts"]) {
// exists; get a mutable copy
@@ -281,9 +281,9 @@ + (void)addContact:(NSArray*)contact
// should never happen
return;
}
-
+
[mutable addObject:contact];
-
+
// update user defaults
[appDefaults setObject:mutable forKey:@"contacts"];
}
@@ -291,7 +291,7 @@ + (void)addContact:(NSArray*)contact
+ (void)removeContactAtIndex:(int)index
{
NSUserDefaults* appDefaults = [NSUserDefaults standardUserDefaults];
-
+
NSMutableArray * mutable = nil;
if ([appDefaults arrayForKey:@"contacts"]) {
// exists; get a mutable copy
@@ -301,9 +301,9 @@ + (void)removeContactAtIndex:(int)index
// should never happen
return;
}
-
+
[mutable removeObjectAtIndex:index];
-
+
// update user defaults
[appDefaults setObject:mutable forKey:@"contacts"];
}
@@ -311,7 +311,7 @@ + (void)removeContactAtIndex:(int)index
+ (void)updateContactWithSipUri:(NSString*)sipUri alias:(NSString*)alias
{
NSUserDefaults* appDefaults = [NSUserDefaults standardUserDefaults];
-
+
NSMutableArray * mutable = nil;
if ([appDefaults arrayForKey:@"contacts"]) {
// exists; get a mutable copy
@@ -321,7 +321,7 @@ + (void)updateContactWithSipUri:(NSString*)sipUri alias:(NSString*)alias
// should never happen
return;
}
-
+
for (int i = 0; i < [mutable count]; i++) {
NSArray * contact = [mutable objectAtIndex:i];
if ([[contact objectAtIndex:1] isEqualToString:sipUri]) {
@@ -410,6 +410,7 @@ + (NSString*)convertInterappUri2RestcommUri:(NSURL*)uri
* restcomm-tel://+1235@telestax.com
* client://bob
* restcomm-client://bob
+ * restcomm-app://bob -> just opens app and potentially login with user
* Important note: the browser only recognizes URLs starting with 'scheme://', not 'scheme:'
*/
@@ -425,12 +426,14 @@ + (NSString*)convertInterappUri2RestcommUri:(NSURL*)uri
NSString * normalized = [[uri absoluteString] stringByReplacingOccurrencesOfString:@"restcomm-sip" withString:@"sip"];
// also replace '://' with ':' so that the SIP stack can understand it
final = [normalized stringByReplacingOccurrencesOfString:@"://" withString:@":"];
+ } else if ([RCUtilities string:[uri scheme] containsString:@"app"]) {
+ //just open the app with no call initiated
}
else {
// either 'tel', 'restcomm-tel', 'client' or 'restcomm-client'. Return just the host part, like 'bob' or '1235' that the Restcomm SDK can handle
final = [NSString stringWithFormat:@"%@", [uri host]];
}
-
+
NSLog(@"convertInterappUri2RestcommUri after conversion: %@", final);
return final;
}
@@ -440,7 +443,7 @@ + (NSString*)convertInterappUri2RestcommUri:(NSURL*)uri
+ (void) setGenericType:(NSString*)type forLevel:(NSNumber*)level withValue:(NSNumber*)value updateType:(NSString*)updateType
{
NSUserDefaults* appDefaults = [NSUserDefaults standardUserDefaults];
-
+
NSMutableDictionary * mutable = nil;
if ([appDefaults dictionaryForKey:type]) {
// exists; get a mutable copy
@@ -450,7 +453,7 @@ + (void) setGenericType:(NSString*)type forLevel:(NSNumber*)level withValue:(NSN
// if the type does not exist create it
mutable = [[NSMutableDictionary alloc] init];
}
-
+
BOOL updateValue = YES;
if (updateType && [updateType isEqualToString:@"update-when-greater"]) {
// if there's a value for the level score or stars and that is bigger than the current value then don't update score
@@ -458,11 +461,11 @@ + (void) setGenericType:(NSString*)type forLevel:(NSNumber*)level withValue:(NSN
updateValue = NO;
}
}
-
+
if (updateValue) {
[mutable setObject:value forKey:[level stringValue]];
}
-
+
// update user defaults
[appDefaults setObject:mutable forKey:type];
}
diff --git a/Examples/restcomm-olympus/restcomm-olympus/restcomm-olympus-Info.plist b/Examples/restcomm-olympus/restcomm-olympus/restcomm-olympus-Info.plist
index c1efa25..cfbaf3c 100644
--- a/Examples/restcomm-olympus/restcomm-olympus/restcomm-olympus-Info.plist
+++ b/Examples/restcomm-olympus/restcomm-olympus/restcomm-olympus-Info.plist
@@ -26,6 +26,16 @@
????
CFBundleURLTypes
+
+ CFBundleTypeRole
+ Editor
+ CFBundleURLName
+ com.telestax.olympus.restcomm-app
+ CFBundleURLSchemes
+
+ restcomm-app
+
+
CFBundleTypeRole
Editor
@@ -88,7 +98,7 @@
CFBundleVersion
- BETA4.1#2
+ BETA4.1#3
Fabric
APIKey