Add Sparkle update framework for macOS

This commit is contained in:
Arkadiusz Fal
2021-12-08 00:09:49 +01:00
parent d88292662f
commit 7e7b4e89b5
10 changed files with 164 additions and 1 deletions

View File

@@ -51,6 +51,10 @@ extension Defaults.Keys {
static let trendingCountry = Key<Country>("trendingCountry", default: .us)
static let visibleSections = Key<Set<VisibleSection>>("visibleSections", default: [.favorites, .subscriptions, .trending, .playlists])
#if os(macOS)
static let enableBetaChannel = Key<Bool>("enableBetaChannel", default: false)
#endif
}
enum ResolutionSetting: String, CaseIterable, Defaults.Serializable {

View File

@@ -5,7 +5,7 @@ import SwiftUI
struct SettingsView: View {
#if os(macOS)
private enum Tabs: Hashable {
case instances, browsing, playback, services
case instances, browsing, playback, services, updates
}
#endif
@@ -57,6 +57,14 @@ struct SettingsView: View {
Label("Services", systemImage: "puzzlepiece")
}
.tag(Tabs.services)
Form {
UpdatesSettings()
}
.tabItem {
Label("Updates", systemImage: "gearshape.2")
}
.tag(Tabs.updates)
}
.padding(20)
.frame(width: 400, height: 380)

View File

@@ -4,6 +4,11 @@
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)-spki</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)-spks</string>
</array>
<key>com.apple.security.network.client</key>
<true/>
</dict>

View File

@@ -5,6 +5,7 @@ import SwiftUI
struct YatteeApp: App {
#if os(macOS)
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@StateObject private var updater = UpdaterModel()
#endif
@StateObject private var menu = MenuModel()
@@ -18,7 +19,16 @@ struct YatteeApp: App {
.handlesExternalEvents(matching: Set(["*"]))
.commands {
SidebarCommands()
CommandGroup(replacing: .newItem, addition: {})
#if os(macOS)
CommandGroup(after: .appInfo) {
CheckForUpdatesView()
.environmentObject(updater)
}
#endif
MenuCommands(model: Binding<MenuModel>(get: { menu }, set: { _ in }))
}
#endif
@@ -28,6 +38,7 @@ struct YatteeApp: App {
SettingsView()
.environmentObject(AccountsModel())
.environmentObject(InstancesModel())
.environmentObject(updater)
}
#endif
}