IOS-1602 AccountSettingsViewModel has access to MMS. IOS-1602
authorDirk Zimmermann <dz@pep.security>
Tue, 28 May 2019 15:38:20 +0200
branchIOS-1602
changeset 8834ad8eb0a7e341
parent 8833 f2bdcc358632
child 8835 25e9aa9df2a3
IOS-1602 AccountSettingsViewModel has access to MMS.
pEpForiOS/UI/Settings/Setting/AccountSettings/ViewModel/AccountSettingsViewModel.swift
pEpForiOS/UI/Settings/SettingsTableViewController.swift
pEpForiOSTests/Models/Settings/AccountSettingsViewModelTest.swift
     1.1 --- a/pEpForiOS/UI/Settings/Setting/AccountSettings/ViewModel/AccountSettingsViewModel.swift	Tue May 28 15:38:20 2019 +0200
     1.2 +++ b/pEpForiOS/UI/Settings/Setting/AccountSettings/ViewModel/AccountSettingsViewModel.swift	Tue May 28 15:38:20 2019 +0200
     1.3 @@ -48,7 +48,11 @@
     1.4      /// and also the implementation of the verification.
     1.5      public var verifiableAccount: VerifiableAccountProtocol?
     1.6  
     1.7 -    public init(account: Account) {
     1.8 +    var messageModelService: MessageModelService
     1.9 +
    1.10 +    public init(account: Account, messageModelService: MessageModelService) {
    1.11 +        self.messageModelService = messageModelService
    1.12 +
    1.13          // We are using a copy of the data here.
    1.14          // The outside world must not know changed settings until they have been verified.
    1.15          isOAuth2 = account.imapServer?.authMethod == AuthMethod.saslXoauth2.rawValue
     2.1 --- a/pEpForiOS/UI/Settings/SettingsTableViewController.swift	Tue May 28 15:38:20 2019 +0200
     2.2 +++ b/pEpForiOS/UI/Settings/SettingsTableViewController.swift	Tue May 28 15:38:20 2019 +0200
     2.3 @@ -252,7 +252,9 @@
     2.4              if let path = ipath ,
     2.5                  let vm = viewModel[path.section][path.row] as? SettingsCellViewModel,
     2.6                  let acc = vm.account  {
     2.7 -                    let vm = AccountSettingsViewModel(account: acc)
     2.8 +                    let vm = AccountSettingsViewModel(
     2.9 +                        account: acc,
    2.10 +                        messageModelService: appConfig.messageModelService)
    2.11                      destination.viewModel = vm
    2.12              }
    2.13          case .noAccounts,
     3.1 --- a/pEpForiOSTests/Models/Settings/AccountSettingsViewModelTest.swift	Tue May 28 15:38:20 2019 +0200
     3.2 +++ b/pEpForiOSTests/Models/Settings/AccountSettingsViewModelTest.swift	Tue May 28 15:38:20 2019 +0200
     3.3 @@ -137,7 +137,15 @@
     3.4  
     3.5      private func setUpViewModel() {
     3.6          account.save()
     3.7 -        viewModel = AccountSettingsViewModel(account: account)
     3.8 +
     3.9 +        let theMessageModelService = MessageModelService(
    3.10 +            mySelfer: DefaultMySelfer(backgrounder: nil),
    3.11 +            errorPropagator: ErrorPropagator(),
    3.12 +            notifyHandShakeDelegate: NotifyHandshakeDelegate())
    3.13 +
    3.14 +        viewModel = AccountSettingsViewModel(
    3.15 +            account: account,
    3.16 +            messageModelService: theMessageModelService)
    3.17      }
    3.18  }
    3.19