Commit e455c9bf authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

UI: refactor link device page

Change-Id: Iec62254d4e0645eab2eb7dc978b8fc0214a85ccc
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 0d5aeda3
......@@ -136,7 +136,7 @@ enum L10n {
static let networkError = L10n.tr("Localizable", "linkDevice.networkError")
/// The password you entered does not unlock this account
static let passwordError = L10n.tr("Localizable", "linkDevice.passwordError")
/// Link new device
/// Link a new device
static let title = L10n.tr("Localizable", "linkDevice.title")
}
......
......@@ -12,7 +12,7 @@
<!--Link New Device View Controller-->
<scene sceneID="D9S-FB-I4T">
<objects>
<viewController extendedLayoutIncludesOpaqueBars="YES" modalPresentationStyle="currentContext" id="2dj-eG-xeW" customClass="LinkNewDeviceViewController" customModule="Ring" customModuleProvider="target" sceneMemberID="viewController">
<viewController extendedLayoutIncludesOpaqueBars="YES" modalPresentationStyle="currentContext" hidesBottomBarWhenPushed="YES" id="2dj-eG-xeW" customClass="LinkNewDeviceViewController" customModule="Ring" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="eZL-Om-fvc"/>
<viewControllerLayoutGuide type="bottom" id="3JQ-jM-bhq"/>
......@@ -20,159 +20,7 @@
<view key="view" opaque="NO" contentMode="scaleToFill" id="hfz-3u-S0l">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="bAU-MT-5Ok">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<edgeInsets key="layoutMargins" top="0.0" left="0.0" bottom="0.0" right="0.0"/>
</imageView>
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Tkx-Tz-Dro">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="hhH-X0-zM1">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
<blurEffect style="dark"/>
</visualEffectView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="DUK-26-PaO">
<rect key="frame" x="62.5" y="140" width="250" height="250"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EjG-nq-d2Y" userLabel="Gradient View" customClass="DesignableView" customModule="Ring" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="250" height="250"/>
<color key="backgroundColor" red="0.2274509804" green="0.75294117650000003" blue="0.82352941180000006" alpha="0.20000000000000001" colorSpace="custom" customColorSpace="displayP3"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="gradientEndColor">
<color key="value" red="0.2274509804" green="0.75294117650000003" blue="0.82352941180000006" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="gradientStartColor">
<color key="value" red="0.2274509804" green="0.75294117650000003" blue="0.82352941180000006" alpha="0.0" colorSpace="custom" customColorSpace="displayP3"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter Password" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="jXW-gy-tZg">
<rect key="frame" x="5" y="45.5" width="239.5" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" secureTextEntry="YES" smartDashesType="no" smartInsertDeleteType="no" smartQuotesType="no"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="roundedCorners" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="5" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="geP-pG-uQ9">
<rect key="frame" x="10" y="124.5" width="230" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hEG-05-68q" customClass="DesignableButton" customModule="Ring" customModuleProvider="target">
<rect key="frame" x="10" y="210" width="60" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="6vg-8H-tbE"/>
<constraint firstAttribute="width" constant="60" id="fhV-en-uNc"/>
</constraints>
<state key="normal" title="Cancel"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="roundedCorners" value="YES"/>
</userDefinedRuntimeAttributes>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Link Another Device" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ees-Ul-zym">
<rect key="frame" x="48" y="15" width="154" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="7" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oSv-Hz-eMn">
<rect key="frame" x="10" y="70" width="230" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Pin" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BDQ-0Z-HqM">
<rect key="frame" x="112.5" y="30" width="24" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="85j-fk-tVM"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tLd-d1-Onw" customClass="DesignableButton" customModule="Ring" customModuleProvider="target">
<rect key="frame" x="180" y="210" width="60" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="3tg-dw-XKp"/>
<constraint firstAttribute="width" constant="60" id="qra-Ny-3lQ"/>
</constraints>
<state key="normal" title="Ok"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="roundedCorners" value="YES"/>
</userDefinedRuntimeAttributes>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="hEG-05-68q" secondAttribute="bottom" constant="10" id="26g-iR-A7F"/>
<constraint firstItem="jXW-gy-tZg" firstAttribute="top" secondItem="Ees-Ul-zym" secondAttribute="bottom" constant="10" id="2mf-Or-SVI"/>
<constraint firstItem="BDQ-0Z-HqM" firstAttribute="top" secondItem="DUK-26-PaO" secondAttribute="top" constant="30" id="5ia-DN-cAf"/>
<constraint firstItem="jXW-gy-tZg" firstAttribute="centerX" secondItem="DUK-26-PaO" secondAttribute="centerX" id="BPA-ZA-NCX"/>
<constraint firstAttribute="trailing" secondItem="geP-pG-uQ9" secondAttribute="trailing" constant="10" id="E3A-Q3-yZL"/>
<constraint firstAttribute="height" constant="250" id="Eyi-7Y-VZh"/>
<constraint firstItem="Ees-Ul-zym" firstAttribute="centerX" secondItem="DUK-26-PaO" secondAttribute="centerX" id="GcQ-ZN-Kf7"/>
<constraint firstItem="BDQ-0Z-HqM" firstAttribute="centerX" secondItem="DUK-26-PaO" secondAttribute="centerX" id="KRt-k3-GCR"/>
<constraint firstItem="geP-pG-uQ9" firstAttribute="centerX" secondItem="DUK-26-PaO" secondAttribute="centerX" id="LCp-tV-nme"/>
<constraint firstItem="geP-pG-uQ9" firstAttribute="centerY" secondItem="DUK-26-PaO" secondAttribute="centerY" id="Msz-Fp-afW"/>
<constraint firstItem="oSv-Hz-eMn" firstAttribute="leading" secondItem="DUK-26-PaO" secondAttribute="leading" constant="10" id="RNO-ft-fcR"/>
<constraint firstItem="oSv-Hz-eMn" firstAttribute="centerX" secondItem="DUK-26-PaO" secondAttribute="centerX" id="WMe-wm-YT4"/>
<constraint firstItem="Ees-Ul-zym" firstAttribute="top" secondItem="DUK-26-PaO" secondAttribute="top" constant="15" id="XQl-Ux-PCv"/>
<constraint firstItem="EjG-nq-d2Y" firstAttribute="leading" secondItem="DUK-26-PaO" secondAttribute="leading" id="a2W-5K-EdM"/>
<constraint firstItem="geP-pG-uQ9" firstAttribute="top" relation="greaterThanOrEqual" secondItem="DUK-26-PaO" secondAttribute="top" constant="20" id="aGj-RT-SSc"/>
<constraint firstAttribute="trailing" secondItem="EjG-nq-d2Y" secondAttribute="trailing" id="dAZ-J3-qAs"/>
<constraint firstItem="EjG-nq-d2Y" firstAttribute="top" secondItem="DUK-26-PaO" secondAttribute="top" id="gEg-rk-8ue"/>
<constraint firstAttribute="bottom" secondItem="tLd-d1-Onw" secondAttribute="bottom" constant="10" id="hL2-NM-eUa"/>
<constraint firstAttribute="trailing" secondItem="tLd-d1-Onw" secondAttribute="trailing" constant="10" id="hVG-0q-T18"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="geP-pG-uQ9" secondAttribute="bottom" constant="20" id="hnT-KZ-nNk"/>
<constraint firstItem="oSv-Hz-eMn" firstAttribute="top" secondItem="BDQ-0Z-HqM" secondAttribute="bottom" constant="10" id="iaf-dp-0vU"/>
<constraint firstItem="jXW-gy-tZg" firstAttribute="leading" secondItem="DUK-26-PaO" secondAttribute="leading" constant="5" id="kZq-mB-2ed"/>
<constraint firstAttribute="bottom" secondItem="EjG-nq-d2Y" secondAttribute="bottom" id="oLU-wf-KNH"/>
<constraint firstItem="geP-pG-uQ9" firstAttribute="leading" secondItem="DUK-26-PaO" secondAttribute="leading" constant="10" id="sHR-7a-bbd"/>
<constraint firstAttribute="width" constant="250" id="u8k-6x-tBz"/>
<constraint firstAttribute="trailing" secondItem="oSv-Hz-eMn" secondAttribute="trailing" constant="10" id="uWL-yZ-BJL"/>
<constraint firstItem="hEG-05-68q" firstAttribute="leading" secondItem="DUK-26-PaO" secondAttribute="leading" constant="10" id="ulo-GW-WFO"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="roundedCorners" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="10"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<constraints>
<constraint firstItem="DUK-26-PaO" firstAttribute="top" secondItem="eZL-Om-fvc" secondAttribute="bottom" priority="750" constant="120" id="63X-b8-559"/>
<constraint firstItem="bAU-MT-5Ok" firstAttribute="top" secondItem="hfz-3u-S0l" secondAttribute="top" id="6F2-uC-0HH"/>
<constraint firstItem="3JQ-jM-bhq" firstAttribute="top" relation="greaterThanOrEqual" secondItem="DUK-26-PaO" secondAttribute="bottom" constant="30" id="aev-7M-xMF"/>
<constraint firstItem="Tkx-Tz-Dro" firstAttribute="leading" secondItem="hfz-3u-S0l" secondAttribute="leading" id="e0Q-BA-Grx"/>
<constraint firstItem="DUK-26-PaO" firstAttribute="centerX" secondItem="hfz-3u-S0l" secondAttribute="centerX" id="fBl-cM-hBw"/>
<constraint firstItem="bAU-MT-5Ok" firstAttribute="leading" secondItem="hfz-3u-S0l" secondAttribute="leading" id="h3g-hC-dSs"/>
<constraint firstAttribute="trailing" secondItem="bAU-MT-5Ok" secondAttribute="trailing" id="kqj-mu-ZoR"/>
<constraint firstItem="Tkx-Tz-Dro" firstAttribute="top" secondItem="hfz-3u-S0l" secondAttribute="top" id="nZp-x2-ycz"/>
<constraint firstItem="3JQ-jM-bhq" firstAttribute="top" secondItem="Tkx-Tz-Dro" secondAttribute="bottom" id="oAL-K8-Riy"/>
<constraint firstItem="3JQ-jM-bhq" firstAttribute="top" secondItem="bAU-MT-5Ok" secondAttribute="bottom" id="pVT-Xj-NJ0"/>
<constraint firstAttribute="trailing" secondItem="Tkx-Tz-Dro" secondAttribute="trailing" id="v9B-h1-RtS"/>
</constraints>
</view>
<connections>
<outlet property="background" destination="bAU-MT-5Ok" id="neq-1u-Pct"/>
<outlet property="cancelButton" destination="hEG-05-68q" id="bfe-iV-QmP"/>
<outlet property="containerView" destination="DUK-26-PaO" id="Oyr-48-9CT"/>
<outlet property="errorMessage" destination="geP-pG-uQ9" id="fKA-HW-yAi"/>
<outlet property="explanationMessage" destination="oSv-Hz-eMn" id="1Cn-eN-jvD"/>
<outlet property="okButton" destination="tLd-d1-Onw" id="tBs-Mr-ZPa"/>
<outlet property="passwordField" destination="jXW-gy-tZg" id="nMH-ce-BCQ"/>
<outlet property="pinLabel" destination="BDQ-0Z-HqM" id="Lto-kY-5AQ"/>
<outlet property="titleLable" destination="Ees-Ul-zym" id="7uo-rl-0rV"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="mtT-LS-iO8" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
......
......@@ -25,42 +25,14 @@ import PKHUD
class LinkNewDeviceViewController: UIViewController, StoryboardBased, ViewModelBased {
@IBOutlet weak var titleLable: UILabel!
@IBOutlet weak var passwordField: UITextField!
@IBOutlet weak var okButton: UIButton!
@IBOutlet weak var cancelButton: UIButton!
@IBOutlet weak var pinLabel: UILabel!
@IBOutlet weak var explanationMessage: UILabel!
@IBOutlet weak var errorMessage: UILabel!
@IBOutlet weak var background: UIImageView!
@IBOutlet weak var containerView: UIView!
var viewModel: LinkNewDeviceViewModel!
let disposeBag = DisposeBag()
override func viewDidLoad() {
self.background.image = self.view.convertViewToImage()
self.applyL10n()
// initial state
self.viewModel.isInitialState
.bind(to: self.titleLable.rx.isHidden)
.disposed(by: self.disposeBag)
self.viewModel.isInitialState.bind(to: self.passwordField.rx.isHidden)
.disposed(by: self.disposeBag)
self.viewModel.isInitialState.bind(to: self.cancelButton.rx.isHidden)
.disposed(by: self.disposeBag)
// error state
self.viewModel.isErrorState.bind(to: self.errorMessage.rx.isVisible)
.disposed(by: self.disposeBag)
// success state
self.viewModel.isSuccessState
.bind(to: self.explanationMessage.rx.isVisible)
.disposed(by: self.disposeBag)
self.viewModel.isSuccessState
.bind(to: self.pinLabel.rx.isVisible)
.disposed(by: self.disposeBag)
self.view.backgroundColor = UIColor.white.withAlphaComponent(0.0)
super.viewDidLoad()
self.showInitialAlert()
self.viewModel.observableState
.observeOn(MainScheduler.instance)
......@@ -69,43 +41,66 @@ class LinkNewDeviceViewController: UIViewController, StoryboardBased, ViewModelB
case .generatingPin:
self?.showProgress()
case .success(let pin):
self?.pinLabel.text = pin
self?.hideHud()
self?.showSuccessAlert(pin: pin)
case .error(let pinError):
self?.errorMessage.text = pinError.description
self?.showErrorAlert(error: pinError.description)
self?.hideHud()
default:
break
}
}).disposed(by: self.disposeBag)
cancelButton.rx.tap.subscribe(onNext: { [unowned self] in
self.dismiss(animated: true, completion: nil)
}).disposed(by: disposeBag)
okButton.rx.tap.subscribe(onNext: { [unowned self] in
if !self.passwordField.isHidden {
self.viewModel.linkDevice(with: self.passwordField.text)
self.passwordField.text = ""
} else if !self.errorMessage.isHidden {
self.viewModel.refresh()
} else {
self.dismiss(animated: true, completion: nil)
}
}).disposed(by: disposeBag)
super.viewDidLoad()
}
private func showProgress() {
HUD.show(.labeledProgress(title: L10n.Linkdevice.hudMessage, subtitle: nil), onView: self.containerView)
HUD.show(.labeledProgress(title: L10n.Linkdevice.hudMessage, subtitle: nil))
}
private func hideHud() {
HUD.hide(animated: true)
HUD.hide(animated: false)
}
private func applyL10n() {
self.titleLable.text = self.viewModel.linkDeviceTitleTitle
self.explanationMessage.text = self.viewModel.explanationMessage
func showSuccessAlert(pin: String) {
let alert = UIAlertController(title: pin,
message: self.viewModel.explanationMessage,
preferredStyle: .alert)
let action = UIAlertAction(title: L10n.Global.ok, style: .default) { _ in
self.dismiss(animated: true, completion: nil)
}
alert.addAction(action)
self.present(alert, animated: true, completion: nil)
}
func showInitialAlert() {
let alert = UIAlertController(title: self.viewModel.linkDeviceTitleTitle,
message: nil,
preferredStyle: .alert)
let actionCancel = UIAlertAction(title: L10n.Actions.cancelAction, style: .cancel) { _ in
self.dismiss(animated: true, completion: nil)
}
let actionLink = UIAlertAction(title: L10n.Global.ok, style: .default) { _ in
if let textFields = alert.textFields {
self.viewModel.linkDevice(with: textFields[0].text)
}
alert.dismiss(animated: false, completion: nil)
}
alert.addAction(actionCancel)
alert.addAction(actionLink)
alert.addTextField { (textField) in
textField.isSecureTextEntry = true
textField.placeholder = L10n.Linktoaccount.passwordLabel
}
self.present(alert, animated: true, completion: nil)
}
func showErrorAlert(error: String) {
let alert = UIAlertController(title: Error,
message: error,
preferredStyle: .alert)
let action = UIAlertAction(title: L10n.Global.ok, style: .cancel) { _ in
self.dismiss(animated: true, completion: nil)
}
alert.addAction(action)
self.present(alert, animated: true, completion: nil)
}
}
......@@ -84,30 +84,6 @@ class LinkNewDeviceViewModel: ViewModel, Stateable {
return self.generatingState.asObservable()
}()
lazy var isInitialState: Observable<Bool> = {
return self.observableState.map { state in
return !state.isStateOfType(type: "INITIAL")
}
}().share()
lazy var isSuccessState: Observable<Bool> = {
return self.observableState.map { state in
return !state.isStateOfType(type: "SUCCESS")
}
}().share()
lazy var isErrorState: Observable<Bool> = {
return self.observableState.map { state in
return !state.isStateOfType(type: "ERROR")
}
}().share()
lazy var isGeneratedPinState: Observable<Bool> = {
return self.observableState.map { state in
return !state.isStateOfType(type: "GENERATING_PIN")
}
}().share()
let accountService: AccountsService
let disposeBag = DisposeBag()
......
......@@ -25,6 +25,7 @@ import RxSwift
class LinkNewDeviceCell: UITableViewCell, NibReusable {
@IBOutlet weak var addDeviceButton: UIButton!
@IBOutlet weak var addDeviceTitle: UIButton!
var disposeBag = DisposeBag()
override func prepareForReuse() {
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
......@@ -19,30 +19,31 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="contactAdd" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qQU-vB-ZuD" customClass="ButtonTransparentBackground" customModule="Ring" customModuleProvider="target">
<rect key="frame" x="65.5" y="4.5" width="35" height="35"/>
<rect key="frame" x="73.5" y="4.5" width="35" height="35"/>
<constraints>
<constraint firstAttribute="width" constant="35" id="XIg-PF-p2r"/>
<constraint firstAttribute="height" constant="35" id="rZ3-3g-1AV"/>
</constraints>
<color key="tintColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Link Another Device" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Aw5-4m-yjX">
<rect key="frame" x="110.5" y="4.5" width="154" height="35"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5Gy-EN-BpG">
<rect key="frame" x="118.5" y="4.5" width="138" height="35"/>
<state key="normal" title="Link Another Device">
<color key="titleColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
</subviews>
<constraints>
<constraint firstItem="Aw5-4m-yjX" firstAttribute="top" secondItem="qQU-vB-ZuD" secondAttribute="top" id="5nH-9W-o0J"/>
<constraint firstItem="Aw5-4m-yjX" firstAttribute="centerY" secondItem="fhq-ul-0n8" secondAttribute="centerY" id="AaA-ZQ-i3N"/>
<constraint firstItem="Aw5-4m-yjX" firstAttribute="centerX" secondItem="fhq-ul-0n8" secondAttribute="centerX" id="Q1G-cd-PcV"/>
<constraint firstItem="Aw5-4m-yjX" firstAttribute="leading" secondItem="qQU-vB-ZuD" secondAttribute="trailing" constant="10" id="Qnp-Hb-9Fq"/>
<constraint firstItem="Aw5-4m-yjX" firstAttribute="bottom" secondItem="qQU-vB-ZuD" secondAttribute="bottom" id="bzk-WA-kKO"/>
<constraint firstItem="5Gy-EN-BpG" firstAttribute="centerY" secondItem="fhq-ul-0n8" secondAttribute="centerY" id="MFh-yt-NY1"/>
<constraint firstItem="5Gy-EN-BpG" firstAttribute="top" secondItem="qQU-vB-ZuD" secondAttribute="top" id="XnJ-Nr-eWE"/>
<constraint firstItem="5Gy-EN-BpG" firstAttribute="centerX" secondItem="fhq-ul-0n8" secondAttribute="centerX" id="dXj-UN-Lws"/>
<constraint firstItem="5Gy-EN-BpG" firstAttribute="bottom" secondItem="qQU-vB-ZuD" secondAttribute="bottom" id="e91-bu-CRx"/>
<constraint firstItem="5Gy-EN-BpG" firstAttribute="leading" secondItem="qQU-vB-ZuD" secondAttribute="trailing" constant="10" id="qXb-0H-C6u"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="addDeviceButton" destination="qQU-vB-ZuD" id="63f-uV-UkV"/>
<outlet property="addDeviceTitle" destination="5Gy-EN-BpG" id="Rzf-H1-FW1"/>
</connections>
<point key="canvasLocation" x="38.5" y="124"/>
</tableViewCell>
......
......@@ -91,6 +91,9 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas
cell.addDeviceButton.rx.tap.subscribe(onNext: { [unowned self] in
self.viewModel.linkDevice()
}).disposed(by: cell.disposeBag)
cell.addDeviceTitle.rx.tap.subscribe(onNext: { [unowned self] in
self.viewModel.linkDevice()
}).disposed(by: cell.disposeBag)
cell.selectionStyle = .none
return cell
}
......
......@@ -72,6 +72,6 @@ class MeCoordinator: Coordinator, StateableResponsive {
private func showLinkDeviceWindow() {
let linkDeviceVC = LinkNewDeviceViewController.instantiate(with: self.injectionBag)
self.present(viewController: linkDeviceVC, withStyle: .appear, withAnimation: false)
self.present(viewController: linkDeviceVC, withStyle: .popup, withAnimation: false)
}
}
......@@ -107,7 +107,7 @@
"accountPage.devicesListHeader" = "Devices";
//Link New Device
"linkDevice.title" = "Link new device";
"linkDevice.title" = "Link a new device";
"linkDevice.passwordError" = "The password you entered does not unlock this account";
"linkDevice.networkError" = "A network error occured during the export";
"linkDevice.defaultError" = "An error occured during the export";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment