diff --git a/Cartfile b/Cartfile index 0fc3c9017a..790c8b29dc 100644 --- a/Cartfile +++ b/Cartfile @@ -1,7 +1,7 @@ github "LoopKit/LoopKit" == 1.4.1 github "LoopKit/xDripG5" ~> 0.8.0 github "i-schuetz/SwiftCharts" ~> 0.6.0 -github "mddub/dexcom-share-client-swift" == 0.2.1 +github "mddub/dexcom-share-client-swift" == 0.4.0 github "mddub/G4ShareSpy" == 0.3.2 github "ps2/rileylink_ios" == 1.1.1 github "amplitude/Amplitude-iOS" ~> 3.8.5 diff --git a/Cartfile.resolved b/Cartfile.resolved index b91b00d65c..461572d6c3 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,7 +1,7 @@ -github "LoopKit/LoopKit" "v1.4.1" -github "LoopKit/xDripG5" "v0.8.0" github "amplitude/Amplitude-iOS" "v3.14.1" -github "i-schuetz/SwiftCharts" "0.6" github "mddub/G4ShareSpy" "v0.3.2" -github "mddub/dexcom-share-client-swift" "v0.2.1" +github "LoopKit/LoopKit" "v1.4.1" +github "i-schuetz/SwiftCharts" "0.6" +github "mddub/dexcom-share-client-swift" "v0.4.0" github "ps2/rileylink_ios" "v1.1.1" +github "LoopKit/xDripG5" "v0.8.0" diff --git a/Carthage/Build/iOS/ShareClient.framework/Info.plist b/Carthage/Build/iOS/ShareClient.framework/Info.plist index c6b4807fa1..f459dfabc3 100644 Binary files a/Carthage/Build/iOS/ShareClient.framework/Info.plist and b/Carthage/Build/iOS/ShareClient.framework/Info.plist differ diff --git a/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/arm.swiftmodule b/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/arm.swiftmodule index dcf5c2f443..ab53ec4591 100644 Binary files a/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/arm.swiftmodule and b/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/arm.swiftmodule differ diff --git a/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/arm64.swiftmodule b/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/arm64.swiftmodule index 1898d96303..9130d373c6 100644 Binary files a/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/arm64.swiftmodule and b/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/arm64.swiftmodule differ diff --git a/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/i386.swiftmodule b/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/i386.swiftmodule index 2f62da22d5..f5d9c53d9d 100644 Binary files a/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/i386.swiftmodule and b/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/i386.swiftmodule differ diff --git a/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/x86_64.swiftmodule b/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/x86_64.swiftmodule index d8103bfe7f..4b6ce58d99 100644 Binary files a/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/iOS/ShareClient.framework/Modules/ShareClient.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/iOS/ShareClient.framework/ShareClient b/Carthage/Build/iOS/ShareClient.framework/ShareClient index 7d39583a37..bf559707ee 100755 Binary files a/Carthage/Build/iOS/ShareClient.framework/ShareClient and b/Carthage/Build/iOS/ShareClient.framework/ShareClient differ diff --git a/Loop/Models/ServiceAuthentication/ShareService.swift b/Loop/Models/ServiceAuthentication/ShareService.swift index 90a37000da..22bd3f78b1 100644 --- a/Loop/Models/ServiceAuthentication/ShareService.swift +++ b/Loop/Models/ServiceAuthentication/ShareService.swift @@ -36,14 +36,35 @@ class ShareService: ServiceAuthentication { value: url?.absoluteString, options: [ (title: NSLocalizedString("US", comment: "U.S. share server option title"), - value: DexcomShareURL.absoluteString) + value: KnownShareServers.US.rawValue), + (title: NSLocalizedString("Outside US", comment: "Outside US share server option title"), + value: KnownShareServers.NON_US.rawValue) + ] ) ] - if let username = username, let password = password, url != nil { + /* + To enable Loop to use a custom share server, change the value of customServer + and remove the comment markers on line 55 and 62. + + You can find installation instructions for one such custom share server at + https://github.com/dabear/NightscoutShareServer + */ + + /* + let customServer = "https://REPLACEME" + let customServerTitle = "Custom" + + credentials[2].options?.append( + (title: NSLocalizedString(customServerTitle, comment: "Custom share server option title"), + value: customServer)) + */ + + + if let username = username, let password = password, let url = url { isAuthorized = true - client = ShareClient(username: username, password: password) + client = ShareClient(username: username, password: password, shareServer: url.absoluteString) } } @@ -69,14 +90,15 @@ class ShareService: ServiceAuthentication { var isAuthorized: Bool = false func verify(_ completion: @escaping (_ success: Bool, _ error: Error?) -> Void) { - guard let username = username, let password = password, url != nil else { + guard let username = username, let password = password, let url = url else { completion(false, nil) return } - let client = ShareClient(username: username, password: password) + let client = ShareClient(username: username, password: password, shareServer: url.absoluteString) client.fetchLast(1) { (error, _) in completion(true, error) + } self.client = client } @@ -91,7 +113,7 @@ class ShareService: ServiceAuthentication { } -private let DexcomShareURL = URL(string: "https://share1.dexcom.com")! +private let DexcomShareURL = URL(string: KnownShareServers.US.rawValue)! private let DexcomShareServiceLabel = "DexcomShare1"