From 55027dbc82193825453a65cdfca394d424e8d420 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Fri, 2 Jul 2021 17:44:20 +0200 Subject: [PATCH] =?UTF-8?q?Add=20a=20check=20to=20avoid=20going=20back=20t?= =?UTF-8?q?o=20DialerView=20if=20we=E2=80=99ve=20been=20started=20through?= =?UTF-8?q?=20a=20push=20notification=20and=20are=20already=20in=20a=20cha?= =?UTF-8?q?troom=20at=20startup=20(and=20a=20bit=20of=20tab/line=20reforma?= =?UTF-8?q?tting)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Classes/PhoneMainView.m | 60 +++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 7a74d0175..c8d78cd4f 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -473,38 +473,34 @@ static RootViewManager *rootViewManagerInstance = nil; - (void)startUp { @try { LinphoneManager *lm = LinphoneManager.instance; - LOGI(@"%s", linphone_global_state_to_string( - linphone_core_get_global_state(LC))); - if (linphone_core_get_global_state(LC) != LinphoneGlobalOn) { - [self changeCurrentView:DialerView.compositeViewDescription]; - } else if ([LinphoneManager.instance - lpConfigBoolForKey: - @"enable_first_login_view_preference"] == - true) { - [PhoneMainView.instance - changeCurrentView:FirstLoginView - .compositeViewDescription]; - } else { - // always start to dialer when testing - // Change to default view - const MSList *accountList = linphone_core_get_account_list(LC); - if (accountList != NULL || - ([lm lpConfigBoolForKey:@"hide_assistant_preference"] == - true) || - lm.isTesting) { - [self - changeCurrentView:DialerView.compositeViewDescription]; - } else { - AssistantView *view = VIEW(AssistantView); - [PhoneMainView.instance - changeCurrentView:view.compositeViewDescription]; - [view reset]; - } - } - [self updateApplicationBadgeNumber]; // Update Badge at startup - } @catch (NSException *exception) { - // we'll wait until the app transitions correctly - } + LOGI(@"%s", linphone_global_state_to_string(linphone_core_get_global_state(LC))); + + // If we've been started by a remote push notification, + // we'll already be on the corresponding chat conversation view, no need to go anywhere else + if (![[self currentView].name isEqualToString:@"ChatConversationView"]) { + + if (linphone_core_get_global_state(LC) != LinphoneGlobalOn) { + [self changeCurrentView:DialerView.compositeViewDescription]; + } else if ([LinphoneManager.instance lpConfigBoolForKey:@"enable_first_login_view_preference"] == true) { + [PhoneMainView.instance changeCurrentView:FirstLoginView.compositeViewDescription]; + } else { + // always start to dialer when testing + // Change to default view + const MSList *accountList = linphone_core_get_account_list(LC); + if (accountList != NULL || ([lm lpConfigBoolForKey:@"hide_assistant_preference"] == true) || lm.isTesting) { + [self changeCurrentView:DialerView.compositeViewDescription]; + } else { + AssistantView *view = VIEW(AssistantView); + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; + [view reset]; + } + } + } + [self updateApplicationBadgeNumber]; // Update Badge at startup + + } @catch (NSException *exception) { + // we'll wait until the app transitions correctly + } } - (void)updateApplicationBadgeNumber {