Create new key backup setup success view controllers

This commit is contained in:
SBiOSoftWhare 2019-02-13 13:36:35 +01:00
parent ccf075b00d
commit d3efbd2633
6 changed files with 789 additions and 0 deletions

View file

@ -40,6 +40,10 @@
92726A4B1F58737A004AD26F /* SiriIntents.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 92726A431F58737A004AD26F /* SiriIntents.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 92726A4B1F58737A004AD26F /* SiriIntents.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 92726A431F58737A004AD26F /* SiriIntents.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
92726A511F587410004AD26F /* Intents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92726A501F587410004AD26F /* Intents.framework */; }; 92726A511F587410004AD26F /* Intents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92726A501F587410004AD26F /* Intents.framework */; };
B104C2942203773C00D9F496 /* KeyBackupBannerPreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = B104C2932203773B00D9F496 /* KeyBackupBannerPreferences.swift */; }; B104C2942203773C00D9F496 /* KeyBackupBannerPreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = B104C2932203773B00D9F496 /* KeyBackupBannerPreferences.swift */; };
B1057789221304EC00334B1E /* KeyBackupSetupSuccessFromPassphraseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1057788221304EB00334B1E /* KeyBackupSetupSuccessFromPassphraseViewController.swift */; };
B105778B221304FA00334B1E /* KeyBackupSetupSuccessFromPassphraseViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B105778A221304FA00334B1E /* KeyBackupSetupSuccessFromPassphraseViewController.storyboard */; };
B105778D2213051E00334B1E /* KeyBackupSetupSuccessFromRecoveryKeyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B105778C2213051E00334B1E /* KeyBackupSetupSuccessFromRecoveryKeyViewController.swift */; };
B105778F2213052A00334B1E /* KeyBackupSetupSuccessFromRecoveryKeyViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B105778E2213052A00334B1E /* KeyBackupSetupSuccessFromRecoveryKeyViewController.storyboard */; };
B1098BDF21ECE09F000DDA48 /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1098BDA21ECE09E000DDA48 /* Strings.swift */; }; B1098BDF21ECE09F000DDA48 /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1098BDA21ECE09E000DDA48 /* Strings.swift */; };
B1098BE121ECE09F000DDA48 /* Images.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1098BDC21ECE09E000DDA48 /* Images.swift */; }; B1098BE121ECE09F000DDA48 /* Images.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1098BDC21ECE09E000DDA48 /* Images.swift */; };
B1098BE321ECE09F000DDA48 /* RiotDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1098BDE21ECE09E000DDA48 /* RiotDefaults.swift */; }; B1098BE321ECE09F000DDA48 /* RiotDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1098BDE21ECE09E000DDA48 /* RiotDefaults.swift */; };
@ -512,6 +516,10 @@
92726A4F1F587393004AD26F /* SiriIntents.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = SiriIntents.entitlements; sourceTree = "<group>"; }; 92726A4F1F587393004AD26F /* SiriIntents.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = SiriIntents.entitlements; sourceTree = "<group>"; };
92726A501F587410004AD26F /* Intents.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Intents.framework; path = System/Library/Frameworks/Intents.framework; sourceTree = SDKROOT; }; 92726A501F587410004AD26F /* Intents.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Intents.framework; path = System/Library/Frameworks/Intents.framework; sourceTree = SDKROOT; };
B104C2932203773B00D9F496 /* KeyBackupBannerPreferences.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyBackupBannerPreferences.swift; sourceTree = "<group>"; }; B104C2932203773B00D9F496 /* KeyBackupBannerPreferences.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyBackupBannerPreferences.swift; sourceTree = "<group>"; };
B1057788221304EB00334B1E /* KeyBackupSetupSuccessFromPassphraseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyBackupSetupSuccessFromPassphraseViewController.swift; sourceTree = "<group>"; };
B105778A221304FA00334B1E /* KeyBackupSetupSuccessFromPassphraseViewController.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = KeyBackupSetupSuccessFromPassphraseViewController.storyboard; sourceTree = "<group>"; };
B105778C2213051E00334B1E /* KeyBackupSetupSuccessFromRecoveryKeyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyBackupSetupSuccessFromRecoveryKeyViewController.swift; sourceTree = "<group>"; };
B105778E2213052A00334B1E /* KeyBackupSetupSuccessFromRecoveryKeyViewController.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = KeyBackupSetupSuccessFromRecoveryKeyViewController.storyboard; sourceTree = "<group>"; };
B1098BDA21ECE09E000DDA48 /* Strings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = "<group>"; }; B1098BDA21ECE09E000DDA48 /* Strings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = "<group>"; };
B1098BDC21ECE09E000DDA48 /* Images.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Images.swift; sourceTree = "<group>"; }; B1098BDC21ECE09E000DDA48 /* Images.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Images.swift; sourceTree = "<group>"; };
B1098BDE21ECE09E000DDA48 /* RiotDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RiotDefaults.swift; sourceTree = "<group>"; }; B1098BDE21ECE09E000DDA48 /* RiotDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RiotDefaults.swift; sourceTree = "<group>"; };
@ -1225,6 +1233,17 @@
name = Pods; name = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
B1057787221304A200334B1E /* Success */ = {
isa = PBXGroup;
children = (
B1057788221304EB00334B1E /* KeyBackupSetupSuccessFromPassphraseViewController.swift */,
B105778A221304FA00334B1E /* KeyBackupSetupSuccessFromPassphraseViewController.storyboard */,
B105778C2213051E00334B1E /* KeyBackupSetupSuccessFromRecoveryKeyViewController.swift */,
B105778E2213052A00334B1E /* KeyBackupSetupSuccessFromRecoveryKeyViewController.storyboard */,
);
path = Success;
sourceTree = "<group>";
};
B1098BD921ECE09E000DDA48 /* Generated */ = { B1098BD921ECE09E000DDA48 /* Generated */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -1263,6 +1282,7 @@
B1098C0521ECFF5B000DDA48 /* Intro */, B1098C0521ECFF5B000DDA48 /* Intro */,
B1098C0321ECFECC000DDA48 /* Passphrase */, B1098C0321ECFECC000DDA48 /* Passphrase */,
B1098C0621ED00A9000DDA48 /* RecoveryKey */, B1098C0621ED00A9000DDA48 /* RecoveryKey */,
B1057787221304A200334B1E /* Success */,
); );
path = Setup; path = Setup;
sourceTree = "<group>"; sourceTree = "<group>";
@ -3121,6 +3141,7 @@
B1B558BC20EF768F00210D55 /* RoomMembershipBubbleCell.xib in Resources */, B1B558BC20EF768F00210D55 /* RoomMembershipBubbleCell.xib in Resources */,
B1B5571F20EE6C4D00210D55 /* ContactDetailsViewController.xib in Resources */, B1B5571F20EE6C4D00210D55 /* ContactDetailsViewController.xib in Resources */,
B1B558E220EF768F00210D55 /* RoomIncomingTextMsgBubbleCell.xib in Resources */, B1B558E220EF768F00210D55 /* RoomIncomingTextMsgBubbleCell.xib in Resources */,
B105778B221304FA00334B1E /* KeyBackupSetupSuccessFromPassphraseViewController.storyboard in Resources */,
B1664DA220F4F95800808783 /* Localizable.strings in Resources */, B1664DA220F4F95800808783 /* Localizable.strings in Resources */,
B169328720F3954A00746532 /* SharedImages.xcassets in Resources */, B169328720F3954A00746532 /* SharedImages.xcassets in Resources */,
B1664DA120F4F94F00808783 /* InfoPlist.strings in Resources */, B1664DA120F4F94F00808783 /* InfoPlist.strings in Resources */,
@ -3209,6 +3230,7 @@
B1B557D220EF5E3500210D55 /* MediaAlbumTableCell.xib in Resources */, B1B557D220EF5E3500210D55 /* MediaAlbumTableCell.xib in Resources */,
B1B558C520EF768F00210D55 /* RoomOutgoingEncryptedTextMsgBubbleCell.xib in Resources */, B1B558C520EF768F00210D55 /* RoomOutgoingEncryptedTextMsgBubbleCell.xib in Resources */,
B1B5582B20EF666100210D55 /* DirectoryRecentTableViewCell.xib in Resources */, B1B5582B20EF666100210D55 /* DirectoryRecentTableViewCell.xib in Resources */,
B105778F2213052A00334B1E /* KeyBackupSetupSuccessFromRecoveryKeyViewController.storyboard in Resources */,
B1B5590F20EF782800210D55 /* TableViewCellWithPhoneNumberTextField.xib in Resources */, B1B5590F20EF782800210D55 /* TableViewCellWithPhoneNumberTextField.xib in Resources */,
B1B5578520EF564900210D55 /* GroupTableViewCellWithSwitch.xib in Resources */, B1B5578520EF564900210D55 /* GroupTableViewCellWithSwitch.xib in Resources */,
B1B557B320EF5AEF00210D55 /* EventDetailsView.xib in Resources */, B1B557B320EF5AEF00210D55 /* EventDetailsView.xib in Resources */,
@ -3425,6 +3447,7 @@
B169330820F3CA0E00746532 /* ContactsDataSource.m in Sources */, B169330820F3CA0E00746532 /* ContactsDataSource.m in Sources */,
B1B5574B20EE6C4D00210D55 /* MediaAlbumContentViewController.m in Sources */, B1B5574B20EE6C4D00210D55 /* MediaAlbumContentViewController.m in Sources */,
B1B5598820EFC3E000210D55 /* WidgetManager.m in Sources */, B1B5598820EFC3E000210D55 /* WidgetManager.m in Sources */,
B1057789221304EC00334B1E /* KeyBackupSetupSuccessFromPassphraseViewController.swift in Sources */,
B16932B120F3AC9200746532 /* RoomSearchDataSource.m in Sources */, B16932B120F3AC9200746532 /* RoomSearchDataSource.m in Sources */,
B16932A320F3A21C00746532 /* main.m in Sources */, B16932A320F3A21C00746532 /* main.m in Sources */,
B1B5574520EE6C4D00210D55 /* StartChatViewController.m in Sources */, B1B5574520EE6C4D00210D55 /* StartChatViewController.m in Sources */,
@ -3578,6 +3601,7 @@
B1B558E620EF768F00210D55 /* RoomIncomingAttachmentWithoutSenderInfoBubbleCell.m in Sources */, B1B558E620EF768F00210D55 /* RoomIncomingAttachmentWithoutSenderInfoBubbleCell.m in Sources */,
B1098BFB21ECFE65000DDA48 /* KeyBackupSetupCoordinatorType.swift in Sources */, B1098BFB21ECFE65000DDA48 /* KeyBackupSetupCoordinatorType.swift in Sources */,
B1098BF721ECFE65000DDA48 /* PasswordStrength.swift in Sources */, B1098BF721ECFE65000DDA48 /* PasswordStrength.swift in Sources */,
B105778D2213051E00334B1E /* KeyBackupSetupSuccessFromRecoveryKeyViewController.swift in Sources */,
B1B557D820EF5EA900210D55 /* RoomActivitiesView.m in Sources */, B1B557D820EF5EA900210D55 /* RoomActivitiesView.m in Sources */,
B1B5596620EF9E9B00210D55 /* RoomTableViewCell.m in Sources */, B1B5596620EF9E9B00210D55 /* RoomTableViewCell.m in Sources */,
B1B558D020EF768F00210D55 /* RoomOutgoingEncryptedTextMsgWithPaginationTitleWithoutSenderNameBubbleCell.m in Sources */, B1B558D020EF768F00210D55 /* RoomOutgoingEncryptedTextMsgWithPaginationTitleWithoutSenderNameBubbleCell.m in Sources */,

View file

@ -42,6 +42,16 @@ internal enum StoryboardScene {
internal static let initialScene = InitialSceneType<Riot.KeyBackupSetupRecoveryKeyViewController>(storyboard: KeyBackupSetupRecoveryKeyViewController.self) internal static let initialScene = InitialSceneType<Riot.KeyBackupSetupRecoveryKeyViewController>(storyboard: KeyBackupSetupRecoveryKeyViewController.self)
} }
internal enum KeyBackupSetupSuccessFromPassphraseViewController: StoryboardType {
internal static let storyboardName = "KeyBackupSetupSuccessFromPassphraseViewController"
internal static let initialScene = InitialSceneType<Riot.KeyBackupSetupSuccessFromPassphraseViewController>(storyboard: KeyBackupSetupSuccessFromPassphraseViewController.self)
}
internal enum KeyBackupSetupSuccessFromRecoveryKeyViewController: StoryboardType {
internal static let storyboardName = "KeyBackupSetupSuccessFromRecoveryKeyViewController"
internal static let initialScene = InitialSceneType<Riot.KeyBackupSetupSuccessFromRecoveryKeyViewController>(storyboard: KeyBackupSetupSuccessFromRecoveryKeyViewController.self)
}
} }
// swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name // swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name

View file

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="b2C-jK-KPV">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Key Backup Setup Success From Passphrase View Controller-->
<scene sceneID="A4c-pi-pNE">
<objects>
<viewController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="b2C-jK-KPV" customClass="KeyBackupSetupSuccessFromPassphraseViewController" customModule="Riot" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="YAN-xg-EgW">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="S5g-F9-L3B">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="a4X-9Q-mkr">
<rect key="frame" x="0.0" y="0.0" width="375" height="505"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="o2g-Ga-wwR">
<rect key="frame" x="0.0" y="0.0" width="375" height="505"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="key_backup_logo" translatesAutoresizingMaskIntoConstraints="NO" id="epg-Qy-eoD">
<rect key="frame" x="163.5" y="40" width="48" height="46"/>
<constraints>
<constraint firstAttribute="width" constant="48" id="V1N-K1-elw"/>
<constraint firstAttribute="height" constant="46" id="Yzm-7B-uv2"/>
</constraints>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="30" translatesAutoresizingMaskIntoConstraints="NO" id="xlp-uc-Mug">
<rect key="frame" x="20" y="121" width="335" height="194"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Success!" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="X7g-Ha-15I">
<rect key="frame" x="0.0" y="0.0" width="335" height="20.5"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3eY-3I-XYH">
<rect key="frame" x="0.0" y="50.5" width="335" height="143.5"/>
<string key="text">Your keys are being backed up.
Your recovery key is a safety net - you can use it to restore access to your encrypted messages if you forget your passphrase.
Keep your recovery key somewhere very secure, like a password manager (or a safe).</string>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="d9z-1h-dAx">
<rect key="frame" x="0.0" y="365" width="375" height="50"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1vK-9h-Ysd">
<rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="T4c-Ft-vcd"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
<state key="normal" title="Save Recovery Key">
<color key="titleColor" red="0.47843137250000001" green="0.78823529410000004" blue="0.63137254899999995" alpha="1" colorSpace="calibratedRGB"/>
</state>
<state key="disabled">
<color key="titleColor" red="0.47843137250000001" green="0.78823529410000004" blue="0.63137254899999995" alpha="0.5" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="saveRecoveryKeyButtonAction:" destination="b2C-jK-KPV" eventType="touchUpInside" id="BbX-ad-nco"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="1vK-9h-Ysd" firstAttribute="top" secondItem="d9z-1h-dAx" secondAttribute="top" id="37w-qL-TaN"/>
<constraint firstItem="1vK-9h-Ysd" firstAttribute="leading" secondItem="d9z-1h-dAx" secondAttribute="leading" id="JOp-Zb-Whl"/>
<constraint firstAttribute="bottom" secondItem="1vK-9h-Ysd" secondAttribute="bottom" id="OVO-vt-Bgb"/>
<constraint firstAttribute="trailing" secondItem="1vK-9h-Ysd" secondAttribute="trailing" id="nkL-8Y-wrm"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7aK-CF-d5d">
<rect key="frame" x="0.0" y="435" width="375" height="50"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QxC-gf-8VN">
<rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="qB9-Kq-7Jw"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
<state key="normal" title="Done">
<color key="titleColor" red="0.47843137250000001" green="0.78823529410000004" blue="0.63137254899999995" alpha="1" colorSpace="calibratedRGB"/>
</state>
<state key="disabled">
<color key="titleColor" red="0.47843137250000001" green="0.78823529410000004" blue="0.63137254899999995" alpha="0.5" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="doneButtonAction:" destination="b2C-jK-KPV" eventType="touchUpInside" id="Vs7-qI-yBp"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="QxC-gf-8VN" secondAttribute="bottom" id="HQu-va-hRH"/>
<constraint firstAttribute="trailing" secondItem="QxC-gf-8VN" secondAttribute="trailing" id="N4c-nq-GMC"/>
<constraint firstItem="QxC-gf-8VN" firstAttribute="leading" secondItem="7aK-CF-d5d" secondAttribute="leading" id="Z8A-af-23Q"/>
<constraint firstItem="QxC-gf-8VN" firstAttribute="top" secondItem="7aK-CF-d5d" secondAttribute="top" id="sed-9I-71h"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="7aK-CF-d5d" firstAttribute="leading" secondItem="o2g-Ga-wwR" secondAttribute="leading" id="1Hy-bc-46Y"/>
<constraint firstItem="d9z-1h-dAx" firstAttribute="leading" secondItem="o2g-Ga-wwR" secondAttribute="leading" id="4QW-Ir-EWI"/>
<constraint firstAttribute="width" priority="750" constant="500" id="4a2-Az-ekr"/>
<constraint firstItem="d9z-1h-dAx" firstAttribute="top" secondItem="xlp-uc-Mug" secondAttribute="bottom" constant="50" id="JwP-Vr-c2R"/>
<constraint firstItem="epg-Qy-eoD" firstAttribute="centerX" secondItem="o2g-Ga-wwR" secondAttribute="centerX" id="K4J-2Y-7bW"/>
<constraint firstAttribute="trailing" secondItem="d9z-1h-dAx" secondAttribute="trailing" id="Z4F-zE-he5"/>
<constraint firstItem="xlp-uc-Mug" firstAttribute="leading" secondItem="o2g-Ga-wwR" secondAttribute="leading" constant="20" id="drb-kN-IRX"/>
<constraint firstItem="xlp-uc-Mug" firstAttribute="top" secondItem="epg-Qy-eoD" secondAttribute="bottom" constant="35" id="hyp-kS-l81"/>
<constraint firstAttribute="bottom" secondItem="7aK-CF-d5d" secondAttribute="bottom" constant="20" id="nPL-nn-PpM"/>
<constraint firstItem="epg-Qy-eoD" firstAttribute="top" secondItem="o2g-Ga-wwR" secondAttribute="top" constant="40" id="p1e-CF-Kln"/>
<constraint firstItem="7aK-CF-d5d" firstAttribute="top" secondItem="d9z-1h-dAx" secondAttribute="bottom" constant="20" id="vfQ-5E-INV"/>
<constraint firstAttribute="trailing" secondItem="7aK-CF-d5d" secondAttribute="trailing" id="wl8-ha-UIh"/>
<constraint firstAttribute="trailing" secondItem="xlp-uc-Mug" secondAttribute="trailing" constant="20" id="xIU-IL-ycK"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="o2g-Ga-wwR" firstAttribute="centerX" secondItem="a4X-9Q-mkr" secondAttribute="centerX" id="8Ps-hI-nHv"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="o2g-Ga-wwR" secondAttribute="trailing" id="GBk-AU-PAx"/>
<constraint firstItem="o2g-Ga-wwR" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="a4X-9Q-mkr" secondAttribute="leading" id="Z9f-1y-sJV"/>
<constraint firstAttribute="bottom" secondItem="o2g-Ga-wwR" secondAttribute="bottom" id="kJP-Gd-vDF"/>
<constraint firstItem="o2g-Ga-wwR" firstAttribute="top" secondItem="a4X-9Q-mkr" secondAttribute="top" id="zZX-fo-MMO"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="a4X-9Q-mkr" firstAttribute="top" secondItem="S5g-F9-L3B" secondAttribute="top" id="47v-Wy-vaA"/>
<constraint firstItem="a4X-9Q-mkr" firstAttribute="width" secondItem="S5g-F9-L3B" secondAttribute="width" id="REA-MB-gew"/>
<constraint firstAttribute="bottom" secondItem="a4X-9Q-mkr" secondAttribute="bottom" id="Sqk-TW-ccx"/>
<constraint firstAttribute="trailing" secondItem="a4X-9Q-mkr" secondAttribute="trailing" id="keL-QJ-bja"/>
<constraint firstItem="a4X-9Q-mkr" firstAttribute="leading" secondItem="S5g-F9-L3B" secondAttribute="leading" id="maD-UF-Wim"/>
</constraints>
</scrollView>
</subviews>
<color key="backgroundColor" red="0.94509803920000002" green="0.96078431369999995" blue="0.97254901959999995" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="hUM-zt-PJj" firstAttribute="trailing" secondItem="S5g-F9-L3B" secondAttribute="trailing" id="EAb-7P-Zsd"/>
<constraint firstAttribute="bottom" secondItem="S5g-F9-L3B" secondAttribute="bottom" id="Ham-fU-JWM"/>
<constraint firstItem="hUM-zt-PJj" firstAttribute="top" secondItem="S5g-F9-L3B" secondAttribute="top" id="Zkl-TJ-HEv"/>
<constraint firstItem="S5g-F9-L3B" firstAttribute="leading" secondItem="hUM-zt-PJj" secondAttribute="leading" id="sme-S5-pY5"/>
</constraints>
<viewLayoutGuide key="safeArea" id="hUM-zt-PJj"/>
</view>
<connections>
<outlet property="doneButton" destination="QxC-gf-8VN" id="eOc-Ec-FgG"/>
<outlet property="doneButtonBackgroundView" destination="7aK-CF-d5d" id="y7U-Ol-8Nk"/>
<outlet property="informationLabel" destination="3eY-3I-XYH" id="ZT2-Lo-JlX"/>
<outlet property="keyBackupLogoImageView" destination="epg-Qy-eoD" id="YOa-Pv-XrT"/>
<outlet property="saveRecoveryKeyButton" destination="1vK-9h-Ysd" id="eZd-Wa-eev"/>
<outlet property="saveRecoveryKeyButtonBackgroundView" destination="d9z-1h-dAx" id="XlJ-R0-P2Q"/>
<outlet property="titleLabel" destination="X7g-Ha-15I" id="yMg-6G-6lF"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Yhm-Kv-QZF" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-3178" y="-675"/>
</scene>
</scenes>
<resources>
<image name="key_backup_logo" width="48" height="46"/>
</resources>
</document>

View file

@ -0,0 +1,149 @@
/*
Copyright 2019 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import UIKit
protocol KeyBackupSetupSuccessFromPassphraseViewControllerDelegate: class {
func keyBackupSetupSuccessFromPassphraseViewControllerDidTapDoneAction(_ viewController: KeyBackupSetupSuccessFromPassphraseViewController)
}
final class KeyBackupSetupSuccessFromPassphraseViewController: UIViewController {
// MARK: - Properties
// MARK: Outlets
@IBOutlet private weak var keyBackupLogoImageView: UIImageView!
@IBOutlet private weak var titleLabel: UILabel!
@IBOutlet private weak var informationLabel: UILabel!
@IBOutlet private weak var saveRecoveryKeyButtonBackgroundView: UIView!
@IBOutlet private weak var saveRecoveryKeyButton: UIButton!
@IBOutlet private weak var doneButtonBackgroundView: UIView!
@IBOutlet private weak var doneButton: UIButton!
// MARK: Private
private var theme: Theme!
private var recoveryKey: String!
// MARK: Public
weak var delegate: KeyBackupSetupSuccessFromPassphraseViewControllerDelegate?
// MARK: - Setup
class func instantiate(with recoveryKey: String) -> KeyBackupSetupSuccessFromPassphraseViewController {
let viewController = StoryboardScene.KeyBackupSetupSuccessFromPassphraseViewController.initialScene.instantiate()
viewController.theme = ThemeService.shared().theme
viewController.recoveryKey = recoveryKey
return viewController
}
// MARK: - Life cycle
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.title = VectorL10n.keyBackupSetupTitle
self.setupViews()
self.registerThemeServiceDidChangeThemeNotification()
self.update(theme: self.theme)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Hide back button
self.navigationItem.setHidesBackButton(true, animated: animated)
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return self.theme.statusBarStyle
}
// MARK: - Private
private func setupViews() {
let keybackupLogoImage = Asset.Images.keyBackupLogo.image.withRenderingMode(.alwaysTemplate)
self.keyBackupLogoImageView.image = keybackupLogoImage
self.titleLabel.text = VectorL10n.keyBackupSetupSuccessTitle
self.informationLabel.text = VectorL10n.keyBackupSetupSuccessFromPassphraseInfo
self.saveRecoveryKeyButton.setTitle(VectorL10n.keyBackupSetupSuccessFromPassphraseSaveRecoveryKeyAction, for: .normal)
self.doneButton.setTitle(VectorL10n.keyBackupSetupSuccessFromPassphraseDoneAction, for: .normal)
}
private func update(theme: Theme) {
self.theme = theme
self.view.backgroundColor = theme.headerBackgroundColor
if let navigationBar = self.navigationController?.navigationBar {
theme.applyStyle(onNavigationBar: navigationBar)
}
self.keyBackupLogoImageView.tintColor = theme.textPrimaryColor
self.titleLabel.textColor = theme.textPrimaryColor
self.informationLabel.textColor = theme.textPrimaryColor
self.saveRecoveryKeyButtonBackgroundView.backgroundColor = theme.backgroundColor
theme.applyStyle(onButton: self.saveRecoveryKeyButton)
self.doneButtonBackgroundView.backgroundColor = theme.backgroundColor
theme.applyStyle(onButton: self.doneButton)
}
private func registerThemeServiceDidChangeThemeNotification() {
NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeServiceDidChangeTheme, object: nil)
}
@objc private func themeDidChange() {
self.update(theme: ThemeService.shared().theme)
}
private func shareRecoveryKey() {
// Set up activity view controller
let activityItems: [Any] = [ self.recoveryKey ]
let activityViewController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
// Configure source view when activity view controller is presented with a popover
if let popoverPresentationController = activityViewController.popoverPresentationController {
popoverPresentationController.sourceView = self.saveRecoveryKeyButton
popoverPresentationController.sourceRect = self.saveRecoveryKeyButton.bounds
popoverPresentationController.permittedArrowDirections = [.down, .up]
}
self.present(activityViewController, animated: true)
}
// MARK: - Actions
@IBAction private func saveRecoveryKeyButtonAction(_ sender: Any) {
self.shareRecoveryKey()
}
@IBAction private func doneButtonAction(_ sender: Any) {
self.delegate?.keyBackupSetupSuccessFromPassphraseViewControllerDidTapDoneAction(self)
}
}

View file

@ -0,0 +1,245 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Khm-Md-UED">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Key Backup Setup Success From Recovery Key View Controller-->
<scene sceneID="gsq-Wy-pzg">
<objects>
<viewController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="Khm-Md-UED" customClass="KeyBackupSetupSuccessFromRecoveryKeyViewController" customModule="Riot" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="FZy-0L-BN6">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AIk-Of-roB">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uRe-jJ-dwd">
<rect key="frame" x="0.0" y="0.0" width="375" height="544.5"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Wik-yr-B10">
<rect key="frame" x="0.0" y="0.0" width="375" height="544.5"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="key_backup_logo" translatesAutoresizingMaskIntoConstraints="NO" id="qt2-Co-aJV">
<rect key="frame" x="163.5" y="40" width="48" height="46"/>
<constraints>
<constraint firstAttribute="width" constant="48" id="GTB-c7-z7l"/>
<constraint firstAttribute="height" constant="46" id="KE1-7J-YCR"/>
</constraints>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="30" translatesAutoresizingMaskIntoConstraints="NO" id="GHv-zF-QNb">
<rect key="frame" x="20" y="121" width="335" height="122.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Success!" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jR0-Yo-c83">
<rect key="frame" x="0.0" y="0.0" width="335" height="20.5"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oby-w8-TOi">
<rect key="frame" x="0.0" y="50.5" width="335" height="72"/>
<string key="text">Your keys are being backed up.
Make a copy of this recovery key and keep it safe.</string>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WRQ-vW-GBE">
<rect key="frame" x="0.0" y="283.5" width="375" height="161"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="bottom" translatesAutoresizingMaskIntoConstraints="NO" id="61C-am-RWe">
<rect key="frame" x="0.0" y="0.0" width="375" height="161"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aLC-vi-mqP">
<rect key="frame" x="0.0" y="0.0" width="375" height="100"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" text="Recovery Key" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fiW-gH-w7e">
<rect key="frame" x="20" y="20" width="335" height="30.5"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" text="HHWJ-Y8DK-OD04-BQEN-FQ4V-M4O8" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="n2X-Zj-uh3">
<rect key="frame" x="20" y="60.5" width="335" height="19.5"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="fiW-gH-w7e" secondAttribute="trailing" constant="20" id="89v-8q-Q23"/>
<constraint firstItem="fiW-gH-w7e" firstAttribute="top" secondItem="aLC-vi-mqP" secondAttribute="top" constant="20" id="PJv-30-Rq5"/>
<constraint firstItem="n2X-Zj-uh3" firstAttribute="top" secondItem="fiW-gH-w7e" secondAttribute="bottom" constant="10" id="VsG-0Z-kTg"/>
<constraint firstAttribute="bottom" secondItem="n2X-Zj-uh3" secondAttribute="bottom" constant="20" id="Yow-gn-Mej"/>
<constraint firstItem="n2X-Zj-uh3" firstAttribute="trailing" secondItem="fiW-gH-w7e" secondAttribute="trailing" id="ZTE-56-4Ct"/>
<constraint firstItem="n2X-Zj-uh3" firstAttribute="leading" secondItem="fiW-gH-w7e" secondAttribute="leading" id="ow1-1A-Yeg"/>
<constraint firstItem="fiW-gH-w7e" firstAttribute="leading" secondItem="aLC-vi-mqP" secondAttribute="leading" constant="20" id="uBW-dX-Icj"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HLG-2s-cNX">
<rect key="frame" x="0.0" y="100" width="375" height="1"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="w9V-jQ-hPV">
<rect key="frame" x="5" y="0.0" width="365" height="1"/>
<color key="backgroundColor" red="0.93333333330000001" green="0.93725490199999995" blue="0.93725490199999995" alpha="1" colorSpace="calibratedRGB"/>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="8zL-X9-2vD"/>
<constraint firstAttribute="trailing" secondItem="w9V-jQ-hPV" secondAttribute="trailing" constant="5" id="Bvy-yn-4QL"/>
<constraint firstItem="w9V-jQ-hPV" firstAttribute="top" secondItem="HLG-2s-cNX" secondAttribute="top" id="GrJ-SA-KUZ"/>
<constraint firstAttribute="bottom" secondItem="w9V-jQ-hPV" secondAttribute="bottom" id="bnJ-AH-lL6"/>
<constraint firstItem="w9V-jQ-hPV" firstAttribute="leading" secondItem="HLG-2s-cNX" secondAttribute="leading" constant="5" id="pOr-nm-IWM"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YG6-xx-dBh">
<rect key="frame" x="0.0" y="101" width="375" height="60"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BEh-fA-BnW">
<rect key="frame" x="0.0" y="5" width="375" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="8Zg-fi-qls"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
<state key="normal" title="Make a copy">
<color key="titleColor" red="0.47843137250000001" green="0.78823529410000004" blue="0.63137254899999995" alpha="1" colorSpace="calibratedRGB"/>
</state>
<state key="disabled">
<color key="titleColor" red="0.47843137250000001" green="0.78823529410000004" blue="0.63137254899999995" alpha="0.5" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="saveRecoveryKeyButtonAction:" destination="Khm-Md-UED" eventType="touchUpInside" id="hJL-Gq-2hG"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="BEh-fA-BnW" secondAttribute="bottom" constant="5" id="E0d-bo-eDh"/>
<constraint firstItem="BEh-fA-BnW" firstAttribute="leading" secondItem="YG6-xx-dBh" secondAttribute="leading" id="Hjh-HE-ogQ"/>
<constraint firstItem="BEh-fA-BnW" firstAttribute="top" secondItem="YG6-xx-dBh" secondAttribute="top" constant="5" id="JcX-pn-VaE"/>
<constraint firstAttribute="trailing" secondItem="BEh-fA-BnW" secondAttribute="trailing" id="plA-fL-Kwa"/>
</constraints>
</view>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="61C-am-RWe" secondAttribute="trailing" id="Ga1-B0-7Z2"/>
<constraint firstItem="HLG-2s-cNX" firstAttribute="width" secondItem="WRQ-vW-GBE" secondAttribute="width" id="JTw-Am-oXG"/>
<constraint firstItem="61C-am-RWe" firstAttribute="leading" secondItem="WRQ-vW-GBE" secondAttribute="leading" id="NFO-MD-ZTX"/>
<constraint firstItem="YG6-xx-dBh" firstAttribute="width" secondItem="WRQ-vW-GBE" secondAttribute="width" id="emv-Ex-aBV"/>
<constraint firstItem="aLC-vi-mqP" firstAttribute="width" secondItem="WRQ-vW-GBE" secondAttribute="width" id="pTR-NK-Jk0"/>
<constraint firstItem="61C-am-RWe" firstAttribute="top" secondItem="WRQ-vW-GBE" secondAttribute="top" id="qEi-IO-yIo"/>
<constraint firstAttribute="bottom" secondItem="61C-am-RWe" secondAttribute="bottom" id="rYH-7v-UOW"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="orU-DS-nqI">
<rect key="frame" x="0.0" y="474.5" width="375" height="50"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dwt-9F-wdn">
<rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="cJF-XX-ASp"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
<state key="normal" title="I've made a copy">
<color key="titleColor" red="0.47843137250000001" green="0.78823529410000004" blue="0.63137254899999995" alpha="1" colorSpace="calibratedRGB"/>
</state>
<state key="disabled">
<color key="titleColor" red="0.47843137250000001" green="0.78823529410000004" blue="0.63137254899999995" alpha="0.5" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="doneButtonAction:" destination="Khm-Md-UED" eventType="touchUpInside" id="za0-Fp-97D"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="dwt-9F-wdn" firstAttribute="top" secondItem="orU-DS-nqI" secondAttribute="top" id="EFX-ap-gFm"/>
<constraint firstItem="dwt-9F-wdn" firstAttribute="leading" secondItem="orU-DS-nqI" secondAttribute="leading" id="JfT-hk-yVR"/>
<constraint firstAttribute="trailing" secondItem="dwt-9F-wdn" secondAttribute="trailing" id="tvz-oZ-vTV"/>
<constraint firstAttribute="bottom" secondItem="dwt-9F-wdn" secondAttribute="bottom" id="yrO-79-7HD"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="GHv-zF-QNb" firstAttribute="top" secondItem="qt2-Co-aJV" secondAttribute="bottom" constant="35" id="59T-65-5RL"/>
<constraint firstItem="WRQ-vW-GBE" firstAttribute="leading" secondItem="Wik-yr-B10" secondAttribute="leading" id="5Ur-T6-svz"/>
<constraint firstAttribute="trailing" secondItem="orU-DS-nqI" secondAttribute="trailing" id="5qC-6Y-T4s"/>
<constraint firstItem="orU-DS-nqI" firstAttribute="leading" secondItem="Wik-yr-B10" secondAttribute="leading" id="CCl-ic-3kN"/>
<constraint firstAttribute="bottom" secondItem="orU-DS-nqI" secondAttribute="bottom" constant="20" id="FIn-A1-bFP"/>
<constraint firstAttribute="trailing" secondItem="WRQ-vW-GBE" secondAttribute="trailing" id="HpF-Zk-ecC"/>
<constraint firstAttribute="width" priority="750" constant="500" id="KS9-XQ-h3S"/>
<constraint firstItem="qt2-Co-aJV" firstAttribute="top" secondItem="Wik-yr-B10" secondAttribute="top" constant="40" id="QBO-qx-x52"/>
<constraint firstItem="WRQ-vW-GBE" firstAttribute="top" secondItem="GHv-zF-QNb" secondAttribute="bottom" constant="40" id="WhZ-y8-wAC"/>
<constraint firstItem="orU-DS-nqI" firstAttribute="top" secondItem="WRQ-vW-GBE" secondAttribute="bottom" constant="30" id="ZoI-kT-QgN"/>
<constraint firstItem="GHv-zF-QNb" firstAttribute="leading" secondItem="Wik-yr-B10" secondAttribute="leading" constant="20" id="ehX-gT-HYT"/>
<constraint firstAttribute="trailing" secondItem="GHv-zF-QNb" secondAttribute="trailing" constant="20" id="fwQ-Ku-0qi"/>
<constraint firstItem="qt2-Co-aJV" firstAttribute="centerX" secondItem="Wik-yr-B10" secondAttribute="centerX" id="qiU-Uc-cE6"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="Wik-yr-B10" secondAttribute="trailing" id="0xl-q6-oQk"/>
<constraint firstAttribute="bottom" secondItem="Wik-yr-B10" secondAttribute="bottom" id="MSA-E9-ldf"/>
<constraint firstItem="Wik-yr-B10" firstAttribute="centerX" secondItem="uRe-jJ-dwd" secondAttribute="centerX" id="R1L-5K-uzH"/>
<constraint firstItem="Wik-yr-B10" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="uRe-jJ-dwd" secondAttribute="leading" id="yJv-wu-hok"/>
<constraint firstItem="Wik-yr-B10" firstAttribute="top" secondItem="uRe-jJ-dwd" secondAttribute="top" id="yda-iI-DhK"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="uRe-jJ-dwd" firstAttribute="leading" secondItem="AIk-Of-roB" secondAttribute="leading" id="DkY-iW-JZ2"/>
<constraint firstAttribute="trailing" secondItem="uRe-jJ-dwd" secondAttribute="trailing" id="gVw-9f-iOH"/>
<constraint firstItem="uRe-jJ-dwd" firstAttribute="top" secondItem="AIk-Of-roB" secondAttribute="top" id="iFE-uy-sRq"/>
<constraint firstItem="uRe-jJ-dwd" firstAttribute="width" secondItem="AIk-Of-roB" secondAttribute="width" id="ptq-9Q-ipn"/>
<constraint firstAttribute="bottom" secondItem="uRe-jJ-dwd" secondAttribute="bottom" id="v1C-HI-N23"/>
</constraints>
</scrollView>
</subviews>
<color key="backgroundColor" red="0.94509803920000002" green="0.96078431369999995" blue="0.97254901959999995" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="2zP-sG-01C" firstAttribute="trailing" secondItem="AIk-Of-roB" secondAttribute="trailing" id="P5y-RN-BXq"/>
<constraint firstAttribute="bottom" secondItem="AIk-Of-roB" secondAttribute="bottom" id="Qfe-LA-yKJ"/>
<constraint firstItem="AIk-Of-roB" firstAttribute="leading" secondItem="2zP-sG-01C" secondAttribute="leading" id="U5K-ZY-L09"/>
<constraint firstItem="2zP-sG-01C" firstAttribute="top" secondItem="AIk-Of-roB" secondAttribute="top" id="q8k-xW-QEy"/>
</constraints>
<viewLayoutGuide key="safeArea" id="2zP-sG-01C"/>
</view>
<connections>
<outlet property="informationLabel" destination="oby-w8-TOi" id="jPa-0G-lGO"/>
<outlet property="keyBackupLogoImageView" destination="qt2-Co-aJV" id="wGM-vK-KU3"/>
<outlet property="madeACopyButton" destination="dwt-9F-wdn" id="OqF-i5-VrP"/>
<outlet property="madeACopyButtonBackgroundView" destination="orU-DS-nqI" id="GHn-EY-zkf"/>
<outlet property="makeACopyButton" destination="BEh-fA-BnW" id="scn-P0-xGI"/>
<outlet property="recoveryKeyLabel" destination="n2X-Zj-uh3" id="MaM-SP-jrd"/>
<outlet property="recoveryKeySectionBackgroundView" destination="WRQ-vW-GBE" id="dGg-Yc-PJE"/>
<outlet property="recoveryKeyTitleLabel" destination="fiW-gH-w7e" id="OmG-gJ-Vqf"/>
<outlet property="separatorView" destination="w9V-jQ-hPV" id="Nrd-h8-jYX"/>
<outlet property="titleLabel" destination="jR0-Yo-c83" id="072-OA-VmH"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="QsP-yf-rxo" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-3178" y="-675"/>
</scene>
</scenes>
<resources>
<image name="key_backup_logo" width="48" height="46"/>
</resources>
</document>

View file

@ -0,0 +1,181 @@
/*
Copyright 2019 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import UIKit
protocol KeyBackupSetupSuccessFromRecoveryKeyViewControllerDelegate: class {
func keyBackupSetupSuccessFromRecoveryKeyViewControllerDidTapDoneAction(_ viewController: KeyBackupSetupSuccessFromRecoveryKeyViewController)
}
final class KeyBackupSetupSuccessFromRecoveryKeyViewController: UIViewController {
// MARK: - Properties
// MARK: Outlets
@IBOutlet private weak var keyBackupLogoImageView: UIImageView!
@IBOutlet private weak var titleLabel: UILabel!
@IBOutlet private weak var informationLabel: UILabel!
@IBOutlet private weak var recoveryKeySectionBackgroundView: UIView!
@IBOutlet private weak var recoveryKeyTitleLabel: UILabel!
@IBOutlet private weak var recoveryKeyLabel: UILabel!
@IBOutlet private weak var separatorView: UIView!
@IBOutlet private weak var makeACopyButton: UIButton!
@IBOutlet private weak var madeACopyButtonBackgroundView: UIView!
@IBOutlet private weak var madeACopyButton: UIButton!
// MARK: Private
private var theme: Theme!
private var recoveryKey: String!
private var hasMadeARecoveryKeyCopy: Bool = false
// MARK: Public
weak var delegate: KeyBackupSetupSuccessFromRecoveryKeyViewControllerDelegate?
// MARK: - Setup
class func instantiate(with recoveryKey: String) -> KeyBackupSetupSuccessFromRecoveryKeyViewController {
let viewController = StoryboardScene.KeyBackupSetupSuccessFromRecoveryKeyViewController.initialScene.instantiate()
viewController.theme = ThemeService.shared().theme
viewController.recoveryKey = recoveryKey
return viewController
}
// MARK: - Life cycle
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.title = VectorL10n.keyBackupSetupTitle
self.setupViews()
self.registerThemeServiceDidChangeThemeNotification()
self.update(theme: self.theme)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Hide back button
self.navigationItem.setHidesBackButton(true, animated: animated)
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return self.theme.statusBarStyle
}
// MARK: - Private
private func setupViews() {
let keybackupLogoImage = Asset.Images.keyBackupLogo.image.withRenderingMode(.alwaysTemplate)
self.keyBackupLogoImageView.image = keybackupLogoImage
self.titleLabel.text = VectorL10n.keyBackupSetupSuccessTitle
self.informationLabel.text = VectorL10n.keyBackupSetupSuccessFromRecoveryKeyInfo
self.recoveryKeyTitleLabel.text = VectorL10n.keyBackupSetupSuccessFromRecoveryKeyRecoveryKeyTitle
self.recoveryKeyLabel.text = self.recoveryKey
self.makeACopyButton.setTitle(VectorL10n.keyBackupSetupSuccessFromRecoveryKeyMakeCopyAction, for: .normal)
self.madeACopyButton.setTitle(VectorL10n.keyBackupSetupSuccessFromRecoveryKeyMadeCopyAction, for: .normal)
self.updateDoneButton()
}
private func update(theme: Theme) {
self.theme = theme
self.view.backgroundColor = theme.headerBackgroundColor
if let navigationBar = self.navigationController?.navigationBar {
theme.applyStyle(onNavigationBar: navigationBar)
}
self.keyBackupLogoImageView.tintColor = theme.textPrimaryColor
self.titleLabel.textColor = theme.textPrimaryColor
self.informationLabel.textColor = theme.textPrimaryColor
self.recoveryKeySectionBackgroundView.backgroundColor = theme.backgroundColor
self.recoveryKeyTitleLabel.textColor = theme.textPrimaryColor
self.recoveryKeyLabel.textColor = theme.textPrimaryColor
self.separatorView.backgroundColor = theme.separatorColor
theme.applyStyle(onButton: self.makeACopyButton)
self.madeACopyButtonBackgroundView.backgroundColor = theme.backgroundColor
theme.applyStyle(onButton: self.madeACopyButton)
}
private func registerThemeServiceDidChangeThemeNotification() {
NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeServiceDidChangeTheme, object: nil)
}
@objc private func themeDidChange() {
self.update(theme: ThemeService.shared().theme)
}
private func shareRecoveryKey() {
// Set up activity view controller
let activityItems: [Any] = [ self.recoveryKey ]
let activityViewController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
activityViewController.completionWithItemsHandler = { (activityType, completed, returnedItems, error) in
// Enable made copy button only if user has selected an activity item and has setup recovery key without passphrase
if completed {
self.hasMadeARecoveryKeyCopy = true
self.updateDoneButton()
}
}
// Configure source view when activity view controller is presented with a popover
if let popoverPresentationController = activityViewController.popoverPresentationController {
popoverPresentationController.sourceView = self.makeACopyButton
popoverPresentationController.sourceRect = self.makeACopyButton.bounds
popoverPresentationController.permittedArrowDirections = [.down, .up]
}
self.present(activityViewController, animated: true)
}
private func updateDoneButton() {
self.madeACopyButton.isEnabled = self.hasMadeARecoveryKeyCopy
}
// MARK: - Actions
@IBAction private func saveRecoveryKeyButtonAction(_ sender: Any) {
self.shareRecoveryKey()
}
@IBAction private func doneButtonAction(_ sender: Any) {
self.delegate?.keyBackupSetupSuccessFromRecoveryKeyViewControllerDidTapDoneAction(self)
}
}