Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding the "contact trick" #505

Merged
merged 6 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,5 @@ xdripswift.wiki/

# file to edit commit message
commit.txt

*.bak
24 changes: 24 additions & 0 deletions xdrip.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@
D4E499AB277B43E3000F8CBA /* TreatmentCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4E499AA277B43E3000F8CBA /* TreatmentCollection.swift */; };
D4E499AD277B4CE7000F8CBA /* DateOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4E499AC277B4CE7000F8CBA /* DateOnly.swift */; };
D4FD899727772F9100689788 /* TreatmentEntryAccessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4FD899627772F9100689788 /* TreatmentEntryAccessor.swift */; };
F227BF192B9DF76D00CEEAAD /* SettingsViewContactTrickSettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F227BF182B9DF76D00CEEAAD /* SettingsViewContactTrickSettingsViewModel.swift */; };
F227BF1C2B9E426B00CEEAAD /* ContactTrickManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F227BF1B2B9E426B00CEEAAD /* ContactTrickManager.swift */; };
F227BF1E2B9E536400CEEAAD /* NumberImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F227BF1D2B9E536400CEEAAD /* NumberImageView.swift */; };
F2F31E5A2B9F287000F4FF4C /* FontWeightType.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2F31E592B9F287000F4FF4C /* FontWeightType.swift */; };
F51B9F7D24B216CD00FC0643 /* Libre1NonFixedSlopeCalibrator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F51B9F7C24B216CD00FC0643 /* Libre1NonFixedSlopeCalibrator.swift */; };
F64039B0281C3F9D0051EFFE /* QuickActionsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F64039AF281C3F9D0051EFFE /* QuickActionsManager.swift */; };
F64039B2281E90CF0051EFFE /* QuickActions.strings in Resources */ = {isa = PBXBuildFile; fileRef = F64039B1281E90CF0051EFFE /* QuickActions.strings */; };
Expand Down Expand Up @@ -984,6 +988,10 @@
D4E499AA277B43E3000F8CBA /* TreatmentCollection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TreatmentCollection.swift; sourceTree = "<group>"; };
D4E499AC277B4CE7000F8CBA /* DateOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateOnly.swift; sourceTree = "<group>"; };
D4FD899627772F9100689788 /* TreatmentEntryAccessor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TreatmentEntryAccessor.swift; sourceTree = "<group>"; };
F227BF182B9DF76D00CEEAAD /* SettingsViewContactTrickSettingsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewContactTrickSettingsViewModel.swift; sourceTree = "<group>"; };
F227BF1B2B9E426B00CEEAAD /* ContactTrickManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactTrickManager.swift; sourceTree = "<group>"; };
F227BF1D2B9E536400CEEAAD /* NumberImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberImageView.swift; sourceTree = "<group>"; };
F2F31E592B9F287000F4FF4C /* FontWeightType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontWeightType.swift; sourceTree = "<group>"; };
F51B9F7C24B216CD00FC0643 /* Libre1NonFixedSlopeCalibrator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Libre1NonFixedSlopeCalibrator.swift; sourceTree = "<group>"; };
F64039AF281C3F9D0051EFFE /* QuickActionsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickActionsManager.swift; sourceTree = "<group>"; };
F64039B1281E90CF0051EFFE /* QuickActions.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = QuickActions.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2033,6 +2041,14 @@
path = Treatments;
sourceTree = "<group>";
};
F227BF1A2B9E425800CEEAAD /* ContactTrick */ = {
isa = PBXGroup;
children = (
F227BF1B2B9E426B00CEEAAD /* ContactTrickManager.swift */,
);
path = ContactTrick;
sourceTree = "<group>";
};
F64039AE281C3F8D0051EFFE /* QuickActions */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2418,6 +2434,7 @@
F85DC2F621D25E3A00B9F74A /* Managers */ = {
isa = PBXGroup;
children = (
F227BF1A2B9E425800CEEAAD /* ContactTrick */,
F821CF48229BF43A005C1E43 /* Alerts */,
F821CF54229BF43A005C1E43 /* Application */,
F8297F42238DC4AC00D74D66 /* BluetoothPeripheral */,
Expand Down Expand Up @@ -2882,6 +2899,7 @@
4752B4052635878E0081D551 /* SettingsViewStatisticsSettingsViewModel.swift */,
F8E51D6824549E2C001C9E5A /* SettingsViewTraceSettingsViewModel.swift */,
47150A3F27F6211C00DB2994 /* SettingsViewTreatmentsSettingsViewModel.swift */,
F227BF182B9DF76D00CEEAAD /* SettingsViewContactTrickSettingsViewModel.swift */,
);
path = SettingsViewModels;
sourceTree = "<group>";
Expand Down Expand Up @@ -3088,6 +3106,7 @@
F8A1586E22EDC7EE007F5B5D /* ConstantsSuspensionPrevention.swift */,
F8AF36142455C6F700B5977B /* ConstantsTrace.swift */,
F8FDFEAC260DE1B90047597D /* ConstantsUI.swift */,
F2F31E592B9F287000F4FF4C /* FontWeightType.swift */,
47930E812BC5A001000BD8A1 /* ConstantsWidget.swift */,
);
name = Constants;
Expand All @@ -3108,6 +3127,7 @@
F821CF69229FC22D005C1E43 /* Network */,
F8F7B8E9259A7A9400C47B04 /* SavitzkyGolayFilter */,
F8B3A7DD226E48C1004BA588 /* SoundPlayer */,
F227BF1D2B9E536400CEEAAD /* NumberImageView.swift */,
);
path = Utilities;
sourceTree = "<group>";
Expand Down Expand Up @@ -4083,6 +4103,7 @@
F8B3A81B227DEC92004BA588 /* SensorsAccessor.swift in Sources */,
F8F9721E23A5915900C3F17D /* LibreSensorState.swift in Sources */,
F8B3A85D22821BB6004BA588 /* Int.swift in Sources */,
F2F31E5A2B9F287000F4FF4C /* FontWeightType.swift in Sources */,
F808D2CE2403292C0084B5DB /* Bubble+CoreDataProperties.swift in Sources */,
F8A2BC1A25DB0C28001D1E78 /* CGMAtomTransmitterDelegate.swift in Sources */,
F8F71D862B7EC1AD005076E8 /* DexcomG7+BluetoothPeripheral.swift in Sources */,
Expand Down Expand Up @@ -4147,6 +4168,7 @@
F8F9721A23A5915900C3F17D /* CGMBubbleTransmitter.swift in Sources */,
4752B400263570DA0081D551 /* ConstantsStatistics.swift in Sources */,
47A6ABFF2B795DA30047A4BA /* GlucoseChartType.swift in Sources */,
F227BF192B9DF76D00CEEAAD /* SettingsViewContactTrickSettingsViewModel.swift in Sources */,
F8A2BC3B25DB0D6D001D1E78 /* BluetoothPeripheralManager+CGMBubbleTransmitterDelegate.swift in Sources */,
F8A2BC3A25DB0D6D001D1E78 /* BluetoothPeripheralManager+CGMGNSEntryTransmitterDelegate.swift in Sources */,
F8EA6CA921BBE3010082976B /* UniqueId.swift in Sources */,
Expand Down Expand Up @@ -4314,6 +4336,7 @@
F80ED2ED236F68F90005C035 /* SettingsViewM5StackGeneralSettingsViewModel.swift in Sources */,
F816E10A2437E7B8009EE65B /* CGMBlueReaderTransmitterDelegate.swift in Sources */,
47D08D5B2B5437F500B0BEA7 /* ConstantsGlucoseChartSwiftUI.swift in Sources */,
F227BF1E2B9E536400CEEAAD /* NumberImageView.swift in Sources */,
F8B3A850227F26F8004BA588 /* AlertTypesSettingsViewController.swift in Sources */,
D484BC292774F783008490E9 /* TreatmentsInsertViewController.swift in Sources */,
F816E0FE24367338009EE65B /* GNSEntry+BluetoothPeripheral.swift in Sources */,
Expand Down Expand Up @@ -4466,6 +4489,7 @@
F8A1584F22ECB281007F5B5D /* SettingsViewInfoViewModel.swift in Sources */,
F8B3A845227F090E004BA588 /* SettingsViewDexcomSettingsViewModel.swift in Sources */,
F8F9720C23A5915900C3F17D /* SensorDataTxMessage.swift in Sources */,
F227BF1C2B9E426B00CEEAAD /* ContactTrickManager.swift in Sources */,
F8DF766223E390D100063910 /* BLEPeripheral+CoreDataProperties.swift in Sources */,
F8A1585F22EDB81E007F5B5D /* ConstantsLog.swift in Sources */,
F8284230274ED56A0097E0C9 /* DexcomCalibrationParameters.swift in Sources */,
Expand Down
26 changes: 16 additions & 10 deletions xdrip/Constants/ConstantsLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ enum ConstantsLog {

/// debuglogging
static let debuglogging = "xdripdebuglogging"

/// timestamp format for nslog
static let dateFormatNSLog = "y-MM-dd HH:mm:ss.SSSS"

// MARK: - Categories

/// for use in OSLog
static let categoryBlueToothTransmitter = "BlueToothTransmitter "

Expand All @@ -32,7 +32,7 @@ enum ConstantsLog {

/// calibration
static let categoryCalibration = "Calibration "

/// G5
static let categoryCGMG5 = "CGMG5 "

Expand Down Expand Up @@ -79,7 +79,7 @@ enum ConstantsLog {
static let categoryApplicationDataWatlaa = "ApplicationDataWatlaa"

/// application data for BLEPeripheral
static let categoryApplicationDataBLEPeripheral =
static let categoryApplicationDataBLEPeripheral =
"ApplicationDataBLEPeripheral"

/// application data for DexcomG5
Expand Down Expand Up @@ -141,10 +141,16 @@ enum ConstantsLog {

/// CalendarManager logging
static let categoryCalendarManager = "CalendarManager "


/// SettingsViewContactTrickSettingsViewModel logging
static let categorySettingsViewContactTrickSettingsViewModel = "SettingsViewContactTrickSettingsViewModel "

/// WatchManager logging
static let categoryWatchManager = "WatchManager "

static let categoryWatchManager = "WatchManager "

/// ContactTrickManager logging
static let categoryContactTrickManager = "ContactTrickManager "

/// bluetoothPeripheralViewController
static let categoryBluetoothPeripheralViewController = "blePeripheralViewController "

Expand Down Expand Up @@ -185,9 +191,9 @@ enum ConstantsLog {
static let categorySettingsViewDataSourceSettingsViewModel = "SettingsViewDataSourceSettingsViewModel"

/// SettingsViewNotificationsSettingsViewModel logging
static let categorySettingsViewNotificationsSettingsViewModel =
static let categorySettingsViewNotificationsSettingsViewModel =
"NotificationsViewModel "

/// for use in LiveActivityManager
static let categoryLiveActivityManager = "LiveActivityManager "

Expand Down
51 changes: 51 additions & 0 deletions xdrip/Extensions/UserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,17 @@ extension UserDefaults {
/// should a visual coloured indicator be shown in the calendar title yes or no
case displayVisualIndicatorInCalendarEvent = "displayVisualIndicator"

// Contact trick

/// enable contact trick yes or no
case enableContactTrick = "enableContactTrick"
/// the ID of the contact to be used by the contact trick
case contactTrickContactId = "contactTrickContactId"
/// should trend be displayed yes or no
case displayTrendInContactTrick = "displayTrendInContactTrick"
/// should the range indicator be displayed, yes or no
case rangeIndicatorInContactTrick = "rangeIndicatorInContactTrick"

// Other Settings (not user configurable)

/// - in case missed reading alert settings are changed by user, this value will be set to true
Expand Down Expand Up @@ -1731,7 +1741,48 @@ extension UserDefaults {
}
}

// MARK: - Contact trick

/// enable the contact trick yes or no, default false
@objc dynamic var enableContactTrick: Bool {
get {
return bool(forKey: Key.enableContactTrick.rawValue)
}
set {
set(newValue, forKey: Key.enableContactTrick.rawValue)
}
}

/// the ID of the contact to be updated by the contact trick
@objc dynamic var contactTrickContactId: String? {
get {
return string(forKey: Key.contactTrickContactId.rawValue)
}
set {
set(newValue, forKey: Key.contactTrickContactId.rawValue)
}
}

/// this is for showing readings on watch via the contact trick. Should trend be displayed in the contact, yes or no, default no
@objc dynamic var displayTrendInContactTrick: Bool {
get {
return bool(forKey: Key.displayTrendInContactTrick.rawValue)
}
set {
set(newValue, forKey: Key.displayTrendInContactTrick.rawValue)
}
}

/// this is for showing readings on watch via the contact trick. Should the range indicator be displayed, yes or no
@objc dynamic var rangeIndicatorInContactTrick: Bool {
get {
return bool(forKey: Key.rangeIndicatorInContactTrick.rawValue)
}
set {
set(newValue, forKey: Key.rangeIndicatorInContactTrick.rawValue)
}
}

// MARK: - ===== Other Settings ======

/// - in case missed reading alert settings are changed by user, this value will be set to true
Expand Down
Loading