From 992dbb8415ce761425f38b0f8a074a07a91410bd Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Mon, 28 Jan 2019 13:39:44 +0100 Subject: [PATCH] fix problem of loading chats list --- Classes/ChatsListView.m | 14 -------------- Classes/LinphoneManager.m | 4 ++-- Classes/PhoneMainView.m | 6 +++++- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Classes/ChatsListView.m b/Classes/ChatsListView.m index 84e6d0f8c..a48149dc4 100644 --- a/Classes/ChatsListView.m +++ b/Classes/ChatsListView.m @@ -35,10 +35,6 @@ selector:@selector(callUpdateEvent:) name:kLinphoneCallUpdate object:nil]; - [NSNotificationCenter.defaultCenter addObserver:self - selector:@selector(onGlobalStateChanged:) - name:kLinphoneGlobalStateUpdate - object:nil]; [_backToCallButton update]; self.tableController.waitView = _waitView; [self setEditing:NO]; @@ -61,16 +57,6 @@ [_backToCallButton update]; } -- (void)onGlobalStateChanged:(NSNotification *)notif { - LinphoneGlobalState state = (LinphoneGlobalState)[[[notif userInfo] valueForKey:@"state"] integerValue]; - if (state == LinphoneGlobalStartup) { - _waitView.hidden = NO; - } else if (state == LinphoneGlobalOn) { - [_tableController loadData]; - _waitView.hidden = YES; - } -} - #pragma mark - UICompositeViewDelegate Functions static UICompositeViewDescription *compositeDescription = nil; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 661fafd5c..52ee5690c 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -917,7 +917,7 @@ static void linphone_iphone_configuring_status_changed(LinphoneCore *lc, Linphon - (void)onConfiguringStatusChanged:(LinphoneConfiguringState)status withMessage:(const char *)message { LOGI(@"onConfiguringStatusChanged: %s %@", linphone_configuring_state_to_string(status), message ? [NSString stringWithFormat:@"(message: %s)", message] : @""); - + NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:status], @"state", [NSString stringWithUTF8String:message ? message : ""], @"message", nil]; @@ -1837,7 +1837,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } linphone_core_set_zrtp_secrets_file(theLinphoneCore, [zrtpSecretsFileName UTF8String]); - linphone_core_set_chat_database_path(theLinphoneCore, [chatDBFileName UTF8String]); + //linphone_core_set_chat_database_path(theLinphoneCore, [chatDBFileName UTF8String]); linphone_core_set_call_logs_database_path(theLinphoneCore, [chatDBFileName UTF8String]); [self setupNetworkReachabilityCallback]; diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index f712e52f0..1a8de7336 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -329,7 +329,11 @@ static RootViewManager *rootViewManagerInstance = nil; [errView addAction:defaultAction]; [self presentViewController:errView animated:YES completion:nil]; - } + } else if (state == LinphoneRegistrationOk && [currentView equal:ChatsListView.compositeViewDescription]) { + // update avatarImages + //ChatsListView *view = VIEW(ChatsListView); + //[view.tableController loadData]; + } } - (void)onGlobalStateChanged:(NSNotification *)notif {