microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.98k stars 1.47k forks source link

How to load react-native-code-push after root node & app launch? #2557

Closed emclab closed 9 months ago

emclab commented 1 year ago

My React Native 0.70 app uses react-native-code-push 7.1.0. And the way it was integrated into the React Native app happens at the index.js:

/**
 * @format
 */
import 'react-native-gesture-handler';
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import codePush from "react-native-code-push";  //code push

AppRegistry.registerComponent(appName, () => codePush(App));

I was told by app reviewer that codePush is retrieving user's ANDROIDID (red flag) before his/her consent (as index.js is the first module loaded when app is launched). I was told that a popup window asking for users' consent before the code push is needed. There are 2 questions. 1. Does code push depends on user's ANDROIDID to work. 2. If it does, how to load the code push module later on after users' consent (After the app has checked if there is users' consent and will be a few components after index.js).

Here is the app call stack provided by the reviewer:

[com.microsoft.codepush.react.CodePushNativeModule.<init>(CodePushNativeModule.java:63),
 com.microsoft.codepush.react.CodePush.createNativeModules(CodePush.java:414),
 com.facebook.react.ReactPackageHelper.getNativeModuleIterator(ReactPackageHelper.java:42),
 com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:42),
 com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1456),
 com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1427),
 com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1338),
 com.facebook.react.ReactInstanceManager.access$1200(ReactInstanceManager.java:136),
 com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1108),
 java.lang.Thread.run(Thread.java:933)]

Environment

(The more info the faster we will be able to address it!)

emclab commented 1 year ago

Here is the code line in CodePushNativeModule.java line 63:

mClientUniqueId = Settings.Secure.getString(reactContext.getContentResolver(), Settings.Secure.ANDROID_ID);

Is it retrieving the ANDROIDID?

MikhailSuendukov commented 9 months ago

Hello @emclab and thanks for reaching out to us, the fact is that a fix for this problem has already been implemented, and it was released along with the 8.1.1 version of react-native-code-push, so I am closing this issue, but if you have any other questions feel free to reopen it.