* Read and import the secrets from ClassicAppAccounts. * Record snapshots. * Add some documentation, tidy up tests and fix the dismissal of the backup instructions. * Workaround flakey tests (the fulfilments weren't always firing). * Allow a custom Classic App deep link URL to be configured.
50 lines
1.8 KiB
Swift
50 lines
1.8 KiB
Swift
//
|
|
// Copyright 2026 Element Creations Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files in the repository root for full details.
|
|
//
|
|
|
|
import Foundation
|
|
import MatrixRustSDK
|
|
|
|
extension ClassicAppManagerMock {
|
|
struct Configuration {
|
|
var accounts: [ClassicAppAccount]
|
|
var availableSecrets: ClassicAppAccount.AvailableSecrets = .complete
|
|
var secretsBundle: SecretsBundleWithUserId?
|
|
}
|
|
|
|
convenience init(_ configuration: Configuration) {
|
|
self.init()
|
|
|
|
loadAccountsClosure = { configuration.accounts }
|
|
availableSecretsForReturnValue = configuration.availableSecrets
|
|
secretsBundleForReturnValue = configuration.secretsBundle
|
|
}
|
|
}
|
|
|
|
extension ClassicAppAccount {
|
|
static var mockAlice: ClassicAppAccount {
|
|
ClassicAppAccount(userID: "@alice:matrix.org",
|
|
displayName: "Alice",
|
|
avatarURL: nil,
|
|
serverName: "matrix.org",
|
|
homeserverURL: "https://matrix-client.matrix.org",
|
|
cryptoStoreURL: .cachesDirectory,
|
|
cryptoStorePassphrase: "1234567890",
|
|
accessToken: "accessToken")
|
|
}
|
|
|
|
static var mockDan: ClassicAppAccount {
|
|
ClassicAppAccount(userID: "@dan:matrix.org",
|
|
displayName: "Dan",
|
|
avatarURL: .mockMXCUserAvatar,
|
|
serverName: "matrix.org",
|
|
homeserverURL: "https://matrix-client.matrix.org",
|
|
cryptoStoreURL: .cachesDirectory,
|
|
cryptoStorePassphrase: "1234567890",
|
|
accessToken: "accessToken")
|
|
}
|
|
}
|