mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 15:45:11 +00:00
Make the app version and the device ID copyable in the Settings screen. (#1389)
This commit is contained in:
@@ -165,9 +165,12 @@ struct SettingsScreen: View {
|
|||||||
versionText
|
versionText
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
|
|
||||||
context.viewState.deviceID.map(Text.init)
|
if let deviceID = context.viewState.deviceID {
|
||||||
|
Text(deviceID)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.compoundFormSectionFooter()
|
.compoundFormSectionFooter()
|
||||||
|
.textSelection(.enabled)
|
||||||
.padding(.top, 24)
|
.padding(.top, 24)
|
||||||
}
|
}
|
||||||
.compoundFormSection()
|
.compoundFormSection()
|
||||||
@@ -201,7 +204,8 @@ private extension TimelineStyle {
|
|||||||
|
|
||||||
struct SettingsScreen_Previews: PreviewProvider {
|
struct SettingsScreen_Previews: PreviewProvider {
|
||||||
static let viewModel = {
|
static let viewModel = {
|
||||||
let userSession = MockUserSession(clientProxy: MockClientProxy(userID: "@userid:example.com"),
|
let userSession = MockUserSession(clientProxy: MockClientProxy(userID: "@userid:example.com",
|
||||||
|
deviceID: "AAAAAAAAAAA"),
|
||||||
mediaProvider: MockMediaProvider())
|
mediaProvider: MockMediaProvider())
|
||||||
ServiceLocator.shared.settings.notificationSettingsEnabled = true
|
ServiceLocator.shared.settings.notificationSettingsEnabled = true
|
||||||
return SettingsScreenViewModel(userSession: userSession,
|
return SettingsScreenViewModel(userSession: userSession,
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var deviceId: String? {
|
var deviceID: String? {
|
||||||
do {
|
do {
|
||||||
return try client.deviceId()
|
return try client.deviceId()
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {
|
|||||||
|
|
||||||
var userID: String { get }
|
var userID: String { get }
|
||||||
|
|
||||||
var deviceId: String? { get }
|
var deviceID: String? { get }
|
||||||
|
|
||||||
var homeserver: String { get }
|
var homeserver: String { get }
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class MockClientProxy: ClientProxyProtocol {
|
|||||||
let callbacks = PassthroughSubject<ClientProxyCallback, Never>()
|
let callbacks = PassthroughSubject<ClientProxyCallback, Never>()
|
||||||
|
|
||||||
let userID: String
|
let userID: String
|
||||||
let deviceId: String? = nil
|
let deviceID: String?
|
||||||
let homeserver = ""
|
let homeserver = ""
|
||||||
let restorationToken: RestorationToken? = nil
|
let restorationToken: RestorationToken? = nil
|
||||||
|
|
||||||
@@ -34,8 +34,9 @@ class MockClientProxy: ClientProxyProtocol {
|
|||||||
|
|
||||||
var isSyncing: Bool { false }
|
var isSyncing: Bool { false }
|
||||||
|
|
||||||
internal init(userID: String, roomSummaryProvider: RoomSummaryProviderProtocol? = MockRoomSummaryProvider()) {
|
internal init(userID: String, deviceID: String? = nil, roomSummaryProvider: RoomSummaryProviderProtocol? = MockRoomSummaryProvider()) {
|
||||||
self.userID = userID
|
self.userID = userID
|
||||||
|
self.deviceID = deviceID
|
||||||
self.roomSummaryProvider = roomSummaryProvider
|
self.roomSummaryProvider = roomSummaryProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ struct MockUserSession: UserSessionProtocol {
|
|||||||
let callbacks = PassthroughSubject<UserSessionCallback, Never>()
|
let callbacks = PassthroughSubject<UserSessionCallback, Never>()
|
||||||
let sessionVerificationController: SessionVerificationControllerProxyProtocol? = nil
|
let sessionVerificationController: SessionVerificationControllerProxyProtocol? = nil
|
||||||
var userID: String { clientProxy.userID }
|
var userID: String { clientProxy.userID }
|
||||||
var deviceID: String? { clientProxy.deviceId }
|
var deviceID: String? { clientProxy.deviceID }
|
||||||
var homeserver: String { clientProxy.homeserver }
|
var homeserver: String { clientProxy.homeserver }
|
||||||
let clientProxy: ClientProxyProtocol
|
let clientProxy: ClientProxyProtocol
|
||||||
let mediaProvider: MediaProviderProtocol
|
let mediaProvider: MediaProviderProtocol
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class UserSession: UserSessionProtocol {
|
|||||||
private var authErrorCancellable: AnyCancellable?
|
private var authErrorCancellable: AnyCancellable?
|
||||||
|
|
||||||
var userID: String { clientProxy.userID }
|
var userID: String { clientProxy.userID }
|
||||||
var deviceID: String? { clientProxy.deviceId }
|
var deviceID: String? { clientProxy.deviceID }
|
||||||
var homeserver: String { clientProxy.homeserver }
|
var homeserver: String { clientProxy.homeserver }
|
||||||
|
|
||||||
let clientProxy: ClientProxyProtocol
|
let clientProxy: ClientProxyProtocol
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Make the app version and the device ID copyable in the Settings screen.
|
||||||
Reference in New Issue
Block a user