Merge branch 'qrcode' into dev_group_chat [Switch submodule branch]

This commit is contained in:
Benjamin Verdier 2018-06-19 15:50:45 +02:00
commit 7b2f1b70ce
12 changed files with 150 additions and 46 deletions

3
.gitmodules vendored
View file

@ -117,3 +117,6 @@
[submodule "submodules/externals/soci"]
path = submodules/externals/soci
url = git://git.linphone.org/soci
[submodule "submodules/externals/zxing-cpp"]
path = submodules/externals/zxing-cpp
url = git://git.linphone.org/zxing-cpp.git

View file

@ -21,6 +21,7 @@
#import "UICompositeView.h"
#import "TPKeyboardAvoidingScrollView.h"
#import "PhoneMainView.h"
#import <AVFoundation/AVFoundation.h>
@interface AssistantView : UIViewController <UITextFieldDelegate, UICompositeViewDelegate> {
@ -51,6 +52,7 @@
@property(nonatomic, strong) IBOutlet UIView *remoteProvisioningLoginView;
@property(strong, nonatomic) IBOutlet UIView *remoteProvisioningView;
@property (strong, nonatomic) IBOutlet UIView *createAccountActivateSMSView;
@property (strong, nonatomic) IBOutlet UIView *qrCodeView;
@property(nonatomic, strong) IBOutlet UIImageView *welcomeLogoImage;
@property(nonatomic, strong) IBOutlet UIButton *gotoCreateAccountButton;
@ -64,6 +66,7 @@
@property (weak, nonatomic) IBOutlet UILabel *activationSMSText;
@property (weak, nonatomic) IBOutlet UILabel *accountLabel;
@property (weak, nonatomic) IBOutlet UITextField *urlLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *createAccountNextButtonPositionConstraint;
+ (NSString *)StringForXMLRPCError:(const char *)err;
@ -92,6 +95,7 @@
- (IBAction)onLoginClick:(id)sender;
- (IBAction)onRemoteProvisioningLoginClick:(id)sender;
- (IBAction)onRemoteProvisioningDownloadClick:(id)sender;
- (IBAction)onLaunchQRCodeView:(id)sender;
- (IBAction)onCreateAccountCheckActivatedClick:(id)sender;
- (IBAction)onLinkAccountClick:(id)sender;

View file

@ -28,6 +28,7 @@
#import "PhoneMainView.h"
#import "UIAssistantTextField.h"
#import "UITextField+DoneButton.h"
#import "LinphoneAppDelegate.h"
typedef enum _ViewElement {
ViewElement_Username = 100,
@ -134,6 +135,8 @@ static UICompositeViewDescription *compositeDescription = nil;
[_contentView setContentSize:frame.size];
[_contentView contentSizeToFit];
_qrCodeView.frame = [[UIScreen mainScreen] bounds];
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
@ -474,6 +477,13 @@ static UICompositeViewDescription *compositeDescription = nil;
view = _linphoneLoginView;
}
}
if (currentView == _qrCodeView) {
linphone_core_enable_video_preview(LC, FALSE);
linphone_core_enable_qrcode_video_preview(LC, FALSE);
LinphoneAppDelegate *delegate = (LinphoneAppDelegate *)UIApplication.sharedApplication.delegate;
delegate.onlyPortrait = FALSE;
}
// Animation
if (animation && ANIMATED) {
@ -1396,6 +1406,49 @@ void assistant_is_account_linked(LinphoneAccountCreator *creator, LinphoneAccoun
});
}
- (IBAction)onLaunchQRCodeView:(id)sender {
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(qrCodeFound:)
name:kLinphoneQRCodeFound
object:nil];
LinphoneAppDelegate *delegate = (LinphoneAppDelegate *)UIApplication.sharedApplication.delegate;
delegate.onlyPortrait = TRUE;
NSNumber *value = [NSNumber numberWithInt:UIDeviceOrientationPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
//[UIViewController attemptRotationToDeviceOrientation];
AVCaptureDevice *backCamera = [AVCaptureDevice defaultDeviceWithDeviceType:AVCaptureDeviceTypeBuiltInWideAngleCamera mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionBack];
if (![[NSString stringWithUTF8String:linphone_core_get_video_device(LC)] containsString:[backCamera uniqueID]]) {
bctbx_list_t *deviceList = linphone_core_get_video_devices_list(LC);
NSMutableArray *devices = [NSMutableArray array];
while (deviceList) {
char *data = deviceList->data;
[devices addObject:[NSString stringWithUTF8String:data]];
deviceList = deviceList->next;
}
bctbx_list_free(deviceList);
for (NSString *device in devices) {
if ([device containsString:backCamera.uniqueID]) {
linphone_core_set_video_device(LC, device.UTF8String);
}
}
}
linphone_core_set_native_preview_window_id(LC, (__bridge void *)(_qrCodeView));
linphone_core_enable_video_preview(LC, TRUE);
linphone_core_enable_qrcode_video_preview(LC, TRUE);
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(qrCodeFound:)
name:kLinphoneQRCodeFound
object:nil];
[self changeView:_qrCodeView back:FALSE animation:TRUE];
}
- (void)refreshYourUsername {
UIAssistantTextField *username = [self findTextField:ViewElement_Username];
UIAssistantTextField *phone = [self findTextField:ViewElement_Phone];
@ -1509,7 +1562,7 @@ void assistant_is_account_linked(LinphoneAccountCreator *creator, LinphoneAccoun
- (IBAction)onBackClick:(id)sender {
if ([historyViews count] > 0) {
if (currentView == _createAccountActivateSMSView || currentView == _createAccountActivateEmailView) {
if (currentView == _createAccountActivateSMSView || currentView == _createAccountActivateEmailView || currentView == _qrCodeView) {
UIView *view = [historyViews lastObject];
[historyViews removeLastObject];
[self changeView:view back:TRUE animation:TRUE];
@ -1532,7 +1585,7 @@ void assistant_is_account_linked(LinphoneAccountCreator *creator, LinphoneAccoun
#pragma mark - select country delegate
- (void)didSelectCountry:(NSDictionary *)country{
- (void)didSelectCountry:(NSDictionary *)country {
UIRoundBorderedButton *phoneButton = [self findButton:ViewElement_PhoneButton];
[phoneButton setTitle:[country objectForKey:@"name"] forState:UIControlStateNormal];
UIAssistantTextField* countryCodeField = [self findTextField:ViewElement_PhoneCC];
@ -1541,4 +1594,23 @@ void assistant_is_account_linked(LinphoneAccountCreator *creator, LinphoneAccoun
[self shouldEnableNextButton];
}
-(void)qrCodeFound:(NSNotification *)notif {
if ([notif.userInfo count] == 0){
return;
}
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneQRCodeFound object:nil];
dispatch_async(dispatch_get_main_queue(), ^{
self.urlLabel.text = [notif.userInfo objectForKey:@"qrcode"];
});
if ([historyViews count] > 0) {
if (currentView == _qrCodeView) {
UIView *view = [historyViews lastObject];
[historyViews removeLastObject];
[self changeView:view back:TRUE animation:TRUE];
} else {
[self changeView:_welcomeView back:TRUE animation:TRUE];
}
}
}
@end

View file

@ -1,13 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Alignment constraints to the first baseline" minToolsVersion="6.0"/>
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@ -31,9 +30,11 @@
<outlet property="loginView" destination="56" id="bJH-N8-uPi"/>
<outlet property="phoneLabel" destination="ZSJ-Lv-n60" id="5Qi-xR-wyK"/>
<outlet property="phoneTitle" destination="rAy-0V-sqv" id="MZq-EF-6HF"/>
<outlet property="qrCodeView" destination="Z2R-SD-yFJ" id="dcs-rK-HgK"/>
<outlet property="remoteProvisioningLoginView" destination="xVK-hL-6pe" id="pKL-9M-Vsa"/>
<outlet property="remoteProvisioningView" destination="Zuh-Sd-pcd" id="3pa-2M-5Xq"/>
<outlet property="subtileLabel_useLinphoneAccount" destination="4n3-ZD-KVi" id="8d9-0f-2Vi"/>
<outlet property="urlLabel" destination="Ffg-Of-xyh" id="IhC-hf-1OG"/>
<outlet property="welcomeView" destination="33" id="46a-AR-5mN"/>
</connections>
</placeholder>
@ -338,7 +339,7 @@
<rect key="frame" x="0.0" y="426" width="375" height="237"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="EMAIL" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="E7B-Ag-ltX" userLabel="emailLabel">
<rect key="frame" x="38" y="0.0" width="299" height="14"/>
<rect key="frame" x="38" y="0.0" width="291" height="14"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="1pi-x8-d7G"/>
</constraints>
@ -347,7 +348,7 @@
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" tag="103" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="IXr-i2-LEh" userLabel="emailField" customClass="UIAssistantTextField">
<rect key="frame" x="38" y="22" width="299" height="30"/>
<rect key="frame" x="38" y="22" width="291" height="30"/>
<color key="backgroundColor" red="0.85415387153625488" green="0.85412830114364624" blue="0.85414278507232666" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" label="Email"/>
<color key="textColor" red="0.20521381497383118" green="0.20520767569541931" blue="0.20521116256713867" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -359,7 +360,7 @@
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid email" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="1r3-gy-l29" userLabel="emailErrorLabel">
<rect key="frame" x="38" y="52" width="299" height="10"/>
<rect key="frame" x="38" y="52" width="291" height="10"/>
<constraints>
<constraint firstAttribute="height" constant="10" id="DxN-0P-gw6"/>
</constraints>
@ -368,7 +369,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PASSWORD" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="p25-jF-I9X" userLabel="passwordLabel">
<rect key="frame" x="38" y="76" width="299" height="14"/>
<rect key="frame" x="38" y="76" width="291" height="14"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="yWO-rf-S2R"/>
</constraints>
@ -377,7 +378,7 @@
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" tag="101" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="t14-fe-grq" userLabel="passwordField" customClass="UIAssistantTextField">
<rect key="frame" x="38" y="101" width="299" height="30"/>
<rect key="frame" x="38" y="101" width="291" height="30"/>
<color key="backgroundColor" red="0.85415387153625488" green="0.85412830114364624" blue="0.85414278507232666" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" label="Password "/>
<color key="textColor" red="0.20521381497383118" green="0.20520767569541931" blue="0.20521116256713867" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -389,7 +390,7 @@
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid password" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="J5q-GY-AW4" userLabel="passwordErrorLabel">
<rect key="frame" x="38" y="131" width="299" height="10"/>
<rect key="frame" x="38" y="131" width="291" height="10"/>
<constraints>
<constraint firstAttribute="height" constant="10" id="EZT-D6-c3H"/>
</constraints>
@ -398,7 +399,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PASSWORD CONFIRMATION" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fpk-Vv-LB0" userLabel="password2Label">
<rect key="frame" x="38" y="153" width="299" height="14"/>
<rect key="frame" x="38" y="153" width="291" height="14"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="aRv-BL-3ug"/>
</constraints>
@ -407,7 +408,7 @@
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" tag="102" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="kHS-3H-oHM" userLabel="password2Field" customClass="UIAssistantTextField">
<rect key="frame" x="38" y="175" width="299" height="30"/>
<rect key="frame" x="38" y="175" width="291" height="30"/>
<color key="backgroundColor" red="0.85415387153625488" green="0.85412830114364624" blue="0.85414278507232666" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" label="Password confirmation"/>
<color key="textColor" red="0.20521381497383118" green="0.20520767569541931" blue="0.20521116256713867" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -418,7 +419,7 @@
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Passwords do not match" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="DgP-rE-2dp" userLabel="password2ErrorLabel">
<rect key="frame" x="38" y="205" width="299" height="10"/>
<rect key="frame" x="38" y="205" width="291" height="10"/>
<constraints>
<constraint firstAttribute="height" constant="10" id="gT0-em-DfO"/>
</constraints>
@ -1273,11 +1274,11 @@ Once it is done, come back here and click on the button.</string>
<point key="canvasLocation" x="1490" y="264"/>
</view>
<view contentMode="scaleToFill" id="Zuh-Sd-pcd" userLabel="remoteProvisioningView">
<rect key="frame" x="0.0" y="0.0" width="375" height="241"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="347"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="FETCH REMOTE CONFIGURATION" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="dpv-8C-qt6" userLabel="titleLabel">
<rect key="frame" x="36" y="0.0" width="303" height="59"/>
<rect key="frame" x="36" y="0.0" width="303" height="29"/>
<accessibility key="accessibilityConfiguration" label="Account setup assistant"/>
<fontDescription key="fontDescription" type="system" weight="light" pointSize="24"/>
<color key="textColor" red="0.20521381497383118" green="0.20520767569541931" blue="0.20521116256713867" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -1285,7 +1286,7 @@ Once it is done, come back here and click on the button.</string>
<size key="shadowOffset" width="-1" height="-1"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Please provide your provisioning URL." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="hEy-Xe-afq" userLabel="subtitleLabel">
<rect key="frame" x="36" y="66" width="303" height="29"/>
<rect key="frame" x="36" y="36" width="303" height="29"/>
<accessibility key="accessibilityConfiguration" label="Account setup assistant"/>
<constraints>
<constraint firstAttribute="height" constant="29" id="vbU-BF-C6f"/>
@ -1296,7 +1297,7 @@ Once it is done, come back here and click on the button.</string>
<size key="shadowOffset" width="-1" height="-1"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="URL" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0tr-gN-2Ce" userLabel="urlLabel">
<rect key="frame" x="38" y="131" width="299" height="14"/>
<rect key="frame" x="38" y="101" width="299" height="14"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="1xT-bm-Ag5"/>
</constraints>
@ -1305,7 +1306,7 @@ Once it is done, come back here and click on the button.</string>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" tag="105" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" adjustsFontSizeToFit="NO" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="Ffg-Of-xyh" userLabel="urlField" customClass="UIAssistantTextField">
<rect key="frame" x="38" y="153" width="299" height="30"/>
<rect key="frame" x="38" y="123" width="299" height="30"/>
<color key="backgroundColor" red="0.85415387153625488" green="0.85412830114364624" blue="0.85414278507232666" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" label="URL"/>
<constraints>
@ -1320,7 +1321,7 @@ Once it is done, come back here and click on the button.</string>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" tag="410" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invalid URL" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="uEq-Gk-9iy" userLabel="urlErrorLabel">
<rect key="frame" x="38" y="183" width="299" height="10"/>
<rect key="frame" x="38" y="153" width="299" height="10"/>
<constraints>
<constraint firstAttribute="height" constant="10" id="VcL-Iz-4n4"/>
</constraints>
@ -1329,7 +1330,7 @@ Once it is done, come back here and click on the button.</string>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" tag="130" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eM0-bn-v3C" userLabel="downloadButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="38" y="201" width="299" height="40"/>
<rect key="frame" x="38" y="171" width="299" height="40"/>
<accessibility key="accessibilityConfiguration" label="Fetch and apply">
<bool key="isElement" value="YES"/>
</accessibility>
@ -1348,6 +1349,26 @@ Once it is done, come back here and click on the button.</string>
<action selector="onRemoteProvisioningDownloadClick:" destination="-1" eventType="touchUpInside" id="6yF-1w-Hpa"/>
</connections>
</button>
<button opaque="NO" tag="130" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2T9-bt-FHD" userLabel="qrcodeButton" customClass="UIRoundBorderedButton">
<rect key="frame" x="38" y="219" width="299" height="40"/>
<accessibility key="accessibilityConfiguration" label="Fetch and apply">
<bool key="isElement" value="YES"/>
</accessibility>
<constraints>
<constraint firstAttribute="height" constant="40" id="Wcc-Sn-c0r"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="QR CODE">
<color key="titleColor" red="0.20521381499999999" green="0.20520767570000001" blue="0.2052111626" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="disabled">
<color key="titleColor" red="0.71885228160000003" green="0.71883076430000004" blue="0.71884298319999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="color_F.png"/>
<connections>
<action selector="onLaunchQRCodeView:" destination="-1" eventType="touchUpInside" id="i1k-Su-mAZ"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
@ -1366,14 +1387,16 @@ Once it is done, come back here and click on the button.</string>
<constraint firstItem="0tr-gN-2Ce" firstAttribute="trailing" secondItem="Ffg-Of-xyh" secondAttribute="trailing" id="d5L-lU-eEr"/>
<constraint firstItem="hEy-Xe-afq" firstAttribute="centerX" secondItem="0tr-gN-2Ce" secondAttribute="centerX" id="dQg-gY-T2t"/>
<constraint firstItem="Ffg-Of-xyh" firstAttribute="top" secondItem="0tr-gN-2Ce" secondAttribute="bottom" constant="8" symbolic="YES" id="deZ-RJ-Tac"/>
<constraint firstItem="2T9-bt-FHD" firstAttribute="top" secondItem="eM0-bn-v3C" secondAttribute="bottom" constant="8" id="hPc-df-UEy"/>
<constraint firstItem="hEy-Xe-afq" firstAttribute="top" secondItem="dpv-8C-qt6" secondAttribute="bottom" constant="7" id="j4R-8z-ku5"/>
<constraint firstItem="dpv-8C-qt6" firstAttribute="leading" secondItem="hEy-Xe-afq" secondAttribute="leading" id="jKd-Ac-gLa"/>
<constraint firstAttribute="bottom" secondItem="eM0-bn-v3C" secondAttribute="bottom" id="kCn-do-O9N"/>
<constraint firstItem="uEq-Gk-9iy" firstAttribute="trailing" secondItem="eM0-bn-v3C" secondAttribute="trailing" id="kFa-lR-RH4"/>
<constraint firstItem="2T9-bt-FHD" firstAttribute="leading" secondItem="eM0-bn-v3C" secondAttribute="leading" id="kP2-1p-Fpw"/>
<constraint firstItem="2T9-bt-FHD" firstAttribute="trailing" secondItem="eM0-bn-v3C" secondAttribute="trailing" id="vXZ-nV-P1E"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="1917.5" y="96.5"/>
<point key="canvasLocation" x="1917.5" y="149.5"/>
</view>
<view contentMode="scaleToFill" id="xVK-hL-6pe" userLabel="remoteProvisioningLoginView">
<rect key="frame" x="0.0" y="0.0" width="375" height="379"/>
@ -1524,13 +1547,19 @@ Once it is done, come back here and click on the button.</string>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="1917.5" y="457.5"/>
<point key="canvasLocation" x="2422" y="410"/>
</view>
<tapGestureRecognizer id="VEO-W5-GDl" userLabel="onLinkTap">
<connections>
<action selector="onLinkTap:" destination="-1" id="xXJ-65-gxy"/>
</connections>
</tapGestureRecognizer>
<view contentMode="scaleToFill" id="Z2R-SD-yFJ" userLabel="qrCodeView">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<point key="canvasLocation" x="1918" y="554"/>
</view>
</objects>
<resources>
<image name="color_F.png" width="2" height="2"/>

View file

@ -39,6 +39,7 @@
@property PKPushRegistry* voipRegistry;
@property ProviderDelegate *del;
@property BOOL alreadyRegisteredForNotification;
@property BOOL onlyPortrait;
@end

View file

@ -44,6 +44,7 @@
startedInBackground = FALSE;
}
_alreadyRegisteredForNotification = false;
_onlyPortrait = FALSE;
return self;
[[UIApplication sharedApplication] setDelegate:self];
}
@ -218,17 +219,6 @@
actions:[NSArray arrayWithObjects:act_confirm, act_deny, nil]
intentIdentifiers:[[NSMutableArray alloc] init]
options:UNNotificationCategoryOptionCustomDismissAction];
// App version verification
UNNotificationAction *act_go_to_URL = [UNNotificationAction actionWithIdentifier:@"Download"
title:NSLocalizedString(@"Download", nil)
options:UNNotificationActionOptionNone];
UNNotificationCategory *version_verif =
[UNNotificationCategory categoryWithIdentifier:@"version_verif"
actions:[NSArray arrayWithObjects:act_go_to_URL, nil]
intentIdentifiers:[[NSMutableArray alloc] init]
options:UNNotificationCategoryOptionCustomDismissAction];
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge)
@ -238,7 +228,7 @@
LOGD(error.description);
}];
NSSet *categories = [NSSet setWithObjects:cat_call, cat_msg, video_call, cat_zrtp, version_verif, nil];
NSSet *categories = [NSSet setWithObjects:cat_call, cat_msg, video_call, cat_zrtp, nil];
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:categories];
}
@ -676,10 +666,6 @@ didInvalidatePushTokenForType:(NSString *)type {
}];
} else if ([response.notification.request.content.categoryIdentifier isEqual:@"lime"]) {
return;
} else if ([response.notification.request.content.categoryIdentifier isEqual:@"version_verif"]) {
NSString *url = [response.notification.request.content.userInfo objectForKey:@"url"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
return;
} else { // Missed call
[PhoneMainView.instance changeCurrentView:HistoryListView.compositeViewDescription];
}
@ -851,14 +837,13 @@ didInvalidatePushTokenForType:(NSString *)type {
#pragma mark - Prevent ImagePickerView from rotating
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
if ([[(PhoneMainView*)self.window.rootViewController currentView] equal:ImagePickerView.compositeViewDescription])
if ([[(PhoneMainView*)self.window.rootViewController currentView] equal:ImagePickerView.compositeViewDescription] || _onlyPortrait)
{
//Prevent rotation of camera
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
return UIInterfaceOrientationMaskPortrait;
}
else return UIInterfaceOrientationMaskAllButUpsideDown;
} else return UIInterfaceOrientationMaskAllButUpsideDown;
}
@end

View file

@ -56,6 +56,7 @@ extern NSString *const kLinphoneNotifyPresenceReceivedForUriOrTel;
extern NSString *const kLinphoneCallEncryptionChanged;
extern NSString *const kLinphoneFileTransferSendUpdate;
extern NSString *const kLinphoneFileTransferRecvUpdate;
extern NSString *const kLinphoneQRCodeFound;
typedef enum _NetworkType {
network_none = 0,

View file

@ -76,6 +76,7 @@ NSString *const kLinphoneNotifyPresenceReceivedForUriOrTel = @"LinphoneNotifyPre
NSString *const kLinphoneCallEncryptionChanged = @"LinphoneCallEncryptionChanged";
NSString *const kLinphoneFileTransferSendUpdate = @"LinphoneFileTransferSendUpdate";
NSString *const kLinphoneFileTransferRecvUpdate = @"LinphoneFileTransferRecvUpdate";
NSString *const kLinphoneQRCodeFound = @"LinphoneQRCodeFound";
const int kLinphoneAudioVbrCodecDefaultBitrate = 36; /*you can override this from linphonerc or linphonerc-factory*/
@ -1416,6 +1417,12 @@ void linphone_iphone_version_update_check_result_received (LinphoneCore *lc, Lin
[PhoneMainView.instance presentViewController:versVerifView animated:YES completion:nil];
}
void linphone_iphone_qr_code_found(LinphoneCore *lc, const char *result) {
NSDictionary *eventDic = [NSDictionary dictionaryWithObject:[NSString stringWithCString:result encoding:[NSString defaultCStringEncoding]] forKey:@"qrcode"];
LOGD(@"QRCODE FOUND");
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneQRCodeFound object:nil userInfo:eventDic];
}
#pragma mark - Message composition start
- (void)alertLIME:(LinphoneChatRoom *)room {
NSString *title = NSLocalizedString(@"LIME warning", nil);
@ -1988,6 +1995,7 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat
linphone_core_cbs_set_chat_room_state_changed(cbs, linphone_iphone_chatroom_state_changed);
linphone_core_cbs_set_version_update_check_result_received(cbs, linphone_iphone_version_update_check_result_received);
linphone_core_cbs_set_user_data(cbs, (__bridge void *)(self));
linphone_core_cbs_set_qrcode_found(cbs, linphone_iphone_qr_code_found);
theLinphoneCore = linphone_factory_create_core_with_config(factory, cbs, _configDb);
// Let the core handle cbs

@ -1 +1 @@
Subproject commit 6351627a947fc9d2e751dbe749a4b6fb2252f4c4
Subproject commit 01c40162d1119a562f965b03576ddff241b5483d

1
submodules/externals/zxing-cpp vendored Submodule

@ -0,0 +1 @@
Subproject commit 8906fb7b243fa455fd9b091e4ac611536b2dbba4

@ -1 +1 @@
Subproject commit c448d2e0018ca9baa45afe216241fc354cc4edef
Subproject commit 09ae895cd0f37b0ee3bc5bf2e106f12cfe00912a

@ -1 +1 @@
Subproject commit f6e4cc2142821b2c8ac80c644405d9cd42b3216e
Subproject commit e095d83dd509e8664f546e02d3e0f16d6d0be392