Improved UI. Now upload requires pressing upload.
This commit is contained in:
parent
956c23b29d
commit
48f63752a2
|
@ -113,9 +113,6 @@ public class NightScoutUploadManager:NSObject {
|
|||
// upload calibrations
|
||||
uploadCalibrationsToNightScout()
|
||||
|
||||
// upload treatments
|
||||
uploadTreatmentsToNightScout()
|
||||
|
||||
// upload activeSensor if needed
|
||||
if UserDefaults.standard.uploadSensorStartTimeToNS, let activeSensor = sensorsAccessor.fetchActiveSensor() {
|
||||
|
||||
|
@ -358,7 +355,7 @@ public class NightScoutUploadManager:NSObject {
|
|||
|
||||
/// upload treatments to nightscout
|
||||
/// Only checks recents ones
|
||||
public func uploadTreatmentsToNightScout() {
|
||||
public func uploadTreatmentsToNightScout(sucessHandler: (() -> Void)?) {
|
||||
trace("in uploadTreatmentsToNightScout", log: self.oslog, category: ConstantsLog.categoryNightScoutUploadManager, type: .info)
|
||||
|
||||
// get the latest treatments from the last maxDaysToUpload days
|
||||
|
@ -387,6 +384,10 @@ public class NightScoutUploadManager:NSObject {
|
|||
|
||||
self.coreDataManager.saveChanges()
|
||||
}
|
||||
|
||||
if let sucessHandler = sucessHandler {
|
||||
sucessHandler()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -4,3 +4,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -8,3 +8,5 @@
|
|||
"treatments_carbs_with_unit" = "Carbs (g):";
|
||||
"treatments_insulin_with_unit" = "Insulin (U):";
|
||||
"treatments_exercise_with_unit" = "Exercise (min):";
|
||||
"treatments_success" = "Success";
|
||||
"treatments_upload_complete" = "Upload complete.";
|
|
@ -28,4 +28,12 @@ enum Texts_TreatmentsView {
|
|||
return NSLocalizedString("treatments_exercise_with_unit", tableName: filename, bundle: Bundle.main, value: "Exercise (min):", comment: "Exercise with unit.")
|
||||
}()
|
||||
|
||||
static let success:String = {
|
||||
return NSLocalizedString("treatments_success", tableName: filename, bundle: Bundle.main, value: "Success", comment: "Success.")
|
||||
}()
|
||||
|
||||
static let uploadCompleted:String = {
|
||||
return NSLocalizedString("treatments_upload_complete", tableName: filename, bundle: Bundle.main, value: "Upload completed.", comment: "Upload completed.")
|
||||
}()
|
||||
|
||||
}
|
||||
|
|
|
@ -35,10 +35,14 @@ class TreatmentsViewController : UIViewController {
|
|||
}
|
||||
|
||||
@IBAction func uploadButtonTapped(_ sender: UIButton) {
|
||||
nightScoutUploadManager?.uploadTreatmentsToNightScout()
|
||||
let alert = UIAlertController(title: Texts_Common.Ok, message: Texts_Common.Ok, actionHandler: nil)
|
||||
nightScoutUploadManager?.uploadTreatmentsToNightScout(sucessHandler: {
|
||||
// Make sure to run alert in the correct thread.
|
||||
DispatchQueue.main.async {
|
||||
let alert = UIAlertController(title: Texts_TreatmentsView.success, message: Texts_TreatmentsView.uploadCompleted, actionHandler: nil)
|
||||
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue