From 622aa9810820803d268dd3b4f29a58a21f58cd85 Mon Sep 17 00:00:00 2001 From: Benjamin Verdier Date: Mon, 18 Jun 2018 09:13:05 +0200 Subject: [PATCH 1/3] Add qrcode button --- Classes/Base.lproj/AssistantViewScreens.xib | 65 ++++++++++++++------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/Classes/Base.lproj/AssistantViewScreens.xib b/Classes/Base.lproj/AssistantViewScreens.xib index 5d2c6dc86..998c47678 100644 --- a/Classes/Base.lproj/AssistantViewScreens.xib +++ b/Classes/Base.lproj/AssistantViewScreens.xib @@ -1,13 +1,12 @@ - + - + - @@ -338,7 +337,7 @@ - + @@ -359,7 +358,7 @@ - + @@ -389,7 +388,7 @@ - + @@ -418,7 +417,7 @@ @@ -1552,6 +1554,12 @@ Once it is done, come back here and click on the button. + + + + + + diff --git a/Classes/LinphoneAppDelegate.h b/Classes/LinphoneAppDelegate.h index 93c7b1e1b..9236f4f68 100644 --- a/Classes/LinphoneAppDelegate.h +++ b/Classes/LinphoneAppDelegate.h @@ -39,6 +39,7 @@ @property PKPushRegistry* voipRegistry; @property ProviderDelegate *del; @property BOOL alreadyRegisteredForNotification; +@property BOOL onlyPortrait; @end diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index ff39eb49d..0c26035b0 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -44,6 +44,7 @@ startedInBackground = FALSE; } _alreadyRegisteredForNotification = false; + _onlyPortrait = FALSE; return self; [[UIApplication sharedApplication] setDelegate:self]; } @@ -218,17 +219,6 @@ actions:[NSArray arrayWithObjects:act_confirm, act_deny, nil] intentIdentifiers:[[NSMutableArray alloc] init] options:UNNotificationCategoryOptionCustomDismissAction]; - - // App version verification - - UNNotificationAction *act_go_to_URL = [UNNotificationAction actionWithIdentifier:@"Download" - title:NSLocalizedString(@"Download", nil) - options:UNNotificationActionOptionNone]; - UNNotificationCategory *version_verif = - [UNNotificationCategory categoryWithIdentifier:@"version_verif" - actions:[NSArray arrayWithObjects:act_go_to_URL, nil] - intentIdentifiers:[[NSMutableArray alloc] init] - options:UNNotificationCategoryOptionCustomDismissAction]; [UNUserNotificationCenter currentNotificationCenter].delegate = self; [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge) @@ -238,7 +228,7 @@ LOGD(error.description); }]; - NSSet *categories = [NSSet setWithObjects:cat_call, cat_msg, video_call, cat_zrtp, version_verif, nil]; + NSSet *categories = [NSSet setWithObjects:cat_call, cat_msg, video_call, cat_zrtp, nil]; [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:categories]; } @@ -674,10 +664,6 @@ didInvalidatePushTokenForType:(NSString *)type { }]; } else if ([response.notification.request.content.categoryIdentifier isEqual:@"lime"]) { return; - } else if ([response.notification.request.content.categoryIdentifier isEqual:@"version_verif"]) { - NSString *url = [response.notification.request.content.userInfo objectForKey:@"url"]; - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; - return; } else { // Missed call [PhoneMainView.instance changeCurrentView:HistoryListView.compositeViewDescription]; } @@ -849,14 +835,13 @@ didInvalidatePushTokenForType:(NSString *)type { #pragma mark - Prevent ImagePickerView from rotating - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { - if ([[(PhoneMainView*)self.window.rootViewController currentView] equal:ImagePickerView.compositeViewDescription]) + if ([[(PhoneMainView*)self.window.rootViewController currentView] equal:ImagePickerView.compositeViewDescription] || _onlyPortrait) { //Prevent rotation of camera NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait]; [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; return UIInterfaceOrientationMaskPortrait; - } - else return UIInterfaceOrientationMaskAllButUpsideDown; + } else return UIInterfaceOrientationMaskAllButUpsideDown; } @end diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index 498cd37ab..c1eab0464 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -56,6 +56,7 @@ extern NSString *const kLinphoneNotifyPresenceReceivedForUriOrTel; extern NSString *const kLinphoneCallEncryptionChanged; extern NSString *const kLinphoneFileTransferSendUpdate; extern NSString *const kLinphoneFileTransferRecvUpdate; +extern NSString *const kLinphoneQRCodeFound; typedef enum _NetworkType { network_none = 0, diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 535e445f4..33deccc6d 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -76,6 +76,7 @@ NSString *const kLinphoneNotifyPresenceReceivedForUriOrTel = @"LinphoneNotifyPre NSString *const kLinphoneCallEncryptionChanged = @"LinphoneCallEncryptionChanged"; NSString *const kLinphoneFileTransferSendUpdate = @"LinphoneFileTransferSendUpdate"; NSString *const kLinphoneFileTransferRecvUpdate = @"LinphoneFileTransferRecvUpdate"; +NSString *const kLinphoneQRCodeFound = @"LinphoneQRCodeFound"; const int kLinphoneAudioVbrCodecDefaultBitrate = 36; /*you can override this from linphonerc or linphonerc-factory*/ @@ -1416,6 +1417,12 @@ void linphone_iphone_version_update_check_result_received (LinphoneCore *lc, Lin [PhoneMainView.instance presentViewController:versVerifView animated:YES completion:nil]; } +void linphone_iphone_qr_code_found(LinphoneCore *lc, const char *result) { + NSDictionary *eventDic = [NSDictionary dictionaryWithObject:[NSString stringWithCString:result encoding:[NSString defaultCStringEncoding]] forKey:@"qrcode"]; + LOGD(@"QRCODE FOUND"); + [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneQRCodeFound object:nil userInfo:eventDic]; +} + #pragma mark - Message composition start - (void)alertLIME:(LinphoneChatRoom *)room { NSString *title = NSLocalizedString(@"LIME warning", nil); @@ -1988,6 +1995,7 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat linphone_core_cbs_set_chat_room_state_changed(cbs, linphone_iphone_chatroom_state_changed); linphone_core_cbs_set_version_update_check_result_received(cbs, linphone_iphone_version_update_check_result_received); linphone_core_cbs_set_user_data(cbs, (__bridge void *)(self)); + linphone_core_cbs_set_qrcode_found(cbs, linphone_iphone_qr_code_found); theLinphoneCore = linphone_factory_create_core_with_config(factory, cbs, _configDb); // Let the core handle cbs diff --git a/submodules/cmake-builder b/submodules/cmake-builder index 68f19de84..01c40162d 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit 68f19de842824573dd075a4ec41483930b8de325 +Subproject commit 01c40162d1119a562f965b03576ddff241b5483d diff --git a/submodules/externals/zxing-cpp b/submodules/externals/zxing-cpp new file mode 160000 index 000000000..8906fb7b2 --- /dev/null +++ b/submodules/externals/zxing-cpp @@ -0,0 +1 @@ +Subproject commit 8906fb7b243fa455fd9b091e4ac611536b2dbba4