fixed previous commits that were removed due to errors while rebasing treatments branch to develop branch

help button and fixed related to NS auth were overwritten
This commit is contained in:
Johan Degraeve 2022-03-03 21:20:49 +01:00
parent 2bcc8e040c
commit 201b362cd0
2 changed files with 20 additions and 11 deletions

View File

@ -344,7 +344,7 @@ public class NightScoutUploadManager: NSObject {
if (keyValueObserverTimeKeeper.verifyKey(forKey: keyPathEnum.rawValue, withMinimumDelayMilliSeconds: 200)) {
// if master is set, siteURL exists and either API_SECRET or a token is entered, then test credentials
if UserDefaults.standard.nightScoutUrl != "" && UserDefaults.standard.isMaster && (UserDefaults.standard.nightScoutAPIKey != "" || UserDefaults.standard.nightscoutToken != "") {
if UserDefaults.standard.nightScoutUrl != nil && UserDefaults.standard.isMaster && (UserDefaults.standard.nightScoutAPIKey != nil || UserDefaults.standard.nightscoutToken != nil) {
testNightScoutCredentials({ (success, error) in
DispatchQueue.main.async {
@ -368,7 +368,7 @@ public class NightScoutUploadManager: NSObject {
if (keyValueObserverTimeKeeper.verifyKey(forKey: keyPathEnum.rawValue, withMinimumDelayMilliSeconds: 200)) {
// if master is set, siteURL exists and either API_SECRET or a token is entered, then test credentials
if UserDefaults.standard.nightScoutUrl != "" && UserDefaults.standard.isMaster && (UserDefaults.standard.nightScoutAPIKey != "" || UserDefaults.standard.nightscoutToken != "") {
if UserDefaults.standard.nightScoutUrl != nil && UserDefaults.standard.isMaster && (UserDefaults.standard.nightScoutAPIKey != nil || UserDefaults.standard.nightscoutToken != nil) {
testNightScoutCredentials({ (success, error) in
DispatchQueue.main.async {
@ -407,8 +407,6 @@ public class NightScoutUploadManager: NSObject {
/// upload battery level to nightscout
/// - parameters:
/// - siteURL : nightscout site url
/// - apiKey : nightscout api key
/// - transmitterBatteryInfosensor: setransmitterBatteryInfosensornsor to upload
private func uploadTransmitterBatteryInfoToNightScout(transmitterBatteryInfo: TransmitterBatteryInfo) {
@ -1195,7 +1193,12 @@ public class NightScoutUploadManager: NSObject {
private func testNightScoutCredentials(_ completion: @escaping (_ success: Bool, _ error: Error?) -> Void) {
if let nightSccoutUrl = UserDefaults.standard.nightScoutUrl, let url = URL(string: nightSccoutUrl), var uRLComponents = URLComponents(url: url.appendingPathComponent(nightScoutAuthTestPath), resolvingAgainstBaseURL: false) {
// don't run the test if one of the authentication methods is missing. This can happen because the user has input the URL but hasn't added auth yet.
if UserDefaults.standard.nightScoutAPIKey == nil && UserDefaults.standard.nightscoutToken == nil {
return
}
if let nightscoutURL = UserDefaults.standard.nightScoutUrl, let url = URL(string: nightscoutURL), var uRLComponents = URLComponents(url: url.appendingPathComponent(nightScoutAuthTestPath), resolvingAgainstBaseURL: false) {
if UserDefaults.standard.nightScoutPort != 0 {
uRLComponents.port = UserDefaults.standard.nightScoutPort

View File

@ -295,7 +295,6 @@
<segue destination="NvR-Zh-2Zn" kind="show" identifier="RootViewToSnoozeView" id="VtQ-ZG-btn"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="8MU-0O-ujy"/>
<barButtonItem style="plain" systemItem="flexibleSpace" id="uM8-jT-s3T"/>
<barButtonItem title="Sensor" image="ellipsis.circle" catalog="system" id="ZIM-Wf-bUy">
<connections>
@ -309,12 +308,17 @@
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="SlH-A4-F18"/>
<barButtonItem style="plain" systemItem="flexibleSpace" id="Bnf-FN-LqX"/>
<barButtonItem title="Lock" image="lock" catalog="system" id="wfX-50-2w6">
<connections>
<action selector="screenLockToolbarButtonAction:" destination="9pv-A4-QxB" id="L14-hJ-4a9"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="a6G-aW-JeE"/>
<barButtonItem title="Help" image="questionmark.circle" catalog="system" id="DuN-xR-xYB">
<connections>
<action selector="helpToolbarButtonAction:" destination="9pv-A4-QxB" id="DGg-9c-TqQ"/>
</connections>
</barButtonItem>
</items>
</toolbar>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="C16-NQ-F1Y">
@ -717,6 +721,7 @@
<outlet property="clockView" destination="ETk-QH-u1x" id="XuQ-dY-93L"/>
<outlet property="cvTitleLabelOutlet" destination="PZI-Ln-kfh" id="IKV-zy-dNM"/>
<outlet property="diffLabelOutlet" destination="7Wo-wd-80o" id="nnn-w9-1sX"/>
<outlet property="helpToolbarButtonOutlet" destination="DuN-xR-xYB" id="TdW-5k-hgZ"/>
<outlet property="highLabelOutlet" destination="Xlz-6g-zzD" id="DyX-x0-PwZ"/>
<outlet property="highStatisticLabelOutlet" destination="EbR-T4-LIg" id="VZk-1K-BCq"/>
<outlet property="highTitleLabelOutlet" destination="bUK-pC-4bd" id="R8q-Q6-q9d"/>
@ -738,6 +743,7 @@
<outlet property="sensorToolbarButtonOutlet" destination="ZIM-Wf-bUy" id="kjL-rX-6ZV"/>
<outlet property="statisticsView" destination="MtJ-rx-OB9" id="u5w-qN-5Tq"/>
<outlet property="timePeriodLabelOutlet" destination="On3-dy-RgB" id="hAe-Kx-vnM"/>
<outlet property="toolbarOutlet" destination="tVG-ML-9xd" id="p1N-b3-pnD"/>
<outlet property="valueLabelOutlet" destination="We3-bN-ffR" id="wtY-sZ-mev"/>
</connections>
</viewController>
@ -833,7 +839,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="lDU-f7-mwF" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1537" y="-891"/>
<point key="canvasLocation" x="1753.8461538461538" y="-887.20379146919424"/>
</scene>
<!--Picker View Controller-->
<scene sceneID="6RW-Ef-2Hm">
@ -915,7 +921,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="HPe-YM-BbI" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-566" y="1500"/>
<point key="canvasLocation" x="-566" y="1268"/>
</scene>
<!--Date Picker View Controller-->
<scene sceneID="OeI-t1-GDw">
@ -997,7 +1003,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="y9l-yM-uDB" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="403" y="1501"/>
<point key="canvasLocation" x="183" y="1268"/>
</scene>
<!--Settings View Controller-->
<scene sceneID="wg7-f3-ORb">
@ -1967,7 +1973,7 @@
<image name="ellipsis.circle" catalog="system" width="128" height="121"/>
<image name="lock" catalog="system" width="128" height="128"/>
<image name="moon.zzz" catalog="system" width="115" height="128"/>
<image name="pencil" catalog="system" width="128" height="113"/>
<image name="questionmark.circle" catalog="system" width="128" height="121"/>
<image name="scope" catalog="system" width="128" height="122"/>
<image name="sensor14_14_alt" width="390" height="14"/>
<systemColor name="systemGrayColor">