Skip to content
Closed
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.3.0
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" "master"
github "mddub/G4ShareSpy" == 0.3.2
github "ps2/rileylink_ios" == 1.1.0
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.3.0"
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.3.0"
github "i-schuetz/SwiftCharts" "0.6"
github "mddub/dexcom-share-client-swift" "965eca4d8dc3df5a8a7e16bbd6ed11c6def2f7a4"
github "ps2/rileylink_ios" "v1.1.0"
github "LoopKit/xDripG5" "v0.8.0"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 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.
24 changes: 20 additions & 4 deletions Loop/Models/ServiceAuthentication/ShareService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
import Foundation
import ShareClient

fileprivate let defaultShareServer: String="https://share1.dexcom.com"

// Encapsulates the Dexcom Share client service and its authentication
struct ShareService: ServiceAuthentication {
var credentials: [ServiceCredential]

let title: String = NSLocalizedString("Dexcom Share", comment: "The title of the Dexcom Share service")

init(username: String?, password: String?) {
init(username: String?, password: String?, server: String=defaultShareServer) {
credentials = [
ServiceCredential(
title: NSLocalizedString("Username", comment: "The title of the Dexcom share username credential"),
Expand All @@ -31,12 +32,19 @@ struct ShareService: ServiceAuthentication {
isSecret: true,
keyboardType: .asciiCapable,
value: password
)
),
ServiceCredential(
title: NSLocalizedString("Server (optional)", comment: "The title of the share server URL credential"),
placeholder: NSLocalizedString(defaultShareServer, comment: "The placeholder text for the share server URL credential"),
isSecret: false,
keyboardType: .URL,
value: server
),
]

if let username = username, let password = password {
isAuthorized = true
client = ShareClient(username: username, password: password)
client = ShareClient(username: username, password: password, shareServer: ShareServer.Custom(server))
}
}

Expand All @@ -50,6 +58,14 @@ struct ShareService: ServiceAuthentication {
var password: String? {
return credentials[1].value
}
var server: String{
let url = credentials[2].value
if (url?.isEmpty)! {
return defaultShareServer
}
return url!

}

var isAuthorized: Bool = false

Expand All @@ -59,7 +75,7 @@ struct ShareService: ServiceAuthentication {
return
}

let client = ShareClient(username: username, password: password)
let client = ShareClient(username: username, password: password, shareServer: ShareServer.Custom(server))
client.fetchLast(1) { (error, _) in
completion(true, error)
}
Expand Down