diff --git a/Classes/InCallViewController.m b/Classes/InCallViewController.m index 34f511a1a..2009b3463 100644 --- a/Classes/InCallViewController.m +++ b/Classes/InCallViewController.m @@ -36,7 +36,9 @@ const NSInteger SECURE_BUTTON_TAG=5; -@implementation InCallViewController +@implementation InCallViewController { + BOOL hiddenVolume; +} @synthesize callTableController; @synthesize callTableView; @@ -116,6 +118,9 @@ static UICompositeViewDescription *compositeDescription = nil; [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; UIDevice *device = [UIDevice currentDevice]; device.proximityMonitoringEnabled = YES; + + [[PhoneMainView instance] setVolumeHidden:TRUE]; + hiddenVolume = TRUE; } - (void)viewWillDisappear:(BOOL)animated { @@ -128,6 +133,10 @@ static UICompositeViewDescription *compositeDescription = nil; [callTableController viewWillDisappear:animated]; } + if( hiddenVolume ) { + [[PhoneMainView instance] setVolumeHidden:FALSE]; + hiddenVolume = FALSE; + } // Remove observer [[NSNotificationCenter defaultCenter] removeObserver:self @@ -211,6 +220,12 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)callUpdate:(LinphoneCall *)call state:(LinphoneCallState)state animated:(BOOL)animated { LinphoneCore *lc = [LinphoneManager getLc]; + + if( hiddenVolume ){ + [[PhoneMainView instance] setVolumeHidden:FALSE]; + hiddenVolume = FALSE; + } + // Update table [callTableView reloadData]; diff --git a/Classes/PhoneMainView.h b/Classes/PhoneMainView.h index 5bdb2fabf..0c1f5edb9 100644 --- a/Classes/PhoneMainView.h +++ b/Classes/PhoneMainView.h @@ -68,6 +68,7 @@ - (void)updateStatusBar:(UICompositeViewDescription*)to_view; - (void)startUp; - (void)displayIncomingCall:(LinphoneCall*) call; +- (void)setVolumeHidden:(BOOL)hidden; - (void)addInhibitedEvent:(id)event; - (BOOL)removeInhibitedEvent:(id)event; diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index baae85c91..f7536afae 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -90,11 +90,9 @@ static PhoneMainView* phoneMainViewInstance=nil; [super viewDidLoad]; - // insert invisible volumeView to prevent iOS from displaying the volume notification all the time. volumeView = [[MPVolumeView alloc] initWithFrame: CGRectMake(-100,-100,16,16)]; volumeView.showsRouteButton = false; volumeView.userInteractionEnabled = false; - [self.view addSubview:volumeView]; [self.view addSubview: mainViewController.view]; } @@ -181,6 +179,20 @@ static PhoneMainView* phoneMainViewInstance=nil; loadCount--; } +- (void)setVolumeHidden:(BOOL)hidden { + // sometimes when placing a call, the volume view will appear. Inserting a + // carefully hidden MPVolumeView into the view hierarchy will hide it + if( hidden ){ + if ( !(volumeView.superview == self.view) ){ + [self.view addSubview:volumeView]; + } + } else { + if( volumeView.superview == self.view ){ + [volumeView removeFromSuperview]; + } + } +} + - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if(interfaceOrientation == self.interfaceOrientation) return YES;