diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index b3fe14791..5f75c7652 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -151,7 +151,7 @@ } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound]; + [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound |UIRemoteNotificationTypeBadge]; if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)] && [UIApplication sharedApplication].applicationState == UIApplicationStateBackground diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 7258aad92..6dbc8ffef 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -370,25 +370,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); } linphone_proxy_config_set_dial_escape_plus(proxyCfg,substitute_plus_by_00); - //Add custom parameter - NSData *tokenData = [[LinphoneManager instance] pushNotificationToken]; - if(tokenData != nil) { - const unsigned char *tokenBuffer = [tokenData bytes]; - NSMutableString *tokenString = [NSMutableString stringWithCapacity:[tokenData length]*2]; - for(int i = 0; i < [tokenData length]; ++i) { - [tokenString appendFormat:@"%02X", (unsigned int)tokenBuffer[i]]; - } - // NSLocalizedString(@"IC_MSG", nil); // Fake for genstrings - // NSLocalizedString(@"IM_MSG", nil); // Fake for genstrings -#ifdef DEBUG - #define APPMODE_SUFFIX @"dev" -#else - #define APPMODE_SUFFIX @"prod" -#endif - NSString *params = [NSString stringWithFormat:@"app-id=%@.%@;pn-type=apple;pn-tok=%@;pn-msg-str=IM_MSG;pn-call-str=IC_MSG;pn-call-snd=ring.caf;pn-msg-snd=msg.caf", [[NSBundle mainBundle] bundleIdentifier],APPMODE_SUFFIX,tokenString]; - linphone_proxy_config_set_contact_parameters(proxyCfg, [params UTF8String]); - } - + [[LinphoneManager instance ]addPushTokenToProxyConfig : proxyCfg ]; linphone_core_add_proxy_config(lc,proxyCfg); //set to default proxy diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index 44f35bed8..7016fbd60 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -102,6 +102,7 @@ typedef struct _LinphoneManagerSounds { - (void)becomeActive; - (BOOL)enterBackgroundMode; - (void)didReceiveRemoteNotification; +- (void)addPushTokenToProxyConfig: (LinphoneProxyConfig*)cfg; - (BOOL)shouldAutoAcceptCall; + (void)kickOffNetworkConnection; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index ec6877f05..0862758e3 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -942,10 +942,36 @@ static LinphoneCoreVTable linphonec_vtable = { pushNotificationToken = [apushNotificationToken retain]; } if([LinphoneManager isLcReady]) { - [(LinphoneCoreSettingsStore*)settingsStore synchronizeAccount]; + LinphoneProxyConfig *cfg=nil; + linphone_core_get_default_proxy(theLinphoneCore, &cfg); + if (cfg) { + linphone_proxy_config_edit(cfg); + [self addPushTokenToProxyConfig: cfg]; + linphone_proxy_config_done(cfg); + } } } +- (void)addPushTokenToProxyConfig: (LinphoneProxyConfig*)proxyCfg{ + NSData *tokenData = pushNotificationToken; + if(tokenData != nil) { + const unsigned char *tokenBuffer = [tokenData bytes]; + NSMutableString *tokenString = [NSMutableString stringWithCapacity:[tokenData length]*2]; + for(int i = 0; i < [tokenData length]; ++i) { + [tokenString appendFormat:@"%02X", (unsigned int)tokenBuffer[i]]; + } + // NSLocalizedString(@"IC_MSG", nil); // Fake for genstrings + // NSLocalizedString(@"IM_MSG", nil); // Fake for genstrings +#ifdef DEBUG +#define APPMODE_SUFFIX @"dev" +#else +#define APPMODE_SUFFIX @"prod" +#endif + NSString *params = [NSString stringWithFormat:@"app-id=%@.%@;pn-type=apple;pn-tok=%@;pn-msg-str=IM_MSG;pn-call-str=IC_MSG;pn-call-snd=ring.caf;pn-msg-snd=msg.caf", [[NSBundle mainBundle] bundleIdentifier],APPMODE_SUFFIX,tokenString]; + linphone_proxy_config_set_contact_parameters(proxyCfg, [params UTF8String]); + } +} + - (void)addInhibitedEvent:(NSString*)event { [inhibitedEvent addObject:event]; } diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 247a0bad6..23bcf40a7 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -4931,7 +4931,7 @@ "$(ARCHS_STANDARD_32_BIT)", armv6, ); - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = "iPhone Developer: jehan monnier (E8MYPN2NXL)"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -4939,7 +4939,7 @@ HEADER_SEARCH_PATHS = ""; IPHONEOS_DEPLOYMENT_TARGET = 4.0; LIBRARY_SEARCH_PATHS = ""; - PROVISIONING_PROFILE = ""; + PROVISIONING_PROFILE = "FFF4AA57-7302-4F48-B969-20CFC1B10BAF"; SDKROOT = iphoneos; STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/submodules/linphone b/submodules/linphone index bd6a97374..5139b557f 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit bd6a9737485893b0bc08ffe75dfea6f71115b73c +Subproject commit 5139b557f8c922f16b4b2808d62cf63bdc293274