@onekeyfe/react-native-native-overlay 6.7.0-alpha.422 → 6.7.0-alpha.424

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.
package/docs/SPEC.md CHANGED
@@ -472,6 +472,25 @@ Known divergences:
472
472
 
473
473
  ## 5.7 Failure, fallback, and safety
474
474
 
475
+ ### iOS global sheet diagnostics
476
+
477
+ Implemented in source; physical-device verification pending. Native global
478
+ sheets record present/completion, host dismiss/completion/teardown,
479
+ interactive dismiss, appearance/disappearance and unexpected disappearance
480
+ through dynamically resolved OneKeyLog. Missing logger class/selector is a
481
+ no-op and adds no package dependency. These diagnostics do not change the
482
+ presentation, retry, callback, cleanup, or timing contracts.
483
+
484
+ Only process-local temporary controller/presenter counters, wall time,
485
+ fixed stage/reason enums, and lifecycle booleans are logged. Controller addresses,
486
+ descriptions, entry/business identifiers, content, and arbitrary errors are
487
+ excluded. Weak controller keys must not extend controller lifetime. No layout
488
+ or per-frame events are logged. JS and native IDs are independent; timeline
489
+ correlation by time is approximate during concurrent operations. This host
490
+ belongs to main on iOS; background JS has a separate heap and is not an owner
491
+ of these UIKit resources. Native logger persistence is owned by the logger.
492
+
493
+
475
494
  - A page request without host or owner keys throws `OverlayRequestError`. This
476
495
  is a programming error; there is no silent global fallback, unlike today's
477
496
  `Portal.Render` retry.
@@ -574,9 +574,11 @@ final class NativeOverlayEntryView: UIView {
574
574
  }
575
575
  let controller = NativeOverlaySheetController(host: self, style: sheetStyle())
576
576
  sheetController = controller
577
+ NativeOverlayDiagnostic.log("stage=present_begin controllerID=\(NativeOverlayDiagnostic.id(controller)) presenterID=\(NativeOverlayDiagnostic.id(presenter))")
577
578
  phase = .entering
578
579
  presenter.present(controller, animated: true) { [weak self, weak controller] in
579
580
  guard let self, let controller, self.sheetController === controller else { return }
581
+ NativeOverlayDiagnostic.log("stage=present_complete controllerID=\(NativeOverlayDiagnostic.id(controller)) visible=\(self.visible) entering=\(self.phase == .entering)")
580
582
  if self.phase == .entering {
581
583
  self.phase = .shown
582
584
  self.didPresent()
@@ -592,6 +594,7 @@ final class NativeOverlayEntryView: UIView {
592
594
  finishDismiss(reason: "programmatic")
593
595
  return
594
596
  }
597
+ NativeOverlayDiagnostic.log("stage=dismiss_request controllerID=\(NativeOverlayDiagnostic.id(controller)) reason=programmatic presenting=\(controller.isBeingPresented) exiting=\(phase == .exiting)")
595
598
  if controller.resumeHostDismissal() {
596
599
  phase = .exiting
597
600
  return
@@ -602,6 +605,7 @@ final class NativeOverlayEntryView: UIView {
602
605
  controller.dismissRequestedByHost = true
603
606
  controller.dismiss(animated: true) { [weak self, weak controller] in
604
607
  guard let self, self.sheetController === controller, self.phase == .exiting else { return }
608
+ NativeOverlayDiagnostic.log("stage=dismiss_complete controllerID=\(NativeOverlayDiagnostic.id(controller)) reason=programmatic")
605
609
  self.finishDismiss(reason: "programmatic")
606
610
  }
607
611
  }
@@ -612,6 +616,7 @@ final class NativeOverlayEntryView: UIView {
612
616
  touchHandler.perform(NSSelectorFromString("detachFromView:"), with: controller.view)
613
617
  }
614
618
  stageContent()
619
+ NativeOverlayDiagnostic.log("stage=teardown controllerID=\(NativeOverlayDiagnostic.id(controller)) presented=\(controller.presentingViewController != nil) dismissing=\(controller.isBeingDismissed)")
615
620
  if controller.presentingViewController != nil, !controller.isBeingDismissed {
616
621
  controller.dismissRequestedByHost = true
617
622
  controller.dismiss(animated: false)
@@ -705,6 +710,7 @@ extension NativeOverlayContainerView: NativeOverlaySheetHost {
705
710
 
706
711
  func sheetDidDisappearUnexpectedly(_ controller: NativeOverlaySheetController) {
707
712
  guard sheetController === controller else { return }
713
+ NativeOverlayDiagnostic.log("stage=unexpected_disappear controllerID=\(NativeOverlayDiagnostic.id(controller)) visible=\(visible) reason=system")
708
714
  finishDismiss(reason: "system")
709
715
  }
710
716
 
@@ -277,6 +277,7 @@ final class NativeOverlaySheetController: UIViewController,
277
277
 
278
278
  override func viewDidAppear(_ animated: Bool) {
279
279
  super.viewDidAppear(animated)
280
+ NativeOverlayDiagnostic.log("stage=did_appear controllerID=\(NativeOverlayDiagnostic.id(self)) presenterID=\(NativeOverlayDiagnostic.id(presentingViewController))")
280
281
  stopSuppressingPresentationShadow()
281
282
  }
282
283
 
@@ -287,6 +288,7 @@ final class NativeOverlaySheetController: UIViewController,
287
288
 
288
289
  override func viewDidDisappear(_ animated: Bool) {
289
290
  super.viewDidDisappear(animated)
291
+ NativeOverlayDiagnostic.log("stage=did_disappear controllerID=\(NativeOverlayDiagnostic.id(self)) presenterID=\(NativeOverlayDiagnostic.id(presentingViewController)) hostRequested=\(dismissRequestedByHost)")
290
292
  if let backdropTap {
291
293
  dimmingView?.removeGestureRecognizer(backdropTap)
292
294
  }
@@ -319,6 +321,7 @@ final class NativeOverlaySheetController: UIViewController,
319
321
  }
320
322
 
321
323
  func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
324
+ NativeOverlayDiagnostic.log("stage=interactive_dismiss controllerID=\(NativeOverlayDiagnostic.id(self)) reason=pan")
322
325
  dismissRequestedByHost = true
323
326
  host?.sheetDidDismissInteractively(self)
324
327
  }
@@ -1,4 +1,29 @@
1
1
  import UIKit
2
+ import ObjectiveC
3
+
4
+ /// IDs are process-local and weakly keyed; never log controller descriptions or addresses.
5
+ enum NativeOverlayDiagnostic {
6
+ private static var nextID = 0
7
+ private static let controllerIDs = NSMapTable<UIViewController, NSNumber>.weakToStrongObjects()
8
+
9
+ static func id(_ controller: UIViewController?) -> Int {
10
+ guard let controller else { return 0 }
11
+ if let existing = controllerIDs.object(forKey: controller) { return existing.intValue }
12
+ nextID += 1
13
+ controllerIDs.setObject(NSNumber(value: nextID), forKey: controller)
14
+ return nextID
15
+ }
16
+
17
+ static func log(_ details: String) {
18
+ guard let logClass = NSClassFromString("ReactNativeNativeLogger.OneKeyLog")
19
+ ?? NSClassFromString("OneKeyLog"),
20
+ let method = class_getClassMethod(logClass, NSSelectorFromString("info::")) else { return }
21
+ typealias LogFunction = @convention(c) (AnyClass, Selector, NSString, NSString) -> Void
22
+ let log = unsafeBitCast(method_getImplementation(method), to: LogFunction.self)
23
+ log(logClass, NSSelectorFromString("info::"), "NativeOverlay",
24
+ "wallTimeMs=\(Int64(Date().timeIntervalSince1970 * 1000)) \(details)" as NSString)
25
+ }
26
+ }
2
27
 
3
28
  /// Levels mirror `OVERLAY_LEVEL_ORDER`. Each active level gets its own
4
29
  /// window so that order between levels never depends on show order.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-native-overlay",
3
- "version": "6.7.0-alpha.422",
3
+ "version": "6.7.0-alpha.424",
4
4
  "description": "Native and Web overlay hosts with ordered levels, page scope and Fabric measurement",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",