Skip to content

Commit

Permalink
Allow Android to set the post type
Browse files Browse the repository at this point in the history
  • Loading branch information
koke committed Nov 21, 2019
1 parent a151e3d commit 09367d3
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public class WPAndroidGlueCode {
private static final String PROP_NAME_INITIAL_DATA = "initialData";
private static final String PROP_NAME_INITIAL_TITLE = "initialTitle";
private static final String PROP_NAME_INITIAL_HTML_MODE_ENABLED = "initialHtmlModeEnabled";
private static final String PROP_NAME_POST_TYPE = "postType";
private static final String PROP_NAME_LOCALE = "locale";
private static final String PROP_NAME_TRANSLATIONS = "translations";

Expand Down Expand Up @@ -310,9 +311,17 @@ private ImagePipelineConfig getImagePipelineConfig(OkHttpClient client) {
.newBuilder(mReactRootView.getContext(), client).build();
}

@Deprecated
public void onCreateView(Context initContext, boolean htmlModeEnabled,
Application application, boolean isDebug, boolean buildGutenbergFromSource,
boolean isNewPost, String localeString, Bundle translations) {
onCreateView(initContext, htmlModeEnabled, application, isDebug, buildGutenbergFromSource, "post", isNewPost
, localeString, translations);
}

public void onCreateView(Context initContext, boolean htmlModeEnabled,
Application application, boolean isDebug, boolean buildGutenbergFromSource,
String postType, boolean isNewPost, String localeString, Bundle translations) {
mReactRootView = new ReactRootView(new MutableContextWrapper(initContext));

ReactInstanceManagerBuilder builder =
Expand All @@ -339,6 +348,7 @@ public void onReactContextInitialized(ReactContext context) {
initialProps.putString(PROP_NAME_INITIAL_DATA, "");
initialProps.putString(PROP_NAME_INITIAL_TITLE, "");
initialProps.putBoolean(PROP_NAME_INITIAL_HTML_MODE_ENABLED, htmlModeEnabled);
initialProps.putString(PROP_NAME_POST_TYPE, postType);
initialProps.putString(PROP_NAME_LOCALE, localeString);
initialProps.putBundle(PROP_NAME_TRANSLATIONS, translations);

Expand Down

0 comments on commit 09367d3

Please sign in to comment.