mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 08:39:20 +00:00
Fix video button disabled state
This commit is contained in:
parent
357849ecc1
commit
f2c47fd45d
2 changed files with 19 additions and 28 deletions
|
|
@ -24,9 +24,6 @@
|
|||
@interface UIVideoButton : UIToggleButton<UIToggleButtonDelegate> {
|
||||
}
|
||||
|
||||
@property (assign) BOOL locked;
|
||||
@property (assign) BOOL unlockVideoState;
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UIActivityIndicatorView* waitView;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -22,13 +22,9 @@
|
|||
|
||||
@implementation UIVideoButton
|
||||
|
||||
@synthesize locked;
|
||||
@synthesize unlockVideoState;
|
||||
@synthesize waitView;
|
||||
|
||||
- (void)initUIVideoButton {
|
||||
locked = FALSE;
|
||||
unlockVideoState = FALSE;
|
||||
}
|
||||
|
||||
- (id)init{
|
||||
|
|
@ -68,8 +64,6 @@
|
|||
|
||||
[self setEnabled: FALSE];
|
||||
[waitView startAnimating];
|
||||
[self setLocked: TRUE];
|
||||
[self setUnlockVideoState: TRUE];
|
||||
|
||||
LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]);
|
||||
if (call) {
|
||||
|
|
@ -95,8 +89,6 @@
|
|||
|
||||
[self setEnabled: FALSE];
|
||||
[waitView startAnimating];
|
||||
[self setLocked: TRUE];
|
||||
[self setUnlockVideoState: FALSE];
|
||||
|
||||
LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]);
|
||||
if (call) {
|
||||
|
|
@ -116,26 +108,28 @@
|
|||
LinphoneCall* currentCall = linphone_core_get_current_call([LinphoneManager getLc]);
|
||||
if (currentCall) {
|
||||
LinphoneCallState state = linphone_call_get_state(currentCall);
|
||||
if (state == LinphoneCallStreamsRunning || state == LinphoneCallUpdated || state == LinphoneCallUpdatedByRemote) {
|
||||
if (linphone_call_params_video_enabled(linphone_call_get_current_params(currentCall))) {
|
||||
val = true;
|
||||
if(locked && unlockVideoState) {
|
||||
locked = FALSE;
|
||||
[waitView stopAnimating];
|
||||
}
|
||||
} else {
|
||||
if(locked && !unlockVideoState) {
|
||||
locked = FALSE;
|
||||
[waitView stopAnimating];
|
||||
}
|
||||
switch (state) {
|
||||
case LinphoneCallUpdated:
|
||||
{
|
||||
[waitView stopAnimating];
|
||||
}
|
||||
if(!locked) {
|
||||
case LinphoneCallStreamsRunning:
|
||||
{
|
||||
[self setEnabled:TRUE];
|
||||
if (linphone_call_params_video_enabled(linphone_call_get_current_params(currentCall))) {
|
||||
val = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Disable button if the call is not running
|
||||
[self setEnabled:FALSE];
|
||||
[waitView stopAnimating];
|
||||
|
||||
default:
|
||||
{
|
||||
// Disable button if the call is not running
|
||||
[self setEnabled:FALSE];
|
||||
[waitView stopAnimating];
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
// Disable button if there is no call
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue