Updates: Make updater restricted to minVersion

For versions that require iOS 15 and up, don't notify previous iOS 14
users about a new update. This requires a minVersion attribute in
the shared Application class.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2023-03-06 00:07:13 -05:00
parent 618041714d
commit a0632b0c16
2 changed files with 6 additions and 1 deletions

View file

@ -12,6 +12,8 @@ import Foundation
public class Application {
static let shared = Application()
let minVersion = OperatingSystemVersion(majorVersion: 14, minorVersion: 0, patchVersion: 0)
var appVersion: String {
Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "0.0.0"
}

View file

@ -73,7 +73,10 @@ struct MainView: View {
}
}
.backport.onAppear {
if autoUpdateNotifs {
if
autoUpdateNotifs,
Application.shared.osVersion.majorVersion >= Application.shared.minVersion.majorVersion
{
viewTask = Task {
do {
guard let latestRelease = try await Github().fetchLatestRelease() else {