Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 34 additions & 11 deletions Loop/App/LoopApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,46 @@ import SwiftUI
@main
struct LoopApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@State var isMenubarItemPresented: Bool = false
@ObservedObject private var updater = Updater.shared
@Default(.hideMenuBarIcon) var hideMenuBarIcon

var body: some Scene {
MenuBarExtra(Bundle.main.appName, image: "menubarIcon", isInserted: Binding.constant(!hideMenuBarIcon)) {
#if DEBUG
let text = "DEV BUILD: \(Bundle.main.appVersion ?? "Unknown") (\(Bundle.main.appBuild ?? 0))"
Text(text)
.font(.system(size: 11, weight: .semibold))
#endif

Button {
if let url = URL(string: "https://github.com/sponsors/MrKai77") {
NSWorkspace.shared.open(url)
}
} label: {
HStack {
Image(systemName: "heart")
Text("Donate")
Label("Donate", systemImage: "heart")
}

Divider()

Text(
"Version \(Bundle.main.appVersion ?? "Unknown") (\(Bundle.main.appBuild ?? 0))",
comment: "Format: Version [version, e.g. 1.3.0] ([build number, e.g. 1500])"
)
.font(.system(size: 11, weight: .semibold))

Button {
Task {
await updater.fetchLatestInfo()

if updater.updateState == .available {
await updater.showUpdateWindow()
}
}
} label: {
if updater.updateState == .available {
Text(
"Update…",
comment: "Button to update app in menubar dropdown menu"
)
} else {
Text(
"Check for Updates…",
comment: "Button to check for updates in menubar dropdown menu"
)
}
}

Expand All @@ -38,7 +59,9 @@ struct LoopApp: App {
}
.keyboardShortcut(",", modifiers: .command)

Button("Quit") {
Divider()

Button("Quit \(Bundle.main.appName)") {
NSApp.terminate(nil)
}
.keyboardShortcut("q", modifiers: .command)
Expand Down
12 changes: 11 additions & 1 deletion Loop/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -2557,6 +2557,9 @@
}
}
},
"Check for Updates…" : {
"comment" : "Button to check for updates in menubar dropdown menu"
},
"Close" : {
"comment" : "Label for a button that closes a modal window",
"localizations" : {
Expand Down Expand Up @@ -20675,6 +20678,7 @@
}
},
"Quit" : {
"extractionState" : "stale",
"localizations" : {
"ar" : {
"stringUnit" : {
Expand Down Expand Up @@ -20756,6 +20760,10 @@
}
}
},
"Quit %@" : {
"comment" : "A button that quits the app.",
"isCommentAutoGenerated" : true
},
"Radial menu" : {
"localizations" : {
"ar" : {
Expand Down Expand Up @@ -27605,6 +27613,7 @@
}
},
"Update…" : {
"comment" : "Button to update app in menubar dropdown menu",
"localizations" : {
"ar" : {
"stringUnit" : {
Expand Down Expand Up @@ -28180,6 +28189,7 @@
}
},
"Version %@ (%lld)" : {
"comment" : "Format: Version [version, e.g. 1.3.0] ([build number, e.g. 1500])",
"localizations" : {
"ar" : {
"stringUnit" : {
Expand Down Expand Up @@ -29667,5 +29677,5 @@
}
}
},
"version" : "1.0"
"version" : "1.1"
}