diff --git a/.buildkite/full/react-native-android-pipeline.full.yml b/.buildkite/full/react-native-android-pipeline.full.yml index 71bb0f4cf0..d82fba5ac3 100644 --- a/.buildkite/full/react-native-android-pipeline.full.yml +++ b/.buildkite/full/react-native-android-pipeline.full.yml @@ -232,8 +232,8 @@ steps: service-ports: true command: - --app=build/rn0.60.apk - - --app-activity=com.rn060.MainActivity - - --app-package=com.rn060 + - --app-activity=com.reactnative.MainActivity + - --app-package=com.reactnative - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator @@ -426,8 +426,8 @@ steps: service-ports: true command: - --app=build/r_navigation_0.60.apk - - --app-activity=com.rn060.MainActivity - - --app-package=com.rn060 + - --app-activity=com.reactnative.MainActivity + - --app-package=com.reactnative - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator @@ -478,8 +478,8 @@ steps: service-ports: true command: - --app=build/r_native_navigation_0.60.apk - - --app-activity=com.rn060.MainActivity - - --app-package=com.rn060 + - --app-activity=com.reactnative.MainActivity + - --app-package=com.reactnative - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator diff --git a/.buildkite/full/react-native-cli-pipeline.full.yml b/.buildkite/full/react-native-cli-pipeline.full.yml index fa7b186529..6d93fdef88 100644 --- a/.buildkite/full/react-native-cli-pipeline.full.yml +++ b/.buildkite/full/react-native-cli-pipeline.full.yml @@ -587,8 +587,8 @@ steps: service-ports: true command: - --app=build/rn0_60.apk - - --app-activity=com.rn0_60.MainActivity - - --app-package=com.rn0_60 + - --app-activity=com.reactnative.MainActivity + - --app-package=com.reactnative - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator @@ -612,8 +612,8 @@ steps: service-ports: true command: - --app=build/rn0_61.apk - - --app-activity=com.rn0_61.MainActivity - - --app-package=com.rn0_61 + - --app-activity=com.reactnative.MainActivity + - --app-package=com.reactnative - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator @@ -637,8 +637,8 @@ steps: service-ports: true command: - --app=build/rn0_62.apk - - --app-activity=com.rn0_62.MainActivity - - --app-package=com.rn0_62 + - --app-activity=com.reactnative.MainActivity + - --app-package=com.reactnative - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator @@ -662,8 +662,8 @@ steps: service-ports: true command: - --app=build/rn0_63.apk - - --app-activity=com.rn0_63.MainActivity - - --app-package=com.rn0_63 + - --app-activity=com.reactnative.MainActivity + - --app-package=com.reactnative - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator @@ -687,8 +687,8 @@ steps: service-ports: true command: - --app=build/rn0_63_expo_ejected.apk - - --app-activity=com.rn0_63_expo_ejected.MainActivity - - --app-package=com.rn0_63_expo_ejected + - --app-activity=com.reactnative_expo_ejected.MainActivity + - --app-package=com.reactnative_expo_ejected - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator @@ -712,8 +712,8 @@ steps: service-ports: true command: - --app=build/rn0_64.apk - - --app-activity=com.rn0_64.MainActivity - - --app-package=com.rn0_64 + - --app-activity=com.reactnative.MainActivity + - --app-package=com.reactnative - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator @@ -737,8 +737,8 @@ steps: service-ports: true command: - --app=build/rn0_65.apk - - --app-activity=com.rn0_65.MainActivity - - --app-package=com.rn0_65 + - --app-activity=com.reactnative.MainActivity + - --app-package=com.reactnative - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator @@ -762,8 +762,8 @@ steps: service-ports: true command: - --app=build/rn0_66.apk - - --app-activity=com.rn0_66.MainActivity - - --app-package=com.rn0_66 + - --app-activity=com.reactnative.MainActivity + - --app-package=com.reactnative - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator @@ -787,8 +787,8 @@ steps: service-ports: true command: - --app=build/rn0_67.apk - - --app-activity=com.rn0_67.MainActivity - - --app-package=com.rn0_67 + - --app-activity=com.reactnative.MainActivity + - --app-package=com.reactnative - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator @@ -812,8 +812,8 @@ steps: service-ports: true command: - --app=build/rn0_69.apk - - --app-activity=com.rn0_69.MainActivity - - --app-package=com.rn0_69 + - --app-activity=com.reactnative.MainActivity + - --app-package=com.reactnative - --farm=bb - --device=ANDROID_10|ANDROID_11|ANDROID_12 - --a11y-locator diff --git a/test/react-native-cli/features/fixtures/rn0_60/android/app/BUCK b/test/react-native-cli/features/fixtures/rn0_60/android/app/BUCK index a654a558ba..fe3384745e 100644 --- a/test/react-native-cli/features/fixtures/rn0_60/android/app/BUCK +++ b/test/react-native-cli/features/fixtures/rn0_60/android/app/BUCK @@ -35,12 +35,12 @@ android_library( android_build_config( name = "build_config", - package = "com.rn0_60", + package = "com.reactnative", ) android_resource( name = "res", - package = "com.rn0_60", + package = "com.reactnative", res = "src/main/res", ) diff --git a/test/react-native-cli/features/fixtures/rn0_60/android/app/build.gradle b/test/react-native-cli/features/fixtures/rn0_60/android/app/build.gradle index f53e375b2f..d6c2ff10d2 100644 --- a/test/react-native-cli/features/fixtures/rn0_60/android/app/build.gradle +++ b/test/react-native-cli/features/fixtures/rn0_60/android/app/build.gradle @@ -129,7 +129,7 @@ android { } defaultConfig { - applicationId "com.rn0_60" + applicationId "com.reactnative" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/AndroidManifest.xml b/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/AndroidManifest.xml index 24e2911992..b4d26d6e50 100644 --- a/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/AndroidManifest.xml +++ b/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.reactnative"> diff --git a/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/CrashyModule.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/CrashyModule.java rename to test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/CrashyModule.java index 4942a4d57b..dadcc0a6a9 100644 --- a/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/CrashyModule.java +++ b/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/CrashyModule.java @@ -1,4 +1,4 @@ -package com.rn0_60; +package com.reactnative; import com.bugsnag.android.Bugsnag; diff --git a/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/CrashyPackage.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/CrashyPackage.java rename to test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/CrashyPackage.java index cf65c46b5e..87b7bac258 100644 --- a/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/CrashyPackage.java +++ b/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/CrashyPackage.java @@ -1,4 +1,4 @@ -package com.rn0_62; +package com.reactnative; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; diff --git a/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/MainActivity.java b/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/MainActivity.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/MainActivity.java rename to test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/MainActivity.java index 8ee51c84bc..4b323f7b97 100644 --- a/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/MainActivity.java +++ b/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/MainActivity.java @@ -1,4 +1,4 @@ -package com.rn0_60; +package com.reactnative; import android.content.Intent; import android.os.Bundle; diff --git a/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/MainApplication.java b/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/MainApplication.java similarity index 98% rename from test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/MainApplication.java rename to test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/MainApplication.java index 1c6f3275fb..339d70b907 100644 --- a/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/MainApplication.java +++ b/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/MainApplication.java @@ -1,4 +1,4 @@ -package com.rn0_60; +package com.reactnative; import com.bugsnag.android.Configuration; import com.bugsnag.android.EndpointConfiguration; diff --git a/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/TestUtils.kt similarity index 99% rename from test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/TestUtils.kt rename to test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/TestUtils.kt index 7ed7561ffb..873018adff 100644 --- a/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/TestUtils.kt +++ b/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/reactnative/TestUtils.kt @@ -1,4 +1,4 @@ -package com.rn0_60 +package com.reactnative import android.content.Context import android.content.pm.PackageManager diff --git a/test/react-native-cli/features/fixtures/rn0_61/android/app/BUCK b/test/react-native-cli/features/fixtures/rn0_61/android/app/BUCK index a7b87f7cd3..fe3384745e 100644 --- a/test/react-native-cli/features/fixtures/rn0_61/android/app/BUCK +++ b/test/react-native-cli/features/fixtures/rn0_61/android/app/BUCK @@ -35,12 +35,12 @@ android_library( android_build_config( name = "build_config", - package = "com.rn0_61", + package = "com.reactnative", ) android_resource( name = "res", - package = "com.rn0_61", + package = "com.reactnative", res = "src/main/res", ) diff --git a/test/react-native-cli/features/fixtures/rn0_61/android/app/build.gradle b/test/react-native-cli/features/fixtures/rn0_61/android/app/build.gradle index d049f26b78..9573316031 100644 --- a/test/react-native-cli/features/fixtures/rn0_61/android/app/build.gradle +++ b/test/react-native-cli/features/fixtures/rn0_61/android/app/build.gradle @@ -129,7 +129,7 @@ android { } defaultConfig { - applicationId "com.rn0_61" + applicationId "com.reactnative" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/AndroidManifest.xml b/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/AndroidManifest.xml index df9e4aaa73..0dab38da52 100644 --- a/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/AndroidManifest.xml +++ b/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.reactnative"> diff --git a/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/CrashyModule.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/CrashyModule.java rename to test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/CrashyModule.java index 71f990da4b..dadcc0a6a9 100644 --- a/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/CrashyModule.java +++ b/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/CrashyModule.java @@ -1,4 +1,4 @@ -package com.rn0_62; +package com.reactnative; import com.bugsnag.android.Bugsnag; diff --git a/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/CrashyPackage.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/CrashyPackage.java rename to test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/CrashyPackage.java index 9c77aa9bca..87b7bac258 100644 --- a/test/react-native-cli/features/fixtures/rn0_60/android/app/src/main/java/com/rn0_60/CrashyPackage.java +++ b/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/CrashyPackage.java @@ -1,4 +1,4 @@ -package com.rn0_60; +package com.reactnative; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; diff --git a/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/MainActivity.java b/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/MainActivity.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/MainActivity.java rename to test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/MainActivity.java index d9a251d91f..0ba001fc9b 100644 --- a/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/MainActivity.java +++ b/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/MainActivity.java @@ -1,4 +1,4 @@ -package com.rn0_61; +package com.reactnative; import android.content.Intent; import android.os.Bundle; diff --git a/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/MainApplication.java b/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/MainApplication.java similarity index 98% rename from test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/MainApplication.java rename to test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/MainApplication.java index d24f489dd2..0ec91582bb 100644 --- a/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/MainApplication.java +++ b/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/MainApplication.java @@ -1,4 +1,4 @@ -package com.rn0_61; +package com.reactnative; import com.bugsnag.android.Configuration; import com.bugsnag.android.EndpointConfiguration; diff --git a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/TestUtils.kt similarity index 99% rename from test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/TestUtils.kt rename to test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/TestUtils.kt index c1f82410e8..4ac45b14fa 100644 --- a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/TestUtils.kt +++ b/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/reactnative/TestUtils.kt @@ -1,4 +1,4 @@ -package com.rn0_64 +package com.reactnative import android.content.Context import android.content.pm.PackageManager diff --git a/test/react-native-cli/features/fixtures/rn0_62/android/app/BUCK b/test/react-native-cli/features/fixtures/rn0_62/android/app/BUCK index 87de597c85..fe3384745e 100644 --- a/test/react-native-cli/features/fixtures/rn0_62/android/app/BUCK +++ b/test/react-native-cli/features/fixtures/rn0_62/android/app/BUCK @@ -35,12 +35,12 @@ android_library( android_build_config( name = "build_config", - package = "com.rn0_62", + package = "com.reactnative", ) android_resource( name = "res", - package = "com.rn0_62", + package = "com.reactnative", res = "src/main/res", ) diff --git a/test/react-native-cli/features/fixtures/rn0_62/android/app/build.gradle b/test/react-native-cli/features/fixtures/rn0_62/android/app/build.gradle index 9fe27998c2..33c85fa224 100644 --- a/test/react-native-cli/features/fixtures/rn0_62/android/app/build.gradle +++ b/test/react-native-cli/features/fixtures/rn0_62/android/app/build.gradle @@ -130,7 +130,7 @@ android { } defaultConfig { - applicationId "com.rn0_62" + applicationId "com.reactnative" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/AndroidManifest.xml b/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/AndroidManifest.xml index 5bb027c1ac..705bc0c3e2 100644 --- a/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/AndroidManifest.xml +++ b/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.reactnative"> diff --git a/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/CrashyModule.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/CrashyModule.java rename to test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/CrashyModule.java index 5143ae3a5a..dadcc0a6a9 100644 --- a/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/CrashyModule.java +++ b/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/CrashyModule.java @@ -1,4 +1,4 @@ -package com.rn0_63; +package com.reactnative; import com.bugsnag.android.Bugsnag; diff --git a/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/CrashyPackage.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/CrashyPackage.java rename to test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/CrashyPackage.java index 01d70e835a..87b7bac258 100644 --- a/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/CrashyPackage.java +++ b/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/CrashyPackage.java @@ -1,4 +1,4 @@ -package com.rn0_63; +package com.reactnative; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; diff --git a/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/MainActivity.java b/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/MainActivity.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/MainActivity.java rename to test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/MainActivity.java index bd88cbf521..968bc0f277 100644 --- a/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/MainActivity.java +++ b/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/MainActivity.java @@ -1,4 +1,4 @@ -package com.rn0_62; +package com.reactnative; import android.content.Intent; import android.os.Bundle; diff --git a/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/MainApplication.java b/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/MainApplication.java similarity index 98% rename from test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/MainApplication.java rename to test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/MainApplication.java index 1af4351a63..0e26231158 100644 --- a/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/MainApplication.java +++ b/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/MainApplication.java @@ -1,4 +1,4 @@ -package com.rn0_62; +package com.reactnative; import com.bugsnag.android.Configuration; import com.bugsnag.android.EndpointConfiguration; diff --git a/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/TestUtils.kt similarity index 99% rename from test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/TestUtils.kt rename to test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/TestUtils.kt index 2d806deb72..4ac45b14fa 100644 --- a/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/rn0_62/TestUtils.kt +++ b/test/react-native-cli/features/fixtures/rn0_62/android/app/src/main/java/com/reactnative/TestUtils.kt @@ -1,4 +1,4 @@ -package com.rn0_62 +package com.reactnative import android.content.Context import android.content.pm.PackageManager diff --git a/test/react-native-cli/features/fixtures/rn0_63/android/app/BUCK b/test/react-native-cli/features/fixtures/rn0_63/android/app/BUCK index 9f5d23bf46..fe3384745e 100644 --- a/test/react-native-cli/features/fixtures/rn0_63/android/app/BUCK +++ b/test/react-native-cli/features/fixtures/rn0_63/android/app/BUCK @@ -35,12 +35,12 @@ android_library( android_build_config( name = "build_config", - package = "com.rn0_63", + package = "com.reactnative", ) android_resource( name = "res", - package = "com.rn0_63", + package = "com.reactnative", res = "src/main/res", ) diff --git a/test/react-native-cli/features/fixtures/rn0_63/android/app/build.gradle b/test/react-native-cli/features/fixtures/rn0_63/android/app/build.gradle index ba57583e4b..2e32262b96 100644 --- a/test/react-native-cli/features/fixtures/rn0_63/android/app/build.gradle +++ b/test/react-native-cli/features/fixtures/rn0_63/android/app/build.gradle @@ -130,7 +130,7 @@ android { } defaultConfig { - applicationId "com.rn0_63" + applicationId "com.reactnative" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/AndroidManifest.xml b/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/AndroidManifest.xml index e93c28bce4..705bc0c3e2 100644 --- a/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/AndroidManifest.xml +++ b/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.reactnative"> diff --git a/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/CrashyModule.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/CrashyModule.java rename to test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/CrashyModule.java index f5893e6897..dadcc0a6a9 100644 --- a/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/CrashyModule.java +++ b/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/CrashyModule.java @@ -1,4 +1,4 @@ -package com.rn0_61; +package com.reactnative; import com.bugsnag.android.Bugsnag; diff --git a/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/CrashyPackage.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/CrashyPackage.java rename to test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/CrashyPackage.java index 74abfc32b1..87b7bac258 100644 --- a/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/CrashyPackage.java +++ b/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/CrashyPackage.java @@ -1,4 +1,4 @@ -package com.rn0_61; +package com.reactnative; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; diff --git a/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/MainActivity.java b/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/MainActivity.java similarity index 92% rename from test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/MainActivity.java rename to test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/MainActivity.java index a933e028dc..41671cc7de 100644 --- a/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/MainActivity.java +++ b/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/MainActivity.java @@ -1,4 +1,4 @@ -package com.rn0_63; +package com.reactnative; import com.facebook.react.ReactActivity; diff --git a/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/MainApplication.java b/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/MainApplication.java similarity index 98% rename from test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/MainApplication.java rename to test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/MainApplication.java index 1a12f74fd0..0e26231158 100644 --- a/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/MainApplication.java +++ b/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/MainApplication.java @@ -1,4 +1,4 @@ -package com.rn0_63; +package com.reactnative; import com.bugsnag.android.Configuration; import com.bugsnag.android.EndpointConfiguration; diff --git a/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/TestUtils.kt similarity index 99% rename from test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/TestUtils.kt rename to test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/TestUtils.kt index 60e0749502..4ac45b14fa 100644 --- a/test/react-native-cli/features/fixtures/rn0_61/android/app/src/main/java/com/rn0_61/TestUtils.kt +++ b/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/reactnative/TestUtils.kt @@ -1,4 +1,4 @@ -package com.rn0_61 +package com.reactnative import android.content.Context import android.content.pm.PackageManager diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/build.gradle b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/build.gradle index f6155c5547..591d03af64 100644 --- a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/build.gradle +++ b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/build.gradle @@ -133,7 +133,7 @@ android { } defaultConfig { - applicationId 'com.rn0_63_expo_ejected' + applicationId 'com.reactnative' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/AndroidManifest.xml b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/AndroidManifest.xml index b6052f5c91..0760de7930 100644 --- a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/AndroidManifest.xml +++ b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,4 @@ - + @@ -30,7 +30,7 @@ - + diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/CrashyModule.java new file mode 100644 index 0000000000..dadcc0a6a9 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/CrashyModule.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.bugsnag.android.Bugsnag; + +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; + +public class CrashyModule extends ReactContextBaseJavaModule { + public CrashyModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return "CrashyCrashy"; + } + + @ReactMethod + public void generateCrash() throws Exception { + throw new Exception("Ooopsy from Java!"); + } + + @ReactMethod + public void generatePromiseRejection(Promise promise) { + promise.reject(new Exception("Oops - rejected promise from Java!")); + } + + @ReactMethod + public void handledError() throws Exception { + Bugsnag.notify(new Exception("Handled ooopsy from Java!")); + } +} diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/CrashyPackage.java new file mode 100644 index 0000000000..87b7bac258 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/CrashyPackage.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.JavaScriptModule; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +class CrashyPackage implements ReactPackage { + + public List> createJSModules() { + return Collections.emptyList(); + } + + @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } + + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + List modules = new ArrayList<>(); + + modules.add(new CrashyModule(reactContext)); + + return modules; + } +} + diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/MainActivity.java b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/MainActivity.java similarity index 98% rename from test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/MainActivity.java rename to test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/MainActivity.java index 1c245da6ac..b8df277173 100644 --- a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/MainActivity.java +++ b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/MainActivity.java @@ -1,4 +1,4 @@ -package com.rn0_63_expo_ejected; +package com.reactnative; import android.content.Intent; import android.os.Bundle; diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/MainApplication.java b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/MainApplication.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/MainApplication.java rename to test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/MainApplication.java index 4d94b81a0f..14783a6178 100644 --- a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/MainApplication.java +++ b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/MainApplication.java @@ -1,4 +1,4 @@ -package com.rn0_63_expo_ejected; +package com.reactnative; import android.app.Application; import android.content.Context; @@ -13,7 +13,7 @@ import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; -import com.rn0_63_expo_ejected.generated.BasePackageList; +import com.reactnative.generated.BasePackageList; import com.bugsnag.android.Configuration; import com.bugsnag.android.EndpointConfiguration; diff --git a/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/TestUtils.kt similarity index 99% rename from test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/TestUtils.kt rename to test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/TestUtils.kt index 18be2eb89c..4ac45b14fa 100644 --- a/test/react-native-cli/features/fixtures/rn0_63/android/app/src/main/java/com/rn0_63/TestUtils.kt +++ b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/TestUtils.kt @@ -1,4 +1,4 @@ -package com.rn0_63 +package com.reactnative import android.content.Context import android.content.pm.PackageManager diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/generated/BasePackageList.java b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/generated/BasePackageList.java similarity index 94% rename from test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/generated/BasePackageList.java rename to test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/generated/BasePackageList.java index 0afdd8aa38..5bbbc575e3 100644 --- a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/generated/BasePackageList.java +++ b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/reactnative/generated/BasePackageList.java @@ -1,4 +1,4 @@ -package com.rn0_63_expo_ejected.generated; +package com.reactnative.generated; import java.util.Arrays; import java.util.List; diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/CrashyModule.java deleted file mode 100644 index 91f15340cd..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/CrashyModule.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_63_expo_ejected; - -import com.bugsnag.android.Bugsnag; - -import com.facebook.react.bridge.Promise; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; - -public class CrashyModule extends ReactContextBaseJavaModule { - public CrashyModule(ReactApplicationContext reactContext) { - super(reactContext); - } - - @Override - public String getName() { - return "CrashyCrashy"; - } - - @ReactMethod - public void generateCrash() throws Exception { - throw new Exception("Ooopsy from Java!"); - } - - @ReactMethod - public void generatePromiseRejection(Promise promise) { - promise.reject(new Exception("Oops - rejected promise from Java!")); - } - - @ReactMethod - public void handledError() throws Exception { - Bugsnag.notify(new Exception("Handled ooopsy from Java!")); - } -} diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/CrashyPackage.java deleted file mode 100644 index a5f8b6007b..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/CrashyPackage.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_63_expo_ejected; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.JavaScriptModule; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -class CrashyPackage implements ReactPackage { - - public List> createJSModules() { - return Collections.emptyList(); - } - - @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } - - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - - modules.add(new CrashyModule(reactContext)); - - return modules; - } -} - diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/TestUtils.kt deleted file mode 100644 index 428769da40..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/rn0_63_expo_ejected/TestUtils.kt +++ /dev/null @@ -1,70 +0,0 @@ -package com.rn0_63_expo_ejected - -import android.content.Context -import android.content.pm.PackageManager -import android.util.Log -import org.json.JSONObject -import java.io.File -import java.io.IOException - -const val CONFIG_FILE_TIMEOUT = 15000 -const val BUGSNAG_NS = "com.bugsnag.android" -const val API_KEY = "$BUGSNAG_NS.API_KEY" -const val ENDPOINT_NOTIFY = "$BUGSNAG_NS.ENDPOINT_NOTIFY" -const val ENDPOINT_SESSIONS = "$BUGSNAG_NS.ENDPOINT_SESSIONS" - -class TestUtils { - - fun getMazeRunnerAddress(context: Context): String { - val externalFilesDir = context.getExternalFilesDir(null) - val configFile = File(externalFilesDir, "fixture_config.json") - var mazeAddress: String? = null - Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") - - // Poll for the fixture config file - val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT - while (System.currentTimeMillis() < pollEnd) { - if (configFile.exists()) { - val fileContents = configFile.readText() - val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() - mazeAddress = getStringSafely(fixtureConfig, "maze_address") - if (!mazeAddress.isNullOrBlank()) { - Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") - break - } - } - - Thread.sleep(250) - } - if (mazeAddress.isNullOrBlank()) { - Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") - mazeAddress = "bs-local.com:9339" - } - return mazeAddress - } - - fun loadDefaultParams(ctx: Context): Map { - try { - val packageManager = ctx.packageManager - val packageName = ctx.packageName - val ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) - val data = ai.metaData - if (data != null) { - val default_metadata = hashMapOf( - "apiKey" to data.getString(API_KEY), - "notify" to data.getString(ENDPOINT_NOTIFY), - "sessions" to data.getString(ENDPOINT_SESSIONS) - ) - return default_metadata - } - } catch (exc: Exception) { - throw IllegalStateException("Bugsnag is unable to read config from manifest.", exc) - } - return emptyMap() - } - - private fun getStringSafely(jsonObject: JSONObject?, key: String): String { - return jsonObject?.optString(key) ?: "" - } - -} diff --git a/test/react-native-cli/features/fixtures/rn0_64/android/app/_BUCK b/test/react-native-cli/features/fixtures/rn0_64/android/app/_BUCK index fb221f8c7a..fe3384745e 100644 --- a/test/react-native-cli/features/fixtures/rn0_64/android/app/_BUCK +++ b/test/react-native-cli/features/fixtures/rn0_64/android/app/_BUCK @@ -35,12 +35,12 @@ android_library( android_build_config( name = "build_config", - package = "com.rn0_64", + package = "com.reactnative", ) android_resource( name = "res", - package = "com.rn0_64", + package = "com.reactnative", res = "src/main/res", ) diff --git a/test/react-native-cli/features/fixtures/rn0_64/android/app/build.gradle b/test/react-native-cli/features/fixtures/rn0_64/android/app/build.gradle index 596d04f804..d00fe65175 100644 --- a/test/react-native-cli/features/fixtures/rn0_64/android/app/build.gradle +++ b/test/react-native-cli/features/fixtures/rn0_64/android/app/build.gradle @@ -132,7 +132,7 @@ android { } defaultConfig { - applicationId "com.rn0_64" + applicationId "com.reactnative" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/AndroidManifest.xml b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/AndroidManifest.xml index 5a4706cff9..34c4647c58 100644 --- a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/AndroidManifest.xml +++ b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.reactnative"> diff --git a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/CrashyModule.java new file mode 100644 index 0000000000..dadcc0a6a9 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/CrashyModule.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.bugsnag.android.Bugsnag; + +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; + +public class CrashyModule extends ReactContextBaseJavaModule { + public CrashyModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return "CrashyCrashy"; + } + + @ReactMethod + public void generateCrash() throws Exception { + throw new Exception("Ooopsy from Java!"); + } + + @ReactMethod + public void generatePromiseRejection(Promise promise) { + promise.reject(new Exception("Oops - rejected promise from Java!")); + } + + @ReactMethod + public void handledError() throws Exception { + Bugsnag.notify(new Exception("Handled ooopsy from Java!")); + } +} diff --git a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/CrashyPackage.java new file mode 100644 index 0000000000..87b7bac258 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/CrashyPackage.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.JavaScriptModule; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +class CrashyPackage implements ReactPackage { + + public List> createJSModules() { + return Collections.emptyList(); + } + + @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } + + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + List modules = new ArrayList<>(); + + modules.add(new CrashyModule(reactContext)); + + return modules; + } +} + diff --git a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/MainActivity.java b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/MainActivity.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/MainActivity.java rename to test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/MainActivity.java index e8afb6429f..b2480c6dfe 100644 --- a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/MainActivity.java +++ b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/MainActivity.java @@ -1,4 +1,4 @@ -package com.rn0_64; +package com.reactnative; import android.content.Intent; import android.os.Bundle; diff --git a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/MainApplication.java b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/MainApplication.java similarity index 98% rename from test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/MainApplication.java rename to test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/MainApplication.java index 7c21cc2519..7af4fe5800 100644 --- a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/MainApplication.java +++ b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/MainApplication.java @@ -1,4 +1,4 @@ -package com.rn0_64; +package com.reactnative; import com.bugsnag.android.Configuration; import com.bugsnag.android.EndpointConfiguration; diff --git a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/TestUtils.kt new file mode 100644 index 0000000000..4ac45b14fa --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/reactnative/TestUtils.kt @@ -0,0 +1,70 @@ +package com.reactnative + +import android.content.Context +import android.content.pm.PackageManager +import android.util.Log +import org.json.JSONObject +import java.io.File +import java.io.IOException + +const val CONFIG_FILE_TIMEOUT = 15000 +const val BUGSNAG_NS = "com.bugsnag.android" +const val API_KEY = "$BUGSNAG_NS.API_KEY" +const val ENDPOINT_NOTIFY = "$BUGSNAG_NS.ENDPOINT_NOTIFY" +const val ENDPOINT_SESSIONS = "$BUGSNAG_NS.ENDPOINT_SESSIONS" + +class TestUtils { + + fun getMazeRunnerAddress(context: Context): String { + val externalFilesDir = context.getExternalFilesDir(null) + val configFile = File(externalFilesDir, "fixture_config.json") + var mazeAddress: String? = null + Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") + + // Poll for the fixture config file + val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT + while (System.currentTimeMillis() < pollEnd) { + if (configFile.exists()) { + val fileContents = configFile.readText() + val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() + mazeAddress = getStringSafely(fixtureConfig, "maze_address") + if (!mazeAddress.isNullOrBlank()) { + Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") + break + } + } + + Thread.sleep(250) + } + if (mazeAddress.isNullOrBlank()) { + Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") + mazeAddress = "bs-local.com:9339" + } + return mazeAddress + } + + fun loadDefaultParams(ctx: Context): Map { + try { + val packageManager = ctx.packageManager + val packageName = ctx.packageName + val ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) + val data = ai.metaData + if (data != null) { + val default_metadata = hashMapOf( + "apiKey" to data.getString(API_KEY), + "notify" to data.getString(ENDPOINT_NOTIFY), + "sessions" to data.getString(ENDPOINT_SESSIONS) + ) + return default_metadata + } + } catch (exc: Exception) { + throw IllegalStateException("Bugsnag is unable to read config from manifest.", exc) + } + return emptyMap() + } + + private fun getStringSafely(jsonObject: JSONObject?, key: String): String { + return jsonObject?.optString(key) ?: "" + } + +} diff --git a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/CrashyModule.java deleted file mode 100644 index c9a755626f..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/CrashyModule.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_64; - -import com.bugsnag.android.Bugsnag; - -import com.facebook.react.bridge.Promise; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; - -public class CrashyModule extends ReactContextBaseJavaModule { - public CrashyModule(ReactApplicationContext reactContext) { - super(reactContext); - } - - @Override - public String getName() { - return "CrashyCrashy"; - } - - @ReactMethod - public void generateCrash() throws Exception { - throw new Exception("Ooopsy from Java!"); - } - - @ReactMethod - public void generatePromiseRejection(Promise promise) { - promise.reject(new Exception("Oops - rejected promise from Java!")); - } - - @ReactMethod - public void handledError() throws Exception { - Bugsnag.notify(new Exception("Handled ooopsy from Java!")); - } -} diff --git a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/CrashyPackage.java deleted file mode 100644 index 54882d0822..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_64/android/app/src/main/java/com/rn0_64/CrashyPackage.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_64; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.JavaScriptModule; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -class CrashyPackage implements ReactPackage { - - public List> createJSModules() { - return Collections.emptyList(); - } - - @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } - - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - - modules.add(new CrashyModule(reactContext)); - - return modules; - } -} - diff --git a/test/react-native-cli/features/fixtures/rn0_65/android/app/_BUCK b/test/react-native-cli/features/fixtures/rn0_65/android/app/_BUCK index 419299c526..fe3384745e 100644 --- a/test/react-native-cli/features/fixtures/rn0_65/android/app/_BUCK +++ b/test/react-native-cli/features/fixtures/rn0_65/android/app/_BUCK @@ -35,12 +35,12 @@ android_library( android_build_config( name = "build_config", - package = "com.rn0_65", + package = "com.reactnative", ) android_resource( name = "res", - package = "com.rn0_65", + package = "com.reactnative", res = "src/main/res", ) diff --git a/test/react-native-cli/features/fixtures/rn0_65/android/app/build.gradle b/test/react-native-cli/features/fixtures/rn0_65/android/app/build.gradle index 135f8bc88a..3f0ca0f9fe 100644 --- a/test/react-native-cli/features/fixtures/rn0_65/android/app/build.gradle +++ b/test/react-native-cli/features/fixtures/rn0_65/android/app/build.gradle @@ -127,7 +127,7 @@ android { compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { - applicationId "com.rn0_65" + applicationId "com.reactnative" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/AndroidManifest.xml b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/AndroidManifest.xml index 74a3148f47..347e6f3ebd 100644 --- a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/AndroidManifest.xml +++ b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.reactnative"> diff --git a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/CrashyModule.java new file mode 100644 index 0000000000..dadcc0a6a9 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/CrashyModule.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.bugsnag.android.Bugsnag; + +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; + +public class CrashyModule extends ReactContextBaseJavaModule { + public CrashyModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return "CrashyCrashy"; + } + + @ReactMethod + public void generateCrash() throws Exception { + throw new Exception("Ooopsy from Java!"); + } + + @ReactMethod + public void generatePromiseRejection(Promise promise) { + promise.reject(new Exception("Oops - rejected promise from Java!")); + } + + @ReactMethod + public void handledError() throws Exception { + Bugsnag.notify(new Exception("Handled ooopsy from Java!")); + } +} diff --git a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/CrashyPackage.java new file mode 100644 index 0000000000..87b7bac258 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/CrashyPackage.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.JavaScriptModule; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +class CrashyPackage implements ReactPackage { + + public List> createJSModules() { + return Collections.emptyList(); + } + + @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } + + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + List modules = new ArrayList<>(); + + modules.add(new CrashyModule(reactContext)); + + return modules; + } +} + diff --git a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/MainActivity.java b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/MainActivity.java similarity index 92% rename from test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/MainActivity.java rename to test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/MainActivity.java index 2e6c717581..01a0989d26 100644 --- a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/MainActivity.java +++ b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/MainActivity.java @@ -1,4 +1,4 @@ -package com.rn0_65; +package com.reactnative; import com.facebook.react.ReactActivity; diff --git a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/MainApplication.java b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/MainApplication.java similarity index 98% rename from test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/MainApplication.java rename to test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/MainApplication.java index 19c8617b7c..a07bb4a603 100644 --- a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/MainApplication.java +++ b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/MainApplication.java @@ -1,4 +1,4 @@ -package com.rn0_66; +package com.reactnative; import com.bugsnag.android.Configuration; import com.bugsnag.android.EndpointConfiguration; diff --git a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/TestUtils.kt new file mode 100644 index 0000000000..4ac45b14fa --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/reactnative/TestUtils.kt @@ -0,0 +1,70 @@ +package com.reactnative + +import android.content.Context +import android.content.pm.PackageManager +import android.util.Log +import org.json.JSONObject +import java.io.File +import java.io.IOException + +const val CONFIG_FILE_TIMEOUT = 15000 +const val BUGSNAG_NS = "com.bugsnag.android" +const val API_KEY = "$BUGSNAG_NS.API_KEY" +const val ENDPOINT_NOTIFY = "$BUGSNAG_NS.ENDPOINT_NOTIFY" +const val ENDPOINT_SESSIONS = "$BUGSNAG_NS.ENDPOINT_SESSIONS" + +class TestUtils { + + fun getMazeRunnerAddress(context: Context): String { + val externalFilesDir = context.getExternalFilesDir(null) + val configFile = File(externalFilesDir, "fixture_config.json") + var mazeAddress: String? = null + Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") + + // Poll for the fixture config file + val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT + while (System.currentTimeMillis() < pollEnd) { + if (configFile.exists()) { + val fileContents = configFile.readText() + val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() + mazeAddress = getStringSafely(fixtureConfig, "maze_address") + if (!mazeAddress.isNullOrBlank()) { + Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") + break + } + } + + Thread.sleep(250) + } + if (mazeAddress.isNullOrBlank()) { + Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") + mazeAddress = "bs-local.com:9339" + } + return mazeAddress + } + + fun loadDefaultParams(ctx: Context): Map { + try { + val packageManager = ctx.packageManager + val packageName = ctx.packageName + val ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) + val data = ai.metaData + if (data != null) { + val default_metadata = hashMapOf( + "apiKey" to data.getString(API_KEY), + "notify" to data.getString(ENDPOINT_NOTIFY), + "sessions" to data.getString(ENDPOINT_SESSIONS) + ) + return default_metadata + } + } catch (exc: Exception) { + throw IllegalStateException("Bugsnag is unable to read config from manifest.", exc) + } + return emptyMap() + } + + private fun getStringSafely(jsonObject: JSONObject?, key: String): String { + return jsonObject?.optString(key) ?: "" + } + +} diff --git a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/CrashyModule.java deleted file mode 100644 index 253433c1a0..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/CrashyModule.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_65; - -import com.bugsnag.android.Bugsnag; - -import com.facebook.react.bridge.Promise; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; - -public class CrashyModule extends ReactContextBaseJavaModule { - public CrashyModule(ReactApplicationContext reactContext) { - super(reactContext); - } - - @Override - public String getName() { - return "CrashyCrashy"; - } - - @ReactMethod - public void generateCrash() throws Exception { - throw new Exception("Ooopsy from Java!"); - } - - @ReactMethod - public void generatePromiseRejection(Promise promise) { - promise.reject(new Exception("Oops - rejected promise from Java!")); - } - - @ReactMethod - public void handledError() throws Exception { - Bugsnag.notify(new Exception("Handled ooopsy from Java!")); - } -} diff --git a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/CrashyPackage.java deleted file mode 100644 index 4ccacc7217..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/CrashyPackage.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_65; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.JavaScriptModule; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -class CrashyPackage implements ReactPackage { - - public List> createJSModules() { - return Collections.emptyList(); - } - - @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } - - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - - modules.add(new CrashyModule(reactContext)); - - return modules; - } -} - diff --git a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/TestUtils.kt deleted file mode 100644 index e19d17c9b7..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/TestUtils.kt +++ /dev/null @@ -1,70 +0,0 @@ -package com.rn0_65 - -import android.content.Context -import android.content.pm.PackageManager -import android.util.Log -import org.json.JSONObject -import java.io.File -import java.io.IOException - -const val CONFIG_FILE_TIMEOUT = 15000 -const val BUGSNAG_NS = "com.bugsnag.android" -const val API_KEY = "$BUGSNAG_NS.API_KEY" -const val ENDPOINT_NOTIFY = "$BUGSNAG_NS.ENDPOINT_NOTIFY" -const val ENDPOINT_SESSIONS = "$BUGSNAG_NS.ENDPOINT_SESSIONS" - -class TestUtils { - - fun getMazeRunnerAddress(context: Context): String { - val externalFilesDir = context.getExternalFilesDir(null) - val configFile = File(externalFilesDir, "fixture_config.json") - var mazeAddress: String? = null - Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") - - // Poll for the fixture config file - val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT - while (System.currentTimeMillis() < pollEnd) { - if (configFile.exists()) { - val fileContents = configFile.readText() - val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() - mazeAddress = getStringSafely(fixtureConfig, "maze_address") - if (!mazeAddress.isNullOrBlank()) { - Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") - break - } - } - - Thread.sleep(250) - } - if (mazeAddress.isNullOrBlank()) { - Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") - mazeAddress = "bs-local.com:9339" - } - return mazeAddress - } - - fun loadDefaultParams(ctx: Context): Map { - try { - val packageManager = ctx.packageManager - val packageName = ctx.packageName - val ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) - val data = ai.metaData - if (data != null) { - val default_metadata = hashMapOf( - "apiKey" to data.getString(API_KEY), - "notify" to data.getString(ENDPOINT_NOTIFY), - "sessions" to data.getString(ENDPOINT_SESSIONS) - ) - return default_metadata - } - } catch (exc: Exception) { - throw IllegalStateException("Bugsnag is unable to read config from manifest.", exc) - } - return emptyMap() - } - - private fun getStringSafely(jsonObject: JSONObject?, key: String): String { - return jsonObject?.optString(key) ?: "" - } - -} diff --git a/test/react-native-cli/features/fixtures/rn0_66/android/app/_BUCK b/test/react-native-cli/features/fixtures/rn0_66/android/app/_BUCK index ee86ef9653..fe3384745e 100644 --- a/test/react-native-cli/features/fixtures/rn0_66/android/app/_BUCK +++ b/test/react-native-cli/features/fixtures/rn0_66/android/app/_BUCK @@ -35,12 +35,12 @@ android_library( android_build_config( name = "build_config", - package = "com.rn0_66", + package = "com.reactnative", ) android_resource( name = "res", - package = "com.rn0_66", + package = "com.reactnative", res = "src/main/res", ) diff --git a/test/react-native-cli/features/fixtures/rn0_66/android/app/build.gradle b/test/react-native-cli/features/fixtures/rn0_66/android/app/build.gradle index 10c6880cff..96b34a9c1f 100644 --- a/test/react-native-cli/features/fixtures/rn0_66/android/app/build.gradle +++ b/test/react-native-cli/features/fixtures/rn0_66/android/app/build.gradle @@ -132,7 +132,7 @@ android { compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { - applicationId "com.rn0_66" + applicationId "com.reactnative" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/AndroidManifest.xml b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/AndroidManifest.xml index dc693f91ee..347e6f3ebd 100644 --- a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/AndroidManifest.xml +++ b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.reactnative"> diff --git a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/CrashyModule.java new file mode 100644 index 0000000000..dadcc0a6a9 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/CrashyModule.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.bugsnag.android.Bugsnag; + +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; + +public class CrashyModule extends ReactContextBaseJavaModule { + public CrashyModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return "CrashyCrashy"; + } + + @ReactMethod + public void generateCrash() throws Exception { + throw new Exception("Ooopsy from Java!"); + } + + @ReactMethod + public void generatePromiseRejection(Promise promise) { + promise.reject(new Exception("Oops - rejected promise from Java!")); + } + + @ReactMethod + public void handledError() throws Exception { + Bugsnag.notify(new Exception("Handled ooopsy from Java!")); + } +} diff --git a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/CrashyPackage.java new file mode 100644 index 0000000000..87b7bac258 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/CrashyPackage.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.JavaScriptModule; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +class CrashyPackage implements ReactPackage { + + public List> createJSModules() { + return Collections.emptyList(); + } + + @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } + + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + List modules = new ArrayList<>(); + + modules.add(new CrashyModule(reactContext)); + + return modules; + } +} + diff --git a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/MainActivity.java b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/MainActivity.java similarity index 92% rename from test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/MainActivity.java rename to test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/MainActivity.java index 0a45c7d651..8b7341dc75 100644 --- a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/MainActivity.java +++ b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/MainActivity.java @@ -1,4 +1,4 @@ -package com.rn0_66; +package com.reactnative; import com.facebook.react.ReactActivity; diff --git a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/MainApplication.java b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/MainApplication.java similarity index 98% rename from test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/MainApplication.java rename to test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/MainApplication.java index 117e88ebbe..a07bb4a603 100644 --- a/test/react-native-cli/features/fixtures/rn0_65/android/app/src/main/java/com/rn0_65/MainApplication.java +++ b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/MainApplication.java @@ -1,4 +1,4 @@ -package com.rn0_65; +package com.reactnative; import com.bugsnag.android.Configuration; import com.bugsnag.android.EndpointConfiguration; diff --git a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/TestUtils.kt new file mode 100644 index 0000000000..4ac45b14fa --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/reactnative/TestUtils.kt @@ -0,0 +1,70 @@ +package com.reactnative + +import android.content.Context +import android.content.pm.PackageManager +import android.util.Log +import org.json.JSONObject +import java.io.File +import java.io.IOException + +const val CONFIG_FILE_TIMEOUT = 15000 +const val BUGSNAG_NS = "com.bugsnag.android" +const val API_KEY = "$BUGSNAG_NS.API_KEY" +const val ENDPOINT_NOTIFY = "$BUGSNAG_NS.ENDPOINT_NOTIFY" +const val ENDPOINT_SESSIONS = "$BUGSNAG_NS.ENDPOINT_SESSIONS" + +class TestUtils { + + fun getMazeRunnerAddress(context: Context): String { + val externalFilesDir = context.getExternalFilesDir(null) + val configFile = File(externalFilesDir, "fixture_config.json") + var mazeAddress: String? = null + Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") + + // Poll for the fixture config file + val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT + while (System.currentTimeMillis() < pollEnd) { + if (configFile.exists()) { + val fileContents = configFile.readText() + val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() + mazeAddress = getStringSafely(fixtureConfig, "maze_address") + if (!mazeAddress.isNullOrBlank()) { + Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") + break + } + } + + Thread.sleep(250) + } + if (mazeAddress.isNullOrBlank()) { + Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") + mazeAddress = "bs-local.com:9339" + } + return mazeAddress + } + + fun loadDefaultParams(ctx: Context): Map { + try { + val packageManager = ctx.packageManager + val packageName = ctx.packageName + val ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) + val data = ai.metaData + if (data != null) { + val default_metadata = hashMapOf( + "apiKey" to data.getString(API_KEY), + "notify" to data.getString(ENDPOINT_NOTIFY), + "sessions" to data.getString(ENDPOINT_SESSIONS) + ) + return default_metadata + } + } catch (exc: Exception) { + throw IllegalStateException("Bugsnag is unable to read config from manifest.", exc) + } + return emptyMap() + } + + private fun getStringSafely(jsonObject: JSONObject?, key: String): String { + return jsonObject?.optString(key) ?: "" + } + +} diff --git a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/CrashyModule.java deleted file mode 100644 index 79bc90b511..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/CrashyModule.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_66; - -import com.bugsnag.android.Bugsnag; - -import com.facebook.react.bridge.Promise; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; - -public class CrashyModule extends ReactContextBaseJavaModule { - public CrashyModule(ReactApplicationContext reactContext) { - super(reactContext); - } - - @Override - public String getName() { - return "CrashyCrashy"; - } - - @ReactMethod - public void generateCrash() throws Exception { - throw new Exception("Ooopsy from Java!"); - } - - @ReactMethod - public void generatePromiseRejection(Promise promise) { - promise.reject(new Exception("Oops - rejected promise from Java!")); - } - - @ReactMethod - public void handledError() throws Exception { - Bugsnag.notify(new Exception("Handled ooopsy from Java!")); - } -} diff --git a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/CrashyPackage.java deleted file mode 100644 index ebe7c86702..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/CrashyPackage.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_66; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.JavaScriptModule; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -class CrashyPackage implements ReactPackage { - - public List> createJSModules() { - return Collections.emptyList(); - } - - @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } - - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - - modules.add(new CrashyModule(reactContext)); - - return modules; - } -} - diff --git a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/TestUtils.kt deleted file mode 100644 index e5b1b76966..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_66/android/app/src/main/java/com/rn0_66/TestUtils.kt +++ /dev/null @@ -1,70 +0,0 @@ -package com.rn0_66 - -import android.content.Context -import android.content.pm.PackageManager -import android.util.Log -import org.json.JSONObject -import java.io.File -import java.io.IOException - -const val CONFIG_FILE_TIMEOUT = 15000 -const val BUGSNAG_NS = "com.bugsnag.android" -const val API_KEY = "$BUGSNAG_NS.API_KEY" -const val ENDPOINT_NOTIFY = "$BUGSNAG_NS.ENDPOINT_NOTIFY" -const val ENDPOINT_SESSIONS = "$BUGSNAG_NS.ENDPOINT_SESSIONS" - -class TestUtils { - - fun getMazeRunnerAddress(context: Context): String { - val externalFilesDir = context.getExternalFilesDir(null) - val configFile = File(externalFilesDir, "fixture_config.json") - var mazeAddress: String? = null - Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") - - // Poll for the fixture config file - val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT - while (System.currentTimeMillis() < pollEnd) { - if (configFile.exists()) { - val fileContents = configFile.readText() - val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() - mazeAddress = getStringSafely(fixtureConfig, "maze_address") - if (!mazeAddress.isNullOrBlank()) { - Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") - break - } - } - - Thread.sleep(250) - } - if (mazeAddress.isNullOrBlank()) { - Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") - mazeAddress = "bs-local.com:9339" - } - return mazeAddress - } - - fun loadDefaultParams(ctx: Context): Map { - try { - val packageManager = ctx.packageManager - val packageName = ctx.packageName - val ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) - val data = ai.metaData - if (data != null) { - val default_metadata = hashMapOf( - "apiKey" to data.getString(API_KEY), - "notify" to data.getString(ENDPOINT_NOTIFY), - "sessions" to data.getString(ENDPOINT_SESSIONS) - ) - return default_metadata - } - } catch (exc: Exception) { - throw IllegalStateException("Bugsnag is unable to read config from manifest.", exc) - } - return emptyMap() - } - - private fun getStringSafely(jsonObject: JSONObject?, key: String): String { - return jsonObject?.optString(key) ?: "" - } - -} diff --git a/test/react-native-cli/features/fixtures/rn0_67/android/app/_BUCK b/test/react-native-cli/features/fixtures/rn0_67/android/app/_BUCK index 64f2c3f362..fe3384745e 100644 --- a/test/react-native-cli/features/fixtures/rn0_67/android/app/_BUCK +++ b/test/react-native-cli/features/fixtures/rn0_67/android/app/_BUCK @@ -35,12 +35,12 @@ android_library( android_build_config( name = "build_config", - package = "com.rn0_67", + package = "com.reactnative", ) android_resource( name = "res", - package = "com.rn0_67", + package = "com.reactnative", res = "src/main/res", ) diff --git a/test/react-native-cli/features/fixtures/rn0_67/android/app/build.gradle b/test/react-native-cli/features/fixtures/rn0_67/android/app/build.gradle index ff5542ed31..a7d2200d9f 100644 --- a/test/react-native-cli/features/fixtures/rn0_67/android/app/build.gradle +++ b/test/react-native-cli/features/fixtures/rn0_67/android/app/build.gradle @@ -132,7 +132,7 @@ android { compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { - applicationId "com.rn0_67" + applicationId "com.reactnative" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/AndroidManifest.xml b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/AndroidManifest.xml index 4acdada199..347e6f3ebd 100644 --- a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/AndroidManifest.xml +++ b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.reactnative"> diff --git a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/CrashyModule.java new file mode 100644 index 0000000000..dadcc0a6a9 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/CrashyModule.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.bugsnag.android.Bugsnag; + +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; + +public class CrashyModule extends ReactContextBaseJavaModule { + public CrashyModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return "CrashyCrashy"; + } + + @ReactMethod + public void generateCrash() throws Exception { + throw new Exception("Ooopsy from Java!"); + } + + @ReactMethod + public void generatePromiseRejection(Promise promise) { + promise.reject(new Exception("Oops - rejected promise from Java!")); + } + + @ReactMethod + public void handledError() throws Exception { + Bugsnag.notify(new Exception("Handled ooopsy from Java!")); + } +} diff --git a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/CrashyPackage.java new file mode 100644 index 0000000000..87b7bac258 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/CrashyPackage.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.JavaScriptModule; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +class CrashyPackage implements ReactPackage { + + public List> createJSModules() { + return Collections.emptyList(); + } + + @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } + + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + List modules = new ArrayList<>(); + + modules.add(new CrashyModule(reactContext)); + + return modules; + } +} + diff --git a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/MainActivity.java b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/MainActivity.java similarity index 92% rename from test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/MainActivity.java rename to test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/MainActivity.java index 2ba33f6d3e..823dbd88f8 100644 --- a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/MainActivity.java +++ b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/MainActivity.java @@ -1,4 +1,4 @@ -package com.rn0_67; +package com.reactnative; import com.facebook.react.ReactActivity; diff --git a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/MainApplication.java b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/MainApplication.java similarity index 98% rename from test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/MainApplication.java rename to test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/MainApplication.java index 057100bcbb..a07bb4a603 100644 --- a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/MainApplication.java +++ b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/MainApplication.java @@ -1,4 +1,4 @@ -package com.rn0_67; +package com.reactnative; import com.bugsnag.android.Configuration; import com.bugsnag.android.EndpointConfiguration; diff --git a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/TestUtils.kt new file mode 100644 index 0000000000..4ac45b14fa --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/reactnative/TestUtils.kt @@ -0,0 +1,70 @@ +package com.reactnative + +import android.content.Context +import android.content.pm.PackageManager +import android.util.Log +import org.json.JSONObject +import java.io.File +import java.io.IOException + +const val CONFIG_FILE_TIMEOUT = 15000 +const val BUGSNAG_NS = "com.bugsnag.android" +const val API_KEY = "$BUGSNAG_NS.API_KEY" +const val ENDPOINT_NOTIFY = "$BUGSNAG_NS.ENDPOINT_NOTIFY" +const val ENDPOINT_SESSIONS = "$BUGSNAG_NS.ENDPOINT_SESSIONS" + +class TestUtils { + + fun getMazeRunnerAddress(context: Context): String { + val externalFilesDir = context.getExternalFilesDir(null) + val configFile = File(externalFilesDir, "fixture_config.json") + var mazeAddress: String? = null + Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") + + // Poll for the fixture config file + val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT + while (System.currentTimeMillis() < pollEnd) { + if (configFile.exists()) { + val fileContents = configFile.readText() + val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() + mazeAddress = getStringSafely(fixtureConfig, "maze_address") + if (!mazeAddress.isNullOrBlank()) { + Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") + break + } + } + + Thread.sleep(250) + } + if (mazeAddress.isNullOrBlank()) { + Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") + mazeAddress = "bs-local.com:9339" + } + return mazeAddress + } + + fun loadDefaultParams(ctx: Context): Map { + try { + val packageManager = ctx.packageManager + val packageName = ctx.packageName + val ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) + val data = ai.metaData + if (data != null) { + val default_metadata = hashMapOf( + "apiKey" to data.getString(API_KEY), + "notify" to data.getString(ENDPOINT_NOTIFY), + "sessions" to data.getString(ENDPOINT_SESSIONS) + ) + return default_metadata + } + } catch (exc: Exception) { + throw IllegalStateException("Bugsnag is unable to read config from manifest.", exc) + } + return emptyMap() + } + + private fun getStringSafely(jsonObject: JSONObject?, key: String): String { + return jsonObject?.optString(key) ?: "" + } + +} diff --git a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/CrashyModule.java deleted file mode 100644 index 0d78203846..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/CrashyModule.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_67; - -import com.bugsnag.android.Bugsnag; - -import com.facebook.react.bridge.Promise; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; - -public class CrashyModule extends ReactContextBaseJavaModule { - public CrashyModule(ReactApplicationContext reactContext) { - super(reactContext); - } - - @Override - public String getName() { - return "CrashyCrashy"; - } - - @ReactMethod - public void generateCrash() throws Exception { - throw new Exception("Ooopsy from Java!"); - } - - @ReactMethod - public void generatePromiseRejection(Promise promise) { - promise.reject(new Exception("Oops - rejected promise from Java!")); - } - - @ReactMethod - public void handledError() throws Exception { - Bugsnag.notify(new Exception("Handled ooopsy from Java!")); - } -} diff --git a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/CrashyPackage.java deleted file mode 100644 index 723cd1a355..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/CrashyPackage.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_67; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.JavaScriptModule; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -class CrashyPackage implements ReactPackage { - - public List> createJSModules() { - return Collections.emptyList(); - } - - @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } - - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - - modules.add(new CrashyModule(reactContext)); - - return modules; - } -} - diff --git a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/TestUtils.kt deleted file mode 100644 index 67062d7810..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_67/android/app/src/main/java/com/rn0_67/TestUtils.kt +++ /dev/null @@ -1,70 +0,0 @@ -package com.rn0_67 - -import android.content.Context -import android.content.pm.PackageManager -import android.util.Log -import org.json.JSONObject -import java.io.File -import java.io.IOException - -const val CONFIG_FILE_TIMEOUT = 15000 -const val BUGSNAG_NS = "com.bugsnag.android" -const val API_KEY = "$BUGSNAG_NS.API_KEY" -const val ENDPOINT_NOTIFY = "$BUGSNAG_NS.ENDPOINT_NOTIFY" -const val ENDPOINT_SESSIONS = "$BUGSNAG_NS.ENDPOINT_SESSIONS" - -class TestUtils { - - fun getMazeRunnerAddress(context: Context): String { - val externalFilesDir = context.getExternalFilesDir(null) - val configFile = File(externalFilesDir, "fixture_config.json") - var mazeAddress: String? = null - Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") - - // Poll for the fixture config file - val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT - while (System.currentTimeMillis() < pollEnd) { - if (configFile.exists()) { - val fileContents = configFile.readText() - val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() - mazeAddress = getStringSafely(fixtureConfig, "maze_address") - if (!mazeAddress.isNullOrBlank()) { - Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") - break - } - } - - Thread.sleep(250) - } - if (mazeAddress.isNullOrBlank()) { - Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") - mazeAddress = "bs-local.com:9339" - } - return mazeAddress - } - - fun loadDefaultParams(ctx: Context): Map { - try { - val packageManager = ctx.packageManager - val packageName = ctx.packageName - val ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) - val data = ai.metaData - if (data != null) { - val default_metadata = hashMapOf( - "apiKey" to data.getString(API_KEY), - "notify" to data.getString(ENDPOINT_NOTIFY), - "sessions" to data.getString(ENDPOINT_SESSIONS) - ) - return default_metadata - } - } catch (exc: Exception) { - throw IllegalStateException("Bugsnag is unable to read config from manifest.", exc) - } - return emptyMap() - } - - private fun getStringSafely(jsonObject: JSONObject?, key: String): String { - return jsonObject?.optString(key) ?: "" - } - -} diff --git a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/_BUCK b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/_BUCK index 9dfe5362d1..fe3384745e 100644 --- a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/_BUCK +++ b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/_BUCK @@ -35,12 +35,12 @@ android_library( android_build_config( name = "build_config", - package = "com.rn0_67_hermes", + package = "com.reactnative", ) android_resource( name = "res", - package = "com.rn0_67_hermes", + package = "com.reactnative", res = "src/main/res", ) diff --git a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/build.gradle b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/build.gradle index f45c92ba0d..1731ea2dfc 100644 --- a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/build.gradle +++ b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/build.gradle @@ -132,7 +132,7 @@ android { compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { - applicationId "com.rn0_67_hermes" + applicationId "com.reactnative" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/AndroidManifest.xml b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/AndroidManifest.xml index 4cc3a2870e..347e6f3ebd 100644 --- a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/AndroidManifest.xml +++ b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.reactnative"> diff --git a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/CrashyModule.java new file mode 100644 index 0000000000..dadcc0a6a9 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/CrashyModule.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.bugsnag.android.Bugsnag; + +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; + +public class CrashyModule extends ReactContextBaseJavaModule { + public CrashyModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return "CrashyCrashy"; + } + + @ReactMethod + public void generateCrash() throws Exception { + throw new Exception("Ooopsy from Java!"); + } + + @ReactMethod + public void generatePromiseRejection(Promise promise) { + promise.reject(new Exception("Oops - rejected promise from Java!")); + } + + @ReactMethod + public void handledError() throws Exception { + Bugsnag.notify(new Exception("Handled ooopsy from Java!")); + } +} diff --git a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/CrashyPackage.java new file mode 100644 index 0000000000..87b7bac258 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/CrashyPackage.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.JavaScriptModule; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +class CrashyPackage implements ReactPackage { + + public List> createJSModules() { + return Collections.emptyList(); + } + + @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } + + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + List modules = new ArrayList<>(); + + modules.add(new CrashyModule(reactContext)); + + return modules; + } +} + diff --git a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/MainActivity.java b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/MainActivity.java similarity index 92% rename from test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/MainActivity.java rename to test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/MainActivity.java index b30facf192..2d81ca8db3 100644 --- a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/MainActivity.java +++ b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/MainActivity.java @@ -1,4 +1,4 @@ -package com.rn0_67_hermes; +package com.reactnative; import com.facebook.react.ReactActivity; diff --git a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/MainApplication.java b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/MainApplication.java similarity index 98% rename from test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/MainApplication.java rename to test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/MainApplication.java index b9d2e83b35..a07bb4a603 100644 --- a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/MainApplication.java +++ b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/MainApplication.java @@ -1,4 +1,4 @@ -package com.rn0_67_hermes; +package com.reactnative; import com.bugsnag.android.Configuration; import com.bugsnag.android.EndpointConfiguration; diff --git a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/TestUtils.kt new file mode 100644 index 0000000000..4ac45b14fa --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/reactnative/TestUtils.kt @@ -0,0 +1,70 @@ +package com.reactnative + +import android.content.Context +import android.content.pm.PackageManager +import android.util.Log +import org.json.JSONObject +import java.io.File +import java.io.IOException + +const val CONFIG_FILE_TIMEOUT = 15000 +const val BUGSNAG_NS = "com.bugsnag.android" +const val API_KEY = "$BUGSNAG_NS.API_KEY" +const val ENDPOINT_NOTIFY = "$BUGSNAG_NS.ENDPOINT_NOTIFY" +const val ENDPOINT_SESSIONS = "$BUGSNAG_NS.ENDPOINT_SESSIONS" + +class TestUtils { + + fun getMazeRunnerAddress(context: Context): String { + val externalFilesDir = context.getExternalFilesDir(null) + val configFile = File(externalFilesDir, "fixture_config.json") + var mazeAddress: String? = null + Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") + + // Poll for the fixture config file + val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT + while (System.currentTimeMillis() < pollEnd) { + if (configFile.exists()) { + val fileContents = configFile.readText() + val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() + mazeAddress = getStringSafely(fixtureConfig, "maze_address") + if (!mazeAddress.isNullOrBlank()) { + Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") + break + } + } + + Thread.sleep(250) + } + if (mazeAddress.isNullOrBlank()) { + Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") + mazeAddress = "bs-local.com:9339" + } + return mazeAddress + } + + fun loadDefaultParams(ctx: Context): Map { + try { + val packageManager = ctx.packageManager + val packageName = ctx.packageName + val ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) + val data = ai.metaData + if (data != null) { + val default_metadata = hashMapOf( + "apiKey" to data.getString(API_KEY), + "notify" to data.getString(ENDPOINT_NOTIFY), + "sessions" to data.getString(ENDPOINT_SESSIONS) + ) + return default_metadata + } + } catch (exc: Exception) { + throw IllegalStateException("Bugsnag is unable to read config from manifest.", exc) + } + return emptyMap() + } + + private fun getStringSafely(jsonObject: JSONObject?, key: String): String { + return jsonObject?.optString(key) ?: "" + } + +} diff --git a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/CrashyModule.java deleted file mode 100644 index 6fd84eb1df..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/CrashyModule.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_67_hermes; - -import com.bugsnag.android.Bugsnag; - -import com.facebook.react.bridge.Promise; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; - -public class CrashyModule extends ReactContextBaseJavaModule { - public CrashyModule(ReactApplicationContext reactContext) { - super(reactContext); - } - - @Override - public String getName() { - return "CrashyCrashy"; - } - - @ReactMethod - public void generateCrash() throws Exception { - throw new Exception("Ooopsy from Java!"); - } - - @ReactMethod - public void generatePromiseRejection(Promise promise) { - promise.reject(new Exception("Oops - rejected promise from Java!")); - } - - @ReactMethod - public void handledError() throws Exception { - Bugsnag.notify(new Exception("Handled ooopsy from Java!")); - } -} diff --git a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/CrashyPackage.java deleted file mode 100644 index 2eb119ed18..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/CrashyPackage.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_67_hermes; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.JavaScriptModule; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -class CrashyPackage implements ReactPackage { - - public List> createJSModules() { - return Collections.emptyList(); - } - - @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } - - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - - modules.add(new CrashyModule(reactContext)); - - return modules; - } -} - diff --git a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/TestUtils.kt deleted file mode 100644 index 15320cc7cc..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_67_hermes/android/app/src/main/java/com/rn0_67_hermes/TestUtils.kt +++ /dev/null @@ -1,70 +0,0 @@ -package com.rn0_67_hermes - -import android.content.Context -import android.content.pm.PackageManager -import android.util.Log -import org.json.JSONObject -import java.io.File -import java.io.IOException - -const val CONFIG_FILE_TIMEOUT = 15000 -const val BUGSNAG_NS = "com.bugsnag.android" -const val API_KEY = "$BUGSNAG_NS.API_KEY" -const val ENDPOINT_NOTIFY = "$BUGSNAG_NS.ENDPOINT_NOTIFY" -const val ENDPOINT_SESSIONS = "$BUGSNAG_NS.ENDPOINT_SESSIONS" - -class TestUtils { - - fun getMazeRunnerAddress(context: Context): String { - val externalFilesDir = context.getExternalFilesDir(null) - val configFile = File(externalFilesDir, "fixture_config.json") - var mazeAddress: String? = null - Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") - - // Poll for the fixture config file - val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT - while (System.currentTimeMillis() < pollEnd) { - if (configFile.exists()) { - val fileContents = configFile.readText() - val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() - mazeAddress = getStringSafely(fixtureConfig, "maze_address") - if (!mazeAddress.isNullOrBlank()) { - Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") - break - } - } - - Thread.sleep(250) - } - if (mazeAddress.isNullOrBlank()) { - Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") - mazeAddress = "bs-local.com:9339" - } - return mazeAddress - } - - fun loadDefaultParams(ctx: Context): Map { - try { - val packageManager = ctx.packageManager - val packageName = ctx.packageName - val ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) - val data = ai.metaData - if (data != null) { - val default_metadata = hashMapOf( - "apiKey" to data.getString(API_KEY), - "notify" to data.getString(ENDPOINT_NOTIFY), - "sessions" to data.getString(ENDPOINT_SESSIONS) - ) - return default_metadata - } - } catch (exc: Exception) { - throw IllegalStateException("Bugsnag is unable to read config from manifest.", exc) - } - return emptyMap() - } - - private fun getStringSafely(jsonObject: JSONObject?, key: String): String { - return jsonObject?.optString(key) ?: "" - } - -} diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/_BUCK b/test/react-native-cli/features/fixtures/rn0_69/android/app/_BUCK index d49d886df6..fe3384745e 100644 --- a/test/react-native-cli/features/fixtures/rn0_69/android/app/_BUCK +++ b/test/react-native-cli/features/fixtures/rn0_69/android/app/_BUCK @@ -35,12 +35,12 @@ android_library( android_build_config( name = "build_config", - package = "com.rn0_69", + package = "com.reactnative", ) android_resource( name = "res", - package = "com.rn0_69", + package = "com.reactnative", res = "src/main/res", ) diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/build.gradle b/test/react-native-cli/features/fixtures/rn0_69/android/app/build.gradle index 1a8fb1c8bb..bce7fd9599 100644 --- a/test/react-native-cli/features/fixtures/rn0_69/android/app/build.gradle +++ b/test/react-native-cli/features/fixtures/rn0_69/android/app/build.gradle @@ -135,7 +135,7 @@ android { compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { - applicationId "com.rn0_69" + applicationId "com.reactnative" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/AndroidManifest.xml b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/AndroidManifest.xml index fc7cc11de3..8b44777c9c 100644 --- a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/AndroidManifest.xml +++ b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.reactnative"> diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/CrashyModule.java new file mode 100644 index 0000000000..dadcc0a6a9 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/CrashyModule.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.bugsnag.android.Bugsnag; + +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; + +public class CrashyModule extends ReactContextBaseJavaModule { + public CrashyModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return "CrashyCrashy"; + } + + @ReactMethod + public void generateCrash() throws Exception { + throw new Exception("Ooopsy from Java!"); + } + + @ReactMethod + public void generatePromiseRejection(Promise promise) { + promise.reject(new Exception("Oops - rejected promise from Java!")); + } + + @ReactMethod + public void handledError() throws Exception { + Bugsnag.notify(new Exception("Handled ooopsy from Java!")); + } +} diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/CrashyPackage.java new file mode 100644 index 0000000000..87b7bac258 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/CrashyPackage.java @@ -0,0 +1,34 @@ +package com.reactnative; + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.JavaScriptModule; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +class CrashyPackage implements ReactPackage { + + public List> createJSModules() { + return Collections.emptyList(); + } + + @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } + + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + List modules = new ArrayList<>(); + + modules.add(new CrashyModule(reactContext)); + + return modules; + } +} + diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/MainActivity.java b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/MainActivity.java similarity index 98% rename from test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/MainActivity.java rename to test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/MainActivity.java index fe9e234c27..fdab0ffe0e 100644 --- a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/MainActivity.java +++ b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/MainActivity.java @@ -1,4 +1,4 @@ -package com.rn0_69; +package com.reactnative; import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/MainApplication.java b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/MainApplication.java similarity index 96% rename from test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/MainApplication.java rename to test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/MainApplication.java index 5b122d4836..b8baaa13fd 100644 --- a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/MainApplication.java +++ b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/MainApplication.java @@ -1,4 +1,4 @@ -package com.rn0_69; +package com.reactnative; import com.bugsnag.android.Configuration; import com.bugsnag.android.EndpointConfiguration; @@ -13,7 +13,7 @@ import com.facebook.react.ReactPackage; import com.facebook.react.config.ReactFeatureFlags; import com.facebook.soloader.SoLoader; -import com.rn0_69.newarchitecture.MainApplicationReactNativeHost; +import com.reactnative.newarchitecture.MainApplicationReactNativeHost; import java.lang.reflect.InvocationTargetException; import java.util.List; diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/TestUtils.kt new file mode 100644 index 0000000000..4ac45b14fa --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/TestUtils.kt @@ -0,0 +1,70 @@ +package com.reactnative + +import android.content.Context +import android.content.pm.PackageManager +import android.util.Log +import org.json.JSONObject +import java.io.File +import java.io.IOException + +const val CONFIG_FILE_TIMEOUT = 15000 +const val BUGSNAG_NS = "com.bugsnag.android" +const val API_KEY = "$BUGSNAG_NS.API_KEY" +const val ENDPOINT_NOTIFY = "$BUGSNAG_NS.ENDPOINT_NOTIFY" +const val ENDPOINT_SESSIONS = "$BUGSNAG_NS.ENDPOINT_SESSIONS" + +class TestUtils { + + fun getMazeRunnerAddress(context: Context): String { + val externalFilesDir = context.getExternalFilesDir(null) + val configFile = File(externalFilesDir, "fixture_config.json") + var mazeAddress: String? = null + Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") + + // Poll for the fixture config file + val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT + while (System.currentTimeMillis() < pollEnd) { + if (configFile.exists()) { + val fileContents = configFile.readText() + val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() + mazeAddress = getStringSafely(fixtureConfig, "maze_address") + if (!mazeAddress.isNullOrBlank()) { + Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") + break + } + } + + Thread.sleep(250) + } + if (mazeAddress.isNullOrBlank()) { + Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") + mazeAddress = "bs-local.com:9339" + } + return mazeAddress + } + + fun loadDefaultParams(ctx: Context): Map { + try { + val packageManager = ctx.packageManager + val packageName = ctx.packageName + val ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) + val data = ai.metaData + if (data != null) { + val default_metadata = hashMapOf( + "apiKey" to data.getString(API_KEY), + "notify" to data.getString(ENDPOINT_NOTIFY), + "sessions" to data.getString(ENDPOINT_SESSIONS) + ) + return default_metadata + } + } catch (exc: Exception) { + throw IllegalStateException("Bugsnag is unable to read config from manifest.", exc) + } + return emptyMap() + } + + private fun getStringSafely(jsonObject: JSONObject?, key: String): String { + return jsonObject?.optString(key) ?: "" + } + +} diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/newarchitecture/MainApplicationReactNativeHost.java b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/newarchitecture/MainApplicationReactNativeHost.java similarity index 94% rename from test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/newarchitecture/MainApplicationReactNativeHost.java rename to test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/newarchitecture/MainApplicationReactNativeHost.java index aa2c1719db..4f508d311d 100644 --- a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/newarchitecture/MainApplicationReactNativeHost.java +++ b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/newarchitecture/MainApplicationReactNativeHost.java @@ -1,4 +1,4 @@ -package com.rn0_69.newarchitecture; +package com.reactnative.newarchitecture; import android.app.Application; import androidx.annotation.NonNull; @@ -19,9 +19,9 @@ import com.facebook.react.fabric.FabricJSIModuleProvider; import com.facebook.react.fabric.ReactNativeConfig; import com.facebook.react.uimanager.ViewManagerRegistry; -import com.rn0_69.BuildConfig; -import com.rn0_69.newarchitecture.components.MainComponentsRegistry; -import com.rn0_69.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate; +import com.reactnative.BuildConfig; +import com.reactnative.newarchitecture.components.MainComponentsRegistry; +import com.reactnative.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate; import java.util.ArrayList; import java.util.List; diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/newarchitecture/components/MainComponentsRegistry.java b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/newarchitecture/components/MainComponentsRegistry.java similarity index 95% rename from test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/newarchitecture/components/MainComponentsRegistry.java rename to test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/newarchitecture/components/MainComponentsRegistry.java index 10cd211c0a..ae22a393d4 100644 --- a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/newarchitecture/components/MainComponentsRegistry.java +++ b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/newarchitecture/components/MainComponentsRegistry.java @@ -1,4 +1,4 @@ -package com.rn0_69.newarchitecture.components; +package com.reactnative.newarchitecture.components; import com.facebook.jni.HybridData; import com.facebook.proguard.annotations.DoNotStrip; diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java similarity index 97% rename from test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java rename to test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java index 2428e9d994..6b4653919d 100644 --- a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java +++ b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/reactnative/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java @@ -1,4 +1,4 @@ -package com.rn0_69.newarchitecture.modules; +package com.reactnative.newarchitecture.modules; import com.facebook.jni.HybridData; import com.facebook.react.ReactPackage; diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/CrashyModule.java b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/CrashyModule.java deleted file mode 100644 index a1f956ef09..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/CrashyModule.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_69; - -import com.bugsnag.android.Bugsnag; - -import com.facebook.react.bridge.Promise; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; - -public class CrashyModule extends ReactContextBaseJavaModule { - public CrashyModule(ReactApplicationContext reactContext) { - super(reactContext); - } - - @Override - public String getName() { - return "CrashyCrashy"; - } - - @ReactMethod - public void generateCrash() throws Exception { - throw new Exception("Ooopsy from Java!"); - } - - @ReactMethod - public void generatePromiseRejection(Promise promise) { - promise.reject(new Exception("Oops - rejected promise from Java!")); - } - - @ReactMethod - public void handledError() throws Exception { - Bugsnag.notify(new Exception("Handled ooopsy from Java!")); - } -} diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/CrashyPackage.java b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/CrashyPackage.java deleted file mode 100644 index 0ecfe56cf8..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/CrashyPackage.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.rn0_69; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.JavaScriptModule; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -class CrashyPackage implements ReactPackage { - - public List> createJSModules() { - return Collections.emptyList(); - } - - @SuppressWarnings("rawtypes") // the ReactPackage interface uses a raw type, ignore it - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } - - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - - modules.add(new CrashyModule(reactContext)); - - return modules; - } -} - diff --git a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/TestUtils.kt b/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/TestUtils.kt deleted file mode 100644 index 8e72dd2e75..0000000000 --- a/test/react-native-cli/features/fixtures/rn0_69/android/app/src/main/java/com/rn0_69/TestUtils.kt +++ /dev/null @@ -1,70 +0,0 @@ -package com.rn0_69 - -import android.content.Context -import android.content.pm.PackageManager -import android.util.Log -import org.json.JSONObject -import java.io.File -import java.io.IOException - -const val CONFIG_FILE_TIMEOUT = 15000 -const val BUGSNAG_NS = "com.bugsnag.android" -const val API_KEY = "$BUGSNAG_NS.API_KEY" -const val ENDPOINT_NOTIFY = "$BUGSNAG_NS.ENDPOINT_NOTIFY" -const val ENDPOINT_SESSIONS = "$BUGSNAG_NS.ENDPOINT_SESSIONS" - -class TestUtils { - - fun getMazeRunnerAddress(context: Context): String { - val externalFilesDir = context.getExternalFilesDir(null) - val configFile = File(externalFilesDir, "fixture_config.json") - var mazeAddress: String? = null - Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") - - // Poll for the fixture config file - val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT - while (System.currentTimeMillis() < pollEnd) { - if (configFile.exists()) { - val fileContents = configFile.readText() - val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() - mazeAddress = getStringSafely(fixtureConfig, "maze_address") - if (!mazeAddress.isNullOrBlank()) { - Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") - break - } - } - - Thread.sleep(250) - } - if (mazeAddress.isNullOrBlank()) { - Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") - mazeAddress = "bs-local.com:9339" - } - return mazeAddress - } - - fun loadDefaultParams(ctx: Context): Map { - try { - val packageManager = ctx.packageManager - val packageName = ctx.packageName - val ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) - val data = ai.metaData - if (data != null) { - val default_metadata = hashMapOf( - "apiKey" to data.getString(API_KEY), - "notify" to data.getString(ENDPOINT_NOTIFY), - "sessions" to data.getString(ENDPOINT_SESSIONS) - ) - return default_metadata - } - } catch (exc: Exception) { - throw IllegalStateException("Bugsnag is unable to read config from manifest.", exc) - } - return emptyMap() - } - - private fun getStringSafely(jsonObject: JSONObject?, key: String): String { - return jsonObject?.optString(key) ?: "" - } - -} diff --git a/test/react-native/features/fixtures/rn0.60/android/app/src/main/AndroidManifest.xml b/test/react-native/features/fixtures/rn0.60/android/app/src/main/AndroidManifest.xml index d58cb7ba7b..b4d26d6e50 100644 --- a/test/react-native/features/fixtures/rn0.60/android/app/src/main/AndroidManifest.xml +++ b/test/react-native/features/fixtures/rn0.60/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.reactnative"> diff --git a/test/react-native/features/fixtures/rn0.60/android/app/src/main/java/com/rn060/MainActivity.java b/test/react-native/features/fixtures/rn0.60/android/app/src/main/java/com/reactnative/MainActivity.java similarity index 97% rename from test/react-native/features/fixtures/rn0.60/android/app/src/main/java/com/rn060/MainActivity.java rename to test/react-native/features/fixtures/rn0.60/android/app/src/main/java/com/reactnative/MainActivity.java index b492fc5fa0..c0c465705d 100644 --- a/test/react-native/features/fixtures/rn0.60/android/app/src/main/java/com/rn060/MainActivity.java +++ b/test/react-native/features/fixtures/rn0.60/android/app/src/main/java/com/reactnative/MainActivity.java @@ -1,4 +1,4 @@ -package com.rn060; +package com.reactnative; import android.content.Intent; import android.os.Bundle; diff --git a/test/react-native/features/fixtures/rn0.60/android/app/src/main/java/com/rn060/MainApplication.java b/test/react-native/features/fixtures/rn0.60/android/app/src/main/java/com/reactnative/MainApplication.java similarity index 98% rename from test/react-native/features/fixtures/rn0.60/android/app/src/main/java/com/rn060/MainApplication.java rename to test/react-native/features/fixtures/rn0.60/android/app/src/main/java/com/reactnative/MainApplication.java index b40a0964fd..32830c2acf 100644 --- a/test/react-native/features/fixtures/rn0.60/android/app/src/main/java/com/rn060/MainApplication.java +++ b/test/react-native/features/fixtures/rn0.60/android/app/src/main/java/com/reactnative/MainApplication.java @@ -1,4 +1,4 @@ -package com.rn060; +package com.reactnative; import android.app.Application; import android.util.Log;