Skip to content

Commit

Permalink
Update ContentView UX
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Nov 24, 2023
1 parent a301986 commit 82d7204
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 12 deletions.
10 changes: 10 additions & 0 deletions Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,16 @@
}
}
},
"You can turn off MenuHelper's extension in **System Settings -> Privacy & Security -> Extensions -> Added Extensions**" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "您可以在 **系统设置 -> 隐私与安全性 -> 扩展 -> 添加的扩展** 中关闭“速达-访达扩展”"
}
}
}
},
"You can turn on MenuHelper's extension in **System Settings -> Privacy & Security -> Extensions -> Added Extensions**" : {
"localizations" : {
"zh-Hans" : {
Expand Down
50 changes: 39 additions & 11 deletions MenuHelper/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,53 @@ import SwiftUI
private let logger = Logger(subsystem: subsystem, category: "main")

struct ContentView: View {
private var enable: Bool {
FIFinderSyncController.isExtensionEnabled
}

private var imageName: String {
enable ? "gear.badge.checkmark" : "gear.badge.xmark"
}

private var hint: LocalizedStringKey {
enable
? "You can turn off MenuHelper's extension in **System Settings -> Privacy & Security -> Extensions -> Added Extensions**"
: "You can turn on MenuHelper's extension in **System Settings -> Privacy & Security -> Extensions -> Added Extensions**"
}

var body: some View {
VStack(spacing: 30) {
Image("icon")
Text("You can turn on MenuHelper's extension in **System Settings -> Privacy & Security -> Extensions -> Added Extensions**")
.multilineTextAlignment(.center)
// FIXME: FIFinderSyncController.isExtensionEnabled is always returning false now.
// Hide the related UI and add text description if extension is enabled.
if !FIFinderSyncController.isExtensionEnabled {
Form {
Section {
HStack {
Image(systemName: imageName)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 50)
.symbolRenderingMode(.multicolor)
Text(hint)
.multilineTextAlignment(.leading)
}
} header: {
HStack {
Spacer()
Image("icon")
Spacer()
}
}
Section {
Button {
FIFinderSyncController.showExtensionManagementInterface()
} label: {
Text("Open System Extension Panel...")
}
SettingsLink {
Text("Open App Settings Window...")
}
}
SettingsLink {
Text("Open App Settings Window...")
}
.buttonStyle(.link)
.foregroundStyle(.accent)
}
.buttonStyle(.borderedProminent)
.formStyle(.grouped)
}
}

Expand Down
2 changes: 1 addition & 1 deletion MenuHelper/MenuHelperApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct MenuHelperApp: App {
}
}
}
.defaultSize(width: 400, height: 200)
.defaultSize(width: 400, height: 300)

Window("Support", id: "support") {
SupportWindow()
Expand Down

0 comments on commit 82d7204

Please sign in to comment.