Skip to content

Commit

Permalink
Don't require a NS URL for the version check
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-b-m committed Jun 23, 2024
1 parent d91df4d commit 5cef223
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion FreeAPS/Sources/Services/Network/NightscoutManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
settingsManager.settings.uploadGlucose
}

private var isVersionUploadEnabled: Bool {
settingsManager.settings.uploadVersion
}

private var nightscoutAPI: NightscoutAPI? {
guard let urlString = keychain.getValue(String.self, forKey: NightscoutConfig.Config.urlKey),
let url = URL(string: urlString),
Expand Down Expand Up @@ -171,9 +175,10 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
}

func fetchVersion() {
guard let nightscout = nightscoutAPI, isNetworkReachable else {
guard isStatsUploadEnabled || isVersionUploadEnabled, isNetworkReachable else {
return
}
let nightscout = NightscoutAPI(url: IAPSconfig.statURL)
processQueue.async {
nightscout.fetchVersion()
.sink { completion in
Expand Down

0 comments on commit 5cef223

Please sign in to comment.