mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
appStore mode added
This commit is contained in:
@@ -16,6 +16,8 @@ extension Notification.Name {
|
||||
let modules: Observable<[Module]> = Observable([CPU(), Memory(), Disk(), Battery(), Network()])
|
||||
let updater = macAppUpdater(user: "exelban", repo: "stats")
|
||||
|
||||
let appStoreMode: Bool = false
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
let defaults = UserDefaults.standard
|
||||
@@ -45,7 +47,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
NSApp.setActivationPolicy(dockIconStatus)
|
||||
}
|
||||
|
||||
if defaults.object(forKey: "checkUpdatesOnLogin") == nil || defaults.bool(forKey: "checkUpdatesOnLogin") {
|
||||
if !appStoreMode && defaults.object(forKey: "checkUpdatesOnLogin") == nil || defaults.bool(forKey: "checkUpdatesOnLogin") {
|
||||
updater.check() { result, error in
|
||||
if error != nil && error as! String == "No internet connection" {
|
||||
return
|
||||
|
||||
@@ -82,7 +82,9 @@ class MenuBar {
|
||||
let aboutMenu = NSMenuItem(title: "About Stats", action: #selector(openAbout), keyEquivalent: "")
|
||||
aboutMenu.target = self
|
||||
|
||||
menu.addItem(updateMenu)
|
||||
if !appStoreMode {
|
||||
menu.addItem(updateMenu)
|
||||
}
|
||||
menu.addItem(aboutMenu)
|
||||
menu.addItem(NSMenuItem(title: "Quit Stats", action: #selector(NSApplication.terminate(_:)), keyEquivalent: ""))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user