From 287dcb97a19da001770774e53661b7ec1fc85523 Mon Sep 17 00:00:00 2001 From: Johan Degraeve Date: Tue, 3 May 2022 22:55:59 +0200 Subject: [PATCH 1/2] Follower should be able to download treatments, even if token or api-secret is not set - this was changed previous commit while fixing a crash issue, but change was not necessary --- xdrip/Managers/NightScout/NightScoutUploadManager.swift | 5 ----- 1 file changed, 5 deletions(-) diff --git a/xdrip/Managers/NightScout/NightScoutUploadManager.swift b/xdrip/Managers/NightScout/NightScoutUploadManager.swift index 97f2b487..8675dffe 100644 --- a/xdrip/Managers/NightScout/NightScoutUploadManager.swift +++ b/xdrip/Managers/NightScout/NightScoutUploadManager.swift @@ -163,11 +163,6 @@ public class NightScoutUploadManager: NSObject { // and nightScoutUrl exists guard UserDefaults.standard.nightScoutEnabled, UserDefaults.standard.nightScoutUrl != nil else {return} - // check that either the API_SECRET or Token exists, if both are nil then return - if UserDefaults.standard.nightScoutAPIKey == nil && UserDefaults.standard.nightscoutToken == nil { - return - } - // if sync already running, then set nightScoutTreatmentSyncRequired to true // sync is running already, once stopped it will rerun if let nightScoutTreatmentsSyncStartTimeStamp = nightScoutTreatmentsSyncStartTimeStamp { From 9cbbe3522117e49f15c5b3e84ed445fffeb127f7 Mon Sep 17 00:00:00 2001 From: Johan Degraeve Date: Wed, 4 May 2022 16:53:33 +0200 Subject: [PATCH 2/2] Fix for deletion of treatments at NS Bug was introduced by a previous commit --- xdrip/Managers/NightScout/NightScoutUploadManager.swift | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/xdrip/Managers/NightScout/NightScoutUploadManager.swift b/xdrip/Managers/NightScout/NightScoutUploadManager.swift index 8675dffe..73c8a97b 100644 --- a/xdrip/Managers/NightScout/NightScoutUploadManager.swift +++ b/xdrip/Managers/NightScout/NightScoutUploadManager.swift @@ -700,13 +700,7 @@ public class NightScoutUploadManager: NSObject { // there's no other treatmentEntries with the same id, so it's ok to delete it - // first check if it's uploaded, otherwise it makes no sense to delete it at NightScout - guard treatmentToDelete.uploaded else { - completionHandler(.success(0)) - return - } - - // now check that id exists, it should otherwise it's not uploaded, anyway let's check + // check that id exists, if not then it's never been uploaded, and so makes no sense to delete guard treatmentToDelete.id != TreatmentEntry.EmptyId && treatmentToDelete.id.count > 0 else { completionHandler(.success(0)) return