IOS-1756 merge default working + some improvements IOS-1756
authorXavier Algarra <xavier@pep-project.org>
Fri, 07 Feb 2020 15:39:44 +0100
branchIOS-1756
changeset 116652fafad095006
parent 11663 29c60f41f881
child 11934 08087c300f8d
IOS-1756 merge default working + some improvements
pEpForiOS.xcodeproj/project.pbxproj
pEpForiOS/Base.lproj/AccountCreation.storyboard
pEpForiOS/UI/EmailDisplay/EmailDisplayList/EmailListViewController.swift
pEpForiOS/UI/Login/AccountTypeSelectorCollectionViewCell.swift
pEpForiOS/UI/Login/AccountTypeSelectorViewController.swift
pEpForiOS/UI/Login/LoginViewController.swift
pEpForiOS/UI/Login/ViewModel/AccountTypeSelectorViewModel.swift
     1.1 --- a/pEpForiOS.xcodeproj/project.pbxproj	Fri Feb 07 12:31:01 2020 +0100
     1.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Fri Feb 07 15:39:44 2020 +0100
     1.3 @@ -409,13 +409,14 @@
     1.4  		B722EC4D1E5B01B300A2B9D5 /* FolderCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B722EC4C1E5B01B300A2B9D5 /* FolderCellViewModel.swift */; };
     1.5  		B722EC651E5B49BA00A2B9D5 /* FolderSectionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B722EC641E5B49BA00A2B9D5 /* FolderSectionViewModel.swift */; };
     1.6  		B722EC7A1E5C879000A2B9D5 /* FolderUiProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = B722EC791E5C879000A2B9D5 /* FolderUiProtocols.swift */; };
     1.7 -		B72C7BAA2395182F0013B12E /* AccountTypeSelectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72C7BA92395182F0013B12E /* AccountTypeSelectorViewController.swift */; };
     1.8 -		B72C7BAC2395198D0013B12E /* AccountTypeSelectorViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72C7BAB2395198D0013B12E /* AccountTypeSelectorViewModel.swift */; };
     1.9  		B72AC87423C494D2009B90B5 /* PerAccountSyncViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72AC87323C494D2009B90B5 /* PerAccountSyncViewController.swift */; };
    1.10  		B72AC87623C494FE009B90B5 /* PerAccountSyncViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72AC87523C494FE009B90B5 /* PerAccountSyncViewModel.swift */; };
    1.11  		B72AC87823C4A12A009B90B5 /* PerAccountSyncAccountTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72AC87723C4A12A009B90B5 /* PerAccountSyncAccountTableViewCell.swift */; };
    1.12 +		B72C7BAA2395182F0013B12E /* AccountTypeSelectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72C7BA92395182F0013B12E /* AccountTypeSelectorViewController.swift */; };
    1.13 +		B72C7BAC2395198D0013B12E /* AccountTypeSelectorViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72C7BAB2395198D0013B12E /* AccountTypeSelectorViewModel.swift */; };
    1.14  		B72E192423C7617B00CBC841 /* KeySyncSwitchSettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72E192323C7617B00CBC841 /* KeySyncSwitchSettingViewModel.swift */; };
    1.15  		B74F81021EB0E20000519FCC /* LoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B74F81011EB0E20000519FCC /* LoginViewModel.swift */; };
    1.16 +		B756E57523ED99FA0007D535 /* AccountTypeSelectorCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B756E57423ED99FA0007D535 /* AccountTypeSelectorCollectionViewCell.swift */; };
    1.17  		B75FF00B1EFD420F00C57289 /* EmailListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B75FF00A1EFD420F00C57289 /* EmailListViewModel.swift */; };
    1.18  		B76CF8B320D2739B002429A8 /* MoveToFolderViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B76CF8B220D2739B002429A8 /* MoveToFolderViewModel.swift */; };
    1.19  		B78309C81EAA09040051A2E0 /* AccountCreation.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B78309C61EAA09040051A2E0 /* AccountCreation.storyboard */; };
    1.20 @@ -925,13 +926,14 @@
    1.21  		B722EC4C1E5B01B300A2B9D5 /* FolderCellViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FolderCellViewModel.swift; path = Folder/ViewModel/FolderCellViewModel.swift; sourceTree = "<group>"; };
    1.22  		B722EC641E5B49BA00A2B9D5 /* FolderSectionViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FolderSectionViewModel.swift; path = Folder/ViewModel/FolderSectionViewModel.swift; sourceTree = "<group>"; };
    1.23  		B722EC791E5C879000A2B9D5 /* FolderUiProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FolderUiProtocols.swift; sourceTree = "<group>"; };
    1.24 -		B72C7BA92395182F0013B12E /* AccountTypeSelectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTypeSelectorViewController.swift; sourceTree = "<group>"; };
    1.25 -		B72C7BAB2395198D0013B12E /* AccountTypeSelectorViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTypeSelectorViewModel.swift; sourceTree = "<group>"; };
    1.26  		B72AC87323C494D2009B90B5 /* PerAccountSyncViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerAccountSyncViewController.swift; sourceTree = "<group>"; };
    1.27  		B72AC87523C494FE009B90B5 /* PerAccountSyncViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerAccountSyncViewModel.swift; sourceTree = "<group>"; };
    1.28  		B72AC87723C4A12A009B90B5 /* PerAccountSyncAccountTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerAccountSyncAccountTableViewCell.swift; sourceTree = "<group>"; };
    1.29 +		B72C7BA92395182F0013B12E /* AccountTypeSelectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTypeSelectorViewController.swift; sourceTree = "<group>"; };
    1.30 +		B72C7BAB2395198D0013B12E /* AccountTypeSelectorViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTypeSelectorViewModel.swift; sourceTree = "<group>"; };
    1.31  		B72E192323C7617B00CBC841 /* KeySyncSwitchSettingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeySyncSwitchSettingViewModel.swift; sourceTree = "<group>"; };
    1.32  		B74F81011EB0E20000519FCC /* LoginViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginViewModel.swift; sourceTree = "<group>"; };
    1.33 +		B756E57423ED99FA0007D535 /* AccountTypeSelectorCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTypeSelectorCollectionViewCell.swift; sourceTree = "<group>"; };
    1.34  		B75FF00A1EFD420F00C57289 /* EmailListViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmailListViewModel.swift; sourceTree = "<group>"; };
    1.35  		B76CF8B220D2739B002429A8 /* MoveToFolderViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoveToFolderViewModel.swift; sourceTree = "<group>"; };
    1.36  		B78309C71EAA09040051A2E0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/AccountCreation.storyboard; sourceTree = "<group>"; };
    1.37 @@ -2400,6 +2402,7 @@
    1.38  				B70D32AB205BCCDD0094A92A /* ViewModel */,
    1.39  				49D3BECB20F8F7330043E05D /* LoginViewController.swift */,
    1.40  				B72C7BA92395182F0013B12E /* AccountTypeSelectorViewController.swift */,
    1.41 +				B756E57423ED99FA0007D535 /* AccountTypeSelectorCollectionViewCell.swift */,
    1.42  			);
    1.43  			path = Login;
    1.44  			sourceTree = "<group>";
    1.45 @@ -2925,6 +2928,7 @@
    1.46  				15874BCD2127493E00A3A4A6 /* AccountSettingsError.swift in Sources */,
    1.47  				15147EF7237EBE2A003989FE /* AppSettings+KeySyncDeviceGroupStateChangeNotification.swift in Sources */,
    1.48  				15D4399A216E697700EB3933 /* AccountPickerView.swift in Sources */,
    1.49 +				B756E57523ED99FA0007D535 /* AccountTypeSelectorCollectionViewCell.swift in Sources */,
    1.50  				37A710E0233B5AA5001FEAF0 /* UIHelper+PEP.swift in Sources */,
    1.51  				15265962216230B1006A78DF /* ContactCell.swift in Sources */,
    1.52  				43425EDF1FE3E052004A2728 /* OAuth2ProviderFactory.swift in Sources */,
     2.1 --- a/pEpForiOS/Base.lproj/AccountCreation.storyboard	Fri Feb 07 12:31:01 2020 +0100
     2.2 +++ b/pEpForiOS/Base.lproj/AccountCreation.storyboard	Fri Feb 07 15:39:44 2020 +0100
     2.3 @@ -5,6 +5,7 @@
     2.4          <deployment identifier="iOS"/>
     2.5          <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
     2.6          <capability name="Safe area layout guides" minToolsVersion="9.0"/>
     2.7 +        <capability name="collection view cell content view" minToolsVersion="11.0"/>
     2.8          <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     2.9      </dependencies>
    2.10      <scenes>
    2.11 @@ -434,12 +435,12 @@
    2.12                      </navigationBar>
    2.13                      <nil name="viewControllers"/>
    2.14                      <connections>
    2.15 -                        <segue destination="clh-8B-z2B" kind="relationship" relationship="rootViewController" id="oJy-Qa-jKN"/>
    2.16 +                        <segue destination="L5l-QH-yd0" kind="relationship" relationship="rootViewController" id="Xbl-mP-hLW"/>
    2.17                      </connections>
    2.18                  </navigationController>
    2.19                  <placeholder placeholderIdentifier="IBFirstResponder" id="D07-Xf-86Q" userLabel="First Responder" sceneMemberID="firstResponder"/>
    2.20              </objects>
    2.21 -            <point key="canvasLocation" x="5647" y="-396"/>
    2.22 +            <point key="canvasLocation" x="4626" y="-398"/>
    2.23          </scene>
    2.24          <!--User Info View Controller-->
    2.25          <scene sceneID="j9A-ew-A6L">
    2.26 @@ -583,8 +584,77 @@
    2.27              </objects>
    2.28              <point key="canvasLocation" x="9513" y="-396"/>
    2.29          </scene>
    2.30 +        <!--Account Type Selector View Controller-->
    2.31 +        <scene sceneID="V9w-WW-Gu0">
    2.32 +            <objects>
    2.33 +                <viewController id="L5l-QH-yd0" customClass="AccountTypeSelectorViewController" customModule="pEpForiOS" customModuleProvider="target" sceneMemberID="viewController">
    2.34 +                    <view key="view" contentMode="scaleToFill" id="vCs-pa-EKN">
    2.35 +                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
    2.36 +                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
    2.37 +                        <subviews>
    2.38 +                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="splashscreen" translatesAutoresizingMaskIntoConstraints="NO" id="Qvj-Kg-e68">
    2.39 +                                <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
    2.40 +                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
    2.41 +                            </imageView>
    2.42 +                            <collectionView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="qSY-an-Kw8">
    2.43 +                                <rect key="frame" x="40" y="94" width="334" height="718"/>
    2.44 +                                <color key="backgroundColor" white="1" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
    2.45 +                                <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="r3c-yT-fzZ">
    2.46 +                                    <size key="itemSize" width="50" height="50"/>
    2.47 +                                    <size key="headerReferenceSize" width="0.0" height="0.0"/>
    2.48 +                                    <size key="footerReferenceSize" width="0.0" height="0.0"/>
    2.49 +                                    <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
    2.50 +                                </collectionViewFlowLayout>
    2.51 +                                <cells>
    2.52 +                                    <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="providerCell" id="sx3-ns-V2S" customClass="AccountTypeSelectorCollectionViewCell" customModule="pEpForiOS" customModuleProvider="target">
    2.53 +                                        <rect key="frame" x="0.0" y="0.0" width="150" height="150"/>
    2.54 +                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
    2.55 +                                        <collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="0be-Mw-TSY">
    2.56 +                                            <rect key="frame" x="0.0" y="0.0" width="150" height="150"/>
    2.57 +                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
    2.58 +                                            <subviews>
    2.59 +                                                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="asset-Google" translatesAutoresizingMaskIntoConstraints="NO" id="cbt-3L-94D">
    2.60 +                                                    <rect key="frame" x="10" y="40" width="130" height="70"/>
    2.61 +                                                </imageView>
    2.62 +                                            </subviews>
    2.63 +                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
    2.64 +                                            <constraints>
    2.65 +                                                <constraint firstItem="cbt-3L-94D" firstAttribute="leading" secondItem="0be-Mw-TSY" secondAttribute="leading" constant="10" id="AYo-my-Zqt"/>
    2.66 +                                                <constraint firstItem="cbt-3L-94D" firstAttribute="top" secondItem="0be-Mw-TSY" secondAttribute="top" constant="40" id="McA-MQ-0D3"/>
    2.67 +                                                <constraint firstAttribute="trailing" secondItem="cbt-3L-94D" secondAttribute="trailing" constant="10" id="TNX-Ur-pHs"/>
    2.68 +                                                <constraint firstAttribute="bottom" secondItem="cbt-3L-94D" secondAttribute="bottom" constant="40" id="VYt-ts-eKH"/>
    2.69 +                                            </constraints>
    2.70 +                                        </collectionViewCellContentView>
    2.71 +                                        <size key="customSize" width="150" height="150"/>
    2.72 +                                        <connections>
    2.73 +                                            <outlet property="imageToFill" destination="cbt-3L-94D" id="bhO-Sg-pDR"/>
    2.74 +                                        </connections>
    2.75 +                                    </collectionViewCell>
    2.76 +                                </cells>
    2.77 +                            </collectionView>
    2.78 +                        </subviews>
    2.79 +                        <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
    2.80 +                        <constraints>
    2.81 +                            <constraint firstItem="qSY-an-Kw8" firstAttribute="leading" secondItem="4SX-0s-gq3" secondAttribute="leading" constant="40" id="4fh-Ja-IXX"/>
    2.82 +                            <constraint firstItem="qSY-an-Kw8" firstAttribute="top" secondItem="4SX-0s-gq3" secondAttribute="top" constant="50" id="6FK-QF-6nP"/>
    2.83 +                            <constraint firstItem="4SX-0s-gq3" firstAttribute="bottom" secondItem="qSY-an-Kw8" secondAttribute="bottom" constant="50" id="EGQ-Dx-ngD"/>
    2.84 +                            <constraint firstItem="4SX-0s-gq3" firstAttribute="trailing" secondItem="qSY-an-Kw8" secondAttribute="trailing" constant="40" id="o23-Ru-nBs"/>
    2.85 +                        </constraints>
    2.86 +                        <viewLayoutGuide key="safeArea" id="4SX-0s-gq3"/>
    2.87 +                    </view>
    2.88 +                    <navigationItem key="navigationItem" id="Fvo-rK-Wij"/>
    2.89 +                    <connections>
    2.90 +                        <outlet property="collectionView" destination="qSY-an-Kw8" id="fT9-bD-ta5"/>
    2.91 +                        <segue destination="clh-8B-z2B" kind="show" identifier="showLogin" id="A6U-Bz-3KU"/>
    2.92 +                    </connections>
    2.93 +                </viewController>
    2.94 +                <placeholder placeholderIdentifier="IBFirstResponder" id="LTH-0U-dto" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
    2.95 +            </objects>
    2.96 +            <point key="canvasLocation" x="5594" y="-398"/>
    2.97 +        </scene>
    2.98      </scenes>
    2.99      <resources>
   2.100 +        <image name="asset-Google" width="101" height="33"/>
   2.101          <image name="splashscreen" width="228" height="404"/>
   2.102      </resources>
   2.103  </document>
     3.1 --- a/pEpForiOS/UI/EmailDisplay/EmailDisplayList/EmailListViewController.swift	Fri Feb 07 12:31:01 2020 +0100
     3.2 +++ b/pEpForiOS/UI/EmailDisplay/EmailDisplayList/EmailListViewController.swift	Fri Feb 07 15:39:44 2020 +0100
     3.3 @@ -1269,12 +1269,12 @@
     3.4          case .segueAddNewAccount:
     3.5              guard
     3.6                  let nav = segue.destination as? UINavigationController,
     3.7 -                let vc = nav.rootViewController as? LoginViewController else {
     3.8 +                let vc = nav.rootViewController as? AccountTypeSelectorViewController else {
     3.9                      Log.shared.errorAndCrash("Segue issue")
    3.10                      return
    3.11              }
    3.12              vc.appConfig = appConfig
    3.13 -            vc.delegate = self
    3.14 +            vc.loginDelegate = self
    3.15              vc.hidesBottomBarWhenPushed = true
    3.16              break
    3.17          case .segueFolderViews:
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/pEpForiOS/UI/Login/AccountTypeSelectorCollectionViewCell.swift	Fri Feb 07 15:39:44 2020 +0100
     4.3 @@ -0,0 +1,29 @@
     4.4 +//
     4.5 +//  AccountTypeSelectorCollectionViewCell.swift
     4.6 +//  pEp
     4.7 +//
     4.8 +//  Created by Xavier Algarra on 07/02/2020.
     4.9 +//  Copyright © 2020 p≡p Security S.A. All rights reserved.
    4.10 +//
    4.11 +
    4.12 +import UIKit
    4.13 +
    4.14 +/// Collection view cell class
    4.15 +class AccountTypeSelectorCollectionViewCell: UICollectionViewCell {
    4.16 +
    4.17 +    @IBOutlet var imageToFill: UIImageView!
    4.18 +    
    4.19 +    /// adds an image loaded from the file name
    4.20 +    /// - Parameter fileName: file name to load
    4.21 +    func configure(withFileName fileName: String) {
    4.22 +        let image = UIImage(named: fileName)
    4.23 +        imageToFill.image = image
    4.24 +    }
    4.25 +    
    4.26 +    /// adds an image created from a text
    4.27 +    /// - Parameter text: source text
    4.28 +    func configure(withText text: String) {
    4.29 +        let image = text.image(color: UIColor.pEpGreen)
    4.30 +        imageToFill.image = image
    4.31 +    }
    4.32 +}
     5.1 --- a/pEpForiOS/UI/Login/AccountTypeSelectorViewController.swift	Fri Feb 07 12:31:01 2020 +0100
     5.2 +++ b/pEpForiOS/UI/Login/AccountTypeSelectorViewController.swift	Fri Feb 07 15:39:44 2020 +0100
     5.3 @@ -13,6 +13,7 @@
     5.4      let viewModel = AccountTypeSelectorViewModel()
     5.5  
     5.6      var SelectedIndexPath: IndexPath?
     5.7 +    var loginDelegate: LoginViewControllerDelegate?
     5.8  
     5.9      @IBOutlet var collectionView: UICollectionView!
    5.10  
    5.11 @@ -68,14 +69,14 @@
    5.12  
    5.13      func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    5.14          guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "providerCell",
    5.15 -                                                for: indexPath) as? imageCollectionViewCell else {
    5.16 +                                                for: indexPath) as? AccountTypeSelectorCollectionViewCell else {
    5.17              return UICollectionViewCell()
    5.18          }
    5.19          let cellProvider = viewModel[indexPath.row]
    5.20          switch cellProvider {
    5.21 -        case .GMail:
    5.22 +        case .gmail:
    5.23              cell.configure(withFileName: viewModel.fileNameOrText(provider: cellProvider))
    5.24 -        case .Other:
    5.25 +        case .other:
    5.26              cell.configure(withText: viewModel.fileNameOrText(provider: cellProvider))
    5.27          }
    5.28          return cell
    5.29 @@ -101,34 +102,9 @@
    5.30              if let vc = segue.destination as? LoginViewController,
    5.31                  let selected = SelectedIndexPath {
    5.32                  vc.appConfig = appConfig
    5.33 -                //loginView is not ready for this yet
    5.34 -//                switch viewModel[selected.row] {
    5.35 -//                case .GMail:
    5.36 -//                    vc.provider = true
    5.37 -//                case .Other:
    5.38 -//                    vc.provider = false
    5.39 -//                }
    5.40 +                vc.accountType = viewModel[selected.row]
    5.41 +                vc.delegate = loginDelegate
    5.42              }
    5.43          }
    5.44      }
    5.45  }
    5.46 -
    5.47 -/// Collection view cell class
    5.48 -public class imageCollectionViewCell: UICollectionViewCell {
    5.49 -
    5.50 -    @IBOutlet var imageToFill: UIImageView!
    5.51 -
    5.52 -    /// adds an image loaded from the file name
    5.53 -    /// - Parameter fileName: file name to load
    5.54 -    func configure(withFileName fileName: String) {
    5.55 -        let image = UIImage(named: fileName)
    5.56 -        imageToFill.image = image
    5.57 -    }
    5.58 -
    5.59 -    /// adds an image created from a text
    5.60 -    /// - Parameter text: source text
    5.61 -    func configure(withText text: String) {
    5.62 -        let image = text.image(color: UIColor.pEpGreen)
    5.63 -        imageToFill.image = image
    5.64 -    }
    5.65 -}
     6.1 --- a/pEpForiOS/UI/Login/LoginViewController.swift	Fri Feb 07 12:31:01 2020 +0100
     6.2 +++ b/pEpForiOS/UI/Login/LoginViewController.swift	Fri Feb 07 15:39:44 2020 +0100
     6.3 @@ -16,16 +16,6 @@
     6.4  }
     6.5  
     6.6  final class LoginViewController: BaseViewController {
     6.7 -    //Remove when account type is mgerge
     6.8 -    //TODO: Xavia this enum is in Account selector view model, this is just a place holder. Remove it and use yours.
     6.9 -    enum AccountType {
    6.10 -        case gmail
    6.11 -        case other
    6.12 -
    6.13 -        var isOauth: Bool {
    6.14 -            return self != .other
    6.15 -        }
    6.16 -    }
    6.17  
    6.18      weak var delegate: LoginViewControllerDelegate?
    6.19  
    6.20 @@ -48,12 +38,7 @@
    6.21      var loginViewModel: LoginViewModel?
    6.22      var offerManualSetup = false
    6.23      /// Use this property if is an oauth login. This will hide password TextFiled and show the Oauth screen.
    6.24 -    var accountType: AccountType = .other {
    6.25 -        didSet {
    6.26 -            password.isHidden = accountType.isOauth
    6.27 -            password.isEnabled = !accountType.isOauth
    6.28 -        }
    6.29 -    }
    6.30 +    var accountType: AccountTypeProvider = .other
    6.31      var isCurrentlyVerifying = false {
    6.32          didSet {
    6.33              updateView()
    6.34 @@ -72,6 +57,8 @@
    6.35  
    6.36      override func viewWillAppear(_ animated: Bool) {
    6.37          super.viewWillAppear(animated)
    6.38 +        password.isHidden = accountType.isOauth
    6.39 +        password.isEnabled = !accountType.isOauth
    6.40          updateView()
    6.41      }
    6.42  
     7.1 --- a/pEpForiOS/UI/Login/ViewModel/AccountTypeSelectorViewModel.swift	Fri Feb 07 12:31:01 2020 +0100
     7.2 +++ b/pEpForiOS/UI/Login/ViewModel/AccountTypeSelectorViewModel.swift	Fri Feb 07 15:39:44 2020 +0100
     7.3 @@ -9,19 +9,22 @@
     7.4  import Foundation
     7.5  import MessageModel
     7.6  
     7.7 -public enum Provider {
     7.8 -    case GMail
     7.9 -    case Other
    7.10 +public enum AccountTypeProvider {
    7.11 +    case gmail
    7.12 +    case other
    7.13 +    var isOauth: Bool {
    7.14 +        return self != .other
    7.15 +    }
    7.16  }
    7.17  
    7.18  class AccountTypeSelectorViewModel {
    7.19  
    7.20      /// list of providers to show
    7.21 -    var providers = [Provider]()
    7.22 +    var providers = [AccountTypeProvider]()
    7.23  
    7.24      init() {
    7.25 -        providers.append(.GMail)
    7.26 -        providers.append(.Other)
    7.27 +        providers.append(.gmail)
    7.28 +        providers.append(.other)
    7.29      }
    7.30  
    7.31      var count: Int {
    7.32 @@ -30,17 +33,17 @@
    7.33          }
    7.34      }
    7.35  
    7.36 -    subscript(index: Int) -> Provider {
    7.37 +    subscript(index: Int) -> AccountTypeProvider {
    7.38          return providers[index]
    7.39      }
    7.40  
    7.41      /// returns the text corresponding to the provider
    7.42      /// - Parameter provider: provider to obtain it's text
    7.43 -    func fileNameOrText(provider: Provider) -> String {
    7.44 +    func fileNameOrText(provider: AccountTypeProvider) -> String {
    7.45          switch provider {
    7.46 -        case .GMail:
    7.47 +        case .gmail:
    7.48              return "asset-Google"
    7.49 -        case .Other:
    7.50 +        case .other:
    7.51              return NSLocalizedString("Other", comment: "Other provider key")
    7.52          }
    7.53      }