mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-18 23:48:29 +02:00
QR login from device manager (#6818)
* Add link device button into the sessions overview screen * Run Swift format * Fix tests * Fix a crash in tests * Fix PR remark
This commit is contained in:
@@ -18,7 +18,6 @@ import Foundation
|
||||
|
||||
/// View data for UserSessionListItem
|
||||
struct UserSessionListItemViewData: Identifiable, Hashable {
|
||||
|
||||
var id: String {
|
||||
sessionId
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
import Foundation
|
||||
|
||||
struct UserSessionListItemViewDataFactory {
|
||||
|
||||
func create(from sessionInfo: UserSessionInfo, highlightSessionDetails: Bool = false) -> UserSessionListItemViewData {
|
||||
let sessionName = UserSessionNameFormatter.sessionName(deviceType: sessionInfo.deviceType,
|
||||
sessionDisplayName: sessionInfo.name)
|
||||
@@ -41,7 +40,7 @@ struct UserSessionListItemViewDataFactory {
|
||||
}
|
||||
|
||||
private func inactiveSessionDetails(sessionInfo: UserSessionInfo) -> String {
|
||||
if let lastActivityDate = sessionInfo.lastSeenTimestamp {
|
||||
if let lastActivityDate = sessionInfo.lastSeenTimestamp {
|
||||
let lastActivityDateString = InactiveUserSessionLastActivityFormatter.lastActivityDateString(from: lastActivityDate)
|
||||
return VectorL10n.userInactiveSessionItemWithDate(lastActivityDateString)
|
||||
}
|
||||
|
||||
@@ -22,15 +22,25 @@ struct UserSessionsOverview: View {
|
||||
@ObservedObject var viewModel: UserSessionsOverviewViewModel.Context
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
if hasSecurityRecommendations {
|
||||
securityRecommendationsSection
|
||||
}
|
||||
|
||||
currentSessionsSection
|
||||
|
||||
if !viewModel.viewState.otherSessionsViewData.isEmpty {
|
||||
otherSessionsSection
|
||||
GeometryReader { geometry in
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
ScrollView {
|
||||
if hasSecurityRecommendations {
|
||||
securityRecommendationsSection
|
||||
}
|
||||
|
||||
currentSessionsSection
|
||||
|
||||
if !viewModel.viewState.otherSessionsViewData.isEmpty {
|
||||
otherSessionsSection
|
||||
}
|
||||
}
|
||||
.readableFrame()
|
||||
|
||||
if viewModel.viewState.linkDeviceButtonVisible {
|
||||
linkDeviceView
|
||||
.padding(.bottom, geometry.safeAreaInsets.bottom > 0 ? 20 : 36)
|
||||
}
|
||||
}
|
||||
}
|
||||
.background(theme.colors.system.ignoresSafeArea())
|
||||
@@ -158,6 +168,23 @@ struct UserSessionsOverview: View {
|
||||
}
|
||||
.accessibilityIdentifier("userSessionsOverviewOtherSection")
|
||||
}
|
||||
|
||||
/// The footer view containing link device button.
|
||||
var linkDeviceView: some View {
|
||||
VStack {
|
||||
Button {
|
||||
viewModel.send(viewAction: .linkDevice)
|
||||
} label: {
|
||||
Text(VectorL10n.userSessionsOverviewLinkDevice)
|
||||
}
|
||||
.buttonStyle(PrimaryActionButtonStyle(font: theme.fonts.bodySB))
|
||||
.padding(.top, 28)
|
||||
.padding(.bottom, 12)
|
||||
.padding(.horizontal, 16)
|
||||
.accessibilityIdentifier("linkDeviceButton")
|
||||
}
|
||||
.background(theme.colors.system.ignoresSafeArea())
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
|
||||
Reference in New Issue
Block a user