@akylas/nativescript 9.0.25 → 9.1.5
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/abortcontroller/abortsignal.js.map +1 -1
- package/abortcontroller/index.js.map +1 -1
- package/accessibility/accessibility-common.js.map +1 -1
- package/accessibility/accessibility-css-helper.js.map +1 -1
- package/accessibility/accessibility-properties.js.map +1 -1
- package/accessibility/accessibility-service-common.js.map +1 -1
- package/accessibility/accessibility-service.android.js.map +1 -1
- package/accessibility/accessibility-service.ios.js.map +1 -1
- package/accessibility/accessibility-types.js.map +1 -1
- package/accessibility/font-scale-common.js.map +1 -1
- package/accessibility/font-scale.android.js.map +1 -1
- package/accessibility/font-scale.ios.js.map +1 -1
- package/accessibility/index.android.js.map +1 -1
- package/accessibility/index.ios.js.map +1 -1
- package/animation-frame/animation-native.android.js.map +1 -1
- package/animation-frame/animation-native.ios.js.map +1 -1
- package/animation-frame/index.js.map +1 -1
- package/application/application-common.d.ts +205 -3
- package/application/application-common.js +438 -55
- package/application/application-common.js.map +1 -1
- package/application/application-interfaces.d.ts +67 -1
- package/application/application-interfaces.js.map +1 -1
- package/application/application-shims.js.map +1 -1
- package/application/application.android.d.ts +39 -0
- package/application/application.android.js +239 -18
- package/application/application.android.js.map +1 -1
- package/application/application.d.ts +161 -54
- package/application/application.ios.d.ts +189 -28
- package/application/application.ios.js +892 -390
- package/application/application.ios.js.map +1 -1
- package/application/helpers-common.d.ts +7 -0
- package/application/helpers-common.js +46 -1
- package/application/helpers-common.js.map +1 -1
- package/application/helpers.android.js.map +1 -1
- package/application/helpers.ios.js.map +1 -1
- package/application/index.android.js.map +1 -1
- package/application/index.ios.js.map +1 -1
- package/application/scene-delegate-bridge.d.ts +60 -0
- package/application/scene-delegate-bridge.js +138 -0
- package/application/scene-delegate-bridge.js.map +1 -0
- package/application-settings/application-settings-common.js.map +1 -1
- package/application-settings/index.android.js.map +1 -1
- package/application-settings/index.ios.js.map +1 -1
- package/bundle-entry-points.js.map +1 -1
- package/cli-hooks/before-checkForChanges.mjs +0 -11
- package/color/color-common.js +16 -5
- package/color/color-common.js.map +1 -1
- package/color/color-types.js.map +1 -1
- package/color/color-utils.d.ts +4 -1
- package/color/color-utils.js +14 -9
- package/color/color-utils.js.map +1 -1
- package/color/index.android.js.map +1 -1
- package/color/index.ios.js.map +1 -1
- package/color/known-colors.js.map +1 -1
- package/config/config.interface.d.ts +45 -3
- package/config/config.interface.js.map +1 -1
- package/config/index.js.map +1 -1
- package/connectivity/index.android.js.map +1 -1
- package/connectivity/index.ios.js.map +1 -1
- package/console/index.js.map +1 -1
- package/core-types/animation-types.js.map +1 -1
- package/core-types/index.d.ts +25 -2
- package/core-types/index.js +23 -0
- package/core-types/index.js.map +1 -1
- package/core-types/validators.js.map +1 -1
- package/css/CSS3Parser.js +3 -2
- package/css/CSS3Parser.js.map +1 -1
- package/css/CSSNativeScript.js.map +1 -1
- package/css/css-tree-parser.js +5 -1
- package/css/css-tree-parser.js.map +1 -1
- package/css/lib/parse/index.js +5 -1
- package/css/lib/parse/index.js.map +1 -1
- package/css/parser.js +20 -3
- package/css/parser.js.map +1 -1
- package/css/reworkcss.js.map +1 -1
- package/css/system-classes.d.ts +9 -0
- package/css/system-classes.js +23 -0
- package/css/system-classes.js.map +1 -1
- package/css-mediaquery/index.d.ts +6 -1
- package/css-mediaquery/index.js +35 -6
- package/css-mediaquery/index.js.map +1 -1
- package/css-value/reworkcss-value.js.map +1 -1
- package/data/observable/index.d.ts +23 -0
- package/data/observable/index.js +50 -9
- package/data/observable/index.js.map +1 -1
- package/data/observable-array/index.js.map +1 -1
- package/data/virtual-array/index.js.map +1 -1
- package/debugger/InspectorBackendCommands.js.map +1 -1
- package/debugger/devtools-elements-interfaces.js.map +1 -1
- package/debugger/devtools-elements.common.js.map +1 -1
- package/debugger/devtools-elements.js.map +1 -1
- package/debugger/dom-types.js +31 -1
- package/debugger/dom-types.js.map +1 -1
- package/debugger/index.js.map +1 -1
- package/debugger/webinspector-css.js.map +1 -1
- package/debugger/webinspector-dom.js.map +1 -1
- package/debugger/webinspector-network.android.js.map +1 -1
- package/debugger/webinspector-network.d.ts +29 -0
- package/debugger/webinspector-network.ios.js.map +1 -1
- package/fetch/index.d.ts +79 -0
- package/fetch/index.js +408 -0
- package/fetch/index.js.map +1 -0
- package/file-system/file-system-access.android.d.ts +1 -0
- package/file-system/file-system-access.android.js +18 -21
- package/file-system/file-system-access.android.js.map +1 -1
- package/file-system/file-system-access.ios.js +21 -13
- package/file-system/file-system-access.ios.js.map +1 -1
- package/file-system/index.d.ts +3 -3
- package/file-system/index.js.map +1 -1
- package/fps-meter/fps-native.android.js.map +1 -1
- package/fps-meter/fps-native.ios.js.map +1 -1
- package/fps-meter/index.js.map +1 -1
- package/global-types.d.ts +40 -34
- package/globals/global-utils.d.ts +6 -1
- package/globals/global-utils.js +10 -5
- package/globals/global-utils.js.map +1 -1
- package/globals/index.js +22 -9
- package/globals/index.js.map +1 -1
- package/globals/polyfills/polyfill-xhr.js.map +1 -1
- package/globals/polyfills/utils.js +2 -0
- package/globals/polyfills/utils.js.map +1 -1
- package/http/http-interfaces.js.map +1 -1
- package/http/http-request/http-request-common.js.map +1 -1
- package/http/http-request/index.android.js +5 -1
- package/http/http-request/index.android.js.map +1 -1
- package/http/http-request/index.ios.js.map +1 -1
- package/http/http-request-internal/http-request-internal-common.d.ts +6 -1
- package/http/http-request-internal/http-request-internal-common.js +19 -0
- package/http/http-request-internal/http-request-internal-common.js.map +1 -1
- package/http/http-request-internal/index.android.d.ts +7 -1
- package/http/http-request-internal/index.android.js +8 -6
- package/http/http-request-internal/index.android.js.map +1 -1
- package/http/http-request-internal/index.ios.d.ts +7 -1
- package/http/http-request-internal/index.ios.js +34 -17
- package/http/http-request-internal/index.ios.js.map +1 -1
- package/http/index.js.map +1 -1
- package/image-asset/image-asset-common.js.map +1 -1
- package/image-asset/index.android.js.map +1 -1
- package/image-asset/index.ios.js.map +1 -1
- package/image-source/image-source-common.js.map +1 -1
- package/image-source/index.android.js.map +1 -1
- package/image-source/index.ios.js +7 -6
- package/image-source/index.ios.js.map +1 -1
- package/index.d.ts +3 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/inspector_modules.js +1 -1
- package/inspector_modules.js.map +1 -1
- package/js-libs/easysax/easysax.d.ts +49 -7
- package/js-libs/easysax/easysax.js +631 -747
- package/js-libs/easysax/easysax.js.map +1 -0
- package/matrix/index.js.map +1 -1
- package/media-query-list/index.js +57 -15
- package/media-query-list/index.js.map +1 -1
- package/module-name-resolver/helpers.d.ts +1 -1
- package/module-name-resolver/helpers.js.map +1 -1
- package/module-name-resolver/index.d.ts +2 -2
- package/module-name-resolver/index.js.map +1 -1
- package/module-name-resolver/non-bundle-workflow-compat.js.map +1 -1
- package/module-name-resolver/qualifier-matcher/index.js.map +1 -1
- package/native-window/index.d.ts +426 -0
- package/native-window/index.js +4 -0
- package/native-window/index.js.map +1 -0
- package/native-window/native-window-common.d.ts +153 -0
- package/native-window/native-window-common.js +340 -0
- package/native-window/native-window-common.js.map +1 -0
- package/native-window/native-window-interfaces.d.ts +186 -0
- package/native-window/native-window-interfaces.js +90 -0
- package/native-window/native-window-interfaces.js.map +1 -0
- package/native-window/native-window.android.d.ts +59 -0
- package/native-window/native-window.android.js +175 -0
- package/native-window/native-window.android.js.map +1 -0
- package/native-window/native-window.ios.d.ts +61 -0
- package/native-window/native-window.ios.js +218 -0
- package/native-window/native-window.ios.js.map +1 -0
- package/native-window/window-base.d.ts +111 -0
- package/native-window/window-base.js +91 -0
- package/native-window/window-base.js.map +1 -0
- package/package.json +3 -3
- package/platform/common.js.map +1 -1
- package/platform/device/index.android.js.map +1 -1
- package/platform/device/index.ios.js.map +1 -1
- package/platform/index.js.map +1 -1
- package/platform/screen/index.android.js.map +1 -1
- package/platform/screen/index.ios.d.ts +1 -0
- package/platform/screen/index.ios.js +6 -2
- package/platform/screen/index.ios.js.map +1 -1
- package/platforms/android/java/org/nativescript/widgets/BorderDrawable.java +5 -6
- package/platforms/android/java/org/nativescript/widgets/BoxShadowDrawable.java +0 -6
- package/platforms/android/java/org/nativescript/widgets/CommonLayoutParams.java +56 -0
- package/platforms/android/java/org/nativescript/widgets/ContentLayout.java +20 -4
- package/platforms/android/java/org/nativescript/widgets/CustomTransition.java +26 -9
- package/platforms/android/java/org/nativescript/widgets/FlexLine.java +3 -3
- package/platforms/android/java/org/nativescript/widgets/FlexboxLayout.java +194 -731
- package/platforms/android/java/org/nativescript/widgets/ImageView.java +2 -2
- package/platforms/android/java/org/nativescript/widgets/Utils.java +37 -9
- package/platforms/android/java/org/nativescript/widgets/ViewHelper.java +78 -0
- package/platforms/android/java/org/nativescript/widgets/image/BitmapOwner.java +1 -4
- package/platforms/android/java/org/nativescript/widgets/image/Worker.java +99 -76
- package/platforms/android/native-api-usage.json +11 -0
- package/platforms/ios/src/NativeScriptMainWindow.swift +72 -39
- package/profiling/index.js.map +1 -1
- package/references.d.ts +5 -2
- package/text/formatted-string.js.map +1 -1
- package/text/index.android.js.map +1 -1
- package/text/index.ios.js.map +1 -1
- package/text/span.js.map +1 -1
- package/text/text-common.js +1 -1
- package/text/text-common.js.map +1 -1
- package/timer/index.android.js +2 -1
- package/timer/index.android.js.map +1 -1
- package/timer/index.ios.js.map +1 -1
- package/trace/index.d.ts +2 -2
- package/trace/index.js.map +1 -1
- package/ui/action-bar/action-bar-common.js.map +1 -1
- package/ui/action-bar/index.android.js +7 -11
- package/ui/action-bar/index.android.js.map +1 -1
- package/ui/action-bar/index.d.ts +13 -1
- package/ui/action-bar/index.ios.js +26 -0
- package/ui/action-bar/index.ios.js.map +1 -1
- package/ui/activity-indicator/activity-indicator-common.js.map +1 -1
- package/ui/activity-indicator/index.android.js.map +1 -1
- package/ui/activity-indicator/index.ios.js.map +1 -1
- package/ui/animation/animation-common.js.map +1 -1
- package/ui/animation/animation-interfaces.js.map +1 -1
- package/ui/animation/animation-shared.js.map +1 -1
- package/ui/animation/animation-types.js.map +1 -1
- package/ui/animation/index.android.js.map +1 -1
- package/ui/animation/index.ios.js +6 -1
- package/ui/animation/index.ios.js.map +1 -1
- package/ui/animation/keyframe-animation.d.ts +3 -1
- package/ui/animation/keyframe-animation.js +72 -3
- package/ui/animation/keyframe-animation.js.map +1 -1
- package/ui/builder/binding-builder.d.ts +8 -0
- package/ui/builder/binding-builder.js +12 -0
- package/ui/builder/binding-builder.js.map +1 -1
- package/ui/builder/component-builder/index.d.ts +7 -4
- package/ui/builder/component-builder/index.js +13 -7
- package/ui/builder/component-builder/index.js.map +1 -1
- package/ui/builder/index.d.ts +16 -2
- package/ui/builder/index.js +61 -13
- package/ui/builder/index.js.map +1 -1
- package/ui/button/button-common.js.map +1 -1
- package/ui/button/index.android.js +4 -3
- package/ui/button/index.android.js.map +1 -1
- package/ui/button/index.ios.js.map +1 -1
- package/ui/content-view/index.js +2 -0
- package/ui/content-view/index.js.map +1 -1
- package/ui/core/bindable/bindable-expressions.js.map +1 -1
- package/ui/core/bindable/bindable-resources.js.map +1 -1
- package/ui/core/bindable/bindable-types.d.ts +15 -0
- package/ui/core/bindable/bindable-types.js.map +1 -1
- package/ui/core/bindable/index.d.ts +1 -1
- package/ui/core/bindable/index.js +14 -8
- package/ui/core/bindable/index.js.map +1 -1
- package/ui/core/control-state-change/index.android.js.map +1 -1
- package/ui/core/control-state-change/index.ios.js.map +1 -1
- package/ui/core/properties/index.d.ts +37 -2
- package/ui/core/properties/index.js +205 -29
- package/ui/core/properties/index.js.map +1 -1
- package/ui/core/properties/property-shared.js +11 -2
- package/ui/core/properties/property-shared.js.map +1 -1
- package/ui/core/view/index.android.d.ts +5 -0
- package/ui/core/view/index.android.js +89 -15
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/index.d.ts +58 -1
- package/ui/core/view/index.ios.d.ts +1 -0
- package/ui/core/view/index.ios.js +48 -11
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/view-common.d.ts +37 -0
- package/ui/core/view/view-common.js +81 -0
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.android.d.ts +1 -0
- package/ui/core/view/view-helper/index.android.js +8 -0
- package/ui/core/view/view-helper/index.android.js.map +1 -1
- package/ui/core/view/view-helper/index.d.ts +46 -0
- package/ui/core/view/view-helper/index.ios.d.ts +42 -0
- package/ui/core/view/view-helper/index.ios.js +170 -5
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/view/view-helper/view-helper-common.js +21 -3
- package/ui/core/view/view-helper/view-helper-common.js.map +1 -1
- package/ui/core/view/view-helper/view-helper-shared.js.map +1 -1
- package/ui/core/view/view-interfaces.js.map +1 -1
- package/ui/core/view-base/index.js +75 -36
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/core/view-base/utils.js.map +1 -1
- package/ui/core/weak-event-listener/index.js.map +1 -1
- package/ui/date-picker/date-picker-common.js.map +1 -1
- package/ui/date-picker/index.android.js +1 -1
- package/ui/date-picker/index.android.js.map +1 -1
- package/ui/date-picker/index.ios.js.map +1 -1
- package/ui/dialogs/dialogs-common.js.map +1 -1
- package/ui/dialogs/index.android.js +5 -5
- package/ui/dialogs/index.android.js.map +1 -1
- package/ui/dialogs/index.ios.js.map +1 -1
- package/ui/editable-text-base/editable-text-base-common.js.map +1 -1
- package/ui/editable-text-base/index.android.d.ts +2 -0
- package/ui/editable-text-base/index.android.js +17 -7
- package/ui/editable-text-base/index.android.js.map +1 -1
- package/ui/editable-text-base/index.d.ts +8 -0
- package/ui/editable-text-base/index.ios.js.map +1 -1
- package/ui/embedding/index.android.js.map +1 -1
- package/ui/embedding/index.ios.js.map +1 -1
- package/ui/enums/enums.js.map +1 -1
- package/ui/enums/index.js.map +1 -1
- package/ui/frame/activity.android.js.map +1 -1
- package/ui/frame/fragment.android.js.map +1 -1
- package/ui/frame/fragment.ios.js.map +1 -1
- package/ui/frame/fragment.transitions.android.d.ts +12 -9
- package/ui/frame/fragment.transitions.android.js +105 -90
- package/ui/frame/fragment.transitions.android.js.map +1 -1
- package/ui/frame/fragment.transitions.types.js.map +1 -1
- package/ui/frame/frame-common.d.ts +14 -2
- package/ui/frame/frame-common.js +51 -24
- package/ui/frame/frame-common.js.map +1 -1
- package/ui/frame/frame-constants.d.ts +9 -0
- package/ui/frame/frame-constants.js +10 -0
- package/ui/frame/frame-constants.js.map +1 -0
- package/ui/frame/frame-helper-for-android.d.ts +2 -2
- package/ui/frame/frame-helper-for-android.js +14 -5
- package/ui/frame/frame-helper-for-android.js.map +1 -1
- package/ui/frame/frame-helpers.js.map +1 -1
- package/ui/frame/frame-interfaces.d.ts +1 -1
- package/ui/frame/frame-interfaces.js.map +1 -1
- package/ui/frame/frame-stack.d.ts +22 -1
- package/ui/frame/frame-stack.js +43 -5
- package/ui/frame/frame-stack.js.map +1 -1
- package/ui/frame/index.android.d.ts +2 -2
- package/ui/frame/index.android.js +161 -56
- package/ui/frame/index.android.js.map +1 -1
- package/ui/frame/index.d.ts +15 -5
- package/ui/frame/index.ios.d.ts +1 -1
- package/ui/frame/index.ios.js +86 -26
- package/ui/frame/index.ios.js.map +1 -1
- package/ui/gestures/gestures-common.js.map +1 -1
- package/ui/gestures/gestures-types.d.ts +2 -0
- package/ui/gestures/gestures-types.js.map +1 -1
- package/ui/gestures/index.android.d.ts +1 -1
- package/ui/gestures/index.android.js +177 -133
- package/ui/gestures/index.android.js.map +1 -1
- package/ui/gestures/index.ios.js +36 -7
- package/ui/gestures/index.ios.js.map +1 -1
- package/ui/gestures/touch-manager.d.ts +1 -2
- package/ui/gestures/touch-manager.js +79 -50
- package/ui/gestures/touch-manager.js.map +1 -1
- package/ui/html-view/html-view-common.js.map +1 -1
- package/ui/html-view/index.android.js.map +1 -1
- package/ui/html-view/index.ios.js.map +1 -1
- package/ui/image/image-common.js +1 -1
- package/ui/image/image-common.js.map +1 -1
- package/ui/image/index.android.js +14 -2
- package/ui/image/index.android.js.map +1 -1
- package/ui/image/index.ios.js.map +1 -1
- package/ui/image/symbol-effects-common.js.map +1 -1
- package/ui/image/symbol-effects.android.js.map +1 -1
- package/ui/image/symbol-effects.ios.js.map +1 -1
- package/ui/image-cache/image-cache-common.js.map +1 -1
- package/ui/image-cache/index.android.js +1 -2
- package/ui/image-cache/index.android.js.map +1 -1
- package/ui/image-cache/index.ios.js.map +1 -1
- package/ui/index.d.ts +2 -2
- package/ui/index.js.map +1 -1
- package/ui/label/index.android.js.map +1 -1
- package/ui/label/index.ios.js.map +1 -1
- package/ui/layouts/absolute-layout/absolute-layout-common.js.map +1 -1
- package/ui/layouts/absolute-layout/index.android.js.map +1 -1
- package/ui/layouts/absolute-layout/index.ios.js +3 -0
- package/ui/layouts/absolute-layout/index.ios.js.map +1 -1
- package/ui/layouts/dock-layout/dock-layout-common.js.map +1 -1
- package/ui/layouts/dock-layout/index.android.js.map +1 -1
- package/ui/layouts/dock-layout/index.ios.js +3 -0
- package/ui/layouts/dock-layout/index.ios.js.map +1 -1
- package/ui/layouts/flexbox-layout/flexbox-layout-common.d.ts +7 -0
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js +18 -0
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.android.d.ts +5 -0
- package/ui/layouts/flexbox-layout/index.android.js +15 -0
- package/ui/layouts/flexbox-layout/index.android.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.d.ts +19 -1
- package/ui/layouts/flexbox-layout/index.ios.d.ts +2 -0
- package/ui/layouts/flexbox-layout/index.ios.js +246 -195
- package/ui/layouts/flexbox-layout/index.ios.js.map +1 -1
- package/ui/layouts/grid-layout/grid-layout-common.js.map +1 -1
- package/ui/layouts/grid-layout/index.android.js.map +1 -1
- package/ui/layouts/grid-layout/index.ios.js +3 -0
- package/ui/layouts/grid-layout/index.ios.js.map +1 -1
- package/ui/layouts/index.js.map +1 -1
- package/ui/layouts/layout-base-common.d.ts +1 -0
- package/ui/layouts/layout-base-common.js +23 -1
- package/ui/layouts/layout-base-common.js.map +1 -1
- package/ui/layouts/layout-base.android.js.map +1 -1
- package/ui/layouts/layout-base.ios.js.map +1 -1
- package/ui/layouts/liquid-glass/index.android.js.map +1 -1
- package/ui/layouts/liquid-glass/index.ios.d.ts +0 -1
- package/ui/layouts/liquid-glass/index.ios.js +2 -43
- package/ui/layouts/liquid-glass/index.ios.js.map +1 -1
- package/ui/layouts/liquid-glass/liquid-glass-common.js.map +1 -1
- package/ui/layouts/liquid-glass-container/index.android.js.map +1 -1
- package/ui/layouts/liquid-glass-container/index.ios.d.ts +0 -1
- package/ui/layouts/liquid-glass-container/index.ios.js +2 -43
- package/ui/layouts/liquid-glass-container/index.ios.js.map +1 -1
- package/ui/layouts/liquid-glass-container/liquid-glass-container-common.js.map +1 -1
- package/ui/layouts/root-layout/index.android.js.map +1 -1
- package/ui/layouts/root-layout/index.ios.js.map +1 -1
- package/ui/layouts/root-layout/root-layout-common.js.map +1 -1
- package/ui/layouts/root-layout/root-layout-stack.js.map +1 -1
- package/ui/layouts/stack-layout/index.android.js.map +1 -1
- package/ui/layouts/stack-layout/index.ios.js +3 -0
- package/ui/layouts/stack-layout/index.ios.js.map +1 -1
- package/ui/layouts/stack-layout/stack-layout-common.js.map +1 -1
- package/ui/layouts/wrap-layout/index.android.js.map +1 -1
- package/ui/layouts/wrap-layout/index.ios.js +3 -0
- package/ui/layouts/wrap-layout/index.ios.js.map +1 -1
- package/ui/layouts/wrap-layout/wrap-layout-common.js.map +1 -1
- package/ui/list-picker/index.android.d.ts +1 -0
- package/ui/list-picker/index.android.js +6 -5
- package/ui/list-picker/index.android.js.map +1 -1
- package/ui/list-picker/index.ios.js.map +1 -1
- package/ui/list-picker/list-picker-common.js.map +1 -1
- package/ui/list-view/index.android.js +19 -11
- package/ui/list-view/index.android.js.map +1 -1
- package/ui/list-view/index.d.ts +47 -3
- package/ui/list-view/index.ios.d.ts +13 -3
- package/ui/list-view/index.ios.js +132 -41
- package/ui/list-view/index.ios.js.map +1 -1
- package/ui/list-view/list-view-common.d.ts +19 -0
- package/ui/list-view/list-view-common.js +30 -0
- package/ui/list-view/list-view-common.js.map +1 -1
- package/ui/page/events.js.map +1 -1
- package/ui/page/index.android.js.map +1 -1
- package/ui/page/index.d.ts +1 -1
- package/ui/page/index.ios.d.ts +3 -1
- package/ui/page/index.ios.js +33 -20
- package/ui/page/index.ios.js.map +1 -1
- package/ui/page/page-common.d.ts +5 -1
- package/ui/page/page-common.js.map +1 -1
- package/ui/placeholder/index.android.js.map +1 -1
- package/ui/placeholder/index.js.map +1 -1
- package/ui/placeholder/placeholder-common.js.map +1 -1
- package/ui/progress/index.android.js.map +1 -1
- package/ui/progress/index.ios.js.map +1 -1
- package/ui/progress/progress-common.js.map +1 -1
- package/ui/proxy-view-container/index.js.map +1 -1
- package/ui/repeater/index.d.ts +2 -1
- package/ui/repeater/index.js.map +1 -1
- package/ui/scroll-view/index.android.d.ts +2 -1
- package/ui/scroll-view/index.android.js +4 -1
- package/ui/scroll-view/index.android.js.map +1 -1
- package/ui/scroll-view/index.d.ts +53 -0
- package/ui/scroll-view/index.ios.d.ts +13 -1
- package/ui/scroll-view/index.ios.js +100 -20
- package/ui/scroll-view/index.ios.js.map +1 -1
- package/ui/scroll-view/scroll-view-common.d.ts +13 -0
- package/ui/scroll-view/scroll-view-common.js +27 -0
- package/ui/scroll-view/scroll-view-common.js.map +1 -1
- package/ui/search-bar/index.android.js +2 -2
- package/ui/search-bar/index.android.js.map +1 -1
- package/ui/search-bar/index.ios.js.map +1 -1
- package/ui/search-bar/search-bar-common.js.map +1 -1
- package/ui/segmented-bar/index.android.js +8 -8
- package/ui/segmented-bar/index.android.js.map +1 -1
- package/ui/segmented-bar/index.ios.js.map +1 -1
- package/ui/segmented-bar/segmented-bar-common.d.ts +5 -1
- package/ui/segmented-bar/segmented-bar-common.js +6 -1
- package/ui/segmented-bar/segmented-bar-common.js.map +1 -1
- package/ui/slider/index.android.js +1 -2
- package/ui/slider/index.android.js.map +1 -1
- package/ui/slider/index.ios.js.map +1 -1
- package/ui/slider/slider-common.js.map +1 -1
- package/ui/split-view/index.android.js.map +1 -1
- package/ui/split-view/index.ios.js.map +1 -1
- package/ui/split-view/split-view-common.js.map +1 -1
- package/ui/styling/background-common.d.ts +2 -0
- package/ui/styling/background-common.js +10 -2
- package/ui/styling/background-common.js.map +1 -1
- package/ui/styling/background.android.d.ts +4 -1
- package/ui/styling/background.android.js +5 -2
- package/ui/styling/background.android.js.map +1 -1
- package/ui/styling/background.d.ts +2 -2
- package/ui/styling/background.ios.d.ts +1 -1
- package/ui/styling/background.ios.js +10 -3
- package/ui/styling/background.ios.js.map +1 -1
- package/ui/styling/box-shadow.js.map +1 -1
- package/ui/styling/clip-path-function.js.map +1 -1
- package/ui/styling/converters.js.map +1 -1
- package/ui/styling/css-animation-parser.js.map +1 -1
- package/ui/styling/css-selector.d.ts +60 -13
- package/ui/styling/css-selector.js +311 -50
- package/ui/styling/css-selector.js.map +1 -1
- package/ui/styling/css-shadow.js.map +1 -1
- package/ui/styling/css-stroke.js.map +1 -1
- package/ui/styling/css-transform.js.map +1 -1
- package/ui/styling/css-utils.d.ts +16 -0
- package/ui/styling/css-utils.js +121 -7
- package/ui/styling/css-utils.js.map +1 -1
- package/ui/styling/font-common.js.map +1 -1
- package/ui/styling/font-interfaces.js.map +1 -1
- package/ui/styling/font.android.js.map +1 -1
- package/ui/styling/font.ios.js.map +1 -1
- package/ui/styling/length-shared.d.ts +2 -0
- package/ui/styling/length-shared.js +29 -2
- package/ui/styling/length-shared.js.map +1 -1
- package/ui/styling/linear-gradient.js.map +1 -1
- package/ui/styling/style/index.d.ts +29 -2
- package/ui/styling/style/index.js +1 -0
- package/ui/styling/style/index.js.map +1 -1
- package/ui/styling/style-properties.d.ts +5 -0
- package/ui/styling/style-properties.js +172 -101
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/styling/style-scope.d.ts +24 -3
- package/ui/styling/style-scope.js +461 -63
- package/ui/styling/style-scope.js.map +1 -1
- package/ui/styling/styling-profile.js.map +1 -1
- package/ui/styling/styling-shared.js.map +1 -1
- package/ui/switch/index.android.js +1 -1
- package/ui/switch/index.android.js.map +1 -1
- package/ui/switch/index.ios.js +5 -1
- package/ui/switch/index.ios.js.map +1 -1
- package/ui/switch/switch-common.js.map +1 -1
- package/ui/tab-view/index.android.js +13 -17
- package/ui/tab-view/index.android.js.map +1 -1
- package/ui/tab-view/index.d.ts +5 -3
- package/ui/tab-view/index.ios.d.ts +2 -1
- package/ui/tab-view/index.ios.js +83 -20
- package/ui/tab-view/index.ios.js.map +1 -1
- package/ui/tab-view/tab-view-common.d.ts +6 -1
- package/ui/tab-view/tab-view-common.js +17 -1
- package/ui/tab-view/tab-view-common.js.map +1 -1
- package/ui/text-base/formatted-string.js.map +1 -1
- package/ui/text-base/index.android.js +6 -9
- package/ui/text-base/index.android.js.map +1 -1
- package/ui/text-base/index.ios.d.ts +3 -0
- package/ui/text-base/index.ios.js +26 -4
- package/ui/text-base/index.ios.js.map +1 -1
- package/ui/text-base/span.js.map +1 -1
- package/ui/text-base/text-base-common.js.map +1 -1
- package/ui/text-field/index.android.js.map +1 -1
- package/ui/text-field/index.ios.js +13 -5
- package/ui/text-field/index.ios.js.map +1 -1
- package/ui/text-field/text-field-common.js.map +1 -1
- package/ui/text-view/index.android.js.map +1 -1
- package/ui/text-view/index.ios.js.map +1 -1
- package/ui/text-view/text-view-common.js.map +1 -1
- package/ui/time-picker/index.android.js +1 -1
- package/ui/time-picker/index.android.js.map +1 -1
- package/ui/time-picker/index.ios.js.map +1 -1
- package/ui/time-picker/time-picker-common.js.map +1 -1
- package/ui/transition/fade-transition.android.js.map +1 -1
- package/ui/transition/fade-transition.ios.js.map +1 -1
- package/ui/transition/flip-transition.android.js.map +1 -1
- package/ui/transition/index.android.js.map +1 -1
- package/ui/transition/index.d.ts +2 -1
- package/ui/transition/index.ios.js.map +1 -1
- package/ui/transition/modal-transition.android.js.map +1 -1
- package/ui/transition/modal-transition.ios.js +33 -5
- package/ui/transition/modal-transition.ios.js.map +1 -1
- package/ui/transition/page-transition.android.d.ts +4 -0
- package/ui/transition/page-transition.android.js +171 -86
- package/ui/transition/page-transition.android.js.map +1 -1
- package/ui/transition/page-transition.ios.d.ts +5 -0
- package/ui/transition/page-transition.ios.js +298 -36
- package/ui/transition/page-transition.ios.js.map +1 -1
- package/ui/transition/shared-transition-helper.android.d.ts +3 -0
- package/ui/transition/shared-transition-helper.android.js +9 -0
- package/ui/transition/shared-transition-helper.android.js.map +1 -1
- package/ui/transition/shared-transition-helper.d.ts +7 -0
- package/ui/transition/shared-transition-helper.ios.d.ts +48 -0
- package/ui/transition/shared-transition-helper.ios.js +977 -95
- package/ui/transition/shared-transition-helper.ios.js.map +1 -1
- package/ui/transition/shared-transition.d.ts +134 -0
- package/ui/transition/shared-transition.js +90 -2
- package/ui/transition/shared-transition.js.map +1 -1
- package/ui/transition/slide-transition.android.js.map +1 -1
- package/ui/transition/slide-transition.ios.js.map +1 -1
- package/ui/utils.android.js.map +1 -1
- package/ui/utils.d.ts +2 -0
- package/ui/utils.ios.js.map +1 -1
- package/ui/web-view/index.android.js +1 -1
- package/ui/web-view/index.android.js.map +1 -1
- package/ui/web-view/index.ios.js.map +1 -1
- package/ui/web-view/web-view-common.js.map +1 -1
- package/ui/web-view/web-view-interfaces.js.map +1 -1
- package/utils/android-runtime-version.d.ts +12 -0
- package/utils/android-runtime-version.js +36 -0
- package/utils/android-runtime-version.js.map +1 -0
- package/utils/animation-helpers.js.map +1 -1
- package/utils/common.js.map +1 -1
- package/utils/constants.android.js.map +1 -1
- package/utils/constants.ios.js.map +1 -1
- package/utils/debug-source.js.map +1 -1
- package/utils/debug.js.map +1 -1
- package/utils/index.android.js.map +1 -1
- package/utils/index.ios.js.map +1 -1
- package/utils/layout-helper/index.android.js.map +1 -1
- package/utils/layout-helper/index.ios.js +11 -3
- package/utils/layout-helper/index.ios.js.map +1 -1
- package/utils/layout-helper/layout-helper-common.js.map +1 -1
- package/utils/layout-helper/layout-helper-shared.js.map +1 -1
- package/utils/lazy.js.map +1 -1
- package/utils/macrotask-scheduler.js.map +1 -1
- package/utils/mainthread-helper.android.js.map +1 -1
- package/utils/mainthread-helper.ios.js.map +1 -1
- package/utils/module-merge.js.map +1 -1
- package/utils/native-helper-for-android.js +9 -3
- package/utils/native-helper-for-android.js.map +1 -1
- package/utils/native-helper.android.d.ts +66 -2
- package/utils/native-helper.android.js.map +1 -1
- package/utils/native-helper.d.ts +2 -2
- package/utils/native-helper.ios.d.ts +52 -2
- package/utils/native-helper.ios.js +35 -5
- package/utils/native-helper.ios.js.map +1 -1
- package/utils/native-helper.types.d.ts +2 -0
- package/utils/number-utils.js.map +1 -1
- package/utils/platform-check.d.ts +1 -1
- package/utils/platform-check.js.map +1 -1
- package/utils/shared.js.map +1 -1
- package/utils/types.js.map +1 -1
- package/utils/utils-shared.js.map +1 -1
- package/wgc/atob.js.map +1 -1
- package/wgc/btoa.js.map +1 -1
- package/wgc/crypto/SubtleCrypto.js.map +1 -1
- package/wgc/crypto/index.d.ts +1 -1
- package/wgc/crypto/index.js +12 -8
- package/wgc/crypto/index.js.map +1 -1
- package/wgc/index.js.map +1 -1
- package/xhr/index.d.ts +5 -4
- package/xhr/index.js +18 -18
- package/xhr/index.js.map +1 -1
- package/xml/index.d.ts +2 -2
- package/xml/index.js +1 -1
- package/xml/index.js.map +1 -1
- package/LICENSE +0 -19
- package/fetch/index.mjs +0 -535
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { profile } from '../profiling';
|
|
2
|
-
import { ContentView } from '../ui/content-view';
|
|
3
2
|
import { isEmbedded } from '../ui/embedding';
|
|
4
3
|
import { IOSHelper } from '../ui/core/view/view-helper';
|
|
5
4
|
import { getWindow } from '../utils/native-helper';
|
|
6
5
|
import { SDK_VERSION } from '../utils/constants';
|
|
7
|
-
import { ios as iosUtils, dataSerialize } from '../utils/native-helper';
|
|
8
|
-
import { ApplicationCommon
|
|
6
|
+
import { ios as iosUtils, dataSerialize, dataDeserialize } from '../utils/native-helper';
|
|
7
|
+
import { ApplicationCommon } from './application-common';
|
|
8
|
+
import { deliverShortcutItem, forwardContinueUserActivity, forwardOpenURLContexts, getLaunchUserActivities, oneShotCompletion } from './scene-delegate-bridge';
|
|
9
9
|
import { Trace } from '../trace';
|
|
10
|
+
import { IOSNativeWindow } from '../native-window/native-window.ios';
|
|
11
|
+
import { NativeWindow } from '../native-window/native-window-common';
|
|
12
|
+
import { NativeWindowEvents } from '../native-window/native-window-interfaces';
|
|
10
13
|
import { CoreTypes } from '../core-types';
|
|
11
|
-
import { getiOSWindow, setApplicationPropertiesCallback, setAppMainEntry, setiOSWindow, setRootView, setToggleApplicationEventListenersCallback } from './helpers-common';
|
|
14
|
+
import { createContentView, getiOSWindow, setApplicationPropertiesCallback, setAppMainEntry, setiOSWindow, setRootView, setToggleApplicationEventListenersCallback } from './helpers-common';
|
|
12
15
|
var NotificationObserver = (function (_super) {
|
|
13
16
|
__extends(NotificationObserver, _super);
|
|
14
17
|
function NotificationObserver() {
|
|
@@ -38,6 +41,7 @@ var CADisplayLinkTarget = (function (_super) {
|
|
|
38
41
|
return target;
|
|
39
42
|
};
|
|
40
43
|
CADisplayLinkTarget.prototype.onDisplayed = function (link) {
|
|
44
|
+
var _a;
|
|
41
45
|
link.invalidate();
|
|
42
46
|
var owner = this._owner.deref();
|
|
43
47
|
if (!owner) {
|
|
@@ -49,6 +53,7 @@ var CADisplayLinkTarget = (function (_super) {
|
|
|
49
53
|
object: owner,
|
|
50
54
|
ios: UIApplication.sharedApplication,
|
|
51
55
|
});
|
|
56
|
+
(_a = owner.primaryWindow) === null || _a === void 0 ? void 0 : _a._notifyEvent(NativeWindowEvents.displayed);
|
|
52
57
|
owner.displayedLinkTarget = null;
|
|
53
58
|
owner.displayedLink = null;
|
|
54
59
|
};
|
|
@@ -79,6 +84,15 @@ function supportsMultipleScenes() {
|
|
|
79
84
|
}
|
|
80
85
|
return UIApplication.sharedApplication?.supportsMultipleScenes;
|
|
81
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Number of times the JS runtime has been soft-rebooted in this process via
|
|
89
|
+
* NativeScriptRuntime.reloadApplication / restartWithConfig. 0 on first boot.
|
|
90
|
+
* Provided as a global by the iOS runtime (v9+); older runtimes report 0.
|
|
91
|
+
*/
|
|
92
|
+
function getRuntimeReloadCount() {
|
|
93
|
+
const runtime = globalThis.NativeScriptRuntime;
|
|
94
|
+
return runtime && typeof runtime.reloadCount === 'number' ? runtime.reloadCount : 0;
|
|
95
|
+
}
|
|
82
96
|
var Responder = (function (_super) {
|
|
83
97
|
__extends(Responder, _super);
|
|
84
98
|
function Responder() {
|
|
@@ -96,25 +110,171 @@ var Responder = (function (_super) {
|
|
|
96
110
|
Responder.ObjCProtocols = [UIApplicationDelegate];
|
|
97
111
|
return Responder;
|
|
98
112
|
}(UIResponder));
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
const delegateWindowKey = Symbol('nativescript.delegateWindow');
|
|
114
|
+
/**
|
|
115
|
+
* Installs NativeScript's default `UIApplicationDelegate` members on the class that will
|
|
116
|
+
* be handed to `UIApplicationMain`, so scenes keep working with a custom delegate.
|
|
117
|
+
*
|
|
118
|
+
* Each member is installed only when the class does not already provide one (its own or
|
|
119
|
+
* inherited), so a delegate that implements a method keeps it and can forward to
|
|
120
|
+
* `Application.ios.defaultSceneConfiguration` / `defaultDiscardSceneSessions` itself.
|
|
121
|
+
*
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
function installSceneDelegateDefaults(delegateClass) {
|
|
125
|
+
const proto = delegateClass?.prototype;
|
|
126
|
+
if (!proto) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
// Implementing the scene methods makes the app assume scene-based lifecycle management,
|
|
130
|
+
// which boots to a white screen when Info.plist has no UIApplicationSceneManifest.
|
|
131
|
+
// Configuring the delegate here is also why UISceneConfigurations does not have to be
|
|
132
|
+
// declared in Info.plist — UIApplicationSceneManifest on its own is enough.
|
|
133
|
+
if (supportsScenes()) {
|
|
134
|
+
if (!proto.applicationConfigurationForConnectingSceneSessionOptions) {
|
|
135
|
+
proto.applicationConfigurationForConnectingSceneSessionOptions = function (application, connectingSceneSession, options) {
|
|
136
|
+
return Application.ios.defaultSceneConfiguration(application, connectingSceneSession, options);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (!proto.applicationDidDiscardSceneSessions) {
|
|
140
|
+
proto.applicationDidDiscardSceneSessions = function (application, sceneSessions) {
|
|
141
|
+
Application.ios.defaultDiscardSceneSessions(application, sceneSessions);
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (!('window' in proto)) {
|
|
146
|
+
Object.defineProperty(proto, 'window', {
|
|
147
|
+
get() {
|
|
148
|
+
return this[delegateWindowKey] ?? Application.ios.window;
|
|
149
|
+
},
|
|
150
|
+
// UIKit assigns `delegate.window` on non-scene apps and a delegate may assign it
|
|
151
|
+
// itself, so the value has to be kept: a discarding setter would leave the
|
|
152
|
+
// delegate reporting a window it never set.
|
|
153
|
+
set(value) {
|
|
154
|
+
this[delegateWindowKey] = value;
|
|
155
|
+
},
|
|
156
|
+
enumerable: true,
|
|
157
|
+
configurable: true,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
installSceneDelegateDefaults(Responder);
|
|
162
|
+
let warnedAboutDelegateProtocols = false;
|
|
163
|
+
let warnedAboutDelegateAfterStart = false;
|
|
164
|
+
function warnAboutDelegate(message) {
|
|
165
|
+
Trace.write(message, Trace.categories.Error, Trace.messageType.warn);
|
|
166
|
+
console.warn(message);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Reports the two custom-delegate mistakes NativeScript cannot correct on the app's behalf:
|
|
170
|
+
* a delegate class that never declared `UIApplicationDelegate` conformance, and a delegate
|
|
171
|
+
* assigned once `UIApplicationMain` has already been given a class.
|
|
172
|
+
*/
|
|
173
|
+
function warnAboutDelegateClass(delegateClass, alreadyStarted) {
|
|
174
|
+
const protocols = delegateClass?.ObjCProtocols;
|
|
175
|
+
if (!warnedAboutDelegateProtocols && !(Array.isArray(protocols) && protocols.indexOf(UIApplicationDelegate) !== -1)) {
|
|
176
|
+
warnedAboutDelegateProtocols = true;
|
|
177
|
+
warnAboutDelegate('Application.ios.delegate was set to a class that does not list UIApplicationDelegate in its static ObjCProtocols. Add `static ObjCProtocols = [UIApplicationDelegate];` to the class body: the Objective-C class is built from ObjCProtocols and cached, so conformance cannot be declared from here and UIKit may never dispatch the delegate methods.');
|
|
178
|
+
}
|
|
179
|
+
if (alreadyStarted && !warnedAboutDelegateAfterStart) {
|
|
180
|
+
warnedAboutDelegateAfterStart = true;
|
|
181
|
+
warnAboutDelegate('Application.ios.delegate was set after the application started. UIApplicationMain has already been given a delegate class, so this assignment has no effect — set Application.ios.delegate before calling Application.run().');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Reads the payload `openWindow()` put on the activating NSUserActivity.
|
|
186
|
+
*/
|
|
187
|
+
function getSceneConnectionData(connectionOptions) {
|
|
188
|
+
const activities = connectionOptions?.userActivities;
|
|
189
|
+
if (!activities || activities.count === 0) {
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
const activity = activities.allObjects.objectAtIndex(0);
|
|
193
|
+
return activity?.userInfo ? dataDeserialize(activity.userInfo) : undefined;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* The activity type `openWindow()` uses to hand its data to the scene it opens.
|
|
197
|
+
*/
|
|
198
|
+
function getSceneActivityType() {
|
|
199
|
+
return `${NSBundle.mainBundle.bundleIdentifier}.scene`;
|
|
200
|
+
}
|
|
201
|
+
function deliverOpenURLContexts(windowScene, nativeWindow, URLContexts) {
|
|
202
|
+
if (nativeWindow) {
|
|
203
|
+
nativeWindow.notify({
|
|
204
|
+
eventName: NativeWindowEvents.sceneOpenURLContexts,
|
|
205
|
+
object: nativeWindow,
|
|
206
|
+
window: nativeWindow,
|
|
207
|
+
scene: windowScene,
|
|
208
|
+
urlContexts: URLContexts,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
Application.ios.notify({
|
|
212
|
+
eventName: NativeWindowEvents.sceneOpenURLContexts,
|
|
213
|
+
object: Application.ios,
|
|
214
|
+
window: nativeWindow,
|
|
215
|
+
scene: windowScene,
|
|
216
|
+
urlContexts: URLContexts,
|
|
217
|
+
});
|
|
218
|
+
forwardOpenURLContexts(Application.ios.delegate, UIApplication.sharedApplication, URLContexts);
|
|
219
|
+
}
|
|
220
|
+
function deliverUserActivity(windowScene, nativeWindow, userActivity) {
|
|
221
|
+
if (nativeWindow) {
|
|
222
|
+
nativeWindow.notify({
|
|
223
|
+
eventName: NativeWindowEvents.sceneContinueUserActivity,
|
|
224
|
+
object: nativeWindow,
|
|
225
|
+
window: nativeWindow,
|
|
226
|
+
scene: windowScene,
|
|
227
|
+
userActivity,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
Application.ios.notify({
|
|
231
|
+
eventName: NativeWindowEvents.sceneContinueUserActivity,
|
|
232
|
+
object: Application.ios,
|
|
233
|
+
window: nativeWindow,
|
|
234
|
+
scene: windowScene,
|
|
235
|
+
userActivity,
|
|
236
|
+
});
|
|
237
|
+
forwardContinueUserActivity(Application.ios.delegate, UIApplication.sharedApplication, userActivity);
|
|
238
|
+
}
|
|
239
|
+
function deliverShortcutAction(windowScene, nativeWindow, shortcutItem, completionHandler) {
|
|
240
|
+
// Shared by the listeners and the legacy handler, so it has to tolerate several callers.
|
|
241
|
+
const deliver = oneShotCompletion(completionHandler);
|
|
242
|
+
if (nativeWindow) {
|
|
243
|
+
nativeWindow.notify({
|
|
244
|
+
eventName: NativeWindowEvents.scenePerformActionForShortcutItem,
|
|
245
|
+
object: nativeWindow,
|
|
246
|
+
window: nativeWindow,
|
|
247
|
+
scene: windowScene,
|
|
248
|
+
shortcutItem,
|
|
249
|
+
completionHandler: deliver,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
Application.ios.notify({
|
|
253
|
+
eventName: NativeWindowEvents.scenePerformActionForShortcutItem,
|
|
254
|
+
object: Application.ios,
|
|
255
|
+
window: nativeWindow,
|
|
256
|
+
scene: windowScene,
|
|
257
|
+
shortcutItem,
|
|
258
|
+
completionHandler: deliver,
|
|
259
|
+
});
|
|
260
|
+
deliverShortcutItem(Application.ios.delegate, UIApplication.sharedApplication, shortcutItem, deliver);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* UIKit hands the URLs, continuation activities and quick action that launched a scene only to
|
|
264
|
+
* `scene:willConnectToSession:options:`; the scene callbacks that carry them later never fire for
|
|
265
|
+
* the launch itself, so they are delivered here the same way.
|
|
266
|
+
*/
|
|
267
|
+
function deliverLaunchPayloads(windowScene, nativeWindow, connectionOptions) {
|
|
268
|
+
if (connectionOptions?.URLContexts?.count) {
|
|
269
|
+
deliverOpenURLContexts(windowScene, nativeWindow, connectionOptions.URLContexts);
|
|
270
|
+
}
|
|
271
|
+
for (const userActivity of getLaunchUserActivities(connectionOptions, getSceneActivityType())) {
|
|
272
|
+
deliverUserActivity(windowScene, nativeWindow, userActivity);
|
|
273
|
+
}
|
|
274
|
+
if (connectionOptions?.shortcutItem) {
|
|
275
|
+
// A launch has no completion handler to report back to.
|
|
276
|
+
deliverShortcutAction(windowScene, nativeWindow, connectionOptions.shortcutItem, undefined);
|
|
277
|
+
}
|
|
118
278
|
}
|
|
119
279
|
var SceneDelegate = (function (_super) {
|
|
120
280
|
__extends(SceneDelegate, _super);
|
|
@@ -138,48 +298,196 @@ var SceneDelegate = (function (_super) {
|
|
|
138
298
|
if (!(scene instanceof UIWindowScene)) {
|
|
139
299
|
return;
|
|
140
300
|
}
|
|
141
|
-
var
|
|
142
|
-
|
|
143
|
-
this.
|
|
144
|
-
|
|
145
|
-
|
|
301
|
+
var windowScene = scene;
|
|
302
|
+
var isFirstScene = Application.ios._getWindows().length === 0;
|
|
303
|
+
this._scene = windowScene;
|
|
304
|
+
this._window = UIWindow.alloc().initWithWindowScene(windowScene);
|
|
305
|
+
if (!__VISIONOS__) {
|
|
306
|
+
this._window.backgroundColor = SDK_VERSION <= 12 || !UIColor.systemBackgroundColor ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
|
307
|
+
}
|
|
308
|
+
var nativeWindowId = IOSNativeWindow.getSceneId(windowScene);
|
|
309
|
+
var knownWindow = nativeWindowId ? Application.ios.getWindowById(nativeWindowId) : undefined;
|
|
310
|
+
var nativeWindow;
|
|
311
|
+
if ((knownWindow === null || knownWindow === void 0 ? void 0 : knownWindow.state) === "detached") {
|
|
312
|
+
nativeWindow = knownWindow;
|
|
313
|
+
nativeWindow._reattach(windowScene, this._window);
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
var isPrimary_1 = isFirstScene || !Application.ios.primaryWindow;
|
|
317
|
+
nativeWindow = new IOSNativeWindow(windowScene, this._window, nativeWindowId, isPrimary_1);
|
|
318
|
+
Application.ios._registerWindow(nativeWindow);
|
|
319
|
+
}
|
|
320
|
+
var isPrimary = nativeWindow.isPrimary;
|
|
321
|
+
nativeWindow._notifyEvent(NativeWindowEvents.attached);
|
|
322
|
+
if (isPrimary) {
|
|
323
|
+
setiOSWindow(this._window);
|
|
324
|
+
}
|
|
325
|
+
nativeWindow.notify({
|
|
326
|
+
eventName: NativeWindowEvents.sceneWillConnect,
|
|
327
|
+
object: nativeWindow,
|
|
328
|
+
window: nativeWindow,
|
|
329
|
+
scene: windowScene,
|
|
330
|
+
uiWindow: this._window,
|
|
331
|
+
connectionOptions: connectionOptions,
|
|
332
|
+
});
|
|
146
333
|
Application.ios.notify({
|
|
147
|
-
eventName:
|
|
334
|
+
eventName: NativeWindowEvents.sceneWillConnect,
|
|
148
335
|
object: Application.ios,
|
|
149
|
-
|
|
150
|
-
|
|
336
|
+
window: nativeWindow,
|
|
337
|
+
scene: windowScene,
|
|
338
|
+
uiWindow: this._window,
|
|
151
339
|
connectionOptions: connectionOptions,
|
|
152
340
|
});
|
|
153
|
-
if (
|
|
341
|
+
if (isPrimary) {
|
|
154
342
|
this._window.makeKeyAndVisible();
|
|
155
343
|
}
|
|
156
|
-
|
|
157
|
-
Application.ios.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
connectionOptions: connectionOptions,
|
|
344
|
+
if (nativeWindow.role === "application") {
|
|
345
|
+
Application.ios._resolveWindowContent(nativeWindow, {
|
|
346
|
+
window: nativeWindow,
|
|
347
|
+
isPrimary: isPrimary,
|
|
348
|
+
data: getSceneConnectionData(connectionOptions),
|
|
349
|
+
ios: { connectionOptions: connectionOptions },
|
|
163
350
|
});
|
|
164
351
|
}
|
|
165
|
-
|
|
166
|
-
Application.ios._notifySceneAppStarted();
|
|
167
|
-
}
|
|
352
|
+
deliverLaunchPayloads(windowScene, nativeWindow, connectionOptions);
|
|
168
353
|
};
|
|
169
354
|
SceneDelegate.prototype.sceneDidBecomeActive = function (scene) {
|
|
355
|
+
var windowScene = scene;
|
|
356
|
+
var nativeWindow = Application.ios._getWindowForScene(windowScene);
|
|
357
|
+
if (nativeWindow) {
|
|
358
|
+
nativeWindow._notifyEvent(NativeWindowEvents.activate);
|
|
359
|
+
nativeWindow.notify({
|
|
360
|
+
eventName: NativeWindowEvents.sceneDidActivate,
|
|
361
|
+
object: nativeWindow,
|
|
362
|
+
window: nativeWindow,
|
|
363
|
+
scene: windowScene,
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
Application.ios.notify({
|
|
367
|
+
eventName: NativeWindowEvents.sceneDidActivate,
|
|
368
|
+
object: Application.ios,
|
|
369
|
+
window: nativeWindow,
|
|
370
|
+
scene: windowScene,
|
|
371
|
+
});
|
|
372
|
+
Application.ios._setWindowActive(nativeWindow, true, windowScene);
|
|
373
|
+
var rootView = nativeWindow === null || nativeWindow === void 0 ? void 0 : nativeWindow.rootView;
|
|
374
|
+
if (rootView && !rootView.isLoaded) {
|
|
375
|
+
rootView.callLoaded();
|
|
376
|
+
}
|
|
170
377
|
};
|
|
171
378
|
SceneDelegate.prototype.sceneWillResignActive = function (scene) {
|
|
379
|
+
var windowScene = scene;
|
|
380
|
+
var nativeWindow = Application.ios._getWindowForScene(windowScene);
|
|
381
|
+
if (nativeWindow) {
|
|
382
|
+
nativeWindow._notifyEvent(NativeWindowEvents.deactivate);
|
|
383
|
+
nativeWindow.notify({
|
|
384
|
+
eventName: NativeWindowEvents.sceneWillResignActive,
|
|
385
|
+
object: nativeWindow,
|
|
386
|
+
window: nativeWindow,
|
|
387
|
+
scene: windowScene,
|
|
388
|
+
});
|
|
389
|
+
}
|
|
172
390
|
Application.ios.notify({
|
|
173
|
-
eventName:
|
|
391
|
+
eventName: NativeWindowEvents.sceneWillResignActive,
|
|
174
392
|
object: Application.ios,
|
|
175
|
-
|
|
393
|
+
window: nativeWindow,
|
|
394
|
+
scene: windowScene,
|
|
176
395
|
});
|
|
396
|
+
Application.ios._setWindowActive(nativeWindow, false, windowScene);
|
|
177
397
|
};
|
|
178
398
|
SceneDelegate.prototype.sceneWillEnterForeground = function (scene) {
|
|
399
|
+
var windowScene = scene;
|
|
400
|
+
var nativeWindow = Application.ios._getWindowForScene(windowScene);
|
|
401
|
+
if (nativeWindow) {
|
|
402
|
+
nativeWindow._notifyEvent(NativeWindowEvents.foreground);
|
|
403
|
+
nativeWindow.notify({
|
|
404
|
+
eventName: NativeWindowEvents.sceneWillEnterForeground,
|
|
405
|
+
object: nativeWindow,
|
|
406
|
+
window: nativeWindow,
|
|
407
|
+
scene: windowScene,
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
Application.ios.notify({
|
|
411
|
+
eventName: NativeWindowEvents.sceneWillEnterForeground,
|
|
412
|
+
object: Application.ios,
|
|
413
|
+
window: nativeWindow,
|
|
414
|
+
scene: windowScene,
|
|
415
|
+
});
|
|
416
|
+
Application.ios._setWindowInForeground(nativeWindow, true, windowScene);
|
|
179
417
|
};
|
|
180
418
|
SceneDelegate.prototype.sceneDidEnterBackground = function (scene) {
|
|
419
|
+
var windowScene = scene;
|
|
420
|
+
var nativeWindow = Application.ios._getWindowForScene(windowScene);
|
|
421
|
+
if (nativeWindow) {
|
|
422
|
+
nativeWindow._notifyEvent(NativeWindowEvents.background);
|
|
423
|
+
nativeWindow.notify({
|
|
424
|
+
eventName: NativeWindowEvents.sceneDidEnterBackground,
|
|
425
|
+
object: nativeWindow,
|
|
426
|
+
window: nativeWindow,
|
|
427
|
+
scene: windowScene,
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
Application.ios.notify({
|
|
431
|
+
eventName: NativeWindowEvents.sceneDidEnterBackground,
|
|
432
|
+
object: Application.ios,
|
|
433
|
+
window: nativeWindow,
|
|
434
|
+
scene: windowScene,
|
|
435
|
+
});
|
|
436
|
+
Application.ios._setWindowInForeground(nativeWindow, false, windowScene);
|
|
437
|
+
var rootView = nativeWindow === null || nativeWindow === void 0 ? void 0 : nativeWindow.rootView;
|
|
438
|
+
if (rootView && rootView.isLoaded) {
|
|
439
|
+
rootView.callUnloaded();
|
|
440
|
+
}
|
|
181
441
|
};
|
|
182
442
|
SceneDelegate.prototype.sceneDidDisconnect = function (scene) {
|
|
443
|
+
var windowScene = scene;
|
|
444
|
+
var nativeWindow = Application.ios._getWindowForScene(windowScene);
|
|
445
|
+
Application.ios._setWindowActive(nativeWindow, false, windowScene);
|
|
446
|
+
Application.ios._setWindowInForeground(nativeWindow, false, windowScene);
|
|
447
|
+
if (nativeWindow) {
|
|
448
|
+
nativeWindow._surfaceGone = true;
|
|
449
|
+
var isClosing = nativeWindow._closeRequested || !nativeWindow._hasSessionIdentity;
|
|
450
|
+
if (isClosing) {
|
|
451
|
+
nativeWindow._notifyEvent(NativeWindowEvents.close);
|
|
452
|
+
}
|
|
453
|
+
nativeWindow.notify({
|
|
454
|
+
eventName: NativeWindowEvents.sceneDidDisconnect,
|
|
455
|
+
object: nativeWindow,
|
|
456
|
+
window: nativeWindow,
|
|
457
|
+
scene: windowScene,
|
|
458
|
+
});
|
|
459
|
+
if (isClosing) {
|
|
460
|
+
Application.ios._unregisterWindow(nativeWindow);
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
nativeWindow._detach();
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
Application.ios.notify({
|
|
467
|
+
eventName: NativeWindowEvents.sceneDidDisconnect,
|
|
468
|
+
object: Application.ios,
|
|
469
|
+
window: nativeWindow,
|
|
470
|
+
scene: windowScene,
|
|
471
|
+
});
|
|
472
|
+
};
|
|
473
|
+
SceneDelegate.prototype.sceneOpenURLContexts = function (scene, URLContexts) {
|
|
474
|
+
var windowScene = scene;
|
|
475
|
+
deliverOpenURLContexts(windowScene, Application.ios._getWindowForScene(windowScene), URLContexts);
|
|
476
|
+
};
|
|
477
|
+
SceneDelegate.prototype.sceneContinueUserActivity = function (scene, userActivity) {
|
|
478
|
+
var windowScene = scene;
|
|
479
|
+
deliverUserActivity(windowScene, Application.ios._getWindowForScene(windowScene), userActivity);
|
|
480
|
+
};
|
|
481
|
+
SceneDelegate.prototype.windowSceneDidUpdateEffectiveGeometry = function (windowScene, previousEffectiveGeometry) {
|
|
482
|
+
var _a;
|
|
483
|
+
(_a = Application.ios._getWindowForScene(windowScene)) === null || _a === void 0 ? void 0 : _a._syncOrientation();
|
|
484
|
+
};
|
|
485
|
+
SceneDelegate.prototype.windowSceneDidUpdateCoordinateSpaceInterfaceOrientationTraitCollection = function (windowScene, previousCoordinateSpace, previousInterfaceOrientation, previousTraitCollection) {
|
|
486
|
+
var _a;
|
|
487
|
+
(_a = Application.ios._getWindowForScene(windowScene)) === null || _a === void 0 ? void 0 : _a._syncOrientation();
|
|
488
|
+
};
|
|
489
|
+
SceneDelegate.prototype.windowScenePerformActionForShortcutItemCompletionHandler = function (windowScene, shortcutItem, completionHandler) {
|
|
490
|
+
deliverShortcutAction(windowScene, Application.ios._getWindowForScene(windowScene), shortcutItem, completionHandler);
|
|
183
491
|
};
|
|
184
492
|
SceneDelegate.ObjCProtocols = [UIWindowSceneDelegate];
|
|
185
493
|
return SceneDelegate;
|
|
@@ -193,12 +501,31 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
193
501
|
constructor() {
|
|
194
502
|
super();
|
|
195
503
|
this._delegateHandlers = new Map();
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
504
|
+
/**
|
|
505
|
+
* Root views that are a ContentView host created by this class. The host is the actual
|
|
506
|
+
* root of the window (it carries `.ns-root`, the system CSS classes and the CSS state, so
|
|
507
|
+
* the user's root view can read CSS variables as soon as it is created), and the root view
|
|
508
|
+
* the user provided (main entry / `launch` root / resetRootView) is its `content`.
|
|
509
|
+
* `getRootView()` returns that user view, as it did before NativeWindow existed.
|
|
510
|
+
*/
|
|
511
|
+
this._contentHosts = new WeakSet();
|
|
512
|
+
// Application-role windows currently in the foreground / currently active. Membership,
|
|
513
|
+
// not a count, so a repeated or missing scene callback cannot drift the aggregate.
|
|
514
|
+
this._foregroundWindows = new Set();
|
|
515
|
+
this._activeWindows = new Set();
|
|
200
516
|
this._notificationObservers = [];
|
|
517
|
+
this._softRebootSceneDelegates = new Map();
|
|
201
518
|
this.displayedOnce = false;
|
|
519
|
+
/**
|
|
520
|
+
* Delays the 'launch' event, and with it the creation of the first window's content, until the
|
|
521
|
+
* app first becomes active, instead of raising it while the app finishes launching.
|
|
522
|
+
*
|
|
523
|
+
* Applies to non-scene apps only. It has no effect in a scene-based app, where each window's
|
|
524
|
+
* content is resolved as its scene connects.
|
|
525
|
+
*
|
|
526
|
+
* @deprecated Use the 'ready' event for application initialization, and
|
|
527
|
+
* Application.setWindowContentResolver() to provide window UI.
|
|
528
|
+
*/
|
|
202
529
|
this.shouldDelayLaunchEvent = false;
|
|
203
530
|
this.addNotificationObserver(UIApplicationDidFinishLaunchingNotification, this.didFinishLaunchingWithOptions.bind(this));
|
|
204
531
|
this.addNotificationObserver(UIApplicationDidBecomeActiveNotification, this.didBecomeActive.bind(this));
|
|
@@ -206,26 +533,59 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
206
533
|
this.addNotificationObserver(UIApplicationWillTerminateNotification, this.willTerminate.bind(this));
|
|
207
534
|
this.addNotificationObserver(UIApplicationDidReceiveMemoryWarningNotification, this.didReceiveMemoryWarning.bind(this));
|
|
208
535
|
this.addNotificationObserver(UIApplicationDidChangeStatusBarOrientationNotification, this.didChangeStatusBarOrientation.bind(this));
|
|
209
|
-
// Add scene lifecycle notification observers only if scenes are supported
|
|
210
|
-
if (this.supportsScenes()) {
|
|
211
|
-
this.addNotificationObserver('UISceneWillConnectNotification', this.sceneWillConnect.bind(this));
|
|
212
|
-
this.addNotificationObserver('UISceneDidActivateNotification', this.sceneDidActivate.bind(this));
|
|
213
|
-
this.addNotificationObserver('UISceneWillEnterForegroundNotification', this.sceneWillEnterForeground.bind(this));
|
|
214
|
-
this.addNotificationObserver('UISceneDidEnterBackgroundNotification', this.sceneDidEnterBackground.bind(this));
|
|
215
|
-
this.addNotificationObserver('UISceneDidDisconnectNotification', this.sceneDidDisconnect.bind(this));
|
|
216
|
-
}
|
|
217
536
|
}
|
|
218
537
|
getRootView() {
|
|
219
|
-
|
|
538
|
+
const root = this._rootView;
|
|
539
|
+
return root && this._contentHosts.has(root) ? root.content || root : root;
|
|
220
540
|
}
|
|
221
|
-
resetRootView(
|
|
222
|
-
super.resetRootView(
|
|
541
|
+
resetRootView(entry) {
|
|
542
|
+
super.resetRootView(entry);
|
|
223
543
|
this.setWindowContent();
|
|
224
544
|
}
|
|
225
545
|
run(entry) {
|
|
226
546
|
setAppMainEntry(typeof entry === 'string' ? { moduleName: entry } : entry);
|
|
227
547
|
this.started = true;
|
|
228
548
|
if (this.nativeApp) {
|
|
549
|
+
// During Vite HMR dev boot, the placeholder has already started
|
|
550
|
+
// the app lifecycle. A second run() with an entry should replace
|
|
551
|
+
// the placeholder root, NOT present a modal via runAsEmbeddedApp.
|
|
552
|
+
// The HTTP ESM realm creates a separate @nativescript/core instance,
|
|
553
|
+
// so JS-level patching of Application.run can't intercept this call.
|
|
554
|
+
// Detect HMR mode via the placeholder's global flag and use
|
|
555
|
+
// setWindowContent on the PRIMARY Application singleton (bundled realm)
|
|
556
|
+
// which has the actual window and root view hierarchy.
|
|
557
|
+
const g = globalThis;
|
|
558
|
+
if (g.__NS_DEV_PLACEHOLDER_ROOT_VIEW__ || g.__NS_DEV_PLACEHOLDER_ROOT_EARLY__) {
|
|
559
|
+
if (entry) {
|
|
560
|
+
// Defer to next run loop tick so resetRootView executes outside the
|
|
561
|
+
// HTTP ESM import context. Direct calls can fail with
|
|
562
|
+
// "ReferenceError: __COMMONJS__ is not defined" because the JS
|
|
563
|
+
// execution stack is in the HTTP realm when Builder loads modules.
|
|
564
|
+
const resolvedEntry = typeof entry === 'string' ? { moduleName: entry } : entry;
|
|
565
|
+
setTimeout(() => {
|
|
566
|
+
try {
|
|
567
|
+
const primaryApp = g.Application;
|
|
568
|
+
if (primaryApp && typeof primaryApp.resetRootView === 'function') {
|
|
569
|
+
primaryApp.resetRootView(resolvedEntry);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
catch (e) {
|
|
573
|
+
if (__DEV__)
|
|
574
|
+
console.warn('[app-ios] deferred resetRootView failed:', e);
|
|
575
|
+
}
|
|
576
|
+
delete g.__NS_DEV_PLACEHOLDER_ROOT_VIEW__;
|
|
577
|
+
delete g.__NS_DEV_PLACEHOLDER_ROOT_EARLY__;
|
|
578
|
+
}, 0);
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
// Framework (e.g. Angular) calls run() with no entry — it manages
|
|
582
|
+
// root views itself via resetRootView(). No-op to avoid presenting
|
|
583
|
+
// a modal via runAsEmbeddedApp or throwing "Main entry is missing".
|
|
584
|
+
if (__DEV__)
|
|
585
|
+
console.info('[app-ios] run() called with no entry during HMR placeholder; framework manages root view');
|
|
586
|
+
}
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
229
589
|
this.runAsEmbeddedApp();
|
|
230
590
|
}
|
|
231
591
|
else {
|
|
@@ -236,6 +596,8 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
236
596
|
UIApplicationMain(0, null, null, this.delegate ? NSStringFromClass(this.delegate) : NSStringFromClass(Responder));
|
|
237
597
|
}
|
|
238
598
|
runAsEmbeddedApp() {
|
|
599
|
+
this.notifyReady();
|
|
600
|
+
this._reattachNativeDelegatesAfterSoftReboot();
|
|
239
601
|
// TODO: this rootView should be held alive until rootController dismissViewController is called.
|
|
240
602
|
const rootView = this.createRootView(this._rootView, true);
|
|
241
603
|
if (!rootView) {
|
|
@@ -244,38 +606,126 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
244
606
|
this._rootView = rootView;
|
|
245
607
|
setRootView(rootView);
|
|
246
608
|
// Attach to the existing iOS app
|
|
247
|
-
|
|
609
|
+
let window = getWindow();
|
|
610
|
+
if (!window) {
|
|
611
|
+
// In-process soft reboot with OTAs.
|
|
612
|
+
// Original UIWindow is deallocated when the old JS isolate is torn down.
|
|
613
|
+
// Recreate a window bound to the active UIWindowScene so the
|
|
614
|
+
// root has somewhere to attach.
|
|
615
|
+
const app = UIApplication.sharedApplication;
|
|
616
|
+
const all = app && app.connectedScenes ? app.connectedScenes.allObjects : null;
|
|
617
|
+
let targetScene;
|
|
618
|
+
if (all) {
|
|
619
|
+
for (let i = 0; i < all.count; i++) {
|
|
620
|
+
const s = all.objectAtIndex(i);
|
|
621
|
+
// Only UIWindowScene exposes `windows`; prefer a foreground-active one.
|
|
622
|
+
if (s && typeof s.windows !== 'undefined') {
|
|
623
|
+
targetScene = s;
|
|
624
|
+
if (s.activationState === 0 /* UISceneActivationState.ForegroundActive */) {
|
|
625
|
+
break;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
if (targetScene) {
|
|
631
|
+
window = UIWindow.alloc().initWithWindowScene(targetScene);
|
|
632
|
+
if (!__VISIONOS__) {
|
|
633
|
+
window.backgroundColor = SDK_VERSION <= 12 || !UIColor.systemBackgroundColor ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
|
634
|
+
}
|
|
635
|
+
// The registry lives in JS and was lost with the previous isolate, so
|
|
636
|
+
// the still-connected scene needs a fresh NativeWindow to be reachable.
|
|
637
|
+
const isPrimary = !this.primaryWindow;
|
|
638
|
+
const nativeWindow = new IOSNativeWindow(targetScene, window, IOSNativeWindow.getSceneId(targetScene), isPrimary);
|
|
639
|
+
this._registerWindow(nativeWindow);
|
|
640
|
+
if (isPrimary) {
|
|
641
|
+
setiOSWindow(window);
|
|
642
|
+
}
|
|
643
|
+
// If the scene's delegate was recreated after a soft reboot, point it
|
|
644
|
+
// at the new window so `scene.delegate.window` queries resolve.
|
|
645
|
+
const freshSceneDelegate = this._softRebootSceneDelegates.get(targetScene);
|
|
646
|
+
if (freshSceneDelegate) {
|
|
647
|
+
freshSceneDelegate.window = window;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
248
651
|
if (!window) {
|
|
249
652
|
return;
|
|
250
653
|
}
|
|
654
|
+
// May be null on a freshly recreated window — expected; the replace-root
|
|
655
|
+
// path below sets it. Only the embedder path needs an existing controller.
|
|
251
656
|
const rootController = window.rootViewController;
|
|
252
|
-
|
|
657
|
+
const embedderDelegate = NativeScriptEmbedder.sharedInstance().delegate;
|
|
658
|
+
// Embed into host app requires an existing root view controller
|
|
659
|
+
if (embedderDelegate && !rootController) {
|
|
253
660
|
return;
|
|
254
661
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
this.
|
|
262
|
-
|
|
263
|
-
rootView.on(IOSHelper.traitCollectionLayoutDirectionChangedEvent, () => {
|
|
264
|
-
const layoutDirection = controller.traitCollection.layoutDirection;
|
|
265
|
-
const newLayoutDirection = this.getLayoutDirectionValue(layoutDirection);
|
|
266
|
-
this.setLayoutDirection(newLayoutDirection);
|
|
267
|
-
});
|
|
268
|
-
if (embedderDelegate) {
|
|
269
|
-
this.setViewControllerView(rootView);
|
|
270
|
-
embedderDelegate.presentNativeScriptApp(controller);
|
|
662
|
+
let hostWindow = this.primaryWindow;
|
|
663
|
+
if (!hostWindow) {
|
|
664
|
+
// Only an embedder delegate makes this window a guest: without one NativeScript
|
|
665
|
+
// owns the UIApplication and the window has to attach its own content.
|
|
666
|
+
const role = embedderDelegate ? 'embedded' : 'application';
|
|
667
|
+
hostWindow = new IOSNativeWindow(window.windowScene ?? undefined, window, 'embedded-main', true, role);
|
|
668
|
+
this._registerWindow(hostWindow);
|
|
669
|
+
hostWindow._notifyEvent(NativeWindowEvents.attached);
|
|
271
670
|
}
|
|
272
|
-
|
|
273
|
-
const visibleVC = iosUtils.getVisibleViewController(rootController);
|
|
274
|
-
visibleVC.presentViewControllerAnimatedCompletion(controller, true, null);
|
|
275
|
-
}
|
|
276
|
-
this.initRootView(rootView);
|
|
671
|
+
hostWindow.setContent(rootView);
|
|
277
672
|
this.notifyAppStarted();
|
|
278
673
|
}
|
|
674
|
+
/**
|
|
675
|
+
* After an in-process soft reboot (NativeScriptRuntime.reloadApplication /
|
|
676
|
+
* restartWithConfig), the Objective-C delegate classes created by the
|
|
677
|
+
* previous JS isolate still exist and UIKit keeps dispatching to their
|
|
678
|
+
* now-inert instances: their method callbacks bail out because the isolate
|
|
679
|
+
* that implemented them is gone. Notification-center observers are
|
|
680
|
+
* re-registered by the new isolate, but delegate-based dispatch (custom
|
|
681
|
+
* UIApplicationDelegate methods like push-token/openURL callbacks, and the
|
|
682
|
+
* UIScene delegates used by scene-lifecycle apps) stays pinned to the old
|
|
683
|
+
* bundle. Recreate those delegates from this bundle's classes and re-point
|
|
684
|
+
* UIKit at them.
|
|
685
|
+
*/
|
|
686
|
+
_reattachNativeDelegatesAfterSoftReboot() {
|
|
687
|
+
if (getRuntimeReloadCount() <= 0) {
|
|
688
|
+
// First boot: UIApplicationMain (or the host app) set up delegates.
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
if (isEmbedded()) {
|
|
692
|
+
// The host app owns the UIApplication delegate; never touch it.
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
const app = UIApplication.sharedApplication;
|
|
696
|
+
if (!app) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
// Fresh application delegate from the new bundle. Assigning `delegate`
|
|
700
|
+
// does not retain (unlike the UIApplicationMain launch path), so keep a
|
|
701
|
+
// strong reference ourselves.
|
|
702
|
+
this.delegate ?? (this.delegate = Responder);
|
|
703
|
+
const freshDelegate = this.delegate.new();
|
|
704
|
+
this._softRebootAppDelegate = freshDelegate;
|
|
705
|
+
app.delegate = freshDelegate;
|
|
706
|
+
// Re-point already-connected scenes at fresh scene delegates so scene
|
|
707
|
+
// lifecycle and user-implemented scene delegate methods (shortcuts,
|
|
708
|
+
// openURLContexts, userActivity continuation, etc.) reach this isolate.
|
|
709
|
+
// Newly connecting scenes are covered by the fresh application delegate's
|
|
710
|
+
// applicationConfigurationForConnectingSceneSessionOptions, which returns
|
|
711
|
+
// this bundle's SceneDelegate class.
|
|
712
|
+
if (this.supportsScenes()) {
|
|
713
|
+
this._softRebootSceneDelegates.clear();
|
|
714
|
+
const scenes = app.connectedScenes?.allObjects;
|
|
715
|
+
for (let i = 0; scenes && i < scenes.count; i++) {
|
|
716
|
+
const scene = scenes.objectAtIndex(i);
|
|
717
|
+
if (!(scene instanceof UIWindowScene)) {
|
|
718
|
+
continue;
|
|
719
|
+
}
|
|
720
|
+
const freshSceneDelegate = SceneDelegate.new();
|
|
721
|
+
scene.delegate = freshSceneDelegate;
|
|
722
|
+
this._softRebootSceneDelegates.set(scene, freshSceneDelegate);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if (Trace.isEnabled()) {
|
|
726
|
+
Trace.write(`Reattached application delegate${this._softRebootSceneDelegates.size ? ` and ${this._softRebootSceneDelegates.size} scene delegate(s)` : ''} after soft reboot (reloadCount: ${getRuntimeReloadCount()})`, Trace.categories.NativeLifecycle);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
279
729
|
getViewController(rootView) {
|
|
280
730
|
let viewController = rootView.viewController || rootView.ios;
|
|
281
731
|
if (!(viewController instanceof UIViewController)) {
|
|
@@ -357,15 +807,74 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
357
807
|
set delegate(value) {
|
|
358
808
|
if (this._delegate !== value) {
|
|
359
809
|
this._delegate = value;
|
|
810
|
+
if (value) {
|
|
811
|
+
warnAboutDelegateClass(value, this.started);
|
|
812
|
+
installSceneDelegateDefaults(value);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* NativeScript's default implementation of the `UIApplicationDelegate`
|
|
818
|
+
* `applicationConfigurationForConnectingSceneSessionOptions` method.
|
|
819
|
+
*
|
|
820
|
+
* It is installed automatically on the application delegate class unless that class
|
|
821
|
+
* already implements the method. A delegate that does implement it can handle the
|
|
822
|
+
* scenes it cares about and forward the rest here:
|
|
823
|
+
*
|
|
824
|
+
* ```ts
|
|
825
|
+
* applicationConfigurationForConnectingSceneSessionOptions(app, session, options) {
|
|
826
|
+
* if (session.role === myCustomRole) {
|
|
827
|
+
* return myConfig;
|
|
828
|
+
* }
|
|
829
|
+
* return Application.ios.defaultSceneConfiguration(app, session, options);
|
|
830
|
+
* }
|
|
831
|
+
* ```
|
|
832
|
+
*
|
|
833
|
+
* `onSceneConfiguration` is consulted first. Scenes with the
|
|
834
|
+
* `UIWindowSceneSessionRoleApplication` role then get a configuration backed by
|
|
835
|
+
* NativeScript's SceneDelegate; every other role gets a bare configuration that
|
|
836
|
+
* NativeScript does not manage.
|
|
837
|
+
*/
|
|
838
|
+
defaultSceneConfiguration(application, connectingSceneSession, options) {
|
|
839
|
+
// Let the user intercept scene configuration for any/all scenes
|
|
840
|
+
const userHandler = this._onSceneConfiguration;
|
|
841
|
+
if (userHandler) {
|
|
842
|
+
const userConfig = userHandler(application, connectingSceneSession, options);
|
|
843
|
+
if (userConfig) {
|
|
844
|
+
return userConfig;
|
|
845
|
+
}
|
|
360
846
|
}
|
|
847
|
+
// Only handle the standard window scene role — skip CarPlay, external displays, etc.
|
|
848
|
+
if (connectingSceneSession.role !== UIWindowSceneSessionRoleApplication) {
|
|
849
|
+
// Return a bare configuration so iOS doesn't crash, but NativeScript won't manage it
|
|
850
|
+
return UISceneConfiguration.configurationWithNameSessionRole('Unmanaged', connectingSceneSession.role);
|
|
851
|
+
}
|
|
852
|
+
const config = UISceneConfiguration.configurationWithNameSessionRole('Default Configuration', connectingSceneSession.role);
|
|
853
|
+
config.sceneClass = UIWindowScene;
|
|
854
|
+
config.delegateClass = SceneDelegate;
|
|
855
|
+
return config;
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* NativeScript's default implementation of the `UIApplicationDelegate`
|
|
859
|
+
* `applicationDidDiscardSceneSessions` method, which retires the `NativeWindow`s
|
|
860
|
+
* belonging to the discarded sessions.
|
|
861
|
+
*
|
|
862
|
+
* It is installed automatically on the application delegate class unless that class
|
|
863
|
+
* already implements the method, in which case forward to it from there so window
|
|
864
|
+
* bookkeeping stays correct.
|
|
865
|
+
*/
|
|
866
|
+
defaultDiscardSceneSessions(application, sceneSessions) {
|
|
867
|
+
this._onSceneSessionsDiscarded(sceneSessions);
|
|
361
868
|
}
|
|
362
869
|
addDelegateHandler(methodName, handler) {
|
|
363
870
|
// safe-guard against invalid handlers
|
|
364
871
|
if (typeof handler !== 'function') {
|
|
365
872
|
return;
|
|
366
873
|
}
|
|
367
|
-
// ensure we have a delegate
|
|
368
|
-
|
|
874
|
+
// ensure we have a delegate; Responder already carries the defaults, so it is
|
|
875
|
+
// stored directly rather than through the setter, whose warnings only apply to
|
|
876
|
+
// a delegate class the app supplied.
|
|
877
|
+
this._delegate ?? (this._delegate = Responder);
|
|
369
878
|
const handlers = this._delegateHandlers.get(methodName) ?? [];
|
|
370
879
|
if (!this._delegateHandlers.has(methodName)) {
|
|
371
880
|
const originalHandler = this.delegate.prototype[methodName];
|
|
@@ -407,11 +916,12 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
407
916
|
}
|
|
408
917
|
getSystemAppearance() {
|
|
409
918
|
// userInterfaceStyle is available on UITraitCollection since iOS 12.
|
|
410
|
-
if (
|
|
919
|
+
if (!__VISIONOS__ && SDK_VERSION <= 11) {
|
|
411
920
|
return null;
|
|
412
921
|
}
|
|
413
|
-
|
|
414
|
-
|
|
922
|
+
// the launch event fires before the window has a root view controller: the screen traits are enough then
|
|
923
|
+
const traits = this.rootController?.traitCollection ?? this.window?.traitCollection ?? UIScreen.mainScreen.traitCollection;
|
|
924
|
+
return this.getSystemAppearanceValue(traits.userInterfaceStyle);
|
|
415
925
|
}
|
|
416
926
|
getSystemAppearanceValue(userInterfaceStyle) {
|
|
417
927
|
switch (userInterfaceStyle) {
|
|
@@ -471,7 +981,6 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
471
981
|
return [newOrientation, degrees];
|
|
472
982
|
}
|
|
473
983
|
notifyAppStarted(notification) {
|
|
474
|
-
this.launchEventCalled = true;
|
|
475
984
|
const root = this.notifyLaunch({
|
|
476
985
|
ios: notification?.userInfo?.objectForKey('UIApplicationLaunchOptionsLocalNotificationKey') ?? null,
|
|
477
986
|
});
|
|
@@ -484,10 +993,6 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
484
993
|
setiOSWindow(this.window);
|
|
485
994
|
}
|
|
486
995
|
}
|
|
487
|
-
// Public method for scene-based app startup
|
|
488
|
-
_notifySceneAppStarted() {
|
|
489
|
-
this.notifyAppStarted();
|
|
490
|
-
}
|
|
491
996
|
_onLivesync(context) {
|
|
492
997
|
// Handle application root module
|
|
493
998
|
const isAppRootModuleChanged = context && context.path && context.path.includes(this.getMainEntry().moduleName) && context.type !== 'style';
|
|
@@ -502,15 +1007,64 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
502
1007
|
}
|
|
503
1008
|
}
|
|
504
1009
|
setWindowContent(view) {
|
|
1010
|
+
const userView = this.createRootView(view);
|
|
1011
|
+
const primaryWindow = this.primaryWindow;
|
|
1012
|
+
if (primaryWindow) {
|
|
1013
|
+
this.setHostedWindowContent(primaryWindow, userView);
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
this.setWindowContentFallback(userView);
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Installs `userView` as the content of `window`, hosted in a ContentView which is the
|
|
1020
|
+
* window's actual root view (see `_contentHosts`).
|
|
1021
|
+
*/
|
|
1022
|
+
setHostedWindowContent(window, userView) {
|
|
1023
|
+
const host = createContentView();
|
|
1024
|
+
this._contentHosts.add(host);
|
|
1025
|
+
// Sets the host up as a root view (CSS classes, native controller) and, for the primary
|
|
1026
|
+
// window, raises `initRootView` for it through `contentLoaded` -> `adoptRootView`.
|
|
1027
|
+
window.setContent(host);
|
|
1028
|
+
this.attachUserRootView(host, userView);
|
|
1029
|
+
}
|
|
1030
|
+
attachUserRootView(host, userView) {
|
|
1031
|
+
if (!userView) {
|
|
1032
|
+
// no root view created
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
if (userView.parent) {
|
|
1036
|
+
userView.parent._removeView(userView);
|
|
1037
|
+
}
|
|
1038
|
+
host.content = userView;
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* The primary window's content is hosted in a ContentView so `Application.getRootView()`
|
|
1042
|
+
* and the first CSS pass behave as before NativeWindow. Other windows get the resolved
|
|
1043
|
+
* view as their root directly.
|
|
1044
|
+
* TODO(merge): secondary windows are not hosted in a ContentView.
|
|
1045
|
+
*/
|
|
1046
|
+
_resolveWindowContent(window, request, options) {
|
|
1047
|
+
if (!window.isPrimary || options?.install === false) {
|
|
1048
|
+
return super._resolveWindowContent(window, request, options);
|
|
1049
|
+
}
|
|
1050
|
+
const userView = super._resolveWindowContent(window, request, { ...options, install: false });
|
|
1051
|
+
if (!userView) {
|
|
1052
|
+
return null;
|
|
1053
|
+
}
|
|
1054
|
+
this.setHostedWindowContent(window, userView);
|
|
1055
|
+
return userView;
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Attaches content to the raw `UIWindow`. Every launch path registers a primary
|
|
1059
|
+
* NativeWindow, so this only runs when no window is left to own the content.
|
|
1060
|
+
*/
|
|
1061
|
+
setWindowContentFallback(userView) {
|
|
505
1062
|
if (this._rootView) {
|
|
506
|
-
// if we already have a root view, we reset it.
|
|
507
1063
|
this._rootView._onRootViewReset();
|
|
508
1064
|
}
|
|
509
|
-
|
|
510
|
-
|
|
1065
|
+
const rootView = createContentView();
|
|
1066
|
+
this._contentHosts.add(rootView);
|
|
511
1067
|
const controller = this.getViewController(rootView);
|
|
512
|
-
this._rootView = rootView;
|
|
513
|
-
setRootView(rootView);
|
|
514
1068
|
// setup view as styleScopeHost
|
|
515
1069
|
rootView._setupAsRootView({});
|
|
516
1070
|
this.setViewControllerView(rootView);
|
|
@@ -520,28 +1074,8 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
520
1074
|
if (!haveController) {
|
|
521
1075
|
win.makeKeyAndVisible();
|
|
522
1076
|
}
|
|
523
|
-
this.
|
|
524
|
-
|
|
525
|
-
const userInterfaceStyle = controller.traitCollection.userInterfaceStyle;
|
|
526
|
-
const newSystemAppearance = this.getSystemAppearanceValue(userInterfaceStyle);
|
|
527
|
-
this.setSystemAppearance(newSystemAppearance);
|
|
528
|
-
});
|
|
529
|
-
rootView.on(IOSHelper.traitCollectionLayoutDirectionChangedEvent, () => {
|
|
530
|
-
const layoutDirection = controller.traitCollection.layoutDirection;
|
|
531
|
-
const newLayoutDirection = this.getLayoutDirectionValue(layoutDirection);
|
|
532
|
-
this.setLayoutDirection(newLayoutDirection);
|
|
533
|
-
});
|
|
534
|
-
let subRootView = this._subRootView;
|
|
535
|
-
subRootView = this.createRootView(view);
|
|
536
|
-
if (!subRootView) {
|
|
537
|
-
// no root view created
|
|
538
|
-
return;
|
|
539
|
-
}
|
|
540
|
-
this._subRootView = subRootView;
|
|
541
|
-
if (subRootView.parent) {
|
|
542
|
-
subRootView.parent._removeView(subRootView);
|
|
543
|
-
}
|
|
544
|
-
rootView.content = subRootView;
|
|
1077
|
+
this.adoptRootView(rootView);
|
|
1078
|
+
this.attachUserRootView(rootView, userView);
|
|
545
1079
|
}
|
|
546
1080
|
// Observers
|
|
547
1081
|
didFinishLaunchingWithOptions(notification) {
|
|
@@ -559,6 +1093,8 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
559
1093
|
}
|
|
560
1094
|
}
|
|
561
1095
|
}
|
|
1096
|
+
// Must precede every window registration below and every scene connect that follows.
|
|
1097
|
+
this.notifyReady();
|
|
562
1098
|
this.setMaxRefreshRate();
|
|
563
1099
|
// Only set up window if NOT using scene-based lifecycle
|
|
564
1100
|
if (!this.supportsScenes()) {
|
|
@@ -572,9 +1108,25 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
572
1108
|
if (!__VISIONOS__) {
|
|
573
1109
|
this.window.backgroundColor = SDK_VERSION <= 12 || !UIColor.systemBackgroundColor ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
|
574
1110
|
}
|
|
575
|
-
this.
|
|
576
|
-
|
|
577
|
-
this.
|
|
1111
|
+
if (!this.primaryWindow) {
|
|
1112
|
+
const nativeWindow = new IOSNativeWindow(undefined, this.window, 'main', true, 'application');
|
|
1113
|
+
this._registerWindow(nativeWindow);
|
|
1114
|
+
nativeWindow._notifyEvent(NativeWindowEvents.attached);
|
|
1115
|
+
}
|
|
1116
|
+
const primaryWindow = this.primaryWindow;
|
|
1117
|
+
const resolveContent = () => this._resolveWindowContent(primaryWindow, {
|
|
1118
|
+
window: primaryWindow,
|
|
1119
|
+
isPrimary: true,
|
|
1120
|
+
}, {
|
|
1121
|
+
launchData: {
|
|
1122
|
+
ios: notification?.userInfo?.objectForKey('UIApplicationLaunchOptionsLocalNotificationKey') ?? null,
|
|
1123
|
+
},
|
|
1124
|
+
});
|
|
1125
|
+
if (this.shouldDelayLaunchEvent) {
|
|
1126
|
+
this._pendingWindowContentResolve = resolveContent;
|
|
1127
|
+
}
|
|
1128
|
+
else {
|
|
1129
|
+
resolveContent();
|
|
578
1130
|
}
|
|
579
1131
|
}
|
|
580
1132
|
else {
|
|
@@ -582,36 +1134,42 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
582
1134
|
}
|
|
583
1135
|
}
|
|
584
1136
|
didBecomeActive(notification) {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
1137
|
+
const pendingWindowContentResolve = this._pendingWindowContentResolve;
|
|
1138
|
+
if (pendingWindowContentResolve) {
|
|
1139
|
+
this._pendingWindowContentResolve = null;
|
|
1140
|
+
pendingWindowContentResolve();
|
|
1141
|
+
}
|
|
1142
|
+
// A scene app derives app-level state from its windows, so this notification must not
|
|
1143
|
+
// drive it as well. In scene mode the root view belongs to a window too, so the scene
|
|
1144
|
+
// delegate loads it.
|
|
1145
|
+
if (!this.supportsScenes()) {
|
|
1146
|
+
const additionalData = {
|
|
1147
|
+
ios: UIApplication.sharedApplication,
|
|
1148
|
+
};
|
|
1149
|
+
this.setInBackground(false, additionalData);
|
|
1150
|
+
this.setSuspended(false, additionalData);
|
|
1151
|
+
const rootView = this._rootView;
|
|
1152
|
+
if (rootView && !rootView.isLoaded) {
|
|
1153
|
+
rootView.callLoaded();
|
|
1154
|
+
}
|
|
596
1155
|
}
|
|
597
1156
|
}
|
|
598
1157
|
didEnterBackground(notification) {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
rootView.
|
|
1158
|
+
// See didBecomeActive: in scene mode the windows drive app-level state.
|
|
1159
|
+
if (!this.supportsScenes()) {
|
|
1160
|
+
const additionalData = {
|
|
1161
|
+
ios: UIApplication.sharedApplication,
|
|
1162
|
+
};
|
|
1163
|
+
this.setInBackground(true, additionalData);
|
|
1164
|
+
this.setSuspended(true, additionalData);
|
|
1165
|
+
const rootView = this._rootView;
|
|
1166
|
+
if (rootView && rootView.isLoaded) {
|
|
1167
|
+
rootView.callUnloaded();
|
|
1168
|
+
}
|
|
607
1169
|
}
|
|
608
1170
|
}
|
|
609
1171
|
willTerminate(notification) {
|
|
610
|
-
this.
|
|
611
|
-
eventName: this.exitEvent,
|
|
612
|
-
object: this,
|
|
613
|
-
ios: this.ios,
|
|
614
|
-
});
|
|
1172
|
+
this.notifyExit({ ios: this.ios });
|
|
615
1173
|
// const rootView = this._rootView;
|
|
616
1174
|
// if (rootView && rootView.isLoaded) {
|
|
617
1175
|
// rootView.callUnloaded();
|
|
@@ -625,151 +1183,150 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
625
1183
|
});
|
|
626
1184
|
}
|
|
627
1185
|
didChangeStatusBarOrientation(notification) {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
this.
|
|
631
|
-
|
|
632
|
-
// Scene lifecycle notification handlers
|
|
633
|
-
sceneWillConnect(notification) {
|
|
634
|
-
const scene = notification.object;
|
|
635
|
-
if (!scene || !(scene instanceof UIWindowScene)) {
|
|
636
|
-
return;
|
|
637
|
-
}
|
|
638
|
-
// Store as primary scene if it's the first one
|
|
639
|
-
if (!this._primaryScene) {
|
|
640
|
-
this._primaryScene = scene;
|
|
1186
|
+
// The notification is app-wide, but scenes rotate independently, so every attached
|
|
1187
|
+
// window is refreshed from its own scene.
|
|
1188
|
+
for (const nativeWindow of this._windows) {
|
|
1189
|
+
nativeWindow._syncOrientation();
|
|
641
1190
|
}
|
|
642
|
-
this.notify({
|
|
643
|
-
eventName: SceneEvents.sceneWillConnect,
|
|
644
|
-
object: this,
|
|
645
|
-
scene: scene,
|
|
646
|
-
userInfo: notification.userInfo,
|
|
647
|
-
});
|
|
648
1191
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
this.
|
|
663
|
-
this.setSuspended(false, additionalData);
|
|
664
|
-
if (this._rootView && !this._rootView.isLoaded) {
|
|
665
|
-
this._rootView.callLoaded();
|
|
666
|
-
}
|
|
1192
|
+
// --- App-level root view mirror ---
|
|
1193
|
+
/**
|
|
1194
|
+
* Keeps the app-level root view state (`getRootView()`, the global root view and the
|
|
1195
|
+
* `initRootView` event) following whatever the primary window shows.
|
|
1196
|
+
*/
|
|
1197
|
+
mirrorPrimaryWindow(nativeWindow) {
|
|
1198
|
+
if (this._mirroredWindow === nativeWindow) {
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
this._mirroredWindow?.off(NativeWindowEvents.contentLoaded, this.onPrimaryWindowContentLoaded, this);
|
|
1202
|
+
this._mirroredWindow = nativeWindow;
|
|
1203
|
+
nativeWindow.on(NativeWindowEvents.contentLoaded, this.onPrimaryWindowContentLoaded, this);
|
|
1204
|
+
if (nativeWindow.rootView && nativeWindow.rootView !== this._rootView) {
|
|
1205
|
+
this.adoptRootView(nativeWindow.rootView);
|
|
667
1206
|
}
|
|
668
1207
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
this.notify({
|
|
672
|
-
eventName: SceneEvents.sceneWillEnterForeground,
|
|
673
|
-
object: this,
|
|
674
|
-
scene: scene,
|
|
675
|
-
});
|
|
1208
|
+
onPrimaryWindowContentLoaded(data) {
|
|
1209
|
+
this.adoptRootView(data.window.rootView);
|
|
676
1210
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
eventName: SceneEvents.sceneDidEnterBackground,
|
|
681
|
-
object: this,
|
|
682
|
-
scene: scene,
|
|
683
|
-
});
|
|
684
|
-
// If this is the primary scene, trigger traditional app lifecycle
|
|
685
|
-
if (scene === this._primaryScene) {
|
|
686
|
-
const additionalData = {
|
|
687
|
-
ios: UIApplication.sharedApplication,
|
|
688
|
-
scene: scene,
|
|
689
|
-
};
|
|
690
|
-
this.setInBackground(true, additionalData);
|
|
691
|
-
this.setSuspended(true, additionalData);
|
|
692
|
-
if (this._rootView && this._rootView.isLoaded) {
|
|
693
|
-
this._rootView.callUnloaded();
|
|
694
|
-
}
|
|
1211
|
+
adoptRootView(rootView) {
|
|
1212
|
+
if (!rootView) {
|
|
1213
|
+
return;
|
|
695
1214
|
}
|
|
1215
|
+
this._rootView = rootView;
|
|
1216
|
+
setRootView(rootView);
|
|
1217
|
+
this.initRootView(rootView, this._mirroredWindow);
|
|
696
1218
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
1219
|
+
// --- NativeWindow registry ---
|
|
1220
|
+
/**
|
|
1221
|
+
* @internal - hands the discarded sessions' ids to the window registry, which decides
|
|
1222
|
+
* which of them name a window that is actually finished with.
|
|
1223
|
+
*/
|
|
1224
|
+
_onSceneSessionsDiscarded(sessions) {
|
|
1225
|
+
const all = sessions?.allObjects;
|
|
1226
|
+
if (!all) {
|
|
1227
|
+
return;
|
|
703
1228
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
console.log('Failed to activate primary scene:', err.localizedDescription);
|
|
710
|
-
}
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
else {
|
|
714
|
-
UIApplication.sharedApplication.requestSceneSessionActivationUserActivityOptionsErrorHandler(this._primaryScene.session, null, null, (err) => {
|
|
715
|
-
if (err) {
|
|
716
|
-
console.log('Failed to activate primary scene (legacy):', err.localizedDescription);
|
|
717
|
-
}
|
|
718
|
-
});
|
|
1229
|
+
const ids = [];
|
|
1230
|
+
for (let i = 0; i < all.count; i++) {
|
|
1231
|
+
const persistentIdentifier = all.objectAtIndex(i)?.persistentIdentifier;
|
|
1232
|
+
if (persistentIdentifier) {
|
|
1233
|
+
ids.push(`${persistentIdentifier}`);
|
|
719
1234
|
}
|
|
720
1235
|
}
|
|
721
|
-
this.
|
|
722
|
-
eventName: SceneEvents.sceneDidDisconnect,
|
|
723
|
-
object: this,
|
|
724
|
-
scene: scene,
|
|
725
|
-
});
|
|
1236
|
+
this._retireDiscardedWindows(ids);
|
|
726
1237
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
1238
|
+
/**
|
|
1239
|
+
* @internal - Get a NativeWindow by its scene.
|
|
1240
|
+
*/
|
|
1241
|
+
_getWindowForScene(scene) {
|
|
1242
|
+
return this._windows.find((nw) => nw.ios?.scene === scene);
|
|
730
1243
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
1244
|
+
/**
|
|
1245
|
+
* @internal - Feeds a window's foreground state into the application-level
|
|
1246
|
+
* 'foreground'/'background' events, which describe the app as a whole: they are raised
|
|
1247
|
+
* when the first application-role window enters the foreground and when the last one
|
|
1248
|
+
* leaves it. Windows in any other role never speak for the app.
|
|
1249
|
+
*/
|
|
1250
|
+
_setWindowInForeground(nativeWindow, inForeground, scene) {
|
|
1251
|
+
if (this._trackWindowState(this._foregroundWindows, nativeWindow, inForeground)) {
|
|
1252
|
+
this.setInBackground(!inForeground, {
|
|
1253
|
+
ios: UIApplication.sharedApplication,
|
|
1254
|
+
scene,
|
|
1255
|
+
});
|
|
740
1256
|
}
|
|
741
|
-
catch { }
|
|
742
1257
|
}
|
|
743
|
-
|
|
744
|
-
|
|
1258
|
+
/**
|
|
1259
|
+
* @internal - Feeds a window's active state into the application-level 'resume'/'suspend'
|
|
1260
|
+
* events, raised when the first application-role window becomes active and when the last
|
|
1261
|
+
* active one resigns.
|
|
1262
|
+
*/
|
|
1263
|
+
_setWindowActive(nativeWindow, active, scene) {
|
|
1264
|
+
if (this._trackWindowState(this._activeWindows, nativeWindow, active)) {
|
|
1265
|
+
this.setSuspended(!active, {
|
|
1266
|
+
ios: UIApplication.sharedApplication,
|
|
1267
|
+
scene,
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
745
1270
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
1271
|
+
/**
|
|
1272
|
+
* @returns whether the set flipped between empty and non-empty, which is the only point
|
|
1273
|
+
* at which app-level state changes.
|
|
1274
|
+
*/
|
|
1275
|
+
_trackWindowState(windows, nativeWindow, member) {
|
|
1276
|
+
if (nativeWindow?.role !== 'application') {
|
|
1277
|
+
return false;
|
|
749
1278
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
this._openedScenesById.set(id, scene);
|
|
1279
|
+
const wasPopulated = windows.size > 0;
|
|
1280
|
+
if (member) {
|
|
1281
|
+
windows.add(nativeWindow);
|
|
754
1282
|
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
if (!__VISIONOS__) {
|
|
758
|
-
window.backgroundColor = SDK_VERSION <= 12 || !UIColor.systemBackgroundColor ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
|
1283
|
+
else {
|
|
1284
|
+
windows.delete(nativeWindow);
|
|
759
1285
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
}
|
|
766
|
-
// During initial scene startup we must wait for launch to be notified first.
|
|
767
|
-
// Some frameworks provide root content from launch handlers.
|
|
768
|
-
if (this.hasLaunched()) {
|
|
769
|
-
this.setWindowContent();
|
|
770
|
-
}
|
|
1286
|
+
return wasPopulated !== windows.size > 0;
|
|
1287
|
+
}
|
|
1288
|
+
_onWindowRegistered(nativeWindow) {
|
|
1289
|
+
if (nativeWindow.isPrimary) {
|
|
1290
|
+
this.mirrorPrimaryWindow(nativeWindow);
|
|
771
1291
|
}
|
|
772
1292
|
}
|
|
1293
|
+
_onPrimaryWindowPromoted(nativeWindow) {
|
|
1294
|
+
const promotedWindow = nativeWindow.ios?.uiWindow;
|
|
1295
|
+
if (promotedWindow) {
|
|
1296
|
+
setiOSWindow(promotedWindow);
|
|
1297
|
+
}
|
|
1298
|
+
this.mirrorPrimaryWindow(nativeWindow);
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Register a callback to intercept scene configuration.
|
|
1302
|
+
*
|
|
1303
|
+
* Called for every new scene session. Return a `UISceneConfiguration` to handle
|
|
1304
|
+
* the scene yourself (e.g. CarPlay, external display), or return `null`/`undefined`
|
|
1305
|
+
* to let NativeScript handle it with the default SceneDelegate.
|
|
1306
|
+
*
|
|
1307
|
+
* NativeScript only auto-manages `UIWindowSceneSessionRoleApplication` scenes.
|
|
1308
|
+
* All other scene roles are ignored unless you provide a configuration here.
|
|
1309
|
+
*
|
|
1310
|
+
* @example
|
|
1311
|
+
* ```ts
|
|
1312
|
+
* Application.ios.onSceneConfiguration = (app, session, options) => {
|
|
1313
|
+
* if (session.role === CPTemplateApplicationSceneSessionRoleApplication) {
|
|
1314
|
+
* const config = UISceneConfiguration.configurationWithNameSessionRole('CarPlay', session.role);
|
|
1315
|
+
* config.delegateClass = MyCarPlaySceneDelegate;
|
|
1316
|
+
* return config;
|
|
1317
|
+
* }
|
|
1318
|
+
* // Return null to let NativeScript handle the default window scene
|
|
1319
|
+
* return null;
|
|
1320
|
+
* };
|
|
1321
|
+
* ```
|
|
1322
|
+
*/
|
|
1323
|
+
set onSceneConfiguration(handler) {
|
|
1324
|
+
this._onSceneConfiguration = handler;
|
|
1325
|
+
}
|
|
1326
|
+
get onSceneConfiguration() {
|
|
1327
|
+
return this._onSceneConfiguration;
|
|
1328
|
+
}
|
|
1329
|
+
// Scene management helper methods (kept for backward compat)
|
|
773
1330
|
get sceneDelegate() {
|
|
774
1331
|
if (!this._sceneDelegate) {
|
|
775
1332
|
this._sceneDelegate = SceneDelegate.new();
|
|
@@ -783,10 +1340,12 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
783
1340
|
* Multi-window support
|
|
784
1341
|
*/
|
|
785
1342
|
/**
|
|
786
|
-
* Opens a new window
|
|
787
|
-
*
|
|
1343
|
+
* Opens a new window (scene).
|
|
1344
|
+
*
|
|
1345
|
+
* @param options Options for the new window. `options.data` is serialized into the
|
|
1346
|
+
* activating scene's `NSUserActivity.userInfo`.
|
|
788
1347
|
*/
|
|
789
|
-
openWindow(
|
|
1348
|
+
openWindow(options) {
|
|
790
1349
|
if (!supportsMultipleScenes()) {
|
|
791
1350
|
console.log('Cannot create a new scene - not supported on this device.');
|
|
792
1351
|
return;
|
|
@@ -795,34 +1354,18 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
795
1354
|
const app = UIApplication.sharedApplication;
|
|
796
1355
|
// iOS 17+
|
|
797
1356
|
if (SDK_VERSION >= 17) {
|
|
798
|
-
// Create a new scene activation request with proper role
|
|
799
1357
|
let request;
|
|
800
1358
|
try {
|
|
801
|
-
// Use the correct factory method to create request with role
|
|
802
|
-
// Based on the type definitions, this is the proper way
|
|
803
1359
|
request = UISceneSessionActivationRequest.requestWithRole(UIWindowSceneSessionRoleApplication);
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
activity.userInfo = dataSerialize(data);
|
|
1360
|
+
const activity = NSUserActivity.alloc().initWithActivityType(getSceneActivityType());
|
|
1361
|
+
activity.userInfo = dataSerialize(options?.data ?? {});
|
|
807
1362
|
request.userActivity = activity;
|
|
808
|
-
|
|
809
|
-
const
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
options
|
|
814
|
-
/**
|
|
815
|
-
* Note: This does not work in testing but worth exploring further sometime
|
|
816
|
-
* regarding the size/dimensions of opened secondary windows.
|
|
817
|
-
* The initial size is ultimately determined by the system
|
|
818
|
-
* based on available space and user context.
|
|
819
|
-
*/
|
|
820
|
-
// Get the size restrictions from the window scene
|
|
821
|
-
// const sizeRestrictions = (options.requestingScene as UIWindowScene).sizeRestrictions;
|
|
822
|
-
// // Set your minimum and maximum dimensions
|
|
823
|
-
// sizeRestrictions.minimumSize = CGSizeMake(320, 400);
|
|
824
|
-
// sizeRestrictions.maximumSize = CGSizeMake(600, 800);
|
|
825
|
-
request.options = options;
|
|
1363
|
+
const activationOptions = UISceneActivationRequestOptions.new();
|
|
1364
|
+
const primary = this.primaryWindow;
|
|
1365
|
+
if (primary?.ios?.scene) {
|
|
1366
|
+
activationOptions.requestingScene = primary.ios.scene;
|
|
1367
|
+
}
|
|
1368
|
+
request.options = activationOptions;
|
|
826
1369
|
}
|
|
827
1370
|
catch (roleError) {
|
|
828
1371
|
console.log('Error creating request:', roleError);
|
|
@@ -831,32 +1374,25 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
831
1374
|
app.activateSceneSessionForRequestErrorHandler(request, (error) => {
|
|
832
1375
|
if (error) {
|
|
833
1376
|
console.log('Error creating new scene (iOS 17+):', error);
|
|
834
|
-
// Log additional debugging info
|
|
835
1377
|
if (error.userInfo) {
|
|
836
1378
|
console.error(`Error userInfo: ${error.userInfo.description}`);
|
|
837
1379
|
}
|
|
838
|
-
// Handle specific error types
|
|
839
1380
|
if (error.localizedDescription.includes('role') && error.localizedDescription.includes('nil')) {
|
|
840
|
-
this.createSceneWithLegacyAPI(data);
|
|
1381
|
+
this.createSceneWithLegacyAPI(options?.data);
|
|
841
1382
|
}
|
|
842
1383
|
else if (error.domain === 'FBSWorkspaceErrorDomain' && error.code === 2) {
|
|
843
|
-
this.createSceneWithLegacyAPI(data);
|
|
1384
|
+
this.createSceneWithLegacyAPI(options?.data);
|
|
844
1385
|
}
|
|
845
1386
|
}
|
|
846
1387
|
});
|
|
847
1388
|
}
|
|
848
|
-
// iOS 13-16 - Use the legacy requestSceneSessionActivationUserActivityOptionsErrorHandler method
|
|
849
1389
|
else if (SDK_VERSION >= 13 && SDK_VERSION < 17) {
|
|
850
|
-
app.requestSceneSessionActivationUserActivityOptionsErrorHandler(null,
|
|
851
|
-
null, // userActivity
|
|
852
|
-
null, // options
|
|
853
|
-
(error) => {
|
|
1390
|
+
app.requestSceneSessionActivationUserActivityOptionsErrorHandler(null, null, null, (error) => {
|
|
854
1391
|
if (error) {
|
|
855
1392
|
console.log('Error creating new scene (legacy):', error);
|
|
856
1393
|
}
|
|
857
1394
|
});
|
|
858
1395
|
}
|
|
859
|
-
// Fallback for older iOS versions or unsupported configurations
|
|
860
1396
|
else {
|
|
861
1397
|
console.log('Neither new nor legacy scene activation methods are available');
|
|
862
1398
|
}
|
|
@@ -867,71 +1403,66 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
867
1403
|
}
|
|
868
1404
|
/**
|
|
869
1405
|
* Closes a secondary window/scene.
|
|
870
|
-
*
|
|
871
|
-
* - Application.ios.closeWindow() // best-effort close of a non-primary scene
|
|
872
|
-
* - Application.ios.closeWindow(button) // from a tap handler within the scene
|
|
873
|
-
* - Application.ios.closeWindow(window)
|
|
874
|
-
* - Application.ios.closeWindow(scene)
|
|
875
|
-
* - Application.ios.closeWindow('scene-id')
|
|
1406
|
+
* Accepts a NativeWindow, View, UIWindow, UIWindowScene, or string id.
|
|
876
1407
|
*/
|
|
877
1408
|
closeWindow(target) {
|
|
878
1409
|
if (!__APPLE__) {
|
|
879
1410
|
return;
|
|
880
1411
|
}
|
|
881
1412
|
try {
|
|
882
|
-
|
|
883
|
-
if (
|
|
884
|
-
|
|
885
|
-
return;
|
|
1413
|
+
let nativeWindow;
|
|
1414
|
+
if (target instanceof NativeWindow) {
|
|
1415
|
+
nativeWindow = target;
|
|
886
1416
|
}
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
1417
|
+
else {
|
|
1418
|
+
const scene = this._resolveScene(target);
|
|
1419
|
+
if (scene) {
|
|
1420
|
+
nativeWindow = this._getWindowForScene(scene);
|
|
1421
|
+
}
|
|
891
1422
|
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
console.log('closeWindow: Scene has no session to destroy');
|
|
1423
|
+
if (!nativeWindow) {
|
|
1424
|
+
console.log('closeWindow: No window resolved for target');
|
|
895
1425
|
return;
|
|
896
1426
|
}
|
|
897
|
-
|
|
898
|
-
if (app.requestSceneSessionDestructionOptionsErrorHandler) {
|
|
899
|
-
app.requestSceneSessionDestructionOptionsErrorHandler(session, null, (error) => {
|
|
900
|
-
if (error) {
|
|
901
|
-
console.log('closeWindow: destruction error', error);
|
|
902
|
-
}
|
|
903
|
-
else {
|
|
904
|
-
// clean up tracked id
|
|
905
|
-
const id = this._getSceneId(scene);
|
|
906
|
-
this._openedScenesById.delete(id);
|
|
907
|
-
}
|
|
908
|
-
});
|
|
909
|
-
}
|
|
910
|
-
else {
|
|
911
|
-
console.info('closeWindow: Scene destruction API not available on this iOS version');
|
|
912
|
-
}
|
|
1427
|
+
nativeWindow.close();
|
|
913
1428
|
}
|
|
914
1429
|
catch (err) {
|
|
915
1430
|
console.log('closeWindow: Unexpected error', err);
|
|
916
1431
|
}
|
|
917
1432
|
}
|
|
1433
|
+
/**
|
|
1434
|
+
* @deprecated Use `getWindows()` instead.
|
|
1435
|
+
*/
|
|
918
1436
|
getAllWindows() {
|
|
919
|
-
return
|
|
1437
|
+
return this._windows.map((nw) => nw.ios?.uiWindow).filter(Boolean);
|
|
920
1438
|
}
|
|
1439
|
+
/**
|
|
1440
|
+
* @deprecated Use `getWindows()` instead.
|
|
1441
|
+
*/
|
|
921
1442
|
getAllScenes() {
|
|
922
|
-
return
|
|
1443
|
+
return this._windows.map((nw) => nw.ios?.scene).filter(Boolean);
|
|
923
1444
|
}
|
|
1445
|
+
/**
|
|
1446
|
+
* @deprecated Use `getWindows()` instead.
|
|
1447
|
+
*/
|
|
924
1448
|
getWindowScenes() {
|
|
925
1449
|
return this.getAllScenes().filter((scene) => scene instanceof UIWindowScene);
|
|
926
1450
|
}
|
|
1451
|
+
/**
|
|
1452
|
+
* @deprecated Use `primaryWindow?.ios?.uiWindow` instead.
|
|
1453
|
+
*/
|
|
927
1454
|
getPrimaryWindow() {
|
|
928
|
-
|
|
929
|
-
|
|
1455
|
+
const primary = this.primaryWindow;
|
|
1456
|
+
if (primary?.ios?.uiWindow) {
|
|
1457
|
+
return primary.ios.uiWindow;
|
|
930
1458
|
}
|
|
931
1459
|
return getiOSWindow();
|
|
932
1460
|
}
|
|
1461
|
+
/**
|
|
1462
|
+
* @deprecated Use `primaryWindow?.ios?.scene` instead.
|
|
1463
|
+
*/
|
|
933
1464
|
getPrimaryScene() {
|
|
934
|
-
return this.
|
|
1465
|
+
return this.primaryWindow?.ios?.scene || null;
|
|
935
1466
|
}
|
|
936
1467
|
// Scene lifecycle management
|
|
937
1468
|
supportsScenes() {
|
|
@@ -941,7 +1472,7 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
941
1472
|
return supportsMultipleScenes();
|
|
942
1473
|
}
|
|
943
1474
|
isUsingSceneLifecycle() {
|
|
944
|
-
return this.supportsScenes() && this.
|
|
1475
|
+
return this.supportsScenes() && this._windows.length > 0;
|
|
945
1476
|
}
|
|
946
1477
|
// Call this to set up scene-based configuration
|
|
947
1478
|
configureForScenes() {
|
|
@@ -949,34 +1480,6 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
949
1480
|
console.warn('Scene-based lifecycle is only supported on iOS 13+ iPad or visionOS with multi-scene enabled apps.');
|
|
950
1481
|
return;
|
|
951
1482
|
}
|
|
952
|
-
// Additional scene configuration can be added here
|
|
953
|
-
// For now, the notification observers are already set up in the constructor
|
|
954
|
-
}
|
|
955
|
-
// Stable scene id for lookups
|
|
956
|
-
_getSceneId(scene) {
|
|
957
|
-
try {
|
|
958
|
-
if (!scene) {
|
|
959
|
-
return 'Unknown';
|
|
960
|
-
}
|
|
961
|
-
// Prefer session persistentIdentifier when available (stable across lifetime)
|
|
962
|
-
const session = scene.session;
|
|
963
|
-
const persistentId = session && session.persistentIdentifier;
|
|
964
|
-
if (persistentId) {
|
|
965
|
-
return `${persistentId}`;
|
|
966
|
-
}
|
|
967
|
-
// Fallbacks
|
|
968
|
-
if (scene.hash != null) {
|
|
969
|
-
return `${scene.hash}`;
|
|
970
|
-
}
|
|
971
|
-
const desc = scene.description;
|
|
972
|
-
if (desc) {
|
|
973
|
-
return `${desc}`;
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
catch (err) {
|
|
977
|
-
// ignore
|
|
978
|
-
}
|
|
979
|
-
return 'Unknown';
|
|
980
1483
|
}
|
|
981
1484
|
// Resolve a UIWindowScene from various input types
|
|
982
1485
|
_resolveScene(target) {
|
|
@@ -984,12 +1487,10 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
984
1487
|
return null;
|
|
985
1488
|
}
|
|
986
1489
|
if (!target) {
|
|
987
|
-
// Try to pick a non-primary
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
return nonPrimary[0] || scenes[0] || null;
|
|
1490
|
+
// Try to pick a non-primary window's scene
|
|
1491
|
+
const nonPrimary = this._windows.filter((nw) => !nw.isPrimary);
|
|
1492
|
+
return nonPrimary[0]?.ios?.scene || this.primaryWindow?.ios?.scene || null;
|
|
991
1493
|
}
|
|
992
|
-
// If a View was passed, derive its window.scene
|
|
993
1494
|
if (target && typeof target === 'object') {
|
|
994
1495
|
// UIWindowScene
|
|
995
1496
|
if (target.session && target.activationState !== undefined) {
|
|
@@ -1008,15 +1509,15 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
1008
1509
|
}
|
|
1009
1510
|
// String id lookup
|
|
1010
1511
|
if (typeof target === 'string') {
|
|
1011
|
-
|
|
1012
|
-
|
|
1512
|
+
const found = this.getWindowById(target);
|
|
1513
|
+
if (found) {
|
|
1514
|
+
return found.ios?.scene || null;
|
|
1013
1515
|
}
|
|
1014
|
-
// Try matching
|
|
1015
|
-
const
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
return s;
|
|
1516
|
+
// Try matching among known scenes
|
|
1517
|
+
for (const nw of this._windows) {
|
|
1518
|
+
const scene = nw.ios?.scene;
|
|
1519
|
+
if (scene && IOSNativeWindow.getSceneId(scene) === target) {
|
|
1520
|
+
return scene;
|
|
1020
1521
|
}
|
|
1021
1522
|
}
|
|
1022
1523
|
}
|
|
@@ -1028,8 +1529,8 @@ export class iOSApplication extends ApplicationCommon {
|
|
|
1028
1529
|
return;
|
|
1029
1530
|
}
|
|
1030
1531
|
// Create user activity for the new scene
|
|
1031
|
-
const userActivity = NSUserActivity.alloc().initWithActivityType(
|
|
1032
|
-
userActivity.userInfo = dataSerialize(data);
|
|
1532
|
+
const userActivity = NSUserActivity.alloc().initWithActivityType(getSceneActivityType());
|
|
1533
|
+
userActivity.userInfo = dataSerialize(data ?? {});
|
|
1033
1534
|
// Use the legacy API
|
|
1034
1535
|
const options = UISceneActivationRequestOptions.new();
|
|
1035
1536
|
options.requestingScene = windowScene;
|
|
@@ -1074,6 +1575,7 @@ global.__onLiveSyncCore = function (context) {
|
|
|
1074
1575
|
iosApp._onLivesync(context);
|
|
1075
1576
|
};
|
|
1076
1577
|
export * from './application-common';
|
|
1578
|
+
export * from './application-interfaces';
|
|
1077
1579
|
export const Application = iosApp;
|
|
1078
1580
|
export const AndroidApplication = undefined;
|
|
1079
1581
|
const applicationEvents = [Application.orientationChangedEvent, Application.systemAppearanceChangedEvent];
|