Skip to content

Commit 9d4341a

Browse files
committed
Merge pull request #178 from Microsoft/logs
Add logging and lift dev restriction on telemtry
2 parents 326d8d3 + 4610e06 commit 9d4341a

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

CodePush.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ async function checkForUpdate(deploymentKey = null) {
5858
* client app is resilient to a potential issue with the update check.
5959
*/
6060
if (!update || update.updateAppVersion || (update.packageHash === localPackage.packageHash)) {
61+
if (update && update.updateAppVersion) {
62+
log("An update is available but it is targeting a newer binary version than you are currently running.");
63+
}
64+
6165
return null;
6266
} else {
6367
const remotePackage = { ...update, ...PackageMixins.remote(sdk.reportStatusDownload) };
@@ -136,12 +140,7 @@ function log(message) {
136140
}
137141

138142
async function notifyApplicationReady() {
139-
await NativeCodePush.notifyApplicationReady();
140-
if (__DEV__) {
141-
// Don't report metrics if in DEV mode.
142-
return;
143-
}
144-
143+
await NativeCodePush.notifyApplicationReady();
145144
const statusReport = await NativeCodePush.getNewStatusReport();
146145
if (statusReport) {
147146
const config = await getConfiguration();
@@ -254,7 +253,12 @@ async function sync(options = {}, syncStatusChangeCallback, downloadProgressCall
254253
return CodePush.SyncStatus.UPDATE_INSTALLED;
255254
};
256255

257-
if (!remotePackage || (remotePackage.failedInstall && syncOptions.ignoreFailedUpdates)) {
256+
const updateShouldBeIgnored = remotePackage && (remotePackage.failedInstall && syncOptions.ignoreFailedUpdates);
257+
if (!remotePackage || updateShouldBeIgnored) {
258+
if (updateShouldBeIgnored) {
259+
log("An update is available, but it is being ignored due to having been previously rolled back.");
260+
}
261+
258262
syncStatusChangeCallback(CodePush.SyncStatus.UP_TO_DATE);
259263
return CodePush.SyncStatus.UP_TO_DATE;
260264
} else if (syncOptions.updateDialog) {

CodePush.m

+1-7
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,7 @@ - (void)savePendingUpdate:(NSString *)packageHash
511511
*/
512512
RCT_EXPORT_METHOD(getNewStatusReport:(RCTPromiseResolveBlock)resolve
513513
rejecter:(RCTPromiseRejectBlock)reject)
514-
{
515-
if ([_bridge.bundleURL.scheme hasPrefix:@"http"]) {
516-
// Do not report metrics if running bundle from packager.
517-
resolve(nil);
518-
return;
519-
}
520-
514+
{
521515
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
522516
if (needToReportRollback) {
523517
needToReportRollback = NO;

package-mixins.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ 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-
// Don't report metrics if in DEV mode.
29-
!__DEV__ && reportStatusDownload && reportStatusDownload(this);
28+
reportStatusDownload && reportStatusDownload(this);
3029
return { ...downloadedPackage, ...local };
3130
} finally {
3231
downloadProgressSubscription && downloadProgressSubscription.remove();

0 commit comments

Comments
 (0)