|
@@ -45,9 +45,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
|
|
|
init(resolver: Resolver) {
|
|
init(resolver: Resolver) {
|
|
|
super.init()
|
|
super.init()
|
|
|
injectServices(resolver)
|
|
injectServices(resolver)
|
|
|
- guard setupWatchSession() else {
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ setupWatchSession()
|
|
|
|
|
|
|
|
units = settingsManager.settings.units
|
|
units = settingsManager.settings.units
|
|
|
glucoseColorScheme = settingsManager.settings.glucoseColorScheme
|
|
glucoseColorScheme = settingsManager.settings.glucoseColorScheme
|
|
@@ -125,24 +123,16 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// Sets up the WatchConnectivity session if the device supports it
|
|
/// Sets up the WatchConnectivity session if the device supports it
|
|
|
- private func setupWatchSession() -> Bool {
|
|
|
|
|
|
|
+ private func setupWatchSession() {
|
|
|
if WCSession.isSupported() {
|
|
if WCSession.isSupported() {
|
|
|
let session = WCSession.default
|
|
let session = WCSession.default
|
|
|
session.delegate = self
|
|
session.delegate = self
|
|
|
session.activate()
|
|
session.activate()
|
|
|
self.session = session
|
|
self.session = session
|
|
|
- debug(.watchManager, "📱 Phone session setup - isPaired: \(session.isPaired)")
|
|
|
|
|
|
|
|
|
|
- guard session.isPaired else {
|
|
|
|
|
- debug(.watchManager, "⌚️❌ No Watch is paired")
|
|
|
|
|
- // return here to end any further initialization of Apple Watch Manager
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
- return true
|
|
|
|
|
|
|
+ debug(.watchManager, "📱 Phone session setup - isPaired: \(session.isPaired)")
|
|
|
} else {
|
|
} else {
|
|
|
debug(.watchManager, "📱 WCSession is not supported on this device")
|
|
debug(.watchManager, "📱 WCSession is not supported on this device")
|
|
|
- // return here to end any further initialization of Apple Watch Manager
|
|
|
|
|
- return false
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|