Merge branch 'develop' into element_3579

# Conflicts:
#	CHANGES.rst
This commit is contained in:
ismailgulek 2020-10-19 16:59:19 +03:00
commit a67f5dab95
16 changed files with 191 additions and 89 deletions

View file

@ -5,8 +5,7 @@ Changes to be released in next version
*
🙌 Improvements
* Device verification: Do not check for existing key backup after SSSS & Cross-Signing reset.
* Cross-signing: Detect when cross-signing keys have been changed.
* Secure backup: Add possibility to not expose recovery key when creating a secure backup.
* NSE: Background sync and store/aggregate sync responses on pushes, to make messages available when the app is foregrounded (#3579).
🐛 Bugfix
@ -24,6 +23,35 @@ Changes to be released in next version
Others
*
Changes in 1.0.17 (2020-10-14)
=================================================
✨ Features
*
🙌 Improvements
* Device verification: Do not check for existing key backup after SSSS & Cross-Signing reset.
* Cross-signing: Detect when cross-signing keys have been changed.
* Make copying & pasting media configurable.
🐛 Bugfix
*
⚠️ API Changes
*
🗣 Translations
*
🧱 Build
*
Others
*
Improvements:
* Upgrade MatrixKit version ([v0.12.25](https://github.com/matrix-org/matrix-ios-kit/releases/tag/v0.12.25)).
Changes in 1.0.16 (2020-10-13)
=================================================

View file

@ -216,6 +216,8 @@ final class BuildSettings: NSObject {
static let messageDetailsAllowPermalink: Bool = true
static let messageDetailsAllowViewSource: Bool = true
static let messageDetailsAllowSave: Bool = true
static let messageDetailsAllowCopyMedia: Bool = true
static let messageDetailsAllowPasteMedia: Bool = true
// MARK: - HTTP
/// Additional HTTP headers will be sent by all requests. Not recommended to use request-specific headers, like `Authorization`.

View file

@ -43,6 +43,8 @@ class CommonConfiguration: NSObject, Configurable {
settings.messageDetailsAllowSharing = BuildSettings.messageDetailsAllowShare
settings.messageDetailsAllowSaving = BuildSettings.messageDetailsAllowSave
settings.messageDetailsAllowCopyingMedia = BuildSettings.messageDetailsAllowCopyMedia
settings.messageDetailsAllowPastingMedia = BuildSettings.messageDetailsAllowPasteMedia
MXKContactManager.shared().allowLocalContactsAccess = BuildSettings.allowLocalContactsAccess
}

View file

@ -11,7 +11,7 @@ use_frameworks!
# - `{ {kit spec hash} => {sdk spec hash}` to depend on specific pod options (:git => …, :podspec => …) for each repo. Used by Fastfile during CI
#
# Warning: our internal tooling depends on the name of this variable name, so be sure not to change it
$matrixKitVersion = '0.12.24'
$matrixKitVersion = '= 0.12.25'
# $matrixKitVersion = :local
# $matrixKitVersion = {'develop' => 'develop'}

View file

@ -53,38 +53,38 @@ PODS:
- MatomoTracker (7.2.1):
- MatomoTracker/Core (= 7.2.1)
- MatomoTracker/Core (7.2.1)
- MatrixKit (0.12.24):
- MatrixKit (0.12.25):
- Down (~> 0.9.3)
- DTCoreText (~> 1.6.23)
- HPGrowingTextView (~> 1.1)
- libPhoneNumber-iOS (~> 0.9.13)
- MatrixKit/Core (= 0.12.24)
- MatrixSDK (= 0.16.18)
- MatrixKit/AppExtension (0.12.24):
- MatrixKit/Core (= 0.12.25)
- MatrixSDK (= 0.16.19)
- MatrixKit/AppExtension (0.12.25):
- Down (~> 0.9.3)
- DTCoreText (~> 1.6.23)
- DTCoreText/Extension
- HPGrowingTextView (~> 1.1)
- libPhoneNumber-iOS (~> 0.9.13)
- MatrixSDK (= 0.16.18)
- MatrixKit/Core (0.12.24):
- MatrixSDK (= 0.16.19)
- MatrixKit/Core (0.12.25):
- Down (~> 0.9.3)
- DTCoreText (~> 1.6.23)
- HPGrowingTextView (~> 1.1)
- libPhoneNumber-iOS (~> 0.9.13)
- MatrixSDK (= 0.16.18)
- MatrixSDK (0.16.18):
- MatrixSDK/Core (= 0.16.18)
- MatrixSDK/Core (0.16.18):
- MatrixSDK (= 0.16.19)
- MatrixSDK (0.16.19):
- MatrixSDK/Core (= 0.16.19)
- MatrixSDK/Core (0.16.19):
- AFNetworking (~> 4.0.0)
- GZIP (~> 1.2.2)
- libbase58 (~> 0.1.4)
- OLMKit (~> 3.1.0)
- Realm (~> 4.4.0)
- MatrixSDK/JingleCallStack (0.16.18):
- MatrixSDK/JingleCallStack (0.16.19):
- JitsiMeetSDK (~> 2.8.1)
- MatrixSDK/Core
- MatrixSDK/SwiftSupport (0.16.18):
- MatrixSDK/SwiftSupport (0.16.19):
- MatrixSDK/Core
- OLMKit (3.1.0):
- OLMKit/olmc (= 3.1.0)
@ -116,8 +116,8 @@ DEPENDENCIES:
- KeychainAccess (~> 4.2)
- KTCenterFlowLayout (~> 1.3.1)
- MatomoTracker (~> 7.2.0)
- MatrixKit (= 0.12.24)
- MatrixKit/AppExtension (= 0.12.24)
- MatrixKit (= 0.12.25)
- MatrixKit/AppExtension (= 0.12.25)
- MatrixSDK
- MatrixSDK/JingleCallStack
- MatrixSDK/SwiftSupport
@ -175,8 +175,8 @@ SPEC CHECKSUMS:
libbase58: 7c040313537b8c44b6e2d15586af8e21f7354efd
libPhoneNumber-iOS: 0a32a9525cf8744fe02c5206eb30d571e38f7d75
MatomoTracker: 246b6b0693cf39b356134dec7561f719d3538b96
MatrixKit: f7fd6a0f152aa1c0b71457c512025bb202343cba
MatrixSDK: 7bdaee197004919ae34670d5ba043d5bff95e4df
MatrixKit: 56fa2848229dc866c712f3b60e634f14a498d975
MatrixSDK: 1c4aee61037751f3b582ea09dbc7efeaf9b423d0
OLMKit: 4ee0159d63feeb86d836fdcfefe418e163511639
ReadMoreTextView: 19147adf93abce6d7271e14031a00303fe28720d
Realm: 4eb04d7487bd43c0581256f40b424eafb711deff
@ -186,6 +186,6 @@ SPEC CHECKSUMS:
zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c
ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb
PODFILE CHECKSUM: 67035ff6c96ebee323589c4919aff428e315d5de
PODFILE CHECKSUM: d63d69286003b12daa38bc1f8fdbe0309ab91c2a
COCOAPODS: 1.9.3

View file

@ -7285,7 +7285,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1.0.17;
CURRENT_PROJECT_VERSION = 1.0.18;
DEFINES_MODULE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -7305,7 +7305,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 1.0.17;
MARKETING_VERSION = 1.0.18;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@ -7344,7 +7344,7 @@
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 1.0.17;
CURRENT_PROJECT_VERSION = 1.0.18;
DEFINES_MODULE = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -7357,7 +7357,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 1.0.17;
MARKETING_VERSION = 1.0.18;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;

View file

@ -1420,6 +1420,9 @@
"key_backup_setup_passphrase_confirm_passphrase_valid" = "Great!";
"key_backup_setup_passphrase_confirm_passphrase_invalid" = "Passphrase doesnt match";
"secrets_setup_recovery_passphrase_summary_title" = "Save your Security Phrase";
"secrets_setup_recovery_passphrase_summary_information" = "Remember your Security Phrase. It can be used to unlock your encrypted messages & data.";
// MARK: - Secrets reset
"secrets_reset_title" = "Reset everything";

View file

@ -3398,6 +3398,14 @@ internal enum VectorL10n {
internal static var secretsSetupRecoveryPassphraseInformation: String {
return VectorL10n.tr("Vector", "secrets_setup_recovery_passphrase_information")
}
/// Store your Recovery Passphrase somewhere safe. It can be used to unlock your encrypted messages & data.
internal static var secretsSetupRecoveryPassphraseSummaryInformation: String {
return VectorL10n.tr("Vector", "secrets_setup_recovery_passphrase_summary_information")
}
/// Save your Security Phrase
internal static var secretsSetupRecoveryPassphraseSummaryTitle: String {
return VectorL10n.tr("Vector", "secrets_setup_recovery_passphrase_summary_title")
}
/// Set a Security Phrase
internal static var secretsSetupRecoveryPassphraseTitle: String {
return VectorL10n.tr("Vector", "secrets_setup_recovery_passphrase_title")

View file

@ -4296,11 +4296,15 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
{
NSLog(@"[AppDelegate] registerDidChangeCrossSigningKeysNotificationForSession: Hide NewSignInAlertController");
[self.userNewSignInAlertController dismissViewControllerAnimated:NO completion:nil];
[self.userNewSignInAlertController dismissViewControllerAnimated:NO completion:^{
[self.masterTabBarController presentVerifyCurrentSessionAlertIfNeededWithSession:session];
}];
self.userNewSignInAlertController = nil;
}
[self.masterTabBarController presentVerifyCurrentSessionAlertIfNeededWithSession:session];
else
{
[self.masterTabBarController presentVerifyCurrentSessionAlertIfNeededWithSession:session];
}
}];
}

View file

@ -5209,6 +5209,11 @@
BOOL isCopyActionEnabled = !attachment || attachment.type != MXKAttachmentTypeSticker;
if (attachment && !BuildSettings.messageDetailsAllowCopyMedia)
{
isCopyActionEnabled = NO;
}
if (isCopyActionEnabled)
{
switch (event.eventType) {

View file

@ -37,8 +37,10 @@ final class SecretsSetupRecoveryKeyCoordinator: SecretsSetupRecoveryKeyCoordinat
// MARK: - Setup
init(recoveryService: MXRecoveryService, passphrase: String?) {
let secretsSetupRecoveryKeyViewModel = SecretsSetupRecoveryKeyViewModel(recoveryService: recoveryService, passphrase: passphrase)
init(recoveryService: MXRecoveryService,
passphrase: String?,
passphraseOnly: Bool) {
let secretsSetupRecoveryKeyViewModel = SecretsSetupRecoveryKeyViewModel(recoveryService: recoveryService, passphrase: passphrase, passphraseOnly: passphraseOnly)
let secretsSetupRecoveryKeyViewController = SecretsSetupRecoveryKeyViewController.instantiate(with: secretsSetupRecoveryKeyViewModel)
self.secretsSetupRecoveryKeyViewModel = secretsSetupRecoveryKeyViewModel
self.secretsSetupRecoveryKeyViewController = secretsSetupRecoveryKeyViewController

View file

@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="EoE-Pl-I63">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097.3" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="EoE-Pl-I63">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@ -49,52 +47,58 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zgt-AN-9EH">
<rect key="frame" x="0.0" y="242" width="414" height="120"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cju-9A-6Ns" customClass="RoundedButton" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="20" y="0.0" width="374" height="50"/>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="Nbm-U7-u0J">
<rect key="frame" x="20" y="0.0" width="374" height="120"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cju-9A-6Ns" customClass="RoundedButton" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="374" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="ywR-tU-0tp"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<inset key="contentEdgeInsets" minX="20" minY="0.0" maxX="20" maxY="0.0"/>
<state key="normal" title="Export">
<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="exportButtonAction:" destination="EoE-Pl-I63" eventType="touchUpInside" id="8Sv-N4-mhU"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="v3h-dA-xvr" userLabel="Continue" customClass="RoundedButton" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="70" width="374" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="efg-jS-vMe"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<inset key="contentEdgeInsets" minX="20" minY="0.0" maxX="20" maxY="0.0"/>
<state key="normal" title="Continue">
<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="EoE-Pl-I63" eventType="touchUpInside" id="NO6-2J-vWo"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="50" id="ywR-tU-0tp"/>
<constraint firstItem="cju-9A-6Ns" firstAttribute="width" secondItem="Nbm-U7-u0J" secondAttribute="width" id="3Q0-zU-kSa"/>
<constraint firstItem="v3h-dA-xvr" firstAttribute="width" secondItem="Nbm-U7-u0J" secondAttribute="width" id="zpJ-fc-yEu"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<inset key="contentEdgeInsets" minX="20" minY="0.0" maxX="20" maxY="0.0"/>
<state key="normal" title="Export">
<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="exportButtonAction:" destination="EoE-Pl-I63" eventType="touchUpInside" id="8Sv-N4-mhU"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="v3h-dA-xvr" userLabel="Continue" customClass="RoundedButton" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="20" y="70" width="374" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="efg-jS-vMe"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<inset key="contentEdgeInsets" minX="20" minY="0.0" maxX="20" maxY="0.0"/>
<state key="normal" title="Continue">
<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="EoE-Pl-I63" eventType="touchUpInside" id="NO6-2J-vWo"/>
</connections>
</button>
</stackView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="v3h-dA-xvr" firstAttribute="top" secondItem="cju-9A-6Ns" secondAttribute="bottom" constant="20" id="CVl-bR-ZyK"/>
<constraint firstAttribute="bottom" secondItem="v3h-dA-xvr" secondAttribute="bottom" id="PPw-gM-JID"/>
<constraint firstItem="v3h-dA-xvr" firstAttribute="leading" secondItem="cju-9A-6Ns" secondAttribute="leading" id="THe-E7-SvT"/>
<constraint firstItem="v3h-dA-xvr" firstAttribute="trailing" secondItem="cju-9A-6Ns" secondAttribute="trailing" id="W5O-7M-cF3"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="cju-9A-6Ns" secondAttribute="trailing" constant="20" id="X0c-Z0-KGn"/>
<constraint firstItem="cju-9A-6Ns" firstAttribute="top" secondItem="zgt-AN-9EH" secondAttribute="top" id="dPj-uh-WWa"/>
<constraint firstItem="cju-9A-6Ns" firstAttribute="centerX" secondItem="zgt-AN-9EH" secondAttribute="centerX" id="iuh-Zf-BZM"/>
<constraint firstItem="cju-9A-6Ns" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="zgt-AN-9EH" secondAttribute="leading" constant="20" id="iyq-Bv-kvf"/>
<constraint firstItem="cju-9A-6Ns" firstAttribute="width" secondItem="zgt-AN-9EH" secondAttribute="width" priority="750" id="t3e-c6-wSf"/>
<constraint firstItem="Nbm-U7-u0J" firstAttribute="width" secondItem="zgt-AN-9EH" secondAttribute="width" priority="750" id="IVm-Um-rVO"/>
<constraint firstItem="Nbm-U7-u0J" firstAttribute="centerX" secondItem="zgt-AN-9EH" secondAttribute="centerX" id="Loa-hj-EGO"/>
<constraint firstAttribute="bottom" secondItem="Nbm-U7-u0J" secondAttribute="bottom" id="XYI-0q-4F1"/>
<constraint firstItem="Nbm-U7-u0J" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="zgt-AN-9EH" secondAttribute="leading" constant="20" id="aNG-Pe-yCg"/>
<constraint firstItem="Nbm-U7-u0J" firstAttribute="top" secondItem="zgt-AN-9EH" secondAttribute="top" id="pWA-9P-KBl"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="Nbm-U7-u0J" secondAttribute="trailing" constant="20" id="vLC-EA-fxi"/>
</constraints>
</view>
</subviews>

View file

@ -33,6 +33,7 @@ final class SecretsSetupRecoveryKeyViewController: UIViewController {
// MARK: Private
private var viewModel: SecretsSetupRecoveryKeyViewModelType!
private var isPassphraseOnly: Bool = true
private var theme: Theme!
private var errorPresenter: MXKErrorPresentation!
private var activityPresenter: ActivityIndicatorPresenter!
@ -132,22 +133,56 @@ final class SecretsSetupRecoveryKeyViewController: UIViewController {
switch viewState {
case .loading:
self.renderLoading()
case .loaded(let recoveryKey):
self.renderLoaded(recoveryKey: recoveryKey)
case .loaded(let passphraseOnly):
self.renderLoaded(passphraseOnly: passphraseOnly)
case .recoveryCreated(let recoveryKey):
self.renderRecoveryCreated(recoveryKey: recoveryKey)
case .error(let error):
self.render(error: error)
}
}
private func renderLoaded(passphraseOnly: Bool) {
self.isPassphraseOnly = passphraseOnly
let title: String
let secretsLogoImage: UIImage
let informationText: String
let recoveryKeyText: String?
if passphraseOnly {
title = VectorL10n.secretsSetupRecoveryPassphraseSummaryTitle
secretsLogoImage = Asset.Images.secretsSetupPassphrase.image
informationText = VectorL10n.secretsSetupRecoveryPassphraseSummaryInformation
recoveryKeyText = nil
} else {
title = VectorL10n.secretsSetupRecoveryKeyTitle
secretsLogoImage = Asset.Images.secretsSetupKey.image
informationText = VectorL10n.secretsSetupRecoveryKeyInformation
recoveryKeyText = VectorL10n.secretsSetupRecoveryKeyLoading
}
self.title = title
self.secureKeyImageView.image = secretsLogoImage
self.informationLabel.text = informationText
self.exportButton.isHidden = passphraseOnly
self.recoveryKeyLabel.text = recoveryKeyText
}
private func renderLoading() {
self.activityPresenter.presentActivityIndicator(on: self.view, animated: true)
}
private func renderLoaded(recoveryKey: String) {
private func renderRecoveryCreated(recoveryKey: String) {
self.activityPresenter.removeCurrentActivityIndicator(animated: true)
self.exportButton.isEnabled = true
self.recoveryKey = recoveryKey
self.recoveryKeyLabel.text = recoveryKey
self.exportButton.isEnabled = !self.isPassphraseOnly
self.doneButton.isEnabled = self.isPassphraseOnly
if !self.isPassphraseOnly {
self.recoveryKey = recoveryKey
self.recoveryKeyLabel.text = recoveryKey
}
}
private func render(error: Error) {
@ -208,7 +243,12 @@ final class SecretsSetupRecoveryKeyViewController: UIViewController {
}
@IBAction private func doneButtonAction(_ sender: Any) {
self.presentKeepSafeAlert()
if self.isPassphraseOnly {
self.viewModel.process(viewAction: .done)
} else {
self.presentKeepSafeAlert()
}
}
private func cancelButtonAction() {

View file

@ -26,6 +26,7 @@ final class SecretsSetupRecoveryKeyViewModel: SecretsSetupRecoveryKeyViewModelTy
private let recoveryService: MXRecoveryService
private let passphrase: String?
private let passphraseOnly: Bool
// MARK: Public
@ -34,9 +35,10 @@ final class SecretsSetupRecoveryKeyViewModel: SecretsSetupRecoveryKeyViewModelTy
// MARK: - Setup
init(recoveryService: MXRecoveryService, passphrase: String?) {
init(recoveryService: MXRecoveryService, passphrase: String?, passphraseOnly: Bool) {
self.recoveryService = recoveryService
self.passphrase = passphrase
self.passphraseOnly = passphraseOnly
}
// MARK: - Public
@ -44,6 +46,7 @@ final class SecretsSetupRecoveryKeyViewModel: SecretsSetupRecoveryKeyViewModelTy
func process(viewAction: SecretsSetupRecoveryKeyViewAction) {
switch viewAction {
case .loadData:
self.update(viewState: .loaded(self.passphraseOnly))
self.createSecureKey()
case .done:
self.coordinatorDelegate?.secretsSetupRecoveryKeyViewModelDidComplete(self)
@ -60,7 +63,7 @@ final class SecretsSetupRecoveryKeyViewModel: SecretsSetupRecoveryKeyViewModelTy
self.update(viewState: .loading)
self.recoveryService.createRecovery(forSecrets: nil, withPassphrase: self.passphrase, createServicesBackups: true, success: { secretStorageKeyCreationInfo in
self.update(viewState: .loaded(secretStorageKeyCreationInfo.recoveryKey))
self.update(viewState: .recoveryCreated(secretStorageKeyCreationInfo.recoveryKey))
}, failure: { error in
self.update(viewState: .error(error))
})

View file

@ -20,7 +20,8 @@ import Foundation
/// SecretsSetupRecoveryKeyViewController view state
enum SecretsSetupRecoveryKeyViewState {
case loaded(_ passphraseOnly: Bool)
case loading
case loaded(_ recoveryKey: String)
case recoveryCreated(_ recoveryKey: String)
case error(Error)
}

View file

@ -84,8 +84,8 @@ final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType {
return introViewController
}
private func showSetupKey(passphrase: String? = nil) {
let coordinator = SecretsSetupRecoveryKeyCoordinator(recoveryService: self.recoveryService, passphrase: passphrase)
private func showSetupKey(passphraseOnly: Bool, passphrase: String? = nil) {
let coordinator = SecretsSetupRecoveryKeyCoordinator(recoveryService: self.recoveryService, passphrase: passphrase, passphraseOnly: passphraseOnly)
coordinator.delegate = self
coordinator.start()
@ -161,7 +161,7 @@ final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType {
extension SecureBackupSetupCoordinator: SecureBackupSetupIntroViewControllerDelegate {
func secureBackupSetupIntroViewControllerDidTapUseKey(_ secureBackupSetupIntroViewController: SecureBackupSetupIntroViewController) {
self.showSetupKey()
self.showSetupKey(passphraseOnly: false)
}
func secureBackupSetupIntroViewControllerDidTapUsePassphrase(_ secureBackupSetupIntroViewController: SecureBackupSetupIntroViewController) {
@ -201,7 +201,7 @@ extension SecureBackupSetupCoordinator: SecretsSetupRecoveryPassphraseCoordinato
}
func secretsSetupRecoveryPassphraseCoordinator(_ coordinator: SecretsSetupRecoveryPassphraseCoordinatorType, didConfirmPassphrase passphrase: String) {
self.showSetupKey(passphrase: passphrase)
self.showSetupKey(passphraseOnly: false, passphrase: passphrase)
}
func secretsSetupRecoveryPassphraseCoordinatorDidCancel(_ coordinator: SecretsSetupRecoveryPassphraseCoordinatorType) {