From 894b4d1ac3e2a6d97d3f6a539773de327cf7bc1e Mon Sep 17 00:00:00 2001 From: Paul Dickens Date: Thu, 15 Feb 2018 22:16:02 +1100 Subject: [PATCH 01/10] add setter for ID --- xDripG5/Transmitter.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xDripG5/Transmitter.swift b/xDripG5/Transmitter.swift index 1b48956c..5a27a513 100644 --- a/xDripG5/Transmitter.swift +++ b/xDripG5/Transmitter.swift @@ -30,7 +30,12 @@ public final class Transmitter: BluetoothManagerDelegate { /// The ID of the transmitter to connect to public var ID: String { - return id.id + get { + return id.id + } + set(newID) { + id = TransmitterID(id: newID) + } } private var id: TransmitterID From c53d90d9e1342baeba2d349b2f47c0bf60c48449 Mon Sep 17 00:00:00 2001 From: Paul Dickens Date: Thu, 15 Feb 2018 22:17:55 +1100 Subject: [PATCH 02/10] use id instead of ID --- Example/xDripG5/AppDelegate.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Example/xDripG5/AppDelegate.swift b/Example/xDripG5/AppDelegate.swift index f230f6d9..70100dec 100644 --- a/Example/xDripG5/AppDelegate.swift +++ b/Example/xDripG5/AppDelegate.swift @@ -24,7 +24,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, TransmitterDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { transmitter = Transmitter( - ID: UserDefaults.standard.transmitterID, + id: UserDefaults.standard.transmitterID, passiveModeEnabled: UserDefaults.standard.passiveModeEnabled ) transmitter?.stayConnected = UserDefaults.standard.stayConnected From 2f344f0633914ea532c354211d3906714e1fa7dd Mon Sep 17 00:00:00 2001 From: Paul Dickens Date: Thu, 15 Feb 2018 22:20:04 +1100 Subject: [PATCH 03/10] call pod install --- Example/Podfile.lock | 2 +- Example/xDripG5.xcodeproj/project.pbxproj | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 9d30a5a1..9a01744f 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -13,4 +13,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 6b30cba971694d5258509315fb52eb645c9bc5e3 -COCOAPODS: 1.1.0.rc.2 +COCOAPODS: 1.3.1 diff --git a/Example/xDripG5.xcodeproj/project.pbxproj b/Example/xDripG5.xcodeproj/project.pbxproj index 02b5616c..03182c02 100644 --- a/Example/xDripG5.xcodeproj/project.pbxproj +++ b/Example/xDripG5.xcodeproj/project.pbxproj @@ -202,13 +202,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-xDripG5_Example-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 2FC4228A9369221D367ED688 /* [CP] Copy Pods Resources */ = { @@ -232,9 +235,12 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-xDripG5_Example/Pods-xDripG5_Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/xDripG5/xDripG5.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/xDripG5.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -383,6 +389,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = xDripG5/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; @@ -399,6 +406,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = xDripG5/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; From 552a72a4cfb9de0e5e09cc328a5da9832a94cccb Mon Sep 17 00:00:00 2001 From: Paul Dickens Date: Thu, 15 Feb 2018 22:22:59 +1100 Subject: [PATCH 04/10] remove deprecated 'characters' --- Example/xDripG5/ViewController.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Example/xDripG5/ViewController.swift b/Example/xDripG5/ViewController.swift index faef5334..35c27737 100644 --- a/Example/xDripG5/ViewController.swift +++ b/Example/xDripG5/ViewController.swift @@ -68,9 +68,9 @@ class ViewController: UIViewController, TransmitterDelegate, UITextFieldDelegate if let text = textField.text { let newString = text.replacingCharacters(in: range.rangeOfString(text), with: string) - if newString.characters.count > 6 { + if newString.count > 6 { return false - } else if newString.characters.count == 6 { + } else if newString.count == 6 { AppDelegate.sharedDelegate.transmitter?.ID = newString UserDefaults.standard.transmitterID = newString @@ -86,7 +86,7 @@ class ViewController: UIViewController, TransmitterDelegate, UITextFieldDelegate } func textFieldDidEndEditing(_ textField: UITextField) { - if textField.text?.characters.count != 6 { + if textField.text?.count != 6 { textField.text = UserDefaults.standard.transmitterID } } @@ -129,8 +129,8 @@ class ViewController: UIViewController, TransmitterDelegate, UITextFieldDelegate private extension NSRange { func rangeOfString(_ string: String) -> Range { - let startIndex = string.characters.index(string.startIndex, offsetBy: location) - let endIndex = string.characters.index(startIndex, offsetBy: length) + let startIndex = string.index(string.startIndex, offsetBy: location) + let endIndex = string.index(startIndex, offsetBy: length) return startIndex.. Date: Thu, 15 Feb 2018 22:36:31 +1100 Subject: [PATCH 05/10] fix pod install errors --- Example/Podfile | 1 + Example/Podfile.lock | 2 +- Example/xDripG5.xcodeproj/project.pbxproj | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Example/Podfile b/Example/Podfile index 396887bb..08010e5e 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,4 +1,5 @@ source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '10.3' use_frameworks! target 'xDripG5_Example' do diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 9a01744f..9ff8cb9a 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -11,6 +11,6 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: xDripG5: 8779a4f495fd8eb81a3d75457afe9b95fb52f61d -PODFILE CHECKSUM: 6b30cba971694d5258509315fb52eb645c9bc5e3 +PODFILE CHECKSUM: c62f3fcb344335d79abdcccea268615000e8801b COCOAPODS: 1.3.1 diff --git a/Example/xDripG5.xcodeproj/project.pbxproj b/Example/xDripG5.xcodeproj/project.pbxproj index 03182c02..3d615fcc 100644 --- a/Example/xDripG5.xcodeproj/project.pbxproj +++ b/Example/xDripG5.xcodeproj/project.pbxproj @@ -387,7 +387,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = F3147B948B4F90A741304461 /* Pods-xDripG5_Example.debug.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = xDripG5/Info.plist; @@ -404,7 +404,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = CFBD776BFE02F42998A8820B /* Pods-xDripG5_Example.release.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = xDripG5/Info.plist; From efc56162404ac6fb1e4bcc2da2d062012d7be8e6 Mon Sep 17 00:00:00 2001 From: Paul Dickens Date: Thu, 15 Feb 2018 23:14:18 +1100 Subject: [PATCH 06/10] set deployment target to 10.3 --- xDripG5.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xDripG5.xcodeproj/project.pbxproj b/xDripG5.xcodeproj/project.pbxproj index 7bd773e9..a866a5bb 100644 --- a/xDripG5.xcodeproj/project.pbxproj +++ b/xDripG5.xcodeproj/project.pbxproj @@ -548,6 +548,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = xDripG5/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.loudnate.xDripG5; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -569,6 +570,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = xDripG5/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.loudnate.xDripG5; PRODUCT_NAME = "$(TARGET_NAME)"; From f2f5d1edbfaf977dd39f357bf0064031acea2ad2 Mon Sep 17 00:00:00 2001 From: Paul Dickens Date: Thu, 15 Feb 2018 23:30:38 +1100 Subject: [PATCH 07/10] revert last commit --- xDripG5.xcodeproj/project.pbxproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/xDripG5.xcodeproj/project.pbxproj b/xDripG5.xcodeproj/project.pbxproj index a866a5bb..7bd773e9 100644 --- a/xDripG5.xcodeproj/project.pbxproj +++ b/xDripG5.xcodeproj/project.pbxproj @@ -548,7 +548,6 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = xDripG5/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.loudnate.xDripG5; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -570,7 +569,6 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = xDripG5/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.loudnate.xDripG5; PRODUCT_NAME = "$(TARGET_NAME)"; From 88bce541849e51b0624a517266ea346372915953 Mon Sep 17 00:00:00 2001 From: Paul Dickens Date: Thu, 15 Feb 2018 23:31:12 +1100 Subject: [PATCH 08/10] change iOS version in podspec --- xDripG5.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xDripG5.podspec b/xDripG5.podspec index 8374f388..d0442f67 100644 --- a/xDripG5.podspec +++ b/xDripG5.podspec @@ -16,7 +16,7 @@ Please note this project is neither created nor backed by Dexcom, Inc. Use of th s.author = { "Nathan Racklyeft" => "loudnate@gmail.com" } s.source = { :git => "https://github.com/LoopKit/xDripG5.git", :tag => s.version.to_s } - s.platform = :ios, '9.3' + s.platform = :ios, '10.3' s.requires_arc = true s.source_files = ['xDripG5/**/*.swift', 'xDripG5/AESCrypt.{h,m}', 'Pod/*.h'] From 567c27eb5978dcbb17d50e58673119a5cd9aa77f Mon Sep 17 00:00:00 2001 From: Paul Dickens Date: Thu, 15 Feb 2018 23:32:33 +1100 Subject: [PATCH 09/10] install pod --- Example/Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 9ff8cb9a..1846c6be 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: ../ SPEC CHECKSUMS: - xDripG5: 8779a4f495fd8eb81a3d75457afe9b95fb52f61d + xDripG5: 95e385a36ebcf3f42e44dae73fb6490dc5b79904 PODFILE CHECKSUM: c62f3fcb344335d79abdcccea268615000e8801b From a5de1128835f342584fc8f6d862dde7ac6255b9f Mon Sep 17 00:00:00 2001 From: Paul Dickens Date: Fri, 16 Feb 2018 20:46:49 +1100 Subject: [PATCH 10/10] fix 'UIWindow.rootViewController must be used from main thread only' --- Example/xDripG5/AppDelegate.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Example/xDripG5/AppDelegate.swift b/Example/xDripG5/AppDelegate.swift index 70100dec..b1ddb6ec 100644 --- a/Example/xDripG5/AppDelegate.swift +++ b/Example/xDripG5/AppDelegate.swift @@ -73,24 +73,24 @@ class AppDelegate: UIResponder, UIApplicationDelegate, TransmitterDelegate { }() func transmitter(_ transmitter: Transmitter, didError error: Error) { - if let vc = window?.rootViewController as? TransmitterDelegate { - DispatchQueue.main.async { + DispatchQueue.main.async { + if let vc = self.window?.rootViewController as? TransmitterDelegate { vc.transmitter(transmitter, didError: error) } } } func transmitter(_ transmitter: Transmitter, didRead glucose: Glucose) { - if let vc = window?.rootViewController as? TransmitterDelegate { - DispatchQueue.main.async { + DispatchQueue.main.async { + if let vc = self.window?.rootViewController as? TransmitterDelegate { vc.transmitter(transmitter, didRead: glucose) } } } func transmitter(_ transmitter: Transmitter, didReadUnknownData data: Data) { - if let vc = window?.rootViewController as? TransmitterDelegate { - DispatchQueue.main.async { + DispatchQueue.main.async { + if let vc = self.window?.rootViewController as? TransmitterDelegate { vc.transmitter(transmitter, didReadUnknownData: data) } }