mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Call: use call_encryption_changed callback to invoke zrtp confirmation dialog only once (in progress)
This commit is contained in:
parent
6d602049b3
commit
f9e82efd6b
5 changed files with 67 additions and 31 deletions
|
|
@ -51,6 +51,7 @@ extern NSString *const kLinphoneBluetoothAvailabilityUpdate;
|
|||
extern NSString *const kLinphoneConfiguringStateUpdate;
|
||||
extern NSString *const kLinphoneGlobalStateUpdate;
|
||||
extern NSString *const kLinphoneNotifyReceived;
|
||||
extern NSString *const kLinphoneCallEncryptionChanged;
|
||||
extern NSString *const kLinphoneFileTransferSendUpdate;
|
||||
extern NSString *const kLinphoneFileTransferRecvUpdate;
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ NSString *const kLinphoneBluetoothAvailabilityUpdate = @"LinphoneBluetoothAvaila
|
|||
NSString *const kLinphoneConfiguringStateUpdate = @"LinphoneConfiguringStateUpdate";
|
||||
NSString *const kLinphoneGlobalStateUpdate = @"LinphoneGlobalStateUpdate";
|
||||
NSString *const kLinphoneNotifyReceived = @"LinphoneNotifyReceived";
|
||||
NSString *const kLinphoneCallEncryptionChanged = @"LinphoneCallEncryptionChanged";
|
||||
NSString *const kLinphoneFileTransferSendUpdate = @"LinphoneFileTransferSendUpdate";
|
||||
NSString *const kLinphoneFileTransferRecvUpdate = @"LinphoneFileTransferRecvUpdate";
|
||||
|
||||
|
|
@ -986,6 +987,28 @@ static void linphone_iphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev
|
|||
content:body];
|
||||
}
|
||||
|
||||
static void linphone_iphone_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t on,
|
||||
const char *authentication_token) {
|
||||
[(__bridge LinphoneManager *)linphone_core_get_user_data(lc) onCallEncryptionChanged:lc
|
||||
call:call
|
||||
on:on
|
||||
token:authentication_token];
|
||||
}
|
||||
|
||||
- (void)onCallEncryptionChanged:(LinphoneCore *)lc
|
||||
call:(LinphoneCall *)call
|
||||
on:(BOOL)on
|
||||
token:(const char *)authentication_token {
|
||||
// Post event
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
||||
[dict setObject:[NSValue valueWithPointer:call] forKey:@"call"];
|
||||
[dict setObject:[NSNumber numberWithBool:on] forKey:@"on"];
|
||||
[dict setObject:[NSString stringWithUTF8String:authentication_token] forKey:@"token"];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallEncryptionChanged
|
||||
object:self
|
||||
userInfo:dict];
|
||||
}
|
||||
|
||||
#pragma mark - Message composition start
|
||||
|
||||
- (void)onMessageComposeReceived:(LinphoneCore *)core forRoom:(LinphoneChatRoom *)room {
|
||||
|
|
@ -1258,25 +1281,27 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
|
||||
#pragma mark - VTable
|
||||
|
||||
static LinphoneCoreVTable linphonec_vtable = {.show = NULL,
|
||||
.call_state_changed =
|
||||
(LinphoneCoreCallStateChangedCb)linphone_iphone_call_state,
|
||||
.registration_state_changed = linphone_iphone_registration_state,
|
||||
.notify_presence_received = NULL,
|
||||
.new_subscription_requested = NULL,
|
||||
.auth_info_requested = linphone_iphone_popup_password_request,
|
||||
.display_status = linphone_iphone_display_status,
|
||||
.display_message = linphone_iphone_log_user_info,
|
||||
.display_warning = linphone_iphone_log_user_warning,
|
||||
.display_url = NULL,
|
||||
.text_received = NULL,
|
||||
.message_received = linphone_iphone_message_received,
|
||||
.dtmf_received = NULL,
|
||||
.transfer_state_changed = linphone_iphone_transfer_state_changed,
|
||||
.is_composing_received = linphone_iphone_is_composing_received,
|
||||
.configuring_status = linphone_iphone_configuring_status_changed,
|
||||
.global_state_changed = linphone_iphone_global_state_changed,
|
||||
.notify_received = linphone_iphone_notify_received};
|
||||
static LinphoneCoreVTable linphonec_vtable = {
|
||||
.show = NULL,
|
||||
.call_state_changed = (LinphoneCoreCallStateChangedCb)linphone_iphone_call_state,
|
||||
.registration_state_changed = linphone_iphone_registration_state,
|
||||
.notify_presence_received = NULL,
|
||||
.new_subscription_requested = NULL,
|
||||
.auth_info_requested = linphone_iphone_popup_password_request,
|
||||
.display_status = linphone_iphone_display_status,
|
||||
.display_message = linphone_iphone_log_user_info,
|
||||
.display_warning = linphone_iphone_log_user_warning,
|
||||
.display_url = NULL,
|
||||
.text_received = NULL,
|
||||
.message_received = linphone_iphone_message_received,
|
||||
.dtmf_received = NULL,
|
||||
.transfer_state_changed = linphone_iphone_transfer_state_changed,
|
||||
.is_composing_received = linphone_iphone_is_composing_received,
|
||||
.configuring_status = linphone_iphone_configuring_status_changed,
|
||||
.global_state_changed = linphone_iphone_global_state_changed,
|
||||
.notify_received = linphone_iphone_notify_received,
|
||||
.call_encryption_changed = linphone_iphone_call_encryption_changed,
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,10 @@
|
|||
selector:@selector(callUpdate:)
|
||||
name:kLinphoneCallUpdate
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(onCallEncryptionChanged:)
|
||||
name:kLinphoneCallEncryptionChanged
|
||||
object:nil];
|
||||
|
||||
// Update to default state
|
||||
LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
|
||||
|
|
@ -101,6 +105,17 @@
|
|||
[self registrationUpdate:notif];
|
||||
}
|
||||
|
||||
- (void)onCallEncryptionChanged:(NSNotification *)notif {
|
||||
LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
|
||||
;
|
||||
|
||||
if (call && (linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)) ==
|
||||
LinphoneMediaEncryptionZRTP) &&
|
||||
(!linphone_call_get_authentication_token_verified(call))) {
|
||||
[self onSecurityClick:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notifyReceived:(NSNotification *)notif {
|
||||
const LinphoneContent *content = [[notif.userInfo objectForKey:@"content"] pointerValue];
|
||||
|
||||
|
|
@ -135,12 +150,6 @@
|
|||
// show voice mail only when there is no call
|
||||
[self updateUI:linphone_core_get_calls([LinphoneManager getLc]) != NULL];
|
||||
[self updateVoicemail];
|
||||
|
||||
LinphoneCall *currentCall = linphone_core_get_current_call([LinphoneManager getLc]);
|
||||
if (currentCall && !linphone_call_get_authentication_token_verified(currentCall) &&
|
||||
linphone_call_get_state(currentCall) == LinphoneCallStreamsRunning) {
|
||||
[self onSecurityClick:nil];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
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];
|
||||
|
||||
|
|
|
|||
|
|
@ -16,22 +16,22 @@
|
|||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="2Vb-Xy-rci" userLabel="view">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" alpha="0.89999999999999991" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_C.png" id="cqN-1f-6SE" userLabel="backgroundColor">
|
||||
<rect key="frame" x="0.0" y="0.0" width="377" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Are you sure you want to delete all your selection?" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="jLz-g1-cTe" userLabel="titleLabel">
|
||||
<rect key="frame" x="28" y="168" width="319" height="118"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="B1K-CB-3of" userLabel="cancelButton" customClass="UIRoundBorderedButton">
|
||||
<rect key="frame" x="28" y="319" width="141" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="CANCEL" backgroundImage="color_F.png">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="SbQ-re-fGQ" userLabel="confirmationButton" customClass="UIRoundBorderedButton">
|
||||
<rect key="frame" x="206" y="319" width="141" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="DELETE" backgroundImage="color_A.png">
|
||||
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="simulatedStatusBarMetrics"/>
|
||||
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<point key="canvasLocation" x="545.5" y="291.5"/>
|
||||
</view>
|
||||
</objects>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue