Skip to content

Commit 865d69d

Browse files
authored
Merge pull request #10358 from wordpress-mobile/merge-release-13.0-into-develop
Merge release 13.0 into develop
2 parents f529af7 + 554abcb commit 865d69d

File tree

16 files changed

+148
-68
lines changed

16 files changed

+148
-68
lines changed

WordPress/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ android {
4949

5050
defaultConfig {
5151
applicationId "org.wordpress.android"
52-
versionName "alpha-183"
53-
versionCode 762
52+
versionName "alpha-185"
53+
versionCode 766
5454
minSdkVersion 21
5555
targetSdkVersion 28
5656

@@ -74,8 +74,8 @@ android {
7474
productFlavors {
7575
vanilla { // used for release and beta
7676
dimension "buildType"
77-
versionName "13.0-rc-1"
78-
versionCode 761
77+
versionName "13.0-rc-3"
78+
versionCode 765
7979
}
8080

8181
zalpha { // alpha version - enable experimental features

WordPress/metadata/PlayStoreStrings.po

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,23 @@ msgstr ""
1010
"X-Generator: VsCode\n"
1111
"Project-Id-Version: Release Notes & Play Store Descriptions\n"
1212

13+
#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
14+
msgctxt "release_note_130"
15+
msgid ""
16+
"13.0:\n"
17+
"* Block editor improvements: the editor is auto-enabled when you open a block post (unless you opted out in v12.9), or you can enable it on a per-site basis.\n"
18+
"* Accessibility improvements: screen readers can now read more of the stats screen.\n"
19+
"* General usability improvements: logging in is speedier, colors are more consistent across screens, and bug fixes put an end to some crashes.\n"
20+
msgstr ""
21+
1322
#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
1423
msgctxt "release_note_129"
1524
msgid ""
1625
"12.9:\n"
1726
"* Customers with unclaimed domain credits can register domains in the app.\n"
1827
"* You can expand the Comment Editor to Full Screen for more space while editing.\n"
1928
"* The Block editor has a few improvements: Video blocks are available, and a some issues that led to content loss when using unsupported blocks have been resolved.\n"
29+
"* The block editor is now the default for new posts after you open a block-based post for the first time.\n"
2030
msgstr ""
2131

2232
msgctxt "release_note_128"
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
* Fixes a crash that could happen when viewing help from the login screen
2-
* Allow setting which editor to use on a per-site basis
3-
* Improves accessibility in stats
4-
* Makes it easier to log in by validating the URL to your site more quickly.
5-
* Some minor tweaks to the colour scheme
1+
* Block editor improvements: the editor is auto-enabled when you open a block post (unless you opted out in v12.9), or you can enable it on a per-site basis.
2+
* Accessibility improvements: screen readers can now read more of the stats screen.
3+
* General usability improvements: logging in is speedier, colors are more consistent across screens, and bug fixes put an end to some crashes.

WordPress/src/main/java/org/wordpress/android/WordPress.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ public void onAppComesFromBackground() {
880880
sDeleteExpiredStats.runIfNotLimited();
881881

882882
// Let's migrate the old editor preference if available in AppPrefs to the remote backend
883-
SiteUtils.migrateAppWideMobileEditorPreferenceToRemote(mContext, mDispatcher, mSiteStore);
883+
SiteUtils.migrateAppWideMobileEditorPreferenceToRemote(mContext, mDispatcher);
884884

885885
if (mFirstActivityResumed) {
886886
deferredInit();

WordPress/src/main/java/org/wordpress/android/ui/main/SitePickerActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
227227
case RequestCodes.CREATE_SITE:
228228
if (data != null) {
229229
int newSiteLocalID = data.getIntExtra(SitePickerActivity.KEY_LOCAL_ID, -1);
230-
SiteUtils.enableBlockEditor(mDispatcher, mSiteStore, newSiteLocalID);
230+
SiteUtils.enableBlockEditorOnSiteCreation(mDispatcher, mSiteStore, newSiteLocalID);
231231
// Mark the site to show the GB popup at first editor run
232232
SiteModel newSiteModel = mSiteStore.getSiteByLocalId(newSiteLocalID);
233233
if (newSiteModel != null) {

WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import org.wordpress.android.fluxc.store.QuickStartStore.QuickStartTask;
5050
import org.wordpress.android.fluxc.store.SiteStore;
5151
import org.wordpress.android.fluxc.store.SiteStore.CompleteQuickStartPayload;
52+
import org.wordpress.android.fluxc.store.SiteStore.OnAllSitesMobileEditorChanged;
5253
import org.wordpress.android.fluxc.store.SiteStore.OnQuickStartCompleted;
5354
import org.wordpress.android.fluxc.store.SiteStore.OnSiteChanged;
5455
import org.wordpress.android.fluxc.store.SiteStore.OnSiteEditorsChanged;
@@ -775,7 +776,7 @@ public void onClick(View v) {
775776
// Enable the block editor on sites created on mobile
776777
if (data != null) {
777778
int newSiteLocalID = data.getIntExtra(SitePickerActivity.KEY_LOCAL_ID, -1);
778-
SiteUtils.enableBlockEditor(mDispatcher, mSiteStore, newSiteLocalID);
779+
SiteUtils.enableBlockEditorOnSiteCreation(mDispatcher, mSiteStore, newSiteLocalID);
779780
// Mark the site to show the GB popup at first editor run
780781
SiteModel newSiteModel = mSiteStore.getSiteByLocalId(newSiteLocalID);
781782
if (newSiteModel != null) {
@@ -1157,6 +1158,26 @@ public void onSiteEditorsChanged(OnSiteEditorsChanged event) {
11571158
return;
11581159
}
11591160

1161+
refreshCurrentSelectedSiteAfterEditorChanges(false, event.site.getId());
1162+
}
1163+
1164+
@SuppressWarnings("unused")
1165+
@Subscribe(threadMode = ThreadMode.MAIN)
1166+
public void onAllSitesMobileEditorChanged(OnAllSitesMobileEditorChanged event) {
1167+
if (event.isError()) {
1168+
return;
1169+
}
1170+
if (event.isNetworkResponse) {
1171+
// We can remove the global app setting now, since we're sure the migration ended with success.
1172+
AppPrefs.removeAppWideEditorPreference();
1173+
}
1174+
refreshCurrentSelectedSiteAfterEditorChanges(true, -1);
1175+
}
1176+
1177+
private void refreshCurrentSelectedSiteAfterEditorChanges(boolean alwaysRefreshUI, int localSiteID) {
1178+
// Need to update the user property about GB enabled on any of the sites
1179+
AnalyticsUtils.refreshMetadata(mAccountStore, mSiteStore);
1180+
11601181
// "Reload" selected site from the db
11611182
// It would be better if the OnSiteChanged provided the list of changed sites.
11621183
if (getSelectedSite() == null && mSiteStore.hasSite()) {
@@ -1166,6 +1187,15 @@ public void onSiteEditorsChanged(OnSiteEditorsChanged event) {
11661187
return;
11671188
}
11681189

1190+
// When alwaysRefreshUI is `true` we need to refresh the UI regardless of the current site
1191+
if (!alwaysRefreshUI) {
1192+
// we need to refresh the UI only when the site IDs matches
1193+
if (getSelectedSite().getId() != localSiteID) {
1194+
// No need to refresh the UI, since the current selected site is another site
1195+
return;
1196+
}
1197+
}
1198+
11691199
SiteModel site = mSiteStore.getSiteByLocalId(getSelectedSite().getId());
11701200
if (site != null) {
11711201
mSelectedSite = site;

WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
import org.wordpress.android.util.WPPermissionUtils;
163163
import org.wordpress.android.util.WPUrlUtils;
164164
import org.wordpress.android.util.analytics.AnalyticsUtils;
165+
import org.wordpress.android.util.analytics.AnalyticsUtils.BlockEditorEnabledSource;
165166
import org.wordpress.android.util.helpers.MediaFile;
166167
import org.wordpress.android.util.helpers.MediaGallery;
167168
import org.wordpress.android.util.helpers.MediaGalleryImageSpan;
@@ -1558,10 +1559,16 @@ private void showGutenbergInformativeDialog() {
15581559
}
15591560

15601561
private void setGutenbergEnabledIfNeeded() {
1561-
if ((TextUtils.isEmpty(mSite.getMobileEditor()) && !mIsNewPost)
1562-
|| AppPrefs.shouldShowGutenbergInfoPopup(mSite.getUrl())) {
1562+
boolean showPopup = AppPrefs.shouldShowGutenbergInfoPopup(mSite.getUrl());
1563+
1564+
if (TextUtils.isEmpty(mSite.getMobileEditor()) && !mIsNewPost) {
15631565
SiteUtils.enableBlockEditor(mDispatcher, mSite);
1564-
AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_GUTENBERG_ENABLED, mSite);
1566+
AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_GUTENBERG_ENABLED, mSite,
1567+
BlockEditorEnabledSource.ON_BLOCK_POST_OPENING.asPropertyMap());
1568+
showPopup = true;
1569+
}
1570+
1571+
if (showPopup) {
15651572
showGutenbergInformativeDialog();
15661573
}
15671574
}

WordPress/src/main/java/org/wordpress/android/ui/prefs/AppPrefs.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,10 @@ public static boolean isGutenbergEditorEnabled() {
648648
return true;
649649
}
650650

651+
/**
652+
* @deprecated As of release 13.0, replaced by SiteSettings mobile editor value
653+
*/
654+
@Deprecated
651655
public static boolean isGutenbergDefaultForNewPosts() {
652656
return getBoolean(DeletablePrefKey.GUTENBERG_DEFAULT_FOR_NEW_POSTS, false);
653657
}

WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
import org.wordpress.android.util.WPActivityUtils;
8585
import org.wordpress.android.util.WPPrefUtils;
8686
import org.wordpress.android.util.analytics.AnalyticsUtils;
87+
import org.wordpress.android.util.analytics.AnalyticsUtils.BlockEditorEnabledSource;
8788
import org.wordpress.android.widgets.WPSnackbar;
8889

8990
import java.util.HashMap;
@@ -743,7 +744,7 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
743744
}
744745
AnalyticsUtils.trackWithSiteDetails(
745746
((Boolean) newValue) ? Stat.EDITOR_GUTENBERG_ENABLED : Stat.EDITOR_GUTENBERG_DISABLED,
746-
mSite);
747+
mSite, BlockEditorEnabledSource.VIA_SITE_SETTINGS.asPropertyMap());
747748
// we need to refresh metadata as gutenberg_enabled is now part of the user data
748749
AnalyticsUtils.refreshMetadata(mAccountStore, mSiteStore);
749750
} else {

WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsInterface.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
import org.wordpress.android.fluxc.generated.SiteActionBuilder;
2020
import org.wordpress.android.fluxc.model.PostFormatModel;
2121
import org.wordpress.android.fluxc.model.SiteModel;
22+
import org.wordpress.android.fluxc.store.AccountStore;
2223
import org.wordpress.android.fluxc.store.SiteStore;
24+
import org.wordpress.android.fluxc.store.SiteStore.OnAllSitesMobileEditorChanged;
2325
import org.wordpress.android.fluxc.store.SiteStore.OnPostFormatsChanged;
2426
import org.wordpress.android.fluxc.store.SiteStore.OnSiteEditorsChanged;
2527
import org.wordpress.android.models.CategoryModel;
@@ -31,6 +33,7 @@
3133
import org.wordpress.android.util.LocaleManager;
3234
import org.wordpress.android.util.SiteUtils;
3335
import org.wordpress.android.util.StringUtils;
36+
import org.wordpress.android.util.analytics.AnalyticsUtils;
3437

3538
import java.util.ArrayList;
3639
import java.util.HashMap;
@@ -171,6 +174,7 @@ public interface SiteSettingsListener {
171174

172175
@Inject SiteStore mSiteStore;
173176
@Inject Dispatcher mDispatcher;
177+
@Inject AccountStore mAccountStore;
174178

175179
protected SiteSettingsInterface(Context host, SiteModel site, SiteSettingsListener listener) {
176180
((WordPress) host.getApplicationContext()).component().inject(this);
@@ -949,7 +953,11 @@ public SiteSettingsInterface init(boolean fetchRemote) {
949953
if (fetchRemote) {
950954
fetchRemoteData();
951955
mDispatcher.dispatch(SiteActionBuilder.newFetchPostFormatsAction(mSite));
952-
mDispatcher.dispatch(SiteActionBuilder.newFetchSiteEditorsAction(mSite));
956+
if (!AppPrefs.isDefaultAppWideEditorPreferenceSet()) {
957+
// Check if the migration from app-wide to per-site setting has already happened - v12.9->13.0
958+
// before fetching site editors from the remote
959+
mDispatcher.dispatch(SiteActionBuilder.newFetchSiteEditorsAction(mSite));
960+
}
953961
}
954962

955963
return this;
@@ -1136,6 +1144,25 @@ public void onSiteEditorsChanged(OnSiteEditorsChanged event) {
11361144
if (event.isError()) {
11371145
return;
11381146
}
1147+
updateAnalyticsAndUI();
1148+
}
1149+
1150+
@SuppressWarnings("unused")
1151+
@Subscribe(threadMode = ThreadMode.MAIN)
1152+
public void onAllSitesMobileEditorChanged(OnAllSitesMobileEditorChanged event) {
1153+
if (event.isError()) {
1154+
return;
1155+
}
1156+
if (event.isNetworkResponse) {
1157+
// We can remove the global app setting now, since we're sure the migration ended with success.
1158+
AppPrefs.removeAppWideEditorPreference();
1159+
}
1160+
updateAnalyticsAndUI();
1161+
}
1162+
1163+
private void updateAnalyticsAndUI() {
1164+
// Need to update the user property about GB enabled on any of the sites
1165+
AnalyticsUtils.refreshMetadata(mAccountStore, mSiteStore);
11391166

11401167
notifyUpdatedOnUiThread();
11411168
}

0 commit comments

Comments
 (0)