Skip to content

Commit

Permalink
Updated docs for clearUpdates method and added logging. (microsoft#1329)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickToropov authored Jun 29, 2018
1 parent 8b5b8ea commit 19b1a5e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,16 @@ public void downloadAndReplaceCurrentBundle(String remoteBundleUrl) {
}
}

/**
* This method clears CodePush's downloaded updates.
* It is needed to switch to a different deployment if the current deployment is more recent.
* 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.
*/
@ReactMethod
public void clearUpdates() {
CodePushUtils.log("Clearing updates.");
mCodePush.clearUpdates();
}
}
4 changes: 3 additions & 1 deletion docs/api-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ When you require `react-native-code-push`, the module object provides the follow

* [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

* [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.
* [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.

_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._

#### codePush

Expand Down
3 changes: 3 additions & 0 deletions ios/CodePush/CodePush.m
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,11 @@ -(void)loadBundleOnTick:(NSTimer *)timer {
/*
* This method clears CodePush's downloaded updates.
* It is needed to switch to a different deployment if the current deployment is more recent.
* 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.
*/
RCT_EXPORT_METHOD(clearUpdates) {
CPLog(@"Clearing updates.");
[CodePush clearUpdates];
}

Expand Down
2 changes: 2 additions & 0 deletions typings/react-native-code-push.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ declare namespace CodePush {
/**
* Clear all downloaded CodePush updates.
* This is useful when switching to a different deployment which may have an older release than the current package.
* 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.
*/
function clearUpdates(): void;

Expand Down

0 comments on commit 19b1a5e

Please sign in to comment.