@tokamakdev/platform-ios-simulator-x64 0.1.1-beta.75 → 0.1.1-beta.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
|
@@ -231,6 +231,10 @@ private final class TokamakController {
|
|
|
231
231
|
self.host = host
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
deinit {
|
|
235
|
+
pluginBridge?.close()
|
|
236
|
+
}
|
|
237
|
+
|
|
234
238
|
func start(frame: CGRect, completion: @escaping (WKWebView) -> Void) {
|
|
235
239
|
host.whenStarted { result in
|
|
236
240
|
switch result {
|
|
@@ -368,31 +372,28 @@ private final class TokamakController {
|
|
|
368
372
|
}
|
|
369
373
|
}
|
|
370
374
|
#else
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
func
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
webView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
388
|
-
viewController.view.addSubview(webView)
|
|
389
|
-
}
|
|
390
|
-
return true
|
|
375
|
+
@main
|
|
376
|
+
private enum TokamakApplication {
|
|
377
|
+
/// Only an app that declares the `remote-notification` background mode
|
|
378
|
+
/// gets a delegate that receives remote notifications, which UIKit
|
|
379
|
+
/// otherwise warns about.
|
|
380
|
+
static func main() {
|
|
381
|
+
let modes = Bundle.main.object(forInfoDictionaryKey: "UIBackgroundModes") as? [String]
|
|
382
|
+
let delegate: TokamakIOSApplicationDelegate.Type =
|
|
383
|
+
modes?.contains("remote-notification") == true
|
|
384
|
+
? TokamakIOSPushApplicationDelegate.self : TokamakIOSApplicationDelegate.self
|
|
385
|
+
UIApplicationMain(
|
|
386
|
+
CommandLine.argc,
|
|
387
|
+
CommandLine.unsafeArgv,
|
|
388
|
+
nil,
|
|
389
|
+
NSStringFromClass(delegate)
|
|
390
|
+
)
|
|
391
391
|
}
|
|
392
|
+
}
|
|
392
393
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
private class TokamakIOSApplicationDelegate: UIResponder, UIApplicationDelegate {
|
|
395
|
+
/// Exists from launch, whether or not a scene connects.
|
|
396
|
+
let host = TokamakHost()
|
|
396
397
|
|
|
397
398
|
func application(
|
|
398
399
|
_ application: UIApplication,
|
|
@@ -407,7 +408,9 @@ private final class TokamakController {
|
|
|
407
408
|
) {
|
|
408
409
|
host.didFailToRegisterForRemoteNotifications(error: error)
|
|
409
410
|
}
|
|
411
|
+
}
|
|
410
412
|
|
|
413
|
+
private final class TokamakIOSPushApplicationDelegate: TokamakIOSApplicationDelegate {
|
|
411
414
|
func application(
|
|
412
415
|
_ application: UIApplication,
|
|
413
416
|
didReceiveRemoteNotification userInfo: [AnyHashable: Any],
|
|
@@ -423,15 +426,41 @@ private final class TokamakController {
|
|
|
423
426
|
}
|
|
424
427
|
}
|
|
425
428
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
429
|
+
/// The Info.plist scene configuration names this class.
|
|
430
|
+
@objc(TokamakSceneDelegate)
|
|
431
|
+
private final class TokamakSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
432
|
+
var window: UIWindow?
|
|
433
|
+
private var controller: TokamakController?
|
|
434
|
+
|
|
435
|
+
func scene(
|
|
436
|
+
_ scene: UIScene,
|
|
437
|
+
willConnectTo session: UISceneSession,
|
|
438
|
+
options connectionOptions: UIScene.ConnectionOptions
|
|
439
|
+
) {
|
|
440
|
+
guard let scene = scene as? UIWindowScene else { return }
|
|
441
|
+
let host = (UIApplication.shared.delegate as! TokamakIOSApplicationDelegate).host
|
|
442
|
+
let viewController = UIViewController()
|
|
443
|
+
let window = UIWindow(windowScene: scene)
|
|
444
|
+
window.rootViewController = viewController
|
|
445
|
+
window.makeKeyAndVisible()
|
|
446
|
+
self.window = window
|
|
447
|
+
|
|
448
|
+
let controller = TokamakController(host: host)
|
|
449
|
+
controller.start(frame: viewController.view.bounds) { webView in
|
|
450
|
+
webView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
451
|
+
viewController.view.addSubview(webView)
|
|
452
|
+
}
|
|
453
|
+
self.controller = controller
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
func sceneWillEnterForeground(_ scene: UIScene) {
|
|
457
|
+
controller?.restoreGateway()
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/// Releases the scene's window and page, which a reconnection recreates.
|
|
461
|
+
func sceneDidDisconnect(_ scene: UIScene) {
|
|
462
|
+
window = nil
|
|
463
|
+
controller = nil
|
|
435
464
|
}
|
|
436
465
|
}
|
|
437
466
|
#endif
|
|
Binary file
|