* Replace GrantLoginWithQrCodeHandlerSDKMock with LinkNewDeviceServiceMock. Add tests for all initial states on the QRCodeLoginScreen. * Add tests for linking both mobile and desktop devices. * Add UI tests for linking a new device. * Don't show the Link Desktop Computer button when running on macOS. This mirrors the decision to hide the Sign In With QR Code button on the start screen.
28 lines
721 B
Swift
28 lines
721 B
Swift
//
|
|
// Copyright 2025 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
|
|
|
|
enum LinkNewDeviceScreenViewModelAction {
|
|
case linkMobileDevice(LinkNewDeviceService.LinkMobileProgressPublisher)
|
|
case linkDesktopComputer
|
|
case dismiss
|
|
}
|
|
|
|
struct LinkNewDeviceScreenViewState: BindableState {
|
|
enum Mode: Equatable { case loading, readyToLink(isGeneratingCode: Bool), notSupported }
|
|
var mode: Mode = .loading
|
|
|
|
let showLinkDesktopComputerButton: Bool
|
|
}
|
|
|
|
enum LinkNewDeviceScreenViewAction {
|
|
case linkMobileDevice
|
|
case linkDesktopComputer
|
|
case dismiss
|
|
}
|