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

feat(ios): support multi-scene applications [Do not merge] #14195

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
@@ -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;
27 changes: 16 additions & 11 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.m
Original file line number Diff line number Diff line change
@@ -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;
@@ -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) {
@@ -1235,6 +1224,22 @@ - (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];
}

#pragma mark Background Tasks

- (void)beginBackgrounding
17 changes: 17 additions & 0 deletions iphone/iphone/Titanium.plist
Original file line number Diff line number Diff line change
@@ -74,5 +74,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
@@ -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>

Unchanged files with check annotations Beta

describe('Buffer', () => {
it('is available off the \'buffer\' module as Buffer', () => {
should.exist(BufferModule.Buffer);

Check warning on line 51 in tests/Resources/buffer.test.js

GitHub Actions / JavaScript

Unexpected use of 'require("buffer").Buffer'. Use the global variable 'Buffer' instead
});
it('is available off global', () => {
const logFile = path.join(HOME, `Library/Containers/${builder.tiapp.id}/Data/Documents/${builder.tiapp.guid}.log`);
// TODO: It does force quit. Find another way to quit.
exec(`pkill -QUIT -x ${builder.tiapp.name}`, function () {

Check warning on line 102 in iphone/cli/hooks/run.js

GitHub Actions / JavaScript

Found child_process.exec() with non Literal first argument
// If there's already a log file from previous run, wipe it
if (fs.pathExistsSync(logFile)) {
try {
// if not build-only open xcode + organizer after packaging, otherwise finish
if (!cli.argv['build-only']) {
logger.info(__('Launching Xcode: %s', builder.xcodeEnv.xcodeapp.cyan));
exec('open -a "' + builder.xcodeEnv.xcodeapp + '"', function () {

Check warning on line 143 in iphone/cli/hooks/package.js

GitHub Actions / JavaScript

Found child_process.exec() with non Literal first argument
process.env.TI_ENV_NAME = process.env.STUDIO_NAME || 'Terminal.app';
exec('osascript "' + path.join(builder.platformPath, 'xcode_organizer.scpt') + '"', { env: process.env }, function () {

Check warning on line 145 in iphone/cli/hooks/package.js

GitHub Actions / JavaScript

Found child_process.exec() with non Literal first argument
logger.info(__('Packaging complete'));
finished();
});
const cmd = cmds[index++];
if (cmd) {
logger.debug(cmd);
exec(cmd, processNextCommand);

Check warning on line 117 in iphone/cli/hooks/hyperloop.js

GitHub Actions / JavaScript

Found child_process.exec() with non Literal first argument
} else {
next();
}
*/
detectBinaryTypeAndArchitectures(binaryPathAndFilename) {
return new Promise((resolve, reject) => {
exec('file -b "' + binaryPathAndFilename + '"', (error, stdout) => {

Check warning on line 836 in iphone/cli/hooks/frameworks.js

GitHub Actions / JavaScript

Found child_process.exec() with non Literal first argument
if (error) {
return reject(error);
}
}
if (this.excludeAssestsDir !== null) {
let testPath = this.excludeAssestsDir;
const checkRegEx = new RegExp(`${testPath}`);

Check warning on line 276 in cli/lib/gather.js

GitHub Actions / JavaScript

Found non-literal argument to RegExp Constructor
if (!relPath.match(checkRegEx)) {
results.imageAssets.set(relPath, info);
return;
if (this.useAppThinning && !relPath.match(BUNDLE_FILE_REGEXP)) {
if (this.excludeAssestsDir !== null) {
let testPath = this.excludeAssestsDir;
const checkRegEx = new RegExp(`${testPath}`);

Check warning on line 315 in cli/lib/gather.js

GitHub Actions / JavaScript

Found non-literal argument to RegExp Constructor
if (!relPath.match(checkRegEx)) {
results.imageAssets.set(relPath, info);
return;
// Run the gradlew command line async.
await new Promise((resolve, reject) => {
const childProcess = exec(commandLineString, { cwd: this._gradlewDirPath });

Check warning on line 210 in android/cli/lib/gradle-wrapper.js

GitHub Actions / JavaScript

Found child_process.exec() with non Literal first argument
if (this._logger) {
childProcess.stdout.on('data', createReadableDataHandlerUsing(this._logger, 'info'));
childProcess.stderr.on('data', createReadableDataHandlerUsing(this._logger, 'error'));
appc.subprocess.run('appc', [ '-q', 'config', 'get', 'proxyServer' ], runOptions, (exitCode, out) => {
try {
if (!exitCode && out && (out.length > 0)) {
proxyUrl = url.parse(out.trim());

Check warning on line 300 in android/cli/lib/gradle-wrapper.js

GitHub Actions / JavaScript

'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead
}
} catch (ex) {
if (this._logger) {