Skip to content

Commit 326d8d3

Browse files
committed
Merge pull request #176 from Microsoft/disable-metrics-in-debug
Disable metrics in debug
2 parents 201e961 + b95519a commit 326d8d3

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

CodePush.js

+5
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ function log(message) {
137137

138138
async function notifyApplicationReady() {
139139
await NativeCodePush.notifyApplicationReady();
140+
if (__DEV__) {
141+
// Don't report metrics if in DEV mode.
142+
return;
143+
}
144+
140145
const statusReport = await NativeCodePush.getNewStatusReport();
141146
if (statusReport) {
142147
const config = await getConfiguration();

CodePush.m

-5
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,6 @@ - (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
519515
if ([_bridge.bundleURL.scheme hasPrefix:@"http"]) {
520516
// Do not report metrics if running bundle from packager.
521517
resolve(nil);
@@ -549,7 +545,6 @@ - (void)savePendingUpdate:(NSString *)packageHash
549545

550546
resolve(nil);
551547
});
552-
#endif
553548
}
554549

555550
/*

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

-5
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,6 @@ 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-
}
434429

435430
AsyncTask asyncTask = new AsyncTask() {
436431
@Override

package-mixins.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ module.exports = (NativeCodePush) => {
2525
// so that the client knows what the current package version is.
2626
try {
2727
const downloadedPackage = await NativeCodePush.downloadUpdate(this);
28-
reportStatusDownload && reportStatusDownload(this);
28+
// Don't report metrics if in DEV mode.
29+
!__DEV__ && reportStatusDownload && reportStatusDownload(this);
2930
return { ...downloadedPackage, ...local };
3031
} finally {
3132
downloadProgressSubscription && downloadProgressSubscription.remove();

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-code-push",
3-
"version": "1.6.0-beta",
3+
"version": "1.7.0-beta",
44
"description": "React Native plugin for the CodePush service",
55
"main": "CodePush.js",
66
"homepage": "https://microsoft.github.io/code-push",
@@ -20,6 +20,6 @@
2020
"semver": "^5.1.0"
2121
},
2222
"devDependencies": {
23-
"react-native": "0.15.0"
23+
"react-native": "0.19.0"
2424
}
2525
}

0 commit comments

Comments
 (0)