Skip to content

Commit

Permalink
Convergence
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshay authored and Akshay committed Jul 7, 2017
1 parent b2959b5 commit a3eb368
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
14 changes: 8 additions & 6 deletions Sample/OCKSample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
Expand All @@ -799,7 +799,7 @@
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
Expand All @@ -821,7 +821,7 @@
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
Expand All @@ -843,7 +843,7 @@
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
Expand Down Expand Up @@ -900,6 +900,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand Down Expand Up @@ -947,6 +948,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -963,7 +965,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.example.apple-samplecode.CareKit";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -981,7 +983,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
22 changes: 11 additions & 11 deletions Sample/OCKSampleWatch Extension/InterfaceController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ class InterfaceController: WKInterfaceController {

override func awake(withContext context: Any?) {
super.awake(withContext: context)
session.delegate = self
session.activate()
session().delegate = self
session().activate()
}

override func willActivate() {
self.setTitle("")

if session.activationState != .activated {
session.activate()
if session().activationState != .activated {
session().activate()
} else {
loadData()
}
Expand All @@ -84,7 +84,7 @@ class InterfaceController: WKInterfaceController {
}

func didLosePhoneConnection() {
guard session.activationState != .activated else {
guard session().activationState != .activated else {
return
}

Expand Down Expand Up @@ -229,7 +229,7 @@ class InterfaceController: WKInterfaceController {

func updateDataStoreEvent(withActivityIdentifier activityIdentifier : String, atIndex eventIndex : Int, toCompletedState completedState : Bool) {

if !session.isReachable {
if !session().isReachable {
didLosePhoneConnection()
return
}
Expand All @@ -246,7 +246,7 @@ class InterfaceController: WKInterfaceController {
updateComplications(withCompletionPercentage: nil)

encoder.finishEncoding()
session.sendMessageData(data as Data, replyHandler: {data in
session().sendMessageData(data as Data, replyHandler: {data in
let decoder = NSKeyedUnarchiver(forReadingWith: data)
if decoder.decodeBool(forKey: "success") {
} else {
Expand All @@ -262,8 +262,8 @@ class InterfaceController: WKInterfaceController {
}

func messagingErrorHandler(_ error : Error) {
NSLog("error: \(error)\nsession reachable = \(session.isReachable)")
if session.activationState != .activated {
NSLog("error: \(error)\nsession reachable = \(session().isReachable)")
if session().activationState != .activated {
didLosePhoneConnection()
} else {
loadData()
Expand All @@ -278,12 +278,12 @@ class InterfaceController: WKInterfaceController {
// MARK: Fetching Data

func getAllData() {
if session.activationState == .activated {
if session().activationState == .activated {
let data = NSMutableData()
let encoder = NSKeyedArchiver(forWritingWith: data)
encoder.encode("getAllData", forKey: "type")
encoder.finishEncoding()
session.sendMessageData(data as Data, replyHandler: {(data) in
session().sendMessageData(data as Data, replyHandler: {(data) in
let decoder = NSKeyedUnarchiver(forReadingWith: data)
defer {
decoder.finishDecoding()
Expand Down
2 changes: 1 addition & 1 deletion dependency
Submodule dependency updated 425 files
6 changes: 4 additions & 2 deletions testing/OCKTest/OCKTest.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -524,6 +525,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand All @@ -540,7 +542,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.carekit.OCKTest;
PRODUCT_NAME = OCKTest;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -556,7 +558,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.carekit.OCKTest;
PRODUCT_NAME = OCKTest;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down

0 comments on commit a3eb368

Please sign in to comment.