IOS-1697 KeySyncHandShake set viewModel delegate to self and minor settings IOS-1697
authorAlejandro Gelos <agp@pep.security>
Wed, 10 Jul 2019 15:29:35 +0200
branchIOS-1697
changeset 9370c2e61fb1bb5b
parent 9369 790ade8bf401
child 9371 52c8907023eb
IOS-1697 KeySyncHandShake set viewModel delegate to self and minor settings
pEpForiOS/Base.lproj/Reusable.storyboard
pEpForiOS/UI/KeySyncHandshake/KeySyncHandshakeViewController.swift
pEpForiOS/UI/KeySyncHandshake/KeySyncHandshakeViewModel.swift
     1.1 --- a/pEpForiOS/Base.lproj/Reusable.storyboard	Wed Jul 10 15:02:00 2019 +0200
     1.2 +++ b/pEpForiOS/Base.lproj/Reusable.storyboard	Wed Jul 10 15:29:35 2019 +0200
     1.3 @@ -157,7 +157,7 @@
     1.4                                              <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qdF-uZ-5ra">
     1.5                                                  <rect key="frame" x="12" y="70.5" width="236" height="55"/>
     1.6                                                  <subviews>
     1.7 -                                                    <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="749" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xM8-bm-Ks8">
     1.8 +                                                    <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="749" showsHorizontalScrollIndicator="NO" editable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xM8-bm-Ks8">
     1.9                                                          <rect key="frame" x="0.0" y="0.0" width="236" height="55"/>
    1.10                                                          <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
    1.11                                                          <string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
    1.12 @@ -240,9 +240,9 @@
    1.13                          <viewLayoutGuide key="safeArea" id="O4B-B0-4XF"/>
    1.14                      </view>
    1.15                      <connections>
    1.16 +                        <outlet property="alertTitle" destination="ckp-rp-1Pd" id="WIa-4m-pJy"/>
    1.17                          <outlet property="keySyncWorlds" destination="xM8-bm-Ks8" id="DFP-aT-BOZ"/>
    1.18                          <outlet property="message" destination="rPi-Px-Pyp" id="Pyb-o1-Nmp"/>
    1.19 -                        <outlet property="titile" destination="ckp-rp-1Pd" id="XGD-Q1-9Pn"/>
    1.20                      </connections>
    1.21                  </viewController>
    1.22                  <placeholder placeholderIdentifier="IBFirstResponder" id="rVu-Ti-LbX" userLabel="First Responder" sceneMemberID="firstResponder"/>
     2.1 --- a/pEpForiOS/UI/KeySyncHandshake/KeySyncHandshakeViewController.swift	Wed Jul 10 15:02:00 2019 +0200
     2.2 +++ b/pEpForiOS/UI/KeySyncHandshake/KeySyncHandshakeViewController.swift	Wed Jul 10 15:29:35 2019 +0200
     2.3 @@ -11,7 +11,7 @@
     2.4  final class KeySyncHandshakeViewController: UIViewController {
     2.5      static let storyboardId = "KeySyncHandshakeViewController"
     2.6      
     2.7 -    @IBOutlet weak var titile: UILabel!
     2.8 +    @IBOutlet weak var alertTitle: UILabel!
     2.9      @IBOutlet weak var message: UILabel!
    2.10      @IBOutlet weak var keySyncWorlds: UITextView! {
    2.11          didSet {
    2.12 @@ -30,9 +30,18 @@
    2.13  
    2.14      private let viewModel = KeySyncHandshakeViewModel()
    2.15      private var pickerLanguages = [String]()
    2.16 +    private var meFPR: String?
    2.17 +    private var partnerFPR: String?
    2.18 +
    2.19 +    override func viewDidLoad() {
    2.20 +        super.viewDidLoad()
    2.21 +        viewModel.delegate = self
    2.22 +        viewModel.fingerPrints(meFPR: meFPR, partnerFPR: partnerFPR)
    2.23 +    }
    2.24  
    2.25      func finderPrints(meFPR: String, partnerFPR: String) {
    2.26 -        viewModel.fingerPrints(meFPR: meFPR, partnerFPR: partnerFPR)
    2.27 +        self.meFPR = meFPR
    2.28 +        self.partnerFPR = partnerFPR
    2.29      }
    2.30  
    2.31      @IBAction func didPress(_ sender: UIButton) {
    2.32 @@ -50,6 +59,9 @@
    2.33              return
    2.34          }
    2.35          completion?(action)
    2.36 +        DispatchQueue.main.async { [weak self] in
    2.37 +            self?.dismiss(animated: true, completion: nil)
    2.38 +        }
    2.39      }
    2.40  
    2.41      func showPicker(withLanguages languages: [String]) {
     3.1 --- a/pEpForiOS/UI/KeySyncHandshake/KeySyncHandshakeViewModel.swift	Wed Jul 10 15:02:00 2019 +0200
     3.2 +++ b/pEpForiOS/UI/KeySyncHandshake/KeySyncHandshakeViewModel.swift	Wed Jul 10 15:29:35 2019 +0200
     3.3 @@ -47,7 +47,7 @@
     3.4          }
     3.5      }
     3.6  
     3.7 -    func fingerPrints(meFPR: String, partnerFPR: String) {
     3.8 +    func fingerPrints(meFPR: String?, partnerFPR: String?) {
     3.9          self.meFPR = meFPR
    3.10          self.partnerFPR = partnerFPR
    3.11          delegate?.change(handshakeWordsTo: trustWorkds())