@react-native-firebase/app-check 14.2.4 → 14.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [14.3.0](https://github.com/invertase/react-native-firebase/compare/v14.2.4...v14.3.0) (2022-01-26)
7
+
8
+ ### Features
9
+
10
+ - **app-check:** android debug token argument for app-check ([#6026](https://github.com/invertase/react-native-firebase/issues/6026)) ([6f67503](https://github.com/invertase/react-native-firebase/commit/6f6750309cc6b275772cb9c1bac7e67c2eb7d4ba))
11
+
6
12
  ## [14.2.4](https://github.com/invertase/react-native-firebase/compare/v14.2.3...v14.2.4) (2022-01-24)
7
13
 
8
14
  **Note:** Version bump only for package @react-native-firebase/app-check
@@ -66,6 +66,9 @@ project.ext {
66
66
  android {
67
67
  defaultConfig {
68
68
  multiDexEnabled true
69
+ // Here we add a build config field to allow devs to provide a
70
+ // FIREBASE_APP_CHECK_DEBUG_TOKEN to be used in debug mode.
71
+ buildConfigField "String", "FIREBASE_APP_CHECK_DEBUG_TOKEN", "\"${System.env.FIREBASE_APP_CHECK_DEBUG_TOKEN}\""
69
72
  }
70
73
  lintOptions {
71
74
  disable 'GradleCompatible'
@@ -23,10 +23,12 @@ import android.util.Log;
23
23
  import com.facebook.react.bridge.*;
24
24
  import com.google.android.gms.tasks.Tasks;
25
25
  import com.google.firebase.FirebaseApp;
26
+ import com.google.firebase.appcheck.AppCheckProviderFactory;
26
27
  import com.google.firebase.appcheck.FirebaseAppCheck;
27
28
  import com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory;
28
29
  import com.google.firebase.appcheck.safetynet.SafetyNetAppCheckProviderFactory;
29
30
  import io.invertase.firebase.common.ReactNativeFirebaseModule;
31
+ import java.lang.reflect.*;
30
32
 
31
33
  public class ReactNativeFirebaseAppCheckModule extends ReactNativeFirebaseModule {
32
34
  private static final String TAG = "AppCheck";
@@ -51,7 +53,26 @@ public class ReactNativeFirebaseAppCheckModule extends ReactNativeFirebaseModule
51
53
  }
52
54
 
53
55
  if (isDebuggable) {
54
- firebaseAppCheck.installAppCheckProviderFactory(DebugAppCheckProviderFactory.getInstance());
56
+
57
+ if (BuildConfig.FIREBASE_APP_CHECK_DEBUG_TOKEN != "null") {
58
+ // Get DebugAppCheckProviderFactory class
59
+ Class<DebugAppCheckProviderFactory> debugACFactoryClass =
60
+ DebugAppCheckProviderFactory.class;
61
+
62
+ // Get the (undocumented) constructor accepting a debug token as string
63
+ Class<?>[] argType = {String.class};
64
+ Constructor c = debugACFactoryClass.getDeclaredConstructor(argType);
65
+
66
+ // Create a object containing the constructor arguments
67
+ // and initialize a new instance.
68
+ Object[] cArgs = {BuildConfig.FIREBASE_APP_CHECK_DEBUG_TOKEN};
69
+ firebaseAppCheck.installAppCheckProviderFactory(
70
+ (AppCheckProviderFactory) c.newInstance(cArgs));
71
+ } else {
72
+ firebaseAppCheck.installAppCheckProviderFactory(
73
+ DebugAppCheckProviderFactory.getInstance());
74
+ }
75
+
55
76
  } else {
56
77
  firebaseAppCheck.installAppCheckProviderFactory(
57
78
  SafetyNetAppCheckProviderFactory.getInstance());
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- module.exports = '14.2.4';
2
+ module.exports = '14.3.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/app-check",
3
- "version": "14.2.4",
3
+ "version": "14.3.0",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - App Check",
6
6
  "main": "lib/index.js",
@@ -23,10 +23,10 @@
23
23
  "appCheck"
24
24
  ],
25
25
  "peerDependencies": {
26
- "@react-native-firebase/app": "14.2.4"
26
+ "@react-native-firebase/app": "14.3.0"
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
- "gitHead": "ef4189597f21955266a444e39700b5f0c13ea30a"
31
+ "gitHead": "240cabb06b34af67f20a68db4e1d9247eb7b6903"
32
32
  }