xdripswift/xdrip/Constants/ConstantsNightScout.swift

29 lines
1.4 KiB
Swift
Raw Normal View History

2019-09-12 22:53:28 +02:00
enum ConstantsNightScout {
/// - default nightscout url
/// - used in settings, when setting first time nightscout url
static let defaultNightScoutUrl = "https://"
improvements treatments (not finished) - TreatmentNSResponse : changed type of createdAt from String to Date - TreatmentEntryAccessor : functions that use howOld as parameter, changed type from Int to TimeInterval - created constant for maximum days to upload for treatments, default 7 days - increased maximum amount of treatments to show in TreatmentsViewController to 100 days - removed TODO : check that hTTPURLResponse.statusCode is 200 - removed checkIfDisReConnectAfterTimeStampFunction in comments of initializer NightScoutUploadManager (seems not used anymore) - in DexcomShareUploadManager and NightScoutUploadManager : renamed upload to uploadLatestBgReadings to make clear distinction with other upload functions - deleted xdrip/Texts/TextsNFCLibre.swift because it's not used (not related to treatments) - renamed xdrip/Texts/TextsNightScoutTestResult.swift to xdrip/Texts/TextsNightScout.swift - fix in getLatestTreatments, howOld - removed getRequireUploadTreatments from TreatmentEntryAccessor, filter on treatments to upload is done in NightScoutUploader - using a new value in UserDefaults to trigger a NightScout sync. Setting the value to true from anywhere will launch a new sync. - quite some changes in NightScoutUploadManager - TreatmentsViewController does not control the sync, it will just trigger it whenever necessary by setting UserDefaults.standard.nightScoutSyncTreatmentsRequired to true - NightScoutSync is triggered from several places : create a new Treatment, update a Treatment, delete a Treatment, click the sync button - Removed UIAlertController with result from NightScoutSync. It should always succeed. It's like uploading BgReading's. - removed file TextsNightScoutTestResult.swift, seems not used - in TreatmentNSResponse: matchesTreatmentEntry changed : check on date didn't work, not it compares date in milliseconds, that works. - removed/changed some var's , coreDataManager for example which is now Implicitly Unwrapped Optionals, in stead of optional. This is something which could be improved throughout the project - after download form NS : check if existing treatments are updated, and if so update locally - delete treatments at NS : treatments deleted on the app are not permenanetly deleted from coredata, but there's a new attribute "treatmentDeleted" which is set to true. Which means will not be shown in table. It's needed to keep track of deletions at NS
2022-01-16 20:53:34 +01:00
/// maximum number of days to upload
static let maxBgReadingsDaysToUpload = TimeInterval(days: 7)
/// there's al imit of 102400 bytes to upload to NightScout, this corresponds on average to 400 readings. Setting a lower maximum value to avoid to bypass this limit.
static let maxReadingsToUpload = 300
improvements treatments (not finished) - TreatmentNSResponse : changed type of createdAt from String to Date - TreatmentEntryAccessor : functions that use howOld as parameter, changed type from Int to TimeInterval - created constant for maximum days to upload for treatments, default 7 days - increased maximum amount of treatments to show in TreatmentsViewController to 100 days - removed TODO : check that hTTPURLResponse.statusCode is 200 - removed checkIfDisReConnectAfterTimeStampFunction in comments of initializer NightScoutUploadManager (seems not used anymore) - in DexcomShareUploadManager and NightScoutUploadManager : renamed upload to uploadLatestBgReadings to make clear distinction with other upload functions - deleted xdrip/Texts/TextsNFCLibre.swift because it's not used (not related to treatments) - renamed xdrip/Texts/TextsNightScoutTestResult.swift to xdrip/Texts/TextsNightScout.swift - fix in getLatestTreatments, howOld - removed getRequireUploadTreatments from TreatmentEntryAccessor, filter on treatments to upload is done in NightScoutUploader - using a new value in UserDefaults to trigger a NightScout sync. Setting the value to true from anywhere will launch a new sync. - quite some changes in NightScoutUploadManager - TreatmentsViewController does not control the sync, it will just trigger it whenever necessary by setting UserDefaults.standard.nightScoutSyncTreatmentsRequired to true - NightScoutSync is triggered from several places : create a new Treatment, update a Treatment, delete a Treatment, click the sync button - Removed UIAlertController with result from NightScoutSync. It should always succeed. It's like uploading BgReading's. - removed file TextsNightScoutTestResult.swift, seems not used - in TreatmentNSResponse: matchesTreatmentEntry changed : check on date didn't work, not it compares date in milliseconds, that works. - removed/changed some var's , coreDataManager for example which is now Implicitly Unwrapped Optionals, in stead of optional. This is something which could be improved throughout the project - after download form NS : check if existing treatments are updated, and if so update locally - delete treatments at NS : treatments deleted on the app are not permenanetly deleted from coredata, but there's a new attribute "treatmentDeleted" which is set to true. Which means will not be shown in table. It's needed to keep track of deletions at NS
2022-01-16 20:53:34 +01:00
/// if the time between the last and last but one reading is less than minimiumTimeBetweenTwoReadingsInMinutes, then the last reading will not be uploaded - except if there's been a disconnect in between these two readings
static let minimiumTimeBetweenTwoReadingsInMinutes = 4.75
/// maximum amount of treatments to upload to NightScout (inclusive updated treatments and treatments marked as deleted)
static let maxTreatmentsToUpload = 50
/// download treatments from nightscout, how manyhours
static let maxHoursTreatmentsToDownload = 24.0
/// the text used by Nightscout for the "unit" json attribute for BG Checks stored in mg/dl
static let mgDlNightscoutUnitString = "mg/dl"
/// the text used by Nightscout for the "unit" json attribute for BG Checks stored in mmol/l
static let mmolNightscoutUnitString = "mmol"
improvements treatments (not finished) - TreatmentNSResponse : changed type of createdAt from String to Date - TreatmentEntryAccessor : functions that use howOld as parameter, changed type from Int to TimeInterval - created constant for maximum days to upload for treatments, default 7 days - increased maximum amount of treatments to show in TreatmentsViewController to 100 days - removed TODO : check that hTTPURLResponse.statusCode is 200 - removed checkIfDisReConnectAfterTimeStampFunction in comments of initializer NightScoutUploadManager (seems not used anymore) - in DexcomShareUploadManager and NightScoutUploadManager : renamed upload to uploadLatestBgReadings to make clear distinction with other upload functions - deleted xdrip/Texts/TextsNFCLibre.swift because it's not used (not related to treatments) - renamed xdrip/Texts/TextsNightScoutTestResult.swift to xdrip/Texts/TextsNightScout.swift - fix in getLatestTreatments, howOld - removed getRequireUploadTreatments from TreatmentEntryAccessor, filter on treatments to upload is done in NightScoutUploader - using a new value in UserDefaults to trigger a NightScout sync. Setting the value to true from anywhere will launch a new sync. - quite some changes in NightScoutUploadManager - TreatmentsViewController does not control the sync, it will just trigger it whenever necessary by setting UserDefaults.standard.nightScoutSyncTreatmentsRequired to true - NightScoutSync is triggered from several places : create a new Treatment, update a Treatment, delete a Treatment, click the sync button - Removed UIAlertController with result from NightScoutSync. It should always succeed. It's like uploading BgReading's. - removed file TextsNightScoutTestResult.swift, seems not used - in TreatmentNSResponse: matchesTreatmentEntry changed : check on date didn't work, not it compares date in milliseconds, that works. - removed/changed some var's , coreDataManager for example which is now Implicitly Unwrapped Optionals, in stead of optional. This is something which could be improved throughout the project - after download form NS : check if existing treatments are updated, and if so update locally - delete treatments at NS : treatments deleted on the app are not permenanetly deleted from coredata, but there's a new attribute "treatmentDeleted" which is set to true. Which means will not be shown in table. It's needed to keep track of deletions at NS
2022-01-16 20:53:34 +01:00
2019-09-12 22:53:28 +02:00
}