mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 17:59:21 +00:00
Only hide the volume view when the InCall view appears and until further call updates arrive.
This commit is contained in:
parent
5f931de1cb
commit
4410655111
3 changed files with 31 additions and 3 deletions
|
|
@ -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];
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue