forked from mirrors/linphone-iphone
Call: fix video on/off UI bug
This commit is contained in:
parent
9b72bf00ce
commit
774ff0bb8f
11 changed files with 81 additions and 44 deletions
|
|
@ -123,7 +123,7 @@
|
|||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" tag="7" contentMode="scaleAspectFit" image="avatar.png" id="fZy-K5-yQp" userLabel="avatarImage" customClass="UIRoundedImageView">
|
||||
<rect key="frame" x="62" y="140" width="250" height="250"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<accessibility key="accessibilityConfiguration" label="Contact avatar">
|
||||
<accessibilityTraits key="traits" none="YES" image="YES" notEnabled="YES"/>
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@
|
|||
<bool key="isElement" value="YES"/>
|
||||
</accessibility>
|
||||
</imageView>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="John Doe" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="25" userLabel="contactLabel">
|
||||
<rect key="frame" x="0.0" y="110" width="375" height="30"/>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="John Doe" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="17" id="25" userLabel="contactLabel">
|
||||
<rect key="frame" x="0.0" y="110" width="375" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<accessibility key="accessibilityConfiguration" label="Contact name"/>
|
||||
|
|
@ -94,8 +94,17 @@
|
|||
<bool key="isElement" value="YES"/>
|
||||
</accessibility>
|
||||
</imageView>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="johndoe@sip.linphone.org" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="EoB-ux-sD7" userLabel="addressLabel">
|
||||
<rect key="frame" x="0.0" y="158" width="375" height="23"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<accessibility key="accessibilityConfiguration" label="Contact name"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
||||
<color key="textColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="obZ-W7-q8P" userLabel="chatButton">
|
||||
<rect key="frame" x="202" y="173" width="51" height="51"/>
|
||||
<rect key="frame" x="202" y="189" width="51" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<state key="normal" title="Button" image="chat_start_body_default.png">
|
||||
|
|
@ -107,17 +116,8 @@
|
|||
<action selector="onChatClick:" destination="-1" eventType="touchUpInside" id="Dd5-7a-ev8"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="johndoe@sip.linphone.org" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="EoB-ux-sD7" userLabel="addressLabel">
|
||||
<rect key="frame" x="0.0" y="134" width="375" height="37"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<accessibility key="accessibilityConfiguration" label="Contact name"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
||||
<color key="textColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="5eX-W0-T4B" userLabel="callButton">
|
||||
<rect key="frame" x="122" y="173" width="51" height="51"/>
|
||||
<rect key="frame" x="122" y="189" width="51" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<state key="normal" title="Button" image="call_start_body_default.png">
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
@private
|
||||
UITapGestureRecognizer *singleFingerTap;
|
||||
NSTimer *hideControlsTimer;
|
||||
NSTimer *videoDismissTimer;
|
||||
BOOL videoShown;
|
||||
VideoZoomHandler *videoZoomHandler;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,12 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
hiddenVolume = FALSE;
|
||||
}
|
||||
|
||||
if (videoDismissTimer) {
|
||||
[self dismissVideoActionSheet:videoDismissTimer];
|
||||
[videoDismissTimer invalidate];
|
||||
videoDismissTimer = nil;
|
||||
}
|
||||
|
||||
// Remove observer
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCallUpdate object:nil];
|
||||
}
|
||||
|
|
@ -284,7 +290,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
hideControlsTimer = nil;
|
||||
}
|
||||
|
||||
if ([[PhoneMainView.instance currentView] equal:CallView.compositeViewDescription] && videoShown) {
|
||||
if ([[PhoneMainView.instance currentView] equal:CallView.compositeViewDescription]) {
|
||||
// show controls
|
||||
|
||||
[UIView beginAnimations:nil context:nil];
|
||||
|
|
@ -317,7 +323,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
hideControlsTimer = nil;
|
||||
}
|
||||
|
||||
if ([[PhoneMainView.instance currentView] equal:CallView.compositeViewDescription] && videoShown) {
|
||||
if ([[PhoneMainView.instance currentView] equal:CallView.compositeViewDescription]) {
|
||||
[PhoneMainView.instance showTabBar:false];
|
||||
[PhoneMainView.instance showStatusBar:false];
|
||||
|
||||
|
|
@ -674,30 +680,36 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
|
|||
|
||||
NSString *username = [FastAddressBook displayNameForAddress:linphone_call_get_remote_address(call)];
|
||||
NSString *title = [NSString stringWithFormat:NSLocalizedString(@"%@ would like to enable video", nil), username];
|
||||
NSTimer *timer;
|
||||
UIConfirmationDialog *sheet = [UIConfirmationDialog ShowWithMessage:title
|
||||
cancelMessage:nil
|
||||
confirmMessage:NSLocalizedString(@"ACCEPT", nil)
|
||||
onCancelClick:^() {
|
||||
LOGI(@"User declined video proposal");
|
||||
LinphoneCallParams *paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call));
|
||||
linphone_core_accept_call_update([LinphoneManager getLc], call, paramsCopy);
|
||||
linphone_call_params_destroy(paramsCopy);
|
||||
[timer invalidate];
|
||||
if (call == linphone_core_get_current_call([LinphoneManager getLc])) {
|
||||
LinphoneCallParams *paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call));
|
||||
linphone_core_accept_call_update([LinphoneManager getLc], call, paramsCopy);
|
||||
linphone_call_params_destroy(paramsCopy);
|
||||
[videoDismissTimer invalidate];
|
||||
videoDismissTimer = nil;
|
||||
}
|
||||
}
|
||||
onConfirmationClick:^() {
|
||||
LOGI(@"User accept video proposal");
|
||||
LinphoneCallParams *paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call));
|
||||
linphone_call_params_enable_video(paramsCopy, TRUE);
|
||||
linphone_core_accept_call_update([LinphoneManager getLc], call, paramsCopy);
|
||||
linphone_call_params_destroy(paramsCopy);
|
||||
[timer invalidate];
|
||||
}];
|
||||
timer = [NSTimer scheduledTimerWithTimeInterval:30
|
||||
target:self
|
||||
selector:@selector(dismissVideoActionSheet:)
|
||||
userInfo:sheet
|
||||
repeats:NO];
|
||||
if (call == linphone_core_get_current_call([LinphoneManager getLc])) {
|
||||
LinphoneCallParams *paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call));
|
||||
linphone_call_params_enable_video(paramsCopy, TRUE);
|
||||
linphone_core_accept_call_update([LinphoneManager getLc], call, paramsCopy);
|
||||
linphone_call_params_destroy(paramsCopy);
|
||||
[videoDismissTimer invalidate];
|
||||
videoDismissTimer = nil;
|
||||
}
|
||||
}
|
||||
inController:self];
|
||||
videoDismissTimer = [NSTimer scheduledTimerWithTimeInterval:30
|
||||
target:self
|
||||
selector:@selector(dismissVideoActionSheet:)
|
||||
userInfo:sheet
|
||||
repeats:NO];
|
||||
}
|
||||
|
||||
- (void)dismissVideoActionSheet:(NSTimer *)timer {
|
||||
|
|
|
|||
|
|
@ -347,8 +347,10 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (void)call:(NSString *)address {
|
||||
ABRecordRef contact = [FastAddressBook getContact:address];
|
||||
NSString *displayName = contact ? [FastAddressBook displayNameForContact:contact] : nil;
|
||||
LinphoneAddress *addr = linphone_address_new(address.UTF8String);
|
||||
NSString *displayName = addr ? [FastAddressBook displayNameForAddress:addr] : nil;
|
||||
if (addr)
|
||||
linphone_address_destroy(addr);
|
||||
[self call:address displayName:displayName];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,10 +138,9 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog);
|
||||
ABRecordRef contact = [FastAddressBook getContactWithAddress:addr];
|
||||
_addContactButton.hidden = (contact != nil);
|
||||
_addContactButton.hidden = ([FastAddressBook getContactWithAddress:addr] != nil);
|
||||
[ContactDisplay setDisplayNameLabel:_contactLabel forAddress:addr];
|
||||
[_avatarImage setImage:[FastAddressBook imageForContact:contact thumbnail:NO] bordered:NO withRoundedRadius:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:NO] bordered:NO withRoundedRadius:YES];
|
||||
char *addrURI = linphone_address_as_string_uri_only(addr);
|
||||
_addressLabel.text = [NSString stringWithUTF8String:addrURI];
|
||||
ms_free(addrURI);
|
||||
|
|
|
|||
|
|
@ -231,6 +231,9 @@
|
|||
[callSecurityTimer invalidate];
|
||||
callSecurityTimer = nil;
|
||||
}
|
||||
if (securityDialog) {
|
||||
[securityDialog dismiss];
|
||||
}
|
||||
|
||||
// if we are in call, we have to update quality and security icons every sec
|
||||
if (inCall) {
|
||||
|
|
|
|||
|
|
@ -87,8 +87,10 @@
|
|||
}
|
||||
|
||||
if ([address length] > 0) {
|
||||
ABRecordRef contact = [FastAddressBook getContact:address];
|
||||
NSString *displayName = contact ? [FastAddressBook displayNameForContact:contact] : nil;
|
||||
LinphoneAddress *addr = linphone_address_new(address.UTF8String);
|
||||
NSString *displayName = addr ? [FastAddressBook displayNameForAddress:addr] : nil;
|
||||
if (addr)
|
||||
linphone_address_destroy(addr);
|
||||
[LinphoneManager.instance call:address displayName:displayName transfer:FALSE];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ typedef void (^UIConfirmationBlock)(void);
|
|||
confirmMessage:(NSString *)confirm
|
||||
onCancelClick:(UIConfirmationBlock)onCancel
|
||||
onConfirmationClick:(UIConfirmationBlock)onConfirm;
|
||||
+ (UIConfirmationDialog *)ShowWithMessage:(NSString *)message
|
||||
cancelMessage:(NSString *)cancel
|
||||
confirmMessage:(NSString *)confirm
|
||||
onCancelClick:(UIConfirmationBlock)onCancel
|
||||
onConfirmationClick:(UIConfirmationBlock)onConfirm
|
||||
inController:(UIViewController *)controller;
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UIRoundBorderedButton *cancelButton;
|
||||
@property(weak, nonatomic) IBOutlet UIRoundBorderedButton *confirmationButton;
|
||||
|
|
|
|||
|
|
@ -10,18 +10,18 @@
|
|||
#import "PhoneMainView.h"
|
||||
|
||||
@implementation UIConfirmationDialog
|
||||
|
||||
+ (UIConfirmationDialog *)ShowWithMessage:(NSString *)message
|
||||
cancelMessage:(NSString *)cancel
|
||||
confirmMessage:(NSString *)confirm
|
||||
onCancelClick:(UIConfirmationBlock)onCancel
|
||||
onConfirmationClick:(UIConfirmationBlock)onConfirm {
|
||||
onConfirmationClick:(UIConfirmationBlock)onConfirm
|
||||
inController:(UIViewController *)controller {
|
||||
UIConfirmationDialog *dialog =
|
||||
[[UIConfirmationDialog alloc] initWithNibName:NSStringFromClass(self.class) bundle:NSBundle.mainBundle];
|
||||
|
||||
dialog.view.frame = PhoneMainView.instance.mainViewController.view.frame;
|
||||
[PhoneMainView.instance.mainViewController.view addSubview:dialog.view];
|
||||
[PhoneMainView.instance.mainViewController addChildViewController:dialog];
|
||||
[controller.view addSubview:dialog.view];
|
||||
[controller addChildViewController:dialog];
|
||||
|
||||
dialog->onCancelCb = onCancel;
|
||||
dialog->onConfirmCb = onConfirm;
|
||||
|
|
@ -41,6 +41,19 @@
|
|||
return dialog;
|
||||
}
|
||||
|
||||
+ (UIConfirmationDialog *)ShowWithMessage:(NSString *)message
|
||||
cancelMessage:(NSString *)cancel
|
||||
confirmMessage:(NSString *)confirm
|
||||
onCancelClick:(UIConfirmationBlock)onCancel
|
||||
onConfirmationClick:(UIConfirmationBlock)onConfirm {
|
||||
return [self ShowWithMessage:message
|
||||
cancelMessage:cancel
|
||||
confirmMessage:confirm
|
||||
onCancelClick:onCancel
|
||||
onConfirmationClick:onConfirm
|
||||
inController:PhoneMainView.instance.mainViewController];
|
||||
}
|
||||
|
||||
- (IBAction)onCancelClick:(id)sender {
|
||||
[self.view removeFromSuperview];
|
||||
[self removeFromParentViewController];
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
// TOOLS
|
||||
|
||||
+ (ABRecordRef)getContact:(NSString *)address;
|
||||
+ (ABRecordRef)getContactWithAddress:(const LinphoneAddress *)address;
|
||||
|
||||
+ (UIImage *)imageForContact:(ABRecordRef)contact thumbnail:(BOOL)thumbnail;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue