Device Manager: Verify session (#6832)

* Initial implementation
* Add verificationState to UserSessionInfo
* Listen for changes device changes in the service.
This commit is contained in:
Doug
2022-10-11 16:11:52 +01:00
committed by GitHub
parent 6c9a058b93
commit 6a0112aa95
33 changed files with 534 additions and 114 deletions
@@ -38,14 +38,12 @@ struct DeviceAvatarView: View {
.clipShape(Circle())
// Verification badge
if let isVerified = viewData.isVerified {
Image(isVerified ? Asset.Images.userSessionVerified.name : Asset.Images.userSessionUnverified.name)
.frame(maxWidth: CGFloat(badgeSize), maxHeight: CGFloat(badgeSize))
.shapedBorder(color: theme.colors.system, borderWidth: 1, shape: Circle())
.background(theme.colors.background)
.clipShape(Circle())
.offset(x: 10, y: 8)
}
Image(viewData.verificationImageName)
.frame(maxWidth: CGFloat(badgeSize), maxHeight: CGFloat(badgeSize))
.shapedBorder(color: theme.colors.system, borderWidth: 1, shape: Circle())
.background(theme.colors.background)
.clipShape(Circle())
.offset(x: 10, y: 8)
}
.frame(maxWidth: CGFloat(avatarSize), maxHeight: CGFloat(avatarSize))
}
@@ -54,20 +52,20 @@ struct DeviceAvatarView: View {
struct DeviceAvatarViewListPreview: View {
var viewDataList: [DeviceAvatarViewData] {
[
DeviceAvatarViewData(deviceType: .desktop, isVerified: true),
DeviceAvatarViewData(deviceType: .web, isVerified: true),
DeviceAvatarViewData(deviceType: .mobile, isVerified: true),
DeviceAvatarViewData(deviceType: .unknown, isVerified: true)
DeviceAvatarViewData(deviceType: .desktop, verificationState: .verified),
DeviceAvatarViewData(deviceType: .web, verificationState: .verified),
DeviceAvatarViewData(deviceType: .mobile, verificationState: .verified),
DeviceAvatarViewData(deviceType: .unknown, verificationState: .verified)
]
}
var body: some View {
HStack {
VStack(alignment: .center, spacing: 20) {
DeviceAvatarView(viewData: DeviceAvatarViewData(deviceType: .web, isVerified: true))
DeviceAvatarView(viewData: DeviceAvatarViewData(deviceType: .desktop, isVerified: false))
DeviceAvatarView(viewData: DeviceAvatarViewData(deviceType: .mobile, isVerified: true))
DeviceAvatarView(viewData: DeviceAvatarViewData(deviceType: .unknown, isVerified: false))
DeviceAvatarView(viewData: DeviceAvatarViewData(deviceType: .web, verificationState: .verified))
DeviceAvatarView(viewData: DeviceAvatarViewData(deviceType: .desktop, verificationState: .unverified))
DeviceAvatarView(viewData: DeviceAvatarViewData(deviceType: .mobile, verificationState: .verified))
DeviceAvatarView(viewData: DeviceAvatarViewData(deviceType: .unknown, verificationState: .unverified))
}
}
}