Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): fix debug issues with scenes #13979

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,10 @@
#import "TiRootViewController.h"
#import <JavaScriptCore/JavaScriptCore.h>

extern BOOL applicationInMemoryPanic; // TODO: Remove in SDK 9.0+

// TODO: Remove in SDK 9.0+
TI_INLINE void waitForMemoryPanicCleared() //WARNING: This must never be run on main thread, or else there is a risk of deadlock!
{
}

/**
TiApp represents an instance of an application. There is always only one instance per application which could be accessed through <app> class method.
*/
@interface TiApp : TiHost <UIApplicationDelegate, NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDownloadDelegate, UNUserNotificationCenterDelegate> {
@interface TiApp : TiHost <UIApplicationDelegate, NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDownloadDelegate, UNUserNotificationCenterDelegate, UIWindowSceneDelegate> {
UIWindow *window;
UIImageView *loadView;
UIView *splashScreenView;
Expand Down
39 changes: 22 additions & 17 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@

#define SHUTDOWN_TIMEOUT_IN_SEC 3

BOOL applicationInMemoryPanic = NO; // TODO: Remove in SDK 9.0+

// TODO: Remove in SDK 9.0+
TI_INLINE void waitForMemoryPanicCleared(void); //WARNING: This must never be run on main thread, or else there is a risk of deadlock!

@interface TiApp ()
- (void)checkBackgroundServices;
- (void)appBoot;
Expand Down Expand Up @@ -327,15 +322,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[[TiLogServer defaultLogServer] start];
}

// Initialize the root-window
window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

// Initialize the launch options to be used by the client
launchOptions = [[NSMutableDictionary alloc] initWithDictionary:launchOptions_];

// Initialize the root-controller
[self initController];

// If we have a APNS-UUID, assign it
NSString *apnsUUID = [[NSUserDefaults standardUserDefaults] stringForKey:@"APNSRemoteDeviceUUID"];
if (apnsUUID != nil) {
Expand Down Expand Up @@ -427,12 +416,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// If a "application-launch-url" is set, launch it directly
[self launchToUrl];

// Boot our kroll-core
[self boot];

// Create application support directory if not exists
[self createDefaultDirectories];

return YES;
}

Expand Down Expand Up @@ -1235,6 +1218,28 @@ - (KrollBridge *)krollBridge
return kjsBridge;
}

#pragma mark UIWindowSceneDelegate

- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options
{
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
}

- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions
{
// Initialize the root-window
window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];

// Initialize the root-controller
[self initController];

// Boot our kroll-core
[self boot];

// Create application support directory if not exists
[self createDefaultDirectories];
}

#pragma mark Background Tasks

- (void)beginBackgrounding
Expand Down
17 changes: 17 additions & 0 deletions iphone/iphone/Titanium.plist
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,22 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>TiApp</string>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>
17 changes: 17 additions & 0 deletions support/iphone/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,22 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>TiApp</string>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>
Loading