From b1babeb510e695e881f4e0624275fbb64c98d455 Mon Sep 17 00:00:00 2001 From: Geoffrey Goh Date: Tue, 2 Feb 2016 15:15:17 -0800 Subject: [PATCH] disable-metrics-in-debug --- CodePush.js | 5 +++++ CodePush.m | 6 +++++- android/app/build.gradle | 6 +++--- package-mixins.js | 3 ++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CodePush.js b/CodePush.js index b95296a..79821f9 100644 --- a/CodePush.js +++ b/CodePush.js @@ -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(); diff --git a/CodePush.m b/CodePush.m index 2059fac..5ede292 100644 --- a/CodePush.m +++ b/CodePush.m @@ -512,6 +512,10 @@ RCT_EXPORT_METHOD(notifyApplicationReady:(RCTPromiseResolveBlock)resolve RCT_EXPORT_METHOD(getNewStatusReport:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { + if ([_bridge.bundleURL.scheme hasPrefix:@"http"]) { + resolve(nil); + return; + } dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ if (needToReportRollback) { @@ -532,7 +536,7 @@ RCT_EXPORT_METHOD(getNewStatusReport:(RCTPromiseResolveBlock)resolve resolve([CodePushTelemetryManager getUpdateReport:currentPackage]); return; } - } else if (isRunningBinaryVersion || [_bridge.bundleURL.scheme hasPrefix:@"http"]) { + } else if (isRunningBinaryVersion) { // Check if the current appVersion has been reported. NSString *appVersion = [[CodePushConfig current] appVersion]; resolve([CodePushTelemetryManager getBinaryUpdateReport:appVersion]); diff --git a/android/app/build.gradle b/android/app/build.gradle index 3dc2a4e..6ba6398 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -22,7 +22,7 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:23.0.0' - compile 'com.facebook.react:react-native:0.15.1' + compile fileTree(dir: "libs", include: ["*.jar"]) + compile "com.android.support:appcompat-v7:23.0.1" + compile "com.facebook.react:react-native:0.19.+" } \ No newline at end of file diff --git a/package-mixins.js b/package-mixins.js index 6078bee..fb68ead 100644 --- a/package-mixins.js +++ b/package-mixins.js @@ -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();