-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from devwaseem/development
v1.1
- Loading branch information
Showing
9 changed files
with
113 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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,17 @@ | ||
// | ||
// CheckForUpdatesView.swift | ||
// TempBox (macOS) | ||
// | ||
// Created by Waseem Akram on 28/10/21. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct CheckForUpdatesView: View { | ||
@ObservedObject var updaterViewController: UpdaterViewController | ||
|
||
var body: some View { | ||
Button("Check For Updates…", action: updaterViewController.checkForUpdates) | ||
.disabled(!updaterViewController.canCheckForUpdates) | ||
} | ||
} |
This file contains 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,29 @@ | ||
// | ||
// UpdaterViewController.swift | ||
// TempBox (macOS) | ||
// | ||
// Created by Waseem Akram on 28/10/21. | ||
// | ||
|
||
import Foundation | ||
import Sparkle | ||
import SwiftUI | ||
|
||
final class UpdaterViewController: ObservableObject { | ||
private let updaterController: SPUStandardUpdaterController | ||
|
||
@Published var canCheckForUpdates = false | ||
|
||
init() { | ||
// If you want to start the updater manually, pass false to startingUpdater and call .startUpdater() later | ||
// This is where you can also pass an updater delegate if you need one | ||
updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil) | ||
|
||
updaterController.updater.publisher(for: \.canCheckForUpdates) | ||
.assign(to: &$canCheckForUpdates) | ||
} | ||
|
||
func checkForUpdates() { | ||
updaterController.checkForUpdates(nil) | ||
} | ||
} |