diff --git a/.detoxrc.json b/.detoxrc.json new file mode 100644 index 000000000..e4c802c14 --- /dev/null +++ b/.detoxrc.json @@ -0,0 +1,37 @@ +{ + "testRunner": "jest", + "runnerConfig": "e2e/config.json", + "skipLegacyWorkersInjection": true, + "devices": { + "simulator": { + "type": "ios.simulator", + "device": { + "type": "iPhone 12 Pro Max" + } + } + }, + "apps": { + "ios.release": { + "name": "RNNotifications", + "type": "ios.app", + "binaryPath": "example/ios/DerivedData/NotificationsExampleApp/Build/Products/Release-iphonesimulator/NotificationsExampleApp.app", + "build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme NotificationsExampleApp_release -workspace example/ios/NotificationsExampleApp.xcworkspace -sdk iphonesimulator -configuration Release -derivedDataPath example/ios/DerivedData/NotificationsExampleApp ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO" + }, + "ios.debug": { + "name": "RNNotificationsDebug", + "type": "ios.app", + "binaryPath": "example/ios/DerivedData/NotificationsExampleApp/Build/Products/Debug-iphonesimulator/NotificationsExampleApp.app", + "build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme NotificationsExampleApp -workspace example/ios/NotificationsExampleApp.xcworkspace -sdk iphonesimulator -configuration Debug -derivedDataPath example/ios/DerivedData/NotificationsExampleApp ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO" + } + }, + "configurations": { + "ios.sim.release": { + "device": "simulator", + "app": "ios.release" + }, + "ios.sim.debug": { + "device": "simulator", + "app": "ios.debug" + } + } +} \ No newline at end of file diff --git a/e2e/Notifications.test.js b/e2e/Notifications.test.js index 09881409d..6bbf8107f 100644 --- a/e2e/Notifications.test.js +++ b/e2e/Notifications.test.js @@ -3,7 +3,7 @@ const {elementByLabel} = Utils; describe('Notifications', () => { beforeEach(async () => { - await device.relaunchApp({delete: true, permissions: {notifications: 'YES'}}); + await device.launchApp({delete: true, permissions: {notifications: 'YES'}}); }); describe('Foreground', () => { diff --git a/e2e/config.json b/e2e/config.json index 4dac170d3..1769825ad 100644 --- a/e2e/config.json +++ b/e2e/config.json @@ -1,6 +1,8 @@ { - "setupTestFrameworkScriptFile" : "./init.js", - "testEnvironment": "node", - "bail": true, + "maxWorkers": 1, + "testEnvironment": "./environment", + "testRunner": "jest-circus/runner", + "testTimeout": 120000, + "reporters": ["detox/runners/jest/streamlineReporter"], "verbose": true } diff --git a/e2e/environment.js b/e2e/environment.js new file mode 100644 index 000000000..7f4fc942f --- /dev/null +++ b/e2e/environment.js @@ -0,0 +1,23 @@ +const { + DetoxCircusEnvironment, + SpecReporter, + WorkerAssignReporter, +} = require('detox/runners/jest-circus'); + +class CustomDetoxEnvironment extends DetoxCircusEnvironment { + constructor(config, context) { + super(config, context); + + // Can be safely removed, if you are content with the default value (=300000ms) + this.initTimeout = 300000; + + // This takes care of generating status logs on a per-spec basis. By default, Jest only reports at file-level. + // This is strictly optional. + this.registerListeners({ + SpecReporter, + WorkerAssignReporter, + }); + } +} + +module.exports = CustomDetoxEnvironment; diff --git a/example/android/build.gradle b/example/android/build.gradle index edaa8977a..59288b7e9 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -2,8 +2,19 @@ buildscript { ext { - androidSdkVersion = 30 - androidMinSdkVersion = 21 + buildToolsVersion = "31.0.0" + minSdkVersion = 21 + compileSdkVersion = 31 + targetSdkVersion = 31 + + 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" + } + kotlinVersion = "1.3.61" kotlinStdlib = "kotlin-stdlib-jdk8" detoxKotlinVersion = kotlinVersion @@ -13,9 +24,11 @@ buildscript { mavenCentral() } dependencies { - classpath "com.android.tools.build:gradle:4.2.2" - classpath "com.google.gms:google-services:4.3.3" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" + classpath("com.android.tools.build:gradle:7.0.4") + classpath("com.facebook.react:react-native-gradle-plugin") + classpath("de.undercouch:gradle-download-task:4.1.2") + classpath("com.google.gms:google-services:4.3.3") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") } } diff --git a/example/android/gradle.properties b/example/android/gradle.properties index ccb748f58..ffe919e4f 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -10,12 +10,26 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true +org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true -android.enableJetifier=true \ No newline at end of file +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true + +# Version of flipper SDK to use with React Native +FLIPPER_VERSION=0.125.0 + +# Use this property to specify which architecture you want to build. +# You can also override it from the CLI using +# ./gradlew -PreactNativeArchitectures=x86_64 + +reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 +# Use this property to enable support to the new architecture. +# This will allow you to use TurboModules and the Fabric render in +# your application. You should enable this flag either if you want +# to write custom TurboModules/Fabric components OR use libraries that +# are providing them. +newArchEnabled=false \ No newline at end of file diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 966aa8e62..f338a8808 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip diff --git a/example/android/myapplication/build.gradle b/example/android/myapplication/build.gradle index d20c48f28..b7b7bcd17 100644 --- a/example/android/myapplication/build.gradle +++ b/example/android/myapplication/build.gradle @@ -1,62 +1,325 @@ apply plugin: "com.android.application" -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' + +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: [] + * ] + */ project.ext.react = [ - root : "../../../", - entryFile : "index.js", - cliPath : "node_modules/react-native/cli.js", - bundleAssetName: "index.bundle", - enableHermes : true, - bundleInAlpha : true, - bundleInBeta : true, - hermesFlagsDebug:['-Xes6-proxy','-output-source-map'], - hermesFlagsRelease:['-output-source-map'], - hermesCommand: "../../../node_modules/hermes-engine/%OS-BIN%/hermesc", + cliPath : "../../../node_modules/react-native/cli.js", + enableHermes: false, // clean and rebuild if changing ] apply from: "../../../node_modules/react-native/react.gradle" +/** + * 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. + */ +def enableSeparateBuildPerCPUArchitecture = false + +/** + * Run Proguard to shrink the Java bytecode in release builds. + */ +def enableProguardInReleaseBuilds = false + +/** + * The preferred build flavor of JavaScriptCore. + * + * 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 + * 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. + */ +def reactNativeArchitectures() { + def value = project.getProperties().get("reactNativeArchitectures") + return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] +} + android { - ndkVersion "20.1.5948944" + ndkVersion rootProject.ext.ndkVersion - compileSdkVersion androidSdkVersion + compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { applicationId "com.wix.reactnativenotifications.app" - minSdkVersion androidMinSdkVersion - targetSdkVersion androidSdkVersion + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" + buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() - ndk { - abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' + if (isNewArchitectureEnabled()) { + // We configure the NDK build only if you decide to opt-in for the New Architecture. + externalNativeBuild { + ndkBuild { + arguments "APP_PLATFORM=android-21", + "APP_STL=c++_shared", + "NDK_TOOLCHAIN_VERSION=clang", + "GENERATED_SRC_DIR=$buildDir/generated/source", + "PROJECT_BUILD_DIR=$buildDir", + "REACT_ANDROID_DIR=$rootDir/../../node_modules/react-native/ReactAndroid", + "REACT_ANDROID_BUILD_DIR=$rootDir/../../node_modules/react-native/ReactAndroid/build" + cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1" + cppFlags "-std=c++17" + // Make sure this target name is the same you specify inside the + // src/main/jni/Android.mk file for the `LOCAL_MODULE` variable. + targets "rn_68_appmodules" + // Fix for windows limit on number of character in file paths and in command lines + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + arguments "NDK_APP_SHORT_COMMANDS=true" + } + } + } + if (!enableSeparateBuildPerCPUArchitecture) { + ndk { + abiFilters (*reactNativeArchitectures()) + } + } + } + } + + if (isNewArchitectureEnabled()) { + // We configure the NDK build only if you decide to opt-in for the New Architecture. + externalNativeBuild { + ndkBuild { + path "$projectDir/src/main/jni/Android.mk" + } + } + 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 configureNdkBuild* tasks and the preBuild tasks. + // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732 + configureNdkBuildRelease.dependsOn(preReleaseBuild) + configureNdkBuildDebug.dependsOn(preDebugBuild) + reactNativeArchitectures().each { architecture -> + tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure { + dependsOn("preDebugBuild") + } + tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure { + dependsOn("preReleaseBuild") + } + } + } + } + + splits { + abi { + reset() + enable enableSeparateBuildPerCPUArchitecture + universalApk false // If true, also generate a universal APK + include (*reactNativeArchitectures()) + } + } + signingConfigs { + debug { + storeFile file('debug.keystore') + storePassword 'android' + keyAlias 'androiddebugkey' + keyPassword 'android' } } buildTypes { + debug { + signingConfig signingConfigs.debug + } release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + // Caution! In production, you need to generate your own keystore file. + // see https://reactnative.dev/docs/signed-apk-android. + signingConfig signingConfigs.debug + minifyEnabled enableProguardInReleaseBuilds + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + + // applicationVariants are e.g. debug, release + applicationVariants.all { variant -> + 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 = + defaultConfig.versionCode * 1000 + versionCodes.get(abi) + } + + } } } - dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation fileTree(dir: "libs", include: ["*.jar"]) + //noinspection GradleDynamicVersion - implementation "com.facebook.react:react-native:+" + implementation "com.facebook.react:react-native:+" // From node_modules + + implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" + + debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { + exclude group:'com.facebook.fbjni' + } + + 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) { + def hermesPath = "../../../node_modules/hermes-engine/android/"; + debugImplementation files(hermesPath + "hermes-debug.aar") + releaseImplementation files(hermesPath + "hermes-release.aar") + } else { + implementation jscFlavor + } - def hermesPath = "../../../node_modules/hermes-engine/android/"; - debugImplementation files(hermesPath + "hermes-debug.aar") - releaseImplementation files(hermesPath + "hermes-release.aar") - implementation "org.jetbrains.kotlin:$kotlinStdlib:$kotlinVersion" - implementation "androidx.appcompat:appcompat:1.0.0" implementation project(':react-native-notifications') } +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") + } + } +} + +// 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: file("../../../node_modules/@react-native-community/cli-platform-android/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" +} + + apply plugin: 'com.google.gms.google-services' diff --git a/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainActivity.java b/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainActivity.java index af9e6dca8..cf4c30398 100644 --- a/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainActivity.java +++ b/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainActivity.java @@ -1,10 +1,35 @@ package com.wix.reactnativenotifications.app; import com.facebook.react.ReactActivity; +import com.facebook.react.ReactActivityDelegate; +import com.facebook.react.ReactRootView; public class MainActivity extends ReactActivity { @Override protected String getMainComponentName() { return "NotificationsExampleApp"; } + + /** + * Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and + * you can specify the rendered you wish to use (Fabric or the older renderer). + */ + @Override + protected ReactActivityDelegate createReactActivityDelegate() { + return 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; + } + } } diff --git a/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainApplication.java b/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainApplication.java index 021e42a17..0bf26f37d 100644 --- a/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainApplication.java +++ b/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainApplication.java @@ -1,13 +1,14 @@ package com.wix.reactnativenotifications.app; import android.app.Application; - import com.facebook.react.ReactApplication; 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.soloader.SoLoader; import com.wix.reactnativenotifications.RNNotificationsPackage; +import com.wix.reactnativenotifications.app.newarchitecture.MainApplicationReactNativeHost; import java.util.Arrays; import java.util.List; @@ -15,8 +16,10 @@ public class MainApplication extends Application implements ReactApplication { @Override public void onCreate() { - super.onCreate(); - SoLoader.init(this, false); + 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, false); } private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @@ -38,9 +41,15 @@ protected String getJSMainModuleName() { return "index"; } }; + private final ReactNativeHost mNewArchitectureNativeHost = + new MainApplicationReactNativeHost(this); @Override public ReactNativeHost getReactNativeHost() { - return mReactNativeHost; + if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { + return mNewArchitectureNativeHost; + } else { + return mReactNativeHost; + } } } diff --git a/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/newarchitecture/MainApplicationReactNativeHost.java b/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/newarchitecture/MainApplicationReactNativeHost.java new file mode 100644 index 000000000..90af51f94 --- /dev/null +++ b/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/newarchitecture/MainApplicationReactNativeHost.java @@ -0,0 +1,116 @@ +package com.wix.reactnativenotifications.app.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.uimanager.ViewManagerRegistry; +import com.wix.reactnativenotifications.app.BuildConfig; +import com.wix.reactnativenotifications.app.newarchitecture.components.MainComponentsRegistry; +import com.wix.reactnativenotifications.app.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, + new EmptyReactNativeConfig(), + viewManagerRegistry); + } + }); + return specs; + } + }; + } +} diff --git a/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/newarchitecture/components/MainComponentsRegistry.java b/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/newarchitecture/components/MainComponentsRegistry.java new file mode 100644 index 000000000..d47da70a7 --- /dev/null +++ b/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/newarchitecture/components/MainComponentsRegistry.java @@ -0,0 +1,36 @@ +package com.wix.reactnativenotifications.app.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/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java b/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java new file mode 100644 index 000000000..10f515f94 --- /dev/null +++ b/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java @@ -0,0 +1,48 @@ +package com.wix.reactnativenotifications.app.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("rn_68_appmodules"); + sIsSoLibraryLoaded = true; + } + } +} diff --git a/example/android/settings.gradle b/example/android/settings.gradle index e5b7932bd..850023eec 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,5 +1,12 @@ rootProject.name = 'NotificationsExampleApp' +apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':myapplication' +includeBuild('../../node_modules/react-native-gradle-plugin') +if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") { + include(":ReactAndroid") + project(":ReactAndroid").projectDir = file('../../node_modules/react-native/ReactAndroid') +} + include ':react-native-notifications' project(':react-native-notifications').projectDir = new File(rootProject.projectDir, '../../lib/android/app') \ No newline at end of file diff --git a/example/ios/NotificationsExampleApp/AppDelegate.m b/example/ios/NotificationsExampleApp/AppDelegate.m index 4204bd318..204171bb5 100644 --- a/example/ios/NotificationsExampleApp/AppDelegate.m +++ b/example/ios/NotificationsExampleApp/AppDelegate.m @@ -11,7 +11,7 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSURL *jsCodeLocation; - jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; + jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"NotificationsExampleApp" diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index f3e32ad81..93a5260c0 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,14 +1,14 @@ PODS: - boost (1.76.0) - DoubleConversion (1.1.6) - - FBLazyVector (0.66.3) - - FBReactNativeSpec (0.66.3): + - FBLazyVector (0.68.1) + - FBReactNativeSpec (0.68.1): - RCT-Folly (= 2021.06.28.00-v2) - - RCTRequired (= 0.66.3) - - RCTTypeSafety (= 0.66.3) - - React-Core (= 0.66.3) - - React-jsi (= 0.66.3) - - ReactCommon/turbomodule/core (= 0.66.3) + - RCTRequired (= 0.68.1) + - RCTTypeSafety (= 0.68.1) + - React-Core (= 0.68.1) + - React-jsi (= 0.68.1) + - ReactCommon/turbomodule/core (= 0.68.1) - fmt (6.2.1) - glog (0.3.5) - OCMock (3.9.1) @@ -23,260 +23,269 @@ PODS: - DoubleConversion - fmt (~> 6.2.1) - glog - - RCTRequired (0.66.3) - - RCTTypeSafety (0.66.3): - - FBLazyVector (= 0.66.3) + - RCTRequired (0.68.1) + - RCTTypeSafety (0.68.1): + - FBLazyVector (= 0.68.1) - RCT-Folly (= 2021.06.28.00-v2) - - RCTRequired (= 0.66.3) - - React-Core (= 0.66.3) - - React (0.66.3): - - React-Core (= 0.66.3) - - React-Core/DevSupport (= 0.66.3) - - React-Core/RCTWebSocket (= 0.66.3) - - React-RCTActionSheet (= 0.66.3) - - React-RCTAnimation (= 0.66.3) - - React-RCTBlob (= 0.66.3) - - React-RCTImage (= 0.66.3) - - React-RCTLinking (= 0.66.3) - - React-RCTNetwork (= 0.66.3) - - React-RCTSettings (= 0.66.3) - - React-RCTText (= 0.66.3) - - React-RCTVibration (= 0.66.3) - - React-callinvoker (0.66.3) - - React-Core (0.66.3): + - RCTRequired (= 0.68.1) + - React-Core (= 0.68.1) + - React (0.68.1): + - React-Core (= 0.68.1) + - React-Core/DevSupport (= 0.68.1) + - React-Core/RCTWebSocket (= 0.68.1) + - React-RCTActionSheet (= 0.68.1) + - React-RCTAnimation (= 0.68.1) + - React-RCTBlob (= 0.68.1) + - React-RCTImage (= 0.68.1) + - React-RCTLinking (= 0.68.1) + - React-RCTNetwork (= 0.68.1) + - React-RCTSettings (= 0.68.1) + - React-RCTText (= 0.68.1) + - React-RCTVibration (= 0.68.1) + - React-callinvoker (0.68.1) + - React-Codegen (0.68.1): + - FBReactNativeSpec (= 0.68.1) + - RCT-Folly (= 2021.06.28.00-v2) + - RCTRequired (= 0.68.1) + - RCTTypeSafety (= 0.68.1) + - React-Core (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - ReactCommon/turbomodule/core (= 0.68.1) + - React-Core (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - - React-Core/Default (= 0.66.3) - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-Core/Default (= 0.68.1) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/CoreModulesHeaders (0.66.3): + - React-Core/CoreModulesHeaders (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/Default (0.66.3): + - React-Core/Default (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/DevSupport (0.66.3): + - React-Core/DevSupport (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - - React-Core/Default (= 0.66.3) - - React-Core/RCTWebSocket (= 0.66.3) - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-jsinspector (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-Core/Default (= 0.68.1) + - React-Core/RCTWebSocket (= 0.68.1) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-jsinspector (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/RCTActionSheetHeaders (0.66.3): + - React-Core/RCTActionSheetHeaders (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/RCTAnimationHeaders (0.66.3): + - React-Core/RCTAnimationHeaders (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/RCTBlobHeaders (0.66.3): + - React-Core/RCTBlobHeaders (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/RCTImageHeaders (0.66.3): + - React-Core/RCTImageHeaders (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/RCTLinkingHeaders (0.66.3): + - React-Core/RCTLinkingHeaders (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/RCTNetworkHeaders (0.66.3): + - React-Core/RCTNetworkHeaders (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/RCTSettingsHeaders (0.66.3): + - React-Core/RCTSettingsHeaders (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/RCTTextHeaders (0.66.3): + - React-Core/RCTTextHeaders (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/RCTVibrationHeaders (0.66.3): + - React-Core/RCTVibrationHeaders (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-Core/RCTWebSocket (0.66.3): + - React-Core/RCTWebSocket (0.68.1): - glog - RCT-Folly (= 2021.06.28.00-v2) - - React-Core/Default (= 0.66.3) - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsiexecutor (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-Core/Default (= 0.68.1) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsiexecutor (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga - - React-CoreModules (0.66.3): - - FBReactNativeSpec (= 0.66.3) + - React-CoreModules (0.68.1): - RCT-Folly (= 2021.06.28.00-v2) - - RCTTypeSafety (= 0.66.3) - - React-Core/CoreModulesHeaders (= 0.66.3) - - React-jsi (= 0.66.3) - - React-RCTImage (= 0.66.3) - - ReactCommon/turbomodule/core (= 0.66.3) - - React-cxxreact (0.66.3): + - RCTTypeSafety (= 0.68.1) + - React-Codegen (= 0.68.1) + - React-Core/CoreModulesHeaders (= 0.68.1) + - React-jsi (= 0.68.1) + - React-RCTImage (= 0.68.1) + - ReactCommon/turbomodule/core (= 0.68.1) + - React-cxxreact (0.68.1): - boost (= 1.76.0) - DoubleConversion - glog - RCT-Folly (= 2021.06.28.00-v2) - - React-callinvoker (= 0.66.3) - - React-jsi (= 0.66.3) - - React-jsinspector (= 0.66.3) - - React-logger (= 0.66.3) - - React-perflogger (= 0.66.3) - - React-runtimeexecutor (= 0.66.3) - - React-jsi (0.66.3): + - React-callinvoker (= 0.68.1) + - React-jsi (= 0.68.1) + - React-jsinspector (= 0.68.1) + - React-logger (= 0.68.1) + - React-perflogger (= 0.68.1) + - React-runtimeexecutor (= 0.68.1) + - React-jsi (0.68.1): - boost (= 1.76.0) - DoubleConversion - glog - RCT-Folly (= 2021.06.28.00-v2) - - React-jsi/Default (= 0.66.3) - - React-jsi/Default (0.66.3): + - React-jsi/Default (= 0.68.1) + - React-jsi/Default (0.68.1): - boost (= 1.76.0) - DoubleConversion - glog - RCT-Folly (= 2021.06.28.00-v2) - - React-jsiexecutor (0.66.3): + - React-jsiexecutor (0.68.1): - DoubleConversion - glog - RCT-Folly (= 2021.06.28.00-v2) - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-perflogger (= 0.66.3) - - React-jsinspector (0.66.3) - - React-logger (0.66.3): + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-perflogger (= 0.68.1) + - React-jsinspector (0.68.1) + - React-logger (0.68.1): - glog - - react-native-notifications (4.1.3): + - react-native-notifications (4.3.1): - React-Core - - React-perflogger (0.66.3) - - React-RCTActionSheet (0.66.3): - - React-Core/RCTActionSheetHeaders (= 0.66.3) - - React-RCTAnimation (0.66.3): - - FBReactNativeSpec (= 0.66.3) + - React-perflogger (0.68.1) + - React-RCTActionSheet (0.68.1): + - React-Core/RCTActionSheetHeaders (= 0.68.1) + - React-RCTAnimation (0.68.1): - RCT-Folly (= 2021.06.28.00-v2) - - RCTTypeSafety (= 0.66.3) - - React-Core/RCTAnimationHeaders (= 0.66.3) - - React-jsi (= 0.66.3) - - ReactCommon/turbomodule/core (= 0.66.3) - - React-RCTBlob (0.66.3): - - FBReactNativeSpec (= 0.66.3) + - RCTTypeSafety (= 0.68.1) + - React-Codegen (= 0.68.1) + - React-Core/RCTAnimationHeaders (= 0.68.1) + - React-jsi (= 0.68.1) + - ReactCommon/turbomodule/core (= 0.68.1) + - React-RCTBlob (0.68.1): - RCT-Folly (= 2021.06.28.00-v2) - - React-Core/RCTBlobHeaders (= 0.66.3) - - React-Core/RCTWebSocket (= 0.66.3) - - React-jsi (= 0.66.3) - - React-RCTNetwork (= 0.66.3) - - ReactCommon/turbomodule/core (= 0.66.3) - - React-RCTImage (0.66.3): - - FBReactNativeSpec (= 0.66.3) + - React-Codegen (= 0.68.1) + - React-Core/RCTBlobHeaders (= 0.68.1) + - React-Core/RCTWebSocket (= 0.68.1) + - React-jsi (= 0.68.1) + - React-RCTNetwork (= 0.68.1) + - ReactCommon/turbomodule/core (= 0.68.1) + - React-RCTImage (0.68.1): - RCT-Folly (= 2021.06.28.00-v2) - - RCTTypeSafety (= 0.66.3) - - React-Core/RCTImageHeaders (= 0.66.3) - - React-jsi (= 0.66.3) - - React-RCTNetwork (= 0.66.3) - - ReactCommon/turbomodule/core (= 0.66.3) - - React-RCTLinking (0.66.3): - - FBReactNativeSpec (= 0.66.3) - - React-Core/RCTLinkingHeaders (= 0.66.3) - - React-jsi (= 0.66.3) - - ReactCommon/turbomodule/core (= 0.66.3) - - React-RCTNetwork (0.66.3): - - FBReactNativeSpec (= 0.66.3) + - RCTTypeSafety (= 0.68.1) + - React-Codegen (= 0.68.1) + - React-Core/RCTImageHeaders (= 0.68.1) + - React-jsi (= 0.68.1) + - React-RCTNetwork (= 0.68.1) + - ReactCommon/turbomodule/core (= 0.68.1) + - React-RCTLinking (0.68.1): + - React-Codegen (= 0.68.1) + - React-Core/RCTLinkingHeaders (= 0.68.1) + - React-jsi (= 0.68.1) + - ReactCommon/turbomodule/core (= 0.68.1) + - React-RCTNetwork (0.68.1): - RCT-Folly (= 2021.06.28.00-v2) - - RCTTypeSafety (= 0.66.3) - - React-Core/RCTNetworkHeaders (= 0.66.3) - - React-jsi (= 0.66.3) - - ReactCommon/turbomodule/core (= 0.66.3) - - React-RCTSettings (0.66.3): - - FBReactNativeSpec (= 0.66.3) + - RCTTypeSafety (= 0.68.1) + - React-Codegen (= 0.68.1) + - React-Core/RCTNetworkHeaders (= 0.68.1) + - React-jsi (= 0.68.1) + - ReactCommon/turbomodule/core (= 0.68.1) + - React-RCTSettings (0.68.1): - RCT-Folly (= 2021.06.28.00-v2) - - RCTTypeSafety (= 0.66.3) - - React-Core/RCTSettingsHeaders (= 0.66.3) - - React-jsi (= 0.66.3) - - ReactCommon/turbomodule/core (= 0.66.3) - - React-RCTText (0.66.3): - - React-Core/RCTTextHeaders (= 0.66.3) - - React-RCTVibration (0.66.3): - - FBReactNativeSpec (= 0.66.3) + - RCTTypeSafety (= 0.68.1) + - React-Codegen (= 0.68.1) + - React-Core/RCTSettingsHeaders (= 0.68.1) + - React-jsi (= 0.68.1) + - ReactCommon/turbomodule/core (= 0.68.1) + - React-RCTText (0.68.1): + - React-Core/RCTTextHeaders (= 0.68.1) + - React-RCTVibration (0.68.1): - RCT-Folly (= 2021.06.28.00-v2) - - React-Core/RCTVibrationHeaders (= 0.66.3) - - React-jsi (= 0.66.3) - - ReactCommon/turbomodule/core (= 0.66.3) - - React-runtimeexecutor (0.66.3): - - React-jsi (= 0.66.3) - - ReactCommon/turbomodule/core (0.66.3): + - React-Codegen (= 0.68.1) + - React-Core/RCTVibrationHeaders (= 0.68.1) + - React-jsi (= 0.68.1) + - ReactCommon/turbomodule/core (= 0.68.1) + - React-runtimeexecutor (0.68.1): + - React-jsi (= 0.68.1) + - ReactCommon/turbomodule/core (0.68.1): - DoubleConversion - glog - RCT-Folly (= 2021.06.28.00-v2) - - React-callinvoker (= 0.66.3) - - React-Core (= 0.66.3) - - React-cxxreact (= 0.66.3) - - React-jsi (= 0.66.3) - - React-logger (= 0.66.3) - - React-perflogger (= 0.66.3) + - React-callinvoker (= 0.68.1) + - React-Core (= 0.68.1) + - React-cxxreact (= 0.68.1) + - React-jsi (= 0.68.1) + - React-logger (= 0.68.1) + - React-perflogger (= 0.68.1) - Yoga (1.14.0) DEPENDENCIES: @@ -291,6 +300,7 @@ DEPENDENCIES: - RCTTypeSafety (from `../../node_modules/react-native/Libraries/TypeSafety`) - React (from `../../node_modules/react-native/`) - React-callinvoker (from `../../node_modules/react-native/ReactCommon/callinvoker`) + - React-Codegen (from `build/generated/ios`) - React-Core (from `../../node_modules/react-native/`) - React-Core/DevSupport (from `../../node_modules/react-native/`) - React-Core/RCTWebSocket (from `../../node_modules/react-native/`) @@ -341,6 +351,8 @@ EXTERNAL SOURCES: :path: "../../node_modules/react-native/" React-callinvoker: :path: "../../node_modules/react-native/ReactCommon/callinvoker" + React-Codegen: + :path: build/generated/ios React-Core: :path: "../../node_modules/react-native/" React-CoreModules: @@ -387,37 +399,38 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost: a7c83b31436843459a1961bfd74b96033dc77234 DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 - FBLazyVector: de148e8310b8b878db304ceea2fec13f2c02e3a0 - FBReactNativeSpec: 6192956c9e346013d5f1809ba049af720b11c6a4 + FBLazyVector: 2c76493a346ef8cacf1f442926a39f805fffec1f + FBReactNativeSpec: 3fc6fbf67b2bc6ab4f1c3fd6a39cbaff17d1007e fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - glog: 5337263514dd6f09803962437687240c5dc39aa4 + glog: 85ecdd10ee8d8ec362ef519a6a45ff9aa27b2e85 OCMock: 9491e4bec59e0b267d52a9184ff5605995e74be8 - RCT-Folly: a21c126816d8025b547704b777a2ba552f3d9fa9 - RCTRequired: 59d2b744d8c2bf2d9bc7032a9f654809adcf7d50 - RCTTypeSafety: d0aaf7ccae5c70a4aaa3a5c3e9e0db97efae760e - React: fbe655dd1d12c052299b61abdc576720098d80fc - React-callinvoker: a535746608d9bc8b1dea7095ed4d8d3d7aae9a05 - React-Core: 008d2638c4f80b189c8e170ff2d241027ec517fd - React-CoreModules: 91c9a03f4e1b74494c087d9c9a29e89a3145c228 - React-cxxreact: 9c462fb6d59f865855e2dee2097c7d87b3d2de49 - React-jsi: 4de8b8d70ba4ed841eb9b772bdb719f176387e21 - React-jsiexecutor: 433a691aee158533a6a6ee9c86cb4a1684fa2853 - React-jsinspector: d9c8eb0b53f0da206fed56612b289fec84991157 - React-logger: e522e76fa3e9ec3e7d7115b49485cc065cf4ae06 - react-native-notifications: 80af69028850631d607374dbd104fb1026f5393f - React-perflogger: 73732888d37d4f5065198727b167846743232882 - React-RCTActionSheet: 96c6d774fa89b1f7c59fc460adc3245ba2d7fd79 - React-RCTAnimation: 8940cfd3a8640bd6f6372150dbdb83a79bcbae6c - React-RCTBlob: e80de5fdf952a4f226a00fc54f3db526809f92f7 - React-RCTImage: f990d6b272c7e89ff864caf0bccfb620ab3ca5d0 - React-RCTLinking: 2280ed0d5ffb78954b484b90228d597b5f941c5f - React-RCTNetwork: 1359fa853c216616e711b810dcb8682a6a8e7564 - React-RCTSettings: 84958860aaa3639f0249e751ea7702c62eb67188 - React-RCTText: 196cf06b8cb6229d8c6dd9fc9057bdf97db5d3fb - React-RCTVibration: 50cfe7049167cfc7e83ac5542c6fff0c76791a9b - React-runtimeexecutor: bbbdb3d8fcf327c6e2249ee71b6ef1764b7dc266 - ReactCommon: 9bac022ab71596f2b0fde1268272543184c63971 - Yoga: 32a18c0e845e185f4a2a66ec76e1fd1f958f22fa + RCT-Folly: 803a9cfd78114b2ec0f140cfa6fa2a6bafb2d685 + RCTRequired: 00581111c53531e39e3c6346ef0d2c0cf52a5a37 + RCTTypeSafety: 07e03ee7800e7dd65cba8e52ad0c2edb06c96604 + React: e61f4bf3c573d0c61c56b53dc3eb1d9daf0768a0 + React-callinvoker: 047d47230bb6fd66827f8cb0bea4e944ffd1309b + React-Codegen: bb0403cde7374af091530e84e492589485aab480 + React-Core: a4a3a8e10d004b08e013c3d0438259dd89a3894c + React-CoreModules: bb9f8bc36f1ae6d780b856927fa9d4aa01ccccc0 + React-cxxreact: 7dd472aefb8629d6080cbb859240bafccd902704 + React-jsi: b25808afe821b607d51c779bdd1717be8393b7ec + React-jsiexecutor: 4a4bae5671b064a2248a690cf75957669489d08c + React-jsinspector: 218a2503198ff28a085f8e16622a8d8f507c8019 + React-logger: f79dd3cc0f9b44f5611c6c7862badd891a862cf8 + react-native-notifications: 33ec77006f7987bb22de8f1665889abc633b9196 + React-perflogger: 30ab8d6db10e175626069e742eead3ebe8f24fd5 + React-RCTActionSheet: 4b45da334a175b24dabe75f856b98fed3dfd6201 + React-RCTAnimation: d6237386cb04500889877845b3e9e9291146bc2e + React-RCTBlob: bc9e2cd738c43bd2948e862e371402ef9584730a + React-RCTImage: 9f8cac465c6e5837007f59ade2a0a741016dd6a3 + React-RCTLinking: 5073abb7d30cc0824b2172bd4582fc15bfc40510 + React-RCTNetwork: 28ff94aa7d8fc117fc800b87dd80869a00d2bef3 + React-RCTSettings: f27aa036f7270fe6ca43f8cdd1819e821fa429a0 + React-RCTText: 7cb6f86fa7bc86f22f16333ad243b158e63b2a68 + React-RCTVibration: 9e344c840176b0af9c84d5019eb4fed8b3c105a1 + React-runtimeexecutor: 7285b499d0339104b2813a1f58ad1ada4adbd6c0 + ReactCommon: bf2888a826ceedf54b99ad1b6182d1bc4a8a3984 + Yoga: 17cd9a50243093b547c1e539c749928dd68152da PODFILE CHECKSUM: 6406485412bd691c219c78894ca02f40bcbd6ba2 diff --git a/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java b/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java index c09024700..850a9839f 100644 --- a/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java +++ b/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java @@ -17,7 +17,6 @@ import com.wix.reactnativenotifications.core.NotificationIntentAdapter; import com.wix.reactnativenotifications.core.notification.IPushNotification; import com.wix.reactnativenotifications.core.notification.PushNotification; -import com.wix.reactnativenotifications.core.notification.PushNotificationProps; import com.wix.reactnativenotifications.core.notificationdrawer.IPushNotificationsDrawer; import com.wix.reactnativenotifications.core.notificationdrawer.PushNotificationsDrawer; @@ -96,8 +95,8 @@ private void callOnOpenedIfNeed(Activity activity) { Intent intent = activity.getIntent(); if (NotificationIntentAdapter.canHandleIntent(intent)) { Context appContext = mApplication.getApplicationContext(); - Bundle notificationData = NotificationIntentAdapter.cannotHandleTrampolineActivity(appContext) ? - NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent) : intent.getExtras(); + Bundle notificationData = NotificationIntentAdapter.canHandleTrampolineActivity(appContext) ? + intent.getExtras() : NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent); final IPushNotification pushNotification = PushNotification.get(appContext, notificationData); if (pushNotification != null) { pushNotification.onOpened(); diff --git a/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/NotificationIntentAdapter.java b/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/NotificationIntentAdapter.java index 41b48242a..70f609a81 100644 --- a/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/NotificationIntentAdapter.java +++ b/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/NotificationIntentAdapter.java @@ -14,21 +14,21 @@ public class NotificationIntentAdapter { @SuppressLint("UnspecifiedImmutableFlag") public static PendingIntent createPendingNotificationIntent(Context appContext, PushNotificationProps notification) { - if (cannotHandleTrampolineActivity(appContext)) { + if (canHandleTrampolineActivity(appContext)) { + Intent intent = new Intent(appContext, ProxyService.class); + intent.putExtra(PUSH_NOTIFICATION_EXTRA_NAME, notification.asBundle()); + return PendingIntent.getService(appContext, (int) System.currentTimeMillis(), intent, PendingIntent.FLAG_ONE_SHOT); + } else { Intent mainActivityIntent = appContext.getPackageManager().getLaunchIntentForPackage(appContext.getPackageName()); mainActivityIntent.putExtra(PUSH_NOTIFICATION_EXTRA_NAME, notification.asBundle()); TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(appContext); taskStackBuilder.addNextIntentWithParentStack(mainActivityIntent); return taskStackBuilder.getPendingIntent((int) System.currentTimeMillis(), PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE); - } else { - Intent intent = new Intent(appContext, ProxyService.class); - intent.putExtra(PUSH_NOTIFICATION_EXTRA_NAME, notification.asBundle()); - return PendingIntent.getService(appContext, (int) System.currentTimeMillis(), intent, PendingIntent.FLAG_ONE_SHOT); } } - public static boolean cannotHandleTrampolineActivity(Context appContext) { - return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R && appContext.getApplicationInfo().targetSdkVersion >= 31; + public static boolean canHandleTrampolineActivity(Context appContext) { + return android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.R || appContext.getApplicationInfo().targetSdkVersion < 31; } public static Bundle extractPendingNotificationDataFromIntent(Intent intent) { diff --git a/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java b/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java index 54a5fb83c..eade08d85 100644 --- a/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java +++ b/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java @@ -176,7 +176,7 @@ private void setUpIcon(Notification.Builder notification) { private void setUpIconColor(Notification.Builder notification) { int colorResID = getAppResourceId("colorAccent", "color"); - if (colorResID != 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + if (colorResID != 0) { int color = mContext.getResources().getColor(colorResID); notification.setColor(color); } @@ -213,7 +213,7 @@ private void notifyOpenedToJS() { } protected void launchOrResumeApp() { - if (!NotificationIntentAdapter.cannotHandleTrampolineActivity(mContext)) { + if (NotificationIntentAdapter.canHandleTrampolineActivity(mContext)) { final Intent intent = mAppLaunchHelper.getLaunchIntent(mContext); mContext.startActivity(intent); } diff --git a/lib/src/adapters/NativeCommandsSender.mock.ts b/lib/src/adapters/NativeCommandsSender.mock.ts deleted file mode 100644 index 138de4ca5..000000000 --- a/lib/src/adapters/NativeCommandsSender.mock.ts +++ /dev/null @@ -1 +0,0 @@ -export const { NativeCommandsSender } = jest.genMockFromModule('./NativeCommandsSender'); diff --git a/lib/src/adapters/NativeEventsReceiver.mock.ts b/lib/src/adapters/NativeEventsReceiver.mock.ts deleted file mode 100644 index 69e8f0e97..000000000 --- a/lib/src/adapters/NativeEventsReceiver.mock.ts +++ /dev/null @@ -1 +0,0 @@ -export const { NativeEventsReceiver } = jest.genMockFromModule('./NativeEventsReceiver'); diff --git a/lib/src/adapters/NativeEventsReceiver.ts b/lib/src/adapters/NativeEventsReceiver.ts index 18536ead0..2ddf13ff3 100644 --- a/lib/src/adapters/NativeEventsReceiver.ts +++ b/lib/src/adapters/NativeEventsReceiver.ts @@ -8,7 +8,7 @@ import { NotificationFactory } from '../DTO/NotificationFactory'; export class NativeEventsReceiver { private emitter: EventEmitter; - constructor(private readonly notificationFactory: NotificationFactory) { + constructor(private readonly notificationFactory: NotificationFactory = new NotificationFactory()) { this.emitter = new NativeEventEmitter(NativeModules.RNEventEmitter); } diff --git a/lib/src/events/EventsRegistry.test.ts b/lib/src/events/EventsRegistry.test.ts index 8320e41cc..ea5c121ad 100644 --- a/lib/src/events/EventsRegistry.test.ts +++ b/lib/src/events/EventsRegistry.test.ts @@ -1,16 +1,19 @@ -import { EventsRegistry } from './EventsRegistry'; -import { NativeEventsReceiver } from '../adapters/NativeEventsReceiver.mock'; +import { Platform, AppState } from 'react-native'; import { Notification } from '../DTO/Notification'; import { CompletionCallbackWrapper } from '../adapters/CompletionCallbackWrapper'; -import { NativeCommandsSender } from '../adapters/NativeCommandsSender.mock'; +import { NativeCommandsSender } from '../adapters/NativeCommandsSender'; +import { NativeEventsReceiver } from '../adapters/NativeEventsReceiver'; import { NotificationResponse } from '../interfaces/NotificationEvents'; -import { Platform, AppState } from 'react-native'; import { NotificationCompletion, NotificationBackgroundFetchResult } from '../interfaces/NotificationCompletion'; +import { EventsRegistry } from './EventsRegistry'; + +jest.mock('../adapters/NativeCommandsSender') +jest.mock('../adapters/NativeEventsReceiver') describe('EventsRegistry', () => { let uut: EventsRegistry; - const mockNativeEventsReceiver = new NativeEventsReceiver(); - const mockNativeCommandsSender = new NativeCommandsSender(); + const mockNativeEventsReceiver = new NativeEventsReceiver() as jest.Mocked; + const mockNativeCommandsSender = new NativeCommandsSender() as jest.Mocked; const completionCallbackWrapper = new CompletionCallbackWrapper(mockNativeCommandsSender); beforeEach(() => { @@ -174,13 +177,12 @@ describe('EventsRegistry', () => { it('should wrap callback with completion block', () => { const notification: Notification = new Notification({identifier: 'identifier'}); - const expectedResponse: NotificationResponse = {notification, identifier: 'responseId'} uut.registerNotificationOpened((response) => { - expect(response).toEqual(expectedResponse); + expect(response).toEqual(notification); }); const call = mockNativeEventsReceiver.registerNotificationOpened.mock.calls[0][0]; - call(expectedResponse); + call(notification); }); it('calling completion should invoke finishHandlingAction', () => { diff --git a/lib/src/events/EventsRegistryIOS.test.ts b/lib/src/events/EventsRegistryIOS.test.ts index 2341dd573..71587a572 100644 --- a/lib/src/events/EventsRegistryIOS.test.ts +++ b/lib/src/events/EventsRegistryIOS.test.ts @@ -1,12 +1,15 @@ import { EventsRegistryIOS } from './EventsRegistryIOS'; import { CompletionCallbackWrapper } from '../adapters/CompletionCallbackWrapper'; -import { NativeCommandsSender } from '../adapters/NativeCommandsSender.mock'; -import { NativeEventsReceiver } from '../adapters/NativeEventsReceiver.mock'; +import { NativeCommandsSender } from '../adapters/NativeCommandsSender'; +import { NativeEventsReceiver } from '../adapters/NativeEventsReceiver'; + +jest.mock('../adapters/NativeCommandsSender') +jest.mock('../adapters/NativeEventsReceiver') describe('EventsRegistryIOS', () => { let uut: EventsRegistryIOS; - const mockNativeEventsReceiver = new NativeEventsReceiver(); - const mockNativeCommandsSender = new NativeCommandsSender(); + const mockNativeEventsReceiver = new NativeEventsReceiver() as jest.Mocked; + const mockNativeCommandsSender = new NativeCommandsSender() as jest.Mocked; const completionCallbackWrapper = new CompletionCallbackWrapper(mockNativeCommandsSender); beforeEach(() => { diff --git a/package.json b/package.json index 02b38d089..556d19d64 100644 --- a/package.json +++ b/package.json @@ -51,24 +51,25 @@ "devDependencies": { "@babel/plugin-proposal-export-default-from": "7.2.0", "@babel/plugin-proposal-export-namespace-from": "7.2.0", - "@types/jest": "24.9.0", - "@types/lodash": "4.14.170", - "@types/react": "16.9.35", - "@types/react-native": "0.67.1", + "@types/jest": "^27.0.0", + "@types/lodash": "4.14.182", + "@types/react": "^17.0.0", + "@types/react-native": "0.67.6", "@types/react-test-renderer": "16.9.2", "babel-eslint": "10.0.3", "detox": "^19.4.2", "github-release-notes": "https://github.com/yogevbd/github-release-notes/tarball/e601b3dba72dcd6cba323c1286ea6dd0c0110b58", - "jest": "24.9.0", + "jest": "^27.0.0", "lodash": "4.17.21", - "metro-react-native-babel-preset": "0.66.2", - "react": "17.0.2", + "metro-babel-register": "^0.73.2", + "metro-react-native-babel-preset": "^0.67.0", + "react": "^17.0.0", "react-autobind": "1.0.6", - "react-native": "0.67.3", + "react-native": "^0.68.1", "shell-utils": "1.0.10", "ts-mockito": "2.5.0", - "tslint": "6.1.2", - "typescript": "^3.7.5" + "tslint": "6.1.3", + "typescript": "^4.0.0" }, "publishConfig": { "registry": "https://registry.npmjs.org/" @@ -81,24 +82,6 @@ "bugs": { "url": "https://github.com/wix/react-native-notifications/issues" }, - "detox": { - "test-runner": "jest", - "specs": "", - "configurations": { - "ios.sim.debug": { - "binaryPath": "example/ios/DerivedData/NotificationsExampleApp/Build/Products/Debug-iphonesimulator/NotificationsExampleApp.app", - "build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme NotificationsExampleApp -workspace example/ios/NotificationsExampleApp.xcworkspace -sdk iphonesimulator -configuration Debug -derivedDataPath example/ios/DerivedData/NotificationsExampleApp ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO", - "type": "ios.simulator", - "name": "iPhone 11" - }, - "ios.sim.release": { - "binaryPath": "example/ios/DerivedData/NotificationsExampleApp/Build/Products/Release-iphonesimulator/NotificationsExampleApp.app", - "build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme NotificationsExampleApp_release -workspace example/ios/NotificationsExampleApp.xcworkspace -sdk iphonesimulator -configuration Release -derivedDataPath example/ios/DerivedData/NotificationsExampleApp ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO", - "type": "ios.simulator", - "name": "iPhone 11" - } - } - }, "jest": { "preset": "react-native", "transform": { @@ -131,4 +114,4 @@ "html" ] } -} \ No newline at end of file +}