From 549b495d164620ba85319257a92ca2b948b80ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 30 Jan 2019 17:06:19 +0100 Subject: [PATCH] ios: add initial implementation of join / leave --- ios/app/src/ViewController.m | 2 +- ios/sdk/src/JitsiMeetView.h | 3 +- ios/sdk/src/JitsiMeetView.m | 56 ++++++++++++++++++++---------------- 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/ios/app/src/ViewController.m b/ios/app/src/ViewController.m index ffde23a42..6fbd9dce9 100644 --- a/ios/app/src/ViewController.m +++ b/ios/app/src/ViewController.m @@ -39,7 +39,7 @@ // anyway. view.welcomePageEnabled = YES; - [view loadURL:[[JitsiMeet sharedInstance] getInitialURL]]; + [view join:[[JitsiMeet sharedInstance] getInitialURL]]; } // JitsiMeetViewDelegate diff --git a/ios/sdk/src/JitsiMeetView.h b/ios/sdk/src/JitsiMeetView.h index e1dcf33e8..0c7cc0ec1 100644 --- a/ios/sdk/src/JitsiMeetView.h +++ b/ios/sdk/src/JitsiMeetView.h @@ -34,6 +34,7 @@ @property (nonatomic) BOOL welcomePageEnabled; -- (void)loadURL:(NSDictionary * _Nullable)urlObject; +- (void)join:(NSDictionary * _Nullable)url; +- (void)leave; @end diff --git a/ios/sdk/src/JitsiMeetView.m b/ios/sdk/src/JitsiMeetView.m index 90457dbd6..2d8866689 100644 --- a/ios/sdk/src/JitsiMeetView.m +++ b/ios/sdk/src/JitsiMeetView.m @@ -101,6 +101,38 @@ static void initializeViewsMap() { #pragma mark API +- (void)join:(NSDictionary *_Nullable)url { + [self loadURL:url]; +} + +- (void)leave { + [self loadURL:nil]; +} + +#pragma pictureInPictureEnabled getter / setter + +- (void) setPictureInPictureEnabled:(BOOL)pictureInPictureEnabled { + _pictureInPictureEnabled + = [NSNumber numberWithBool:pictureInPictureEnabled]; +} + +- (BOOL) pictureInPictureEnabled { + if (_pictureInPictureEnabled) { + return [_pictureInPictureEnabled boolValue]; + } + + // The SDK/JitsiMeetView client/consumer did not explicitly enable/disable + // Picture-in-Picture. However, we may automatically deduce their + // intentions: we need the support of the client in order to implement + // Picture-in-Picture on iOS (in contrast to Android) so if the client + // appears to have provided the support then we can assume that they did it + // with the intention to have Picture-in-Picture enabled. + return self.delegate + && [self.delegate respondsToSelector:@selector(enterPictureInPicture:)]; +} + +#pragma mark Private methods + /** * Loads a specific URL which may identify a conference to join. The URL is * specified in the form of an `NSDictionary` of properties which (1) @@ -160,30 +192,6 @@ static void initializeViewsMap() { } } -#pragma pictureInPictureEnabled getter / setter - -- (void) setPictureInPictureEnabled:(BOOL)pictureInPictureEnabled { - _pictureInPictureEnabled - = [NSNumber numberWithBool:pictureInPictureEnabled]; -} - -- (BOOL) pictureInPictureEnabled { - if (_pictureInPictureEnabled) { - return [_pictureInPictureEnabled boolValue]; - } - - // The SDK/JitsiMeetView client/consumer did not explicitly enable/disable - // Picture-in-Picture. However, we may automatically deduce their - // intentions: we need the support of the client in order to implement - // Picture-in-Picture on iOS (in contrast to Android) so if the client - // appears to have provided the support then we can assume that they did it - // with the intention to have Picture-in-Picture enabled. - return self.delegate - && [self.delegate respondsToSelector:@selector(enterPictureInPicture:)]; -} - -#pragma mark Private methods - + (BOOL)loadURLInViews:(NSDictionary *)urlObject { BOOL handled = NO;