@xrnjs/app-template 0.0.1
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/$package.json +51 -0
- package/.env +6 -0
- package/.env.prod +6 -0
- package/LICENSE +202 -0
- package/android/app/build.gradle +176 -0
- package/android/app/build_defs.bzl +19 -0
- package/android/app/debug.keystore +0 -0
- package/android/app/proguard-rules.pro +10 -0
- package/android/app/src/debug/AndroidManifest.xml +13 -0
- package/android/app/src/debug/java/com/xrn/template/ReactNativeFlipper.java +73 -0
- package/android/app/src/main/AndroidManifest.xml +46 -0
- package/android/app/src/main/assets/index.main-bundle.bundle +178940 -0
- package/android/app/src/main/assets/index.sub-bundle.bundle +178928 -0
- package/android/app/src/main/assets/xrn-manifest.json +1 -0
- package/android/app/src/main/java/com/xrn/template/MainActivity.kt +52 -0
- package/android/app/src/main/java/com/xrn/template/MainApplication.kt +91 -0
- package/android/app/src/main/java/com/xrn/template/multibundle/XBundleInfoHook.kt +9 -0
- package/android/app/src/main/java/com/xrn/template/multibundle/XDevSupportParams.kt +6 -0
- package/android/app/src/main/java/com/xrn/template/multibundle/XRNHostParams.kt +81 -0
- package/android/app/src/main/java/com/xrn/template/navigation/MainClazzFactory.kt +14 -0
- package/android/app/src/main/java/com/xrn/template/navigation/XBundleActivity.kt +56 -0
- package/android/app/src/main/java/com/xrn/template/navigation/XMainActivity.kt +4 -0
- package/android/app/src/main/java/com/xrn/template/utils/DevEntryUtil.kt +29 -0
- package/android/app/src/main/java/com/xrn/template/utils/LifecycleAwareRunnable.kt +37 -0
- package/android/app/src/main/jni/CMakeLists.txt +7 -0
- package/android/app/src/main/jni/MainApplicationModuleProvider.cpp +32 -0
- package/android/app/src/main/jni/MainApplicationModuleProvider.h +16 -0
- package/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp +45 -0
- package/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +38 -0
- package/android/app/src/main/jni/MainComponentsRegistry.cpp +65 -0
- package/android/app/src/main/jni/MainComponentsRegistry.h +32 -0
- package/android/app/src/main/jni/OnLoad.cpp +11 -0
- package/android/app/src/main/res/drawable/bg_debug_entry.xml +15 -0
- package/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
- package/android/app/src/main/res/drawable-hdpi/node_modules_reactnavigation_elements_src_assets_backicon.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_reactnative_libraries_logbox_ui_logboximages_alerttriangle.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_reactnative_libraries_logbox_ui_logboximages_chevronleft.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_reactnative_libraries_logbox_ui_logboximages_chevronright.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_reactnative_libraries_logbox_ui_logboximages_close.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_reactnative_libraries_logbox_ui_logboximages_loader.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_reactnavigation_elements_src_assets_backicon.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_reactnavigation_elements_src_assets_backiconmask.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_xrn_devtools_assets_images_fail_icon.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_xrn_devtools_assets_images_success_icon.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_xrn_devtools_assets_network_close.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_xrn_devtools_assets_network_filter.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_xrn_devtools_assets_network_more.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_xrn_devtools_assets_network_search.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_xrn_devtools_assets_network_share.png +0 -0
- package/android/app/src/main/res/drawable-mdpi/node_modules_xrn_navigation_assets_backicon.png +0 -0
- package/android/app/src/main/res/drawable-xhdpi/node_modules_reactnavigation_elements_src_assets_backicon.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_reactnavigation_elements_src_assets_backicon.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_copy_icon.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_app_info.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_app_start_time.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_file.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_fps.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_h5.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_health.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_kadun.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_net.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_qingchu.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_scan.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_self.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_setting.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_view_check.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_view_level.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_doraemon_viewmetrics.png +0 -0
- package/android/app/src/main/res/drawable-xxhdpi/node_modules_xrn_devtools_assets_images_rebackwhiteicon.png +0 -0
- package/android/app/src/main/res/drawable-xxxhdpi/node_modules_reactnavigation_elements_src_assets_backicon.png +0 -0
- package/android/app/src/main/res/layout/activity_splash.xml +16 -0
- package/android/app/src/main/res/layout/layout_rn_dev_float.xml +18 -0
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/raw/bundle_config.json +23 -0
- package/android/app/src/main/res/raw/launch_screen.json +1 -0
- package/android/app/src/main/res/values/strings.xml +3 -0
- package/android/app/src/main/res/values/styles.xml +9 -0
- package/android/build.gradle +83 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +63 -0
- package/android/gradlew +234 -0
- package/android/gradlew.bat +89 -0
- package/android/settings.gradle +18 -0
- package/harmony/.clang-format +64 -0
- package/harmony/.clang-tidy +1 -0
- package/harmony/.clangd +13 -0
- package/harmony/AppScope/app.json5 +10 -0
- package/harmony/AppScope/resources/base/element/string.json +8 -0
- package/harmony/AppScope/resources/base/media/app_icon.png +0 -0
- package/harmony/XRNTemplate-dev.cer +52 -0
- package/harmony/XRNTemplate-devDebug.p7b +0 -0
- package/harmony/XRNTemplate.p12 +0 -0
- package/harmony/build-profile.json5 +91 -0
- package/harmony/code-linter.json5 +20 -0
- package/harmony/entry/build-profile.json5 +33 -0
- package/harmony/entry/hvigorfile.ts +6 -0
- package/harmony/entry/obfuscation-rules.txt +23 -0
- package/harmony/entry/oh-package-lock.json5 +486 -0
- package/harmony/entry/oh-package.json5 +59 -0
- package/harmony/entry/src/main/cpp/CMakeLists.txt +72 -0
- package/harmony/entry/src/main/cpp/PackageProvider.cpp +51 -0
- package/harmony/entry/src/main/cpp/generated/BundleNavigation.cpp +25 -0
- package/harmony/entry/src/main/cpp/generated/BundleNavigation.h +21 -0
- package/harmony/entry/src/main/cpp/generated/ConfigNativeModule.cpp +21 -0
- package/harmony/entry/src/main/cpp/generated/ConfigNativeModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/GetRandomValuesNativeModule.cpp +21 -0
- package/harmony/entry/src/main/cpp/generated/GetRandomValuesNativeModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/ImageResizer.cpp +21 -0
- package/harmony/entry/src/main/cpp/generated/ImageResizer.h +21 -0
- package/harmony/entry/src/main/cpp/generated/NativeHarmonyTouchId.cpp +22 -0
- package/harmony/entry/src/main/cpp/generated/NativeHarmonyTouchId.h +21 -0
- package/harmony/entry/src/main/cpp/generated/OreitationLockerNativeModule.cpp +31 -0
- package/harmony/entry/src/main/cpp/generated/OreitationLockerNativeModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/RNCCameraRoll.cpp +28 -0
- package/harmony/entry/src/main/cpp/generated/RNCCameraRoll.h +21 -0
- package/harmony/entry/src/main/cpp/generated/RNCCameraRollPermission.cpp +26 -0
- package/harmony/entry/src/main/cpp/generated/RNCCameraRollPermission.h +21 -0
- package/harmony/entry/src/main/cpp/generated/RNCWebViewComponentDescriptor.h +43 -0
- package/harmony/entry/src/main/cpp/generated/RNCWebViewJSIBinder.h +120 -0
- package/harmony/entry/src/main/cpp/generated/RNCWebViewModule.cpp +22 -0
- package/harmony/entry/src/main/cpp/generated/RNCWebViewModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/RNDeviceInfo.cpp +137 -0
- package/harmony/entry/src/main/cpp/generated/RNDeviceInfo.h +21 -0
- package/harmony/entry/src/main/cpp/generated/RNDocumentPicker.cpp +24 -0
- package/harmony/entry/src/main/cpp/generated/RNDocumentPicker.h +21 -0
- package/harmony/entry/src/main/cpp/generated/RNGestureHandlerButtonComponentDescriptor.h +43 -0
- package/harmony/entry/src/main/cpp/generated/RNGestureHandlerButtonJSIBinder.h +38 -0
- package/harmony/entry/src/main/cpp/generated/RNGestureHandlerModule.cpp +28 -0
- package/harmony/entry/src/main/cpp/generated/RNGestureHandlerModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/RNGestureHandlerRootViewComponentDescriptor.h +43 -0
- package/harmony/entry/src/main/cpp/generated/RNGestureHandlerRootViewJSIBinder.h +31 -0
- package/harmony/entry/src/main/cpp/generated/RNLocalize.cpp +31 -0
- package/harmony/entry/src/main/cpp/generated/RNLocalize.h +21 -0
- package/harmony/entry/src/main/cpp/generated/RNOHGeneratedPackage.h +191 -0
- package/harmony/entry/src/main/cpp/generated/RTNCodePush.cpp +48 -0
- package/harmony/entry/src/main/cpp/generated/RTNCodePush.h +21 -0
- package/harmony/entry/src/main/cpp/generated/ReactNativeBlobUtil.cpp +51 -0
- package/harmony/entry/src/main/cpp/generated/ReactNativeBlobUtil.h +21 -0
- package/harmony/entry/src/main/cpp/generated/XRNAppUtilsModule.cpp +29 -0
- package/harmony/entry/src/main/cpp/generated/XRNAppUtilsModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/XRNAssetLoaderModule.cpp +21 -0
- package/harmony/entry/src/main/cpp/generated/XRNAssetLoaderModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/XRNBundleModule.cpp +27 -0
- package/harmony/entry/src/main/cpp/generated/XRNBundleModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/XRNDebugToolsModule.cpp +32 -0
- package/harmony/entry/src/main/cpp/generated/XRNDebugToolsModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/XRNFileModule.cpp +22 -0
- package/harmony/entry/src/main/cpp/generated/XRNFileModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/XRNLoadingModule.cpp +25 -0
- package/harmony/entry/src/main/cpp/generated/XRNLoadingModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/XRNMultiBundleModule.cpp +21 -0
- package/harmony/entry/src/main/cpp/generated/XRNMultiBundleModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/XRNNativeStorageModule.cpp +26 -0
- package/harmony/entry/src/main/cpp/generated/XRNNativeStorageModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/XRNNavigation.cpp +23 -0
- package/harmony/entry/src/main/cpp/generated/XRNNavigation.h +21 -0
- package/harmony/entry/src/main/cpp/generated/XRNToastModule.cpp +22 -0
- package/harmony/entry/src/main/cpp/generated/XRNToastModule.h +21 -0
- package/harmony/entry/src/main/cpp/generated/_react_native_oh_tpl_async_storage/RNOH/generated/BaseReactNativeOhTplAsyncStoragePackage.h +68 -0
- package/harmony/entry/src/main/cpp/generated/_react_native_oh_tpl_async_storage/RNOH/generated/turbo_modules/RNCAsyncStorage.cpp +26 -0
- package/harmony/entry/src/main/cpp/generated/_react_native_oh_tpl_async_storage/RNOH/generated/turbo_modules/RNCAsyncStorage.h +21 -0
- package/harmony/entry/src/main/cpp/generated/_react_native_oh_tpl_async_storage/react/renderer/components/_react_native_oh_tpl_async_storage/ComponentDescriptors.h +22 -0
- package/harmony/entry/src/main/cpp/generated/_react_native_oh_tpl_async_storage/react/renderer/components/_react_native_oh_tpl_async_storage/EventEmitters.cpp +18 -0
- package/harmony/entry/src/main/cpp/generated/_react_native_oh_tpl_async_storage/react/renderer/components/_react_native_oh_tpl_async_storage/EventEmitters.h +19 -0
- package/harmony/entry/src/main/cpp/generated/_react_native_oh_tpl_async_storage/react/renderer/components/_react_native_oh_tpl_async_storage/Props.cpp +21 -0
- package/harmony/entry/src/main/cpp/generated/_react_native_oh_tpl_async_storage/react/renderer/components/_react_native_oh_tpl_async_storage/Props.h +20 -0
- package/harmony/entry/src/main/cpp/generated/_react_native_oh_tpl_async_storage/react/renderer/components/_react_native_oh_tpl_async_storage/ShadowNodes.cpp +19 -0
- package/harmony/entry/src/main/cpp/generated/_react_native_oh_tpl_async_storage/react/renderer/components/_react_native_oh_tpl_async_storage/ShadowNodes.h +25 -0
- package/harmony/entry/src/main/cpp/generated/_react_native_oh_tpl_async_storage/react/renderer/components/_react_native_oh_tpl_async_storage/States.cpp +18 -0
- package/harmony/entry/src/main/cpp/generated/_react_native_oh_tpl_async_storage/react/renderer/components/_react_native_oh_tpl_async_storage/States.h +23 -0
- package/harmony/entry/src/main/ets/BundleHelper.ets +198 -0
- package/harmony/entry/src/main/ets/Constants.ets +2 -0
- package/harmony/entry/src/main/ets/MainAbilityStage.ets +60 -0
- package/harmony/entry/src/main/ets/entryability/EntryAbility.ets +57 -0
- package/harmony/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +12 -0
- package/harmony/entry/src/main/ets/lottie/launch_screen.json +1 -0
- package/harmony/entry/src/main/ets/module/devtools/components/FloatBall.ets +359 -0
- package/harmony/entry/src/main/ets/navDestination/BizModuleContainer.ets +8 -0
- package/harmony/entry/src/main/ets/navDestination/MainModuleContainer.ets +8 -0
- package/harmony/entry/src/main/ets/navDestination/Splash.ets +79 -0
- package/harmony/entry/src/main/ets/pages/Index.ets +66 -0
- package/harmony/entry/src/main/module.json5 +68 -0
- package/harmony/entry/src/main/resources/base/element/color.json +12 -0
- package/harmony/entry/src/main/resources/base/element/string.json +19 -0
- package/harmony/entry/src/main/resources/base/media/background.png +0 -0
- package/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
- package/harmony/entry/src/main/resources/base/media/ic_back.png +0 -0
- package/harmony/entry/src/main/resources/base/media/layered_image.json +7 -0
- package/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
- package/harmony/entry/src/main/resources/base/profile/backup_config.json +3 -0
- package/harmony/entry/src/main/resources/base/profile/main_pages.json +5 -0
- package/harmony/entry/src/main/resources/en_US/element/string.json +16 -0
- package/harmony/entry/src/main/resources/rawfile/bundle_config.json5 +23 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/AntDesign.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/Entypo.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/EvilIcons.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/Feather.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/FontAwesome.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/FontAwesome5_Brands.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/FontAwesome5_Regular.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/FontAwesome5_Solid.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/FontAwesome6_Brands.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/FontAwesome6_Regular.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/FontAwesome6_Solid.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/Fontisto.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/Foundation.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/Ionicons.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/MaterialCommunityIcons.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/MaterialIcons.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/Octicons.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/SimpleLineIcons.ttf +0 -0
- package/harmony/entry/src/main/resources/rawfile/fonts/Zocial.ttf +0 -0
- package/harmony/entry/src/main/resources/zh_CN/element/string.json +16 -0
- package/harmony/entry/src/mock/mock-config.json5 +2 -0
- package/harmony/entry/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/harmony/entry/src/ohosTest/ets/test/List.test.ets +5 -0
- package/harmony/entry/src/ohosTest/module.json5 +13 -0
- package/harmony/entry/src/test/List.test.ets +5 -0
- package/harmony/entry/src/test/LocalUnit.test.ets +33 -0
- package/harmony/hvigor/hvigor-config.json5 +22 -0
- package/harmony/hvigorfile.ts +6 -0
- package/harmony/material/ac/6a282c38039b44b2949441a85986c35d +1 -0
- package/harmony/material/ce/b2a765b7b925475797f45ae55c8d3ad3 +0 -0
- package/harmony/material/fd/0/9cbed212f275489b874de30a02692f59 +1 -0
- package/harmony/material/fd/1/dc8ea45ef44142d09bca7eeacdc5ecac +1 -0
- package/harmony/material/fd/2/d34888210a5846829d745f65295f90b7 +1 -0
- package/harmony/oh-package-lock.json5 +27 -0
- package/harmony/oh-package.json5 +17 -0
- package/ios/.xcode.env +11 -0
- package/ios/BundleEventCenter/XTBundleProvider.h +17 -0
- package/ios/BundleEventCenter/XTBundleProvider.m +129 -0
- package/ios/BundleEventCenter/XTBundleViewControllerFactory.h +18 -0
- package/ios/BundleEventCenter/XTBundleViewControllerFactory.m +39 -0
- package/ios/BundleEventCenter/bundleController/XTBundleViewController.h +16 -0
- package/ios/BundleEventCenter/bundleController/XTBundleViewController.m +35 -0
- package/ios/BundleEventCenter/bundleController/XTMainBundleViewController.h +16 -0
- package/ios/BundleEventCenter/bundleController/XTMainBundleViewController.m +41 -0
- package/ios/BundleEventCenter/bundleController/xtBundles.plist +14 -0
- package/ios/Podfile +221 -0
- package/ios/Podfile.lock +955 -0
- package/ios/RNDebug/DebugPlugin/XTPluginManage.h +24 -0
- package/ios/RNDebug/DebugPlugin/XTPluginManage.m +93 -0
- package/ios/RNDebug/Views/XTLoadJSErrorTipPanel.swift +231 -0
- package/ios/RNDebug/Views/XTScanQRPlugin.swift +122 -0
- package/ios/RNDebug/Views/XTSuspendBall.h +34 -0
- package/ios/RNDebug/Views/XTSuspendBall.m +357 -0
- package/ios/XRNTemplate/AppDelegate.h +8 -0
- package/ios/XRNTemplate/AppDelegate.mm +168 -0
- package/ios/XRNTemplate/Images.xcassets/AppIcon.appiconset/Contents.json +55 -0
- package/ios/XRNTemplate/Images.xcassets/AppIcon.appiconset/icon120_120@2x.png +0 -0
- package/ios/XRNTemplate/Images.xcassets/AppIcon.appiconset/icon180_180@3x.png +0 -0
- package/ios/XRNTemplate/Images.xcassets/Contents.json +6 -0
- package/ios/XRNTemplate/Images.xcassets/launch_icon.imageset/Contents.json +21 -0
- package/ios/XRNTemplate/Images.xcassets/launch_icon.imageset/launch_icon@2x.png +0 -0
- package/ios/XRNTemplate/Info.plist +82 -0
- package/ios/XRNTemplate/LaunchScreen.storyboard +43 -0
- package/ios/XRNTemplate/main.m +10 -0
- package/ios/XRNTemplate-Bridging-Header.h +29 -0
- package/ios/XRNTemplate.xcodeproj/project.pbxproj +1022 -0
- package/ios/XRNTemplate.xcodeproj/xcshareddata/xcschemes/XRNTemplate.xcscheme +88 -0
- package/ios/XRNTemplate.xcworkspace/contents.xcworkspacedata +10 -0
- package/ios/XRNTemplate.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/XRNTemplateTests/Info.plist +24 -0
- package/ios/XRNTemplateTests/XRNTemplateTests.m +66 -0
- package/main-bundle/App.tsx +29 -0
- package/main-bundle/app.json +15 -0
- package/main-bundle/babel.config.js +4 -0
- package/main-bundle/index.ts +3 -0
- package/main-bundle/metro.config.js +21 -0
- package/main-bundle/package.json +35 -0
- package/main-bundle/router.ts +18 -0
- package/main-bundle/tsconfig.json +26 -0
- package/main-bundle/xrn.config.ts +13 -0
- package/main-bundle/yarn.lock +13622 -0
- package/package.json +16 -0
- package/react-native.config.js +36 -0
- package/sub-bundle/App.tsx +23 -0
- package/sub-bundle/app.json +15 -0
- package/sub-bundle/babel.config.js +4 -0
- package/sub-bundle/index.ts +3 -0
- package/sub-bundle/metro.config.js +21 -0
- package/sub-bundle/package.json +36 -0
- package/sub-bundle/router.ts +18 -0
- package/sub-bundle/tsconfig.json +26 -0
- package/sub-bundle/xrn.config.ts +13 -0
- package/sub-bundle/yarn.lock +13652 -0
- package/xrn-react-native-xcode.sh +172 -0
- package/xrn.config.json +46 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
//
|
|
2
|
+
// XTSuspendBall.m
|
|
3
|
+
// XRNTemplate
|
|
4
|
+
//
|
|
5
|
+
// Created by xtgq on 2024/4/23.
|
|
6
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "XTSuspendBall.h"
|
|
10
|
+
|
|
11
|
+
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
|
|
12
|
+
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
|
|
13
|
+
#define ViewSize 50
|
|
14
|
+
#define KHeightFit(w) (((w) / 667.0) * SCREEN_HEIGHT)
|
|
15
|
+
|
|
16
|
+
#define LRString [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent
|
|
17
|
+
#define DLog(...) {\
|
|
18
|
+
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];\
|
|
19
|
+
[dateFormatter setDateFormat:@"YYYY-MM-dd hh:mm:ss"];\
|
|
20
|
+
NSString *dateString = [dateFormatter stringFromDate:[NSDate date]];\
|
|
21
|
+
printf("%s %s 第%d行:%s\n\n",[dateString UTF8String],[LRString UTF8String] ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String]);}
|
|
22
|
+
|
|
23
|
+
@implementation XTSuspendBall
|
|
24
|
+
|
|
25
|
+
- (instancetype)init{
|
|
26
|
+
self = [super init];
|
|
27
|
+
if (self) {
|
|
28
|
+
self.backgroundColor = UIColor.greenColor;
|
|
29
|
+
self.layer.masksToBounds = YES;
|
|
30
|
+
self.layer.cornerRadius = ViewSize/2;
|
|
31
|
+
self.alpha = 0.5;
|
|
32
|
+
|
|
33
|
+
self.orientation = [[UIApplication sharedApplication] statusBarOrientation];
|
|
34
|
+
if (self.orientation == UIInterfaceOrientationLandscapeRight){
|
|
35
|
+
self.frame = CGRectMake(SCREEN_WIDTH - [self vg_safeDistanceTop] - ViewSize - 20, KHeightFit(80) + ViewSize/2, ViewSize, ViewSize);
|
|
36
|
+
}else{
|
|
37
|
+
self.frame = CGRectMake(SCREEN_WIDTH - ViewSize/2, KHeightFit(80) + ViewSize/2, ViewSize, ViewSize);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
self.btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
41
|
+
[self.btn setTitle:@"" forState:UIControlStateNormal];
|
|
42
|
+
self.btn.titleLabel.font = [UIFont boldSystemFontOfSize:12];
|
|
43
|
+
[self.btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
|
|
44
|
+
self.btn.frame = CGRectMake(5, 5, 40, 40);
|
|
45
|
+
self.btn.backgroundColor = UIColor.greenColor;
|
|
46
|
+
self.btn.layer.cornerRadius = 20;
|
|
47
|
+
[self.btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
48
|
+
[self addSubview:self.btn];
|
|
49
|
+
[self changeCoordinateScale];
|
|
50
|
+
isChangePosition = NO;
|
|
51
|
+
|
|
52
|
+
UIPanGestureRecognizer *panRcognize=[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)];
|
|
53
|
+
[panRcognize setMinimumNumberOfTouches:1];
|
|
54
|
+
[panRcognize setEnabled:YES];
|
|
55
|
+
[panRcognize delaysTouchesEnded];
|
|
56
|
+
[panRcognize cancelsTouchesInView];
|
|
57
|
+
[self addGestureRecognizer:panRcognize];
|
|
58
|
+
|
|
59
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
60
|
+
selector:@selector(didChangeStatusBarOrientation)
|
|
61
|
+
name:UIApplicationDidChangeStatusBarOrientationNotification
|
|
62
|
+
object:nil];
|
|
63
|
+
}
|
|
64
|
+
return self;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
- (void)didChangeStatusBarOrientation {
|
|
68
|
+
self.orientation = [UIApplication sharedApplication].statusBarOrientation;
|
|
69
|
+
switch ([UIDevice currentDevice].orientation) {
|
|
70
|
+
case UIDeviceOrientationPortraitUpsideDown:
|
|
71
|
+
[self locationChange:@"Down"];
|
|
72
|
+
break;
|
|
73
|
+
case UIDeviceOrientationLandscapeLeft:{
|
|
74
|
+
[self locationChange:@"left"];
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
case UIDeviceOrientationLandscapeRight:{
|
|
78
|
+
[self locationChange:@"right"];
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
case UIDeviceOrientationPortrait:{
|
|
82
|
+
[self locationChange:@"Portrait"];
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
default:
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
- (void)locationChange:(NSString *)message{
|
|
91
|
+
if (SCREEN_HEIGHT > SCREEN_WIDTH) {
|
|
92
|
+
if ([message isEqualToString:@"Portrait"]) {
|
|
93
|
+
self.center = CGPointMake(changeWid * SCREEN_WIDTH, changeHig * SCREEN_HEIGHT);
|
|
94
|
+
}else{
|
|
95
|
+
self.center = CGPointMake(changeWid * SCREEN_WIDTH, changeHig * SCREEN_HEIGHT - [self vg_safeDistanceTop]);
|
|
96
|
+
}
|
|
97
|
+
}else{
|
|
98
|
+
if ([message isEqualToString:@"left"]) {
|
|
99
|
+
self.center = CGPointMake(changeWid * SCREEN_WIDTH + [self vg_safeDistanceTop] + ViewSize, changeHig * SCREEN_HEIGHT);
|
|
100
|
+
}else{
|
|
101
|
+
self.center = CGPointMake(changeWid * SCREEN_WIDTH - [self vg_safeDistanceTop] - ViewSize, changeHig * SCREEN_HEIGHT);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
[self changeCoordinateScale];
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
- (void)changeCoordinateScale{
|
|
109
|
+
changeHig = self.center.y/SCREEN_HEIGHT;
|
|
110
|
+
changeWid = self.center.x/SCREEN_WIDTH;
|
|
111
|
+
if (self.orientation == UIInterfaceOrientationLandscapeRight) {
|
|
112
|
+
if (self.center.x > SCREEN_WIDTH/2) {
|
|
113
|
+
self.center = CGPointMake(SCREEN_WIDTH, self.center.y);
|
|
114
|
+
}else{
|
|
115
|
+
self.center = CGPointMake([self vg_safeDistanceTop] + ViewSize + 20, self.center.y);
|
|
116
|
+
}
|
|
117
|
+
}else if(self.orientation == UIInterfaceOrientationLandscapeLeft){
|
|
118
|
+
if (self.center.x > SCREEN_WIDTH/2) {
|
|
119
|
+
self.center = CGPointMake(SCREEN_WIDTH - [self vg_safeDistanceTop] - ViewSize - 20, self.center.y);
|
|
120
|
+
}else{
|
|
121
|
+
self.center = CGPointMake(0, self.center.y);
|
|
122
|
+
}
|
|
123
|
+
}else{
|
|
124
|
+
if (self.center.x > SCREEN_WIDTH/2) {
|
|
125
|
+
self.center = CGPointMake(SCREEN_WIDTH, self.center.y);
|
|
126
|
+
}else{
|
|
127
|
+
self.center = CGPointMake(0, self.center.y);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
- (void)showSuspendView{
|
|
133
|
+
self.hidden = NO;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
- (void)dismissSuspendView{
|
|
137
|
+
self.hidden = YES;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
- (void)btnClick:(UIButton *)button{
|
|
141
|
+
if (self.delegate && [self.delegate respondsToSelector:@selector(suspendViewButtonClick:)]) {
|
|
142
|
+
[self.delegate suspendViewButtonClick:button];
|
|
143
|
+
}
|
|
144
|
+
if (!isChangePosition) {
|
|
145
|
+
if (self.orientation == UIInterfaceOrientationLandscapeLeft) {
|
|
146
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
147
|
+
self.center = CGPointMake(SCREEN_WIDTH - [self vg_safeDistanceTop] - ViewSize - 20 - 20, self.center.y);
|
|
148
|
+
}];
|
|
149
|
+
}else{
|
|
150
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
151
|
+
self.center = CGPointMake(SCREEN_WIDTH - ViewSize, self.center.y);
|
|
152
|
+
}];
|
|
153
|
+
}
|
|
154
|
+
}else{
|
|
155
|
+
if (self.orientation == UIInterfaceOrientationLandscapeRight) {
|
|
156
|
+
if (self.center.x > SCREEN_WIDTH/2) {
|
|
157
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
158
|
+
self.center = CGPointMake(SCREEN_WIDTH - ViewSize, self.center.y);
|
|
159
|
+
}];
|
|
160
|
+
}else{
|
|
161
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
162
|
+
self.center = CGPointMake([self vg_safeDistanceTop] + ViewSize + 20 + 20, self.center.y);
|
|
163
|
+
}];
|
|
164
|
+
}
|
|
165
|
+
}else if(self.orientation == UIInterfaceOrientationLandscapeLeft){
|
|
166
|
+
if (self.center.x > SCREEN_WIDTH/2) {
|
|
167
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
168
|
+
self.center = CGPointMake(SCREEN_WIDTH - [self vg_safeDistanceTop] - ViewSize - 20 - 20, self.center.y);
|
|
169
|
+
}];
|
|
170
|
+
}else{
|
|
171
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
172
|
+
self.center = CGPointMake(ViewSize, self.center.y);
|
|
173
|
+
}];
|
|
174
|
+
}
|
|
175
|
+
}else{
|
|
176
|
+
if (self.center.x < SCREEN_WIDTH/2) {
|
|
177
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
178
|
+
self.center = CGPointMake(ViewSize, self.center.y);
|
|
179
|
+
}];
|
|
180
|
+
}else{
|
|
181
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
182
|
+
self.center = CGPointMake(SCREEN_WIDTH - ViewSize, self.center.y);
|
|
183
|
+
}];
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
self.alpha = 1;
|
|
190
|
+
self.timer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(timerAction) userInfo:nil repeats:NO];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
- (void)timerAction{
|
|
195
|
+
self.alpha = 0.5;
|
|
196
|
+
if (!isChangePosition) {
|
|
197
|
+
if (self.orientation == UIInterfaceOrientationLandscapeLeft) {
|
|
198
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
199
|
+
self.center = CGPointMake(SCREEN_WIDTH - [self vg_safeDistanceTop] - ViewSize - 20, self.center.y);
|
|
200
|
+
}];
|
|
201
|
+
}else{
|
|
202
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
203
|
+
self.center = CGPointMake(SCREEN_WIDTH, self.center.y);
|
|
204
|
+
}];
|
|
205
|
+
}
|
|
206
|
+
}else{
|
|
207
|
+
if (self.orientation == UIInterfaceOrientationLandscapeRight) {
|
|
208
|
+
if (self.center.x > SCREEN_WIDTH/2) {
|
|
209
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
210
|
+
self.center = CGPointMake(SCREEN_WIDTH, self.center.y);
|
|
211
|
+
}];
|
|
212
|
+
}else{
|
|
213
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
214
|
+
self.center = CGPointMake([self vg_safeDistanceTop] + ViewSize + 20, self.center.y);
|
|
215
|
+
}];
|
|
216
|
+
}
|
|
217
|
+
}else if(self.orientation == UIInterfaceOrientationLandscapeLeft){
|
|
218
|
+
if (self.center.x > SCREEN_WIDTH/2) {
|
|
219
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
220
|
+
self.center = CGPointMake(SCREEN_WIDTH - [self vg_safeDistanceTop] - ViewSize - 20, self.center.y);
|
|
221
|
+
}];
|
|
222
|
+
}else{
|
|
223
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
224
|
+
self.center = CGPointMake(0, self.center.y);
|
|
225
|
+
}];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
}else{
|
|
229
|
+
if (self.center.x > SCREEN_WIDTH/2) {
|
|
230
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
231
|
+
self.center = CGPointMake(SCREEN_WIDTH, self.center.y);
|
|
232
|
+
}];
|
|
233
|
+
}else{
|
|
234
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
235
|
+
self.center = CGPointMake(0, self.center.y);
|
|
236
|
+
}];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
[self.timer invalidate];
|
|
242
|
+
self.timer = nil;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
- (void)handlePanGesture:(UIPanGestureRecognizer *)recognizer
|
|
246
|
+
{
|
|
247
|
+
UIGestureRecognizerState recState = recognizer.state;
|
|
248
|
+
isChangePosition = YES;
|
|
249
|
+
|
|
250
|
+
switch (recState) {
|
|
251
|
+
case UIGestureRecognizerStateBegan:
|
|
252
|
+
self.alpha = 1;
|
|
253
|
+
break;
|
|
254
|
+
case UIGestureRecognizerStateChanged:
|
|
255
|
+
{
|
|
256
|
+
self.alpha = 1;
|
|
257
|
+
CGPoint translation = [recognizer translationInView:self];
|
|
258
|
+
recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x, recognizer.view.center.y + translation.y);
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
case UIGestureRecognizerStateEnded:
|
|
262
|
+
{
|
|
263
|
+
self.alpha = 0.5;
|
|
264
|
+
CGPoint stopPoint = CGPointMake(0, SCREEN_HEIGHT / 2);
|
|
265
|
+
if (recognizer.view.center.x < SCREEN_WIDTH / 2) {
|
|
266
|
+
stopPoint = CGPointMake(ViewSize/2, recognizer.view.center.y);
|
|
267
|
+
}else{
|
|
268
|
+
stopPoint = CGPointMake(SCREEN_WIDTH - ViewSize/2,recognizer.view.center.y);
|
|
269
|
+
}
|
|
270
|
+
if (stopPoint.y - ViewSize/2 <= 0) {
|
|
271
|
+
if (stopPoint.x - ViewSize/2 <= SCREEN_WIDTH/2) {
|
|
272
|
+
stopPoint = CGPointMake(0, stopPoint.y + [self vg_safeDistanceTop] + ViewSize);
|
|
273
|
+
}else{
|
|
274
|
+
stopPoint = CGPointMake(SCREEN_WIDTH, stopPoint.y + [self vg_safeDistanceTop] + ViewSize);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (stopPoint.y + ViewSize + 20 >= SCREEN_HEIGHT) {
|
|
278
|
+
if (stopPoint.x - ViewSize/2 <= SCREEN_WIDTH/2) {
|
|
279
|
+
stopPoint = CGPointMake(0, stopPoint.y - [self vg_safeDistanceBottom] - ViewSize/2);
|
|
280
|
+
}else{
|
|
281
|
+
stopPoint = CGPointMake(SCREEN_WIDTH, stopPoint.y - [self vg_safeDistanceBottom] - ViewSize/2);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (stopPoint.x - ViewSize/2 <= 0) {
|
|
286
|
+
stopPoint = CGPointMake(0, stopPoint.y);
|
|
287
|
+
}
|
|
288
|
+
if (stopPoint.x + ViewSize/2 >= SCREEN_WIDTH) {
|
|
289
|
+
stopPoint = CGPointMake(SCREEN_WIDTH, stopPoint.y);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
lastPoint = stopPoint;
|
|
293
|
+
|
|
294
|
+
CGRect rect = [self convertRect:self.frame toView:self];
|
|
295
|
+
|
|
296
|
+
if (self.orientation == UIInterfaceOrientationLandscapeRight) {
|
|
297
|
+
if (stopPoint.x > SCREEN_WIDTH/2) {
|
|
298
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
299
|
+
recognizer.view.center = CGPointMake(SCREEN_WIDTH, stopPoint.y);
|
|
300
|
+
}];
|
|
301
|
+
}else{
|
|
302
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
303
|
+
recognizer.view.center = CGPointMake([self vg_safeDistanceTop] + ViewSize + 20, stopPoint.y);
|
|
304
|
+
}];
|
|
305
|
+
}
|
|
306
|
+
}else if(self.orientation == UIInterfaceOrientationLandscapeLeft){
|
|
307
|
+
if (stopPoint.x > SCREEN_WIDTH/2) {
|
|
308
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
309
|
+
recognizer.view.center = CGPointMake(SCREEN_WIDTH - [self vg_safeDistanceTop] - ViewSize - 20, stopPoint.y);
|
|
310
|
+
}];
|
|
311
|
+
}else{
|
|
312
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
313
|
+
recognizer.view.center = CGPointMake(0, stopPoint.y);
|
|
314
|
+
}];
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
}else{
|
|
318
|
+
[UIView animateWithDuration:0.5 animations:^{
|
|
319
|
+
recognizer.view.center = stopPoint;
|
|
320
|
+
}];
|
|
321
|
+
}
|
|
322
|
+
[self changeCoordinateScale];
|
|
323
|
+
}
|
|
324
|
+
break;
|
|
325
|
+
default:
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
[recognizer setTranslation:CGPointMake(0, 0) inView:self];
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
- (CGFloat)vg_safeDistanceTop {
|
|
332
|
+
if (@available(iOS 13.0, *)) {
|
|
333
|
+
NSSet *set = [UIApplication sharedApplication].connectedScenes;
|
|
334
|
+
UIWindowScene *windowScene = [set anyObject];
|
|
335
|
+
UIWindow *window = windowScene.windows.firstObject;
|
|
336
|
+
return window.safeAreaInsets.top;
|
|
337
|
+
} else if (@available(iOS 11.0, *)) {
|
|
338
|
+
UIWindow *window = [UIApplication sharedApplication].windows.firstObject;
|
|
339
|
+
return window.safeAreaInsets.top;
|
|
340
|
+
}
|
|
341
|
+
return 0;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
- (CGFloat)vg_safeDistanceBottom {
|
|
345
|
+
if (@available(iOS 13.0, *)) {
|
|
346
|
+
NSSet *set = [UIApplication sharedApplication].connectedScenes;
|
|
347
|
+
UIWindowScene *windowScene = [set anyObject];
|
|
348
|
+
UIWindow *window = windowScene.windows.firstObject;
|
|
349
|
+
return window.safeAreaInsets.bottom;
|
|
350
|
+
} else if (@available(iOS 11.0, *)) {
|
|
351
|
+
UIWindow *window = [UIApplication sharedApplication].windows.firstObject;
|
|
352
|
+
return window.safeAreaInsets.bottom;
|
|
353
|
+
}
|
|
354
|
+
return 0;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
@end
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#import "AppDelegate.h"
|
|
2
|
+
|
|
3
|
+
#import <React/RCTBridge.h>
|
|
4
|
+
#import <React/RCTBundleURLProvider.h>
|
|
5
|
+
#import <React/RCTRootView.h>
|
|
6
|
+
#import <React/RCTDevSettings.h>
|
|
7
|
+
|
|
8
|
+
#import "XRNTemplate-Swift.h"
|
|
9
|
+
#import "XTMultiBundleManager.h"
|
|
10
|
+
#import "XTPluginManage.h"
|
|
11
|
+
#import <CodePush/CodePush.h>
|
|
12
|
+
#import "XTBundleViewController.h"
|
|
13
|
+
#import "XTJSBundleTool.h"
|
|
14
|
+
#import "XTMainBundleViewController.h"
|
|
15
|
+
#import "XTNavigationViewController.h"
|
|
16
|
+
#import "XTNativeRouterManager.h"
|
|
17
|
+
#import <react-native-xrn-multi-bundle/XTMultiBundle.h>
|
|
18
|
+
#import "XTBundleProvider.h"
|
|
19
|
+
#import "XTBundleViewControllerFactory.h"
|
|
20
|
+
|
|
21
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
22
|
+
#import <React/CoreModulesPlugins.h>
|
|
23
|
+
#import <React/RCTCxxBridgeDelegate.h>
|
|
24
|
+
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
|
|
25
|
+
#import <React/RCTSurfacePresenter.h>
|
|
26
|
+
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
|
27
|
+
#import <ReactCommon/RCTTurboModuleManager.h>
|
|
28
|
+
|
|
29
|
+
#import <react/config/ReactNativeConfig.h>
|
|
30
|
+
|
|
31
|
+
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
|
32
|
+
|
|
33
|
+
@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
|
|
34
|
+
RCTTurboModuleManager *_turboModuleManager;
|
|
35
|
+
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
|
|
36
|
+
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
|
|
37
|
+
facebook::react::ContextContainer::Shared _contextContainer;
|
|
38
|
+
}
|
|
39
|
+
@end
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
@interface AppDelegate ()<XTMultiBundleDataSource>
|
|
43
|
+
|
|
44
|
+
@property (nonatomic, copy) NSDictionary *launchOption;
|
|
45
|
+
@end
|
|
46
|
+
|
|
47
|
+
@implementation AppDelegate
|
|
48
|
+
|
|
49
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
50
|
+
{
|
|
51
|
+
// RCTAppSetupPrepareApp(application);
|
|
52
|
+
|
|
53
|
+
self.launchOpptions = launchOptions;
|
|
54
|
+
|
|
55
|
+
[XTMultiBundleManager shared].dataSource = self;
|
|
56
|
+
[[XTMultiBundleManager shared] startUp];
|
|
57
|
+
|
|
58
|
+
[self loadMainVC];
|
|
59
|
+
|
|
60
|
+
[[XTPluginManage shareInstance] addSuspendBallToWindow];
|
|
61
|
+
return YES;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
-(void)loadMainVC {
|
|
65
|
+
|
|
66
|
+
RCTBridge *mainBridge = [XTMultiBundleManager.shared.pool fetchJSBridgeWithJSBundleName:[[XTJSBundleTool shared] getMainBundleName]];
|
|
67
|
+
RCTDevSettings *decSetting = [mainBridge moduleForClass:[RCTDevSettings class]];
|
|
68
|
+
decSetting.isShakeToShowDevMenuEnabled = NO;
|
|
69
|
+
|
|
70
|
+
NSString *mainModuleName = [XTMultiBundleManager.shared.pool fetchDefaultModuleNameWithJSBundleName:[[XTJSBundleTool shared] getMainBundleName]];
|
|
71
|
+
|
|
72
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
73
|
+
_contextContainer = std::make_shared<facebook::react::ContextContainer const>();
|
|
74
|
+
_reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
|
|
75
|
+
_contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
|
|
76
|
+
_bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
|
|
77
|
+
bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
|
|
78
|
+
#endif
|
|
79
|
+
|
|
80
|
+
XTBundleViewControllerFactory *bundleVCfactory = [[XTBundleViewControllerFactory alloc] init];
|
|
81
|
+
[XTNativeRouterManager shared].bundleVCFactory = bundleVCfactory;
|
|
82
|
+
XTMainBundleViewController *rootViewController = [[XTMainBundleViewController alloc] initWithBridge:mainBridge moduleName:mainModuleName initialProperties:self.launchOption];
|
|
83
|
+
rootViewController.view.backgroundColor = [UIColor whiteColor];
|
|
84
|
+
|
|
85
|
+
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
86
|
+
XTNavigationViewController *nav = [[XTNavigationViewController alloc] initWithRootViewController:rootViewController];
|
|
87
|
+
self.window.rootViewController = nav;
|
|
88
|
+
[self.window makeKeyAndVisible];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
- (NSArray <XTBundleData *>*_Nonnull)multiBundleForBundleModelArray {
|
|
92
|
+
|
|
93
|
+
NSMutableArray <XTBundleData *>*bundleDataArray = [NSMutableArray arrayWithCapacity:10];
|
|
94
|
+
|
|
95
|
+
NSString *mainDeploymentKey = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CodePushDeploymentKey"];
|
|
96
|
+
NSString *mainBundleName = [XTJSBundleTool.shared getMainBundleName];
|
|
97
|
+
NSString *mainModuleName = mainBundleName;
|
|
98
|
+
|
|
99
|
+
XTBundleProvider *mainBundleProvider = [[XTBundleProvider alloc] init];
|
|
100
|
+
XTBundleData *mainBundleData = [[XTBundleData alloc] initWithJSBundleName:mainBundleName moduleName:mainModuleName codePushKey:mainDeploymentKey portNum:[XTJSBundleTool.shared getMainBundlePort] isMain:YES provider:mainBundleProvider];
|
|
101
|
+
[bundleDataArray addObject:mainBundleData];
|
|
102
|
+
|
|
103
|
+
NSArray *xtBundlesArray = [XTJSBundleTool.shared getAllSubBundles];
|
|
104
|
+
for (NSDictionary *obj in xtBundlesArray) {
|
|
105
|
+
XTBundleProvider *bundleProvider = [[XTBundleProvider alloc] init];
|
|
106
|
+
XTBundleData *bundleData = [[XTBundleData alloc] initWithJSBundleName:obj[@"jsBundleName"] moduleName:obj[@"jsBundleName"] codePushKey:obj[@"codePushKey"] portNum:obj[@"port"] isMain:NO provider:bundleProvider];
|
|
107
|
+
[bundleDataArray addObject:bundleData];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return bundleDataArray;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
- (NSDictionary *_Nullable)multiBundleForLaunchOptions {
|
|
114
|
+
return self.launchOption;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
|
|
118
|
+
///
|
|
119
|
+
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
|
|
120
|
+
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
|
|
121
|
+
/// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`.
|
|
122
|
+
- (BOOL)concurrentRootEnabled
|
|
123
|
+
{
|
|
124
|
+
// Switch this bool to turn on and off the concurrent root
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
129
|
+
|
|
130
|
+
#pragma mark - RCTCxxBridgeDelegate
|
|
131
|
+
|
|
132
|
+
- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
|
|
133
|
+
{
|
|
134
|
+
_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
|
|
135
|
+
delegate:self
|
|
136
|
+
jsInvoker:bridge.jsCallInvoker];
|
|
137
|
+
return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
#pragma mark RCTTurboModuleManagerDelegate
|
|
141
|
+
|
|
142
|
+
- (Class)getModuleClassFromName:(const char *)name
|
|
143
|
+
{
|
|
144
|
+
return RCTCoreModulesClassProvider(name);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
|
148
|
+
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
|
|
149
|
+
{
|
|
150
|
+
return nullptr;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
|
154
|
+
initParams:
|
|
155
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
156
|
+
{
|
|
157
|
+
return nullptr;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
|
|
161
|
+
{
|
|
162
|
+
return RCTAppSetupDefaultModuleFromClass(moduleClass);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
#endif
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"images" : [
|
|
3
|
+
{
|
|
4
|
+
"idiom" : "iphone",
|
|
5
|
+
"scale" : "2x",
|
|
6
|
+
"size" : "20x20"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"idiom" : "iphone",
|
|
10
|
+
"scale" : "3x",
|
|
11
|
+
"size" : "20x20"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"idiom" : "iphone",
|
|
15
|
+
"scale" : "2x",
|
|
16
|
+
"size" : "29x29"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"idiom" : "iphone",
|
|
20
|
+
"scale" : "3x",
|
|
21
|
+
"size" : "29x29"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"idiom" : "iphone",
|
|
25
|
+
"scale" : "2x",
|
|
26
|
+
"size" : "40x40"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"idiom" : "iphone",
|
|
30
|
+
"scale" : "3x",
|
|
31
|
+
"size" : "40x40"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"filename" : "icon120_120@2x.png",
|
|
35
|
+
"idiom" : "iphone",
|
|
36
|
+
"scale" : "2x",
|
|
37
|
+
"size" : "60x60"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"filename" : "icon180_180@3x.png",
|
|
41
|
+
"idiom" : "iphone",
|
|
42
|
+
"scale" : "3x",
|
|
43
|
+
"size" : "60x60"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"idiom" : "ios-marketing",
|
|
47
|
+
"scale" : "1x",
|
|
48
|
+
"size" : "1024x1024"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"info" : {
|
|
52
|
+
"author" : "xcode",
|
|
53
|
+
"version" : 1
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"images" : [
|
|
3
|
+
{
|
|
4
|
+
"idiom" : "universal",
|
|
5
|
+
"scale" : "1x"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"filename" : "launch_icon@2x.png",
|
|
9
|
+
"idiom" : "universal",
|
|
10
|
+
"scale" : "2x"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"idiom" : "universal",
|
|
14
|
+
"scale" : "3x"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"info" : {
|
|
18
|
+
"author" : "xcode",
|
|
19
|
+
"version" : 1
|
|
20
|
+
}
|
|
21
|
+
}
|