From aca213ec82c271585cd99426d249903d8691d85d Mon Sep 17 00:00:00 2001 From: Nathan Racklyeft Date: Wed, 20 Jul 2016 21:07:34 -0700 Subject: [PATCH] Removes support for RemoteSettings.plist --- Loop.xcodeproj/project.pbxproj | 6 ------ Loop/Extensions/NSBundle.swift | 27 --------------------------- Loop/Managers/AnalyticsManager.swift | 8 +------- Loop/Managers/DiagnosticLogger.swift | 12 +----------- Loop/Managers/RemoteDataManager.swift | 15 --------------- 5 files changed, 2 insertions(+), 66 deletions(-) delete mode 100644 Loop/Extensions/NSBundle.swift diff --git a/Loop.xcodeproj/project.pbxproj b/Loop.xcodeproj/project.pbxproj index fd11c92e49..6acf37b05e 100644 --- a/Loop.xcodeproj/project.pbxproj +++ b/Loop.xcodeproj/project.pbxproj @@ -83,7 +83,6 @@ 43B371861CE583890013C5A6 /* BasalStateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43B371851CE583890013C5A6 /* BasalStateView.swift */; }; 43B371881CE597D10013C5A6 /* ShareClient.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43B371871CE597D10013C5A6 /* ShareClient.framework */; }; 43C0944A1CACCC73001F6403 /* NotificationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C094491CACCC73001F6403 /* NotificationManager.swift */; }; - 43C418B31CE0550100405B6A /* NSBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43E344A51B9E1B3300C85C07 /* NSBundle.swift */; }; 43C418B51CE0575200405B6A /* ShareGlucose+GlucoseKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C418B41CE0575200405B6A /* ShareGlucose+GlucoseKit.swift */; }; 43CA93371CB98079000026B5 /* MinimedKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43CA93361CB98079000026B5 /* MinimedKit.framework */; }; 43CE7CDE1CA8B63E003CC1B0 /* NSDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43CE7CDD1CA8B63E003CC1B0 /* NSDate.swift */; }; @@ -120,7 +119,6 @@ 43E2D9191D222759004DA55F /* LoopKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43F78D4B1C914197002152D1 /* LoopKit.framework */; }; 43E3449F1B9D68E900C85C07 /* StatusTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43E3449E1B9D68E900C85C07 /* StatusTableViewController.swift */; }; 43E344A41B9E1B1C00C85C07 /* NSUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43E344A31B9E1B1C00C85C07 /* NSUserDefaults.swift */; }; - 43E344A61B9E1B3300C85C07 /* NSBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43E344A51B9E1B3300C85C07 /* NSBundle.swift */; }; 43EB40861C82646A00472A8C /* StatusChartManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43EB40851C82646A00472A8C /* StatusChartManager.swift */; }; 43EDDBF31C361C75007D89B5 /* xDripG5.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43EDDBF11C361C75007D89B5 /* xDripG5.framework */; }; 43F41C331D3A17AA00C11ED6 /* ChartAxisValueDoubleUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43F41C321D3A17AA00C11ED6 /* ChartAxisValueDoubleUnit.swift */; }; @@ -329,7 +327,6 @@ 43E2D90F1D20C581004DA55F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43E3449E1B9D68E900C85C07 /* StatusTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = StatusTableViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 43E344A31B9E1B1C00C85C07 /* NSUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSUserDefaults.swift; sourceTree = ""; }; - 43E344A51B9E1B3300C85C07 /* NSBundle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSBundle.swift; sourceTree = ""; }; 43EB40851C82646A00472A8C /* StatusChartManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusChartManager.swift; sourceTree = ""; }; 43EDDBF01C361C75007D89B5 /* CommonCrypto.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CommonCrypto.framework; path = Carthage/Build/iOS/CommonCrypto.framework; sourceTree = ""; }; 43EDDBF11C361C75007D89B5 /* xDripG5.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = xDripG5.framework; path = Carthage/Build/iOS/xDripG5.framework; sourceTree = ""; }; @@ -578,7 +575,6 @@ 43649A621C7A347F00523D7F /* CollectionType.swift */, 434FF1E91CF26C29000DB779 /* IdentifiableClass.swift */, 434F54561D287FDB002A9274 /* NibLoadable.swift */, - 43E344A51B9E1B3300C85C07 /* NSBundle.swift */, 43CE7CDD1CA8B63E003CC1B0 /* NSDate.swift */, 4398973A1CD2FC2000223065 /* NSDateFormatter.swift */, 439897341CD2F7DE00223065 /* NSTimeInterval.swift */, @@ -969,7 +965,6 @@ 437CEEBE1CD6E0CB003C8C80 /* LoopCompletionHUDView.swift in Sources */, 435400321C9F745500D5819C /* BolusSuggestionUserInfo.swift in Sources */, 43E3449F1B9D68E900C85C07 /* StatusTableViewController.swift in Sources */, - 43E344A61B9E1B3300C85C07 /* NSBundle.swift in Sources */, 43DBF0531C93EC8200B3C386 /* DeviceDataManager.swift in Sources */, 43E2D8C81D208D5B004DA55F /* KeychainManager+Loop.swift in Sources */, 4346D1E71C77F5FE00ABAFE3 /* ChartTableViewCell.swift in Sources */, @@ -1039,7 +1034,6 @@ 43DE925A1C5479E4001FFDE1 /* CarbEntryUserInfo.swift in Sources */, 4328E0301CFBFAEB00E199AA /* NSTimeInterval.swift in Sources */, 43A9438E1B926B7B0051FA24 /* ComplicationController.swift in Sources */, - 43C418B31CE0550100405B6A /* NSBundle.swift in Sources */, 4328E01A1CFBE1DA00E199AA /* StatusInterfaceController.swift in Sources */, 43DE925D1C547A20001FFDE1 /* WatchContext.swift in Sources */, 435400351C9F878D00D5819C /* SetBolusUserInfo.swift in Sources */, diff --git a/Loop/Extensions/NSBundle.swift b/Loop/Extensions/NSBundle.swift deleted file mode 100644 index be9848ce9f..0000000000 --- a/Loop/Extensions/NSBundle.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// NSBundle.swift -// Naterade -// -// Created by Nathan Racklyeft on 9/7/15. -// Copyright © 2015 Nathan Racklyeft. All rights reserved. -// - -import Foundation - -extension NSBundle { - var shortVersionString: String! { - return objectForInfoDictionaryKey("CFBundleShortVersionString") as? String - } - - private var remoteSettingsPath: String? { - return NSBundle.mainBundle().pathForResource("RemoteSettings", ofType: "plist") - } - - var remoteSettings: [String: String]? { - guard let path = remoteSettingsPath else { - return nil - } - - return NSDictionary(contentsOfFile: path) as? [String: String] - } -} \ No newline at end of file diff --git a/Loop/Managers/AnalyticsManager.swift b/Loop/Managers/AnalyticsManager.swift index d8d90a2dc5..e13c50258a 100644 --- a/Loop/Managers/AnalyticsManager.swift +++ b/Loop/Managers/AnalyticsManager.swift @@ -19,14 +19,8 @@ class AnalyticsManager { } init() { - // Migrate RemoteSettings.plist to the Keychain - let keychain = KeychainManager() - - if let APIKey = keychain.getAmplitudeAPIKey() { + if let APIKey = KeychainManager().getAmplitudeAPIKey() { amplitudeService = AmplitudeService(APIKey: APIKey) - } else if let settings = NSBundle.mainBundle().remoteSettings, key = settings["AmplitudeAPIKey"] where !key.isEmpty { - try! keychain.setAmplitudeAPIKey(key) - amplitudeService = AmplitudeService(APIKey: key) } else { amplitudeService = AmplitudeService(APIKey: nil) } diff --git a/Loop/Managers/DiagnosticLogger.swift b/Loop/Managers/DiagnosticLogger.swift index 0fd9b75311..1ba2fdb199 100644 --- a/Loop/Managers/DiagnosticLogger.swift +++ b/Loop/Managers/DiagnosticLogger.swift @@ -19,17 +19,7 @@ class DiagnosticLogger { } init() { - let keychain = KeychainManager() - - // Migrate RemoteSettings.plist to the Keychain - if let (databaseName, APIKey) = keychain.getMLabCredentials() { - mLabService = MLabService(databaseName: databaseName, APIKey: APIKey) - } else if let settings = NSBundle.mainBundle().remoteSettings, - APIKey = settings["mLabAPIKey"], - APIPath = settings["mLabAPIPath"] where !APIKey.isEmpty - { - let databaseName = APIPath.componentsSeparatedByString("/")[1] - try! keychain.setMLabDatabaseName(databaseName, APIKey: APIKey) + if let (databaseName, APIKey) = KeychainManager().getMLabCredentials() { mLabService = MLabService(databaseName: databaseName, APIKey: APIKey) } else { mLabService = MLabService(databaseName: nil, APIKey: nil) diff --git a/Loop/Managers/RemoteDataManager.swift b/Loop/Managers/RemoteDataManager.swift index f6accd96b6..c30bf09ac5 100644 --- a/Loop/Managers/RemoteDataManager.swift +++ b/Loop/Managers/RemoteDataManager.swift @@ -36,29 +36,14 @@ class RemoteDataManager { private let keychain = KeychainManager() init() { - // Migrate RemoteSettings.plist to the Keychain - let settings = NSBundle.mainBundle().remoteSettings - if let (username, password) = keychain.getDexcomShareCredentials() { shareService = ShareService(username: username, password: password) - } else if let username = settings?["ShareAccountName"], - password = settings?["ShareAccountPassword"] - where !username.isEmpty && !password.isEmpty - { - try! keychain.setDexcomShareUsername(username, password: password) - shareService = ShareService(username: username, password: password) } else { shareService = ShareService(username: nil, password: nil) } if let (siteURL, APISecret) = keychain.getNightscoutCredentials() { nightscoutService = NightscoutService(siteURL: siteURL, APISecret: APISecret) - } else if let siteURLString = settings?["NightscoutSiteURL"], - APISecret = settings?["NightscoutAPISecret"], - siteURL = NSURL(string: siteURLString) - { - keychain.setNightscoutURL(siteURL, secret: APISecret) - nightscoutService = NightscoutService(siteURL: siteURL, APISecret: APISecret) } else { nightscoutService = NightscoutService(siteURL: nil, APISecret: nil) }