UserVerificationSessionStatusViewController: Add manually verify button

This commit is contained in:
manuroe 2020-05-05 18:14:23 +02:00
parent d8e61aeb31
commit 21e6310fd8
4 changed files with 45 additions and 7 deletions

View file

@ -1296,5 +1296,6 @@
"user_verification_session_details_additional_information_untrusted_other_user" = "Until this user trusts this session, messages sent to and from it are labelled with warnings. Alternatively, you can manually verify it.";
"user_verification_session_details_additional_information_untrusted_current_user" = "If you didnt sign in to this session, your account may be compromised.";
"user_verification_session_details_verify_action_current_user" = "Verify";
"user_verification_session_details_verify_action_current_user" = "Interactively Verify";
"user_verification_session_details_verify_action_current_user_manually" = "Manually Verify by Text";
"user_verification_session_details_verify_action_other_user" = "Manually verify";

View file

@ -3746,10 +3746,14 @@ internal enum VectorL10n {
internal static var userVerificationSessionDetailsUntrustedTitle: String {
return VectorL10n.tr("Vector", "user_verification_session_details_untrusted_title")
}
/// Verify
/// Interactively Verify
internal static var userVerificationSessionDetailsVerifyActionCurrentUser: String {
return VectorL10n.tr("Vector", "user_verification_session_details_verify_action_current_user")
}
/// Manually Verify by Text
internal static var userVerificationSessionDetailsVerifyActionCurrentUserManually: String {
return VectorL10n.tr("Vector", "user_verification_session_details_verify_action_current_user_manually")
}
/// Manually verify
internal static var userVerificationSessionDetailsVerifyActionOtherUser: String {
return VectorL10n.tr("Vector", "user_verification_session_details_verify_action_other_user")

View file

@ -22,7 +22,7 @@
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sX2-Xu-9f5">
<rect key="frame" x="0.0" y="0.0" width="375" height="296.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="348.5"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1lx-d3-6c2">
<rect key="frame" x="0.0" y="0.0" width="375" height="108"/>
@ -102,10 +102,10 @@
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="rB7-Ct-Mq7">
<rect key="frame" x="0.0" y="148.5" width="375" height="148"/>
<rect key="frame" x="0.0" y="148.5" width="375" height="200"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oRN-W6-TVF">
<rect key="frame" x="0.0" y="0.0" width="375" height="148"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="200"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dd2-N5-GEx">
<rect key="frame" x="20" y="10" width="335" height="54"/>
@ -123,7 +123,7 @@
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<inset key="contentEdgeInsets" minX="30" minY="0.0" maxX="30" maxY="0.0"/>
<state key="normal" title="Manually verify">
<state key="normal" title="Verify">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
@ -131,15 +131,36 @@
<action selector="verifyButtonAction:" destination="edG-Ef-G5W" eventType="touchUpInside" id="gGx-OT-X5w"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="249" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zpI-gc-wUh">
<rect key="frame" x="76" y="136" width="223" height="44"/>
<accessibility key="accessibilityConfiguration" identifier="AuthenticationVCLoginButton"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="100" id="e0g-or-1Fr"/>
<constraint firstAttribute="height" constant="44" id="m7k-72-n0t"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<inset key="contentEdgeInsets" minX="30" minY="0.0" maxX="30" maxY="0.0"/>
<state key="normal" title="Manually Verify by Text">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="manuallyVerifyButtonAction:" destination="edG-Ef-G5W" eventType="touchUpInside" id="fpP-Yv-6dD"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="HiI-uV-Hjw" secondAttribute="bottom" constant="20" id="3bP-Hs-m42"/>
<constraint firstItem="zpI-gc-wUh" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="oRN-W6-TVF" secondAttribute="leading" constant="20" id="3AK-6W-oYS"/>
<constraint firstAttribute="trailing" secondItem="dd2-N5-GEx" secondAttribute="trailing" constant="20" id="BHw-Yv-ceG"/>
<constraint firstItem="dd2-N5-GEx" firstAttribute="leading" secondItem="oRN-W6-TVF" secondAttribute="leading" constant="20" id="BV7-Vu-PQR"/>
<constraint firstItem="HiI-uV-Hjw" firstAttribute="top" secondItem="dd2-N5-GEx" secondAttribute="bottom" constant="20" id="BtT-Mg-Okq"/>
<constraint firstItem="HiI-uV-Hjw" firstAttribute="centerX" secondItem="oRN-W6-TVF" secondAttribute="centerX" id="Ign-Yp-tpB"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="zpI-gc-wUh" secondAttribute="trailing" constant="20" id="T1v-Iv-kls"/>
<constraint firstItem="dd2-N5-GEx" firstAttribute="top" secondItem="oRN-W6-TVF" secondAttribute="top" constant="10" id="Ygn-tl-ahK"/>
<constraint firstAttribute="bottom" secondItem="zpI-gc-wUh" secondAttribute="bottom" constant="20" id="bsQ-04-17O"/>
<constraint firstItem="zpI-gc-wUh" firstAttribute="top" secondItem="HiI-uV-Hjw" secondAttribute="bottom" constant="8" symbolic="YES" id="i06-nz-c3n"/>
<constraint firstItem="zpI-gc-wUh" firstAttribute="centerX" secondItem="oRN-W6-TVF" secondAttribute="centerX" id="lCz-Rb-vQB"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="HiI-uV-Hjw" secondAttribute="trailing" constant="20" id="nqA-lS-ubx"/>
<constraint firstItem="HiI-uV-Hjw" firstAttribute="width" secondItem="oRN-W6-TVF" secondAttribute="width" priority="250" id="qp1-z5-eP9"/>
<constraint firstItem="HiI-uV-Hjw" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="oRN-W6-TVF" secondAttribute="leading" constant="20" id="uNl-Ok-uee"/>
@ -191,6 +212,7 @@
<outlet property="deviceInformationLabel" destination="FET-ZT-Q69" id="D8n-5b-H4p"/>
<outlet property="deviceStatusImageView" destination="0ME-4K-MWA" id="kgp-dT-Q0P"/>
<outlet property="informationLabel" destination="CTY-XM-iLf" id="qVC-lS-YOY"/>
<outlet property="manuallyVerifyButton" destination="zpI-gc-wUh" id="tt1-h1-TrK"/>
<outlet property="titleLabel" destination="mXI-Sg-wYe" id="Wrj-QM-srt"/>
<outlet property="untrustedSessionContainerView" destination="oRN-W6-TVF" id="9sc-53-MWY"/>
<outlet property="untrustedSessionInformationLabel" destination="dd2-N5-GEx" id="6TB-Ve-OyC"/>

View file

@ -45,6 +45,7 @@ final class UserVerificationSessionStatusViewController: UIViewController {
@IBOutlet private weak var untrustedSessionContainerView: UIView!
@IBOutlet private weak var untrustedSessionInformationLabel: UILabel!
@IBOutlet private weak var verifyButton: UIButton!
@IBOutlet private weak var manuallyVerifyButton: UIButton!
// MARK: Private
@ -111,6 +112,8 @@ final class UserVerificationSessionStatusViewController: UIViewController {
self.untrustedSessionInformationLabel.textColor = theme.textPrimaryColor
self.verifyButton.vc_setBackgroundColor(theme.tintColor, for: .normal)
theme.applyStyle(onButton: self.manuallyVerifyButton)
}
private func registerThemeServiceDidChangeThemeNotification() {
@ -124,6 +127,8 @@ final class UserVerificationSessionStatusViewController: UIViewController {
private func setupViews() {
self.closeButton.layer.masksToBounds = true
self.verifyButton.layer.masksToBounds = true
self.manuallyVerifyButton.setTitle(VectorL10n.userVerificationSessionDetailsVerifyActionCurrentUserManually, for: .normal)
}
private func render(viewState: UserVerificationSessionStatusViewState) {
@ -149,6 +154,8 @@ final class UserVerificationSessionStatusViewController: UIViewController {
self.untrustedSessionContainerView.isHidden = viewData.isDeviceTrusted
self.manuallyVerifyButton.isHidden = !viewData.isCurrentUser
if viewData.isDeviceTrusted {
badgeImage = Asset.Images.encryptionTrusted.image
title = VectorL10n.userVerificationSessionDetailsTrustedTitle
@ -258,6 +265,10 @@ final class UserVerificationSessionStatusViewController: UIViewController {
@IBAction private func verifyButtonAction(_ sender: Any) {
self.viewModel.process(viewAction: .verify)
}
@IBAction private func manuallyVerifyButtonAction(_ sender: Any) {
// TODO
}
}