Add location feature in UserSessionsOverview

This commit is contained in:
Alfonso Grillo
2022-11-02 15:28:14 +01:00
parent b52a487eda
commit 3488cc508d
4 changed files with 32 additions and 10 deletions
@@ -136,21 +136,37 @@ struct UserSessionsOverview: View {
}
}
} label: {
Image(systemName: "ellipsis")
.foregroundColor(theme.colors.secondaryContent)
.padding(.horizontal, 8)
.padding(.vertical, 12)
menuImage
}
.accessibilityIdentifier("MoreOptionsMenu")
.offset(x: 8) // Re-align the symbol after applying padding.
}
private var otherSessionsMenu: some View {
Menu {
Button { viewModel.send(viewAction: .viewOtherSessionsLocation) } label: {
let text = viewModel.viewState.showLocationInfo ? VectorL10n.userSessionsHideLocationInfo : VectorL10n.userSessionsShowLocationInfo
let image = viewModel.viewState.showLocationInfo ? "eye.slash" : "eye"
Label(text, systemImage: image)
}
} label: {
menuImage
}
}
private var menuImage: some View {
Image(systemName: "ellipsis")
.foregroundColor(theme.colors.secondaryContent)
.padding(.horizontal, 8)
.padding(.vertical, 12)
}
private var otherSessionsSection: some View {
SwiftUI.Section {
LazyVStack(spacing: 0) {
ForEach(viewModel.viewState.otherSessionsViewData.prefix(maxOtherSessionsToDisplay)) { viewData in
UserSessionListItem(viewData: viewData,
showsLocationInfo: false,
showsLocationInfo: viewModel.viewState.showLocationInfo,
isSeparatorHidden: viewData == viewModel.viewState.otherSessionsViewData.last,
onBackgroundTap: { sessionId in viewModel.send(viewAction: .tapUserSession(sessionId)) })
}