Skip to content

Commit ffa64b2

Browse files
authored
Merge pull request #34 from tidepool-org/ps2/LOOP-4116/diy-sync
LOOP-4116 DIY Sync
2 parents 9086a3a + 0143495 commit ffa64b2

File tree

19 files changed

+83
-68
lines changed

19 files changed

+83
-68
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: objective-c
2-
osx_image: xcode11.6
2+
osx_image: xcode12.2
33

44
before_script:
5-
- carthage bootstrap
5+
- ./Scripts/carthage.sh bootstrap
66

77
script:
88
# Build Travis project and run tests

Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "LoopKit/LoopKit" "merge-from-tidepool"
1+
github "LoopKit/LoopKit" "dev"

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
github "LoopKit/LoopKit" "564d8554d43f65034d341e0edf0ffd5bec7223eb"
1+
github "LoopKit/LoopKit" "7cc4d031b8d49837f82af91538a397a3e8dea02d"
22
github "i-schuetz/SwiftCharts" "0.6.5"

Scripts/carthage.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This script exists due to an issue with Carthage. The script comes from https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323
4+
5+
# carthage.sh
6+
# Usage example: ./carthage.sh build --platform iOS
7+
8+
set -euo pipefail
9+
10+
xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
11+
trap 'rm -f "$xcconfig"' INT TERM HUP EXIT
12+
13+
# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
14+
# the build will fail on lipo due to duplicate architectures.
15+
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
16+
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig
17+
18+
export XCODE_XCCONFIG_FILE="$xcconfig"
19+
carthage "$@"

ShareClient.xcodeproj/project.pbxproj

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@
141141
B40BF26423ABD4E600A43CEE /* ShareClientPlugin-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ShareClientPlugin-Bridging-Header.h"; sourceTree = "<group>"; };
142142
B40BF26523ABD4E700A43CEE /* ShareClientPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareClientPlugin.swift; sourceTree = "<group>"; };
143143
B40BF26723ABD55200A43CEE /* OSLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSLog.swift; sourceTree = "<group>"; };
144+
F5D9C04227DAC15A002E48F6 /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Localizable.strings; sourceTree = "<group>"; };
145+
F5D9C04327DAC15A002E48F6 /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Localizable.strings; sourceTree = "<group>"; };
146+
F5E0BE3027E1E05E0033557E /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/Localizable.strings; sourceTree = "<group>"; };
147+
F5E0BE3127E1E05F0033557E /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/Localizable.strings; sourceTree = "<group>"; };
144148
/* End PBXFileReference section */
145149

146150
/* Begin PBXFrameworksBuildPhase section */
@@ -417,7 +421,7 @@
417421
isa = PBXProject;
418422
attributes = {
419423
LastSwiftUpdateCheck = 0730;
420-
LastUpgradeCheck = 1020;
424+
LastUpgradeCheck = 1330;
421425
ORGANIZATIONNAME = "Mark Wilson";
422426
TargetAttributes = {
423427
432B0E871CDFC3C50045347B = {
@@ -445,7 +449,6 @@
445449
developmentRegion = en;
446450
hasScannedForEncodings = 0;
447451
knownRegions = (
448-
English,
449452
en,
450453
Base,
451454
fr,
@@ -464,6 +467,8 @@
464467
ro,
465468
fi,
466469
da,
470+
tr,
471+
he,
467472
);
468473
mainGroup = 432B0E7E1CDFC3C50045347B;
469474
productRefGroup = 432B0E891CDFC3C50045347B /* Products */;
@@ -645,6 +650,8 @@
645650
7D9BF12C2336FFA2005DCFD6 /* ro */,
646651
7D9BF12E2336FFA9005DCFD6 /* fi */,
647652
7D9BF1302336FFAF005DCFD6 /* da */,
653+
F5D9C04327DAC15A002E48F6 /* tr */,
654+
F5E0BE3127E1E05F0033557E /* he */,
648655
);
649656
name = Localizable.strings;
650657
sourceTree = "<group>";
@@ -669,6 +676,8 @@
669676
7D9BF12B2336FFA2005DCFD6 /* ro */,
670677
7D9BF12D2336FFA9005DCFD6 /* fi */,
671678
7D9BF12F2336FFAF005DCFD6 /* da */,
679+
F5D9C04227DAC15A002E48F6 /* tr */,
680+
F5E0BE3027E1E05E0033557E /* he */,
672681
);
673682
name = Localizable.strings;
674683
sourceTree = "<group>";
@@ -700,6 +709,7 @@
700709
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
701710
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
702711
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
712+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
703713
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
704714
CLANG_WARN_STRICT_PROTOTYPES = YES;
705715
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -767,6 +777,7 @@
767777
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
768778
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
769779
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
780+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
770781
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
771782
CLANG_WARN_STRICT_PROTOTYPES = YES;
772783
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -814,10 +825,7 @@
814825
DYLIB_COMPATIBILITY_VERSION = 1;
815826
DYLIB_CURRENT_VERSION = 2;
816827
DYLIB_INSTALL_NAME_BASE = "@rpath";
817-
FRAMEWORK_SEARCH_PATHS = (
818-
"$(inherited)",
819-
"$(PROJECT_DIR)/Carthage/Build/iOS",
820-
);
828+
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
821829
INFOPLIST_FILE = ShareClient/Info.plist;
822830
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
823831
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -838,10 +846,7 @@
838846
DYLIB_COMPATIBILITY_VERSION = 1;
839847
DYLIB_CURRENT_VERSION = 2;
840848
DYLIB_INSTALL_NAME_BASE = "@rpath";
841-
FRAMEWORK_SEARCH_PATHS = (
842-
"$(inherited)",
843-
"$(PROJECT_DIR)/Carthage/Build/iOS",
844-
);
849+
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
845850
INFOPLIST_FILE = ShareClient/Info.plist;
846851
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
847852
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -854,10 +859,7 @@
854859
432B0EA01CDFC3C50045347B /* Debug */ = {
855860
isa = XCBuildConfiguration;
856861
buildSettings = {
857-
FRAMEWORK_SEARCH_PATHS = (
858-
"$(inherited)",
859-
"$(PROJECT_DIR)/Carthage/Build/iOS",
860-
);
862+
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
861863
INFOPLIST_FILE = ShareClientTests/Info.plist;
862864
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
863865
PRODUCT_BUNDLE_IDENTIFIER = com.mddub.ShareClientTests;
@@ -868,10 +870,7 @@
868870
432B0EA11CDFC3C50045347B /* Release */ = {
869871
isa = XCBuildConfiguration;
870872
buildSettings = {
871-
FRAMEWORK_SEARCH_PATHS = (
872-
"$(inherited)",
873-
"$(PROJECT_DIR)/Carthage/Build/iOS",
874-
);
873+
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
875874
INFOPLIST_FILE = ShareClientTests/Info.plist;
876875
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
877876
PRODUCT_BUNDLE_IDENTIFIER = com.mddub.ShareClientTests;
@@ -896,10 +895,7 @@
896895
DYLIB_COMPATIBILITY_VERSION = 1;
897896
DYLIB_CURRENT_VERSION = 2;
898897
DYLIB_INSTALL_NAME_BASE = "@rpath";
899-
FRAMEWORK_SEARCH_PATHS = (
900-
"$(inherited)",
901-
"$(PROJECT_DIR)/Carthage/Build/iOS",
902-
);
898+
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
903899
GCC_C_LANGUAGE_STANDARD = gnu11;
904900
INFOPLIST_FILE = ShareClientUI/Info.plist;
905901
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -929,10 +925,7 @@
929925
DYLIB_COMPATIBILITY_VERSION = 1;
930926
DYLIB_CURRENT_VERSION = 2;
931927
DYLIB_INSTALL_NAME_BASE = "@rpath";
932-
FRAMEWORK_SEARCH_PATHS = (
933-
"$(inherited)",
934-
"$(PROJECT_DIR)/Carthage/Build/iOS",
935-
);
928+
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
936929
GCC_C_LANGUAGE_STANDARD = gnu11;
937930
INFOPLIST_FILE = ShareClientUI/Info.plist;
938931
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -955,10 +948,7 @@
955948
DYLIB_COMPATIBILITY_VERSION = 1;
956949
DYLIB_CURRENT_VERSION = 2;
957950
DYLIB_INSTALL_NAME_BASE = "@rpath";
958-
FRAMEWORK_SEARCH_PATHS = (
959-
"$(inherited)",
960-
"$(PROJECT_DIR)/Carthage/Build/watchOS",
961-
);
951+
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
962952
INFOPLIST_FILE = ShareClient/Info.plist;
963953
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
964954
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -984,10 +974,7 @@
984974
DYLIB_COMPATIBILITY_VERSION = 1;
985975
DYLIB_CURRENT_VERSION = 2;
986976
DYLIB_INSTALL_NAME_BASE = "@rpath";
987-
FRAMEWORK_SEARCH_PATHS = (
988-
"$(inherited)",
989-
"$(PROJECT_DIR)/Carthage/Build/watchOS",
990-
);
977+
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
991978
INFOPLIST_FILE = ShareClient/Info.plist;
992979
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
993980
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";

ShareClient.xcodeproj/xcshareddata/xcschemes/Shared-watchOS.xcscheme

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1020"
3+
LastUpgradeVersion = "1330"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -29,8 +29,6 @@
2929
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
3131
</Testables>
32-
<AdditionalOptions>
33-
</AdditionalOptions>
3432
</TestAction>
3533
<LaunchAction
3634
buildConfiguration = "Debug"
@@ -51,8 +49,6 @@
5149
ReferencedContainer = "container:ShareClient.xcodeproj">
5250
</BuildableReference>
5351
</MacroExpansion>
54-
<AdditionalOptions>
55-
</AdditionalOptions>
5652
</LaunchAction>
5753
<ProfileAction
5854
buildConfiguration = "Release"

ShareClient.xcodeproj/xcshareddata/xcschemes/Shared.xcscheme

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1020"
3+
LastUpgradeVersion = "1330"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -41,6 +41,15 @@
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
4343
shouldUseLaunchSchemeArgsEnv = "YES">
44+
<MacroExpansion>
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "432B0E871CDFC3C50045347B"
48+
BuildableName = "ShareClient.framework"
49+
BlueprintName = "ShareClient"
50+
ReferencedContainer = "container:ShareClient.xcodeproj">
51+
</BuildableReference>
52+
</MacroExpansion>
4453
<Testables>
4554
<TestableReference
4655
skipped = "NO">
@@ -53,17 +62,6 @@
5362
</BuildableReference>
5463
</TestableReference>
5564
</Testables>
56-
<MacroExpansion>
57-
<BuildableReference
58-
BuildableIdentifier = "primary"
59-
BlueprintIdentifier = "432B0E871CDFC3C50045347B"
60-
BuildableName = "ShareClient.framework"
61-
BlueprintName = "ShareClient"
62-
ReferencedContainer = "container:ShareClient.xcodeproj">
63-
</BuildableReference>
64-
</MacroExpansion>
65-
<AdditionalOptions>
66-
</AdditionalOptions>
6765
</TestAction>
6866
<LaunchAction
6967
buildConfiguration = "Debug"
@@ -84,8 +82,6 @@
8482
ReferencedContainer = "container:ShareClient.xcodeproj">
8583
</BuildableReference>
8684
</MacroExpansion>
87-
<AdditionalOptions>
88-
</AdditionalOptions>
8985
</LaunchAction>
9086
<ProfileAction
9187
buildConfiguration = "Release"

ShareClient/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>CFBundleExecutable</key>
88
<string>$(EXECUTABLE_NAME)</string>
99
<key>CFBundleIdentifier</key>
10-
<string>$(PRODUCT_BUNDLE_IDENTIFIER)-$(PLATFORM_NAME)</string>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
1111
<key>CFBundleInfoDictionaryVersion</key>
1212
<string>6.0</string>
1313
<key>CFBundleName</key>

ShareClient/ShareClient.swift

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public enum ShareError: Error {
2828

2929

3030
public enum KnownShareServers: String {
31-
case US="https://share1.dexcom.com"
31+
case US="https://share2.dexcom.com"
3232
case NON_US="https://shareous1.dexcom.com"
3333

3434
}
@@ -184,12 +184,25 @@ public class ShareClient {
184184

185185
var transformed: Array<ShareGlucose> = []
186186
for sgv in sgvs {
187-
if let glucose = sgv["Value"] as? Int, let trend = sgv["Trend"] as? Int, let wt = sgv["WT"] as? String {
188-
transformed.append(ShareGlucose(
189-
glucose: UInt16(glucose),
190-
trend: UInt8(trend),
191-
timestamp: try self.parseDate(wt)
192-
))
187+
if let glucose = sgv["Value"] as? Int, let wt = sgv["WT"] as? String {
188+
let trend: Int?
189+
if let trendString = sgv["Trend"] as? String {
190+
// Dec 2021, Dexcom Share modified json encoding of Trend from int to string
191+
let trendmap = ["": 0, "DoubleUp":1, "SingleUp":2, "FortyFiveUp":3, "Flat":4, "FortyFiveDown":5, "SingleDown":6, "DoubleDown": 7, "NotComputable":8, "RateOutOfRange":9]
192+
trend = trendmap[trendString, default: 0]
193+
} else {
194+
trend = sgv["Trend"] as? Int
195+
}
196+
197+
if let trend = trend {
198+
transformed.append(ShareGlucose(
199+
glucose: UInt16(glucose),
200+
trend: UInt8(trend),
201+
timestamp: try self.parseDate(wt)
202+
))
203+
} else {
204+
throw ShareError.dataError(reason: "Failed to decode. SGV record had bad trend: " + response)
205+
}
193206
} else {
194207
throw ShareError.dataError(reason: "Failed to decode an SGV record: " + response)
195208
}

ShareClient/ShareService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public class ShareService: ServiceAuthentication {
8888

8989

9090
private let DexcomShareURL = URL(string: KnownShareServers.US.rawValue)!
91-
private let DexcomShareServiceLabel = "DexcomShare1"
91+
private let DexcomShareServiceLabel = "DexcomShare2"
9292

9393

9494
extension KeychainManager {
-274 Bytes
Binary file not shown.
548 Bytes
Binary file not shown.
-14 Bytes
Binary file not shown.
548 Bytes
Binary file not shown.

ShareClientPlugin/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
<key>com.loopkit.Loop.CGMManagerDisplayName</key>
2626
<string>Dexcom Share</string>
2727
<key>com.loopkit.Loop.CGMManagerIdentifier</key>
28-
<string>ShareClient</string>
28+
<string>DexShareClient</string>
2929
</dict>
3030
</plist>

ShareClientUI/IdentifiableClass.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010

1111

12-
protocol IdentifiableClass: class {
12+
protocol IdentifiableClass: AnyObject {
1313
static var className: String { get }
1414
}
1515

ShareClientUI/ShareService+UI.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import ShareClient
1010

1111

1212
extension ShareService: ServiceAuthenticationUI {
13+
public var credentialFormFieldHelperMessage: String? {
14+
return nil
15+
}
16+
1317
public var credentialFormFields: [ServiceCredential] {
1418
return [
1519
ServiceCredential(
2.01 KB
Binary file not shown.
2.01 KB
Binary file not shown.

0 commit comments

Comments
 (0)