Browse Source

use WCSession for remote notification dispatching instead of darwin notification center

Tobias Conradi 10 years ago
parent
commit
e87a07ff5d

+ 0 - 27
SharedSources/VLCNotificationRelay.h

@@ -1,27 +0,0 @@
-/*****************************************************************************
- * VLCNotificationRelay.h
- * VLC for iOS
- *****************************************************************************
- * Copyright (c) 2015 VideoLAN. All rights reserved.
- * $Id$
- *
- * Author: Tobias Conradi <videolan # tobias-conradi.de>
- *
- * Refer to the COPYING file of the official project for license.
- *****************************************************************************/
-
-#import <Foundation/Foundation.h>
-
-@interface VLCNotificationRelay : NSObject
-+ (instancetype)sharedRelay;
-
-/* relays NSNotificationCenter notifications with localName to CFNotifactionCenter with remoteName */
-- (void)addRelayLocalName:(NSString *)localName toRemoteName:(NSString *)remoteName;
-- (void)removeRelayLocalName:(NSString *)localName;
-
-
-/* relays CFNotifactionCenter with remoteName to  NSNotificationCenter notifications with localName */
-- (void)addRelayRemoteName:(NSString *)remoteName toLocalName:(NSString *)localName;
-- (void)removeRelayRemoteName:(NSString *)remoteName;
-
-@end

+ 0 - 101
SharedSources/VLCNotificationRelay.m

@@ -1,101 +0,0 @@
-/*****************************************************************************
- * VLCNotificationRelay.m
- * VLC for iOS
- *****************************************************************************
- * Copyright (c) 2015 VideoLAN. All rights reserved.
- * $Id$
- *
- * Author: Tobias Conradi <videolan # tobias-conradi.de>
- *
- * Refer to the COPYING file of the official project for license.
- *****************************************************************************/
-
-#import "VLCNotificationRelay.h"
-
-@interface VLCNotificationRelay ()
-@property (nonatomic, readonly) NSMutableDictionary *localToRemote;
-@property (nonatomic, readonly) NSMutableDictionary *remoteToLocal;
-@end
-
-@implementation VLCNotificationRelay
-
-+ (instancetype)sharedRelay
-{
-    static dispatch_once_t onceToken;
-    static VLCNotificationRelay *instance;
-    dispatch_once(&onceToken, ^{
-        instance = [VLCNotificationRelay new];
-    });
-    return instance;
-}
-
-- (instancetype)init
-{
-    self = [super init];
-    if (self) {
-        _localToRemote = [NSMutableDictionary dictionary];
-        _remoteToLocal = [NSMutableDictionary dictionary];
-    }
-    return self;
-}
-
-- (void)dealloc {
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-    CFNotificationCenterRef center = CFNotificationCenterGetDarwinNotifyCenter();
-    CFNotificationCenterRemoveObserver(center, (__bridge const void *)(self), NULL, NULL);
-}
-
-- (void)addRelayLocalName:(NSString *)localName toRemoteName:(NSString *)remoteName {
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(localNotification:) name:localName object:nil];
-    self.localToRemote[localName] = remoteName;
-}
-
-- (void)removeRelayLocalName:(NSString *)localName {
-    [[NSNotificationCenter defaultCenter] removeObserver:self name:localName object:nil];
-    [self.localToRemote removeObjectForKey:localName];
-}
-
-- (void)addRelayRemoteName:(NSString *)remoteName toLocalName:(NSString *)localName {
-    CFNotificationCenterRef center = CFNotificationCenterGetDarwinNotifyCenter();
-    CFNotificationCenterAddObserver(center, (__bridge  const void *)(self), notificationCallback, (__bridge CFStringRef)remoteName, NULL, CFNotificationSuspensionBehaviorHold);
-    self.remoteToLocal[remoteName] = localName;
-}
-
-- (void)removeRelayRemoteName:(NSString *)remoteName {
-    CFNotificationCenterRef center = CFNotificationCenterGetDarwinNotifyCenter();
-    CFNotificationCenterRemoveObserver(center, (__bridge const void *)(self), (__bridge CFStringRef)remoteName, NULL);
-    [self.remoteToLocal removeObjectForKey:remoteName];
-}
-
-#pragma mark - notification handeling
-- (void)localNotification:(NSNotification *)notification {
-
-    NSString *localName = notification.name;
-    NSString *remoteName = self.localToRemote[localName];
-
-    /* 
-     * in current version of iOS this is ignored for the darwin center
-     * nevertheless we use it to be future proof
-     */
-    NSDictionary *userInfo = notification.userInfo;
-
-    CFNotificationCenterRef center = CFNotificationCenterGetDarwinNotifyCenter();
-    CFNotificationCenterPostNotification(center, (__bridge CFStringRef)remoteName, NULL, (__bridge CFDictionaryRef)userInfo, false);
-}
-
-static void notificationCallback(CFNotificationCenterRef center, void* observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
-{
-    VLCNotificationRelay *relay = (__bridge VLCNotificationRelay*) observer;
-    NSString *remoteName = (__bridge NSString *)name;
-    NSString *localName = relay.remoteToLocal[remoteName];
-
-    /*
-     * in current version of iOS this is ignored for the darwin center
-     * nevertheless we use it to be future proof
-     */
-    NSDictionary *dict = (__bridge NSDictionary *)userInfo;
-    [[NSNotificationCenter defaultCenter] postNotificationName:localName object:nil userInfo:dict];
-}
-
-
-@end

+ 8 - 4
SharedSources/VLCWatchMessage.h

@@ -8,24 +8,28 @@
 
 #import <Foundation/Foundation.h>
 
+NS_ASSUME_NONNULL_BEGIN
+
 extern NSString *const VLCWatchMessageNameGetNowPlayingInfo;
 extern NSString *const VLCWatchMessageNamePlayPause;
 extern NSString *const VLCWatchMessageNameSkipForward;
 extern NSString *const VLCWatchMessageNameSkipBackward;
 extern NSString *const VLCWatchMessageNamePlayFile;
 extern NSString *const VLCWatchMessageNameSetVolume;
-
+extern NSString *const VLCWatchMessageNameNotification;
 
 @interface VLCWatchMessage : NSObject
 @property (nonatomic, readonly) NSString *name;
-@property (nonatomic, readonly) id<NSObject,NSCoding> payload;
+@property (nonatomic, readonly, nullable) id<NSObject,NSCoding> payload;
 
 @property (nonatomic, readonly) NSDictionary *dictionaryRepresentation;
 
-- (instancetype)initWithName:(NSString *)name payload:(id<NSObject,NSCoding>)payload;
+- (instancetype)initWithName:(NSString *)name payload:(nullable id<NSObject,NSCoding>)payload;
 - (instancetype)initWithDictionary:(NSDictionary *)dictionary;
 
-+ (NSDictionary *)messageDictionaryForName:(NSString *)name payload:(id<NSObject,NSCoding>)payload;
++ (NSDictionary *)messageDictionaryForName:(NSString *)name payload:(nullable id<NSObject,NSCoding>)payload;
 + (NSDictionary *)messageDictionaryForName:(NSString *)name;
 
 @end
+
+NS_ASSUME_NONNULL_END

+ 3 - 2
SharedSources/VLCWatchMessage.m

@@ -14,6 +14,7 @@ NSString *const VLCWatchMessageNameSkipForward = @"skipForward";
 NSString *const VLCWatchMessageNameSkipBackward = @"skipBackward";
 NSString *const VLCWatchMessageNamePlayFile = @"playFile";
 NSString *const VLCWatchMessageNameSetVolume = @"setVolume";
+NSString *const VLCWatchMessageNameNotification = @"notification";
 
 static NSString *const VLCWatchMessageNameKey = @"name";
 static NSString *const VLCWatchMessagePayloadKey = @"payload";
@@ -21,7 +22,7 @@ static NSString *const VLCWatchMessagePayloadKey = @"payload";
 @implementation VLCWatchMessage
 @synthesize dictionaryRepresentation = _dictionaryRepresentation;
 
-- (instancetype)initWithName:(NSString *)name payload:(id<NSObject, NSCoding>)payload
+- (instancetype)initWithName:(NSString *)name payload:(nullable id<NSObject,NSCoding>)payload
 {
     self = [super init];
     if (self) {
@@ -62,7 +63,7 @@ static NSString *const VLCWatchMessagePayloadKey = @"payload";
     return payload;
 }
 
-+ (NSDictionary *)messageDictionaryForName:(NSString *)name payload:(id<NSObject,NSCoding>)payload
++ (NSDictionary *)messageDictionaryForName:(NSString *)name payload:(nullable id<NSObject,NSCoding>)payload
 {
     id payloadObject;
     BOOL noArchiving = [payload isKindOfClass:[NSNumber class]] || [payload isKindOfClass:[NSString class]];

+ 3 - 4
Sources/VLCAppDelegate.m

@@ -24,7 +24,6 @@
 #import "VLCHTTPUploaderController.h"
 #import "VLCMigrationViewController.h"
 #import <BoxSDK/BoxSDK.h>
-#import "VLCNotificationRelay.h"
 #import "VLCPlaybackController.h"
 #import "VLCPlaybackController+MediaLibrary.h"
 #import "VLCPlayerDisplayController.h"
@@ -170,9 +169,9 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
 
     _watchCommunication = [VLCWatchCommunication sharedInstance];
 
-    VLCNotificationRelay *notificationRelay = [VLCNotificationRelay sharedRelay];
-    [notificationRelay addRelayLocalName:NSManagedObjectContextDidSaveNotification toRemoteName:@"org.videolan.ios-app.dbupdate"];
-    [notificationRelay addRelayLocalName:VLCPlaybackControllerPlaybackMetadataDidChange toRemoteName:kVLCDarwinNotificationNowPlayingInfoUpdate];
+    // TODO: push DB changes instead
+//    [_watchCommunication startRelayingNotificationName:NSManagedObjectContextDidSaveNotification object:nil];
+    [_watchCommunication startRelayingNotificationName:VLCPlaybackControllerPlaybackMetadataDidChange object:nil];
 
     return YES;
 }

+ 7 - 0
Sources/VLCWatchCommunication.h

@@ -12,8 +12,15 @@
 #import <Foundation/Foundation.h>
 #import <WatchConnectivity/WatchConnectivity.h>
 
+NS_ASSUME_NONNULL_BEGIN
+
 @interface VLCWatchCommunication : NSObject <WCSessionDelegate>
 
 + (instancetype)sharedInstance;
 
+- (void)startRelayingNotificationName:(nullable NSString *)name object:(nullable id)object;
+- (void)stopRelayingNotificationName:(nullable NSString *)name object:(nullable id)object;
+
 @end
+
+NS_ASSUME_NONNULL_END

+ 21 - 0
Sources/VLCWatchCommunication.m

@@ -31,6 +31,10 @@
     return self;
 }
 
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self name:nil object:nil];
+}
+
 static VLCWatchCommunication *_singeltonInstance = nil;
 
 + (VLCWatchCommunication *)sharedInstance
@@ -126,4 +130,21 @@ static VLCWatchCommunication *_singeltonInstance = nil;
     return response;
 }
 
+#pragma mark - Notifications
+- (void)startRelayingNotificationName:(nullable NSString *)name object:(nullable id)object {
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(relayNotification:) name:name object:object];
+}
+- (void)stopRelayingNotificationName:(nullable NSString *)name object:(nullable id)object {
+    [[NSNotificationCenter defaultCenter] removeObserver:self name:name object:object];
+}
+- (void)relayNotification:(NSNotification *)notification {
+    NSDictionary *dict = [VLCWatchMessage messageDictionaryForName:VLCWatchMessageNameNotification
+                                                           payload:@{@"name" : notification.name,
+                                                                     @"userInfo" : notification.userInfo
+                                                                     }];
+    if ([WCSession isSupported] && [[WCSession defaultSession] isReachable]) {
+        [[WCSession defaultSession] sendMessage:dict replyHandler:nil errorHandler:nil];
+    }
+}
+
 @end

+ 25 - 12
VLC WatchKit Native Extension/Classes/ExtensionDelegate.swift

@@ -1,13 +1,18 @@
-//
-//  ExtensionDelegate.swift
-//  watchkitapp Extension
-//
-//  Created by Tobias Conradi on 28.07.15.
-//  Copyright © 2015 VideoLAN. All rights reserved.
-//
+/*****************************************************************************
+* ExtensionDelegate.swift
+* VLC for iOS
+*****************************************************************************
+* Copyright (c) 2015 VideoLAN. All rights reserved.
+* $Id$
+*
+* Authors: Tobias Conradi <videolan # tobias-conradi.de>
+*
+* Refer to the COPYING file of the official project for license.
+*****************************************************************************/
 
 import WatchKit
 import WatchConnectivity
+import CoreData
 
 class ExtensionDelegate: NSObject, WKExtensionDelegate, WCSessionDelegate {
 
@@ -18,13 +23,21 @@ class ExtensionDelegate: NSObject, WKExtensionDelegate, WCSessionDelegate {
 
     }
 
-    func applicationDidBecomeActive() {
-        // 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.
+    func session(session: WCSession, didReceiveMessage message: [String : AnyObject], replyHandler: ([String : AnyObject]) -> Void) {
+        let msg = VLCWatchMessage(dictionary: message)
+        if msg.name == VLCWatchMessageNameNotification, let payloadDict = msg.payload as? [String : AnyObject] {
+            if let name = payloadDict["name"] as? String {
+                handleRemoteNotification(name, userInfo: payloadDict["userInfo"] as? [String : AnyObject])
+            }
+        }
     }
 
-    func applicationWillResignActive() {
-        // 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, etc.
+    func handleRemoteNotification(name:String, userInfo: [String: AnyObject]?) {
+        NSNotificationCenter.defaultCenter().postNotificationName(name, object: self, userInfo: userInfo)
     }
 
+
+    func session(session: WCSession, didReceiveFile file: WCSessionFile) {
+        // TODO: copy db and send update notification
+    }
 }

+ 0 - 31
VLC WatchKit Native Extension/Classes/InterfaceController.swift

@@ -1,31 +0,0 @@
-//
-//  InterfaceController.swift
-//  watchkitapp Extension
-//
-//  Created by Tobias Conradi on 28.07.15.
-//  Copyright © 2015 VideoLAN. All rights reserved.
-//
-
-import WatchKit
-import Foundation
-
-
-class InterfaceController: WKInterfaceController {
-
-    override func awakeWithContext(context: AnyObject?) {
-        super.awakeWithContext(context)
-        
-        // Configure interface objects here.
-    }
-
-    override func willActivate() {
-        // This method is called when watch view controller is about to be visible to user
-        super.willActivate()
-    }
-
-    override func didDeactivate() {
-        // This method is called when watch view controller is no longer visible
-        super.didDeactivate()
-    }
-
-}

+ 2 - 0
VLC WatchKit Native Extension/Classes/VLCBaseInterfaceController.h

@@ -12,6 +12,8 @@
 
 #import <WatchKit/WatchKit.h>
 
+extern NSString *const VLCDBUpdateNotification;
+
 @interface VLCBaseInterfaceController : WKInterfaceController
 @property (nonatomic, assign, readonly, getter=isActivated) BOOL activated;
 

+ 1 - 1
VLC WatchKit Native Extension/Classes/VLCBaseInterfaceController.m

@@ -12,7 +12,7 @@
 
 #import "VLCBaseInterfaceController.h"
 
-static NSString *const VLCDBUpdateNotification = @"VLCUpdateDataBase";
+NSString *const VLCDBUpdateNotification = @"VLCUpdateDatabase";
 
 @interface VLCBaseInterfaceController()
 @property (nonatomic) BOOL needsUpdate;

+ 0 - 27
VLC WatchKit Native Extension/Classes/VLCNotificationRelay.h

@@ -1,27 +0,0 @@
-/*****************************************************************************
- * VLCNotificationRelay.h
- * VLC for iOS
- *****************************************************************************
- * Copyright (c) 2015 VideoLAN. All rights reserved.
- * $Id$
- *
- * Author: Tobias Conradi <videolan # tobias-conradi.de>
- *
- * Refer to the COPYING file of the official project for license.
- *****************************************************************************/
-
-#import <Foundation/Foundation.h>
-
-@interface VLCNotificationRelay : NSObject
-+ (instancetype)sharedRelay;
-
-/* relays NSNotificationCenter notifications with localName to CFNotifactionCenter with remoteName */
-- (void)addRelayLocalName:(NSString *)localName toRemoteName:(NSString *)remoteName;
-- (void)removeRelayLocalName:(NSString *)localName;
-
-
-/* relays CFNotifactionCenter with remoteName to  NSNotificationCenter notifications with localName */
-- (void)addRelayRemoteName:(NSString *)remoteName toLocalName:(NSString *)localName;
-- (void)removeRelayRemoteName:(NSString *)remoteName;
-
-@end

+ 0 - 101
VLC WatchKit Native Extension/Classes/VLCNotificationRelay.m

@@ -1,101 +0,0 @@
-/*****************************************************************************
- * VLCNotificationRelay.m
- * VLC for iOS
- *****************************************************************************
- * Copyright (c) 2015 VideoLAN. All rights reserved.
- * $Id$
- *
- * Author: Tobias Conradi <videolan # tobias-conradi.de>
- *
- * Refer to the COPYING file of the official project for license.
- *****************************************************************************/
-
-#import "VLCNotificationRelay.h"
-
-@interface VLCNotificationRelay ()
-@property (nonatomic, readonly) NSMutableDictionary *localToRemote;
-@property (nonatomic, readonly) NSMutableDictionary *remoteToLocal;
-@end
-
-@implementation VLCNotificationRelay
-
-+ (instancetype)sharedRelay
-{
-    static dispatch_once_t onceToken;
-    static VLCNotificationRelay *instance;
-    dispatch_once(&onceToken, ^{
-        instance = [VLCNotificationRelay new];
-    });
-    return instance;
-}
-
-- (instancetype)init
-{
-    self = [super init];
-    if (self) {
-        _localToRemote = [NSMutableDictionary dictionary];
-        _remoteToLocal = [NSMutableDictionary dictionary];
-    }
-    return self;
-}
-
-- (void)dealloc {
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-    CFNotificationCenterRef center = CFNotificationCenterGetDarwinNotifyCenter();
-    CFNotificationCenterRemoveObserver(center, (__bridge const void *)(self), NULL, NULL);
-}
-
-- (void)addRelayLocalName:(NSString *)localName toRemoteName:(NSString *)remoteName {
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(localNotification:) name:localName object:nil];
-    self.localToRemote[localName] = remoteName;
-}
-
-- (void)removeRelayLocalName:(NSString *)localName {
-    [[NSNotificationCenter defaultCenter] removeObserver:self name:localName object:nil];
-    [self.localToRemote removeObjectForKey:localName];
-}
-
-- (void)addRelayRemoteName:(NSString *)remoteName toLocalName:(NSString *)localName {
-    CFNotificationCenterRef center = CFNotificationCenterGetDarwinNotifyCenter();
-    CFNotificationCenterAddObserver(center, (__bridge  const void *)(self), notificationCallback, (__bridge CFStringRef)remoteName, NULL, CFNotificationSuspensionBehaviorHold);
-    self.remoteToLocal[remoteName] = localName;
-}
-
-- (void)removeRelayRemoteName:(NSString *)remoteName {
-    CFNotificationCenterRef center = CFNotificationCenterGetDarwinNotifyCenter();
-    CFNotificationCenterRemoveObserver(center, (__bridge const void *)(self), (__bridge CFStringRef)remoteName, NULL);
-    [self.remoteToLocal removeObjectForKey:remoteName];
-}
-
-#pragma mark - notification handeling
-- (void)localNotification:(NSNotification *)notification {
-
-    NSString *localName = notification.name;
-    NSString *remoteName = self.localToRemote[localName];
-
-    /* 
-     * in current version of iOS this is ignored for the darwin center
-     * nevertheless we use it to be future proof
-     */
-    NSDictionary *userInfo = notification.userInfo;
-
-    CFNotificationCenterRef center = CFNotificationCenterGetDarwinNotifyCenter();
-    CFNotificationCenterPostNotification(center, (__bridge CFStringRef)remoteName, NULL, (__bridge CFDictionaryRef)userInfo, false);
-}
-
-static void notificationCallback(CFNotificationCenterRef center, void* observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
-{
-    VLCNotificationRelay *relay = (__bridge VLCNotificationRelay*) observer;
-    NSString *remoteName = (__bridge NSString *)name;
-    NSString *localName = relay.remoteToLocal[remoteName];
-
-    /*
-     * in current version of iOS this is ignored for the darwin center
-     * nevertheless we use it to be future proof
-     */
-    NSDictionary *dict = (__bridge NSDictionary *)userInfo;
-    [[NSNotificationCenter defaultCenter] postNotificationName:localName object:nil userInfo:dict];
-}
-
-
-@end

+ 9 - 5
VLC WatchKit Native Extension/Classes/VLCNowPlayingInterfaceController.m

@@ -12,12 +12,13 @@
 
 #import "VLCNowPlayingInterfaceController.h"
 #import "VLCTime.h"
-#import "VLCNotificationRelay.h"
 #import "WKInterfaceObject+VLCProgress.h"
 #import "VLCWatchMessage.h"
 #import "VLCThumbnailsCache.h"
 #import <WatchConnectivity/WatchConnectivity.h>
 
+static NSString *const VLCNowPlayingUpdateNotification = @"VLCPlaybackControllerPlaybackMetadataDidChange";
+
 @interface VLCNowPlayingInterfaceController ()
 {
     CGRect _screenBounds;
@@ -50,14 +51,15 @@
     [self setPlaying:YES];
 
     [self requestNowPlayingInfo];
-    [[VLCNotificationRelay sharedRelay] addRelayRemoteName:@"org.videolan.ios-app.nowPlayingInfoUpdate" toLocalName:@"nowPlayingInfoUpdate"];
 }
 
+// TODO: check if iPhone is connected when inteface controller activates and for each user action
+
 - (void)willActivate {
     // This method is called when watch view controller is about to be visible to user
     [super willActivate];
 
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(requestNowPlayingInfo) name:@"nowPlayingInfoUpdate" object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(requestNowPlayingInfo) name:VLCNowPlayingUpdateNotification object:nil];
     [self requestNowPlayingInfo];
 
     const NSTimeInterval updateInterval = 5;
@@ -70,11 +72,14 @@
 - (void)didDeactivate {
     // This method is called when watch view controller is no longer visible
     [super didDeactivate];
-    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"nowPlayingInfoUpdate" object:nil];
+    [[NSNotificationCenter defaultCenter] removeObserver:self name:VLCNowPlayingUpdateNotification object:nil];
     [self.updateTimer invalidate];
     self.updateTimer = nil;
 }
 
+
+// TODO: don't query for after receiving a notification from iPhone instead add user info to message which sends the notification
+// and use that user info dictionary
 - (void)requestNowPlayingInfo {
 
     NSDictionary *dict = [VLCWatchMessage messageDictionaryForName:VLCWatchMessageNameGetNowPlayingInfo];
@@ -169,7 +174,6 @@
     }];
 }
 
-
 - (void)setVolume:(float)volume
 {
     if (_volume != volume) {

+ 0 - 5
VLC WatchKit Native Extension/Classes/VLCPlaylistInterfaceController.m

@@ -15,14 +15,11 @@
 #import "VLCPlaylistInterfaceController.h"
 #import "VLCRowController.h"
 
-#import "VLCNotificationRelay.h"
 #import "VLCWatchTableController.h"
 #import "NSManagedObjectContext+refreshAll.h"
 #import "MLMediaLibrary+playlist.h"
 
 static NSString *const rowType = @"mediaRow";
-static NSString *const VLCDBUpdateNotification = @"VLCUpdateDataBase";
-static NSString *const VLCDBUpdateNotificationRemote = @"org.videolan.ios-app.dbupdate";
 
 @interface VLCPlaylistInterfaceController()
 {
@@ -56,8 +53,6 @@ static NSString *const VLCDBUpdateNotificationRemote = @"org.videolan.ios-app.db
     }
     [self addNowPlayingMenu];
 
-    [[VLCNotificationRelay sharedRelay] addRelayRemoteName:VLCDBUpdateNotificationRemote toLocalName:VLCDBUpdateNotification];
-
     /* setup table view controller */
     VLCWatchTableController *tableController = [[VLCWatchTableController alloc] init];
     tableController.table = self.table;

+ 2 - 0
VLC WatchKit Native Extension/VLC WatchKit Extension-Bridging-Header.h

@@ -2,3 +2,5 @@
 //  Use this file to import your target's public headers that you would like to expose to Swift.
 //
 
+
+#import "VLCWatchMessage.h"

+ 0 - 16
VLC for iOS.xcodeproj/project.pbxproj

@@ -213,7 +213,6 @@
 		CC1BBC58170493E100A20CBF /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC1BBC57170493E100A20CBF /* CoreData.framework */; };
 		CCE2A22E17A5859E00D9EAAD /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CCE2A22D17A5859E00D9EAAD /* CoreText.framework */; };
 		D9C52A9E9D4D5AFA7EF1B45A /* libPods-vlc-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAF8927B0BE9C328466C0EA7 /* libPods-vlc-ios.a */; };
-		DD1574761B67BBDB00641E8E /* VLCNotificationRelay.m in Sources */ = {isa = PBXBuildFile; fileRef = DD1574751B67BBDB00641E8E /* VLCNotificationRelay.m */; };
 		DD1A45FD1B676BAC00086F57 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DDE1BCE41B676B8800A4B9CE /* Localizable.strings */; };
 		DD2789DC1B67A44200CED769 /* MediaLibraryKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD2789DB1B67A44200CED769 /* MediaLibraryKit.framework */; };
 		DD2789DD1B67A5C400CED769 /* VLCThumbnailsCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D37849D183A98DD009EE944 /* VLCThumbnailsCache.m */; };
@@ -231,11 +230,9 @@
 		DD3567901B6761CE00338947 /* WatchConnectivity.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD35678F1B6761CD00338947 /* WatchConnectivity.framework */; };
 		DD3567B41B67674700338947 /* VLCTime.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3567B31B67674700338947 /* VLCTime.m */; };
 		DD3567EF1B6768FC00338947 /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3567D91B6768FC00338947 /* ExtensionDelegate.swift */; };
-		DD3567F01B6768FC00338947 /* InterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3567DA1B6768FC00338947 /* InterfaceController.swift */; };
 		DD3567F11B6768FC00338947 /* NSManagedObjectContext+refreshAll.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3567DC1B6768FC00338947 /* NSManagedObjectContext+refreshAll.m */; };
 		DD3567F21B6768FC00338947 /* VLCBaseInterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3567E01B6768FC00338947 /* VLCBaseInterfaceController.m */; };
 		DD3567F31B6768FC00338947 /* VLCDetailInterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3567E21B6768FC00338947 /* VLCDetailInterfaceController.m */; };
-		DD3567F41B6768FC00338947 /* VLCNotificationRelay.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3567E41B6768FC00338947 /* VLCNotificationRelay.m */; };
 		DD3567F51B6768FC00338947 /* VLCNowPlayingInterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3567E61B6768FC00338947 /* VLCNowPlayingInterfaceController.m */; };
 		DD3567F61B6768FC00338947 /* VLCPlaylistInterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3567E81B6768FC00338947 /* VLCPlaylistInterfaceController.m */; };
 		DD3567F71B6768FC00338947 /* VLCRowController.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3567EA1B6768FC00338947 /* VLCRowController.m */; };
@@ -690,8 +687,6 @@
 		CCAF837E17DE46D800E3578F /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
 		CCE2A22D17A5859E00D9EAAD /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
 		DAF8927B0BE9C328466C0EA7 /* libPods-vlc-ios.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-vlc-ios.a"; sourceTree = BUILT_PRODUCTS_DIR; };
-		DD1574741B67BBDB00641E8E /* VLCNotificationRelay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCNotificationRelay.h; sourceTree = "<group>"; };
-		DD1574751B67BBDB00641E8E /* VLCNotificationRelay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCNotificationRelay.m; sourceTree = "<group>"; };
 		DD1A45FC1B676BAC00086F57 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
 		DD2789DB1B67A44200CED769 /* MediaLibraryKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaLibraryKit.framework; path = "ImportedSources/MediaLibraryKit/build/Debug-watchos/MediaLibraryKit.framework"; sourceTree = "<group>"; };
 		DD2789E01B67A7BE00CED769 /* VLCWatchCommunication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCWatchCommunication.h; path = Sources/VLCWatchCommunication.h; sourceTree = SOURCE_ROOT; };
@@ -710,7 +705,6 @@
 		DD3567B31B67674700338947 /* VLCTime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCTime.m; path = ImportedSources/VLCKit/Sources/VLCTime.m; sourceTree = SOURCE_ROOT; };
 		DD3567B51B67675400338947 /* VLCTime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = VLCTime.h; path = ImportedSources/VLCKit/Headers/Public/VLCTime.h; sourceTree = SOURCE_ROOT; };
 		DD3567D91B6768FC00338947 /* ExtensionDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtensionDelegate.swift; sourceTree = "<group>"; };
-		DD3567DA1B6768FC00338947 /* InterfaceController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InterfaceController.swift; sourceTree = "<group>"; };
 		DD3567DB1B6768FC00338947 /* NSManagedObjectContext+refreshAll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSManagedObjectContext+refreshAll.h"; sourceTree = "<group>"; };
 		DD3567DC1B6768FC00338947 /* NSManagedObjectContext+refreshAll.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSManagedObjectContext+refreshAll.m"; sourceTree = "<group>"; };
 		DD3567DD1B6768FC00338947 /* VLC for iOS WatchKit Extension-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "VLC for iOS WatchKit Extension-Prefix.pch"; sourceTree = "<group>"; };
@@ -718,8 +712,6 @@
 		DD3567E01B6768FC00338947 /* VLCBaseInterfaceController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCBaseInterfaceController.m; sourceTree = "<group>"; };
 		DD3567E11B6768FC00338947 /* VLCDetailInterfaceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCDetailInterfaceController.h; sourceTree = "<group>"; };
 		DD3567E21B6768FC00338947 /* VLCDetailInterfaceController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCDetailInterfaceController.m; sourceTree = "<group>"; };
-		DD3567E31B6768FC00338947 /* VLCNotificationRelay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCNotificationRelay.h; sourceTree = "<group>"; };
-		DD3567E41B6768FC00338947 /* VLCNotificationRelay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCNotificationRelay.m; sourceTree = "<group>"; };
 		DD3567E51B6768FC00338947 /* VLCNowPlayingInterfaceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCNowPlayingInterfaceController.h; sourceTree = "<group>"; };
 		DD3567E61B6768FC00338947 /* VLCNowPlayingInterfaceController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCNowPlayingInterfaceController.m; sourceTree = "<group>"; };
 		DD3567E71B6768FC00338947 /* VLCPlaylistInterfaceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCPlaylistInterfaceController.h; sourceTree = "<group>"; };
@@ -1615,15 +1607,12 @@
 			isa = PBXGroup;
 			children = (
 				DD3567D91B6768FC00338947 /* ExtensionDelegate.swift */,
-				DD3567DA1B6768FC00338947 /* InterfaceController.swift */,
 				DD3567DB1B6768FC00338947 /* NSManagedObjectContext+refreshAll.h */,
 				DD3567DC1B6768FC00338947 /* NSManagedObjectContext+refreshAll.m */,
 				DD3567DF1B6768FC00338947 /* VLCBaseInterfaceController.h */,
 				DD3567E01B6768FC00338947 /* VLCBaseInterfaceController.m */,
 				DD3567E11B6768FC00338947 /* VLCDetailInterfaceController.h */,
 				DD3567E21B6768FC00338947 /* VLCDetailInterfaceController.m */,
-				DD3567E31B6768FC00338947 /* VLCNotificationRelay.h */,
-				DD3567E41B6768FC00338947 /* VLCNotificationRelay.m */,
 				DD3567E51B6768FC00338947 /* VLCNowPlayingInterfaceController.h */,
 				DD3567E61B6768FC00338947 /* VLCNowPlayingInterfaceController.m */,
 				DD3567E71B6768FC00338947 /* VLCPlaylistInterfaceController.h */,
@@ -1645,8 +1634,6 @@
 				7D37849D183A98DD009EE944 /* VLCThumbnailsCache.m */,
 				DD7110EE1AF38B2B00854776 /* MLMediaLibrary+playlist.h */,
 				DD7110EF1AF38B2B00854776 /* MLMediaLibrary+playlist.m */,
-				DD1574741B67BBDB00641E8E /* VLCNotificationRelay.h */,
-				DD1574751B67BBDB00641E8E /* VLCNotificationRelay.m */,
 				DD3EA62F1AF50CFE007FF096 /* VLCWatchMessage.h */,
 				DD3EA6301AF50CFE007FF096 /* VLCWatchMessage.m */,
 			);
@@ -1971,7 +1958,6 @@
 				2915542717490A9C00B86CAD /* DDLog.m in Sources */,
 				7D95610B1AF3E9E800779745 /* VLCMiniPlaybackView.m in Sources */,
 				2915542817490A9C00B86CAD /* DDTTYLogger.m in Sources */,
-				DD1574761B67BBDB00641E8E /* VLCNotificationRelay.m in Sources */,
 				2915542917490A9C00B86CAD /* ContextFilterLogFormatter.m in Sources */,
 				2915542A17490A9C00B86CAD /* DispatchQueueLogFormatter.m in Sources */,
 				7DC19B051868D1C400810BF7 /* VLCFirstStepsFifthPageViewController.m in Sources */,
@@ -2075,7 +2061,6 @@
 			files = (
 				DD3567F91B6768FC00338947 /* WKInterfaceObject+VLCProgress.m in Sources */,
 				DD3567F11B6768FC00338947 /* NSManagedObjectContext+refreshAll.m in Sources */,
-				DD3567F01B6768FC00338947 /* InterfaceController.swift in Sources */,
 				DD3567EF1B6768FC00338947 /* ExtensionDelegate.swift in Sources */,
 				DD3567F81B6768FC00338947 /* VLCWatchTableController.m in Sources */,
 				DD3567F61B6768FC00338947 /* VLCPlaylistInterfaceController.m in Sources */,
@@ -2085,7 +2070,6 @@
 				DD3567F71B6768FC00338947 /* VLCRowController.m in Sources */,
 				DD3567F21B6768FC00338947 /* VLCBaseInterfaceController.m in Sources */,
 				DD3567B41B67674700338947 /* VLCTime.m in Sources */,
-				DD3567F41B6768FC00338947 /* VLCNotificationRelay.m in Sources */,
 				DD2789DD1B67A5C400CED769 /* VLCThumbnailsCache.m in Sources */,
 				DD3567F51B6768FC00338947 /* VLCNowPlayingInterfaceController.m in Sources */,
 			);