mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 19:18:06 +00:00
smoother startup when push notification token arrives (avoid running synchronizeAccounts just for that)
This commit is contained in:
parent
2d0a5d42ea
commit
2049dccd0e
6 changed files with 33 additions and 24 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ typedef struct _LinphoneManagerSounds {
|
|||
- (void)becomeActive;
|
||||
- (BOOL)enterBackgroundMode;
|
||||
- (void)didReceiveRemoteNotification;
|
||||
- (void)addPushTokenToProxyConfig: (LinphoneProxyConfig*)cfg;
|
||||
- (BOOL)shouldAutoAcceptCall;
|
||||
|
||||
+ (void)kickOffNetworkConnection;
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit bd6a9737485893b0bc08ffe75dfea6f71115b73c
|
||||
Subproject commit 5139b557f8c922f16b4b2808d62cf63bdc293274
|
||||
Loading…
Add table
Reference in a new issue