From 60bbcbc944e6614fe22a5c902a1dc5ebc06b5278 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 27 Oct 2015 15:48:59 +0100 Subject: [PATCH] Assistant: avoid adding multiple times the same account if registration failed --- Classes/AssistantView.h | 1 + Classes/AssistantView.m | 9 +- Classes/Base.lproj/AssistantView.xib | 4 +- Classes/Base.lproj/CallView.xib | 725 +++++++++---------- Classes/CallView.h | 2 - Classes/CallView.m | 12 +- Classes/LinphoneUI/UIChatBubblePhotoCell.m | 2 +- Classes/LinphoneUI/UIChatBubblePhotoCell.xib | 10 +- Classes/LinphoneUI/UIChatBubbleTextCell.m | 6 +- Classes/LinphoneUI/UIChatBubbleTextCell.xib | 7 +- Classes/LinphoneUI/UIMicroButton.m | 2 +- 11 files changed, 394 insertions(+), 386 deletions(-) diff --git a/Classes/AssistantView.h b/Classes/AssistantView.h index 37bf80863..401ff4e1c 100644 --- a/Classes/AssistantView.h +++ b/Classes/AssistantView.h @@ -28,6 +28,7 @@ UIView *currentView; UIView *nextView; NSMutableArray *historyViews; + LinphoneProxyConfig *new_config; } @property(nonatomic, strong) IBOutlet TPKeyboardAvoidingScrollView *contentView; diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index 94b98053e..4231c235b 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -88,7 +88,7 @@ static UICompositeViewDescription *compositeDescription = nil; selector:@selector(configuringUpdate:) name:kLinphoneConfiguringStateUpdate object:nil]; - + new_config = NULL; [self changeView:_welcomeView back:FALSE animation:FALSE]; } @@ -207,6 +207,12 @@ static UICompositeViewDescription *compositeDescription = nil; - (BOOL)addProxyConfig:(LinphoneProxyConfig *)proxy { LinphoneCore *lc = [LinphoneManager getLc]; LinphoneManager *lm = [LinphoneManager instance]; + + if (new_config != NULL && proxy != new_config) { + linphone_core_remove_proxy_config(lc, new_config); + } + new_config = proxy; + [lm configurePushTokenForProxyConfig:proxy]; linphone_core_set_default_proxy_config(lc, proxy); // reload address book to prepend proxy config domain to contacts' phone number @@ -469,6 +475,7 @@ static UICompositeViewDescription *compositeDescription = nil; cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; + linphone_core_remove_proxy_config([LinphoneManager getLc], new_config); break; } case LinphoneRegistrationProgress: { diff --git a/Classes/Base.lproj/AssistantView.xib b/Classes/Base.lproj/AssistantView.xib index 8e4520658..9dc420d34 100644 --- a/Classes/Base.lproj/AssistantView.xib +++ b/Classes/Base.lproj/AssistantView.xib @@ -77,8 +77,8 @@ - - + + diff --git a/Classes/Base.lproj/CallView.xib b/Classes/Base.lproj/CallView.xib index 4cf86623b..61fd385e2 100644 --- a/Classes/Base.lproj/CallView.xib +++ b/Classes/Base.lproj/CallView.xib @@ -42,7 +42,6 @@ - @@ -103,7 +102,7 @@ - + @@ -115,16 +114,16 @@ - + - + - + @@ -132,7 +131,7 @@ - + @@ -192,17 +191,6 @@ - @@ -234,381 +222,386 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + diff --git a/Classes/CallView.h b/Classes/CallView.h index 756a32cd4..c77144f9d 100644 --- a/Classes/CallView.h +++ b/Classes/CallView.h @@ -50,8 +50,6 @@ @property(nonatomic, strong) IBOutlet UIView *videoPreview; @property(nonatomic, strong) IBOutlet UICamSwitch *videoCameraSwitch; @property(nonatomic, strong) IBOutlet UIActivityIndicatorView *videoWaitingForFirstImage; -@property(weak, nonatomic) IBOutlet UIView *tabBarView; - @property(weak, nonatomic) IBOutlet UIView *callView; @property(nonatomic, strong) IBOutlet UIPauseButton *pauseButton; diff --git a/Classes/CallView.m b/Classes/CallView.m index f8ba1009f..9e7da6abf 100644 --- a/Classes/CallView.m +++ b/Classes/CallView.m @@ -287,8 +287,9 @@ static UICompositeViewDescription *compositeDescription = nil; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.35]; - _pausedCallsTable.tableView.alpha = _videoCameraSwitch.alpha = _tabBarView.alpha = _pauseButton.alpha = 1.0; - _nameLabel.alpha = _durationLabel.alpha = .3; + _pausedCallsTable.tableView.alpha = _videoCameraSwitch.alpha = _pauseButton.alpha = 1.0; + _routesView.alpha = _optionsView.alpha = _numpadView.alpha = _bottomBar.alpha = 1.0; + _nameLabel.alpha = _durationLabel.alpha = .8; CGRect newFrame = self.view.frame; newFrame.size.height -= _bottomBar.frame.size.height; @@ -320,8 +321,9 @@ static UICompositeViewDescription *compositeDescription = nil; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; - _pausedCallsTable.tableView.alpha = _videoCameraSwitch.alpha = _tabBarView.alpha = _nameLabel.alpha = - _durationLabel.alpha = _pauseButton.alpha = 0.0; + _pausedCallsTable.tableView.alpha = _videoCameraSwitch.alpha = _nameLabel.alpha = _durationLabel.alpha = + _pauseButton.alpha = 0.0; + _routesView.alpha = _optionsView.alpha = _numpadView.alpha = _bottomBar.alpha = 0.0; CGRect newFrame = self.view.frame; _callView.frame = newFrame; @@ -442,7 +444,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { LinphoneCall *call = linphone_core_get_current_call(lc); _noActiveCallView.hidden = (call || linphone_core_is_in_conference(lc)); - _callView.hidden = !call; + _callView.hidden = _pauseButton.hidden = !call; _conferenceView.hidden = !linphone_core_is_in_conference(lc); if (!_callView.hidden) { diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.m b/Classes/LinphoneUI/UIChatBubblePhotoCell.m index 4215fc659..512f150f1 100644 --- a/Classes/LinphoneUI/UIChatBubblePhotoCell.m +++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.m @@ -80,11 +80,11 @@ } - (void)update { - [super update]; if (self.message == nil) { LOGW(@"Cannot update message room cell: NULL message"); return; } + [super update]; LinphoneChatMessageState state = linphone_chat_message_get_state(self.message); if (state == LinphoneChatMessageStateDelivered || state == LinphoneChatMessageStateNotDelivered) { diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.xib b/Classes/LinphoneUI/UIChatBubblePhotoCell.xib index 4fd57d8bc..ef07d0da3 100644 --- a/Classes/LinphoneUI/UIChatBubblePhotoCell.xib +++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.xib @@ -67,6 +67,9 @@ + + + - + @@ -84,7 +87,7 @@