Fix iCloud icon and move to the right

This commit is contained in:
Davide De Rosa 2024-10-04 00:39:41 +02:00
parent fc834ab367
commit ca03d057fc
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
3 changed files with 24 additions and 33 deletions

View File

@ -80,7 +80,7 @@ public final class Theme: ObservableObject {
switch $0 {
case .add: return "plus"
case .close: return "xmark"
case .cloud: return "cloud"
case .cloud: return "icloud"
case .contextDuplicate: return "plus.square.on.square"
case .contextRemove: return "trash"
case .copy: return "doc.on.doc"

View File

@ -38,31 +38,18 @@ struct ProfileCardView: View {
let header: ProfileHeader
@ObservedObject
var profileManager: ProfileManager
var body: some View {
switch style {
case .compact:
HStack {
Text(header.name)
.themeTruncating()
if isShared {
ThemeImage(.cloud)
}
}
.frame(maxWidth: .infinity, alignment: .leading)
case .full:
VStack(alignment: .leading) {
HStack {
Text(header.name)
.font(.headline)
.themeTruncating()
if isShared {
ThemeImage(.cloud)
}
}
Text(Strings.Views.Profiles.Rows.modules(header.modules.count))
.font(.subheadline)
.foregroundStyle(.secondary)
@ -72,12 +59,6 @@ struct ProfileCardView: View {
}
}
private extension ProfileCardView {
var isShared: Bool {
profileManager.isRemotelyShared(profileWithId: header.id)
}
}
// MARK: - Previews
#Preview {
@ -85,15 +66,13 @@ private extension ProfileCardView {
Section {
ProfileCardView(
style: .compact,
header: Profile.mock.header(),
profileManager: .mock
header: Profile.mock.header()
)
}
Section {
ProfileCardView(
style: .full,
header: Profile.mock.header(),
profileManager: .mock
header: Profile.mock.header()
)
}
}

View File

@ -38,7 +38,8 @@ struct ProfileRowView: View, TunnelContextProviding {
let style: ProfileCardView.Style
let profileManager: ProfileManager
@ObservedObject
var profileManager: ProfileManager
@ObservedObject
var tunnel: Tunnel
@ -63,12 +64,19 @@ struct ProfileRowView: View, TunnelContextProviding {
}
cardView
Spacer()
if isShared {
sharingView
}
ProfileInfoButton(header: header, onEdit: onEdit)
}
}
}
private extension ProfileRowView {
var isShared: Bool {
profileManager.isRemotelyShared(profileWithId: header.id)
}
var markerView: some View {
ThemeImage(header.id == nextProfileId ? .pending : statusImage)
.opacity(header.id == nextProfileId || header.id == tunnel.currentProfile?.id ? 1.0 : 0.0)
@ -85,14 +93,18 @@ private extension ProfileRowView {
) { _ in
ProfileCardView(
style: style,
header: header,
profileManager: profileManager
header: header
)
.frame(maxWidth: .infinity)
.contentShape(.rect)
}
}
var sharingView: some View {
ThemeImage(.cloud)
.foregroundStyle(.secondary)
}
var statusImage: Theme.ImageName {
switch tunnelConnectionStatus {
case .active: