Skip to content

Commit 95a8105

Browse files
committed
Merge pull request #314 from Microsoft/isFirstRun_Fix
Fixing isFirstRun on Android
2 parents 9c546ab + c5a84d1 commit 95a8105

File tree

1 file changed

+8
-1
lines changed
  • android/app/src/main/java/com/microsoft/codepush/react

1 file changed

+8
-1
lines changed

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,12 @@ private JSONObject getPendingUpdate() {
233233
}
234234

235235
private void initializeUpdateAfterRestart() {
236+
// Reset the state which indicates that
237+
// the app was just freshly updated.
238+
didUpdate = false;
239+
236240
JSONObject pendingUpdate = getPendingUpdate();
237241
if (pendingUpdate != null) {
238-
didUpdate = true;
239242
try {
240243
boolean updateIsLoading = pendingUpdate.getBoolean(PENDING_UPDATE_IS_LOADING_KEY);
241244
if (updateIsLoading) {
@@ -245,6 +248,10 @@ private void initializeUpdateAfterRestart() {
245248
needToReportRollback = true;
246249
rollbackPackage();
247250
} else {
251+
// There is in fact a new update running for the first
252+
// time, so update the local state to ensure the client knows.
253+
didUpdate = true;
254+
248255
// Mark that we tried to initialize the new update, so that if it crashes,
249256
// we will know that we need to rollback when the app next starts.
250257
savePendingUpdate(pendingUpdate.getString(PENDING_UPDATE_HASH_KEY),

0 commit comments

Comments
 (0)