Expose the current device identifier in settings (#442)

This commit is contained in:
Stefan Ceriu
2023-01-11 19:08:20 +02:00
committed by GitHub
parent d8eb9885f8
commit 22480e0ed4
3 changed files with 10 additions and 3 deletions

View File

@@ -26,6 +26,7 @@ enum SettingsViewModelAction {
struct SettingsViewState: BindableState {
var bindings: SettingsViewStateBindings
var deviceID: String?
var userID: String
var userAvatar: UIImage?
var userDisplayName: String?

View File

@@ -26,7 +26,7 @@ class SettingsViewModel: SettingsViewModelType, SettingsViewModelProtocol {
init(withUserSession userSession: UserSessionProtocol) {
self.userSession = userSession
let bindings = SettingsViewStateBindings()
super.init(initialViewState: .init(bindings: bindings, userID: userSession.userID))
super.init(initialViewState: .init(bindings: bindings, deviceID: userSession.deviceId, userID: userSession.userID))
Task {
if case let .success(userAvatarURLString) = await userSession.clientProxy.loadUserAvatarURLString() {

View File

@@ -155,8 +155,14 @@ struct SettingsScreen: View {
Text(ElementL10n.actionSignOutConfirmationSimple)
}
} footer: {
versionText
.frame(maxWidth: .infinity)
VStack {
versionText
.frame(maxWidth: .infinity)
if let deviceId = context.viewState.deviceID {
Text(deviceId)
}
}
}
}