Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Featured Banner to Image Block #14451

Merged
merged 52 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
b6415ee
Update GutenbergEditorFragment.java
Feb 12, 2021
6558a65
Update reference to latest gutenberg-mobile commit
Feb 18, 2021
b251e4b
Set featured image
Mar 3, 2021
f2e1621
Bump Gutenberg mobile
Mar 15, 2021
4badfe5
Updates to GutenbergEditorFragment
Mar 16, 2021
2225c54
Tidy up EditPostActivity
Mar 16, 2021
538163f
Tidy up EditorFragmentAbstract
Mar 16, 2021
b3a29d5
Tidy up EditorFragmentAbstract
Mar 16, 2021
3b9a12e
Fix accidental deletion of "final" from expression
Mar 16, 2021
2700d6c
Restore spacing in GutenbergEditorFragment
Mar 16, 2021
3e9e006
Bump Gutenberg Mobile
Mar 16, 2021
2d0ce03
Bump Gutenberg Mobile
Mar 18, 2021
05ddece
Bump gutenberg-mobile
Mar 22, 2021
adafe83
Bump gutenberg-mobile
Mar 23, 2021
c5669b0
Introduce "OnSetFeaturedImageListener"
Mar 23, 2021
ecfd432
Added TODO to clarify Toast isn't part of final design
Mar 23, 2021
111ddba
Add Snackbar and bump Gutenberg Mobile
Mar 23, 2021
866ba55
Bump
Mar 23, 2021
21544e7
Fixing merge conflict
Mar 23, 2021
54f1bc0
Bump Gutenberg Mobile
Mar 23, 2021
622dfad
Update image blocks when featured image's are set in Post Settings
Mar 23, 2021
e6f3e19
Introduce "removeFeaturedImage" function and update name of "onGetFea…
Mar 29, 2021
4cc6b5f
Update function name from "onRequestFeaturedImageId" to "sendToJSFeat…
Mar 29, 2021
85f4c2b
Remove SnackBar for removed featured image
Mar 29, 2021
8e571a1
Bump Gutenberg Mobile
Mar 29, 2021
be1f089
Add Tracks events for new featured image buttons
Mar 29, 2021
d95e9c7
Bump Gutenberg-Mobile
Mar 30, 2021
60a5a96
Bump Gutenberg Mobile
Mar 30, 2021
5e60cad
Bump Gutenberg Mobile
Mar 31, 2021
8224b32
Merge branch 'develop' into update/image-block-with-featured-image-se…
Mar 31, 2021
43b3513
Address merge conflicts
Mar 31, 2021
368332a
Remove Snackbar
Mar 31, 2021
b70152c
Remove Snackbar reference and bump Gutenberg Mobile
Mar 31, 2021
bdf00a6
"sendToJSFeaturedImageId" name changes and addition of notices
Apr 1, 2021
1936c54
Bump Mobile Gutenberg
Apr 1, 2021
0ec24df
Introduce "featuredMedia" prop to "GutenbergPropsBuilder"
Apr 6, 2021
e2038e8
Remove checkIfFeaturedImage() function
Apr 8, 2021
d9fdf94
Remove logging from EditPostActivity
Apr 9, 2021
8e8b258
Update gutenberg mobile reference
Apr 13, 2021
181c7d1
Merge branch 'develop' of github.com:wordpress-mobile/WordPress-Andro…
Apr 13, 2021
14d372b
Remove functionality for setting featured image within image block
Apr 15, 2021
45d5eb8
Rename "featuredMedia" to "featuredImageId"
Apr 15, 2021
332ca7f
Restore function to detect when featured image is removed
Apr 15, 2021
f19f7fd
Bump Gutenberg Mobile
Apr 15, 2021
894775f
Merge branch 'develop' into add-featured-badge
Apr 15, 2021
aa9ba69
Bump Mobile Gutenberg
Apr 15, 2021
80bfe49
Bump Gutenberg Mobile
Apr 15, 2021
57d0359
Merge branch 'develop' into add-featured-badge
SiobhyB Apr 20, 2021
a0c0ce9
Bump Gutenberg Mobile
Apr 20, 2021
0962113
Merge branch 'add-featured-badge' of github.com:wordpress-mobile/Word…
Apr 20, 2021
457c2da
Bump Gutenberg Mobile
Apr 20, 2021
f7f1071
Bump Gutenberg Mobile
Apr 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2255,6 +2255,7 @@ private void onXpostsSettingsCapability(boolean isXpostsCapable) {

private GutenbergPropsBuilder getGutenbergPropsBuilder() {
String postType = mIsPage ? "page" : "post";
int featuredImageId = (int) mEditPostRepository.getFeaturedImageId();
String languageString = LocaleManager.getLanguage(EditPostActivity.this);
String wpcomLocaleSlug = languageString.replace("_", "-").toLowerCase(Locale.ENGLISH);

Expand All @@ -2281,6 +2282,7 @@ private GutenbergPropsBuilder getGutenbergPropsBuilder() {
!isFreeWPCom, // Disable audio block until it's usable on free sites via "Insert from URL" capability
wpcomLocaleSlug,
postType,
featuredImageId,
themeBundle
);
}
Expand Down Expand Up @@ -2458,6 +2460,9 @@ 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);
}
}
}

Expand Down Expand Up @@ -2856,6 +2861,12 @@ public void onEditPostPublishedSettingsClick() {
* EditorFragmentListener methods
*/

@Override public void clearFeaturedImage() {
if (mEditorFragment instanceof GutenbergEditorFragment) {
((GutenbergEditorFragment) mEditorFragment).sendToJSFeaturedImageId(0);
}
}

@Override
public void onAddMediaClicked() {
if (mEditorPhotoPicker.isPhotoPickerShowing()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,10 @@ public void updateFeaturedImage(long featuredImageId, boolean imagePicked) {

private void clearFeaturedImage() {
updateFeaturedImage(0, false);

if (getActivity() instanceof EditPostSettingsCallback) {
((EditPostSettingsCallback) getActivity()).clearFeaturedImage();
}
}

private void updateFeaturedImageView(PostImmutableModel postModel) {
Expand Down Expand Up @@ -1128,5 +1132,6 @@ private void updateFeaturedImageViews(FeaturedImageState state) {

interface EditPostSettingsCallback {
void onEditPostPublishedSettingsClick();
void clearFeaturedImage();
}
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 'v1.51.0'
ext.gutenbergMobileVersion = 'develop-a26cd60c3eb95830198f4e0a17fe98adc761c022'

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,8 @@ public void onStorySaveResult(final String storyFirstMediaId, final boolean succ
public void onMediaModelCreatedForFile(String oldId, String newId, String oldUrl) {
mWPAndroidGlueCode.mediaIdChanged(oldId, newId, oldUrl);
}

public void sendToJSFeaturedImageId(int mediaId) {
mWPAndroidGlueCode.sendToJSFeaturedImageId(mediaId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,10 @@ public void onClick(DialogInterface dialog, int id) {
dialog.show();
}

public void sendToJSFeaturedImageId(int mediaId) {
getGutenbergContainerFragment().sendToJSFeaturedImageId(mediaId);
}

private void showCancelMediaCollectionUploadDialog(ArrayList<Object> mediaFiles) {
// Display 'cancel upload' dialog
AlertDialog.Builder builder = new MaterialAlertDialogBuilder(getActivity());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ data class GutenbergPropsBuilder(
private val enableAudioBlock: Boolean,
private val localeSlug: String,
private val postType: String,
private val featuredImageId: Int,
private val editorTheme: Bundle?
) : Parcelable {
fun build(activity: Activity, isHtmlModeEnabled: Boolean) = GutenbergProps(
Expand All @@ -29,6 +30,7 @@ data class GutenbergPropsBuilder(
enableAudioBlock = enableAudioBlock,
localeSlug = localeSlug,
postType = postType,
featuredImageId = featuredImageId,
editorTheme = editorTheme,
translations = GutenbergUtils.getTranslations(activity),
isDarkMode = GutenbergUtils.isDarkMode(activity),
Expand Down