Commit fceba30a authored by Tobias's avatar Tobias

add check if WCSession is supported

parent 303ba32f
......@@ -167,11 +167,12 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
setupBlock();
}
_watchCommunication = [VLCWatchCommunication sharedInstance];
// TODO: push DB changes instead
// [_watchCommunication startRelayingNotificationName:NSManagedObjectContextDidSaveNotification object:nil];
[_watchCommunication startRelayingNotificationName:VLCPlaybackControllerPlaybackMetadataDidChange object:nil];
if ([VLCWatchCommunication isSupported]) {
_watchCommunication = [VLCWatchCommunication sharedInstance];
// TODO: push DB changes instead
// [_watchCommunication startRelayingNotificationName:NSManagedObjectContextDidSaveNotification object:nil];
[_watchCommunication startRelayingNotificationName:VLCPlaybackControllerPlaybackMetadataDidChange object:nil];
}
return YES;
}
......@@ -437,7 +438,9 @@ didFailToContinueUserActivityWithType:(NSString *)userActivityType
handleWatchKitExtensionRequest:(NSDictionary *)userInfo
reply:(void (^)(NSDictionary *))reply
{
[self.watchCommunication session:[WCSession defaultSession] didReceiveMessage:userInfo replyHandler:reply];
if ([VLCWatchCommunication isSupported]) {
[self.watchCommunication session:[WCSession defaultSession] didReceiveMessage:userInfo replyHandler:reply];
}
}
......
......@@ -16,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface VLCWatchCommunication : NSObject <WCSessionDelegate>
+ (BOOL)isSupported;
+ (instancetype)sharedInstance;
- (void)startRelayingNotificationName:(nullable NSString *)name object:(nullable id)object;
......
......@@ -18,6 +18,10 @@
@implementation VLCWatchCommunication
+ (BOOL)isSupported {
return [WCSession class] != nil && [WCSession isSupported];
}
- (instancetype)init
{
self = [super init];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment