Add “show location“ feature in session overview

This commit is contained in:
Alfonso Grillo
2022-11-02 14:08:32 +01:00
parent ea50296b10
commit f787043129
5 changed files with 33 additions and 8 deletions
@@ -36,12 +36,17 @@ enum UserSessionOverviewViewModelResult: Equatable {
// MARK: View
struct UserSessionOverviewViewBindings {
var showLocationInfo = false
}
struct UserSessionOverviewViewState: BindableState {
var cardViewData: UserSessionCardViewData
let isCurrentSession: Bool
var isPusherEnabled: Bool?
var remotelyTogglingPushersAvailable: Bool
var showLoadingIndicator: Bool
var bindings: UserSessionOverviewViewBindings = .init()
}
enum UserSessionOverviewViewAction {
@@ -28,7 +28,7 @@ struct UserSessionOverview: View {
},
onViewDetailsAction: { _ in
viewModel.send(viewAction: .viewSessionDetails)
})
}, showLocationInformations: viewModel.showLocationInfo)
.padding(16)
SwiftUI.Section {
UserSessionOverviewItem(title: VectorL10n.userSessionOverviewSessionDetailsButtonTitle,
@@ -68,6 +68,14 @@ struct UserSessionOverview: View {
Label(VectorL10n.manageSessionRename, systemImage: "pencil")
}
.accessibilityIdentifier(VectorL10n.manageSessionRename)
if viewModel.viewState.isCurrentSession == false {
Button { viewModel.showLocationInfo.toggle() } label: {
let text = viewModel.showLocationInfo ? VectorL10n.userSessionsHideLocationInfo : VectorL10n.userSessionsShowLocationInfo
let image = viewModel.showLocationInfo ? "eye.slash" : "eye"
Label(text, systemImage: image)
}
}
}
DestructiveButton {
viewModel.send(viewAction: .logoutOfSession)