fix: ios12 compatibility
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
@property (strong, nonatomic) NSString *pcUuidToLoad;
|
||||
@property (strong, nonatomic) void (^shortcutCompletionHandler)(BOOL);
|
||||
|
||||
|
||||
@@ -60,6 +60,27 @@ static NSString* DB_NAME = @"Limelight_iOS.sqlite";
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// Override point for command tool customization after application launch (works only when user default is nil)
|
||||
[CommandManager presetDefaultCommands];
|
||||
|
||||
// For iOS 12 and below, we need to manually create the window
|
||||
if (@available(iOS 13.0, *)) {
|
||||
// Scene delegate will handle window creation
|
||||
} else {
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
|
||||
NSString *storyboardName;
|
||||
if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
|
||||
storyboardName = @"iPad";
|
||||
} else {
|
||||
storyboardName = @"iPhone";
|
||||
}
|
||||
|
||||
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle:nil];
|
||||
UIViewController *initialViewController = [storyboard instantiateInitialViewController];
|
||||
|
||||
self.window.rootViewController = initialViewController;
|
||||
[self.window makeKeyAndVisible];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
API_AVAILABLE(ios(13.0))
|
||||
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow * window;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#import "SceneDelegate.h"
|
||||
#import "StreamFrameViewController.h"
|
||||
|
||||
API_AVAILABLE(ios(13.0))
|
||||
@implementation SceneDelegate
|
||||
|
||||
static UIView *_sharedStreamVideoRenderView = nil;
|
||||
|
||||
@@ -810,7 +810,9 @@
|
||||
- (void) returnToMainFrame {
|
||||
// Reset display mode back to default
|
||||
[self updatePreferredDisplayMode:NO];
|
||||
[SceneDelegate clearExternalDisplayRenderView];
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[SceneDelegate clearExternalDisplayRenderView];
|
||||
}
|
||||
|
||||
if (_settings.enablePIP) {
|
||||
[self cleanupPiPController];
|
||||
@@ -834,7 +836,9 @@
|
||||
if (_streamVideoRenderView) {
|
||||
// Remove from current superview before passing it
|
||||
[_streamVideoRenderView removeFromSuperview];
|
||||
[SceneDelegate setExternalDisplayRenderView:_streamVideoRenderView];
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[SceneDelegate setExternalDisplayRenderView:_streamVideoRenderView];
|
||||
}
|
||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||
[nc postNotificationName:@"ScreenChanged" object:self];
|
||||
} else {
|
||||
@@ -847,7 +851,9 @@
|
||||
- (void)extScreenDidDisconnect:(NSNotification *)notification {
|
||||
Log(LOG_I, @"External Screen Disconnected");
|
||||
if(UIScreen.screens.count < 2) {
|
||||
[SceneDelegate clearExternalDisplayRenderView];
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[SceneDelegate clearExternalDisplayRenderView];
|
||||
}
|
||||
// Add the render view back to the local StreamView if AirPlay was active
|
||||
if ([self isAirPlayEnabled]) {
|
||||
if (_streamVideoRenderView && _streamView) {
|
||||
@@ -878,9 +884,13 @@
|
||||
- (void) reloadAirPlayConfig{
|
||||
if (UIScreen.screens.count == 1){return;}
|
||||
if (![self isAirPlaying] && [self isAirPlayEnabled]){
|
||||
[SceneDelegate setExternalDisplayRenderView:_streamVideoRenderView];
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[SceneDelegate setExternalDisplayRenderView:_streamVideoRenderView];
|
||||
}
|
||||
}else if ([self isAirPlaying] && ![self isAirPlayEnabled]){
|
||||
[SceneDelegate clearExternalDisplayRenderView];
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[SceneDelegate clearExternalDisplayRenderView];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user