From 23f2c88837cd290cdaaaf37f06bd89cc13ee7710 Mon Sep 17 00:00:00 2001 From: creature-water-valley <83949308+creature-water-valley@users.noreply.github.com> Date: Fri, 21 Apr 2023 10:46:32 +0900 Subject: [PATCH] npm run prebuild:prod --- .../SantokuApp/prebuild/prod/android/app/BUCK | 55 ---- .../prebuild/prod/android/app/build.gradle | 309 ++++++------------ .../prebuild/prod/android/app/build_defs.bzl | 19 -- .../mobile/SantokuApp/ReactNativeFlipper.java | 16 +- .../android/app/src/main/AndroidManifest.xml | 2 +- .../fintan/mobile/SantokuApp/AppActivity.java | 41 +-- .../mobile/SantokuApp/MainApplication.java | 100 ++---- .../MainApplicationReactNativeHost.java | 117 ------- .../components/MainComponentsRegistry.java | 36 -- ...ApplicationTurboModuleManagerDelegate.java | 48 --- .../android/app/src/main/jni/CMakeLists.txt | 7 - .../jni/MainApplicationModuleProvider.cpp | 32 -- .../main/jni/MainApplicationModuleProvider.h | 16 - ...nApplicationTurboModuleManagerDelegate.cpp | 45 --- ...ainApplicationTurboModuleManagerDelegate.h | 38 --- .../src/main/jni/MainComponentsRegistry.cpp | 65 ---- .../app/src/main/jni/MainComponentsRegistry.h | 32 -- .../prod/android/app/src/main/jni/OnLoad.cpp | 11 - .../mobile/SantokuApp/ReactNativeFlipper.java | 20 ++ .../prebuild/prod/android/build.gradle | 37 +-- .../prebuild/prod/android/gradle.properties | 2 +- .../prebuild/prod/android/settings.gradle | 7 - .../SantokuApp/prebuild/prod/ios/Podfile | 39 ++- .../prebuild/prod/ios/Podfile.properties.json | 2 +- .../ios/SantokuApp.xcodeproj/project.pbxproj | 58 ++-- .../prod/ios/SantokuApp/AppDelegate.h | 6 +- .../prod/ios/SantokuApp/AppDelegate.mm | 127 +------ .../prod/ios/SantokuApp/Supporting/Expo.plist | 2 +- 28 files changed, 262 insertions(+), 1027 deletions(-) delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/BUCK delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/build_defs.bzl delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/newarchitecture/MainApplicationReactNativeHost.java delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/newarchitecture/components/MainComponentsRegistry.java delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/CMakeLists.txt delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationModuleProvider.cpp delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationModuleProvider.h delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainComponentsRegistry.cpp delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainComponentsRegistry.h delete mode 100644 example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/OnLoad.cpp create mode 100644 example-app/SantokuApp/prebuild/prod/android/app/src/release/java/jp/fintan/mobile/SantokuApp/ReactNativeFlipper.java diff --git a/example-app/SantokuApp/prebuild/prod/android/app/BUCK b/example-app/SantokuApp/prebuild/prod/android/app/BUCK deleted file mode 100644 index 42c6527ea1..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/BUCK +++ /dev/null @@ -1,55 +0,0 @@ -# To learn about Buck see [Docs](https://buckbuild.com/). -# To run your application with Buck: -# - install Buck -# - `npm start` - to start the packager -# - `cd android` -# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` -# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck -# - `buck install -r android/app` - compile, install and run application -# - -load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") - -lib_deps = [] - -create_aar_targets(glob(["libs/*.aar"])) - -create_jar_targets(glob(["libs/*.jar"])) - -android_library( - name = "all-libs", - exported_deps = lib_deps, -) - -android_library( - name = "app-code", - srcs = glob([ - "src/main/java/**/*.java", - ]), - deps = [ - ":all-libs", - ":build_config", - ":res", - ], -) - -android_build_config( - name = "build_config", - package = "jp.fintan.mobile.SantokuApp", -) - -android_resource( - name = "res", - package = "jp.fintan.mobile.SantokuApp", - res = "src/main/res", -) - -android_binary( - name = "app", - keystore = "//android/keystores:debug", - manifest = "src/main/AndroidManifest.xml", - package_type = "debug", - deps = [ - ":app-code", - ], -) diff --git a/example-app/SantokuApp/prebuild/prod/android/app/build.gradle b/example-app/SantokuApp/prebuild/prod/android/app/build.gradle index cb9ada6694..97d851017d 100644 --- a/example-app/SantokuApp/prebuild/prod/android/app/build.gradle +++ b/example-app/SantokuApp/prebuild/prod/android/app/build.gradle @@ -4,137 +4,109 @@ plugins { apply plugin: "com.android.application" apply plugin: "com.google.gms.google-services" apply plugin: "com.google.firebase.crashlytics" +apply plugin: "com.facebook.react" import com.android.build.OutputFile -/** - * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets - * and bundleReleaseJsAndAssets). - * These basically call `react-native bundle` with the correct arguments during the Android build - * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the - * bundle directly from the development server. Below you can see all the possible configurations - * and their defaults. If you decide to add a configuration block, make sure to add it before the - * `apply from: "../../node_modules/react-native/react.gradle"` line. - * - * project.ext.react = [ - * // the name of the generated asset file containing your JS bundle - * bundleAssetName: "index.android.bundle", - * - * // the entry file for bundle generation. If none specified and - * // "index.android.js" exists, it will be used. Otherwise "index.js" is - * // default. Can be overridden with ENTRY_FILE environment variable. - * entryFile: "index.android.js", - * - * // https://reactnative.dev/docs/performance#enable-the-ram-format - * bundleCommand: "ram-bundle", - * - * // whether to bundle JS and assets in debug mode - * bundleInDebug: false, - * - * // whether to bundle JS and assets in release mode - * bundleInRelease: true, - * - * // whether to bundle JS and assets in another build variant (if configured). - * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants - * // The configuration property can be in the following formats - * // 'bundleIn${productFlavor}${buildType}' - * // 'bundleIn${buildType}' - * // bundleInFreeDebug: true, - * // bundleInPaidRelease: true, - * // bundleInBeta: true, - * - * // whether to disable dev mode in custom build variants (by default only disabled in release) - * // for example: to disable dev mode in the staging build type (if configured) - * devDisabledInStaging: true, - * // The configuration property can be in the following formats - * // 'devDisabledIn${productFlavor}${buildType}' - * // 'devDisabledIn${buildType}' - * - * // the root of your project, i.e. where "package.json" lives - * root: "../../", - * - * // where to put the JS bundle asset in debug mode - * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", - * - * // where to put the JS bundle asset in release mode - * jsBundleDirRelease: "$buildDir/intermediates/assets/release", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in debug mode - * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in release mode - * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", - * - * // by default the gradle tasks are skipped if none of the JS files or assets change; this means - * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to - * // date; if you have any other folders that you want to ignore for performance reasons (gradle - * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ - * // for example, you might want to remove it from here. - * inputExcludes: ["android/**", "ios/**"], - * - * // override which node gets called and with what additional arguments - * nodeExecutableAndArgs: ["node"], - * - * // supply additional arguments to the packager - * extraPackagerArgs: [] - * ] - */ - def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath() +def expoDebuggableVariants = ['debug'] +// Override `debuggableVariants` for expo-updates debugging +if (System.getenv('EX_UPDATES_NATIVE_DEBUG') == "1") { + react { + expoDebuggableVariants = [] + } +} -def reactNativeRoot = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() -project.ext.react = [ - entryFile: ["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android"].execute(null, rootDir).text.trim(), - enableHermes: (findProperty('expo.jsEngine') ?: "jsc") == "hermes", - hermesCommand: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc", - cliPath: "${reactNativeRoot}/cli.js", - composeSourceMapsPath: "${reactNativeRoot}/scripts/compose-source-maps.js", -] +/** + * This is the configuration block to customize your React Native Android app. + * By default you don't need to apply any configuration, just uncomment the lines you need. + */ +react { + entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim()) + reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile() + hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc" + debuggableVariants = expoDebuggableVariants + + /* Folders */ + // The root of your project, i.e. where "package.json" lives. Default is '..' + // root = file("../") + // The folder where the react-native NPM package is. Default is ../node_modules/react-native + // reactNativeDir = file("../node_modules/react-native") + // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen + // codegenDir = file("../node_modules/react-native-codegen") + // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js + // cliFile = file("../node_modules/react-native/cli.js") + + /* Variants */ + // The list of variants to that are debuggable. For those we're going to + // skip the bundling of the JS bundle and the assets. By default is just 'debug'. + // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. + // debuggableVariants = ["liteDebug", "prodDebug"] + + /* Bundling */ + // A list containing the node command and its flags. Default is just 'node'. + // nodeExecutableAndArgs = ["node"] + // + // The command to run when bundling. By default is 'bundle' + // bundleCommand = "ram-bundle" + // + // The path to the CLI configuration file. Default is empty. + // bundleConfig = file(../rn-cli.config.js) + // + // The name of the generated asset file containing your JS bundle + // bundleAssetName = "MyApplication.android.bundle" + // + // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' + // entryFile = file("../js/MyApplication.android.js") + // + // A list of extra flags to pass to the 'bundle' commands. + // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle + // extraPackagerArgs = [] + + /* Hermes Commands */ + // The hermes compiler command to run. By default it is 'hermesc' + // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" + // + // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" + // hermesFlags = ["-O", "-output-source-map"] +} -apply from: new File(reactNativeRoot, "react.gradle") +// Override `hermesEnabled` by `expo.jsEngine` +ext { + hermesEnabled = (findProperty('expo.jsEngine') ?: "hermes") == "hermes" +} /** - * Set this to true to create two separate APKs instead of one: - * - An APK that only works on ARM devices - * - An APK that only works on x86 devices - * The advantage is the size of the APK is reduced by about 4MB. - * Upload all the APKs to the Play Store and people will download - * the correct one based on the CPU architecture of their device. + * Set this to true to create four separate APKs instead of one, + * one for each native architecture. This is useful if you don't + * use App Bundles (https://developer.android.com/guide/app-bundle/) + * and want to have separate APKs to upload to the Play Store. */ def enableSeparateBuildPerCPUArchitecture = false /** - * Run Proguard to shrink the Java bytecode in release builds. + * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean() /** - * The preferred build flavor of JavaScriptCore. + * The preferred build flavor of JavaScriptCore (JSC) * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that - * give correct results when using with locales other than en-US. Note that + * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ def jscFlavor = 'org.webkit:android-jsc:+' /** - * Whether to enable the Hermes VM. - * - * This should be set on project.ext.react and that value will be read here. If it is not set - * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode - * and the benefits of using Hermes will therefore be sharply reduced. - */ -def enableHermes = project.ext.react.get("enableHermes", false); - -/** - * Architectures to build native code for. + * Private function to get the list of Native Architectures you want to build. + * This reads the value from reactNativeArchitectures in your gradle.properties + * file and works together with the --active-arch-only flag of react-native run-android. */ def reactNativeArchitectures() { def value = project.getProperties().get("reactNativeArchitectures") @@ -146,72 +118,13 @@ android { compileSdkVersion rootProject.ext.compileSdkVersion + namespace 'jp.fintan.mobile.SantokuApp' defaultConfig { applicationId 'jp.fintan.mobile.SantokuApp' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 4 versionName "0.1.0" - buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() - - if (isNewArchitectureEnabled()) { - // We configure the CMake build only if you decide to opt-in for the New Architecture. - externalNativeBuild { - cmake { - arguments "-DPROJECT_BUILD_DIR=$buildDir", - "-DREACT_ANDROID_DIR=${reactNativeRoot}/ReactAndroid", - "-DREACT_ANDROID_BUILD_DIR=${reactNativeRoot}/ReactAndroid/build", - "-DNODE_MODULES_DIR=$rootDir/../node_modules", - "-DANDROID_STL=c++_shared" - } - } - if (!enableSeparateBuildPerCPUArchitecture) { - ndk { - abiFilters (*reactNativeArchitectures()) - } - } - } - } - - if (isNewArchitectureEnabled()) { - // We configure the CMake build only if you decide to opt-in for the New Architecture. - externalNativeBuild { - cmake { - path "$projectDir/src/main/jni/CMakeLists.txt" - } - } - def reactAndroidProjectDir = project(':ReactAndroid').projectDir - def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) { - dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck") - from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") - into("$buildDir/react-ndk/exported") - } - def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) { - dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck") - from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") - into("$buildDir/react-ndk/exported") - } - afterEvaluate { - // If you wish to add a custom TurboModule or component locally, - // you should uncomment this line. - // preBuild.dependsOn("generateCodegenArtifactsFromSchema") - preDebugBuild.dependsOn(packageReactNdkDebugLibs) - preReleaseBuild.dependsOn(packageReactNdkReleaseLibs) - - // Due to a bug inside AGP, we have to explicitly set a dependency - // between configureCMakeDebug* tasks and the preBuild tasks. - // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732 - configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild) - configureCMakeDebug.dependsOn(preDebugBuild) - reactNativeArchitectures().each { architecture -> - tasks.findByName("configureCMakeDebug[${architecture}]")?.configure { - dependsOn("preDebugBuild") - } - tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure { - dependsOn("preReleaseBuild") - } - } - } } splits { @@ -253,6 +166,7 @@ android { nativeSymbolUploadEnabled true unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib' } + shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false) minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } @@ -263,11 +177,12 @@ android { variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // https://developer.android.com/studio/build/configure-apk-splits.html + // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = - versionCodes.get(abi) * 1048576 + defaultConfig.versionCode + defaultConfig.versionCode * 1000 + versionCodes.get(abi) } } @@ -295,10 +210,8 @@ android { } dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - - //noinspection GradleDynamicVersion - implementation "com.facebook.react:react-native:+" // From node_modules + // The version of react-native is set by the React Native Gradle Plugin + implementation("com.facebook.react:react-android") def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true"; def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true"; @@ -307,80 +220,42 @@ dependencies { // If your app supports Android versions before Ice Cream Sandwich (API level 14) if (isGifEnabled || isWebpEnabled) { - implementation "com.facebook.fresco:fresco:${frescoVersion}" - implementation "com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}" + implementation("com.facebook.fresco:fresco:${frescoVersion}") + implementation("com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}") } if (isGifEnabled) { // For animated gif support - implementation "com.facebook.fresco:animated-gif:${frescoVersion}" + implementation("com.facebook.fresco:animated-gif:${frescoVersion}") } if (isWebpEnabled) { // For webp support - implementation "com.facebook.fresco:webpsupport:${frescoVersion}" + implementation("com.facebook.fresco:webpsupport:${frescoVersion}") if (isWebpAnimatedEnabled) { // Animated webp support - implementation "com.facebook.fresco:animated-webp:${frescoVersion}" + implementation("com.facebook.fresco:animated-webp:${frescoVersion}") } } - implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" - debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { - exclude group:'com.facebook.fbjni' - } + implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0") + + debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { - exclude group:'com.facebook.flipper' exclude group:'com.squareup.okhttp3', module:'okhttp' } - debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { - exclude group:'com.facebook.flipper' - } + debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") - if (enableHermes) { - //noinspection GradleDynamicVersion - implementation("com.facebook.react:hermes-engine:+") { // From node_modules - exclude group:'com.facebook.fbjni' - } + if (hermesEnabled.toBoolean()) { + implementation("com.facebook.react:hermes-android") } else { implementation jscFlavor } } -if (isNewArchitectureEnabled()) { - // If new architecture is enabled, we let you build RN from source - // Otherwise we fallback to a prebuilt .aar bundled in the NPM package. - // This will be applied to all the imported transtitive dependency. - configurations.all { - resolutionStrategy.dependencySubstitution { - substitute(module("com.facebook.react:react-native")) - .using(project(":ReactAndroid")) - .because("On New Architecture we're building React Native from source") - substitute(module("com.facebook.react:hermes-engine")) - .using(project(":ReactAndroid:hermes-engine")) - .because("On New Architecture we're building Hermes from source") - } - } -} - -// Run this once to be able to run the application with BUCK -// puts all compile dependencies into folder libs for BUCK to use -task copyDownloadableDepsToLibs(type: Copy) { - from configurations.implementation - into 'libs' -} - apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle"); applyNativeModulesAppBuildGradle(project) -def isNewArchitectureEnabled() { - // To opt-in for the New Architecture, you can either: - // - Set `newArchEnabled` to true inside the `gradle.properties` file - // - Invoke gradle with `-newArchEnabled=true` - // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true` - return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true" -} - licenseReport { generateCsvReport = false diff --git a/example-app/SantokuApp/prebuild/prod/android/app/build_defs.bzl b/example-app/SantokuApp/prebuild/prod/android/app/build_defs.bzl deleted file mode 100644 index fff270f8d1..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/build_defs.bzl +++ /dev/null @@ -1,19 +0,0 @@ -"""Helper definitions to glob .aar and .jar targets""" - -def create_aar_targets(aarfiles): - for aarfile in aarfiles: - name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] - lib_deps.append(":" + name) - android_prebuilt_aar( - name = name, - aar = aarfile, - ) - -def create_jar_targets(jarfiles): - for jarfile in jarfiles: - name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] - lib_deps.append(":" + name) - prebuilt_jar( - name = name, - binary_jar = jarfile, - ) diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/debug/java/jp/fintan/mobile/SantokuApp/ReactNativeFlipper.java b/example-app/SantokuApp/prebuild/prod/android/app/src/debug/java/jp/fintan/mobile/SantokuApp/ReactNativeFlipper.java index d339333ded..97199d729d 100644 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/debug/java/jp/fintan/mobile/SantokuApp/ReactNativeFlipper.java +++ b/example-app/SantokuApp/prebuild/prod/android/app/src/debug/java/jp/fintan/mobile/SantokuApp/ReactNativeFlipper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * *

This source code is licensed under the MIT license found in the LICENSE file in the root * directory of this source tree. @@ -17,22 +17,27 @@ import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; -import com.facebook.flipper.plugins.react.ReactFlipperPlugin; import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; +import com.facebook.react.ReactInstanceEventListener; import com.facebook.react.ReactInstanceManager; import com.facebook.react.bridge.ReactContext; import com.facebook.react.modules.network.NetworkingModule; import okhttp3.OkHttpClient; +/** + * Class responsible of loading Flipper inside your React Native application. This is the debug + * flavor of it. Here you can add your own plugins and customize the Flipper setup. + */ public class ReactNativeFlipper { public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { if (FlipperUtils.shouldEnableFlipper(context)) { final FlipperClient client = AndroidFlipperClient.getInstance(context); + client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); - client.addPlugin(new ReactFlipperPlugin()); client.addPlugin(new DatabasesFlipperPlugin(context)); client.addPlugin(new SharedPreferencesFlipperPlugin(context)); client.addPlugin(CrashReporterPlugin.getInstance()); + NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); NetworkingModule.setCustomClientBuilder( new NetworkingModule.CustomClientBuilder() { @@ -43,12 +48,13 @@ public void apply(OkHttpClient.Builder builder) { }); client.addPlugin(networkFlipperPlugin); client.start(); + // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized // Hence we run if after all native modules have been initialized ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); if (reactContext == null) { reactInstanceManager.addReactInstanceEventListener( - new ReactInstanceManager.ReactInstanceEventListener() { + new ReactInstanceEventListener() { @Override public void onReactContextInitialized(ReactContext reactContext) { reactInstanceManager.removeReactInstanceEventListener(this); @@ -66,4 +72,4 @@ public void run() { } } } -} \ No newline at end of file +} diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/AndroidManifest.xml b/example-app/SantokuApp/prebuild/prod/android/app/src/main/AndroidManifest.xml index a7918b74f9..29a4e5628b 100644 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/AndroidManifest.xml +++ b/example-app/SantokuApp/prebuild/prod/android/app/src/main/AndroidManifest.xml @@ -15,7 +15,7 @@ - + diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/AppActivity.java b/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/AppActivity.java index fcb1363913..cf9d32f91e 100644 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/AppActivity.java +++ b/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/AppActivity.java @@ -5,7 +5,8 @@ import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; -import com.facebook.react.ReactRootView; +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; +import com.facebook.react.defaults.DefaultReactActivityDelegate; import expo.modules.ReactActivityDelegateWrapper; @@ -29,15 +30,20 @@ protected String getMainComponentName() { } /** - * Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and - * you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer - * (Paper). + * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link + * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React + * (aka React 18) with two boolean flags. */ @Override protected ReactActivityDelegate createReactActivityDelegate() { - return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, - new MainActivityDelegate(this, getMainComponentName()) - ); + return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate( + this, + getMainComponentName(), + // If you opted-in for the New Architecture, we enable the Fabric Renderer. + DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled + // If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18). + DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled + )); } /** @@ -59,25 +65,4 @@ public void invokeDefaultOnBackPressed() { // because it's doing more than {@link Activity#moveTaskToBack} in fact. super.invokeDefaultOnBackPressed(); } - - public static class MainActivityDelegate extends ReactActivityDelegate { - public MainActivityDelegate(ReactActivity activity, String mainComponentName) { - super(activity, mainComponentName); - } - - @Override - protected ReactRootView createRootView() { - ReactRootView reactRootView = new ReactRootView(getContext()); - // If you opted-in for the New Architecture, we enable the Fabric Renderer. - reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED); - return reactRootView; - } - - @Override - protected boolean isConcurrentRootEnabled() { - // If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18). - // More on this on https://reactjs.org/blog/2022/03/29/react-v18.html - return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; - } - } } diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/MainApplication.java b/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/MainApplication.java index 7f4d8e224d..4ce3715e98 100644 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/MainApplication.java +++ b/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/MainApplication.java @@ -1,70 +1,71 @@ package jp.fintan.mobile.SantokuApp; import android.app.Application; -import android.content.Context; import android.content.res.Configuration; import androidx.annotation.NonNull; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; -import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; -import com.facebook.react.config.ReactFeatureFlags; +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; +import com.facebook.react.defaults.DefaultReactNativeHost; import com.facebook.soloader.SoLoader; -import jp.fintan.mobile.SantokuApp.newarchitecture.MainApplicationReactNativeHost; import expo.modules.ApplicationLifecycleDispatcher; import expo.modules.ReactNativeHostWrapper; -import java.lang.reflect.InvocationTargetException; import java.util.List; public class MainApplication extends Application implements ReactApplication { - private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper( - this, - new ReactNativeHost(this) { - @Override - public boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - @Override - protected List getPackages() { + private final ReactNativeHost mReactNativeHost = + new ReactNativeHostWrapper(this, new DefaultReactNativeHost(this) { + @Override + public boolean getUseDeveloperSupport() { + return BuildConfig.DEBUG; + } + + @Override + protected List getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List packages = new PackageList(this).getPackages(); packages.add(new ThrowErrorPackage());; - // Packages that cannot be autolinked yet can be added manually here, for example: - // packages.add(new MyReactNativePackage()); - return packages; - } + // Packages that cannot be autolinked yet can be added manually here, for example: + // packages.add(new MyReactNativePackage()); + return packages; + } - @Override - protected String getJSMainModuleName() { - return "index"; - } - }); + @Override + protected String getJSMainModuleName() { + return "index"; + } - private final ReactNativeHost mNewArchitectureNativeHost = - new ReactNativeHostWrapper(this, new MainApplicationReactNativeHost(this)); + @Override + protected boolean isNewArchEnabled() { + return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; + } + + @Override + protected Boolean isHermesEnabled() { + return BuildConfig.IS_HERMES_ENABLED; + } + }); @Override public ReactNativeHost getReactNativeHost() { - if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { - return mNewArchitectureNativeHost; - } else { - return mReactNativeHost; - } + return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); - // If you opted-in for the New Architecture, we enable the TurboModule system - ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; SoLoader.init(this, /* native exopackage */ false); - - initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); + if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { + // If you opted-in for the New Architecture, we load the native entry point for this app. + DefaultNewArchitectureEntryPoint.load(); + } + ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); ApplicationLifecycleDispatcher.onApplicationCreate(this); } @@ -73,35 +74,4 @@ public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig); } - - /** - * Loads Flipper in React Native templates. Call this in the onCreate method with something like - * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); - * - * @param context - * @param reactInstanceManager - */ - private static void initializeFlipper( - Context context, ReactInstanceManager reactInstanceManager) { - if (BuildConfig.DEBUG) { - try { - /* - We use reflection here to pick up the class that initializes Flipper, - since Flipper library is not available in release mode - */ - Class aClass = Class.forName("jp.fintan.mobile.SantokuApp.ReactNativeFlipper"); - aClass - .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) - .invoke(null, context, reactInstanceManager); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } - } - } } diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/newarchitecture/MainApplicationReactNativeHost.java b/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/newarchitecture/MainApplicationReactNativeHost.java deleted file mode 100644 index cef0a3124b..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/newarchitecture/MainApplicationReactNativeHost.java +++ /dev/null @@ -1,117 +0,0 @@ -package jp.fintan.mobile.SantokuApp.newarchitecture; - -import android.app.Application; -import androidx.annotation.NonNull; -import com.facebook.react.PackageList; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.ReactPackageTurboModuleManagerDelegate; -import com.facebook.react.bridge.JSIModulePackage; -import com.facebook.react.bridge.JSIModuleProvider; -import com.facebook.react.bridge.JSIModuleSpec; -import com.facebook.react.bridge.JSIModuleType; -import com.facebook.react.bridge.JavaScriptContextHolder; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.UIManager; -import com.facebook.react.fabric.ComponentFactory; -import com.facebook.react.fabric.CoreComponentsRegistry; -import com.facebook.react.fabric.EmptyReactNativeConfig; -import com.facebook.react.fabric.FabricJSIModuleProvider; -import com.facebook.react.fabric.ReactNativeConfig; -import com.facebook.react.uimanager.ViewManagerRegistry; -import jp.fintan.mobile.SantokuApp.BuildConfig; -import jp.fintan.mobile.SantokuApp.newarchitecture.components.MainComponentsRegistry; -import jp.fintan.mobile.SantokuApp.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate; -import java.util.ArrayList; -import java.util.List; - -/** - * A {@link ReactNativeHost} that helps you load everything needed for the New Architecture, both - * TurboModule delegates and the Fabric Renderer. - * - *

Please note that this class is used ONLY if you opt-in for the New Architecture (see the - * `newArchEnabled` property). Is ignored otherwise. - */ -public class MainApplicationReactNativeHost extends ReactNativeHost { - public MainApplicationReactNativeHost(Application application) { - super(application); - } - - @Override - public boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - @Override - protected List getPackages() { - List packages = new PackageList(this).getPackages(); - // Packages that cannot be autolinked yet can be added manually here, for example: - // packages.add(new MyReactNativePackage()); - // TurboModules must also be loaded here providing a valid TurboReactPackage implementation: - // packages.add(new TurboReactPackage() { ... }); - // If you have custom Fabric Components, their ViewManagers should also be loaded here - // inside a ReactPackage. - return packages; - } - - @Override - protected String getJSMainModuleName() { - return "index"; - } - - @NonNull - @Override - protected ReactPackageTurboModuleManagerDelegate.Builder - getReactPackageTurboModuleManagerDelegateBuilder() { - // Here we provide the ReactPackageTurboModuleManagerDelegate Builder. This is necessary - // for the new architecture and to use TurboModules correctly. - return new MainApplicationTurboModuleManagerDelegate.Builder(); - } - - @Override - protected JSIModulePackage getJSIModulePackage() { - return new JSIModulePackage() { - @Override - public List getJSIModules( - final ReactApplicationContext reactApplicationContext, - final JavaScriptContextHolder jsContext) { - final List specs = new ArrayList<>(); - - // Here we provide a new JSIModuleSpec that will be responsible of providing the - // custom Fabric Components. - specs.add( - new JSIModuleSpec() { - @Override - public JSIModuleType getJSIModuleType() { - return JSIModuleType.UIManager; - } - - @Override - public JSIModuleProvider getJSIModuleProvider() { - final ComponentFactory componentFactory = new ComponentFactory(); - CoreComponentsRegistry.register(componentFactory); - - // Here we register a Components Registry. - // The one that is generated with the template contains no components - // and just provides you the one from React Native core. - MainComponentsRegistry.register(componentFactory); - - final ReactInstanceManager reactInstanceManager = getReactInstanceManager(); - - ViewManagerRegistry viewManagerRegistry = - new ViewManagerRegistry( - reactInstanceManager.getOrCreateViewManagers(reactApplicationContext)); - - return new FabricJSIModuleProvider( - reactApplicationContext, - componentFactory, - ReactNativeConfig.DEFAULT_CONFIG, - viewManagerRegistry); - } - }); - return specs; - } - }; - } -} diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/newarchitecture/components/MainComponentsRegistry.java b/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/newarchitecture/components/MainComponentsRegistry.java deleted file mode 100644 index 9317e6abba..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/newarchitecture/components/MainComponentsRegistry.java +++ /dev/null @@ -1,36 +0,0 @@ -package jp.fintan.mobile.SantokuApp.newarchitecture.components; - -import com.facebook.jni.HybridData; -import com.facebook.proguard.annotations.DoNotStrip; -import com.facebook.react.fabric.ComponentFactory; -import com.facebook.soloader.SoLoader; - -/** - * Class responsible to load the custom Fabric Components. This class has native methods and needs a - * corresponding C++ implementation/header file to work correctly (already placed inside the jni/ - * folder for you). - * - *

Please note that this class is used ONLY if you opt-in for the New Architecture (see the - * `newArchEnabled` property). Is ignored otherwise. - */ -@DoNotStrip -public class MainComponentsRegistry { - static { - SoLoader.loadLibrary("fabricjni"); - } - - @DoNotStrip private final HybridData mHybridData; - - @DoNotStrip - private native HybridData initHybrid(ComponentFactory componentFactory); - - @DoNotStrip - private MainComponentsRegistry(ComponentFactory componentFactory) { - mHybridData = initHybrid(componentFactory); - } - - @DoNotStrip - public static MainComponentsRegistry register(ComponentFactory componentFactory) { - return new MainComponentsRegistry(componentFactory); - } -} diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java b/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java deleted file mode 100644 index 7a63b241ea..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/java/jp/fintan/mobile/SantokuApp/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java +++ /dev/null @@ -1,48 +0,0 @@ -package jp.fintan.mobile.SantokuApp.newarchitecture.modules; - -import com.facebook.jni.HybridData; -import com.facebook.react.ReactPackage; -import com.facebook.react.ReactPackageTurboModuleManagerDelegate; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.soloader.SoLoader; -import java.util.List; - -/** - * Class responsible to load the TurboModules. This class has native methods and needs a - * corresponding C++ implementation/header file to work correctly (already placed inside the jni/ - * folder for you). - * - *

Please note that this class is used ONLY if you opt-in for the New Architecture (see the - * `newArchEnabled` property). Is ignored otherwise. - */ -public class MainApplicationTurboModuleManagerDelegate - extends ReactPackageTurboModuleManagerDelegate { - - private static volatile boolean sIsSoLibraryLoaded; - - protected MainApplicationTurboModuleManagerDelegate( - ReactApplicationContext reactApplicationContext, List packages) { - super(reactApplicationContext, packages); - } - - protected native HybridData initHybrid(); - - native boolean canCreateTurboModule(String moduleName); - - public static class Builder extends ReactPackageTurboModuleManagerDelegate.Builder { - protected MainApplicationTurboModuleManagerDelegate build( - ReactApplicationContext context, List packages) { - return new MainApplicationTurboModuleManagerDelegate(context, packages); - } - } - - @Override - protected synchronized void maybeLoadOtherSoLibraries() { - if (!sIsSoLibraryLoaded) { - // If you change the name of your application .so file in the Android.mk file, - // make sure you update the name here as well. - SoLoader.loadLibrary("santokuapp_appmodules"); - sIsSoLibraryLoaded = true; - } - } -} diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/CMakeLists.txt b/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/CMakeLists.txt deleted file mode 100644 index 473bb0a6c4..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.13) - -# Define the library name here. -project(santokuapp_appmodules) - -# This file includes all the necessary to let you build your application with the New Architecture. -include(${REACT_ANDROID_DIR}/cmake-utils/ReactNative-application.cmake) diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationModuleProvider.cpp b/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationModuleProvider.cpp deleted file mode 100644 index 26162dd872..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationModuleProvider.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "MainApplicationModuleProvider.h" - -#include -#include - -namespace facebook { -namespace react { - -std::shared_ptr MainApplicationModuleProvider( - const std::string &moduleName, - const JavaTurboModule::InitParams ¶ms) { - // Here you can provide your own module provider for TurboModules coming from - // either your application or from external libraries. The approach to follow - // is similar to the following (for a library called `samplelibrary`: - // - // auto module = samplelibrary_ModuleProvider(moduleName, params); - // if (module != nullptr) { - // return module; - // } - // return rncore_ModuleProvider(moduleName, params); - - // Module providers autolinked by RN CLI - auto rncli_module = rncli_ModuleProvider(moduleName, params); - if (rncli_module != nullptr) { - return rncli_module; - } - - return rncore_ModuleProvider(moduleName, params); -} - -} // namespace react -} // namespace facebook diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationModuleProvider.h b/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationModuleProvider.h deleted file mode 100644 index b38ccf53fd..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationModuleProvider.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include -#include - -#include - -namespace facebook { -namespace react { - -std::shared_ptr MainApplicationModuleProvider( - const std::string &moduleName, - const JavaTurboModule::InitParams ¶ms); - -} // namespace react -} // namespace facebook diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp b/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp deleted file mode 100644 index 5fd688c509..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "MainApplicationTurboModuleManagerDelegate.h" -#include "MainApplicationModuleProvider.h" - -namespace facebook { -namespace react { - -jni::local_ref -MainApplicationTurboModuleManagerDelegate::initHybrid( - jni::alias_ref) { - return makeCxxInstance(); -} - -void MainApplicationTurboModuleManagerDelegate::registerNatives() { - registerHybrid({ - makeNativeMethod( - "initHybrid", MainApplicationTurboModuleManagerDelegate::initHybrid), - makeNativeMethod( - "canCreateTurboModule", - MainApplicationTurboModuleManagerDelegate::canCreateTurboModule), - }); -} - -std::shared_ptr -MainApplicationTurboModuleManagerDelegate::getTurboModule( - const std::string &name, - const std::shared_ptr &jsInvoker) { - // Not implemented yet: provide pure-C++ NativeModules here. - return nullptr; -} - -std::shared_ptr -MainApplicationTurboModuleManagerDelegate::getTurboModule( - const std::string &name, - const JavaTurboModule::InitParams ¶ms) { - return MainApplicationModuleProvider(name, params); -} - -bool MainApplicationTurboModuleManagerDelegate::canCreateTurboModule( - const std::string &name) { - return getTurboModule(name, nullptr) != nullptr || - getTurboModule(name, {.moduleName = name}) != nullptr; -} - -} // namespace react -} // namespace facebook diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h b/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h deleted file mode 100644 index af17ea5ede..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include - -#include -#include - -namespace facebook { -namespace react { - -class MainApplicationTurboModuleManagerDelegate - : public jni::HybridClass< - MainApplicationTurboModuleManagerDelegate, - TurboModuleManagerDelegate> { - public: - // Adapt it to the package you used for your Java class. - static constexpr auto kJavaDescriptor = - "Ljp/fintan/mobile/SantokuApp/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;"; - - static jni::local_ref initHybrid(jni::alias_ref); - - static void registerNatives(); - - std::shared_ptr getTurboModule( - const std::string &name, - const std::shared_ptr &jsInvoker) override; - std::shared_ptr getTurboModule( - const std::string &name, - const JavaTurboModule::InitParams ¶ms) override; - - /** - * Test-only method. Allows user to verify whether a TurboModule can be - * created by instances of this class. - */ - bool canCreateTurboModule(const std::string &name); -}; - -} // namespace react -} // namespace facebook diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainComponentsRegistry.cpp b/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainComponentsRegistry.cpp deleted file mode 100644 index 54f598a486..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainComponentsRegistry.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "MainComponentsRegistry.h" - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -MainComponentsRegistry::MainComponentsRegistry(ComponentFactory *delegate) {} - -std::shared_ptr -MainComponentsRegistry::sharedProviderRegistry() { - auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry(); - - // Autolinked providers registered by RN CLI - rncli_registerProviders(providerRegistry); - - // Custom Fabric Components go here. You can register custom - // components coming from your App or from 3rd party libraries here. - // - // providerRegistry->add(concreteComponentDescriptorProvider< - // AocViewerComponentDescriptor>()); - return providerRegistry; -} - -jni::local_ref -MainComponentsRegistry::initHybrid( - jni::alias_ref, - ComponentFactory *delegate) { - auto instance = makeCxxInstance(delegate); - - auto buildRegistryFunction = - [](EventDispatcher::Weak const &eventDispatcher, - ContextContainer::Shared const &contextContainer) - -> ComponentDescriptorRegistry::Shared { - auto registry = MainComponentsRegistry::sharedProviderRegistry() - ->createComponentDescriptorRegistry( - {eventDispatcher, contextContainer}); - - auto mutableRegistry = - std::const_pointer_cast(registry); - - mutableRegistry->setFallbackComponentDescriptor( - std::make_shared( - ComponentDescriptorParameters{ - eventDispatcher, contextContainer, nullptr})); - - return registry; - }; - - delegate->buildRegistryFunction = buildRegistryFunction; - return instance; -} - -void MainComponentsRegistry::registerNatives() { - registerHybrid({ - makeNativeMethod("initHybrid", MainComponentsRegistry::initHybrid), - }); -} - -} // namespace react -} // namespace facebook diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainComponentsRegistry.h b/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainComponentsRegistry.h deleted file mode 100644 index 116d2b35c8..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/MainComponentsRegistry.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class MainComponentsRegistry - : public facebook::jni::HybridClass { - public: - // Adapt it to the package you used for your Java class. - constexpr static auto kJavaDescriptor = - "Ljp/fintan/mobile/SantokuApp/newarchitecture/components/MainComponentsRegistry;"; - - static void registerNatives(); - - MainComponentsRegistry(ComponentFactory *delegate); - - private: - static std::shared_ptr - sharedProviderRegistry(); - - static jni::local_ref initHybrid( - jni::alias_ref, - ComponentFactory *delegate); -}; - -} // namespace react -} // namespace facebook diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/OnLoad.cpp b/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/OnLoad.cpp deleted file mode 100644 index c569b6e865..0000000000 --- a/example-app/SantokuApp/prebuild/prod/android/app/src/main/jni/OnLoad.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "MainApplicationTurboModuleManagerDelegate.h" -#include "MainComponentsRegistry.h" - -JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) { - return facebook::jni::initialize(vm, [] { - facebook::react::MainApplicationTurboModuleManagerDelegate:: - registerNatives(); - facebook::react::MainComponentsRegistry::registerNatives(); - }); -} diff --git a/example-app/SantokuApp/prebuild/prod/android/app/src/release/java/jp/fintan/mobile/SantokuApp/ReactNativeFlipper.java b/example-app/SantokuApp/prebuild/prod/android/app/src/release/java/jp/fintan/mobile/SantokuApp/ReactNativeFlipper.java new file mode 100644 index 0000000000..7d417fded2 --- /dev/null +++ b/example-app/SantokuApp/prebuild/prod/android/app/src/release/java/jp/fintan/mobile/SantokuApp/ReactNativeFlipper.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + *

This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + */ +package jp.fintan.mobile.SantokuApp; + +import android.content.Context; +import com.facebook.react.ReactInstanceManager; + +/** + * Class responsible of loading Flipper inside your React Native application. This is the release + * flavor of it so it's empty as we don't want to load Flipper. + */ +public class ReactNativeFlipper { + public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { + // Do nothing as we don't want to initialize Flipper on Release. + } +} diff --git a/example-app/SantokuApp/prebuild/prod/android/build.gradle b/example-app/SantokuApp/prebuild/prod/android/build.gradle index 8f7700e222..ab877c110a 100644 --- a/example-app/SantokuApp/prebuild/prod/android/build.gradle +++ b/example-app/SantokuApp/prebuild/prod/android/build.gradle @@ -2,22 +2,17 @@ buildscript { ext { - buildToolsVersion = findProperty('android.buildToolsVersion') ?: '31.0.0' + buildToolsVersion = findProperty('android.buildToolsVersion') ?: '33.0.0' minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '21') - compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '31') - targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '31') + compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '33') + targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '33') if (findProperty('android.kotlinVersion')) { kotlinVersion = findProperty('android.kotlinVersion') } frescoVersion = findProperty('expo.frescoVersion') ?: '2.5.0' - if (System.properties['os.arch'] == 'aarch64') { - // For M1 Users we need to use the NDK 24 which added support for aarch64 - ndkVersion = '24.0.8215888' - } else { - // Otherwise we default to the side-by-side NDK version from AGP. - ndkVersion = '21.4.7075529' - } + // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP. + ndkVersion = "23.1.7779620" } repositories { google() @@ -26,25 +21,13 @@ buildscript { dependencies { classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2' classpath 'com.google.gms:google-services:4.3.3' - classpath('com.android.tools.build:gradle:7.2.1') + classpath('com.android.tools.build:gradle:7.4.1') classpath('com.facebook.react:react-native-gradle-plugin') - classpath('de.undercouch:gradle-download-task:5.0.1') - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files } } -def REACT_NATIVE_VERSION = new File(['node', '--print', "JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim()) - allprojects { - configurations.all { - resolutionStrategy { - force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION - } - } - repositories { - mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android')) @@ -55,13 +38,7 @@ allprojects { } google() - mavenCentral { - // We don't want to fetch react-native from Maven Central as there are - // older versions over there. - content { - excludeGroup 'com.facebook.react' - } - } + mavenCentral() maven { url 'https://www.jitpack.io' } } } diff --git a/example-app/SantokuApp/prebuild/prod/android/gradle.properties b/example-app/SantokuApp/prebuild/prod/android/gradle.properties index 68475ab50c..22babe01b8 100644 --- a/example-app/SantokuApp/prebuild/prod/android/gradle.properties +++ b/example-app/SantokuApp/prebuild/prod/android/gradle.properties @@ -42,7 +42,7 @@ newArchEnabled=false # The hosted JavaScript engine # Supported values: expo.jsEngine = "hermes" | "jsc" -expo.jsEngine=jsc +expo.jsEngine=hermes # Enable GIF support in React Native images (~200 B increase) expo.gif.enabled=true diff --git a/example-app/SantokuApp/prebuild/prod/android/settings.gradle b/example-app/SantokuApp/prebuild/prod/android/settings.gradle index 6333efb0ab..7ce23ca052 100644 --- a/example-app/SantokuApp/prebuild/prod/android/settings.gradle +++ b/example-app/SantokuApp/prebuild/prod/android/settings.gradle @@ -8,10 +8,3 @@ applyNativeModulesSettingsGradle(settings) include ':app' includeBuild(new File(["node", "--print", "require.resolve('react-native-gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile()) - -if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") { - include(":ReactAndroid") - project(":ReactAndroid").projectDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../ReactAndroid"); - include(":ReactAndroid:hermes-engine") - project(":ReactAndroid:hermes-engine").projectDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../ReactAndroid/hermes-engine"); -} diff --git a/example-app/SantokuApp/prebuild/prod/ios/Podfile b/example-app/SantokuApp/prebuild/prod/ios/Podfile index 26b440688c..c353449106 100644 --- a/example-app/SantokuApp/prebuild/prod/ios/Podfile +++ b/example-app/SantokuApp/prebuild/prod/ios/Podfile @@ -5,34 +5,63 @@ require File.join(File.dirname(`node --print "require.resolve('@react-native-com require 'json' podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {} +ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0' +ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = '1' if podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR'] == 'true' + platform :ios, podfile_properties['ios.deploymentTarget'] || '13.0' install! 'cocoapods', :deterministic_uuids => false +prepare_react_native_project! + +# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set. +# because `react-native-flipper` depends on (FlipperKit,...), which will be excluded. To fix this, +# you can also exclude `react-native-flipper` in `react-native.config.js` +# +# ```js +# module.exports = { +# dependencies: { +# ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), +# } +# } +# ``` +flipper_config = FlipperConfiguration.disabled +if ENV['NO_FLIPPER'] == '1' then + # Explicitly disabled through environment variables + flipper_config = FlipperConfiguration.disabled +elsif podfile_properties.key?('ios.flipper') then + # Configure Flipper in Podfile.properties.json + if podfile_properties['ios.flipper'] == 'true' then + flipper_config = FlipperConfiguration.enabled(["Debug", "Release"]) + elsif podfile_properties['ios.flipper'] != 'false' then + flipper_config = FlipperConfiguration.enabled(["Debug", "Release"], { 'Flipper' => podfile_properties['ios.flipper'] }) + end +end + target 'SantokuApp' do use_expo_modules! config = use_native_modules! use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] + use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS'] # Flags change depending on the env values. flags = get_default_flags() use_react_native!( :path => config[:reactNativePath], - :hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes', + :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes', :fabric_enabled => flags[:fabric_enabled], # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/..", - # - # Uncomment to opt-in to using Flipper - # Note that if you have use_frameworks! enabled, Flipper will not work - # :flipper_configuration => !ENV['CI'] ? FlipperConfiguration.enabled : FlipperConfiguration.disabled, + # Note that if you have use_frameworks! enabled, Flipper will not work if enabled + :flipper_configuration => flipper_config ) post_install do |installer| react_native_post_install( installer, + config[:reactNativePath], # Set `mac_catalyst_enabled` to `true` in order to apply patches # necessary for Mac Catalyst builds :mac_catalyst_enabled => false diff --git a/example-app/SantokuApp/prebuild/prod/ios/Podfile.properties.json b/example-app/SantokuApp/prebuild/prod/ios/Podfile.properties.json index 5a6e743184..22161f0eb8 100644 --- a/example-app/SantokuApp/prebuild/prod/ios/Podfile.properties.json +++ b/example-app/SantokuApp/prebuild/prod/ios/Podfile.properties.json @@ -1,4 +1,4 @@ { - "expo.jsEngine": "jsc", + "expo.jsEngine": "hermes", "ios.useFrameworks": "static" } diff --git a/example-app/SantokuApp/prebuild/prod/ios/SantokuApp.xcodeproj/project.pbxproj b/example-app/SantokuApp/prebuild/prod/ios/SantokuApp.xcodeproj/project.pbxproj index d5b0ddcf14..d5171ec5cf 100644 --- a/example-app/SantokuApp/prebuild/prod/ios/SantokuApp.xcodeproj/project.pbxproj +++ b/example-app/SantokuApp/prebuild/prod/ios/SantokuApp.xcodeproj/project.pbxproj @@ -14,12 +14,12 @@ 96905EF65AED1B983A6B3ABC /* libPods-SantokuApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58EEBF8E8E6FB1BC6CAF49B5 /* libPods-SantokuApp.a */; }; B18059E884C0ABDD17F3DC3D /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */; }; BB2F792D24A3F905000567C9 /* Expo.plist in Resources */ = {isa = PBXBuildFile; fileRef = BB2F792C24A3F905000567C9 /* Expo.plist */; }; - F0EB33D5CEB642529CA1A6FB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F7FAD74748A545DDB629076B /* InfoPlist.strings */; }; - F4763079800D4BE89FE96102 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1822A7FB00D14535AA83E68E /* InfoPlist.strings */; }; - 04856851765747B88885795D /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4FE6816F2685497FB59F127A /* GoogleService-Info.plist */; }; - 8820544EC5044C6EA6136E95 /* noop-file.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690B859CC28B45CA9C7A1321 /* noop-file.swift */; }; - B05AF8C69D9B489BBD406D1B /* RCTThrowErrorModule.h in Resources */ = {isa = PBXBuildFile; fileRef = 9C30268C8FEC40BC8B9B86CF /* RCTThrowErrorModule.h */; }; - 102D990D053C401BA0F8CCF8 /* RCTThrowErrorModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C4C38D42D0348C9BF3A9B3A /* RCTThrowErrorModule.m */; }; + 96E376B2A92041219ED60834 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = AFFB5479F617407D8B970884 /* InfoPlist.strings */; }; + 2D0C57E7AFFB431EB2E41F51 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 02987C8EC66849C3A922F99A /* InfoPlist.strings */; }; + 206D839DE8BC413B8138A052 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 5FE293C2047B49A29EEADFD2 /* GoogleService-Info.plist */; }; + EE70C03FF67F4A5EB5FCB370 /* noop-file.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37955FB710434818A7428481 /* noop-file.swift */; }; + AF21B20C03294D058329AA55 /* RCTThrowErrorModule.h in Resources */ = {isa = PBXBuildFile; fileRef = 398D0B58CB4A4F088C0597CA /* RCTThrowErrorModule.h */; }; + 27BCD27079664DD59DB29965 /* RCTThrowErrorModule.m in Sources */ = {isa = PBXBuildFile; fileRef = A463EDB4B7854DA5962CB4FA /* RCTThrowErrorModule.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -37,12 +37,12 @@ BB2F792C24A3F905000567C9 /* Expo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expo.plist; sourceTree = ""; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-SantokuApp/ExpoModulesProvider.swift"; sourceTree = ""; }; - F7FAD74748A545DDB629076B /* InfoPlist.strings */ = {isa = PBXFileReference; name = "InfoPlist.strings"; path = "ja.lproj/InfoPlist.strings"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = text.plist.strings; explicitFileType = undefined; includeInIndex = 0; }; - 1822A7FB00D14535AA83E68E /* InfoPlist.strings */ = {isa = PBXFileReference; name = "InfoPlist.strings"; path = "en.lproj/InfoPlist.strings"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = text.plist.strings; explicitFileType = undefined; includeInIndex = 0; }; - 4FE6816F2685497FB59F127A /* GoogleService-Info.plist */ = {isa = PBXFileReference; name = "GoogleService-Info.plist"; path = "SantokuApp/GoogleService-Info.plist"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = text.plist.xml; explicitFileType = undefined; includeInIndex = 0; }; - 690B859CC28B45CA9C7A1321 /* noop-file.swift */ = {isa = PBXFileReference; name = "noop-file.swift"; path = "SantokuApp/noop-file.swift"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = sourcecode.swift; explicitFileType = undefined; includeInIndex = 0; }; - 9C30268C8FEC40BC8B9B86CF /* RCTThrowErrorModule.h */ = {isa = PBXFileReference; name = "RCTThrowErrorModule.h"; path = "SantokuApp/RCTThrowErrorModule.h"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; - 3C4C38D42D0348C9BF3A9B3A /* RCTThrowErrorModule.m */ = {isa = PBXFileReference; name = "RCTThrowErrorModule.m"; path = "SantokuApp/RCTThrowErrorModule.m"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + AFFB5479F617407D8B970884 /* InfoPlist.strings */ = {isa = PBXFileReference; name = "InfoPlist.strings"; path = "ja.lproj/InfoPlist.strings"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = text.plist.strings; explicitFileType = undefined; includeInIndex = 0; }; + 02987C8EC66849C3A922F99A /* InfoPlist.strings */ = {isa = PBXFileReference; name = "InfoPlist.strings"; path = "en.lproj/InfoPlist.strings"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = text.plist.strings; explicitFileType = undefined; includeInIndex = 0; }; + 5FE293C2047B49A29EEADFD2 /* GoogleService-Info.plist */ = {isa = PBXFileReference; name = "GoogleService-Info.plist"; path = "SantokuApp/GoogleService-Info.plist"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = text.plist.xml; explicitFileType = undefined; includeInIndex = 0; }; + 37955FB710434818A7428481 /* noop-file.swift */ = {isa = PBXFileReference; name = "noop-file.swift"; path = "SantokuApp/noop-file.swift"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = sourcecode.swift; explicitFileType = undefined; includeInIndex = 0; }; + 398D0B58CB4A4F088C0597CA /* RCTThrowErrorModule.h */ = {isa = PBXFileReference; name = "RCTThrowErrorModule.h"; path = "SantokuApp/RCTThrowErrorModule.h"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + A463EDB4B7854DA5962CB4FA /* RCTThrowErrorModule.m */ = {isa = PBXFileReference; name = "RCTThrowErrorModule.m"; path = "SantokuApp/RCTThrowErrorModule.m"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -68,10 +68,10 @@ 13B07FB61A68108700A75B9A /* Info.plist */, 13B07FB71A68108700A75B9A /* main.m */, AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */, - 4FE6816F2685497FB59F127A /* GoogleService-Info.plist */, - 690B859CC28B45CA9C7A1321 /* noop-file.swift */, - 9C30268C8FEC40BC8B9B86CF /* RCTThrowErrorModule.h */, - 3C4C38D42D0348C9BF3A9B3A /* RCTThrowErrorModule.m */, + 5FE293C2047B49A29EEADFD2 /* GoogleService-Info.plist */, + 37955FB710434818A7428481 /* noop-file.swift */, + 398D0B58CB4A4F088C0597CA /* RCTThrowErrorModule.h */, + A463EDB4B7854DA5962CB4FA /* RCTThrowErrorModule.m */, ); name = SantokuApp; sourceTree = ""; @@ -127,8 +127,8 @@ isa = PBXGroup; children = ( BB2F792C24A3F905000567C9 /* Expo.plist */, - ED100B591CAB4B49BC643444 /* ja.lproj */, - D6790BE41C2247AC842CC80C /* en.lproj */, + 087DDEA008EC44AFAE580FD7 /* ja.lproj */, + BEDBFF0D5687415983778AD6 /* en.lproj */, ); name = Supporting; path = SantokuApp/Supporting; @@ -151,19 +151,19 @@ name = ExpoModulesProviders; sourceTree = ""; }; - ED100B591CAB4B49BC643444 /* ja.lproj */ = { + 087DDEA008EC44AFAE580FD7 /* ja.lproj */ = { isa = "PBXGroup"; children = ( - F7FAD74748A545DDB629076B /* InfoPlist.strings */, + AFFB5479F617407D8B970884 /* InfoPlist.strings */, ); name = ja.lproj; sourceTree = ""; path = ""; }; - D6790BE41C2247AC842CC80C /* en.lproj */ = { + BEDBFF0D5687415983778AD6 /* en.lproj */ = { isa = "PBXGroup"; children = ( - 1822A7FB00D14535AA83E68E /* InfoPlist.strings */, + 02987C8EC66849C3A922F99A /* InfoPlist.strings */, ); name = en.lproj; sourceTree = ""; @@ -232,9 +232,9 @@ BB2F792D24A3F905000567C9 /* Expo.plist in Resources */, 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */, - F0EB33D5CEB642529CA1A6FB /* InfoPlist.strings in Resources */, - F4763079800D4BE89FE96102 /* InfoPlist.strings in Resources */, - 04856851765747B88885795D /* GoogleService-Info.plist in Resources */, + 96E376B2A92041219ED60834 /* InfoPlist.strings in Resources */, + 2D0C57E7AFFB431EB2E41F51 /* InfoPlist.strings in Resources */, + 206D839DE8BC413B8138A052 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -328,9 +328,9 @@ 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */, 13B07FC11A68108700A75B9A /* main.m in Sources */, B18059E884C0ABDD17F3DC3D /* ExpoModulesProvider.swift in Sources */, - 8820544EC5044C6EA6136E95 /* noop-file.swift in Sources */, - B05AF8C69D9B489BBD406D1B /* RCTThrowErrorModule.h in Resources */, - 102D990D053C401BA0F8CCF8 /* RCTThrowErrorModule.m in Sources */, + EE70C03FF67F4A5EB5FCB370 /* noop-file.swift in Sources */, + AF21B20C03294D058329AA55 /* RCTThrowErrorModule.h in Resources */, + 27BCD27079664DD59DB29965 /* RCTThrowErrorModule.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -352,6 +352,7 @@ INFOPLIST_FILE = SantokuApp/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MARKETING_VERSION = 1.0; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -380,6 +381,7 @@ INFOPLIST_FILE = SantokuApp/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MARKETING_VERSION = 1.0; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", diff --git a/example-app/SantokuApp/prebuild/prod/ios/SantokuApp/AppDelegate.h b/example-app/SantokuApp/prebuild/prod/ios/SantokuApp/AppDelegate.h index f7d2972042..1658a437eb 100644 --- a/example-app/SantokuApp/prebuild/prod/ios/SantokuApp/AppDelegate.h +++ b/example-app/SantokuApp/prebuild/prod/ios/SantokuApp/AppDelegate.h @@ -1,9 +1,7 @@ -#import -#import +#import #import - #import -@interface AppDelegate : EXAppDelegateWrapper +@interface AppDelegate : EXAppDelegateWrapper @end diff --git a/example-app/SantokuApp/prebuild/prod/ios/SantokuApp/AppDelegate.mm b/example-app/SantokuApp/prebuild/prod/ios/SantokuApp/AppDelegate.mm index 644c1f38e3..c0ca612a2c 100644 --- a/example-app/SantokuApp/prebuild/prod/ios/SantokuApp/AppDelegate.mm +++ b/example-app/SantokuApp/prebuild/prod/ios/SantokuApp/AppDelegate.mm @@ -1,104 +1,44 @@ #import "AppDelegate.h" #import -#import #import -#import #import -#import - -#import - -#if RCT_NEW_ARCH_ENABLED -#import -#import -#import -#import -#import -#import - -#import - -static NSString *const kRNConcurrentRoot = @"concurrentRoot"; - -@interface AppDelegate () { - RCTTurboModuleManager *_turboModuleManager; - RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; - std::shared_ptr _reactNativeConfig; - facebook::react::ContextContainer::Shared _contextContainer; -} -@end -#endif @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - RCTAppSetupPrepareApp(application); - -// @generated begin @react-native-firebase/app-didFinishLaunchingWithOptions - expo prebuild (DO NOT MODIFY) sync-ecd111c37e49fdd1ed6354203cd6b1e2a38cccda +// @generated begin @react-native-firebase/app-didFinishLaunchingWithOptions-fallback - expo prebuild (DO NOT MODIFY) sync-ecd111c37e49fdd1ed6354203cd6b1e2a38cccda [FIRApp configure]; -// @generated end @react-native-firebase/app-didFinishLaunchingWithOptions - RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions]; - -#if RCT_NEW_ARCH_ENABLED - _contextContainer = std::make_shared(); - _reactNativeConfig = std::make_shared(); - _contextContainer->insert("ReactNativeConfig", _reactNativeConfig); - _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer]; - bridge.surfacePresenter = _bridgeAdapter.surfacePresenter; -#endif - - NSDictionary *initProps = [self prepareInitialProps]; - UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:initProps]; - - rootView.backgroundColor = [UIColor whiteColor]; - self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [self.reactDelegate createRootViewController]; - rootViewController.view = rootView; - self.window.rootViewController = rootViewController; - [self.window makeKeyAndVisible]; +// @generated end @react-native-firebase/app-didFinishLaunchingWithOptions-fallback + self.moduleName = @"main"; - [super application:application didFinishLaunchingWithOptions:launchOptions]; + // You can add your custom initial props in the dictionary below. + // They will be passed down to the ViewController used by React Native. + self.initialProps = @{}; - return YES; + return [super application:application didFinishLaunchingWithOptions:launchOptions]; } -- (NSArray> *)extraModulesForBridge:(RCTBridge *)bridge +- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { - // If you'd like to export some custom RCTBridgeModules, add them here! - return @[]; +#if DEBUG + return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; +#else + return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; +#endif } /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off. /// /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture). -/// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`. +/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`. - (BOOL)concurrentRootEnabled { - // Switch this bool to turn on and off the concurrent root return true; } -- (NSDictionary *)prepareInitialProps -{ - NSMutableDictionary *initProps = [NSMutableDictionary new]; -#if RCT_NEW_ARCH_ENABLED - initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]); -#endif - return initProps; -} - -- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge -{ -#if DEBUG - return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; -#else - return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; -#endif -} - // Linking API - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options]; @@ -128,43 +68,4 @@ - (void)application:(UIApplication *)application didReceiveRemoteNotification:(N return [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; } -#if RCT_NEW_ARCH_ENABLED - -#pragma mark - RCTCxxBridgeDelegate - -- (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge -{ - _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge - delegate:self - jsInvoker:bridge.jsCallInvoker]; - return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager); -} - -#pragma mark RCTTurboModuleManagerDelegate - -- (Class)getModuleClassFromName:(const char *)name -{ - return RCTCoreModulesClassProvider(name); -} - -- (std::shared_ptr)getTurboModule:(const std::string &)name - jsInvoker:(std::shared_ptr)jsInvoker -{ - return nullptr; -} - -- (std::shared_ptr)getTurboModule:(const std::string &)name - initParams: - (const facebook::react::ObjCTurboModule::InitParams &)params -{ - return nullptr; -} - -- (id)getModuleInstanceFromClass:(Class)moduleClass -{ - return RCTAppSetupDefaultModuleFromClass(moduleClass); -} - -#endif - @end diff --git a/example-app/SantokuApp/prebuild/prod/ios/SantokuApp/Supporting/Expo.plist b/example-app/SantokuApp/prebuild/prod/ios/SantokuApp/Supporting/Expo.plist index 3ecefd511b..abe7790f4b 100644 --- a/example-app/SantokuApp/prebuild/prod/ios/SantokuApp/Supporting/Expo.plist +++ b/example-app/SantokuApp/prebuild/prod/ios/SantokuApp/Supporting/Expo.plist @@ -9,7 +9,7 @@ EXUpdatesLaunchWaitMs 0 EXUpdatesSDKVersion - 47.0.0 + 48.0.0 EXUpdatesURL https://exp.host/@anonymous/santoku-app