From 664a5f28f7149989f363730fdc46e0b1afb2a357 Mon Sep 17 00:00:00 2001 From: Tudor-Andrei Vrabie Date: Tue, 31 Dec 2019 05:49:30 +0000 Subject: [PATCH] Fix custom share server functionality (#9) --- ShareClient/ShareClient.swift | 11 +++++++++++ ShareClient/ShareService.swift | 17 ----------------- ShareClientUI/ShareService+UI.swift | 4 +++- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/ShareClient/ShareClient.swift b/ShareClient/ShareClient.swift index 70d869c..761209c 100644 --- a/ShareClient/ShareClient.swift +++ b/ShareClient/ShareClient.swift @@ -30,7 +30,18 @@ public enum ShareError: Error { public enum KnownShareServers: String { case US="https://share1.dexcom.com" case NON_US="https://shareous1.dexcom.com" + /* + To enable Loop to use a custom share server: + - remove the comment marker on line 44 and change the value of CUSTOM + - remove the comment markers on lines 34 and 35 in ShareClientUI/ShareService+UI.swift + Note: The URL in CUSTOM must start with 'https://' (NOT 'http://') + + You can find installation instructions for one such custom share server at + https://github.com/dabear/NightscoutShareServer + */ + + // case CUSTOM="https://yourusernameshareserver.herokuapp.com" } // From the Dexcom Share iOS app, via @bewest and @shanselman: diff --git a/ShareClient/ShareService.swift b/ShareClient/ShareService.swift index 9cb7a2c..99d9a50 100644 --- a/ShareClient/ShareService.swift +++ b/ShareClient/ShareService.swift @@ -23,23 +23,6 @@ public class ShareService: ServiceAuthentication { url?.absoluteString ] - /* - 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: LocalizedString(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, shareServer: url.absoluteString) diff --git a/ShareClientUI/ShareService+UI.swift b/ShareClientUI/ShareService+UI.swift index 1fc86e2..f5bfb35 100644 --- a/ShareClientUI/ShareService+UI.swift +++ b/ShareClientUI/ShareService+UI.swift @@ -30,7 +30,9 @@ extension ShareService: ServiceAuthenticationUI { value: KnownShareServers.US.rawValue), (title: LocalizedString("Outside US", comment: "Outside US share server option title"), value: KnownShareServers.NON_US.rawValue) - + // remove the comment markers on lines 34 and 35 to use a custom share server + // ,(title: LocalizedString("Custom", comment: "Custom share server option title"), + // value: KnownShareServers.CUSTOM.rawValue) ] ) ]