diff --git a/Riot.xcodeproj/project.pbxproj b/Riot.xcodeproj/project.pbxproj index ff10f274c..4bdf4ff1b 100644 --- a/Riot.xcodeproj/project.pbxproj +++ b/Riot.xcodeproj/project.pbxproj @@ -217,6 +217,8 @@ B12676882523E4D100BE6B98 /* SecretsResetViewState.swift in Sources */ = {isa = PBXBuildFile; fileRef = B12676802523E4D100BE6B98 /* SecretsResetViewState.swift */; }; B12676892523E4D100BE6B98 /* SecretsResetViewAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B12676812523E4D100BE6B98 /* SecretsResetViewAction.swift */; }; B126768A2523E4D100BE6B98 /* SecretsResetViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B12676822523E4D100BE6B98 /* SecretsResetViewModel.swift */; }; + B1284E3E2535FEA6003529D7 /* SecureBackupSetupIntroViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1284E3D2535FEA6003529D7 /* SecureBackupSetupIntroViewModelType.swift */; }; + B1284E402535FEBA003529D7 /* SecureBackupSetupIntroViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1284E3F2535FEBA003529D7 /* SecureBackupSetupIntroViewModel.swift */; }; B12C56EF2396CB5E00FAC6DE /* RoomMessageURLParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = B12C56EE2396CB5E00FAC6DE /* RoomMessageURLParser.swift */; }; B12D79FB23E2462200FACEDC /* UserVerificationStartCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B12D79F323E2462000FACEDC /* UserVerificationStartCoordinator.swift */; }; B12D79FC23E2462200FACEDC /* UserVerificationStartViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B12D79F423E2462100FACEDC /* UserVerificationStartViewController.storyboard */; }; @@ -1243,6 +1245,8 @@ B12676802523E4D100BE6B98 /* SecretsResetViewState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecretsResetViewState.swift; sourceTree = ""; }; B12676812523E4D100BE6B98 /* SecretsResetViewAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecretsResetViewAction.swift; sourceTree = ""; }; B12676822523E4D100BE6B98 /* SecretsResetViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecretsResetViewModel.swift; sourceTree = ""; }; + B1284E3D2535FEA6003529D7 /* SecureBackupSetupIntroViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupSetupIntroViewModelType.swift; sourceTree = ""; }; + B1284E3F2535FEBA003529D7 /* SecureBackupSetupIntroViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupSetupIntroViewModel.swift; sourceTree = ""; }; B12C56EE2396CB5E00FAC6DE /* RoomMessageURLParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMessageURLParser.swift; sourceTree = ""; }; B12D79F323E2462000FACEDC /* UserVerificationStartCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserVerificationStartCoordinator.swift; sourceTree = ""; }; B12D79F423E2462100FACEDC /* UserVerificationStartViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = UserVerificationStartViewController.storyboard; sourceTree = ""; }; @@ -5062,6 +5066,8 @@ EC711B9F24A63B58008F830C /* SecureBackupSetupIntroViewController.swift */, EC711BA024A63B58008F830C /* SecureBackupSetupIntroCell.swift */, EC711BA124A63B58008F830C /* SecureBackupSetupIntroViewController.storyboard */, + B1284E3D2535FEA6003529D7 /* SecureBackupSetupIntroViewModelType.swift */, + B1284E3F2535FEBA003529D7 /* SecureBackupSetupIntroViewModel.swift */, ); path = Intro; sourceTree = ""; @@ -6189,6 +6195,7 @@ B157FAA023264AE900EBFBD4 /* SettingsDiscoveryThreePidDetailsViewModelType.swift in Sources */, B1B5573A20EE6C4D00210D55 /* GroupRoomsViewController.m in Sources */, B1B558F920EF768F00210D55 /* RoomOutgoingTextMsgWithoutSenderNameBubbleCell.m in Sources */, + B1284E3E2535FEA6003529D7 /* SecureBackupSetupIntroViewModelType.swift in Sources */, B1FDF56021F5FE5500BA3834 /* KeyBackupSetupPassphraseViewAction.swift in Sources */, B1B5573120EE6C4D00210D55 /* BugReportViewController.m in Sources */, ECFBD5CB250A7AAF00DD5F5A /* DirectoryRoomTableViewCellVM.swift in Sources */, @@ -6592,6 +6599,7 @@ EC711B7624A63B37008F830C /* SecretsSetupRecoveryKeyViewState.swift in Sources */, 32FDC1CD2386CD390084717A /* RiotSettingIntegrationProvisioning.swift in Sources */, B1BEE73523DF44A60003A4CB /* UserVerificationSessionsStatusViewModel.swift in Sources */, + B1284E402535FEBA003529D7 /* SecureBackupSetupIntroViewModel.swift in Sources */, B1B5572020EE6C4D00210D55 /* ContactsTableViewController.m in Sources */, EC85D7142477DCD7002C44C9 /* KeyVerificationScanConfirmationViewState.swift in Sources */, EC711B9124A63B37008F830C /* SecretsRecoveryWithKeyCoordinatorType.swift in Sources */, diff --git a/Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewModel.swift b/Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewModel.swift new file mode 100644 index 000000000..3a10148d9 --- /dev/null +++ b/Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewModel.swift @@ -0,0 +1,33 @@ +// +// Copyright 2020 New Vector Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import Foundation + +final class SecureBackupSetupIntroViewModel: SecureBackupSetupIntroViewModelType { + + // MARK: - Properties + + // TODO: Make these properties private + let keyBackup: MXKeyBackup? + let checkKeyBackup: Bool + + // MARK: - Setup + + init(keyBackup: MXKeyBackup?, checkKeyBackup: Bool) { + self.keyBackup = keyBackup + self.checkKeyBackup = checkKeyBackup + } +} diff --git a/Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewModelType.swift b/Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewModelType.swift new file mode 100644 index 000000000..b7d08f5d5 --- /dev/null +++ b/Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewModelType.swift @@ -0,0 +1,25 @@ +// +// Copyright 2020 New Vector Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import Foundation + +/// Protocol describing the view model used by `SecureBackupSetupIntroViewController` +protocol SecureBackupSetupIntroViewModelType { + + // TODO: Hide these properties from interface and use same behavior as other view models + var keyBackup: MXKeyBackup? { get } + var checkKeyBackup: Bool { get } +}