mirror of
				https://github.com/tooot-app/app
				synced 2025-06-05 22:19:13 +02:00 
			
		
		
		
	Build passed
This commit is contained in:
		@@ -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 = "com.xmflsct.app.tooot",
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
android_resource(
 | 
			
		||||
    name = "res",
 | 
			
		||||
    package = "com.xmflsct.app.tooot",
 | 
			
		||||
    res = "src/main/res",
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
android_binary(
 | 
			
		||||
    name = "app",
 | 
			
		||||
    keystore = "//android/keystores:debug",
 | 
			
		||||
    manifest = "src/main/AndroidManifest.xml",
 | 
			
		||||
    package_type = "debug",
 | 
			
		||||
    deps = [
 | 
			
		||||
        ":app-code",
 | 
			
		||||
    ],
 | 
			
		||||
)
 | 
			
		||||
@@ -1,129 +1,86 @@
 | 
			
		||||
apply plugin: "com.android.application"
 | 
			
		||||
apply plugin: "com.facebook.react"
 | 
			
		||||
apply plugin: 'com.google.gms.google-services'
 | 
			
		||||
 | 
			
		||||
import com.android.build.OutputFile
 | 
			
		||||
import org.apache.tools.ant.taskdefs.condition.Os
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 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: []
 | 
			
		||||
 * ]
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
project.ext.react = [
 | 
			
		||||
    enableHermes: true,
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
apply from: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute().text.trim(), "../react.gradle")
 | 
			
		||||
react {
 | 
			
		||||
    /* 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"]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 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 = false
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 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 mirrored 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", true);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 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")
 | 
			
		||||
@@ -140,69 +97,13 @@ android {
 | 
			
		||||
        targetCompatibility JavaVersion.VERSION_1_8
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    namespace "com.xmflsct.app.tooot"
 | 
			
		||||
    defaultConfig {
 | 
			
		||||
        applicationId 'com.xmflsct.app.tooot'
 | 
			
		||||
        minSdkVersion rootProject.ext.minSdkVersion
 | 
			
		||||
        targetSdkVersion rootProject.ext.targetSdkVersion
 | 
			
		||||
        versionCode 50
 | 
			
		||||
        versionName "0.2"
 | 
			
		||||
        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=$rootDir/../node_modules/react-native/ReactAndroid",
 | 
			
		||||
                        "-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/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 {
 | 
			
		||||
        abi {
 | 
			
		||||
@@ -232,7 +133,6 @@ android {
 | 
			
		||||
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    namespace 'com.xmflsct.app.tooot'
 | 
			
		||||
 | 
			
		||||
    // applicationVariants are e.g. debug, release
 | 
			
		||||
    applicationVariants.all { variant ->
 | 
			
		||||
@@ -255,10 +155,6 @@ dependencies {
 | 
			
		||||
        force = true
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    implementation fileTree(dir: "libs", include: ["*.jar"])
 | 
			
		||||
    //noinspection GradleDynamicVersion
 | 
			
		||||
    implementation "com.facebook.react:react-native:+"  // From node_modules
 | 
			
		||||
 | 
			
		||||
    def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
 | 
			
		||||
    def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
 | 
			
		||||
    def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
 | 
			
		||||
@@ -284,58 +180,21 @@ dependencies {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
 | 
			
		||||
    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
 | 
			
		||||
      exclude group:'com.facebook.fbjni'
 | 
			
		||||
    }
 | 
			
		||||
    // The version of react-native is set by the React Native Gradle Plugin
 | 
			
		||||
    implementation("com.facebook.react:react-android")
 | 
			
		||||
    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'
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (enableHermes) {
 | 
			
		||||
        //noinspection GradleDynamicVersion
 | 
			
		||||
        implementation("com.facebook.react:hermes-engine:+") { // From node_modules
 | 
			
		||||
            exclude group:'com.facebook.fbjni'
 | 
			
		||||
        }
 | 
			
		||||
    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
 | 
			
		||||
    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 transitive 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().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"
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
        )
 | 
			
		||||
@@ -17,7 +17,6 @@ import com.facebook.flipper.plugins.inspector.DescriptorMapping;
 | 
			
		||||
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;
 | 
			
		||||
@@ -25,12 +24,15 @@ 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());
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,4 @@
 | 
			
		||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
  xmlns:tools="http://schemas.android.com/tools"
 | 
			
		||||
  package="com.xmflsct.app.tooot">
 | 
			
		||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
 | 
			
		||||
  <uses-permission android:name="android.permission.INTERNET"/>
 | 
			
		||||
  <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
 | 
			
		||||
  <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,8 @@ import android.os.Bundle;
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
@@ -23,31 +24,19 @@ public class MainActivity extends ReactActivity {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 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, new MainActivityDelegate(this, getMainComponentName()));
 | 
			
		||||
  }
 | 
			
		||||
  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;
 | 
			
		||||
    }
 | 
			
		||||
    return 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
 | 
			
		||||
        );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,23 +1,20 @@
 | 
			
		||||
package com.xmflsct.app.tooot;
 | 
			
		||||
 | 
			
		||||
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.shell.MainReactPackage;
 | 
			
		||||
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
 | 
			
		||||
import com.facebook.react.defaults.DefaultReactNativeHost;
 | 
			
		||||
import com.facebook.soloader.SoLoader;
 | 
			
		||||
 | 
			
		||||
import expo.modules.ApplicationLifecycleDispatcher;
 | 
			
		||||
import expo.modules.ReactNativeHostWrapper;
 | 
			
		||||
 | 
			
		||||
import java.lang.reflect.InvocationTargetException;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.facebook.react.bridge.JSIModulePackage; // <- react-native-reanimated-v2
 | 
			
		||||
@@ -26,7 +23,7 @@ import com.swmansion.reanimated.ReanimatedJSIModulePackage; // <- react-native-r
 | 
			
		||||
public class MainApplication extends Application implements ReactApplication {
 | 
			
		||||
  private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper(
 | 
			
		||||
    this,
 | 
			
		||||
    new ReactNativeHost(this) {
 | 
			
		||||
    new DefaultReactNativeHost(this) {
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean getUseDeveloperSupport() {
 | 
			
		||||
      return BuildConfig.DEBUG;
 | 
			
		||||
@@ -46,6 +43,15 @@ public class MainApplication extends Application implements ReactApplication {
 | 
			
		||||
      return "index";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected boolean isNewArchEnabled() {
 | 
			
		||||
      return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
 | 
			
		||||
    }
 | 
			
		||||
    @Override
 | 
			
		||||
    protected Boolean isHermesEnabled() {
 | 
			
		||||
      return BuildConfig.IS_HERMES_ENABLED;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override // <- react-native-reanimated-v2
 | 
			
		||||
    protected JSIModulePackage getJSIModulePackage() {
 | 
			
		||||
      return new ReanimatedJSIModulePackage();
 | 
			
		||||
@@ -54,59 +60,18 @@ public class MainApplication extends Application implements ReactApplication {
 | 
			
		||||
 | 
			
		||||
  @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());
 | 
			
		||||
    ApplicationLifecycleDispatcher.onApplicationCreate(this);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  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("com.xmflsct.app.tooot.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();
 | 
			
		||||
      }
 | 
			
		||||
    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());
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,20 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 *
 | 
			
		||||
 * <p>This source code is licensed under the MIT license found in the LICENSE file in the root
 | 
			
		||||
 * directory of this source tree.
 | 
			
		||||
 */
 | 
			
		||||
package com.rndiffapp;
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user