Move Theme images to same file

This commit is contained in:
Davide 2024-10-26 21:51:18 +02:00
parent ee3a40b597
commit cc119e18ce
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
3 changed files with 44 additions and 38 deletions

View File

@ -62,3 +62,45 @@ extension Theme {
case tunnelUninstall
}
}
extension Theme.ImageName {
static var defaultSystemName: (Self) -> String {
{
switch $0 {
case .add: return "plus"
case .close: return "xmark"
case .cloud: return "icloud"
case .contextDuplicate: return "plus.square.on.square"
case .contextRemove: return "trash"
case .copy: return "doc.on.doc"
case .disclose: return "chevron.down"
case .editableSectionEdit: return "arrow.up.arrow.down"
case .editableSectionRemove: return "trash"
case .favoriteOff: return "star"
case .favoriteOn: return "star.fill"
case .filters: return "line.3.horizontal.decrease"
case .footerAdd: return "plus.circle"
case .hide: return "eye.slash"
case .info: return "info.circle"
case .marked: return "checkmark"
case .moreDetails: return "ellipsis.circle"
case .pending: return "clock"
case .profileEdit: return "square.and.pencil"
case .profileImport: return "square.and.arrow.down"
case .profilesGrid: return "square.grid.2x2"
case .profilesList: return "rectangle.grid.1x2"
case .remove: return "minus"
case .settings: return "gearshape"
case .share: return "square.and.arrow.up"
case .show: return "eye"
case .sleeping: return "powersleep"
case .tip: return "questionmark.circle"
case .tunnelDisable: return "arrow.down"
case .tunnelEnable: return "arrow.up"
case .tunnelRestart: return "arrow.clockwise"
case .tunnelToggle: return "power"
case .tunnelUninstall: return "arrow.uturn.down"
}
}
}
}

View File

@ -387,7 +387,7 @@ struct ThemeImage: View {
}
var body: some View {
Image(systemName: theme.systemImage(name))
Image(systemName: theme.systemImageName(name))
}
}

View File

@ -78,43 +78,7 @@ public final class Theme: ObservableObject {
var logoImage = "Logo"
var systemImage: (ImageName) -> String = {
switch $0 {
case .add: return "plus"
case .close: return "xmark"
case .cloud: return "icloud"
case .contextDuplicate: return "plus.square.on.square"
case .contextRemove: return "trash"
case .copy: return "doc.on.doc"
case .disclose: return "chevron.down"
case .editableSectionEdit: return "arrow.up.arrow.down"
case .editableSectionRemove: return "trash"
case .favoriteOff: return "star"
case .favoriteOn: return "star.fill"
case .filters: return "line.3.horizontal.decrease"
case .footerAdd: return "plus.circle"
case .hide: return "eye.slash"
case .info: return "info.circle"
case .marked: return "checkmark"
case .moreDetails: return "ellipsis.circle"
case .pending: return "clock"
case .profileEdit: return "square.and.pencil"
case .profileImport: return "square.and.arrow.down"
case .profilesGrid: return "square.grid.2x2"
case .profilesList: return "rectangle.grid.1x2"
case .remove: return "minus"
case .settings: return "gearshape"
case .share: return "square.and.arrow.up"
case .show: return "eye"
case .sleeping: return "powersleep"
case .tip: return "questionmark.circle"
case .tunnelDisable: return "arrow.down"
case .tunnelEnable: return "arrow.up"
case .tunnelRestart: return "arrow.clockwise"
case .tunnelToggle: return "power"
case .tunnelUninstall: return "arrow.uturn.down"
}
}
var systemImageName: (ImageName) -> String = Theme.ImageName.defaultSystemName
init(dummy: Void) {
}