Skip to content

Commit

Permalink
misc: fix call views workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bagage committed Jan 18, 2016
1 parent 9c9d1ff commit 134b420
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 0 additions & 1 deletion Classes/CallOutgoingView.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ - (IBAction)onDeclineClick:(id)sender {
if (call) {
linphone_core_terminate_call(LC, call);
}
[PhoneMainView.instance popCurrentView];
}

- (void)hideRoutes:(BOOL)hidden animated:(BOOL)animated {
Expand Down
21 changes: 14 additions & 7 deletions Classes/PhoneMainView.m
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ - (void)callUpdate:(NSNotification *)notif {
case LinphoneCallPausedByRemote:
case LinphoneCallConnected:
case LinphoneCallStreamsRunning: {
if ((currentView == CallView.compositeViewDescription) ||
(currentView == CallIncomingView.compositeViewDescription) ||
(currentView == CallOutgoingView.compositeViewDescription)) {
[self popCurrentView];
}
[self changeCurrentView:CallView.compositeViewDescription];
break;
}
Expand All @@ -340,9 +345,9 @@ - (void)callUpdate:(NSNotification *)notif {
case LinphoneCallEnd: {
const MSList *calls = linphone_core_get_calls(LC);
if (calls == NULL) {
if ((currentView == CallView.compositeViewDescription) ||
(currentView == CallIncomingView.compositeViewDescription) ||
(currentView == CallOutgoingView.compositeViewDescription)) {
while ((currentView == CallView.compositeViewDescription) ||
(currentView == CallIncomingView.compositeViewDescription) ||
(currentView == CallOutgoingView.compositeViewDescription)) {
[self popCurrentView];
}
} else {
Expand Down Expand Up @@ -537,10 +542,12 @@ - (UIViewController *)popCurrentView {
NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack;
if (viewStack.count <= 1) {
[viewStack removeAllObjects];
LOGW(@"PhoneMainView: Trying to pop view but none stacked, going to %@!", DialerView.compositeViewDescription);
LOGW(@"PhoneMainView: Trying to pop view but none stacked, going to %@!",
DialerView.compositeViewDescription.name);
} else {
[viewStack removeLastObject];
LOGI(@"PhoneMainView: Popping view %@, going to %@", currentView, viewStack.lastObject);
LOGI(@"PhoneMainView: Popping view %@, going to %@", currentView.name,
((UICompositeViewDescription *)(viewStack.lastObject ?: DialerView.compositeViewDescription)).name);
}
[self _changeCurrentView:viewStack.lastObject ?: DialerView.compositeViewDescription
transition:[PhoneMainView getBackwardTransition]
Expand All @@ -549,8 +556,6 @@ - (UIViewController *)popCurrentView {
}

- (void)changeCurrentView:(UICompositeViewDescription *)view {
NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack;
[viewStack addObject:view];
[self _changeCurrentView:view transition:nil animated:ANIMATED];
}

Expand All @@ -560,6 +565,8 @@ - (UIViewController *)_changeCurrentView:(UICompositeViewDescription *)view
PhoneMainView *vc = [[RootViewManager instance] setViewControllerForDescription:view];
if (![view equal:vc.currentView] || vc != self) {
LOGI(@"Change current view to %@", view.name);
NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack;
[viewStack addObject:view];
if (animated && transition == nil)
transition = [PhoneMainView getTransition:vc.currentView new:view];
[vc.mainViewController setViewTransition:(animated ? transition : nil)];
Expand Down

0 comments on commit 134b420

Please sign in to comment.