Skip to content

Commit

Permalink
Gutenberg - Starter Page Templates Tooltip (#11807)
Browse files Browse the repository at this point in the history
* Gutenberg - Starter Page Templates Tooltip

* Update Gutenberg ref
  • Loading branch information
Gerardo Pacheco authored May 26, 2020
1 parent 9d3d5af commit ee93098
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2871,6 +2871,14 @@ public void onEditorFragmentContentReady(ArrayList<Object> unsupportedBlocksList
ActivityLauncher.viewSuggestUsersForResult(this, mSite);
}

@Override public void onGutenbergEditorSetStarterPageTemplatesTooltipShown(boolean tooltipShown) {
AppPrefs.setGutenbergStarterPageTemplatesTooltipShown(tooltipShown);
}

@Override public boolean onGutenbergEditorRequestStarterPageTemplatesTooltipShown() {
return AppPrefs.getGutenbergStarterPageTemplatesTooltipShown();
}

@Override
public void onHtmlModeToggledInToolbar() {
toggleHtmlModeOnMenu();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,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_STARTER_PAGE_TEMPLATES_TOOLTIP_SHOWN,

IS_QUICK_START_NOTICE_REQUIRED,

Expand Down Expand Up @@ -849,6 +850,14 @@ public static void removeSupportName() {
remove(DeletablePrefKey.SUPPORT_NAME);
}

public static void setGutenbergStarterPageTemplatesTooltipShown(boolean tooltipShown) {
setBoolean(DeletablePrefKey.GUTENBERG_STARTER_PAGE_TEMPLATES_TOOLTIP_SHOWN, tooltipShown);
}

public static boolean getGutenbergStarterPageTemplatesTooltipShown() {
return getBoolean(DeletablePrefKey.GUTENBERG_STARTER_PAGE_TEMPLATES_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 @@ -200,6 +200,8 @@ public interface EditorFragmentListener {
void onGutenbergEditorSessionTemplateApplyTracked(String template);
void onGutenbergEditorSessionTemplatePreviewTracked(String template);
void getMention(Consumer<String> onResult);
void onGutenbergEditorSetStarterPageTemplatesTooltipShown(boolean tooltipShown);
boolean onGutenbergEditorRequestStarterPageTemplatesTooltipShown();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGetContentTimeout;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnImageFullscreenPreviewListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnLogGutenbergUserEventListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnStarterPageTemplatesTooltipShownEventListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaEditorListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaLibraryButtonListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnReattachQueryListener;
Expand Down Expand Up @@ -68,6 +69,7 @@ public void attachToContainer(ViewGroup viewGroup, OnMediaLibraryButtonListener
OnMediaEditorListener onMediaEditorListener,
OnLogGutenbergUserEventListener onLogGutenbergUserEventListener,
AddMentionUtil addMentionUtil,
OnStarterPageTemplatesTooltipShownEventListener onSPTTooltipShownEventListener,
boolean isDarkMode) {
mWPAndroidGlueCode.attachToContainer(
viewGroup,
Expand All @@ -81,6 +83,7 @@ public void attachToContainer(ViewGroup viewGroup, OnMediaLibraryButtonListener
onMediaEditorListener,
onLogGutenbergUserEventListener,
addMentionUtil,
onSPTTooltipShownEventListener,
isDarkMode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnEditorMountListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGetContentTimeout;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnLogGutenbergUserEventListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnStarterPageTemplatesTooltipShownEventListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaLibraryButtonListener;
import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnReattachQueryListener;

Expand Down Expand Up @@ -361,6 +362,17 @@ public void onGutenbergUserEvent(GutenbergUserEvent event, Map<String, Object> p
}
},
mEditorFragmentListener::getMention,
new OnStarterPageTemplatesTooltipShownEventListener() {
@Override
public void onSetStarterPageTemplatesTooltipShown(boolean tooltipShown) {
mEditorFragmentListener.onGutenbergEditorSetStarterPageTemplatesTooltipShown(tooltipShown);
}

@Override
public boolean onRequestStarterPageTemplatesTooltipShown() {
return mEditorFragmentListener.onGutenbergEditorRequestStarterPageTemplatesTooltipShown();
}
},
isDarkMode());

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

0 comments on commit ee93098

Please sign in to comment.