Skip to content

Commit 201e961

Browse files
committed
Merge pull request #175 from Microsoft/disable-metrics-in-debug
Disable metrics reporting in debug mode
2 parents 3378d31 + 3f8cb8c commit 201e961

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

CodePush.m

+11-2
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,15 @@ - (void)savePendingUpdate:(NSString *)packageHash
512512
RCT_EXPORT_METHOD(getNewStatusReport:(RCTPromiseResolveBlock)resolve
513513
rejecter:(RCTPromiseRejectBlock)reject)
514514
{
515+
#ifdef DEBUG
516+
// Do not report metrics if running in debug mode.
517+
resolve(nil);
518+
#else
519+
if ([_bridge.bundleURL.scheme hasPrefix:@"http"]) {
520+
// Do not report metrics if running bundle from packager.
521+
resolve(nil);
522+
return;
523+
}
515524

516525
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
517526
if (needToReportRollback) {
@@ -532,15 +541,15 @@ - (void)savePendingUpdate:(NSString *)packageHash
532541
resolve([CodePushTelemetryManager getUpdateReport:currentPackage]);
533542
return;
534543
}
535-
} else if (isRunningBinaryVersion || [_bridge.bundleURL.scheme hasPrefix:@"http"]) {
536-
// Check if the current appVersion has been reported.
544+
} else if (isRunningBinaryVersion) {
537545
NSString *appVersion = [[CodePushConfig current] appVersion];
538546
resolve([CodePushTelemetryManager getBinaryUpdateReport:appVersion]);
539547
return;
540548
}
541549

542550
resolve(nil);
543551
});
552+
#endif
544553
}
545554

546555
/*

android/app/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ android {
2222
}
2323

2424
dependencies {
25-
compile fileTree(dir: 'libs', include: ['*.jar'])
26-
compile 'com.android.support:appcompat-v7:23.0.0'
27-
compile 'com.facebook.react:react-native:0.15.1'
25+
compile fileTree(dir: "libs", include: ["*.jar"])
26+
compile "com.android.support:appcompat-v7:23.0.1"
27+
compile "com.facebook.react:react-native:0.19.+"
2828
}

android/app/src/main/java/com/microsoft/codepush/react/CodePush.java

+5
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,11 @@ protected Void doInBackground(Object... params) {
426426

427427
@ReactMethod
428428
public void getNewStatusReport(final Promise promise) {
429+
if (isDebugMode) {
430+
// Do not report metrics if running in debug mode.
431+
promise.resolve("");
432+
return;
433+
}
429434

430435
AsyncTask asyncTask = new AsyncTask() {
431436
@Override

0 commit comments

Comments
 (0)