Skip to content

Commit 1ffbf70

Browse files
EJM0iampickle
authored andcommitted
feat: Add Barcode AI module with scanning and settings functionality
- Implemented BarcodeAiRootView for barcode scanning and product analysis. - Added BarcodeAiSettingsView for managing API keys and AI model selection. - Integrated haptic feedback in HomeRootView for long press actions. - Enhanced TreatmentsRootView to accept initial values for carbs, fat, protein, and notes. - Introduced OpenBarcodeAIIntent for Siri Shortcuts to open the Barcode AI scanner. - Updated routing to include new Barcode AI views and settings. - Added shortcuts for quick access to the Barcode AI scanner.
1 parent 949f146 commit 1ffbf70

File tree

19 files changed

+2458
-11
lines changed

19 files changed

+2458
-11
lines changed

Trio.xcodeproj/project.pbxproj

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
/* Begin PBXBuildFile section */
1010
041D1E995A6AE92E9289DC49 /* TreatmentsDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D1A7CA8C10C4403D4BBFA7 /* TreatmentsDataFlow.swift */; };
1111
0437CE46C12535A56504EC19 /* SnoozeRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5822B15939E719628E9FF7C /* SnoozeRootView.swift */; };
12+
0980FB242EE1EC9800502200 /* OpenBarcodeAIIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0980FB232EE1EC9500502200 /* OpenBarcodeAIIntent.swift */; };
13+
0980FB2B2EE1ED2A00502200 /* BarcodeAiStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0980FB2A2EE1ED2A00502200 /* BarcodeAiStateModel.swift */; };
14+
0980FB2C2EE1ED2A00502200 /* BarcodeAiSettingsStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0980FB292EE1ED2A00502200 /* BarcodeAiSettingsStateModel.swift */; };
15+
0980FB2D2EE1ED2A00502200 /* BarcodeAiDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0980FB272EE1ED2A00502200 /* BarcodeAiDataFlow.swift */; };
16+
0980FB2E2EE1ED2A00502200 /* BarcodeAiProvider.swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0980FB282EE1ED2A00502200 /* BarcodeAiProvider.swift.swift */; };
17+
0980FB312EE1ED3200502200 /* BarcodeAiRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0980FB2F2EE1ED3200502200 /* BarcodeAiRootView.swift */; };
18+
0980FB322EE1ED3200502200 /* BarcodeAiSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0980FB302EE1ED3200502200 /* BarcodeAiSettingsView.swift */; };
1219
0D9A5E34A899219C5C4CDFAF /* DataTableStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9455FA2D92E77A6C4AFED8A3 /* DataTableStateModel.swift */; };
1320
0F7A65FBD2CD8D6477ED4539 /* GlucoseNotificationSettingsProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = E625985B47742D498CB1681A /* GlucoseNotificationSettingsProvider.swift */; };
1421
110AEDE32C5193D200615CC9 /* BolusIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 110AEDE02C5193D100615CC9 /* BolusIntent.swift */; };
@@ -839,6 +846,13 @@
839846
/* End PBXCopyFilesBuildPhase section */
840847

841848
/* Begin PBXFileReference section */
849+
0980FB232EE1EC9500502200 /* OpenBarcodeAIIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenBarcodeAIIntent.swift; sourceTree = "<group>"; };
850+
0980FB272EE1ED2A00502200 /* BarcodeAiDataFlow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarcodeAiDataFlow.swift; sourceTree = "<group>"; };
851+
0980FB282EE1ED2A00502200 /* BarcodeAiProvider.swift.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarcodeAiProvider.swift.swift; sourceTree = "<group>"; };
852+
0980FB292EE1ED2A00502200 /* BarcodeAiSettingsStateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarcodeAiSettingsStateModel.swift; sourceTree = "<group>"; };
853+
0980FB2A2EE1ED2A00502200 /* BarcodeAiStateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarcodeAiStateModel.swift; sourceTree = "<group>"; };
854+
0980FB2F2EE1ED3200502200 /* BarcodeAiRootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarcodeAiRootView.swift; sourceTree = "<group>"; };
855+
0980FB302EE1ED3200502200 /* BarcodeAiSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarcodeAiSettingsView.swift; sourceTree = "<group>"; };
842856
110AEDE02C5193D100615CC9 /* BolusIntent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BolusIntent.swift; sourceTree = "<group>"; };
843857
110AEDE12C5193D100615CC9 /* BolusIntentRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BolusIntentRequest.swift; sourceTree = "<group>"; };
844858
110AEDE52C51A0AE00615CC9 /* ShortcutsConfigView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShortcutsConfigView.swift; sourceTree = "<group>"; };
@@ -1660,6 +1674,35 @@
16601674
path = ConfigEditor;
16611675
sourceTree = "<group>";
16621676
};
1677+
0980FB222EE1EC8900502200 /* BarcodeAI */ = {
1678+
isa = PBXGroup;
1679+
children = (
1680+
0980FB232EE1EC9500502200 /* OpenBarcodeAIIntent.swift */,
1681+
);
1682+
path = BarcodeAI;
1683+
sourceTree = "<group>";
1684+
};
1685+
0980FB252EE1ECD800502200 /* BarcodeAI */ = {
1686+
isa = PBXGroup;
1687+
children = (
1688+
0980FB262EE1ECE700502200 /* Views */,
1689+
0980FB272EE1ED2A00502200 /* BarcodeAiDataFlow.swift */,
1690+
0980FB282EE1ED2A00502200 /* BarcodeAiProvider.swift.swift */,
1691+
0980FB292EE1ED2A00502200 /* BarcodeAiSettingsStateModel.swift */,
1692+
0980FB2A2EE1ED2A00502200 /* BarcodeAiStateModel.swift */,
1693+
);
1694+
path = BarcodeAI;
1695+
sourceTree = "<group>";
1696+
};
1697+
0980FB262EE1ECE700502200 /* Views */ = {
1698+
isa = PBXGroup;
1699+
children = (
1700+
0980FB2F2EE1ED3200502200 /* BarcodeAiRootView.swift */,
1701+
0980FB302EE1ED3200502200 /* BarcodeAiSettingsView.swift */,
1702+
);
1703+
path = Views;
1704+
sourceTree = "<group>";
1705+
};
16631706
0A67A70F9438DB6586398458 /* View */ = {
16641707
isa = PBXGroup;
16651708
children = (
@@ -1881,6 +1924,7 @@
18811924
3811DE0325C9D31700A708ED /* Modules */ = {
18821925
isa = PBXGroup;
18831926
children = (
1927+
0980FB252EE1ECD800502200 /* BarcodeAI */,
18841928
DDD163032C4C67B400CD525A /* Adjustments */,
18851929
DD1745382C55BF8B00211FAC /* AlgorithmAdvancedSettings */,
18861930
DDF690FE2DA2C9EE008BF16C /* AppDiagnostics */,
@@ -1903,7 +1947,7 @@
19031947
19E1F7E629D0828B005C8D20 /* IconConfig */,
19041948
D8F047E14D567F2B5DBEFD96 /* ISFEditor */,
19051949
DDF847DB2C5C28550049BB3B /* LiveActivitySettings */,
1906-
3811DE1A25C9D48300A708ED /* Main */,
1950+
3811DE1A25C9D48300A708ED /* tt */,
19071951
5031FE61F63C2A8A8B7674DD /* ManualTempBasal */,
19081952
19D466A129AA2B0A004D5F33 /* MealSettings */,
19091953
D533BF261CDC1C3F871E7BFD /* NightscoutConfig */,
@@ -1964,15 +2008,15 @@
19642008
path = Router;
19652009
sourceTree = "<group>";
19662010
};
1967-
3811DE1A25C9D48300A708ED /* Main */ = {
2011+
3811DE1A25C9D48300A708ED /* tt */ = {
19682012
isa = PBXGroup;
19692013
children = (
19702014
3811DE1D25C9D48300A708ED /* MainDataFlow.swift */,
19712015
3811DE1C25C9D48300A708ED /* MainProvider.swift */,
19722016
38FEF3FB2737E53800574A46 /* MainStateModel.swift */,
19732017
3811DE1F25C9D48300A708ED /* View */,
19742018
);
1975-
path = Main;
2019+
path = tt;
19762020
sourceTree = "<group>";
19772021
};
19782022
3811DE1F25C9D48300A708ED /* View */ = {
@@ -3076,6 +3120,7 @@
30763120
CE7CA3422A064973004BE681 /* Shortcuts */ = {
30773121
isa = PBXGroup;
30783122
children = (
3123+
0980FB222EE1EC8900502200 /* BarcodeAI */,
30793124
DD4C57A42D73ADDA001BFF2C /* LiveActivity */,
30803125
118DF7692C5ECBC60067FEB7 /* Override */,
30813126
110AEDE22C5193D100615CC9 /* Bolus */,
@@ -4516,11 +4561,14 @@
45164561
BD249D9D2D42FCF500412DEB /* MealStatsSetup.swift in Sources */,
45174562
BD6EB2D62C7D049B0086BBB6 /* LiveActivityWidgetConfiguration.swift in Sources */,
45184563
DD32CF982CC82463003686D6 /* TrioRemoteControl+Bolus.swift in Sources */,
4564+
0980FB242EE1EC9800502200 /* OpenBarcodeAIIntent.swift in Sources */,
45194565
F816825E28DB441200054060 /* HeartBeatManager.swift in Sources */,
45204566
58F107742BD1A4D000B1A680 /* Determination+helper.swift in Sources */,
45214567
38FEF413273B317A00574A46 /* HKUnit.swift in Sources */,
45224568
A33352ED40476125EBAC6EE0 /* CarbRatioEditorDataFlow.swift in Sources */,
45234569
17A9D0899046B45E87834820 /* CarbRatioEditorProvider.swift in Sources */,
4570+
0980FB312EE1ED3200502200 /* BarcodeAiRootView.swift in Sources */,
4571+
0980FB322EE1ED3200502200 /* BarcodeAiSettingsView.swift in Sources */,
45244572
69B9A368029F7EB39F525422 /* CarbRatioEditorStateModel.swift in Sources */,
45254573
118DF76B2C5ECBC60067FEB7 /* CancelOverrideIntent.swift in Sources */,
45264574
38E44538274E411700EC9A94 /* Disk+[Data].swift in Sources */,
@@ -4609,6 +4657,10 @@
46094657
DDF691052DA2CA23008BF16C /* AppDiagnosticsStateModel.swift in Sources */,
46104658
38A00B2325FC2B55006BC0B0 /* LRUCache.swift in Sources */,
46114659
DDD163122C4C689900CD525A /* AdjustmentsStateModel.swift in Sources */,
4660+
0980FB2B2EE1ED2A00502200 /* BarcodeAiStateModel.swift in Sources */,
4661+
0980FB2C2EE1ED2A00502200 /* BarcodeAiSettingsStateModel.swift in Sources */,
4662+
0980FB2D2EE1ED2A00502200 /* BarcodeAiDataFlow.swift in Sources */,
4663+
0980FB2E2EE1ED2A00502200 /* BarcodeAiProvider.swift.swift in Sources */,
46124664
BD47FDD72D8B64D20043966B /* CarbRatioStepView.swift in Sources */,
46134665
DD17A0322E3FEA1F008E1BF0 /* RemoteNotificationResponseManager.swift in Sources */,
46144666
3B2F77862D7E52ED005ED9FA /* TDD.swift in Sources */,

Trio/Resources/Info.plist

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
<string>To create events with BG reading values, so that they can be viewed on Apple Watch and CarPlay</string>
7878
<key>NSCalendarsUsageDescription</key>
7979
<string>Calendar is used to create a new glucose events.</string>
80+
<key>NSCameraUsageDescription</key>
81+
<string>Trio uses this for scanning barcodes</string>
8082
<key>NSContactsUsageDescription</key>
8183
<string>Contact is used to create a Apple Watch complication</string>
8284
<key>NSFaceIDUsageDescription</key>
@@ -107,8 +109,8 @@
107109
<string>remote-notification</string>
108110
<string>audio</string>
109111
</array>
110-
<key>UIDesignRequiresCompatibility</key>
111-
<true/>
112+
<key>UIDesignRequiresCompatibility</key>
113+
<true/>
112114
<key>UIFileSharingEnabled</key>
113115
<true/>
114116
<key>UILaunchScreen</key>

Trio/Resources/InfoPlist.xcstrings

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,18 @@
601601
}
602602
}
603603
},
604+
"NSCameraUsageDescription" : {
605+
"comment" : "Privacy - Camera Usage Description",
606+
"extractionState" : "extracted_with_value",
607+
"localizations" : {
608+
"en" : {
609+
"stringUnit" : {
610+
"state" : "new",
611+
"value" : "Trio uses this for scanning barcodes"
612+
}
613+
}
614+
}
615+
},
604616
"NSContactsUsageDescription" : {
605617
"comment" : "Privacy - Contacts Usage Description",
606618
"localizations" : {

Trio/Sources/Application/TrioApp.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ extension Notification.Name {
88
static let initializationCompleted = Notification.Name("initializationCompleted")
99
static let initializationError = Notification.Name("initializationError")
1010
static let onboardingCompleted = Notification.Name("onboardingCompleted")
11+
static let openBarcodeAI = Notification.Name("openBarcodeAI")
1112
}
1213

1314
@main struct TrioApp: App {

0 commit comments

Comments
 (0)