Skip to content
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: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -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"
Binary file modified Carthage/Build/iOS/ShareClient.framework/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Carthage/Build/iOS/ShareClient.framework/ShareClient
Binary file not shown.
34 changes: 28 additions & 6 deletions Loop/Models/ServiceAuthentication/ShareService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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
}
Expand All @@ -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"


Expand Down