Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 19b1a5e

Browse files
authored
Updated docs for clearUpdates method and added logging. (#1329)
1 parent 8b5b8ea commit 19b1a5e

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,16 @@ public void downloadAndReplaceCurrentBundle(String remoteBundleUrl) {
588588
}
589589
}
590590

591+
/**
592+
* This method clears CodePush's downloaded updates.
593+
* It is needed to switch to a different deployment if the current deployment is more recent.
594+
* Note: we don’t recommend to use this method in scenarios other than that (CodePush will call
595+
* this method automatically when needed in other cases) as it could lead to unpredictable
596+
* behavior.
597+
*/
591598
@ReactMethod
592599
public void clearUpdates() {
600+
CodePushUtils.log("Clearing updates.");
593601
mCodePush.clearUpdates();
594602
}
595603
}

docs/api-js.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ When you require `react-native-code-push`, the module object provides the follow
2828

2929
* [sync](#codepushsync): Allows checking for an update, downloading it and installing it, all with a single call. Unless you need custom UI and/or behavior, we recommend most developers to use this method when integrating CodePush into their apps
3030

31-
* [clearUpdates](#clearupdates): Clear all downloaded CodePush updates. This is useful when switching to a different deployment which may have an older release than the current package.
31+
* [clearUpdates](#clearupdates): Clear all downloaded CodePush updates. This is useful when switching to a different deployment which may have an older release than the current package.
32+
33+
_Note: we don’t recommend to use this method in scenarios other than that (CodePush will call this method automatically when needed in other cases) as it could lead to unpredictable behavior._
3234

3335
#### codePush
3436

ios/CodePush/CodePush.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,8 +870,11 @@ -(void)loadBundleOnTick:(NSTimer *)timer {
870870
/*
871871
* This method clears CodePush's downloaded updates.
872872
* It is needed to switch to a different deployment if the current deployment is more recent.
873+
* Note: we don’t recommend to use this method in scenarios other than that (CodePush will call this method
874+
* automatically when needed in other cases) as it could lead to unpredictable behavior.
873875
*/
874876
RCT_EXPORT_METHOD(clearUpdates) {
877+
CPLog(@"Clearing updates.");
875878
[CodePush clearUpdates];
876879
}
877880

typings/react-native-code-push.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ declare namespace CodePush {
276276
/**
277277
* Clear all downloaded CodePush updates.
278278
* This is useful when switching to a different deployment which may have an older release than the current package.
279+
* Note: we don’t recommend to use this method in scenarios other than that (CodePush will call
280+
* this method automatically when needed in other cases) as it could lead to unpredictable behavior.
279281
*/
280282
function clearUpdates(): void;
281283

0 commit comments

Comments
 (0)