Repository navigation
Sparkle updates #759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
austincondiff
merged 19 commits into
CodeEditApp:main
from
austincondiff:sparkle-updates
Sep 27, 2022
Merged
Sparkle updates #759
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
4e95209
Split Layouts WIP (#702)
austincondiff 9088307
Added update capabilities to application menu and preferences.
austincondiff 7a114f5
Fixed typos
austincondiff 89e39d9
Update Package.swift
austincondiff b560da9
Update Package.swift
austincondiff ca2277c
Delete DropProposalPositionCalculationsTests.swift
austincondiff 4ea58d0
Delete DropProposalPositionCalculations.swift
austincondiff 9cb99cb
Delete SplitViewDropDelegate.swift
austincondiff 672075c
Delete SplitEditorDropProposalPosition.swift
austincondiff 0c03d6f
Delete SplitViewDropProposalOverlay.swift
austincondiff 7a4d394
Delete SplitViewModifier.swift
austincondiff ffdceb5
Update AppDelegate.swift
austincondiff f314a34
Moved updater state object up so it will get initialized on launch an…
austincondiff 396a9fe
Changed ObservableUpdater to SoftwareUpdater
austincondiff 7a96cf5
Missed one, got it
austincondiff f417625
Removed shared singleton from SoftwareUpdater and removed invalid @St…
austincondiff d132440
Lowercased URL in Info.plist to be consistent with other URLs
austincondiff 3c8fac8
Merge branch 'main' into sparkle-updates
austincondiff 607022d
Merge branch 'main' into sparkle-updates
austincondiff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
CodeEditModules/Modules/AppPreferences/src/SoftwareUpdater.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| // | ||
| // SoftwareUpdater.swift | ||
| // CodeEdit | ||
| // | ||
| // Created by Austin Condiff on 9/19/22. | ||
| // | ||
|
|
||
| import Foundation | ||
| import Sparkle | ||
|
|
||
| public class SoftwareUpdater: ObservableObject { | ||
| private let updater: SPUUpdater | ||
| @Published var automaticallyChecksForUpdates = false { | ||
| didSet { | ||
| updater.automaticallyChecksForUpdates = automaticallyChecksForUpdates | ||
| } | ||
| } | ||
| private var automaticallyChecksForUpdatesObservation: NSKeyValueObservation? | ||
| @Published var lastUpdateCheckDate: Date? | ||
| private var lastUpdateCheckDateObservation: NSKeyValueObservation? | ||
| @Published var includePrereleaseVersions = false { | ||
| didSet { | ||
| UserDefaults.standard.setValue(includePrereleaseVersions, forKey: "includePrereleaseVersions") | ||
| if includePrereleaseVersions { | ||
| updater.setFeedURL(.prereleaseAppcast) | ||
| } else { | ||
| updater.setFeedURL(.appcast) | ||
| } | ||
| } | ||
| } | ||
| public init() { | ||
| updater = SPUStandardUpdaterController( | ||
| startingUpdater: true, | ||
| updaterDelegate: nil, | ||
| userDriverDelegate: nil | ||
| ).updater | ||
| automaticallyChecksForUpdatesObservation = updater.observe( | ||
| \.automaticallyChecksForUpdates, | ||
| options: [.initial, .new, .old], | ||
| changeHandler: { [unowned self] updater, change in | ||
| guard change.newValue != change.oldValue else { return } | ||
| self.automaticallyChecksForUpdates = updater.automaticallyChecksForUpdates | ||
| } | ||
| ) | ||
| lastUpdateCheckDateObservation = updater.observe( | ||
| \.lastUpdateCheckDate, | ||
| options: [.initial, .new, .old], | ||
| changeHandler: { [unowned self] updater, _ in | ||
| self.lastUpdateCheckDate = updater.lastUpdateCheckDate | ||
| } | ||
| ) | ||
| includePrereleaseVersions = UserDefaults.standard.bool(forKey: "includePrereleaseVersions") | ||
| } | ||
| func checkForUpdates() { | ||
| updater.checkForUpdates() | ||
| } | ||
| } | ||
|
|
||
| extension URL { | ||
| static let appcast = URL(string: "https://codeeditapp.github.io/CodeEdit/appcast.xml")! | ||
| static let prereleaseAppcast = URL(string: "https://codeeditapp.github.io/CodeEdit/appcast_pre.xml")! | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.