Skip to content

Commit

Permalink
Merge pull request LoopKit#43 from loudnate/dev
Browse files Browse the repository at this point in the history
Version 0.7.0
  • Loading branch information
loudnate authored Sep 16, 2016
2 parents 2dab733 + dc9f9ef commit 5cdf2d3
Show file tree
Hide file tree
Showing 36 changed files with 475 additions and 463 deletions.
20 changes: 10 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
language: objective-c
osx_image: xcode7.3
before_deploy:
- carthage build --no-skip-current
osx_image: xcode8

cache: cocoapods
podfile: Example/Podfile
# cache: cocoapods
# podfile: Example/Podfile

before_install:
- gem install cocoapods # Since Travis is not always on latest version
- pod install --project-directory=Example
# - gem install cocoapods # Since Travis is not always on latest version
# - pod install --project-directory=Example

script:
- set -o pipefail && xcodebuild -workspace Example/xDripG5.xcworkspace -scheme xDripG5-Example -sdk iphonesimulator -destination name="iPhone 6" ONLY_ACTIVE_ARCH=NO | xcpretty
- xctool -project xDripG5.xcodeproj -scheme xDripG5 -sdk iphonesimulator9.3 build test
- pod lib lint
# Build cocoapods example project
# - set -o pipefail && xcodebuild -workspace Example/xDripG5.xcworkspace -scheme xDripG5-Example -sdk iphonesimulator -destination name="iPhone SE" ONLY_ACTIVE_ARCH=NO | xcpretty
# Build Travis project and run tests
- xcodebuild -project xDripG5.xcodeproj -scheme xDripG5 -sdk iphonesimulator10.0 build -destination name="iPhone SE" test
# - pod lib lint
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- xDripG5 (0.6.0)
- xDripG5 (0.7.0)

DEPENDENCIES:
- xDripG5 (from `../`)
Expand All @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: ../

SPEC CHECKSUMS:
xDripG5: ef0c18aa2916c968645fc20313e402b13eb5c845
xDripG5: b0bfa28e1dc510799d919ab6a67badb56a024247

PODFILE CHECKSUM: 6b30cba971694d5258509315fb52eb645c9bc5e3

COCOAPODS: 1.0.1
COCOAPODS: 1.1.0.beta.2
18 changes: 14 additions & 4 deletions Example/xDripG5.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 48;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -147,11 +147,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Nathan Racklyeft";
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
LastSwiftMigration = 0800;
SystemCapabilities = {
com.apple.BackgroundModes = {
enabled = 1;
Expand All @@ -161,7 +162,7 @@
};
};
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "xDripG5" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 8.0";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
Expand Down Expand Up @@ -204,7 +205,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
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";
showEnvVarsInLog = 0;
};
2FC4228A9369221D367ED688 /* [CP] Copy Pods Resources */ = {
Expand Down Expand Up @@ -286,8 +287,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand Down Expand Up @@ -331,8 +334,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -351,6 +356,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -359,12 +365,14 @@
isa = XCBuildConfiguration;
baseConfigurationReference = F3147B948B4F90A741304461 /* Pods-xDripG5_Example.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = xDripG5/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.xDripG5-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -373,12 +381,14 @@
isa = XCBuildConfiguration;
baseConfigurationReference = CFBD776BFE02F42998A8820B /* Pods-xDripG5_Example.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = xDripG5/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.xDripG5-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
36 changes: 18 additions & 18 deletions Example/xDripG5/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,73 +16,73 @@ class AppDelegate: UIResponder, UIApplicationDelegate, TransmitterDelegate {
var window: UIWindow?

static var sharedDelegate: AppDelegate {
return UIApplication.sharedApplication().delegate as! AppDelegate
return UIApplication.shared.delegate as! AppDelegate
}

var transmitter: Transmitter?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

transmitter = Transmitter(
ID: NSUserDefaults.standardUserDefaults().transmitterID,
passiveModeEnabled: NSUserDefaults.standardUserDefaults().passiveModeEnabled
ID: UserDefaults.standard.transmitterID,
passiveModeEnabled: UserDefaults.standard.passiveModeEnabled
)
transmitter?.stayConnected = NSUserDefaults.standardUserDefaults().stayConnected
transmitter?.stayConnected = UserDefaults.standard.stayConnected
transmitter?.delegate = self

return true
}

func applicationWillResignActive(application: UIApplication) {
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

if let transmitter = transmitter where !transmitter.stayConnected {
if let transmitter = transmitter , !transmitter.stayConnected {
transmitter.stopScanning()
}
}

func applicationWillEnterForeground(application: UIApplication) {
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(application: UIApplication) {
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

transmitter?.resumeScanning()
}

func applicationWillTerminate(application: UIApplication) {
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

// MARK: - TransmitterDelegate

private let dateFormatter: NSDateFormatter = {
let dateFormatter = NSDateFormatter()
private let dateFormatter: DateFormatter = {
let dateFormatter = DateFormatter()

dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
dateFormatter.locale = NSLocale(localeIdentifier: "en_US_POSIX")
dateFormatter.locale = Locale(identifier: "en_US_POSIX")

return dateFormatter
}()

func transmitter(transmitter: Transmitter, didError error: ErrorType) {
func transmitter(_ transmitter: Transmitter, didError error: Error) {
if let vc = window?.rootViewController as? TransmitterDelegate {
dispatch_async(dispatch_get_main_queue()) {
DispatchQueue.main.async {
vc.transmitter(transmitter, didError: error)
}
}
}

func transmitter(transmitter: Transmitter, didRead glucose: Glucose) {
func transmitter(_ transmitter: Transmitter, didRead glucose: Glucose) {
if let vc = window?.rootViewController as? TransmitterDelegate {
dispatch_async(dispatch_get_main_queue()) {
DispatchQueue.main.async {
vc.transmitter(transmitter, didRead: glucose)
}
}
Expand Down
Loading

0 comments on commit 5cdf2d3

Please sign in to comment.