mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 08:03:50 +02:00
Hide controls on Jitsi call screen for PiP mode
This commit is contained in:
@@ -22,8 +22,12 @@
|
||||
@import JitsiMeetSDK;
|
||||
|
||||
static const NSString *kJitsiDataErrorKey = @"error";
|
||||
/**
|
||||
Class name for RCTSafeAreaView. It's in the React Native SDK, so we cannot import its header.
|
||||
*/
|
||||
static NSString * _Nonnull kRCTSafeAreaViewClassName = @"RCTSafeAreaView";
|
||||
|
||||
@interface JitsiViewController () <JitsiMeetViewDelegate>
|
||||
@interface JitsiViewController () <PictureInPicturable, JitsiMeetViewDelegate>
|
||||
|
||||
// The jitsi-meet SDK view
|
||||
@property (nonatomic, weak) IBOutlet JitsiMeetView *jitsiMeetView;
|
||||
@@ -33,6 +37,11 @@ static const NSString *kJitsiDataErrorKey = @"error";
|
||||
@property (nonatomic, strong) NSString *jwtToken;
|
||||
@property (nonatomic) BOOL startWithVideo;
|
||||
|
||||
/**
|
||||
Overlay views in self.jitsiMeetView. Only provided if the screen is in the PiP mode.
|
||||
*/
|
||||
@property (nonatomic, strong) NSArray<UIView*> *overlayViews;
|
||||
|
||||
@end
|
||||
|
||||
@implementation JitsiViewController
|
||||
@@ -265,6 +274,26 @@ static const NSString *kJitsiDataErrorKey = @"error";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Finds all the views in self.jitsiMeetView recursively those kind of class with the name `kRCTSafeAreaViewClassName`.
|
||||
*/
|
||||
- (NSArray<UIView*>*)overlayViewsIn:(UIView *)view
|
||||
{
|
||||
Class class = NSClassFromString(kRCTSafeAreaViewClassName);
|
||||
if ([view isKindOfClass:class])
|
||||
{
|
||||
return @[view];
|
||||
}
|
||||
|
||||
NSMutableArray<UIView *> *result = [NSMutableArray arrayWithCapacity:2];
|
||||
|
||||
[view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull subview, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
[result addObjectsFromArray:[self overlayViewsIn:subview]];
|
||||
}];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark - JitsiMeetViewDelegate
|
||||
|
||||
- (void)conferenceWillJoin:(NSDictionary *)data
|
||||
@@ -309,6 +338,26 @@ static const NSString *kJitsiDataErrorKey = @"error";
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - PictureInPicturable
|
||||
|
||||
- (void)enterPiP
|
||||
{
|
||||
self.overlayViews = [self overlayViewsIn:self.view];
|
||||
for (UIView *view in self.overlayViews)
|
||||
{
|
||||
view.alpha = 0;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)exitPiP
|
||||
{
|
||||
for (UIView *view in self.overlayViews)
|
||||
{
|
||||
view.alpha = 1.0;
|
||||
}
|
||||
self.overlayViews = nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user