diff --git a/Classes/LinphoneUI/UIVideoButton.h b/Classes/LinphoneUI/UIVideoButton.h index 759911f00..a7b4be5db 100644 --- a/Classes/LinphoneUI/UIVideoButton.h +++ b/Classes/LinphoneUI/UIVideoButton.h @@ -24,9 +24,6 @@ @interface UIVideoButton : UIToggleButton { } -@property (assign) BOOL locked; -@property (assign) BOOL unlockVideoState; - @property (nonatomic, retain) IBOutlet UIActivityIndicatorView* waitView; @end diff --git a/Classes/LinphoneUI/UIVideoButton.m b/Classes/LinphoneUI/UIVideoButton.m index 2368b9bfa..6100bc7da 100644 --- a/Classes/LinphoneUI/UIVideoButton.m +++ b/Classes/LinphoneUI/UIVideoButton.m @@ -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