From 85774dcb606a50bfbc1fd97f67cb75d106bab78b Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 21 Apr 2021 19:11:55 +0100 Subject: [PATCH 01/76] Update strings.xml with text to be used --- .../WordPressEditor/src/main/res/values/strings.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/editor/WordPressEditor/src/main/res/values/strings.xml b/libs/editor/WordPressEditor/src/main/res/values/strings.xml index 136f2d1dc7e1..cc859fb8abdf 100644 --- a/libs/editor/WordPressEditor/src/main/res/values/strings.xml +++ b/libs/editor/WordPressEditor/src/main/res/values/strings.xml @@ -154,6 +154,13 @@ We’ll be removing the classic editor for new posts soon, but this won’t affect editing any of your existing posts or pages. Get a head start by enabling the Block Editor now in site settings. Dismiss - + + Replace current? + You already have a featured image set. Do you want to replace it? + Replace + Cancel + + Set as Featured Image + Removed as Featured Image From 41900666567e640625821b5a991c9077246f7038 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 21 Apr 2021 19:16:51 +0100 Subject: [PATCH 02/76] Add OnSetFeaturedImageListener() This commit adds an OnSetFeaturedImageListener() in order to fetch a request to set a featured image from the JS side. --- .../android/editor/gutenberg/GutenbergContainerFragment.java | 3 +++ .../android/editor/gutenberg/GutenbergEditorFragment.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java index d9c4b6f2f806..aa34ad3cf1c2 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java @@ -29,6 +29,7 @@ import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaEditorListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaLibraryButtonListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaFilesCollectionBasedBlockEditorListener; +import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnSetFeaturedImageListener; import java.util.ArrayList; @@ -56,6 +57,7 @@ public boolean hasReceivedAnyContent() { public void attachToContainer(ViewGroup viewGroup, OnMediaLibraryButtonListener onMediaLibraryButtonListener, OnReattachMediaUploadQueryListener onReattachQueryListener, OnReattachMediaSavingQueryListener onStorySavingReattachQueryListener, + OnSetFeaturedImageListener onSetFeaturedImageListener, OnEditorMountListener onEditorMountListener, OnEditorAutosaveListener onEditorAutosaveListener, OnAuthHeaderRequestedListener onAuthHeaderRequestedListener, @@ -76,6 +78,7 @@ public void attachToContainer(ViewGroup viewGroup, OnMediaLibraryButtonListener onMediaLibraryButtonListener, onReattachQueryListener, onStorySavingReattachQueryListener, + onSetFeaturedImageListener, onEditorMountListener, onEditorAutosaveListener, onAuthHeaderRequestedListener, diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index a1d2f56de720..e63a0da86be7 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -68,6 +68,7 @@ import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaLibraryButtonListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnReattachMediaSavingQueryListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnReattachMediaUploadQueryListener; +import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnSetFeaturedImageListener; import java.util.ArrayList; import java.util.Date; @@ -333,6 +334,8 @@ public void onQueryCurrentProgressForUploadingMedia() { updateMediaProgress(); } }, + new OnSetFeaturedImageListener() { + }, new OnEditorMountListener() { @Override public void onEditorDidMount(ArrayList unsupportedBlocks) { From 86e6bb0f327ec5703db58e882c57f3e615968f2c Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 21 Apr 2021 19:19:37 +0100 Subject: [PATCH 03/76] Add onSetFeaturedImageButtonClicked() function onSetFeaturedImageButtonClicked() will be called when the option to set a featured image is clicked. It'll call showFeaturedImageConfirmationDialog(), which will be fleshed out in the next commit. --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index e63a0da86be7..21007751e34d 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -335,6 +335,10 @@ public void onQueryCurrentProgressForUploadingMedia() { } }, new OnSetFeaturedImageListener() { + @Override + public void onSetFeaturedImageButtonClicked(int mediaId) { + showFeaturedImageConfirmationDialog(mediaId); + } }, new OnEditorMountListener() { @Override @@ -777,6 +781,8 @@ public void onClick(DialogInterface dialog, int id) { dialog.show(); } + private void showFeaturedImageConfirmationDialog(final int mediaId) { + } public void sendToJSFeaturedImageId(int mediaId) { getGutenbergContainerFragment().sendToJSFeaturedImageId(mediaId); } From 51be414082ff5f0d1c21c11c45eb6d95fccfd999 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 21 Apr 2021 19:25:28 +0100 Subject: [PATCH 04/76] Add updateFeaturedImage() function This commits adds "updateFeaturedImage" as an EditorFragmentListener method in EditPostActivity.java. The function enables an update to a post's featured image. By adding the function to "EditorFragmentAbstract.java", this can then be called from "GutenbergEditorFragment.java". --- .../org/wordpress/android/ui/posts/EditPostActivity.java | 5 +++++ .../org/wordpress/android/editor/EditorFragmentAbstract.java | 1 + 2 files changed, 6 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index f58cd29c7640..fd79e0088442 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -2867,6 +2867,11 @@ public void onEditPostPublishedSettingsClick() { } } + @Override + public void updateFeaturedImage(final long mediaId, final boolean imagePicked) { + setFeaturedImageId(mediaId, imagePicked); + } + @Override public void onAddMediaClicked() { if (mEditorPhotoPicker.isPhotoPickerShowing()) { diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java index d89c7d5827ab..b44b34bcfb2f 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java @@ -178,6 +178,7 @@ public static MediaType getEditorMimeType(MediaFile mediaFile) { public interface EditorFragmentListener extends DialogVisibilityProvider { void onEditorFragmentInitialized(); void onEditorFragmentContentReady(ArrayList unsupportedBlocks, boolean replaceBlockActionWaiting); + void updateFeaturedImage(long mediaId, boolean imagePicked); void onAddMediaClicked(); void onAddMediaImageClicked(boolean allowMultipleSelection); void onAddMediaVideoClicked(boolean allowMultipleSelection); From 4ab70b2279300af091a836d41f7b42284223705f Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 21 Apr 2021 19:27:31 +0100 Subject: [PATCH 05/76] Add setFeaturedImage() and removeFeaturedImage() functions These functions serve to either set a new featured image or remove an existing featured image, using the updateFeaturedImage() function defined in the previous commit. The ID of the new featured image (zero if removed) is then sent back to the JS side of the app via sendToJSFeaturedImageId(). --- .../editor/gutenberg/GutenbergEditorFragment.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 21007751e34d..a3b3d7afed97 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -783,6 +783,21 @@ public void onClick(DialogInterface dialog, int id) { private void showFeaturedImageConfirmationDialog(final int mediaId) { } + + private void setFeaturedImage(int mediaId) { + mEditorFragmentListener.updateFeaturedImage(mediaId, false); + // Necessary to update image in Post Settings + setFeaturedImageId(mediaId); + sendToJSFeaturedImageId(mediaId); + } + + private void removeFeaturedImage(int mediaId) { + mEditorFragmentListener.updateFeaturedImage(mediaId, false); + // Necessary to update image in Post Settings + setFeaturedImageId(mediaId); + sendToJSFeaturedImageId(mediaId); + } + public void sendToJSFeaturedImageId(int mediaId) { getGutenbergContainerFragment().sendToJSFeaturedImageId(mediaId); } From 0dd739903e7cb0399c74ed1c98e49037e2ef0125 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 21 Apr 2021 19:29:12 +0100 Subject: [PATCH 06/76] Create dialog in showFeaturedImageConfirmationDialog() The logic in showFeaturedImageConfirmationDialog() is fleshed out in this commit, with removeFeaturedImage() being called if the featured image is removed, setFeaturedImage() being called by itself if a new featured image is set, and an AlertDialog if there is a replacement. --- .../gutenberg/GutenbergEditorFragment.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index a3b3d7afed97..c655ec7f8a51 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -782,6 +782,31 @@ public void onClick(DialogInterface dialog, int id) { } private void showFeaturedImageConfirmationDialog(final int mediaId) { + if (mediaId == 0) { + removeFeaturedImage(0); + } else if (mFeaturedImageId == 0) { + setFeaturedImage(mediaId); + } else if (mFeaturedImageId != mediaId) { + AlertDialog.Builder builder = new MaterialAlertDialogBuilder(getActivity()); + builder.setTitle(R.string.replace_current_title); + builder.setMessage(R.string.replace_current_description); + builder.setPositiveButton(R.string.replace_current_confirmation, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + setFeaturedImage(mediaId); + } + }); + + builder.setNegativeButton(R.string.replace_current_cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + } + }); + + AlertDialog dialog = builder.create(); + dialog.show(); + } } private void setFeaturedImage(int mediaId) { From 29d2d0bb499f05e30641fa4815a6a42c93164184 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 21 Apr 2021 19:30:32 +0100 Subject: [PATCH 07/76] Send a notice depending on whether a featured image is set or removed The showNotice() function is utilised to send a notice to the user depending on whether a featured image is set or removed. --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index c655ec7f8a51..58f32442ca5d 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -814,6 +814,8 @@ private void setFeaturedImage(int mediaId) { // Necessary to update image in Post Settings setFeaturedImageId(mediaId); sendToJSFeaturedImageId(mediaId); + + showNotice(getString(R.string.featured_image_confirmation)); } private void removeFeaturedImage(int mediaId) { @@ -821,6 +823,8 @@ private void removeFeaturedImage(int mediaId) { // Necessary to update image in Post Settings setFeaturedImageId(mediaId); sendToJSFeaturedImageId(mediaId); + + showNotice(getString(R.string.featured_image_removed)); } public void sendToJSFeaturedImageId(int mediaId) { From 7ee50297d09842923e375d38dd21b0ea8af7ba0a Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 21 Apr 2021 19:32:55 +0100 Subject: [PATCH 08/76] Update reference to latest Gutenberg Mobile commit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d44cce16486a..22fa4e208e29 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.30.3-beta.3' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = 'develop-a26cd60c3eb95830198f4e0a17fe98adc761c022' + ext.gutenbergMobileVersion = '3116-6fe6de3bfe191c784c6faf2ee677daf537cc6691' repositories { google() From 0f54607b6073d96694e96b24ccd86a5880a4f678 Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Fri, 23 Apr 2021 13:15:28 -0500 Subject: [PATCH 09/76] added an update featured image use case. --- .../ui/posts/UpdateFeaturedImageUseCase.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt new file mode 100644 index 000000000000..190a0b5f0346 --- /dev/null +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt @@ -0,0 +1,23 @@ +package org.wordpress.android.ui.posts + +import org.wordpress.android.fluxc.model.PostImmutableModel +import org.wordpress.android.fluxc.model.PostModel +import org.wordpress.android.ui.posts.EditPostRepository.UpdatePostResult +import org.wordpress.android.ui.posts.EditPostRepository.UpdatePostResult.Updated + +class UpdateFeaturedImageUseCase { + fun updateFeaturedImage( + featuredImageId: Long, + editPostRepository: EditPostRepository, + onPostFeaturedImageUpdated: (PostImmutableModel) -> Unit + ) { + editPostRepository.updateAsync({ postModel: PostModel -> + postModel.setFeaturedImageId(featuredImageId) + true + }) { postModel: PostImmutableModel, result: UpdatePostResult -> + if (result === Updated) { + onPostFeaturedImageUpdated.invoke(postModel) + } + } + } +} From 9d72f88bc1c2c74222c2316a9c30cfb2b25bb3a6 Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Fri, 23 Apr 2021 13:16:26 -0500 Subject: [PATCH 10/76] Created mechanisms to track when the gb featured image is picked --- .../java/org/wordpress/android/ui/posts/FeaturedImageHelper.kt | 3 ++- .../java/org/wordpress/android/analytics/AnalyticsTracker.java | 1 + .../wordpress/android/analytics/AnalyticsTrackerNosara.java | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/FeaturedImageHelper.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/FeaturedImageHelper.kt index 0b6fd2e1613d..30c38865c6f9 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/FeaturedImageHelper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/FeaturedImageHelper.kt @@ -201,7 +201,8 @@ class FeaturedImageHelper @Inject constructor( enum class TrackableEvent(val label: Stat) { IMAGE_SET_CLICKED(Stat.FEATURED_IMAGE_SET_CLICKED_POST_SETTINGS), - IMAGE_PICKED(Stat.FEATURED_IMAGE_PICKED_POST_SETTINGS), + IMAGE_PICKED_POST_SETTINGS(Stat.FEATURED_IMAGE_PICKED_POST_SETTINGS), + IMAGE_PICKED_GUTENBERG_EDITOR(Stat.FEATURED_IMAGE_PICKED_GUTENBERG_EDITOR), IMAGE_UPLOAD_CANCELED(Stat.FEATURED_IMAGE_UPLOAD_CANCELED_POST_SETTINGS), IMAGE_UPLOAD_RETRY_CLICKED(Stat.FEATURED_IMAGE_UPLOAD_RETRY_CLICKED_POST_SETTINGS), IMAGE_REMOVE_CLICKED(Stat.FEATURED_IMAGE_REMOVE_CLICKED_POST_SETTINGS) diff --git a/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java b/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java index 59d5da917401..e0ecabb13dd4 100644 --- a/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java +++ b/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java @@ -691,6 +691,7 @@ public enum Stat { WELCOME_NO_SITES_INTERSTITIAL_DISMISSED, FEATURED_IMAGE_SET_CLICKED_POST_SETTINGS, FEATURED_IMAGE_PICKED_POST_SETTINGS, + FEATURED_IMAGE_PICKED_GUTENBERG_EDITOR, FEATURED_IMAGE_UPLOAD_CANCELED_POST_SETTINGS, FEATURED_IMAGE_UPLOAD_RETRY_CLICKED_POST_SETTINGS, FEATURED_IMAGE_REMOVE_CLICKED_POST_SETTINGS, diff --git a/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java b/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java index 78640c0e0682..136f75c3009c 100644 --- a/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java +++ b/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java @@ -1889,6 +1889,8 @@ public static String getEventNameForStat(AnalyticsTracker.Stat stat) { return "featured_image_set_clicked_post_settings"; case FEATURED_IMAGE_PICKED_POST_SETTINGS: return "featured_image_picked_post_settings"; + case FEATURED_IMAGE_PICKED_GUTENBERG_EDITOR: + return "featured_image_picked_gutenberg_editor"; case FEATURED_IMAGE_UPLOAD_CANCELED_POST_SETTINGS: return "featured_image_upload_canceled_post_settings"; case FEATURED_IMAGE_UPLOAD_RETRY_CLICKED_POST_SETTINGS: From d3b897266ac88fda759876ae25fcd46c86ea98be Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Fri, 23 Apr 2021 13:17:14 -0500 Subject: [PATCH 11/76] Integrated the new use case and approach to EditPost and Post Settings --- .../android/ui/posts/EditPostActivity.java | 31 ++++++++++++++----- .../ui/posts/EditPostSettingsFragment.java | 21 +++++++------ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index fd79e0088442..20771d37e1de 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -401,6 +401,7 @@ enum RestartEditorOptions { @Inject StoriesPrefs mStoriesPrefs; @Inject StoriesEventListener mStoriesEventListener; @Inject ContactInfoBlockFeatureConfig mContactInfoBlockFeatureConfig; + @Inject UpdateFeaturedImageUseCase mUpdateFeaturedImageUseCase; private StorePostViewModel mViewModel; @@ -1655,7 +1656,7 @@ private void onUploadSuccess(MediaModel media) { } } else if (media.getMarkedLocallyAsFeatured() && media.getLocalPostId() == mEditPostRepository .getId()) { - setFeaturedImageId(media.getMediaId(), false); + setFeaturedImageId(media.getMediaId(), false, false); } } } @@ -2457,12 +2458,26 @@ protected void setPostContentFromShareAction() { } } - private void setFeaturedImageId(final long mediaId, final boolean imagePicked) { - if (mEditPostSettingsFragment != null) { - mEditPostSettingsFragment.updateFeaturedImage(mediaId, imagePicked); - if (mEditorFragment instanceof GutenbergEditorFragment) { - ((GutenbergEditorFragment) mEditorFragment).sendToJSFeaturedImageId((int) mediaId); + private void setFeaturedImageId(final long mediaId, final boolean imagePicked, final boolean isGutenbergEditor) { + if (isGutenbergEditor) { + EditPostRepository postRepository = getEditPostRepository(); + if (postRepository == null) { + return; } + + int postId = getEditPostRepository().getId(); + mFeaturedImageHelper.trackFeaturedImageEvent( + FeaturedImageHelper.TrackableEvent.IMAGE_PICKED_GUTENBERG_EDITOR, + postId + ); + + mUpdateFeaturedImageUseCase.updateFeaturedImage(mediaId, postRepository, + postModel -> null); + } else if (mEditPostSettingsFragment != null) { + mEditPostSettingsFragment.updateFeaturedImage(mediaId, imagePicked); + } + if (mEditorFragment instanceof GutenbergEditorFragment) { + ((GutenbergEditorFragment) mEditorFragment).sendToJSFeaturedImageId((int) mediaId); } } @@ -2573,7 +2588,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { // user chose a featured image if (data.hasExtra(MediaPickerConstants.EXTRA_MEDIA_ID)) { long mediaId = data.getLongExtra(MediaPickerConstants.EXTRA_MEDIA_ID, 0); - setFeaturedImageId(mediaId, true); + setFeaturedImageId(mediaId, true, false); } else if (data.hasExtra(MediaPickerConstants.EXTRA_MEDIA_QUEUED_URIS)) { List uris = convertStringArrayIntoUrisList( data.getStringArrayExtra(MediaPickerConstants.EXTRA_MEDIA_QUEUED_URIS)); @@ -2869,7 +2884,7 @@ public void onEditPostPublishedSettingsClick() { @Override public void updateFeaturedImage(final long mediaId, final boolean imagePicked) { - setFeaturedImageId(mediaId, imagePicked); + setFeaturedImageId(mediaId, imagePicked, true); } @Override diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostSettingsFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostSettingsFragment.java index aaf155a037bb..5210f9330bb4 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostSettingsFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostSettingsFragment.java @@ -1,5 +1,7 @@ package org.wordpress.android.ui.posts; +import kotlin.Unit; +import kotlin.jvm.functions.Function1; import android.app.Activity; import android.content.Context; import android.content.Intent; @@ -134,6 +136,7 @@ public class EditPostSettingsFragment extends Fragment { @Inject AnalyticsTrackerWrapper mAnalyticsTrackerWrapper; @Inject UpdatePostStatusUseCase mUpdatePostStatusUseCase; @Inject MediaPickerLauncher mMediaPickerLauncher; + @Inject UpdateFeaturedImageUseCase mUpdateFeaturedImageUseCase; @Inject ViewModelProvider.Factory mViewModelFactory; private EditPostPublishSettingsViewModel mPublishedViewModel; @@ -1000,23 +1003,21 @@ public void updateFeaturedImage(long featuredImageId, boolean imagePicked) { if (isAdded() && imagePicked) { int postId = getEditPostRepository().getId(); mFeaturedImageHelper.trackFeaturedImageEvent( - TrackableEvent.IMAGE_PICKED, + TrackableEvent.IMAGE_PICKED_POST_SETTINGS, postId ); } + EditPostRepository postRepository = getEditPostRepository(); if (postRepository == null) { return; } - postRepository.updateAsync(postModel -> { - postModel.setFeaturedImageId(featuredImageId); - return true; - }, (postModel, result) -> { - if (result == UpdatePostResult.Updated.INSTANCE) { - updateFeaturedImageView(postModel); - } - return null; - }); + + mUpdateFeaturedImageUseCase.updateFeaturedImage(featuredImageId, postRepository, + postModel -> { + updateFeaturedImageView(postModel); + return null; + }); } private void clearFeaturedImage() { From ce3785e42339f2a8a16644a41cfd29c54d55bd26 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Tue, 27 Apr 2021 11:00:42 +0100 Subject: [PATCH 12/76] Update remaining references to "IMAGE_PICKED" to "IMAGE_PICKED_POST_SETTINGS" --- .../wordpress/android/ui/photopicker/PhotoPickerActivity.java | 4 ++-- .../java/org/wordpress/android/ui/posts/EditPostActivity.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/photopicker/PhotoPickerActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/photopicker/PhotoPickerActivity.java index bdccb881bb0c..c2d20a8a8446 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/photopicker/PhotoPickerActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/photopicker/PhotoPickerActivity.java @@ -276,7 +276,7 @@ private void doMediaUrisSelected(@NonNull List mediaUris, @NonNul final String mimeType = getContentResolver().getType(mediaUri); mFeaturedImageHelper.trackFeaturedImageEvent( - FeaturedImageHelper.TrackableEvent.IMAGE_PICKED, + FeaturedImageHelper.TrackableEvent.IMAGE_PICKED_POST_SETTINGS, mLocalPostId ); @@ -330,7 +330,7 @@ private void doMediaIdsSelected(ArrayList mediaIds, @NonNull PhotoPickerMe // if user chose a featured image, track image picked event if (mBrowserType == MediaBrowserType.FEATURED_IMAGE_PICKER) { mFeaturedImageHelper.trackFeaturedImageEvent( - FeaturedImageHelper.TrackableEvent.IMAGE_PICKED, + FeaturedImageHelper.TrackableEvent.IMAGE_PICKED_POST_SETTINGS, mLocalPostId ); } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index 20771d37e1de..2a132c24b940 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -2594,7 +2594,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { data.getStringArrayExtra(MediaPickerConstants.EXTRA_MEDIA_QUEUED_URIS)); int postId = getImmutablePost().getId(); mFeaturedImageHelper.trackFeaturedImageEvent( - FeaturedImageHelper.TrackableEvent.IMAGE_PICKED, + FeaturedImageHelper.TrackableEvent.IMAGE_PICKED_POST_SETTINGS, postId ); for (Uri mediaUri : uris) { From c1278d6a6262c401d72501be991b9d2d13ea7408 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Tue, 27 Apr 2021 11:01:50 +0100 Subject: [PATCH 13/76] Remove unused imports from EditPostSettingsFragment.java --- .../wordpress/android/ui/posts/EditPostSettingsFragment.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostSettingsFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostSettingsFragment.java index 5210f9330bb4..f1add7b4561b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostSettingsFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostSettingsFragment.java @@ -1,7 +1,5 @@ package org.wordpress.android.ui.posts; -import kotlin.Unit; -import kotlin.jvm.functions.Function1; import android.app.Activity; import android.content.Context; import android.content.Intent; From 08efc409bfe4f53bca416351959eacfec886acd7 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Tue, 27 Apr 2021 18:08:18 +0100 Subject: [PATCH 14/76] Remove removeFeaturedImage() function and consolidate into a single setFeaturedImage() function --- .../gutenberg/GutenbergEditorFragment.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 58f32442ca5d..7c7d8d4fb75c 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -783,7 +783,7 @@ public void onClick(DialogInterface dialog, int id) { private void showFeaturedImageConfirmationDialog(final int mediaId) { if (mediaId == 0) { - removeFeaturedImage(0); + setFeaturedImage(0); } else if (mFeaturedImageId == 0) { setFeaturedImage(mediaId); } else if (mFeaturedImageId != mediaId) { @@ -815,16 +815,11 @@ private void setFeaturedImage(int mediaId) { setFeaturedImageId(mediaId); sendToJSFeaturedImageId(mediaId); - showNotice(getString(R.string.featured_image_confirmation)); - } - - private void removeFeaturedImage(int mediaId) { - mEditorFragmentListener.updateFeaturedImage(mediaId, false); - // Necessary to update image in Post Settings - setFeaturedImageId(mediaId); - sendToJSFeaturedImageId(mediaId); - - showNotice(getString(R.string.featured_image_removed)); + if (mediaId == 0) { + showNotice(getString(R.string.featured_image_removed)); + } else { + showNotice(getString(R.string.featured_image_confirmation)); + } } public void sendToJSFeaturedImageId(int mediaId) { From 655bb606e9469b10b62106354786b78292eb21b6 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Tue, 27 Apr 2021 20:15:22 +0100 Subject: [PATCH 15/76] Bump Gutenberg Mobile --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c17b244de624..8f1cecdfe7e2 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.30.3-beta.3' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-fdcd6bf9e72b3b522ee81069e3029a163ed169dd' + ext.gutenbergMobileVersion = '3116-fc132c819b0e7380fe53260e3e4e4699c423ed58' repositories { google() From 2e5b21380f9cfd1f2e06776c3bf2c9450faef7f3 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 12 May 2021 00:35:17 +0100 Subject: [PATCH 16/76] Refactor logic for around showFeaturedImageConfirmationDialog() With this commit, the showFeaturedImageConfirmationDialog() is refactored so that it only includes code for building the confirmation dialog. The if/else logic for determining whether the dialog displays is moved to the onSetFeaturedImageButtonClicked() function. The goal is to make the purpose of each function clearer. --- .../gutenberg/GutenbergEditorFragment.java | 46 +++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 7c7d8d4fb75c..ec7f22b427c2 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -337,7 +337,11 @@ public void onQueryCurrentProgressForUploadingMedia() { new OnSetFeaturedImageListener() { @Override public void onSetFeaturedImageButtonClicked(int mediaId) { - showFeaturedImageConfirmationDialog(mediaId); + if (mediaId == 0 || mFeaturedImageId == 0) { + setFeaturedImage(mediaId); + } else if (mFeaturedImageId != mediaId) { + showFeaturedImageConfirmationDialog(mediaId); + } } }, new OnEditorMountListener() { @@ -782,31 +786,25 @@ public void onClick(DialogInterface dialog, int id) { } private void showFeaturedImageConfirmationDialog(final int mediaId) { - if (mediaId == 0) { - setFeaturedImage(0); - } else if (mFeaturedImageId == 0) { - setFeaturedImage(mediaId); - } else if (mFeaturedImageId != mediaId) { - AlertDialog.Builder builder = new MaterialAlertDialogBuilder(getActivity()); - builder.setTitle(R.string.replace_current_title); - builder.setMessage(R.string.replace_current_description); - builder.setPositiveButton(R.string.replace_current_confirmation, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.dismiss(); - setFeaturedImage(mediaId); - } - }); + AlertDialog.Builder builder = new MaterialAlertDialogBuilder(getActivity()); + builder.setTitle(R.string.replace_current_title); + builder.setMessage(R.string.replace_current_description); + builder.setPositiveButton(R.string.replace_current_confirmation, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + setFeaturedImage(mediaId); + } + }); - builder.setNegativeButton(R.string.replace_current_cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.dismiss(); - } - }); + builder.setNegativeButton(R.string.replace_current_cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + } + }); - AlertDialog dialog = builder.create(); - dialog.show(); - } + AlertDialog dialog = builder.create(); + dialog.show(); } private void setFeaturedImage(int mediaId) { From 71f8f367e1797dca6d91c1adcbecee14003738e4 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 12 May 2021 12:41:16 +0100 Subject: [PATCH 17/76] Update build.gradle with latest Gutenberg Mobile reference --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 78860544e180..b83f2f4701f6 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-ca78f5d916e77285885cab602fc54689870d97a3' + ext.gutenbergMobileVersion = '3116-573a5ea5c8ef748739e331fb877d368d8fbd03ad' repositories { google() From 34b78ce08280449c90f4fc5530d01f0ca8774ed6 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 12 May 2021 15:50:36 +0100 Subject: [PATCH 18/76] Update build.gradle to reference latest commit from Gutenberg Mobile --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b83f2f4701f6..74cbcf9e8f07 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-573a5ea5c8ef748739e331fb877d368d8fbd03ad' + ext.gutenbergMobileVersion = '3116-2e64bf0e5539e32cc5d847a3e0a26bb3d4a6cf8a' repositories { google() From f4358c4f89fd39aad5e5877f3f2118e8686d4773 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Sun, 16 May 2021 19:27:29 +0100 Subject: [PATCH 19/76] Update reference to latest Gutenberg Mobile commit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d066b21788c0..1a9d4763cfc0 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-cd3f7d8ea05961097ea2ec949e122e68085ee040' + ext.gutenbergMobileVersion = '3116-076c7af9dc33fe9f9d61b6885146e4920cb7edc6' repositories { google() From 621ce38046c11fb6b48f3709b9cb3413cc748117 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Sun, 16 May 2021 20:09:46 +0100 Subject: [PATCH 20/76] Update reference to latest Gutenberg Mobile commit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1a9d4763cfc0..09920fa517c3 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-076c7af9dc33fe9f9d61b6885146e4920cb7edc6' + ext.gutenbergMobileVersion = '3116-022287a99627de34b0acf579d599eb3a39ecabcc' repositories { google() From 57c305944d2c05b05dd0660491d1e4709e840cca Mon Sep 17 00:00:00 2001 From: Siobhan Date: Tue, 18 May 2021 11:53:17 +0100 Subject: [PATCH 21/76] Bump Gutenberg Mobile reference --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 09920fa517c3..467b08739f95 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-022287a99627de34b0acf579d599eb3a39ecabcc' + ext.gutenbergMobileVersion = '3116-3407f793fccc2032a53728b879202a2421695297' repositories { google() From 1187bc11ec3ba7758f85e291c69e2173f138d954 Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Tue, 18 May 2021 22:34:50 -0500 Subject: [PATCH 22/76] Updated gutenberg-mobile ref. --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5f86ce9caa36..3424b1034ea8 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = 'v1.53.0' + ext.gutenbergMobileVersion = '3523-81aa6db006a4f64dacbd78e6b5d82f286af27c3f' repositories { google() From 610348e5225469f6dd739aa93f57b45e24fe4469 Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Wed, 19 May 2021 01:23:08 -0500 Subject: [PATCH 23/76] added inject annotation to the constructor of the use case. --- .../wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt index 190a0b5f0346..3bec0f89d475 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt @@ -4,8 +4,9 @@ import org.wordpress.android.fluxc.model.PostImmutableModel import org.wordpress.android.fluxc.model.PostModel import org.wordpress.android.ui.posts.EditPostRepository.UpdatePostResult import org.wordpress.android.ui.posts.EditPostRepository.UpdatePostResult.Updated +import javax.inject.Inject -class UpdateFeaturedImageUseCase { +class UpdateFeaturedImageUseCase @Inject constructor() { fun updateFeaturedImage( featuredImageId: Long, editPostRepository: EditPostRepository, From 0cfaf4fff9388fe61d033161f0a934fb380f1a6f Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Wed, 19 May 2021 19:31:39 -0500 Subject: [PATCH 24/76] Updated gutenberg-mobile ref. --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 3424b1034ea8..5032bbff13d0 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3523-81aa6db006a4f64dacbd78e6b5d82f286af27c3f' + ext.gutenbergMobileVersion = '3523-9f2a75febfcfc2978c3319d94073fc239d82ff89' repositories { google() From 617c5e2ef2ff47be3fbb9c9d7207ced73f24bcb6 Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Wed, 19 May 2021 19:32:06 -0500 Subject: [PATCH 25/76] removed comment about disabling Audio block since it is now on all sites --- .../java/org/wordpress/android/ui/posts/EditPostActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index acd8627952aa..e929c68ac8f9 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -2302,7 +2302,7 @@ private GutenbergPropsBuilder getGutenbergPropsBuilder() { enableXPosts, isUnsupportedBlockEditorEnabled, unsupportedBlockEditorSwitch, - !isFreeWPCom, // Disable audio block until it's usable on free sites via "Insert from URL" capability + !isFreeWPCom, wpcomLocaleSlug, postType, featuredImageId, From 70dff2c502270f4d098a06f044c4691a07301b5a Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Wed, 19 May 2021 21:54:01 -0500 Subject: [PATCH 26/76] formatted the use case. --- .../ui/posts/UpdateFeaturedImageUseCase.kt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt index 3bec0f89d475..dbedb9d63207 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt @@ -6,16 +6,13 @@ import org.wordpress.android.ui.posts.EditPostRepository.UpdatePostResult import org.wordpress.android.ui.posts.EditPostRepository.UpdatePostResult.Updated import javax.inject.Inject -class UpdateFeaturedImageUseCase @Inject constructor() { - fun updateFeaturedImage( - featuredImageId: Long, - editPostRepository: EditPostRepository, - onPostFeaturedImageUpdated: (PostImmutableModel) -> Unit - ) { - editPostRepository.updateAsync({ postModel: PostModel -> +class UpdateFeaturedImageUseCase @Inject constructor() { fun updateFeaturedImage( + featuredImageId: Long, + editPostRepository: EditPostRepository, + onPostFeaturedImageUpdated: (PostImmutableModel) -> Unit +) { editPostRepository.updateAsync({ postModel: PostModel -> postModel.setFeaturedImageId(featuredImageId) - true - }) { postModel: PostImmutableModel, result: UpdatePostResult -> + true }) { postModel: PostImmutableModel, result: UpdatePostResult -> if (result === Updated) { onPostFeaturedImageUpdated.invoke(postModel) } From d1e7edaa84cf6511b89fa691a73506857ee48025 Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Wed, 19 May 2021 21:56:02 -0500 Subject: [PATCH 27/76] sync stories submodule. --- libs/stories-android | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/stories-android b/libs/stories-android index 278c9cbb221c..8866392ad6c4 160000 --- a/libs/stories-android +++ b/libs/stories-android @@ -1 +1 @@ -Subproject commit 278c9cbb221c02b61a10fca4a00fc4d5e8b63cc2 +Subproject commit 8866392ad6c4a275d3960d033d89a90eb21f5c4c From fa76582c219efe8ba20c14cfc1e96380f57ac953 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 08:16:40 +0100 Subject: [PATCH 28/76] Create GutenbergDialogFragment.kt using BasicDialogFragment.kt as a template The code for this DialogFragment is copied from the BasicDialogFragment file, with the neutral button omitted: https://github.com/wordpress-mobile/WordPress-Android/blob/develop/WordPress/src/main/java/org/wordpress/android/ui/posts/BasicFragmentDialog.kt The code will continue to be edited for use with dialogs in GutenbergEditorFragment. --- .../gutenberg/GutenbergDialogFragment.kt | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt new file mode 100644 index 000000000000..51f7a2f0e49e --- /dev/null +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -0,0 +1,121 @@ +package org.wordpress.android.editor.gutenberg + +import android.app.Dialog +import android.content.Context +import android.content.DialogInterface +import android.os.Bundle +import androidx.appcompat.app.AppCompatDialogFragment +import androidx.fragment.app.Fragment +import com.google.android.material.dialog.MaterialAlertDialogBuilder + +class GutenbergDialogFragment() : AppCompatDialogFragment() { + private lateinit var mTag: String + private lateinit var mMessage: CharSequence + private var mPositiveButtonLabel: CharSequence? = null + private var mTitle: CharSequence? = null + private var mNegativeButtonLabel: CharSequence? = null + private var dismissedByPositiveButton = false + private var dismissedByNegativeButton = false + + interface BasicDialogPositiveClickInterface { + fun onPositiveClicked(instanceTag: String, mediaId: Int) + } + + interface BasicDialogNegativeClickInterface { + fun onNegativeClicked(instanceTag: String) + } + + interface BasicDialogOnDismissByOutsideTouchInterface { + fun onDismissByOutsideTouch(instanceTag: String) + } + + fun initialize( + tag: String, + title: CharSequence?, + message: CharSequence, + positiveButtonLabel: CharSequence, + negativeButtonLabel: CharSequence? = null, + ) { + mTag = tag + mTitle = title + mMessage = message + mPositiveButtonLabel = positiveButtonLabel + mNegativeButtonLabel = negativeButtonLabel + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + this.isCancelable = true + val theme = 0 + setStyle(STYLE_NORMAL, theme) + + if (savedInstanceState != null) { + mTag = requireNotNull(savedInstanceState.getString(STATE_KEY_TAG)) + mTitle = savedInstanceState.getCharSequence(STATE_KEY_TITLE) + mMessage = requireNotNull(savedInstanceState.getCharSequence(STATE_KEY_MESSAGE)) + mPositiveButtonLabel = savedInstanceState.getCharSequence(STATE_KEY_POSITIVE_BUTTON_LABEL) + mNegativeButtonLabel = savedInstanceState.getCharSequence(STATE_KEY_NEGATIVE_BUTTON_LABEL) + } + } + + override fun onSaveInstanceState(outState: Bundle) { + outState.putString(STATE_KEY_TAG, mTag) + outState.putCharSequence(STATE_KEY_TITLE, mTitle) + outState.putCharSequence(STATE_KEY_MESSAGE, mMessage) + outState.putCharSequence(STATE_KEY_POSITIVE_BUTTON_LABEL, mPositiveButtonLabel) + outState.putCharSequence(STATE_KEY_NEGATIVE_BUTTON_LABEL, mNegativeButtonLabel) + super.onSaveInstanceState(outState) + } + + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + val builder = MaterialAlertDialogBuilder(requireActivity()) + builder.setMessage(mMessage) + + mTitle?.let { + builder.setTitle(mTitle) + } + + mPositiveButtonLabel?.let { + builder.setPositiveButton(mPositiveButtonLabel) { _, _ -> + dismissedByPositiveButton = true + val activity = activity + if (activity != null) { + (activity as BasicDialogPositiveClickInterface).onPositiveClicked(mTag) + } + } + + mNegativeButtonLabel?.let { + builder.setNegativeButton(mNegativeButtonLabel) { _, _ -> + dismissedByNegativeButton = true + if (activity != null) { + (activity as BasicDialogNegativeClickInterface).onNegativeClicked(mTag) + } + } + } + + return builder.create() + } + + override fun onAttach(context: Context) { + super.onAttach(context) + } + + override fun onDismiss(dialog: DialogInterface) { + val activity = activity + if (activity != null && activity is BasicDialogOnDismissByOutsideTouchInterface) { + // Only handle the event if it wasn't triggered by a button + if (!dismissedByPositiveButton && !dismissedByNegativeButton) { + (activity as BasicDialogOnDismissByOutsideTouchInterface).onDismissByOutsideTouch(mTag) + } + } + super.onDismiss(dialog) + } + + companion object { + private const val STATE_KEY_TAG = "state_key_tag" + private const val STATE_KEY_TITLE = "state_key_title" + private const val STATE_KEY_MESSAGE = "state_key_message" + private const val STATE_KEY_POSITIVE_BUTTON_LABEL = "state_key_positive_button_label" + private const val STATE_KEY_NEGATIVE_BUTTON_LABEL = "state_key_negative_button_label" + } +} From 41c25e0a774428e48f3ae2208f0a107feabeef19 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 08:17:55 +0100 Subject: [PATCH 29/76] Add mediaId to GutenbergDialogFragment's constructor --- .../android/editor/gutenberg/GutenbergDialogFragment.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index 51f7a2f0e49e..f90942ad4142 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -14,6 +14,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { private var mPositiveButtonLabel: CharSequence? = null private var mTitle: CharSequence? = null private var mNegativeButtonLabel: CharSequence? = null + private var mMediaId: Int = 0 private var dismissedByPositiveButton = false private var dismissedByNegativeButton = false @@ -35,12 +36,14 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { message: CharSequence, positiveButtonLabel: CharSequence, negativeButtonLabel: CharSequence? = null, + mediaId: Int, ) { mTag = tag mTitle = title mMessage = message mPositiveButtonLabel = positiveButtonLabel mNegativeButtonLabel = negativeButtonLabel + mMediaId = mediaId } override fun onCreate(savedInstanceState: Bundle?) { @@ -55,6 +58,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { mMessage = requireNotNull(savedInstanceState.getCharSequence(STATE_KEY_MESSAGE)) mPositiveButtonLabel = savedInstanceState.getCharSequence(STATE_KEY_POSITIVE_BUTTON_LABEL) mNegativeButtonLabel = savedInstanceState.getCharSequence(STATE_KEY_NEGATIVE_BUTTON_LABEL) + mMediaId = savedInstanceState.getInt(STATE_KEY_MEDIA_ID) } } @@ -64,6 +68,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { outState.putCharSequence(STATE_KEY_MESSAGE, mMessage) outState.putCharSequence(STATE_KEY_POSITIVE_BUTTON_LABEL, mPositiveButtonLabel) outState.putCharSequence(STATE_KEY_NEGATIVE_BUTTON_LABEL, mNegativeButtonLabel) + outState.putInt(STATE_KEY_MEDIA_ID, mMediaId) super.onSaveInstanceState(outState) } @@ -117,5 +122,6 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { private const val STATE_KEY_MESSAGE = "state_key_message" private const val STATE_KEY_POSITIVE_BUTTON_LABEL = "state_key_positive_button_label" private const val STATE_KEY_NEGATIVE_BUTTON_LABEL = "state_key_negative_button_label" + private const val STATE_KEY_MEDIA_ID = "state_key_media_id" } } From d772cbf66a7bc0650209ca586f43623829061ff6 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 08:20:22 +0100 Subject: [PATCH 30/76] Edit "onNegativeClicked" and "onPositiveClicked" so that interface can be used in parent fragment, rather than host activity --- .../editor/gutenberg/GutenbergDialogFragment.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index f90942ad4142..668b006ad3d5 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -83,17 +83,19 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { mPositiveButtonLabel?.let { builder.setPositiveButton(mPositiveButtonLabel) { _, _ -> dismissedByPositiveButton = true - val activity = activity - if (activity != null) { - (activity as BasicDialogPositiveClickInterface).onPositiveClicked(mTag) + val parentFragment: Fragment? = parentFragment + if (parentFragment != null) { + (parentFragment as BasicDialogPositiveClickInterface).onPositiveClicked(mTag, mMediaId) } + }.setCancelable(true) } mNegativeButtonLabel?.let { builder.setNegativeButton(mNegativeButtonLabel) { _, _ -> dismissedByNegativeButton = true - if (activity != null) { - (activity as BasicDialogNegativeClickInterface).onNegativeClicked(mTag) + val parentFragment: Fragment? = parentFragment + if (parentFragment != null) { + (parentFragment as BasicDialogNegativeClickInterface).onNegativeClicked(mTag) } } } From 193a41b01b21d8e7b52f1dc3f3b81c818402b7d9 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 08:22:08 +0100 Subject: [PATCH 31/76] Implement BasicDialogPositiveClickInterface and BasicDialogNegativeClickInterface in GutenbergEditorFragment.java --- .../editor/gutenberg/GutenbergEditorFragment.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index ec7f22b427c2..3f51f2fc5a7e 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -44,6 +44,8 @@ import org.wordpress.android.editor.LiveTextWatcher; import org.wordpress.android.editor.R; import org.wordpress.android.editor.WPGutenbergWebViewActivity; +import org.wordpress.android.editor.gutenberg.GutenbergDialogFragment.BasicDialogPositiveClickInterface; +import org.wordpress.android.editor.gutenberg.GutenbergDialogFragment.BasicDialogNegativeClickInterface; import org.wordpress.android.util.AppLog; import org.wordpress.android.util.AppLog.T; import org.wordpress.android.util.DateTimeUtils; @@ -84,7 +86,9 @@ public class GutenbergEditorFragment extends EditorFragmentAbstract implements EditorMediaUploadListener, IHistoryListener, EditorThemeUpdateListener, - StorySaveMediaListener { + StorySaveMediaListener, + BasicDialogPositiveClickInterface, + BasicDialogNegativeClickInterface { private static final String GUTENBERG_EDITOR_NAME = "gutenberg"; private static final String KEY_HTML_MODE_ENABLED = "KEY_HTML_MODE_ENABLED"; private static final String KEY_EDITOR_DID_MOUNT = "KEY_EDITOR_DID_MOUNT"; @@ -1380,4 +1384,12 @@ public void onEditorThemeUpdated(Bundle editorTheme) { public void showNotice(String message) { getGutenbergContainerFragment().showNotice(message); } + + @Override + public void onPositiveClicked(@NotNull String instanceTag, int mediaId) { + } + + @Override + public void onNegativeClicked(@NotNull String instanceTag) { + } } From 1a988c76e587e96c62add9a55215f5ff9a277fd2 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 08:24:23 +0100 Subject: [PATCH 32/76] Refactor showFeaturedImageConfirmationDialog() to use new GutenbergDialogFragment --- .../gutenberg/GutenbergEditorFragment.java | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 3f51f2fc5a7e..ce8991459a94 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -113,6 +113,8 @@ public class GutenbergEditorFragment extends EditorFragmentAbstract implements private static final int UNSUPPORTED_BLOCK_REQUEST_CODE = 1001; + private static final String TAG_REPLACE_FEATURED_DIALOG = "REPLACE_FEATURED_DIALOG"; + private boolean mHtmlModeEnabled; private Handler mInvalidateOptionsHandler; @@ -789,26 +791,18 @@ public void onClick(DialogInterface dialog, int id) { dialog.show(); } - private void showFeaturedImageConfirmationDialog(final int mediaId) { - AlertDialog.Builder builder = new MaterialAlertDialogBuilder(getActivity()); - builder.setTitle(R.string.replace_current_title); - builder.setMessage(R.string.replace_current_description); - builder.setPositiveButton(R.string.replace_current_confirmation, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.dismiss(); - setFeaturedImage(mediaId); - } - }); - - builder.setNegativeButton(R.string.replace_current_cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.dismiss(); - } - }); + public void showFeaturedImageConfirmationDialog(final int mediaId) { + GutenbergDialogFragment dialog = new GutenbergDialogFragment(); + dialog.initialize( + TAG_REPLACE_FEATURED_DIALOG, + getString(R.string.replace_current_title), + getString(R.string.replace_current_description), + getString(R.string.replace_current_confirmation), + getString(R.string.replace_current_cancel), + mediaId + ); - AlertDialog dialog = builder.create(); - dialog.show(); + dialog.show(getChildFragmentManager(), TAG_REPLACE_FEATURED_DIALOG); } private void setFeaturedImage(int mediaId) { From 246334e6ab58e1a23f7820a2bf9156ba0caad32f Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 08:25:44 +0100 Subject: [PATCH 33/76] Add "org.jetbrains.annotations.NotNull" import This is needed in order for the @NotNull annotations in onPositiveClicked() and onNegativeClicked() to work without error. --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index ce8991459a94..5bafd9450eda 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -34,6 +34,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.gson.Gson; +import org.jetbrains.annotations.NotNull; import org.wordpress.android.editor.BuildConfig; import org.wordpress.android.editor.EditorEditMediaListener; import org.wordpress.android.editor.EditorFragmentAbstract; From 8bb883734aaae43069f66ae1951cd32b94595b83 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 08:26:59 +0100 Subject: [PATCH 34/76] Fill out "onPositiveClicked" function When the positive button in the "Replace Featured" dialog is clicked, setFeaturedImage() should be called. --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 5bafd9450eda..3c957cb359a0 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -1382,6 +1382,11 @@ public void showNotice(String message) { @Override public void onPositiveClicked(@NotNull String instanceTag, int mediaId) { + switch (instanceTag) { + case TAG_REPLACE_FEATURED_DIALOG: + setFeaturedImage(mediaId); + break; + } } @Override From f35cea530574abd80315215133f7d41057896494 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 08:27:30 +0100 Subject: [PATCH 35/76] Fill out onNegativeClicked() function When the negative button in the "Replace Featured" dialog is clicked, the dialog should just simply be dismissed. --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 3c957cb359a0..3bc8fcae5a11 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -1391,5 +1391,10 @@ public void onPositiveClicked(@NotNull String instanceTag, int mediaId) { @Override public void onNegativeClicked(@NotNull String instanceTag) { + switch (instanceTag) { + case TAG_REPLACE_FEATURED_DIALOG: + // Dismiss dialog with no action. + break; + } } } From 3da4908f6499fd612a3b77c9612556c0bcaac828 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 08:32:24 +0100 Subject: [PATCH 36/76] Rename instances of "BasicDialog" to "GutenbergDialog" --- .../editor/gutenberg/GutenbergDialogFragment.kt | 14 +++++++------- .../editor/gutenberg/GutenbergEditorFragment.java | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index 668b006ad3d5..9267e10f0020 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -18,15 +18,15 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { private var dismissedByPositiveButton = false private var dismissedByNegativeButton = false - interface BasicDialogPositiveClickInterface { + interface GutenbergDialogPositiveClickInterface { fun onPositiveClicked(instanceTag: String, mediaId: Int) } - interface BasicDialogNegativeClickInterface { + interface GutenbergDialogNegativeClickInterface { fun onNegativeClicked(instanceTag: String) } - interface BasicDialogOnDismissByOutsideTouchInterface { + interface GutenbergDialogOnDismissByOutsideTouchInterface { fun onDismissByOutsideTouch(instanceTag: String) } @@ -85,7 +85,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { dismissedByPositiveButton = true val parentFragment: Fragment? = parentFragment if (parentFragment != null) { - (parentFragment as BasicDialogPositiveClickInterface).onPositiveClicked(mTag, mMediaId) + (parentFragment as GutenbergDialogPositiveClickInterface).onPositiveClicked(mTag, mMediaId) } }.setCancelable(true) } @@ -95,7 +95,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { dismissedByNegativeButton = true val parentFragment: Fragment? = parentFragment if (parentFragment != null) { - (parentFragment as BasicDialogNegativeClickInterface).onNegativeClicked(mTag) + (parentFragment as GutenbergDialogNegativeClickInterface).onNegativeClicked(mTag) } } } @@ -109,10 +109,10 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { override fun onDismiss(dialog: DialogInterface) { val activity = activity - if (activity != null && activity is BasicDialogOnDismissByOutsideTouchInterface) { + if (activity != null && activity is GutenbergDialogOnDismissByOutsideTouchInterface) { // Only handle the event if it wasn't triggered by a button if (!dismissedByPositiveButton && !dismissedByNegativeButton) { - (activity as BasicDialogOnDismissByOutsideTouchInterface).onDismissByOutsideTouch(mTag) + (activity as GutenbergDialogOnDismissByOutsideTouchInterface).onDismissByOutsideTouch(mTag) } } super.onDismiss(dialog) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 3bc8fcae5a11..e51c91e9b760 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -45,8 +45,8 @@ import org.wordpress.android.editor.LiveTextWatcher; import org.wordpress.android.editor.R; import org.wordpress.android.editor.WPGutenbergWebViewActivity; -import org.wordpress.android.editor.gutenberg.GutenbergDialogFragment.BasicDialogPositiveClickInterface; -import org.wordpress.android.editor.gutenberg.GutenbergDialogFragment.BasicDialogNegativeClickInterface; +import org.wordpress.android.editor.gutenberg.GutenbergDialogFragment.GutenbergDialogPositiveClickInterface; +import org.wordpress.android.editor.gutenberg.GutenbergDialogFragment.GutenbergDialogNegativeClickInterface; import org.wordpress.android.util.AppLog; import org.wordpress.android.util.AppLog.T; import org.wordpress.android.util.DateTimeUtils; @@ -88,8 +88,8 @@ public class GutenbergEditorFragment extends EditorFragmentAbstract implements IHistoryListener, EditorThemeUpdateListener, StorySaveMediaListener, - BasicDialogPositiveClickInterface, - BasicDialogNegativeClickInterface { + GutenbergDialogPositiveClickInterface, + GutenbergDialogNegativeClickInterface { private static final String GUTENBERG_EDITOR_NAME = "gutenberg"; private static final String KEY_HTML_MODE_ENABLED = "KEY_HTML_MODE_ENABLED"; private static final String KEY_EDITOR_DID_MOUNT = "KEY_EDITOR_DID_MOUNT"; From 983ff6c638aaa52acbc1588297e78b688b119add Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 09:35:51 +0100 Subject: [PATCH 37/76] Update reference to Gutenberg Mobile --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 467b08739f95..4eb301278248 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-3407f793fccc2032a53728b879202a2421695297' + ext.gutenbergMobileVersion = '3116-1fdea8f520763d6abc2bd6a944857e7d3683369b' repositories { google() From cd572af85ca8645ae85e85b2bcc126cb08389fbc Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 10:32:44 +0100 Subject: [PATCH 38/76] Rename "onPositiveClicked" and "onNegativeClicked" These functions have been renamed to "onGutenbergDialogPositiveClicked" and "onGutenbergDialogNegativeClicked" respectively, in order to make their purpose clearer. --- .../android/editor/gutenberg/GutenbergDialogFragment.kt | 8 ++++---- .../android/editor/gutenberg/GutenbergEditorFragment.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index 9267e10f0020..925b087273ea 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -19,11 +19,11 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { private var dismissedByNegativeButton = false interface GutenbergDialogPositiveClickInterface { - fun onPositiveClicked(instanceTag: String, mediaId: Int) + fun onGutenbergDialogPositiveClicked(instanceTag: String, mediaId: Int) } interface GutenbergDialogNegativeClickInterface { - fun onNegativeClicked(instanceTag: String) + fun onGutenbergDialogNegativeClicked(instanceTag: String) } interface GutenbergDialogOnDismissByOutsideTouchInterface { @@ -85,7 +85,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { dismissedByPositiveButton = true val parentFragment: Fragment? = parentFragment if (parentFragment != null) { - (parentFragment as GutenbergDialogPositiveClickInterface).onPositiveClicked(mTag, mMediaId) + (parentFragment as GutenbergDialogPositiveClickInterface).onGutenbergDialogPositiveClicked(mTag, mMediaId) } }.setCancelable(true) } @@ -95,7 +95,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { dismissedByNegativeButton = true val parentFragment: Fragment? = parentFragment if (parentFragment != null) { - (parentFragment as GutenbergDialogNegativeClickInterface).onNegativeClicked(mTag) + (parentFragment as GutenbergDialogNegativeClickInterface).onGutenbergDialogNegativeClicked(mTag) } } } diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index e51c91e9b760..46fd566f0db6 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -1381,7 +1381,7 @@ public void showNotice(String message) { } @Override - public void onPositiveClicked(@NotNull String instanceTag, int mediaId) { + public void onGutenbergDialogPositiveClicked(@NotNull String instanceTag, int mediaId) { switch (instanceTag) { case TAG_REPLACE_FEATURED_DIALOG: setFeaturedImage(mediaId); @@ -1390,7 +1390,7 @@ public void onPositiveClicked(@NotNull String instanceTag, int mediaId) { } @Override - public void onNegativeClicked(@NotNull String instanceTag) { + public void onGutenbergDialogNegativeClicked(@NotNull String instanceTag) { switch (instanceTag) { case TAG_REPLACE_FEATURED_DIALOG: // Dismiss dialog with no action. From 349fe906461571259ab798ebb9a3a2bbb9c90212 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 13:31:54 +0100 Subject: [PATCH 39/76] Reformat code in GutenbergDialogFragment.kt --- .../android/editor/gutenberg/GutenbergDialogFragment.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index 925b087273ea..cda5bbf4fdfb 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -85,7 +85,10 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { dismissedByPositiveButton = true val parentFragment: Fragment? = parentFragment if (parentFragment != null) { - (parentFragment as GutenbergDialogPositiveClickInterface).onGutenbergDialogPositiveClicked(mTag, mMediaId) + (parentFragment as GutenbergDialogPositiveClickInterface).onGutenbergDialogPositiveClicked( + mTag, + mMediaId + ) } }.setCancelable(true) } @@ -95,7 +98,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { dismissedByNegativeButton = true val parentFragment: Fragment? = parentFragment if (parentFragment != null) { - (parentFragment as GutenbergDialogNegativeClickInterface).onGutenbergDialogNegativeClicked(mTag) + (parentFragment as GutenbergDialogNegativeClickInterface).onGutenbergDialogNegativeClicked(mTag) } } } From 010505f156d497d53e4429ce549a706b7298e2f8 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 13:46:48 +0100 Subject: [PATCH 40/76] Update build.grade with latest reference to Gutenberg Mobile --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9816e497e307..b0a057aead10 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-1fdea8f520763d6abc2bd6a944857e7d3683369b' + ext.gutenbergMobileVersion = '3116-7bf12e282ad0455cf534a2c8d87187589e2b835a' repositories { google() From f57eeaf8703a2ef816cc98949a54b99ab6432584 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 16:13:16 +0100 Subject: [PATCH 41/76] Save "mFeaturedImageId" in savedInstanceState() and onSaveInstanceState() methods Saving "mFeaturedImageId" in these methods prevents its value being lost when the screen is rotated. This addresses the bug outlined here: https://github.com/wordpress-mobile/WordPress-Android/pull/14503#issuecomment-844950869 --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 46fd566f0db6..0c9689f60139 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -101,6 +101,7 @@ public class GutenbergEditorFragment extends EditorFragmentAbstract implements public static final String ARG_STORY_BLOCK_UPDATED_CONTENT = "story_block_updated_content"; public static final String ARG_STORY_BLOCK_EXTERNALLY_EDITED_ORIGINAL_HASH = "story_block_original_hash"; public static final String ARG_FAILED_MEDIAS = "arg_failed_medias"; + public static final String ARG_FEATURED_IMAGE_ID = "featured_image_id"; private static final int CAPTURE_PHOTO_PERMISSION_REQUEST_CODE = 101; private static final int CAPTURE_VIDEO_PERMISSION_REQUEST_CODE = 102; @@ -205,6 +206,7 @@ public void onCreate(Bundle savedInstanceState) { mExternallyEditedBlockOriginalHash = savedInstanceState.getString( ARG_STORY_BLOCK_EXTERNALLY_EDITED_ORIGINAL_HASH); mFailedMediaIds = (HashSet) savedInstanceState.getSerializable(ARG_FAILED_MEDIAS); + mFeaturedImageId = savedInstanceState.getLong(ARG_FEATURED_IMAGE_ID); } } @@ -927,6 +929,7 @@ public void onSaveInstanceState(Bundle outState) { outState.putBoolean(KEY_EDITOR_DID_MOUNT, mEditorDidMount); outState.putString(ARG_STORY_BLOCK_EXTERNALLY_EDITED_ORIGINAL_HASH, mExternallyEditedBlockOriginalHash); outState.putSerializable(ARG_FAILED_MEDIAS, mFailedMediaIds); + outState.putLong(ARG_FEATURED_IMAGE_ID, mFeaturedImageId); } @Override From 3e18f04a3105d82be2db5d2a53c524dbf0638d20 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 20 May 2021 16:38:29 +0100 Subject: [PATCH 42/76] Remove redundant comma --- .../android/editor/gutenberg/GutenbergDialogFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index cda5bbf4fdfb..275278dca722 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -36,7 +36,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { message: CharSequence, positiveButtonLabel: CharSequence, negativeButtonLabel: CharSequence? = null, - mediaId: Int, + mediaId: Int ) { mTag = tag mTitle = title From aa15b61d83728861ae051d0074e0f40af641e998 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Fri, 21 May 2021 09:04:27 +0100 Subject: [PATCH 43/76] Add checks to ensure GutenbergDialogPositiveClickInterface and GutenbergDialogNegativeClickInterface (if not null) are implemented in the parent fragment --- .../android/editor/gutenberg/GutenbergDialogFragment.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index 275278dca722..a741974ec77b 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -108,6 +108,13 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { override fun onAttach(context: Context) { super.onAttach(context) + val parentFragment: Fragment? = parentFragment + if (parentFragment !is GutenbergDialogPositiveClickInterface) { + throw RuntimeException("Parent fragment must implement GutenbergDialogPositiveClickInterface") + } + if (mNegativeButtonLabel != null && parentFragment !is GutenbergDialogNegativeClickInterface) { + throw RuntimeException("Parent fragment must implement GutenbergDialogNegativeClickInterface") + } } override fun onDismiss(dialog: DialogInterface) { From 101970cfd2f1150508d81bbcefda2d173e95f832 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Fri, 21 May 2021 09:06:16 +0100 Subject: [PATCH 44/76] Don't allow "mPositiveButtonLabel" to be null --- .../android/editor/gutenberg/GutenbergDialogFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index a741974ec77b..8905401c5a4e 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -11,7 +11,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder class GutenbergDialogFragment() : AppCompatDialogFragment() { private lateinit var mTag: String private lateinit var mMessage: CharSequence - private var mPositiveButtonLabel: CharSequence? = null + private var mPositiveButtonLabel: CharSequence private var mTitle: CharSequence? = null private var mNegativeButtonLabel: CharSequence? = null private var mMediaId: Int = 0 @@ -56,7 +56,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { mTag = requireNotNull(savedInstanceState.getString(STATE_KEY_TAG)) mTitle = savedInstanceState.getCharSequence(STATE_KEY_TITLE) mMessage = requireNotNull(savedInstanceState.getCharSequence(STATE_KEY_MESSAGE)) - mPositiveButtonLabel = savedInstanceState.getCharSequence(STATE_KEY_POSITIVE_BUTTON_LABEL) + mPositiveButtonLabel = requireNotNull(savedInstanceState.getCharSequence(STATE_KEY_POSITIVE_BUTTON_LABEL)) mNegativeButtonLabel = savedInstanceState.getCharSequence(STATE_KEY_NEGATIVE_BUTTON_LABEL) mMediaId = savedInstanceState.getInt(STATE_KEY_MEDIA_ID) } From 24a053275df69f69924ab7dbf9ff60787ce30f8d Mon Sep 17 00:00:00 2001 From: Siobhan Date: Fri, 21 May 2021 09:09:32 +0100 Subject: [PATCH 45/76] Add "lateinit" modifier to mPositiveButtonLabel --- .../android/editor/gutenberg/GutenbergDialogFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index 8905401c5a4e..3beeb2e95595 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -11,7 +11,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder class GutenbergDialogFragment() : AppCompatDialogFragment() { private lateinit var mTag: String private lateinit var mMessage: CharSequence - private var mPositiveButtonLabel: CharSequence + private lateinit var mPositiveButtonLabel: CharSequence private var mTitle: CharSequence? = null private var mNegativeButtonLabel: CharSequence? = null private var mMediaId: Int = 0 From 7348943876467cd0ff3e7e9fa572e62c5c7abc07 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Fri, 21 May 2021 10:35:46 +0100 Subject: [PATCH 46/76] Add Tracks event that fires when a featured image is removed from the Gutenberg editor This commit adds a "IMAGE_REMOVED_GUTENBERG_EDITOR" event to complement the "IMAGE_PICKED_GUTENBERG_EDITOR" event, for when an image is removed via the image block. --- .../android/ui/posts/EditPostActivity.java | 16 +++++++++++----- .../android/ui/posts/FeaturedImageHelper.kt | 1 + .../android/analytics/AnalyticsTracker.java | 1 + .../analytics/AnalyticsTrackerNosara.java | 2 ++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index 5392af85952d..d06b6a737469 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -2490,11 +2490,17 @@ private void setFeaturedImageId(final long mediaId, final boolean imagePicked, f } int postId = getEditPostRepository().getId(); - mFeaturedImageHelper.trackFeaturedImageEvent( - FeaturedImageHelper.TrackableEvent.IMAGE_PICKED_GUTENBERG_EDITOR, - postId - ); - + if (mediaId == 0) { + mFeaturedImageHelper.trackFeaturedImageEvent( + FeaturedImageHelper.TrackableEvent.IMAGE_REMOVED_GUTENBERG_EDITOR, + postId + ); + } else { + mFeaturedImageHelper.trackFeaturedImageEvent( + FeaturedImageHelper.TrackableEvent.IMAGE_PICKED_GUTENBERG_EDITOR, + postId + ); + } mUpdateFeaturedImageUseCase.updateFeaturedImage(mediaId, postRepository, postModel -> null); } else if (mEditPostSettingsFragment != null) { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/FeaturedImageHelper.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/FeaturedImageHelper.kt index 30c38865c6f9..7304aa7ca34a 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/FeaturedImageHelper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/FeaturedImageHelper.kt @@ -203,6 +203,7 @@ class FeaturedImageHelper @Inject constructor( IMAGE_SET_CLICKED(Stat.FEATURED_IMAGE_SET_CLICKED_POST_SETTINGS), IMAGE_PICKED_POST_SETTINGS(Stat.FEATURED_IMAGE_PICKED_POST_SETTINGS), IMAGE_PICKED_GUTENBERG_EDITOR(Stat.FEATURED_IMAGE_PICKED_GUTENBERG_EDITOR), + IMAGE_REMOVED_GUTENBERG_EDITOR(Stat.FEATURED_IMAGE_REMOVED_GUTENBERG_EDITOR), IMAGE_UPLOAD_CANCELED(Stat.FEATURED_IMAGE_UPLOAD_CANCELED_POST_SETTINGS), IMAGE_UPLOAD_RETRY_CLICKED(Stat.FEATURED_IMAGE_UPLOAD_RETRY_CLICKED_POST_SETTINGS), IMAGE_REMOVE_CLICKED(Stat.FEATURED_IMAGE_REMOVE_CLICKED_POST_SETTINGS) diff --git a/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java b/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java index 8d8cbfa171b7..0847212d08eb 100644 --- a/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java +++ b/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java @@ -692,6 +692,7 @@ public enum Stat { FEATURED_IMAGE_SET_CLICKED_POST_SETTINGS, FEATURED_IMAGE_PICKED_POST_SETTINGS, FEATURED_IMAGE_PICKED_GUTENBERG_EDITOR, + FEATURED_IMAGE_REMOVED_GUTENBERG_EDITOR, FEATURED_IMAGE_UPLOAD_CANCELED_POST_SETTINGS, FEATURED_IMAGE_UPLOAD_RETRY_CLICKED_POST_SETTINGS, FEATURED_IMAGE_REMOVE_CLICKED_POST_SETTINGS, diff --git a/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java b/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java index 9e20542a5536..2cb04dd62ff3 100644 --- a/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java +++ b/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java @@ -1892,6 +1892,8 @@ public static String getEventNameForStat(AnalyticsTracker.Stat stat) { return "featured_image_picked_post_settings"; case FEATURED_IMAGE_PICKED_GUTENBERG_EDITOR: return "featured_image_picked_gutenberg_editor"; + case FEATURED_IMAGE_REMOVED_GUTENBERG_EDITOR: + return "featured_image_removed_gutenberg_editor"; case FEATURED_IMAGE_UPLOAD_CANCELED_POST_SETTINGS: return "featured_image_upload_canceled_post_settings"; case FEATURED_IMAGE_UPLOAD_RETRY_CLICKED_POST_SETTINGS: From bf1942f4887c7a34327a522cdb2dad342df6bc48 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Mon, 24 May 2021 15:37:10 +0100 Subject: [PATCH 47/76] Refactor null-checks and casting in setPositiveButton() and setNegativeButton() This commit refeactors, setPositiveButton() and setNegativeButton() so that "?.let" is used instead of "!= null" as a null-check for the parentFragment. --- .../editor/gutenberg/GutenbergDialogFragment.kt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index 3beeb2e95595..d8fd74f118d8 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -83,12 +83,8 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { mPositiveButtonLabel?.let { builder.setPositiveButton(mPositiveButtonLabel) { _, _ -> dismissedByPositiveButton = true - val parentFragment: Fragment? = parentFragment - if (parentFragment != null) { - (parentFragment as GutenbergDialogPositiveClickInterface).onGutenbergDialogPositiveClicked( - mTag, - mMediaId - ) + (parentFragment as? GutenbergDialogPositiveClickInterface)?.let { + it.onGutenbergDialogPositiveClicked(mTag, mMediaId); } }.setCancelable(true) } @@ -96,9 +92,8 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { mNegativeButtonLabel?.let { builder.setNegativeButton(mNegativeButtonLabel) { _, _ -> dismissedByNegativeButton = true - val parentFragment: Fragment? = parentFragment - if (parentFragment != null) { - (parentFragment as GutenbergDialogNegativeClickInterface).onGutenbergDialogNegativeClicked(mTag) + (parentFragment as? GutenbergDialogNegativeClickInterface)?.let { + it.onGutenbergDialogNegativeClicked(mTag); } } } From fe93e0b88405bd4240c6263769ed56fae72f14d0 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Mon, 24 May 2021 15:41:45 +0100 Subject: [PATCH 48/76] Refactor if/else statement in onSetFeaturedImageButtonClicked() With this commit, the if/else statement is refactored to a series of single if statements, with accompanying comments. The goal is to make the code more readable and for it to be clearer what the purpose of each combination is. It also adds an explicit if statement for any cases where the mediaId may equal mFeaturedImageId. --- .../gutenberg/GutenbergEditorFragment.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 0c9689f60139..de5fd099076e 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -346,11 +346,25 @@ public void onQueryCurrentProgressForUploadingMedia() { new OnSetFeaturedImageListener() { @Override public void onSetFeaturedImageButtonClicked(int mediaId) { - if (mediaId == 0 || mFeaturedImageId == 0) { + if (mediaId == mFeaturedImageId) { + // nothing special to do, trying to set the image that's already set as featured + return; + } + + if (mediaId == 0) { + // user tries to clear the featured image setting + setFeaturedImage(mediaId); + return; + } + + if (mFeaturedImageId == 0) { + // current featured image is not set so, go ahead and set it to the provided one setFeaturedImage(mediaId); - } else if (mFeaturedImageId != mediaId) { - showFeaturedImageConfirmationDialog(mediaId); + return; } + + // ask the user to confirm changing the featured image since there's already one set + showFeaturedImageConfirmationDialog(mediaId); } }, new OnEditorMountListener() { From 33fd3685a4268e73babf08cbdb2bd59b440dffae Mon Sep 17 00:00:00 2001 From: Siobhan Date: Mon, 24 May 2021 15:49:14 +0100 Subject: [PATCH 49/76] Remove call to sendToJSFeaturedImageId() from within setFeaturedImage() sendToJSFeaturedImageId() doesn't need to be called here, as it's already called directly from updateFeaturedImage() function two lines up. --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index de5fd099076e..b82b8f298f10 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -826,7 +826,6 @@ private void setFeaturedImage(int mediaId) { mEditorFragmentListener.updateFeaturedImage(mediaId, false); // Necessary to update image in Post Settings setFeaturedImageId(mediaId); - sendToJSFeaturedImageId(mediaId); if (mediaId == 0) { showNotice(getString(R.string.featured_image_removed)); From 854dd6dad7cd9df8e4991c009eb9e66f0a343a55 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Mon, 24 May 2021 21:15:59 +0100 Subject: [PATCH 50/76] Remove unnecessary semi-colons --- .../android/editor/gutenberg/GutenbergDialogFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index d8fd74f118d8..2355fe79c4b3 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -84,7 +84,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { builder.setPositiveButton(mPositiveButtonLabel) { _, _ -> dismissedByPositiveButton = true (parentFragment as? GutenbergDialogPositiveClickInterface)?.let { - it.onGutenbergDialogPositiveClicked(mTag, mMediaId); + it.onGutenbergDialogPositiveClicked(mTag, mMediaId) } }.setCancelable(true) } @@ -93,7 +93,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { builder.setNegativeButton(mNegativeButtonLabel) { _, _ -> dismissedByNegativeButton = true (parentFragment as? GutenbergDialogNegativeClickInterface)?.let { - it.onGutenbergDialogNegativeClicked(mTag); + it.onGutenbergDialogNegativeClicked(mTag) } } } From 62caa422b53889dd6b9026880207276d789c384e Mon Sep 17 00:00:00 2001 From: Siobhan Date: Mon, 24 May 2021 21:27:56 +0100 Subject: [PATCH 51/76] Refine string names --- .../editor/gutenberg/GutenbergEditorFragment.java | 8 ++++---- .../WordPressEditor/src/main/res/values/strings.xml | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index b82b8f298f10..4206e3a69fd1 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -812,10 +812,10 @@ public void showFeaturedImageConfirmationDialog(final int mediaId) { GutenbergDialogFragment dialog = new GutenbergDialogFragment(); dialog.initialize( TAG_REPLACE_FEATURED_DIALOG, - getString(R.string.replace_current_title), - getString(R.string.replace_current_description), - getString(R.string.replace_current_confirmation), - getString(R.string.replace_current_cancel), + getString(R.string.featured_image_replace_dialog_title), + getString(R.string.featured_image_replace_dialog_description), + getString(R.string.featured_image_replace_dialog_confirm), + getString(R.string.featured_image_replace_dialog_cancel), mediaId ); diff --git a/libs/editor/WordPressEditor/src/main/res/values/strings.xml b/libs/editor/WordPressEditor/src/main/res/values/strings.xml index cc859fb8abdf..e6380df716bd 100644 --- a/libs/editor/WordPressEditor/src/main/res/values/strings.xml +++ b/libs/editor/WordPressEditor/src/main/res/values/strings.xml @@ -155,12 +155,12 @@ Dismiss - Replace current? - You already have a featured image set. Do you want to replace it? - Replace - Cancel + Replace current? + You already have a featured image set. Do you want to replace it? + Replace + Cancel - Set as Featured Image - Removed as Featured Image + Set as Featured Image + Removed as Featured Image From 6fd6fc00d8d0d6b4a33186078bf4e1a6b61dac4a Mon Sep 17 00:00:00 2001 From: Siobhan Date: Mon, 24 May 2021 21:38:17 +0100 Subject: [PATCH 52/76] Update string name being passed to showNotice() calls --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 4206e3a69fd1..f27ad5e282cf 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -828,9 +828,9 @@ private void setFeaturedImage(int mediaId) { setFeaturedImageId(mediaId); if (mediaId == 0) { - showNotice(getString(R.string.featured_image_removed)); + showNotice(getString(R.string.featured_image_removed_notice)); } else { - showNotice(getString(R.string.featured_image_confirmation)); + showNotice(getString(R.string.featured_image_confirmation_notice)); } } From 3751c08be07892d8c47e93812e26251642c53815 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Tue, 25 May 2021 10:39:02 +0100 Subject: [PATCH 53/76] Update comment to clarify reasoning behind "setFeaturedImageId" call --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index f27ad5e282cf..f14f8a0b989a 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -824,7 +824,8 @@ public void showFeaturedImageConfirmationDialog(final int mediaId) { private void setFeaturedImage(int mediaId) { mEditorFragmentListener.updateFeaturedImage(mediaId, false); - // Necessary to update image in Post Settings + + // Ensure "mFeaturedImageId" member variable is updated to specified "mediaId" setFeaturedImageId(mediaId); if (mediaId == 0) { From b4dc8252d0706ec223a38614546cffbb94d5c292 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Tue, 25 May 2021 12:31:26 +0100 Subject: [PATCH 54/76] Reword "featured_image_replace_dialog_title" string --- libs/editor/WordPressEditor/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/editor/WordPressEditor/src/main/res/values/strings.xml b/libs/editor/WordPressEditor/src/main/res/values/strings.xml index e6380df716bd..8419ce3e9c73 100644 --- a/libs/editor/WordPressEditor/src/main/res/values/strings.xml +++ b/libs/editor/WordPressEditor/src/main/res/values/strings.xml @@ -155,7 +155,7 @@ Dismiss - Replace current? + Replace? You already have a featured image set. Do you want to replace it? Replace Cancel From 9630c2955da873dbbd033849a6d1494876bbb582 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Tue, 25 May 2021 15:35:48 +0100 Subject: [PATCH 55/76] Introduce "MEDIA_ID_NO_FEATURED_IMAGE_SET" const With this commit, a "MEDIA_ID_NO_FEATURED_IMAGE_SET" constant is introduced and used in checks where a featured image is being removed or is already set to zero. The purpose behind introducing a constant is to make its purpose clearer and make it easier to change in the future, if needed. --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index f14f8a0b989a..4aaf180831f5 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -117,6 +117,8 @@ public class GutenbergEditorFragment extends EditorFragmentAbstract implements private static final String TAG_REPLACE_FEATURED_DIALOG = "REPLACE_FEATURED_DIALOG"; + private static final int MEDIA_ID_NO_FEATURED_IMAGE_SET = 0; + private boolean mHtmlModeEnabled; private Handler mInvalidateOptionsHandler; @@ -351,13 +353,13 @@ public void onSetFeaturedImageButtonClicked(int mediaId) { return; } - if (mediaId == 0) { + if (mediaId == MEDIA_ID_NO_FEATURED_IMAGE_SET) { // user tries to clear the featured image setting setFeaturedImage(mediaId); return; } - if (mFeaturedImageId == 0) { + if (mFeaturedImageId == MEDIA_ID_NO_FEATURED_IMAGE_SET) { // current featured image is not set so, go ahead and set it to the provided one setFeaturedImage(mediaId); return; @@ -828,7 +830,7 @@ private void setFeaturedImage(int mediaId) { // Ensure "mFeaturedImageId" member variable is updated to specified "mediaId" setFeaturedImageId(mediaId); - if (mediaId == 0) { + if (mediaId == MEDIA_ID_NO_FEATURED_IMAGE_SET) { showNotice(getString(R.string.featured_image_removed_notice)); } else { showNotice(getString(R.string.featured_image_confirmation_notice)); From 7924341c7b430ec48d6fbb56d2f4d6a8866491c9 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 26 May 2021 14:30:51 +0100 Subject: [PATCH 56/76] Refactor onDismiss() in GutenbergDialogFragment The function is refactor so that its interface can used in parent fragment, rather than host activity. The original code is also refactored so that "?.let" is used instead of "!= null" as a null-check for the parent fragment. --- .../android/editor/gutenberg/GutenbergDialogFragment.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index 2355fe79c4b3..08bb1c41c015 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -113,11 +113,10 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { } override fun onDismiss(dialog: DialogInterface) { - val activity = activity - if (activity != null && activity is GutenbergDialogOnDismissByOutsideTouchInterface) { + (parentFragment is GutenbergDialogOnDismissByOutsideTouchInterface)?.let { // Only handle the event if it wasn't triggered by a button if (!dismissedByPositiveButton && !dismissedByNegativeButton) { - (activity as GutenbergDialogOnDismissByOutsideTouchInterface).onDismissByOutsideTouch(mTag) + (parentFragment as? GutenbergDialogOnDismissByOutsideTouchInterface)?.let { it.onDismissByOutsideTouch(mTag) } } } super.onDismiss(dialog) From d41cd3431ba32594ecac87827694ae3a6b00e1b2 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 26 May 2021 14:53:26 +0100 Subject: [PATCH 57/76] Bump reference to Gutenberg Mobile --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b0a057aead10..f8eab69df113 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-7bf12e282ad0455cf534a2c8d87187589e2b835a' + ext.gutenbergMobileVersion = '3116-85114ed407ae9e347754c858df197e1dd2f7c1e0' repositories { google() From 36b6e2ee848e98baab166230f2e1de04366b92dd Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 26 May 2021 15:40:35 +0100 Subject: [PATCH 58/76] Remove unecessary comment before 'setFeaturedImageId' As the functionality of setFeaturedImageId() is fairly self-explanatory, the current comment before it doesn't add any value and has the potential to cause confusion around the function's importance. --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 4aaf180831f5..e7cfc42a991c 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -826,8 +826,6 @@ public void showFeaturedImageConfirmationDialog(final int mediaId) { private void setFeaturedImage(int mediaId) { mEditorFragmentListener.updateFeaturedImage(mediaId, false); - - // Ensure "mFeaturedImageId" member variable is updated to specified "mediaId" setFeaturedImageId(mediaId); if (mediaId == MEDIA_ID_NO_FEATURED_IMAGE_SET) { From 1be6762ffff5f12978283ced5de978c239159130 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 26 May 2021 15:53:03 +0100 Subject: [PATCH 59/76] Fix 'exceeded max line length' ktlint error A line in the onDismiss() function exceeded the max line length allowed, so this commit splits that line up. --- .../android/editor/gutenberg/GutenbergDialogFragment.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index 08bb1c41c015..f893fc37376c 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -116,7 +116,9 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { (parentFragment is GutenbergDialogOnDismissByOutsideTouchInterface)?.let { // Only handle the event if it wasn't triggered by a button if (!dismissedByPositiveButton && !dismissedByNegativeButton) { - (parentFragment as? GutenbergDialogOnDismissByOutsideTouchInterface)?.let { it.onDismissByOutsideTouch(mTag) } + (parentFragment as? GutenbergDialogOnDismissByOutsideTouchInterface)?.let { + it.onDismissByOutsideTouch(mTag) + } } } super.onDismiss(dialog) From c917a0c71981f47aa3a85ccb44679c22e440e018 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 26 May 2021 16:01:54 +0100 Subject: [PATCH 60/76] Remove conditional surrounding 'GutenbergDialogOnDismissByOutsideTouchInterface' in onDismiss() The 'parentFragment is GutenbergDialogOnDismissByOutsideTouchInterface' was not serving a specific purpose that the refactored 'parentFragment as? GutenbergDialogOnDismissByOutsideTouchInterface' doesn't. --- .../editor/gutenberg/GutenbergDialogFragment.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index f893fc37376c..fd23c1619e3a 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -113,12 +113,10 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { } override fun onDismiss(dialog: DialogInterface) { - (parentFragment is GutenbergDialogOnDismissByOutsideTouchInterface)?.let { - // Only handle the event if it wasn't triggered by a button - if (!dismissedByPositiveButton && !dismissedByNegativeButton) { - (parentFragment as? GutenbergDialogOnDismissByOutsideTouchInterface)?.let { - it.onDismissByOutsideTouch(mTag) - } + // Only handle the event if it wasn't triggered by a button + if (!dismissedByPositiveButton && !dismissedByNegativeButton) { + (parentFragment as? GutenbergDialogOnDismissByOutsideTouchInterface)?.let { + it.onDismissByOutsideTouch(mTag) } } super.onDismiss(dialog) From c0626bf821691c510cc31ba90a68da702fb1c1f3 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 26 May 2021 16:05:02 +0100 Subject: [PATCH 61/76] Update build.gradle reference to latest commit from Gutenberg Mobile --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f8eab69df113..2e1577398913 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-85114ed407ae9e347754c858df197e1dd2f7c1e0' + ext.gutenbergMobileVersion = '3116-4dd883c28ae903f3b09375466c8d27062978c1b9' repositories { google() From 96faacfd8413199acfa92500f05179904480fffa Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Wed, 26 May 2021 21:56:44 -0500 Subject: [PATCH 62/76] renamed capability --- .../android/editor/gutenberg/GutenbergPropsBuilder.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergPropsBuilder.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergPropsBuilder.kt index e1040eb7c8ba..05e40d8ca33f 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergPropsBuilder.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergPropsBuilder.kt @@ -14,7 +14,7 @@ data class GutenbergPropsBuilder( private val enableXPosts: Boolean, private val enableUnsupportedBlockEditor: Boolean, private val unsupportedBlockEditorSwitch: Boolean, - private val enableAudioBlock: Boolean, + private val isAudioBlockMediaUploadEnabled: Boolean, private val enableReusableBlock: Boolean, private val localeSlug: String, private val postType: String, @@ -29,7 +29,7 @@ data class GutenbergPropsBuilder( enableXPosts = enableXPosts, enableUnsupportedBlockEditor = enableUnsupportedBlockEditor, canEnableUnsupportedBlockEditor = unsupportedBlockEditorSwitch, - enableAudioBlock = enableAudioBlock, + isAudioBlockMediaUploadEnabled = isAudioBlockMediaUploadEnabled, enableReusableBlock = enableReusableBlock, localeSlug = localeSlug, postType = postType, From 2fa9eb747099e5ac388a4f0165177f8d8bd78019 Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Wed, 26 May 2021 22:13:04 -0500 Subject: [PATCH 63/76] sync stories submodule hash. --- libs/stories-android | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/stories-android b/libs/stories-android index 8866392ad6c4..98983cbfc67b 160000 --- a/libs/stories-android +++ b/libs/stories-android @@ -1 +1 @@ -Subproject commit 8866392ad6c4a275d3960d033d89a90eb21f5c4c +Subproject commit 98983cbfc67bdf48c0b4d95ae54a05a9d1ecf448 From 74a2251ba720aa64eaf55bf2cb19e41f37541679 Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Wed, 26 May 2021 23:28:27 -0500 Subject: [PATCH 64/76] updated gutenberg-mobile ref. --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 0b0353af87a8..68183650ef60 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3523-9f2a75febfcfc2978c3319d94073fc239d82ff89' + ext.gutenbergMobileVersion = '3523-3a7ec29196c4afadc6f5897b1ed2fe131b6f155f' repositories { google() From 2a1ef1321db3d5f85c024d2c2dee0a1f1ad43358 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 27 May 2021 19:48:59 +0100 Subject: [PATCH 65/76] Bump Gutenberg Mobile reference --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2e1577398913..7949bb3a80d8 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-4dd883c28ae903f3b09375466c8d27062978c1b9' + ext.gutenbergMobileVersion = '3116-f34b24e74d9b30150c1c550b0792f2e434cee421' repositories { google() From a7dababab35e915c601aa2cf1acd1b9af95df9d5 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Mon, 31 May 2021 19:10:10 +0200 Subject: [PATCH 66/76] Update Gutenberg Mobile ref --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 68183650ef60..c870578485d7 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3523-3a7ec29196c4afadc6f5897b1ed2fe131b6f155f' + ext.gutenbergMobileVersion = '3523-47a11cc6d54225c3c7d28f9deaf2ccd9bb6e4607' repositories { google() From bccaaa91476f2c9d742d72f5446ce76f8b68861c Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Mon, 31 May 2021 23:19:26 -0500 Subject: [PATCH 67/76] reformatted use case --- .../ui/posts/UpdateFeaturedImageUseCase.kt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt index dbedb9d63207..1335dcdeed77 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/UpdateFeaturedImageUseCase.kt @@ -6,13 +6,16 @@ import org.wordpress.android.ui.posts.EditPostRepository.UpdatePostResult import org.wordpress.android.ui.posts.EditPostRepository.UpdatePostResult.Updated import javax.inject.Inject -class UpdateFeaturedImageUseCase @Inject constructor() { fun updateFeaturedImage( - featuredImageId: Long, - editPostRepository: EditPostRepository, - onPostFeaturedImageUpdated: (PostImmutableModel) -> Unit -) { editPostRepository.updateAsync({ postModel: PostModel -> +class UpdateFeaturedImageUseCase @Inject constructor() { + fun updateFeaturedImage( + featuredImageId: Long, + editPostRepository: EditPostRepository, + onPostFeaturedImageUpdated: (PostImmutableModel) -> Unit + ) { + editPostRepository.updateAsync({ postModel: PostModel -> postModel.setFeaturedImageId(featuredImageId) - true }) { postModel: PostImmutableModel, result: UpdatePostResult -> + true + }) { postModel: PostImmutableModel, result: UpdatePostResult -> if (result === Updated) { onPostFeaturedImageUpdated.invoke(postModel) } From 92816a9516313fb5dc683e07f134e100afb1f604 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 1 Jun 2021 10:42:01 +0200 Subject: [PATCH 68/76] Update Gutenberg Mobile ref --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c870578485d7..d2fb0bee28cb 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = '1.40.0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3523-47a11cc6d54225c3c7d28f9deaf2ccd9bb6e4607' + ext.gutenbergMobileVersion = '3523-1fe98d426e87fc62e4b4bec02d8c58f4b42c70ac' repositories { google() From fb3ba9548da20bea53f50ca56e8bc6fc584e877e Mon Sep 17 00:00:00 2001 From: Siobhan Date: Tue, 1 Jun 2021 11:15:48 +0100 Subject: [PATCH 69/76] Import constant for use in EditPostActivity With this commit, MEDIA_ID_NO_FEATURED_IMAGE_SET is imported to EditPostActivity, so that it can be used in a conditional checking for whether a featured image is being set. --- .../java/org/wordpress/android/ui/posts/EditPostActivity.java | 3 ++- .../android/editor/gutenberg/GutenbergEditorFragment.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index 0f203ad75e14..0faf3a3f5ce3 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -239,6 +239,7 @@ import static org.wordpress.android.analytics.AnalyticsTracker.Stat.APP_REVIEWS_EVENT_INCREMENTED_BY_PUBLISHING_POST_OR_PAGE; import static org.wordpress.android.imageeditor.preview.PreviewImageFragment.PREVIEW_IMAGE_REDUCED_SIZE_FACTOR; import static org.wordpress.android.ui.history.HistoryDetailContainerFragment.KEY_REVISION; +import static org.wordpress.android.editor.gutenberg.GutenbergEditorFragment.MEDIA_ID_NO_FEATURED_IMAGE_SET; import kotlin.Unit; import kotlin.jvm.functions.Function0; @@ -2493,7 +2494,7 @@ private void setFeaturedImageId(final long mediaId, final boolean imagePicked, f } int postId = getEditPostRepository().getId(); - if (mediaId == 0) { + if (mediaId == MEDIA_ID_NO_FEATURED_IMAGE_SET) { mFeaturedImageHelper.trackFeaturedImageEvent( FeaturedImageHelper.TrackableEvent.IMAGE_REMOVED_GUTENBERG_EDITOR, postId diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index e7cfc42a991c..afa77f8e9c6a 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -117,7 +117,7 @@ public class GutenbergEditorFragment extends EditorFragmentAbstract implements private static final String TAG_REPLACE_FEATURED_DIALOG = "REPLACE_FEATURED_DIALOG"; - private static final int MEDIA_ID_NO_FEATURED_IMAGE_SET = 0; + public static final int MEDIA_ID_NO_FEATURED_IMAGE_SET = 0; private boolean mHtmlModeEnabled; From 40310c385d7c435912942c2a9b0b2ea6610d1445 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Tue, 1 Jun 2021 11:53:43 +0100 Subject: [PATCH 70/76] Rename references to 'mediaId' to 'id' With this commit, references to 'mediaId' are updated to 'id' in the GutenbergDialogFragment.kt class. The purpose is to make the name more generic so that the class is more re-usable. --- .../editor/gutenberg/GutenbergDialogFragment.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index fd23c1619e3a..1ef39f81f298 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -14,12 +14,12 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { private lateinit var mPositiveButtonLabel: CharSequence private var mTitle: CharSequence? = null private var mNegativeButtonLabel: CharSequence? = null - private var mMediaId: Int = 0 + private var mId: Int = 0 private var dismissedByPositiveButton = false private var dismissedByNegativeButton = false interface GutenbergDialogPositiveClickInterface { - fun onGutenbergDialogPositiveClicked(instanceTag: String, mediaId: Int) + fun onGutenbergDialogPositiveClicked(instanceTag: String, id: Int) } interface GutenbergDialogNegativeClickInterface { @@ -36,14 +36,14 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { message: CharSequence, positiveButtonLabel: CharSequence, negativeButtonLabel: CharSequence? = null, - mediaId: Int + id: Int ) { mTag = tag mTitle = title mMessage = message mPositiveButtonLabel = positiveButtonLabel mNegativeButtonLabel = negativeButtonLabel - mMediaId = mediaId + mId = id } override fun onCreate(savedInstanceState: Bundle?) { @@ -58,7 +58,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { mMessage = requireNotNull(savedInstanceState.getCharSequence(STATE_KEY_MESSAGE)) mPositiveButtonLabel = requireNotNull(savedInstanceState.getCharSequence(STATE_KEY_POSITIVE_BUTTON_LABEL)) mNegativeButtonLabel = savedInstanceState.getCharSequence(STATE_KEY_NEGATIVE_BUTTON_LABEL) - mMediaId = savedInstanceState.getInt(STATE_KEY_MEDIA_ID) + mId = savedInstanceState.getInt(STATE_KEY_ID) } } @@ -68,7 +68,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { outState.putCharSequence(STATE_KEY_MESSAGE, mMessage) outState.putCharSequence(STATE_KEY_POSITIVE_BUTTON_LABEL, mPositiveButtonLabel) outState.putCharSequence(STATE_KEY_NEGATIVE_BUTTON_LABEL, mNegativeButtonLabel) - outState.putInt(STATE_KEY_MEDIA_ID, mMediaId) + outState.putInt(STATE_KEY_ID, mId) super.onSaveInstanceState(outState) } @@ -84,7 +84,7 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { builder.setPositiveButton(mPositiveButtonLabel) { _, _ -> dismissedByPositiveButton = true (parentFragment as? GutenbergDialogPositiveClickInterface)?.let { - it.onGutenbergDialogPositiveClicked(mTag, mMediaId) + it.onGutenbergDialogPositiveClicked(mTag, mId) } }.setCancelable(true) } @@ -128,6 +128,6 @@ class GutenbergDialogFragment() : AppCompatDialogFragment() { private const val STATE_KEY_MESSAGE = "state_key_message" private const val STATE_KEY_POSITIVE_BUTTON_LABEL = "state_key_positive_button_label" private const val STATE_KEY_NEGATIVE_BUTTON_LABEL = "state_key_negative_button_label" - private const val STATE_KEY_MEDIA_ID = "state_key_media_id" + private const val STATE_KEY_ID = "state_key_id" } } From 1eb55fa123df127a85a302f0e8c75f5b94eed1d4 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 2 Jun 2021 19:54:10 +0100 Subject: [PATCH 71/76] Reword dialog's title for clarity. The title of the replace dialog is updated from "Replace?" to "Featured Image Already Set" with this commit. This brings it more inline with how titles are presented in other areas of the app (questions aren't generally used for titles). The overall goal is to improve clarity. --- libs/editor/WordPressEditor/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/editor/WordPressEditor/src/main/res/values/strings.xml b/libs/editor/WordPressEditor/src/main/res/values/strings.xml index 8419ce3e9c73..5dfce0f85081 100644 --- a/libs/editor/WordPressEditor/src/main/res/values/strings.xml +++ b/libs/editor/WordPressEditor/src/main/res/values/strings.xml @@ -155,7 +155,7 @@ Dismiss - Replace? + Featured Image Already Set You already have a featured image set. Do you want to replace it? Replace Cancel From c1f68422ddf3e4b0b3071b37eb79067bad203201 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 2 Jun 2021 20:02:29 +0100 Subject: [PATCH 72/76] Undo title case in notices for consistency Following feedback, it makes sense to undo title case that's applied to notices, as they're not strictly headings/titles. This will help with consistency in how notices are capitalised throughout the rest of the apps. --- libs/editor/WordPressEditor/src/main/res/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/res/values/strings.xml b/libs/editor/WordPressEditor/src/main/res/values/strings.xml index 5dfce0f85081..fcb8f125cce7 100644 --- a/libs/editor/WordPressEditor/src/main/res/values/strings.xml +++ b/libs/editor/WordPressEditor/src/main/res/values/strings.xml @@ -160,7 +160,7 @@ Replace Cancel - Set as Featured Image - Removed as Featured Image + Set as featured image + Removed as featured image From 8c5005f961882f6e6e6ab2cf837db609b10ab416 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 2 Jun 2021 20:17:40 +0100 Subject: [PATCH 73/76] Update to latest Gutenberg Mobile reference --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 66c05dd3d6ad..8bb66604e5d6 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = 'develop-bb54ee34c5fec5fa7375ce90a356adb5adbdcae0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-ec8ff832d3c2aecb545d131a10f4cdaf943dfcfd' + ext.gutenbergMobileVersion = '3116-0af44c12fd41a3f5ba62164c873eda2cef80c1ca' repositories { google() From 54d9cf9bb9cbb0c5d7b6a2bc6381747517f4e519 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 3 Jun 2021 13:50:13 +0200 Subject: [PATCH 74/76] Update Gutenberg Mobile ref --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 55c15d6b232a..c92431c24d08 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = 'develop-bb54ee34c5fec5fa7375ce90a356adb5adbdcae0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3523-1fe98d426e87fc62e4b4bec02d8c58f4b42c70ac' + ext.gutenbergMobileVersion = '3523-ab0fe0a9b00e6393a107613f6e3156beb8b52ec4' repositories { google() From d7953d4f4755d02dfe5d83cc8282f733d0535a28 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 3 Jun 2021 15:30:46 +0200 Subject: [PATCH 75/76] Update Gutenberg Mobile ref --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c92431c24d08..a9089f504770 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = 'develop-bb54ee34c5fec5fa7375ce90a356adb5adbdcae0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3523-ab0fe0a9b00e6393a107613f6e3156beb8b52ec4' + ext.gutenbergMobileVersion = 'v1.55.0-alpha1' repositories { google() From 2caa7c00bcdfe15f5543964c4b74b844dadfacd8 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Thu, 3 Jun 2021 15:04:04 +0100 Subject: [PATCH 76/76] Bump Gutenberg Mobile reference --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8bb66604e5d6..88d9fa47ff63 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext.kotlin_ktx_version = '1.2.0' ext.wordPressUtilsVersion = 'develop-bb54ee34c5fec5fa7375ce90a356adb5adbdcae0' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = '3116-0af44c12fd41a3f5ba62164c873eda2cef80c1ca' + ext.gutenbergMobileVersion = 'develop-b316b2b49f57f08426f1a33418f28480cdc8787b' repositories { google()