Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):
What you expected to happen?
codePush(App) does not check or download anything in debug mode.
What actually happens?
I have codePush function in my root app.js as this:
codePush({
checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
installMode: codePush.InstallMode.ON_NEXT_RESUME,
})(App)
I expected none of [CodePush] logs be seen in debug mode after implementing 'multi-deployment testing', but it seems to keep run and give some error as below
[Mon Sep 14 2020 15:29:13.715] LOG [CodePush] Checking for update.
[Mon Sep 14 2020 15:29:14.690] LOG [CodePush] An unknown error occurred.
[Mon Sep 14 2020 15:29:14.695] LOG [CodePush] 400: An update check must include a valid deployment key - please check that your app has been configured correctly. To view available deployment keys, run 'code-push deployment ls <appName> -k'.
I think I can handle this by getting the default codePushDeploymentKey from device on runtime(return a non-codepush-ifyed app component if it gives a empty key), but I cannot find any API reference which gives the deploymentkey value or status.
I'm always getting those [CodePush] LOGs in every refresh(since I configured as codepush to run on app-resume), and it pretty disturbs me on debugging.
I don't want to commentize codePush(App) part back and forth for every iteration.
Is there any way to not run codepush in debug mode?
Examples folder run node create-app.js appName [email protected] [email protected] command to generate plain CodePushified React Native app. Please see description on top of create-app.js file content if neededSystem:
OS: macOS 10.15.6
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.9.0 - /usr/local/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.7 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6514223
Xcode: 11.7/11E801a - /usr/bin/xcodebuild
npmPackages:
react: 16.13.1 => 16.13.1
react-dom: ^16.13.1 => 16.13.1
react-native: 0.63.2 => 0.63.2
react-native-web: ^0.13.9 => 0.13.9
(The more info the faster we will be able to address it!)
Just use:
if (!__DEV__) {
codePush({
checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
installMode: codePush.InstallMode.ON_NEXT_RESUME,
})(App)
}
I don't even know that there was global variable __DEV__ haha...
Thank you so much!
Just use:
if (!__DEV__) { codePush({ checkFrequency: codePush.CheckFrequency.ON_APP_RESUME, installMode: codePush.InstallMode.ON_NEXT_RESUME, })(App) }
Where should I put this code?
Might wanna do something like this, this goes in the root component file, likely called App.js/App.tsx.
const codePushOptions = {
checkFrequency: __DEV__ ? codePush.CheckFrequency.MANUAL : codePush.CheckFrequency.ON_APP_RESUME,
// other options
};
export default codePush(codePushOptions)(App);
Most helpful comment
Just use: