mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-16 11:50:32 +08:00
Merge pull request #176 from Microsoft/disable-metrics-in-debug
Disable metrics in debug
This commit is contained in:
@@ -137,6 +137,11 @@ function log(message) {
|
||||
|
||||
async function notifyApplicationReady() {
|
||||
await NativeCodePush.notifyApplicationReady();
|
||||
if (__DEV__) {
|
||||
// Don't report metrics if in DEV mode.
|
||||
return;
|
||||
}
|
||||
|
||||
const statusReport = await NativeCodePush.getNewStatusReport();
|
||||
if (statusReport) {
|
||||
const config = await getConfiguration();
|
||||
|
||||
@@ -512,10 +512,6 @@ RCT_EXPORT_METHOD(notifyApplicationReady:(RCTPromiseResolveBlock)resolve
|
||||
RCT_EXPORT_METHOD(getNewStatusReport:(RCTPromiseResolveBlock)resolve
|
||||
rejecter:(RCTPromiseRejectBlock)reject)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// Do not report metrics if running in debug mode.
|
||||
resolve(nil);
|
||||
#else
|
||||
if ([_bridge.bundleURL.scheme hasPrefix:@"http"]) {
|
||||
// Do not report metrics if running bundle from packager.
|
||||
resolve(nil);
|
||||
@@ -549,7 +545,6 @@ RCT_EXPORT_METHOD(getNewStatusReport:(RCTPromiseResolveBlock)resolve
|
||||
|
||||
resolve(nil);
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -426,11 +426,6 @@ public class CodePush {
|
||||
|
||||
@ReactMethod
|
||||
public void getNewStatusReport(final Promise promise) {
|
||||
if (isDebugMode) {
|
||||
// Do not report metrics if running in debug mode.
|
||||
promise.resolve("");
|
||||
return;
|
||||
}
|
||||
|
||||
AsyncTask asyncTask = new AsyncTask() {
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,8 @@ module.exports = (NativeCodePush) => {
|
||||
// so that the client knows what the current package version is.
|
||||
try {
|
||||
const downloadedPackage = await NativeCodePush.downloadUpdate(this);
|
||||
reportStatusDownload && reportStatusDownload(this);
|
||||
// Don't report metrics if in DEV mode.
|
||||
!__DEV__ && reportStatusDownload && reportStatusDownload(this);
|
||||
return { ...downloadedPackage, ...local };
|
||||
} finally {
|
||||
downloadProgressSubscription && downloadProgressSubscription.remove();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-code-push",
|
||||
"version": "1.6.0-beta",
|
||||
"version": "1.7.0-beta",
|
||||
"description": "React Native plugin for the CodePush service",
|
||||
"main": "CodePush.js",
|
||||
"homepage": "https://microsoft.github.io/code-push",
|
||||
@@ -20,6 +20,6 @@
|
||||
"semver": "^5.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"react-native": "0.15.0"
|
||||
"react-native": "0.19.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user