mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
set new text for SAS security dialog
This commit is contained in:
parent
a388334f01
commit
a58d549b9a
4 changed files with 97 additions and 47 deletions
|
|
@ -1,44 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIConfirmationDialog">
|
||||
<connections>
|
||||
<outlet property="cancelButton" destination="B1K-CB-3of" id="KKi-Xc-ldA"/>
|
||||
<outlet property="confirmationButton" destination="SbQ-re-fGQ" id="yiv-a9-o8E"/>
|
||||
<outlet property="securityImage" destination="bbo-g3-bGy" id="qZa-li-yrl"/>
|
||||
<outlet property="titleLabel" destination="jLz-g1-cTe" id="qaj-OB-2r1"/>
|
||||
<outlet property="view" destination="2Vb-Xy-rci" id="nNw-EJ-AY3"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<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="414" height="736"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<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="416" height="736"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="377" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
</imageView>
|
||||
<view contentMode="scaleToFill" id="2BQ-o9-xv2">
|
||||
<rect key="frame" x="48" y="285" width="320" height="166"/>
|
||||
<rect key="frame" x="28" y="139" width="320" height="365"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<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="4" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="jLz-g1-cTe" userLabel="titleLabel">
|
||||
<rect key="frame" x="-10" y="0.0" width="336" height="118"/>
|
||||
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" insetsLayoutMarginsFromSafeArea="NO" image="security_2_indicator.png" id="bbo-g3-bGy" userLabel="securityImage">
|
||||
<rect key="frame" x="130" y="0.0" width="56" height="68"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="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="0" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="jLz-g1-cTe" userLabel="titleLabel">
|
||||
<rect key="frame" x="-10" y="54" width="336" height="226"/>
|
||||
<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"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="21"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<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="7" y="126" width="142" height="40"/>
|
||||
<rect key="frame" x="8" y="308" width="139" height="42"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="CANCEL" backgroundImage="color_H.png">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</state>
|
||||
<state key="highlighted" backgroundImage="color_F.png"/>
|
||||
<connections>
|
||||
|
|
@ -46,11 +55,11 @@
|
|||
</connections>
|
||||
</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="169" y="126" width="142" height="40"/>
|
||||
<rect key="frame" x="169" y="308" width="143" height="42"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="DELETE" backgroundImage="color_I.png">
|
||||
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</state>
|
||||
<state key="highlighted" backgroundImage="color_M.png"/>
|
||||
<connections>
|
||||
|
|
@ -60,10 +69,9 @@
|
|||
</subviews>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="simulatedStatusBarMetrics"/>
|
||||
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina55"/>
|
||||
<point key="canvasLocation" x="545" y="291"/>
|
||||
<point key="canvasLocation" x="872" y="261.76911544227886"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
|
|
@ -72,5 +80,6 @@
|
|||
<image name="color_H.png" width="2" height="2"/>
|
||||
<image name="color_I.png" width="2" height="2"/>
|
||||
<image name="color_M.png" width="2" height="2"/>
|
||||
<image name="security_2_indicator.png" width="27" height="32"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
|
|||
|
|
@ -330,12 +330,13 @@
|
|||
myCode = [code substringFromIndex:2];
|
||||
}
|
||||
NSString *message =
|
||||
[NSString stringWithFormat:NSLocalizedString(@"Confirm the following SAS with peer:\n"
|
||||
@"Say : %@\n"
|
||||
@"Your correspondant should say : %@",
|
||||
[NSString stringWithFormat:NSLocalizedString(@"Confirmation security\n\n"
|
||||
@"Say: %@\n"
|
||||
@"Confirm that your interlocutor\n"
|
||||
@"says: %@",
|
||||
nil),
|
||||
myCode, correspondantCode];
|
||||
|
||||
myCode.uppercaseString, correspondantCode.uppercaseString];
|
||||
|
||||
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive &&
|
||||
floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) {
|
||||
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
|
||||
|
|
@ -361,7 +362,18 @@
|
|||
} else {
|
||||
if (securityDialog == nil) {
|
||||
__block __strong StatusBarView *weakSelf = self;
|
||||
securityDialog = [UIConfirmationDialog ShowWithMessage:message
|
||||
// define font of message
|
||||
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:message];
|
||||
NSUInteger length = [message length];
|
||||
UIFont *baseFont = [UIFont systemFontOfSize:21.0];
|
||||
[attrString addAttribute:NSFontAttributeName value:baseFont range:NSMakeRange(0, length)];
|
||||
UIFont *boldFont = [UIFont boldSystemFontOfSize:23.0];
|
||||
[attrString addAttribute:NSFontAttributeName value:boldFont range:[message rangeOfString:@"Confirmation security"]];
|
||||
UIColor *color = [UIColor colorWithRed:(150 / 255.0) green:(193 / 255.0) blue:(31 / 255.0) alpha:1.0];
|
||||
[attrString addAttribute:NSForegroundColorAttributeName value:color range:[message rangeOfString:myCode.uppercaseString]];
|
||||
[attrString addAttribute:NSForegroundColorAttributeName value:color range:[message rangeOfString:correspondantCode.uppercaseString]];
|
||||
|
||||
securityDialog = [UIConfirmationDialog ShowWithAttributedMessage:attrString
|
||||
cancelMessage:NSLocalizedString(@"DENY", nil)
|
||||
confirmMessage:NSLocalizedString(@"ACCEPT", nil)
|
||||
onCancelClick:^() {
|
||||
|
|
@ -375,7 +387,9 @@
|
|||
linphone_call_set_authentication_token_verified(call, YES);
|
||||
}
|
||||
weakSelf->securityDialog = nil;
|
||||
}];
|
||||
} ];
|
||||
|
||||
securityDialog.securityImage.hidden = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,14 @@ typedef void (^UIConfirmationBlock)(void);
|
|||
onCancelClick:(UIConfirmationBlock)onCancel
|
||||
onConfirmationClick:(UIConfirmationBlock)onConfirm
|
||||
inController:(UIViewController *)controller;
|
||||
+ (UIConfirmationDialog *)ShowWithAttributedMessage:(NSMutableAttributedString *)attributedText
|
||||
cancelMessage:(NSString *)cancel
|
||||
confirmMessage:(NSString *)confirm
|
||||
onCancelClick:(UIConfirmationBlock)onCancel
|
||||
onConfirmationClick:(UIConfirmationBlock)onConfirm;
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UIRoundBorderedButton *cancelButton;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *securityImage;
|
||||
@property(weak, nonatomic) IBOutlet UIRoundBorderedButton *confirmationButton;
|
||||
@property(weak, nonatomic) IBOutlet UILabel *titleLabel;
|
||||
- (IBAction)onCancelClick:(id)sender;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,35 @@
|
|||
#import "PhoneMainView.h"
|
||||
|
||||
@implementation UIConfirmationDialog
|
||||
+ (UIConfirmationDialog *)initDialog:(NSString *)cancel
|
||||
confirmMessage:(NSString *)confirm
|
||||
onCancelClick:(UIConfirmationBlock)onCancel
|
||||
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;
|
||||
[controller.view addSubview:dialog.view];
|
||||
[controller addChildViewController:dialog];
|
||||
|
||||
dialog->onCancelCb = onCancel;
|
||||
dialog->onConfirmCb = onConfirm;
|
||||
|
||||
if (cancel) {
|
||||
[dialog.cancelButton setTitle:cancel forState:UIControlStateNormal];
|
||||
}
|
||||
if (confirm) {
|
||||
[dialog.confirmationButton setTitle:confirm forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
dialog.confirmationButton.layer.borderColor =
|
||||
[[UIColor colorWithPatternImage:[UIImage imageNamed:@"color_A.png"]] CGColor];
|
||||
dialog.cancelButton.layer.borderColor =
|
||||
[[UIColor colorWithPatternImage:[UIImage imageNamed:@"color_F.png"]] CGColor];
|
||||
return dialog;
|
||||
}
|
||||
|
||||
+ (UIConfirmationDialog *)ShowWithMessage:(NSString *)message
|
||||
cancelMessage:(NSString *)cancel
|
||||
confirmMessage:(NSString *)confirm
|
||||
|
|
@ -17,27 +46,8 @@
|
|||
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;
|
||||
[controller.view addSubview:dialog.view];
|
||||
[controller addChildViewController:dialog];
|
||||
|
||||
dialog->onCancelCb = onCancel;
|
||||
dialog->onConfirmCb = onConfirm;
|
||||
|
||||
[dialog.titleLabel setText:message];
|
||||
if (cancel) {
|
||||
[dialog.cancelButton setTitle:cancel forState:UIControlStateNormal];
|
||||
}
|
||||
if (confirm) {
|
||||
[dialog.confirmationButton setTitle:confirm forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
dialog.confirmationButton.layer.borderColor =
|
||||
[[UIColor colorWithPatternImage:[UIImage imageNamed:@"color_A.png"]] CGColor];
|
||||
dialog.cancelButton.layer.borderColor =
|
||||
[[UIColor colorWithPatternImage:[UIImage imageNamed:@"color_F.png"]] CGColor];
|
||||
[UIConfirmationDialog initDialog:cancel confirmMessage:confirm onCancelClick:onCancel onConfirmationClick:onConfirm inController:controller];
|
||||
[dialog.titleLabel setText:message];
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
|
@ -54,6 +64,17 @@
|
|||
inController:PhoneMainView.instance.mainViewController];
|
||||
}
|
||||
|
||||
+ (UIConfirmationDialog *)ShowWithAttributedMessage:(NSMutableAttributedString *)attributedText
|
||||
cancelMessage:(NSString *)cancel
|
||||
confirmMessage:(NSString *)confirm
|
||||
onCancelClick:(UIConfirmationBlock)onCancel
|
||||
onConfirmationClick:(UIConfirmationBlock)onConfirm {
|
||||
UIConfirmationDialog *dialog =
|
||||
[UIConfirmationDialog initDialog:cancel confirmMessage:confirm onCancelClick:onCancel onConfirmationClick:onConfirm inController:PhoneMainView.instance.mainViewController];
|
||||
dialog.titleLabel.attributedText = attributedText;
|
||||
return dialog;
|
||||
}
|
||||
|
||||
- (IBAction)onCancelClick:(id)sender {
|
||||
[self.view removeFromSuperview];
|
||||
[self removeFromParentViewController];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue