linphonerc: add support for unauthorized_views and fallback_view

This commit is contained in:
Gautier Pelloux-Prayer 2015-11-25 15:49:27 +01:00
parent fc6fb9701e
commit 15ccbeebbe
2 changed files with 16 additions and 1 deletions

View file

@ -561,13 +561,26 @@ static RootViewManager *rootViewManagerInstance = nil;
[self _changeCurrentView:view transition:nil animated:animated];
}
- (BOOL)isUnauthorizedView:(UICompositeViewDescription *)view {
return [[LinphoneManager.instance lpConfigStringForKey:@"unauthorized_views"] containsString:view.content];
}
- (UIViewController *)_changeCurrentView:(UICompositeViewDescription *)view
transition:(CATransition *)transition
animated:(BOOL)animated {
PhoneMainView *vc = [[RootViewManager instance] setViewControllerForDescription:view];
if ([self isUnauthorizedView:view]) {
NSString *fallback = [LinphoneManager.instance lpConfigStringForKey:@"fallback_view"];
UICompositeViewDescription *fallback_view = DialerView.compositeViewDescription;
if (fallback && [NSClassFromString(fallback) respondsToSelector:@selector(compositeViewDescription)]) {
fallback_view = [NSClassFromString(fallback) performSelector:@selector(compositeViewDescription)];
}
LOGW(@"Trying to access unauthorized view %@, going back to %@", view.content, fallback_view.content);
view = fallback_view;
}
if (![view equal:vc.currentView] || vc != self) {
LOGI(@"PhoneMainView: Change current view to %@", [view content]);
LOGI(@"Change current view to %@", [view content]);
if (animated && transition == nil)
transition = [PhoneMainView getTransition:vc.currentView new:view];
[vc.mainViewController setViewTransition:(animated ? transition : nil)];

View file

@ -17,6 +17,8 @@ display_filter_auto_rotate=0
#contact_filter_on_default_domain=1
#use_phone_number=0
send_logs_include_linphonerc_and_chathistory=0
fallback_view=DialerView
unauthorized_views=FirstView
[assistant]
username_regex=^[a-z0-9_.\-]*$