|
@@ -17,7 +17,7 @@ protocol NightscoutManager: GlucoseSource {
|
|
|
func uploadManualGlucose()
|
|
func uploadManualGlucose()
|
|
|
func uploadStatistics(dailystat: Statistics)
|
|
func uploadStatistics(dailystat: Statistics)
|
|
|
func uploadPreferences(_ preferences: Preferences)
|
|
func uploadPreferences(_ preferences: Preferences)
|
|
|
- func uploadProfileAndSettings()
|
|
|
|
|
|
|
+ func uploadProfileAndSettings(_: Bool)
|
|
|
var cgmURL: URL? { get }
|
|
var cgmURL: URL? { get }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -445,7 +445,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- func uploadProfileAndSettings() {
|
|
|
|
|
|
|
+ func uploadProfileAndSettings(_ force: Bool) {
|
|
|
// These should be modified anyways and not the defaults
|
|
// These should be modified anyways and not the defaults
|
|
|
guard let sensitivities = storage.retrieve(OpenAPS.Settings.insulinSensitivities, as: InsulinSensitivities.self),
|
|
guard let sensitivities = storage.retrieve(OpenAPS.Settings.insulinSensitivities, as: InsulinSensitivities.self),
|
|
|
let basalProfile = storage.retrieve(OpenAPS.Settings.basalProfile, as: [BasalProfileEntry].self),
|
|
let basalProfile = storage.retrieve(OpenAPS.Settings.basalProfile, as: [BasalProfileEntry].self),
|
|
@@ -454,7 +454,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
|
|
|
let preferences = storage.retrieve(OpenAPS.Settings.preferences, as: Preferences.self),
|
|
let preferences = storage.retrieve(OpenAPS.Settings.preferences, as: Preferences.self),
|
|
|
let settings = storage.retrieve(OpenAPS.FreeAPS.settings, as: FreeAPSSettings.self)
|
|
let settings = storage.retrieve(OpenAPS.FreeAPS.settings, as: FreeAPSSettings.self)
|
|
|
else {
|
|
else {
|
|
|
- NSLog("NightscoutManager uploadProfile Not all settings found to build profile!")
|
|
|
|
|
|
|
+ debug(.nightscout, "NightscoutManager uploadProfile Not all settings found to build profile!")
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -548,20 +548,20 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
|
|
|
|
|
|
|
|
// UPLOAD PREFERNCES WHEN CHANGED
|
|
// UPLOAD PREFERNCES WHEN CHANGED
|
|
|
if let uploadedPreferences = storage.retrieve(OpenAPS.Nightscout.uploadedPreferences, as: Preferences.self),
|
|
if let uploadedPreferences = storage.retrieve(OpenAPS.Nightscout.uploadedPreferences, as: Preferences.self),
|
|
|
- uploadedPreferences.rawJSON.sorted() == preferences.rawJSON.sorted()
|
|
|
|
|
|
|
+ uploadedPreferences.rawJSON.sorted() == preferences.rawJSON.sorted(), !force
|
|
|
{
|
|
{
|
|
|
NSLog("NightscoutManager Preferences, preferences unchanged")
|
|
NSLog("NightscoutManager Preferences, preferences unchanged")
|
|
|
} else { uploadPreferences(preferences) }
|
|
} else { uploadPreferences(preferences) }
|
|
|
|
|
|
|
|
// UPLOAD FreeAPS Settings WHEN CHANGED
|
|
// UPLOAD FreeAPS Settings WHEN CHANGED
|
|
|
if let uploadedSettings = storage.retrieve(OpenAPS.Nightscout.uploadedSettings, as: FreeAPSSettings.self),
|
|
if let uploadedSettings = storage.retrieve(OpenAPS.Nightscout.uploadedSettings, as: FreeAPSSettings.self),
|
|
|
- uploadedSettings.rawJSON.sorted() == settings.rawJSON.sorted()
|
|
|
|
|
|
|
+ uploadedSettings.rawJSON.sorted() == settings.rawJSON.sorted(), !force
|
|
|
{
|
|
{
|
|
|
NSLog("NightscoutManager Settings, settings unchanged")
|
|
NSLog("NightscoutManager Settings, settings unchanged")
|
|
|
} else { uploadSettings(settings) }
|
|
} else { uploadSettings(settings) }
|
|
|
|
|
|
|
|
if let uploadedProfile = storage.retrieve(OpenAPS.Nightscout.uploadedProfile, as: NightscoutProfileStore.self),
|
|
if let uploadedProfile = storage.retrieve(OpenAPS.Nightscout.uploadedProfile, as: NightscoutProfileStore.self),
|
|
|
- (uploadedProfile.store["default"]?.rawJSON ?? "").sorted() == ps.rawJSON.sorted()
|
|
|
|
|
|
|
+ (uploadedProfile.store["default"]?.rawJSON ?? "").sorted() == ps.rawJSON.sorted(), !force
|
|
|
{
|
|
{
|
|
|
NSLog("NightscoutManager uploadProfile, no profile change")
|
|
NSLog("NightscoutManager uploadProfile, no profile change")
|
|
|
return
|
|
return
|