error message in case Libre US is used

This commit is contained in:
Johan Degraeve 2020-07-14 20:48:55 +02:00
parent 1fc653d3fb
commit 2d8ac5758d
10 changed files with 97 additions and 4 deletions

View File

@ -92,6 +92,9 @@
F821CF9522ADB0D7005C1E43 /* HealthKitManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F821CF9422ADB0D7005C1E43 /* HealthKitManager.swift */; };
F821CF9722AE589E005C1E43 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F821CF9622AE589E005C1E43 /* HealthKit.framework */; };
F821CF9D22AEF483005C1E43 /* BGReadingSpeaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = F821CF9C22AEF483005C1E43 /* BGReadingSpeaker.swift */; };
F82436FA24BDFA5E00BED341 /* LibreReCalibrator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F82436F924BDFA5E00BED341 /* LibreReCalibrator.swift */; };
F82436FC24BE014000BED341 /* TextsLibreStates.swift in Sources */ = {isa = PBXBuildFile; fileRef = F82436FB24BE014000BED341 /* TextsLibreStates.swift */; };
F82436FE24BE01F700BED341 /* LibreStates.strings in Resources */ = {isa = PBXBuildFile; fileRef = F82436FD24BE01F700BED341 /* LibreStates.strings */; };
F8252867243E50FE0067AF77 /* ConstantsLibre.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8252866243E50FE0067AF77 /* ConstantsLibre.swift */; };
F825286A2443AE190067AF77 /* DexcomG6BluetoothPeripheralViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F82528692443AE190067AF77 /* DexcomG6BluetoothPeripheralViewModel.swift */; };
F825286C2443BEDC0067AF77 /* CGMG6TransmitterDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F825286B2443BEDC0067AF77 /* CGMG6TransmitterDelegate.swift */; };
@ -436,6 +439,9 @@
F821CF9622AE589E005C1E43 /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; };
F821CF9822AE589E005C1E43 /* xdrip.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = xdrip.entitlements; sourceTree = "<group>"; };
F821CF9C22AEF483005C1E43 /* BGReadingSpeaker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BGReadingSpeaker.swift; sourceTree = "<group>"; };
F82436F924BDFA5E00BED341 /* LibreReCalibrator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibreReCalibrator.swift; sourceTree = "<group>"; };
F82436FB24BE014000BED341 /* TextsLibreStates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextsLibreStates.swift; sourceTree = "<group>"; };
F82436FD24BE01F700BED341 /* LibreStates.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = LibreStates.strings; sourceTree = "<group>"; };
F8252866243E50FE0067AF77 /* ConstantsLibre.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstantsLibre.swift; sourceTree = "<group>"; };
F82528692443AE190067AF77 /* DexcomG6BluetoothPeripheralViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DexcomG6BluetoothPeripheralViewModel.swift; sourceTree = "<group>"; };
F825286B2443BEDC0067AF77 /* CGMG6TransmitterDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGMG6TransmitterDelegate.swift; sourceTree = "<group>"; };
@ -1231,6 +1237,7 @@
F8B48A9A22B2FA66009BCC01 /* SpeakReading.strings */,
F830992923C32A98005741DF /* WatlaaView.strings */,
F8AF11FF24B3B62D00AE5BA2 /* LibreErrors.strings */,
F82436FD24BE01F700BED341 /* LibreStates.strings */,
);
path = Storyboards;
sourceTree = "<group>";
@ -1496,6 +1503,7 @@
F869188B23A044340065B607 /* TextsM5StackView.swift */,
F830992723C32A13005741DF /* TextsWatlaaView.swift */,
F8AF11F224B1279500AE5BA2 /* TextsLibreErrors.swift */,
F82436FB24BE014000BED341 /* TextsLibreStates.swift */,
);
path = Texts;
sourceTree = "<group>";
@ -1686,6 +1694,7 @@
F8025E5221EE8CE500ECF0C0 /* Protocol */,
F8A54AAC22D6859200934E7A /* SlopeParameters.swift */,
F51B9F7C24B216CD00FC0643 /* Libre1NonFixedSlopeCalibrator.swift */,
F82436F924BDFA5E00BED341 /* LibreReCalibrator.swift */,
);
path = Calibration;
sourceTree = "<group>";
@ -2108,6 +2117,7 @@
F8B3A7D1226CC0B7004BA588 /* betterwakeup.mp3 in Resources */,
F8B3A81F227DEC92004BA588 /* README.md in Resources */,
F8BDD455221DEF22006EAB84 /* SettingsViews.strings in Resources */,
F82436FE24BE01F700BED341 /* LibreStates.strings in Resources */,
F8B48A9C22B2FA66009BCC01 /* SpeakReading.strings in Resources */,
F8B3A7C7226CC0B7004BA588 /* shortlow3.mp3 in Resources */,
F8B3A7CB226CC0B7004BA588 /* shortlow4.mp3 in Resources */,
@ -2316,6 +2326,7 @@
F816E10E2437EAC9009EE65B /* BlueReader+CoreDataProperties.swift in Sources */,
F8F9722523A5915900C3F17D /* LibreRawGlucoseData.swift in Sources */,
F8B3A830227F085A004BA588 /* SettingsTableViewCell.swift in Sources */,
F82436FC24BE014000BED341 /* TextsLibreStates.swift in Sources */,
F830991C23C2909E005741DF /* Watlaa+CoreDataClass.swift in Sources */,
F808D2CC240328FA0084B5DB /* Bubble+CoreDataClass.swift in Sources */,
F8A1586122EDB844007F5B5D /* ConstantsNotifications.swift in Sources */,
@ -2425,6 +2436,7 @@
F897E25323FC871C0075E0E8 /* BluetoothPeripheralManager+WatlaaBluetoothTransmitterDelegate.swift in Sources */,
F81D6D5222C27F18005EFAE2 /* BgReading+DexcomShare.swift in Sources */,
F8F9723023A5915900C3F17D /* M5StackUtilities.swift in Sources */,
F82436FA24BDFA5E00BED341 /* LibreReCalibrator.swift in Sources */,
F89467F0249FFF5900F18424 /* LibreRawGlucoseOOPGlucose.swift in Sources */,
F8297F52238ECA3200D74D66 /* BluetoothPeripheralViewController.swift in Sources */,
F816E1312439E2DD009EE65B /* DexcomG4BluetoothPeripheralViewModel.swift in Sources */,
@ -2868,7 +2880,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.1.13;
MARKETING_VERSION = 4.1.16;
PRODUCT_BUNDLE_IDENTIFIER = net.johandegraeve.xdripswift;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -2897,7 +2909,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.1.13;
MARKETING_VERSION = 4.1.16;
PRODUCT_BUNDLE_IDENTIFIER = net.johandegraeve.xdripswift;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -171,6 +171,10 @@ class LibreDataParser {
case .libreUS:// not sure if this works for libreUS
// libreUS isn't working yet, create an error and send to delegate
cgmTransmitterDelegate?.errorOccurred(xDripError: LibreOOPWebError.libreUSNotSupported)
// continue anyway, although this will not work
LibreOOPClient.getLibreRawGlucoseOOPOA2Data(libreData: libreData, oopWebSite: oopWebSite) { (libreRawGlucoseOOPA2Data, xDripError) in
if let libreRawGlucoseOOPA2Data = libreRawGlucoseOOPA2Data as? LibreRawGlucoseOOPA2Data {

View File

@ -15,6 +15,9 @@ enum LibreOOPWebError {
/// in case web server returns err
case jsonResponseHasError(msg: String?, errcode: Int?)
/// user tries Libre US which is not suppored
case libreUSNotSupported
}
extension LibreOOPWebError: XdripError {
@ -42,6 +45,9 @@ extension LibreOOPWebError: XdripError {
// for now always return HIGH
// maybe letter we change change to MEDIUM or LOW depending on errcode value
return .HIGH
case .libreUSNotSupported:
return .HIGH
}
@ -75,6 +81,9 @@ extension LibreOOPWebError: XdripError {
return TextsLibreErrors.oOPWebServerError + " code = " + errcodeAsInt.description + ", message = " + message
case .libreUSNotSupported:
return TextsLibreErrors.oOPWebServerError + " " + TextsLibreErrors.libreUSNotSupported
}
}

View File

@ -66,4 +66,23 @@ public enum LibreSensorState {
return "Unknown sensor state"
}
}
var translatedDescription: String {
switch self {
case .notYetStarted:
return TextsLibreStates.notYetStarted
case .starting:
return TextsLibreStates.starting
case .ready:
return TextsLibreStates.ready
case .expired:
return TextsLibreStates.expired
case .shutdown:
return TextsLibreStates.shutdown
case .failure:
return TextsLibreStates.failure
default:
return TextsLibreStates.unknown
}
}
}

View File

@ -0,0 +1,8 @@
"notYetStarted" = "not yet started";
"starting" = "starting";
"ready" = "ready";
"expired" = "expired";
"shutdown" = "shut down";
"failure" = "failed";
"unknown" = "unknown";

View File

@ -1,2 +1,3 @@
"receivedDataIsNil" = "No data received from oop web server";
"oOPWebServerError" = "OOP Web Server error: ";
"libreUSNotSupported" = "Libre US is not supported";

View File

@ -12,4 +12,8 @@ class TextsLibreErrors {
return NSLocalizedString("oOPWebServerError", tableName: filename, bundle: Bundle.main, value: "OOP Web Server error: ", comment: "This is for the notification that is created when there is an error while trying to reach the oop web server. The body text starts with this string, and will be followed by the error message received from iOS")
}()
static let libreUSNotSupported: String = {
return NSLocalizedString("libreUSNotSupported", tableName: filename, bundle: Bundle.main, value: "Libre US is not supported", comment: "This is for the notification that is created when there is an error while trying to reach the oop web server. The body text starts with this string, and will be followed by the text defined here")
}()
}

View File

@ -0,0 +1,36 @@
import Foundation
class TextsLibreStates {
static private let filename = "LibreStates"
static let notYetStarted: String = {
return NSLocalizedString("notYetStarted", tableName: filename, bundle: Bundle.main, value: "not yet started", comment: "Possible Libre Sensor states")
}()
static let starting: String = {
return NSLocalizedString("notYetStarted", tableName: filename, bundle: Bundle.main, value: "starting", comment: "Possible Libre Sensor states")
}()
static let ready: String = {
return NSLocalizedString("notYetStarted", tableName: filename, bundle: Bundle.main, value: "ready", comment: "Possible Libre Sensor states")
}()
static let expired: String = {
return NSLocalizedString("notYetStarted", tableName: filename, bundle: Bundle.main, value: "expired", comment: "Possible Libre Sensor states")
}()
static let shutdown: String = {
return NSLocalizedString("notYetStarted", tableName: filename, bundle: Bundle.main, value: "shut down", comment: "Possible Libre Sensor states")
}()
static let failure: String = {
return NSLocalizedString("notYetStarted", tableName: filename, bundle: Bundle.main, value: "failed", comment: "Possible Libre Sensor states")
}()
static let unknown: String = {
return NSLocalizedString("unknown", tableName: filename, bundle: Bundle.main, value: "unknown", comment: "Possible Libre Sensor states")
}()
}

View File

@ -182,7 +182,7 @@ extension BubbleBluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
cell.textLabel?.text = Texts_Common.sensorStatus
cell.detailTextLabel?.text = bubble.sensorState.description
cell.detailTextLabel?.text = bubble.sensorState.translatedDescription
}

View File

@ -144,7 +144,7 @@ extension MiaoMiaoBluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
cell.textLabel?.text = Texts_Common.sensorStatus
cell.detailTextLabel?.text = miaoMiao.sensorState.description
cell.detailTextLabel?.text = miaoMiao.sensorState.translatedDescription
case .batteryLevel: