Landscape orientation.

pull/1/head
Matthew Chen 6 years ago
parent ff24e826c9
commit 82d1517460

@ -1,224 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
</dependencies>
<scenes>
<!--Linked Devices-->
<scene sceneID="R59-ey-Ucx">
<objects>
<tableViewController storyboardIdentifier="OWSLinkedDevicesTableViewController" id="euf-gj-Iag" customClass="OWSLinkedDevicesTableViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" allowsSelectionDuringEditing="YES" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="zqK-o2-Psk">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ExistingDevice" rowHeight="72" id="XjV-oU-jSb" customClass="OWSDeviceTableViewCell">
<rect key="frame" x="0.0" y="55.5" width="375" height="72"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="XjV-oU-jSb" id="XqL-QG-IbY">
<rect key="frame" x="0.0" y="0.0" width="375" height="71.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Signal on Chrome" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="57o-uV-YOg">
<rect key="frame" x="17" y="8" width="136" height="19.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Linked: Jun 12, 2016" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uL2-wj-OZr">
<rect key="frame" x="17" y="27.5" width="124" height="18"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Last Seen: Aug 25, 2016" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Kek-MK-oLy">
<rect key="frame" x="17" y="45.5" width="148" height="17.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="bottomMargin" secondItem="Kek-MK-oLy" secondAttribute="bottom" id="5Wg-pN-nfp"/>
<constraint firstItem="57o-uV-YOg" firstAttribute="leading" secondItem="XqL-QG-IbY" secondAttribute="leadingMargin" constant="9" id="7T0-ym-8gM"/>
<constraint firstItem="uL2-wj-OZr" firstAttribute="top" secondItem="57o-uV-YOg" secondAttribute="bottom" id="7dw-uu-TZK"/>
<constraint firstItem="Kek-MK-oLy" firstAttribute="top" secondItem="uL2-wj-OZr" secondAttribute="bottom" id="CPN-Tu-AVN"/>
<constraint firstItem="Kek-MK-oLy" firstAttribute="leading" secondItem="57o-uV-YOg" secondAttribute="leading" id="JEA-wB-KbQ"/>
<constraint firstItem="uL2-wj-OZr" firstAttribute="height" secondItem="57o-uV-YOg" secondAttribute="height" multiplier="15/17" id="O61-fc-qwm"/>
<constraint firstItem="uL2-wj-OZr" firstAttribute="leading" secondItem="57o-uV-YOg" secondAttribute="leading" id="T5V-13-qDK"/>
<constraint firstItem="57o-uV-YOg" firstAttribute="top" secondItem="XqL-QG-IbY" secondAttribute="topMargin" id="asn-zh-Ubj"/>
<constraint firstItem="Kek-MK-oLy" firstAttribute="height" secondItem="uL2-wj-OZr" secondAttribute="height" id="hXw-bD-8Rq"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="lastSeenLabel" destination="Kek-MK-oLy" id="hnT-Gu-wAF"/>
<outlet property="linkedLabel" destination="uL2-wj-OZr" id="XoU-iO-eDe"/>
<outlet property="nameLabel" destination="57o-uV-YOg" id="yZG-PJ-JOY"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="AddNewDevice" textLabel="w80-IJ-E6R" detailTextLabel="8ft-2u-wBF" style="IBUITableViewCellStyleSubtitle" id="6h2-gg-1C6">
<rect key="frame" x="0.0" y="127.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="6h2-gg-1C6" id="RKi-c6-pzb">
<rect key="frame" x="0.0" y="0.0" width="342" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Link New Device" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="w80-IJ-E6R">
<rect key="frame" x="15" y="4" width="127" height="20.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Scan QR Code" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="8ft-2u-wBF">
<rect key="frame" x="15" y="24.5" width="88" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="euf-gj-Iag" id="R6C-wt-F6o"/>
<outlet property="delegate" destination="euf-gj-Iag" id="Smu-kk-c7F"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Linked Devices" id="HAh-b7-E4Q"/>
<connections>
<segue destination="tWr-1v-Sq9" kind="push" identifier="LinkDeviceSegue" id="zMV-AS-COl"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="tUY-HM-TQP" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-2404" y="-3229"/>
</scene>
<!--Link Device-->
<scene sceneID="all-Be-y2s">
<objects>
<viewController id="tWr-1v-Sq9" customClass="OWSLinkDeviceViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="HSZ-fb-tHK"/>
<viewControllerLayoutGuide type="bottom" id="nre-8Q-MvI"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="XYT-jy-1yR">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6B0-ZZ-d6K" userLabel="Instructions">
<rect key="frame" x="16" y="343.5" width="343" height="323.5"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Oqf-fj-8Va" userLabel="Spacer">
<rect key="frame" x="0.0" y="0.0" width="343" height="86.5"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="16" id="Xq5-fV-fUr"/>
</constraints>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_devices_ios" translatesAutoresizingMaskIntoConstraints="NO" id="zl7-KG-ma4">
<rect key="frame" x="86" y="86.5" width="171" height="114"/>
<color key="tintColor" red="0.67450980392156867" green="0.67450980392156867" blue="0.67450980392156867" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" secondItem="zl7-KG-ma4" secondAttribute="height" multiplier="3:2" id="RKt-hc-iWB"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GMf-cM-kQN" userLabel="Spacer">
<rect key="frame" x="0.0" y="237.5" width="343" height="86"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Scan the QR code displayed on the device to link." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="3D8-yn-TJ8">
<rect key="frame" x="0.0" y="216.5" width="343" height="21"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="GMf-cM-kQN" firstAttribute="top" secondItem="3D8-yn-TJ8" secondAttribute="bottom" id="1Aa-eC-Btt"/>
<constraint firstAttribute="trailing" secondItem="3D8-yn-TJ8" secondAttribute="trailing" id="3nn-2q-410"/>
<constraint firstItem="3D8-yn-TJ8" firstAttribute="centerX" secondItem="6B0-ZZ-d6K" secondAttribute="centerX" id="4RV-Ni-MSU"/>
<constraint firstItem="zl7-KG-ma4" firstAttribute="centerX" secondItem="6B0-ZZ-d6K" secondAttribute="centerX" id="Gto-9J-MBy"/>
<constraint firstItem="Oqf-fj-8Va" firstAttribute="top" secondItem="6B0-ZZ-d6K" secondAttribute="top" id="I98-tS-4Zz"/>
<constraint firstItem="zl7-KG-ma4" firstAttribute="width" secondItem="6B0-ZZ-d6K" secondAttribute="width" multiplier="0.5" id="LRW-Tk-Iqw"/>
<constraint firstItem="Oqf-fj-8Va" firstAttribute="height" secondItem="GMf-cM-kQN" secondAttribute="height" id="PCs-h1-GSh"/>
<constraint firstAttribute="bottom" secondItem="GMf-cM-kQN" secondAttribute="bottom" id="WUh-ur-3Yy"/>
<constraint firstItem="3D8-yn-TJ8" firstAttribute="top" secondItem="zl7-KG-ma4" secondAttribute="bottom" constant="16" id="XFH-UK-1mo"/>
<constraint firstItem="GMf-cM-kQN" firstAttribute="width" secondItem="6B0-ZZ-d6K" secondAttribute="width" id="cAj-Ii-Nxv"/>
<constraint firstItem="Oqf-fj-8Va" firstAttribute="width" secondItem="6B0-ZZ-d6K" secondAttribute="width" id="eVH-uq-RPl"/>
<constraint firstItem="3D8-yn-TJ8" firstAttribute="leading" secondItem="6B0-ZZ-d6K" secondAttribute="leading" id="gBK-bQ-mel"/>
<constraint firstItem="zl7-KG-ma4" firstAttribute="top" secondItem="Oqf-fj-8Va" secondAttribute="bottom" id="rhg-sr-hER"/>
<constraint firstItem="Oqf-fj-8Va" firstAttribute="centerX" secondItem="6B0-ZZ-d6K" secondAttribute="centerX" id="udm-8V-xQ0"/>
<constraint firstItem="GMf-cM-kQN" firstAttribute="centerX" secondItem="6B0-ZZ-d6K" secondAttribute="centerX" id="xMi-b6-Px2"/>
</constraints>
</view>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="eF5-us-VJe">
<rect key="frame" x="0.0" y="20" width="375" height="323.5"/>
<color key="backgroundColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<segue destination="xDh-Mk-Yo9" kind="embed" identifier="embedDeviceQRScanner" id="mve-0t-D0g"/>
</connections>
</containerView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="eF5-us-VJe" firstAttribute="leading" secondItem="XYT-jy-1yR" secondAttribute="leading" id="Dhy-We-RwI"/>
<constraint firstItem="6B0-ZZ-d6K" firstAttribute="leading" secondItem="XYT-jy-1yR" secondAttribute="leadingMargin" id="EUH-nz-kiP"/>
<constraint firstItem="6B0-ZZ-d6K" firstAttribute="height" secondItem="eF5-us-VJe" secondAttribute="height" id="Fj7-4c-vv9"/>
<constraint firstAttribute="trailing" secondItem="eF5-us-VJe" secondAttribute="trailing" id="Iag-Z0-aIy"/>
<constraint firstItem="eF5-us-VJe" firstAttribute="top" secondItem="HSZ-fb-tHK" secondAttribute="bottom" id="JW1-ne-tF7"/>
<constraint firstItem="6B0-ZZ-d6K" firstAttribute="top" secondItem="eF5-us-VJe" secondAttribute="bottom" id="UJr-YC-IcC"/>
<constraint firstItem="nre-8Q-MvI" firstAttribute="top" secondItem="6B0-ZZ-d6K" secondAttribute="bottom" id="c2b-Wz-z6U"/>
<constraint firstItem="eF5-us-VJe" firstAttribute="width" secondItem="XYT-jy-1yR" secondAttribute="width" id="gOe-Rq-SKo"/>
<constraint firstAttribute="trailingMargin" secondItem="6B0-ZZ-d6K" secondAttribute="trailing" id="qBl-kf-5Fr"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Link Device" id="OnR-Ni-zff"/>
<connections>
<outlet property="qrScanningView" destination="eF5-us-VJe" id="du3-ov-cGw"/>
<outlet property="scanningInstructionsLabel" destination="3D8-yn-TJ8" id="roC-Qj-INs"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="lPR-Bk-TZT" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-2023" y="-3228"/>
</scene>
<!--Device QR Scanner-->
<scene sceneID="f3S-St-vF2">
<objects>
<viewController title="Device QR Scanner" id="xDh-Mk-Yo9" customClass="OWSQRCodeScanningViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="YV9-ra-E3e"/>
<viewControllerLayoutGuide type="bottom" id="s4y-gf-WU5"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="aYO-nF-lxB">
<rect key="frame" x="0.0" y="0.0" width="375" height="323.5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="sg5-uD-LVc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1632" y="-3228"/>
</scene>
</scenes>
<resources>
<image name="ic_devices_ios" width="180" height="119"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4_7.fullscreen"/>
</simulatedMetricsContainer>
<scenes/>
</document>

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import "AppSettingsViewController.h"
@ -360,8 +360,7 @@
- (void)showLinkedDevices
{
OWSLinkedDevicesTableViewController *vc =
[[UIStoryboard main] instantiateViewControllerWithIdentifier:@"OWSLinkedDevicesTableViewController"];
OWSLinkedDevicesTableViewController *vc = [OWSLinkedDevicesTableViewController new];
[self.navigationController pushViewController:vc animated:YES];
}

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import "OWSQRCodeScanningViewController.h"
@ -9,9 +9,9 @@ NS_ASSUME_NONNULL_BEGIN
@class OWSLinkedDevicesTableViewController;
@interface OWSLinkDeviceViewController : OWSViewController <OWSQRScannerDelegate>
@interface OWSLinkDeviceViewController : OWSViewController
@property OWSLinkedDevicesTableViewController *linkedDevicesTableViewController;
@property (nonatomic, weak) OWSLinkedDevicesTableViewController *linkedDevicesTableViewController;
- (void)controller:(OWSQRCodeScanningViewController *)controller didDetectQRCodeWithString:(NSString *)string;

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import "OWSLinkDeviceViewController.h"
@ -16,11 +16,11 @@
NS_ASSUME_NONNULL_BEGIN
@interface OWSLinkDeviceViewController ()
@interface OWSLinkDeviceViewController () <OWSQRScannerDelegate>
@property (nonatomic) YapDatabaseConnection *dbConnection;
@property (nonatomic) IBOutlet UIView *qrScanningView;
@property (nonatomic) IBOutlet UILabel *scanningInstructionsLabel;
@property (nonatomic) UIView *qrScanningView;
@property (nonatomic) UILabel *scanningInstructionsLabel;
@property (nonatomic) OWSQRCodeScanningViewController *qrScanningController;
@property (nonatomic, readonly) OWSReadReceiptManager *readReceiptManager;
@ -32,16 +32,52 @@ NS_ASSUME_NONNULL_BEGIN
{
[super viewDidLoad];
self.view.backgroundColor = Theme.backgroundColor;
self.dbConnection = [[OWSPrimaryStorage sharedManager] newDatabaseConnection];
// HACK to get full width preview layer
CGRect oldFrame = self.qrScanningView.frame;
self.qrScanningView.frame = CGRectMake(
oldFrame.origin.x, oldFrame.origin.y, self.view.frame.size.width, self.view.frame.size.height / 2.0f - 32.0f);
// END HACK to get full width preview layer
UIImage *heroImage = [UIImage imageNamed:@"ic_devices_ios"];
OWSAssertDebug(heroImage);
UIImageView *heroImageView = [[UIImageView alloc] initWithImage:heroImage];
[heroImageView autoSetDimensionsToSize:heroImage.size];
self.scanningInstructionsLabel = [UILabel new];
self.scanningInstructionsLabel.text = NSLocalizedString(@"LINK_DEVICE_SCANNING_INSTRUCTIONS",
@"QR Scanning screen instructions, placed alongside a camera view for scanning QR Codes");
self.scanningInstructionsLabel.textColor = Theme.primaryColor;
self.scanningInstructionsLabel.font = UIFont.ows_dynamicTypeCaption1Font;
self.scanningInstructionsLabel.numberOfLines = 0;
self.scanningInstructionsLabel.lineBreakMode = NSLineBreakByWordWrapping;
self.scanningInstructionsLabel.textAlignment = NSTextAlignmentCenter;
self.qrScanningController = [OWSQRCodeScanningViewController new];
self.qrScanningController.scanDelegate = self;
[self.view addSubview:self.qrScanningController.view];
[self.qrScanningController.view autoPinEdgeToSuperviewEdge:ALEdgeLeading];
[self.qrScanningController.view autoPinEdgeToSuperviewEdge:ALEdgeTrailing];
[self.qrScanningController.view autoPinToTopLayoutGuideOfViewController:self withInset:0.f];
[self.qrScanningController.view autoPinToAspectRatio:1.f];
UIView *bottomView = [UIView new];
[self.view addSubview:bottomView];
[bottomView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.qrScanningController.view];
[bottomView autoPinEdgeToSuperviewEdge:ALEdgeLeading];
[bottomView autoPinEdgeToSuperviewEdge:ALEdgeTrailing];
[bottomView autoPinEdgeToSuperviewEdge:ALEdgeBottom];
UIStackView *bottomStack = [[UIStackView alloc] initWithArrangedSubviews:@[
heroImageView,
self.scanningInstructionsLabel,
]];
bottomStack.axis = UILayoutConstraintAxisVertical;
bottomStack.alignment = UIStackViewAlignmentCenter;
bottomStack.spacing = 2;
bottomStack.layoutMarginsRelativeArrangement = YES;
bottomStack.layoutMargins = UIEdgeInsetsMake(20, 20, 20, 20);
[bottomView addSubview:bottomStack];
[bottomStack autoPinWidthToSuperview];
[bottomStack autoVCenterInSuperview];
self.title
= NSLocalizedString(@"LINK_NEW_DEVICE_TITLE", "Navigation title when scanning QR code to add new device.");
}
@ -83,21 +119,12 @@ NS_ASSUME_NONNULL_BEGIN
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.qrScanningController startCapture];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(nullable id)sender
{
if ([segue.identifier isEqualToString:@"embedDeviceQRScanner"]) {
OWSQRCodeScanningViewController *qrScanningController
= (OWSQRCodeScanningViewController *)segue.destinationViewController;
qrScanningController.scanDelegate = self;
self.qrScanningController = qrScanningController;
}
[self.qrScanningController startCapture];
}
// pragma mark - OWSQRScannerDelegate
- (void)controller:(OWSQRCodeScanningViewController *)controller didDetectQRCodeWithString:(NSString *)string
{
OWSDeviceProvisioningURLParser *parser = [[OWSDeviceProvisioningURLParser alloc] initWithProvisioningURL:string];

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import "OWSLinkedDevicesTableViewController.h"
@ -49,7 +49,8 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1;
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 60;
self.tableView.separatorColor = Theme.cellSeparatorColor;
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"AddNewDevice"];
[self.tableView registerClass:[OWSDeviceTableViewCell class] forCellReuseIdentifier:@"ExistingDevice"];
[self.tableView applyScrollViewInsetsFix];
self.dbConnection = [[OWSPrimaryStorage sharedManager] newDatabaseConnection];
@ -303,20 +304,29 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1;
if (!granted) {
return;
}
[self performSegueWithIdentifier:@"LinkDeviceSegue" sender:self];
[self showLinkNewDeviceView];
}];
}
}
- (void)showLinkNewDeviceView
{
OWSLinkDeviceViewController *vc = [OWSLinkDeviceViewController new];
vc.linkedDevicesTableViewController = self;
[self.navigationController pushViewController:vc animated:YES];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == OWSLinkedDevicesTableViewControllerSectionAddDevice) {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AddNewDevice" forIndexPath:indexPath];
UITableViewCell *cell =
[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"AddNewDevice"];
[OWSTableItem configureCell:cell];
cell.textLabel.text
= NSLocalizedString(@"LINK_NEW_DEVICE_TITLE", @"Navigation title when scanning QR code to add new device.");
cell.detailTextLabel.text
= NSLocalizedString(@"LINK_NEW_DEVICE_SUBTITLE", @"Subheading for 'Link New Device' navigation");
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
} else if (indexPath.section == OWSLinkedDevicesTableViewControllerSectionExistingDevices) {
OWSDeviceTableViewCell *cell =
@ -427,14 +437,6 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1;
}];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(nullable id)sender
{
if ([segue.destinationViewController isKindOfClass:[OWSLinkDeviceViewController class]]) {
OWSLinkDeviceViewController *controller = (OWSLinkDeviceViewController *)segue.destinationViewController;
controller.linkedDevicesTableViewController = self;
}
}
@end
NS_ASSUME_NONNULL_END

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import "OWSQRCodeScanningViewController.h"
@ -93,6 +93,11 @@ NS_ASSUME_NONNULL_BEGIN
[self stopCapture];
}
- (void)viewWillLayoutSubviews
{
self.capture.layer.frame = self.view.bounds;
}
- (void)startCapture
{
self.captureEnabled = YES;
@ -101,10 +106,10 @@ NS_ASSUME_NONNULL_BEGIN
self.capture = [[ZXCapture alloc] init];
self.capture.camera = self.capture.back;
self.capture.focusMode = AVCaptureFocusModeContinuousAutoFocus;
self.capture.layer.frame = self.view.bounds;
self.capture.delegate = self;
dispatch_async(dispatch_get_main_queue(), ^{
self.capture.layer.frame = self.view.bounds;
[self.view.layer addSublayer:self.capture.layer];
[self.view bringSubviewToFront:self.maskingView];
[self.capture start];

@ -1,4 +1,6 @@
// Copyright © 2016 Open Whisper Systems. All rights reserved.
//
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import <SignalServiceKit/OWSDevice.h>
#import <UIKit/UIKit.h>
@ -7,9 +9,9 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSDeviceTableViewCell : UITableViewCell
@property (strong, nonatomic) IBOutlet UILabel *nameLabel;
@property (strong, nonatomic) IBOutlet UILabel *linkedLabel;
@property (strong, nonatomic) IBOutlet UILabel *lastSeenLabel;
@property (nonatomic) UILabel *nameLabel;
@property (nonatomic) UILabel *linkedLabel;
@property (nonatomic) UILabel *lastSeenLabel;
- (void)configureWithDevice:(OWSDevice *)device;

@ -1,22 +1,57 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import "OWSDeviceTableViewCell.h"
#import "DateUtil.h"
#import <SignalMessaging/OWSTableViewController.h>
#import <SignalMessaging/Theme.h>
#import <SignalMessaging/UIFont+OWS.h>
#import <SignalMessaging/UIView+OWS.h>
NS_ASSUME_NONNULL_BEGIN
@implementation OWSDeviceTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(nullable NSString *)reuseIdentifier
{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self configure];
}
return self;
}
- (void)configure
{
self.preservesSuperviewLayoutMargins = YES;
self.contentView.preservesSuperviewLayoutMargins = YES;
self.nameLabel = [UILabel new];
self.linkedLabel = [UILabel new];
self.lastSeenLabel = [UILabel new];
UIStackView *stackView = [[UIStackView alloc] initWithArrangedSubviews:@[
self.nameLabel,
self.linkedLabel,
self.lastSeenLabel,
]];
stackView.axis = UILayoutConstraintAxisVertical;
stackView.alignment = UIStackViewAlignmentLeading;
stackView.spacing = 2;
[self.contentView addSubview:stackView];
[stackView ows_autoPinToSuperviewMargins];
}
- (void)configureWithDevice:(OWSDevice *)device
{
OWSAssertDebug(device);
[OWSTableItem configureCell:self];
self.nameLabel.font = UIFont.ows_dynamicTypeBodyFont;
self.linkedLabel.font = UIFont.ows_dynamicTypeCaption1Font;
self.lastSeenLabel.font = UIFont.ows_dynamicTypeCaption1Font;
self.nameLabel.textColor = Theme.primaryColor;
self.linkedLabel.textColor = Theme.secondaryColor;
self.lastSeenLabel.textColor = Theme.secondaryColor;

Loading…
Cancel
Save