mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-18 23:48:29 +02:00
Map location info
This commit is contained in:
@@ -20,6 +20,8 @@ struct UserSessionListItem: View {
|
||||
@Environment(\.theme) private var theme: ThemeSwiftUI
|
||||
|
||||
let viewData: UserSessionListItemViewData
|
||||
let showsLocationInfo: Bool
|
||||
|
||||
var isSeparatorHidden = false
|
||||
var isEditModeEnabled = false
|
||||
var onBackgroundTap: ((String) -> Void)?
|
||||
@@ -76,6 +78,13 @@ struct UserSessionListItem: View {
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.accessibilityIdentifier("UserSessionListItem_\(viewData.sessionId)")
|
||||
}
|
||||
|
||||
private var ipText: String? {
|
||||
guard let lastSeenIp = viewData.lastSeenIP, !lastSeenIp.isEmpty else {
|
||||
return nil
|
||||
}
|
||||
return viewData.lastSeenIPLocation.map { "\(lastSeenIp) (\($0))" } ?? lastSeenIp
|
||||
}
|
||||
}
|
||||
|
||||
struct UserSessionListPreview: View {
|
||||
@@ -86,7 +95,7 @@ struct UserSessionListPreview: View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
ForEach(userSessionsOverviewService.otherSessions) { userSessionInfo in
|
||||
let viewData = UserSessionListItemViewDataFactory().create(from: userSessionInfo)
|
||||
UserSessionListItem(viewData: viewData, isEditModeEnabled: isEditModeEnabled, onBackgroundTap: { _ in
|
||||
UserSessionListItem(viewData: viewData, showsLocationInfo: true, isEditModeEnabled: isEditModeEnabled, onBackgroundTap: { _ in
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,14 +25,12 @@ struct UserSessionListItemViewData: Identifiable, Hashable {
|
||||
}
|
||||
|
||||
let sessionId: SessionId
|
||||
|
||||
let sessionName: String
|
||||
|
||||
let sessionDetails: String
|
||||
|
||||
let highlightSessionDetails: Bool
|
||||
let deviceAvatarViewData: DeviceAvatarViewData
|
||||
|
||||
let sessionDetailsIcon: String?
|
||||
|
||||
let isSelected: Bool
|
||||
let lastSeenIP: String?
|
||||
let lastSeenIPLocation: String?
|
||||
}
|
||||
|
||||
@@ -29,7 +29,9 @@ struct UserSessionListItemViewDataFactory {
|
||||
sessionDetails: sessionDetails,
|
||||
deviceAvatarViewData: deviceAvatarViewData,
|
||||
sessionDetailsIcon: getSessionDetailsIcon(isActive: sessionInfo.isActive),
|
||||
isSelected: isSelected)
|
||||
isSelected: isSelected,
|
||||
lastSeenIP: sessionInfo.lastSeenIP,
|
||||
lastSeenIPLocation: sessionInfo.lastSeenIPLocation)
|
||||
}
|
||||
|
||||
private func buildSessionDetails(sessionInfo: UserSessionInfo) -> String {
|
||||
|
||||
@@ -38,11 +38,6 @@ struct UserSessionsOverview: View {
|
||||
}
|
||||
}
|
||||
.readableFrame()
|
||||
|
||||
// if viewModel.viewState.linkDeviceButtonVisible {
|
||||
// linkDeviceView
|
||||
// .padding(.bottom, geometry.safeAreaInsets.bottom > 0 ? 20 : 36)
|
||||
// }
|
||||
}
|
||||
}
|
||||
.background(theme.colors.system.ignoresSafeArea())
|
||||
@@ -155,6 +150,7 @@ struct UserSessionsOverview: View {
|
||||
LazyVStack(spacing: 0) {
|
||||
ForEach(viewModel.viewState.otherSessionsViewData.prefix(maxOtherSessionsToDisplay)) { viewData in
|
||||
UserSessionListItem(viewData: viewData,
|
||||
showsLocationInfo: false,
|
||||
isSeparatorHidden: viewData == viewModel.viewState.otherSessionsViewData.last,
|
||||
onBackgroundTap: { sessionId in viewModel.send(viewAction: .tapUserSession(sessionId)) })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user