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

[Gutenberg] Add Cover block media settings #13818

Merged
merged 12 commits into from
Feb 15, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -3332,6 +3332,14 @@ private void showSuggestions(SuggestionType type, Consumer<String> onResult) {
ActivityLauncher.viewSuggestionsForResult(this, mSite, type);
}

@Override public void onGutenbergEditorSetFocalPointPickerTooltipShown(boolean tooltipShown) {
AppPrefs.setGutenbergFocalPointPickerTooltipShown(tooltipShown);
}

@Override public boolean onGutenbergEditorRequestFocalPointPickerTooltipShown() {
return AppPrefs.getGutenbergFocalPointPickerTooltipShown();
}

@Override
public void onHtmlModeToggledInToolbar() {
toggleHtmlModeOnMenu();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public enum DeletablePrefKey implements PrefKey {
SHOULD_AUTO_ENABLE_GUTENBERG_FOR_THE_NEW_POSTS,
SHOULD_AUTO_ENABLE_GUTENBERG_FOR_THE_NEW_POSTS_PHASE_2,
GUTENBERG_OPT_IN_DIALOG_SHOWN,
GUTENBERG_FOCAL_POINT_PICKER_TOOLTIP_SHOWN,

IS_QUICK_START_NOTICE_REQUIRED,
LAST_SKIPPED_QUICK_START_TASK,
Expand Down Expand Up @@ -889,6 +890,14 @@ public static void removeSupportName() {
remove(DeletablePrefKey.SUPPORT_NAME);
}

public static void setGutenbergFocalPointPickerTooltipShown(boolean tooltipShown) {
setBoolean(DeletablePrefKey.GUTENBERG_FOCAL_POINT_PICKER_TOOLTIP_SHOWN, tooltipShown);
}

public static boolean getGutenbergFocalPointPickerTooltipShown() {
return getBoolean(DeletablePrefKey.GUTENBERG_FOCAL_POINT_PICKER_TOOLTIP_SHOWN, false);
}

/*
* returns a list of local IDs of sites recently chosen in the site picker
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ public interface EditorFragmentListener extends DialogVisibilityProvider {
void onGutenbergEditorSessionTemplatePreviewTracked(String template);
void showUserSuggestions(Consumer<String> onResult);
void showXpostSuggestions(Consumer<String> onResult);
void onGutenbergEditorSetFocalPointPickerTooltipShown(boolean tooltipShown);
boolean onGutenbergEditorRequestFocalPointPickerTooltipShown();
String getErrorMessageFromMedia(int mediaId);
void showJetpackSettings();
void onStoryComposerLoadRequested(ArrayList<Object> mediaFiles, String blockId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnLogGutenbergUserEventListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnReattachMediaSavingQueryListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnReattachMediaUploadQueryListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnFocalPointPickerTooltipShownEventListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaEditorListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaLibraryButtonListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaFilesCollectionBasedBlockEditorListener;
Expand Down Expand Up @@ -70,6 +71,7 @@ public void attachToContainer(ViewGroup viewGroup, OnMediaLibraryButtonListener
ShowSuggestionsUtil showSuggestionsUtil,
OnMediaFilesCollectionBasedBlockEditorListener
onMediaFilesCollectionBasedBlockEditorListener,
OnFocalPointPickerTooltipShownEventListener onFPPTooltipShownEventListener,
boolean isDarkMode) {
mWPAndroidGlueCode.attachToContainer(
viewGroup,
Expand All @@ -87,6 +89,7 @@ public void attachToContainer(ViewGroup viewGroup, OnMediaLibraryButtonListener
onGutenbergDidSendButtonPressedActionListener,
showSuggestionsUtil,
onMediaFilesCollectionBasedBlockEditorListener,
onFPPTooltipShownEventListener,
isDarkMode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnLogGutenbergUserEventListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnReattachMediaSavingQueryListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnReattachMediaUploadQueryListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnFocalPointPickerTooltipShownEventListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaLibraryButtonListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaFilesCollectionBasedBlockEditorListener;

Expand Down Expand Up @@ -457,6 +458,17 @@ public void gutenbergDidSendButtonPressedAction(String buttonType) {
}
}
},
new OnFocalPointPickerTooltipShownEventListener() {
@Override
public void onSetFocalPointPickerTooltipShown(boolean tooltipShown) {
mEditorFragmentListener.onGutenbergEditorSetFocalPointPickerTooltipShown(tooltipShown);
}

@Override
public boolean onRequestFocalPointPickerTooltipShown() {
return mEditorFragmentListener.onGutenbergEditorRequestFocalPointPickerTooltipShown();
}
},
GutenbergUtils.isDarkMode(getActivity()));

// request dependency injection. Do this after setting min/max dimensions
Expand Down