[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Fix infinite theme change loop in PageActivity.

2017-07-21 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/366856 )

Change subject: Fix infinite theme change loop in PageActivity.
..


Fix infinite theme change loop in PageActivity.

When changing the theme in PageActivity (while online) it enters an
infinite loop of light/dark theme changes.  This is because of a race
condition between the UserOption uploader uploading the new value and the
UserOption *downloader* downloading the previous value and triggering a
theme change to the old value.

This patch requests a sync of UserOptions only when the activity is
launched freshly (i.e. not restarted via theme change).

Bug: T170756
Change-Id: I830aef92c1c57dc64e42c49550a0b2fcb402534b
---
M app/src/main/java/org/wikipedia/page/PageActivity.java
1 file changed, 3 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Mholloway: Looks good to me, approved



diff --git a/app/src/main/java/org/wikipedia/page/PageActivity.java 
b/app/src/main/java/org/wikipedia/page/PageActivity.java
index 14961e1..94f18c2 100644
--- a/app/src/main/java/org/wikipedia/page/PageActivity.java
+++ b/app/src/main/java/org/wikipedia/page/PageActivity.java
@@ -168,7 +168,7 @@
 
 // Note: when system language is enabled, and the system language 
is changed outside of
 // the app, MRU languages are not updated. There's no harm in 
doing that here but since
-// the user didin't choose that language in app, it may be 
unexpected.
+// the user didn't choose that language in app, it may be 
unexpected.
 }
 
 if (languageChanged) {
@@ -180,9 +180,9 @@
 // if there's no savedInstanceState, and we're not coming back 
from a Theme change,
 // then we must have been launched with an Intent, so... handle it!
 handleIntent(getIntent());
-}
 
-UserOptionContentResolver.requestManualSync();
+UserOptionContentResolver.requestManualSync();
+}
 }
 
 private void finishActionMode() {

-- 
To view, visit https://gerrit.wikimedia.org/r/366856
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I830aef92c1c57dc64e42c49550a0b2fcb402534b
Gerrit-PatchSet: 2
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant 
Gerrit-Reviewer: Brion VIBBER 
Gerrit-Reviewer: Dbrant 
Gerrit-Reviewer: Mholloway 
Gerrit-Reviewer: Niedzielski 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Fix infinite theme change loop in PageActivity.

2017-07-21 Thread Dbrant (Code Review)
Dbrant has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366856 )

Change subject: Fix infinite theme change loop in PageActivity.
..

Fix infinite theme change loop in PageActivity.

When changing the theme in PageActivity (while online) it enters an
infinite loop of light/dark theme changes.  This is because of a race
condition between the UserOption uploader uploading the new value and the
UserOption *downloader* downloading the previous value and triggering a
theme change to the old value.

This patch requests a sync of UserOptions only when the activity is
launched freshly (i.e. not restarted via theme change).

Change-Id: I830aef92c1c57dc64e42c49550a0b2fcb402534b
---
M app/src/main/java/org/wikipedia/page/PageActivity.java
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/56/366856/1

diff --git a/app/src/main/java/org/wikipedia/page/PageActivity.java 
b/app/src/main/java/org/wikipedia/page/PageActivity.java
index 14961e1..94f18c2 100644
--- a/app/src/main/java/org/wikipedia/page/PageActivity.java
+++ b/app/src/main/java/org/wikipedia/page/PageActivity.java
@@ -168,7 +168,7 @@
 
 // Note: when system language is enabled, and the system language 
is changed outside of
 // the app, MRU languages are not updated. There's no harm in 
doing that here but since
-// the user didin't choose that language in app, it may be 
unexpected.
+// the user didn't choose that language in app, it may be 
unexpected.
 }
 
 if (languageChanged) {
@@ -180,9 +180,9 @@
 // if there's no savedInstanceState, and we're not coming back 
from a Theme change,
 // then we must have been launched with an Intent, so... handle it!
 handleIntent(getIntent());
-}
 
-UserOptionContentResolver.requestManualSync();
+UserOptionContentResolver.requestManualSync();
+}
 }
 
 private void finishActionMode() {

-- 
To view, visit https://gerrit.wikimedia.org/r/366856
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I830aef92c1c57dc64e42c49550a0b2fcb402534b
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits