fix: ios12 compatibility
This commit is contained in:
1 parent
d6558c3619
commit
386516ade9
5 files changed
+39
-5
No files matched your search
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||||
|
|
||||||
|
@property (strong, nonatomic) UIWindow *window;
|
||||||
@property (strong, nonatomic) NSString *pcUuidToLoad;
|
@property (strong, nonatomic) NSString *pcUuidToLoad;
|
||||||
@property (strong, nonatomic) void (^shortcutCompletionHandler)(BOOL);
|
@property (strong, nonatomic) void (^shortcutCompletionHandler)(BOOL);
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,27 @@ static NSString* DB_NAME = @"Limelight_iOS.sqlite";
|
|||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||||
// Override point for command tool customization after application launch (works only when user default is nil)
|
// Override point for command tool customization after application launch (works only when user default is nil)
|
||||||
[CommandManager presetDefaultCommands];
|
[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;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
API_AVAILABLE(ios(13.0))
|
||||||
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
|
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
|
||||||
|
|
||||||
@property (strong, nonatomic) UIWindow * window;
|
@property (strong, nonatomic) UIWindow * window;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#import "SceneDelegate.h"
|
#import "SceneDelegate.h"
|
||||||
#import "StreamFrameViewController.h"
|
#import "StreamFrameViewController.h"
|
||||||
|
|
||||||
|
API_AVAILABLE(ios(13.0))
|
||||||
@implementation SceneDelegate
|
@implementation SceneDelegate
|
||||||
|
|
||||||
static UIView *_sharedStreamVideoRenderView = nil;
|
static UIView *_sharedStreamVideoRenderView = nil;
|
||||||
|
|||||||
@@ -810,7 +810,9 @@
|
|||||||
- (void) returnToMainFrame {
|
- (void) returnToMainFrame {
|
||||||
// Reset display mode back to default
|
// Reset display mode back to default
|
||||||
[self updatePreferredDisplayMode:NO];
|
[self updatePreferredDisplayMode:NO];
|
||||||
[SceneDelegate clearExternalDisplayRenderView];
|
if (@available(iOS 13.0, *)) {
|
||||||
|
[SceneDelegate clearExternalDisplayRenderView];
|
||||||
|
}
|
||||||
|
|
||||||
if (_settings.enablePIP) {
|
if (_settings.enablePIP) {
|
||||||
[self cleanupPiPController];
|
[self cleanupPiPController];
|
||||||
@@ -834,7 +836,9 @@
|
|||||||
if (_streamVideoRenderView) {
|
if (_streamVideoRenderView) {
|
||||||
// Remove from current superview before passing it
|
// Remove from current superview before passing it
|
||||||
[_streamVideoRenderView removeFromSuperview];
|
[_streamVideoRenderView removeFromSuperview];
|
||||||
[SceneDelegate setExternalDisplayRenderView:_streamVideoRenderView];
|
if (@available(iOS 13.0, *)) {
|
||||||
|
[SceneDelegate setExternalDisplayRenderView:_streamVideoRenderView];
|
||||||
|
}
|
||||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||||
[nc postNotificationName:@"ScreenChanged" object:self];
|
[nc postNotificationName:@"ScreenChanged" object:self];
|
||||||
} else {
|
} else {
|
||||||
@@ -847,7 +851,9 @@
|
|||||||
- (void)extScreenDidDisconnect:(NSNotification *)notification {
|
- (void)extScreenDidDisconnect:(NSNotification *)notification {
|
||||||
Log(LOG_I, @"External Screen Disconnected");
|
Log(LOG_I, @"External Screen Disconnected");
|
||||||
if(UIScreen.screens.count < 2) {
|
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
|
// Add the render view back to the local StreamView if AirPlay was active
|
||||||
if ([self isAirPlayEnabled]) {
|
if ([self isAirPlayEnabled]) {
|
||||||
if (_streamVideoRenderView && _streamView) {
|
if (_streamVideoRenderView && _streamView) {
|
||||||
@@ -878,9 +884,13 @@
|
|||||||
- (void) reloadAirPlayConfig{
|
- (void) reloadAirPlayConfig{
|
||||||
if (UIScreen.screens.count == 1){return;}
|
if (UIScreen.screens.count == 1){return;}
|
||||||
if (![self isAirPlaying] && [self isAirPlayEnabled]){
|
if (![self isAirPlaying] && [self isAirPlayEnabled]){
|
||||||
[SceneDelegate setExternalDisplayRenderView:_streamVideoRenderView];
|
if (@available(iOS 13.0, *)) {
|
||||||
|
[SceneDelegate setExternalDisplayRenderView:_streamVideoRenderView];
|
||||||
|
}
|
||||||
}else if ([self isAirPlaying] && ![self isAirPlayEnabled]){
|
}else if ([self isAirPlaying] && ![self isAirPlayEnabled]){
|
||||||
[SceneDelegate clearExternalDisplayRenderView];
|
if (@available(iOS 13.0, *)) {
|
||||||
|
[SceneDelegate clearExternalDisplayRenderView];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user