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

Fix config options for Android release builds #295

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -2,7 +2,11 @@

import com.pichillilorenzo.flutter_inappwebview.Options;

public class ChromeCustomTabsOptions extends Options {
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class ChromeCustomTabsOptions implements Options {

final static String LOG_TAG = "ChromeCustomTabsOptions";

Expand All @@ -12,4 +16,47 @@ public class ChromeCustomTabsOptions extends Options {
public boolean enableUrlBarHiding = false;
public boolean instantAppsEnabled = false;

ChromeCustomTabsOptions parse(HashMap<String, Object> options) {
Iterator it = options.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> pair = (Map.Entry<String, Object>) it.next();
String key = pair.getKey();
Object value = pair.getValue();
if (value == null) {
continue;
}

switch (key) {
case "addShareButton":
addShareButton = (boolean) value;
break;
case "showTitle":
showTitle = (boolean) value;
break;
case "toolbarBackgroundColor":
toolbarBackgroundColor = (String) value;
break;
case "enableUrlBarHiding":
enableUrlBarHiding = (boolean) value;
break;
case "instantAppsEnabled":
instantAppsEnabled = (boolean) value;
break;
}
}

return this;
}

@Override
public HashMap<String, Object> getHashMap() {
HashMap<String, Object> options = new HashMap<>();
options.put("addShareButton", addShareButton);
options.put("showTitle", showTitle);
options.put("toolbarBackgroundColor", toolbarBackgroundColor);
options.put("enableUrlBarHiding", enableUrlBarHiding);
options.put("instantAppsEnabled", instantAppsEnabled);

return options;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.pichillilorenzo.flutter_inappwebview;

public class InAppBrowserOptions extends Options {
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class InAppBrowserOptions implements Options {

public static final String LOG_TAG = "InAppBrowserOptions";

Expand All @@ -13,4 +17,60 @@ public class InAppBrowserOptions extends Options {
public boolean hideTitleBar = false;
public boolean closeOnCannotGoBack = true;
public boolean progressBar = true;

public InAppBrowserOptions parse(HashMap<String, Object> options) {
Iterator it = options.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> pair = (Map.Entry<String, Object>) it.next();
String key = pair.getKey();
Object value = pair.getValue();
if (value == null) {
continue;
}

switch (key) {
case "hidden":
hidden = (boolean) value;
break;
case "toolbarTop":
toolbarTop = (boolean) value;
break;
case "toolbarTopBackgroundColor":
toolbarTopBackgroundColor = (String) value;
break;
case "toolbarTopFixedTitle":
toolbarTopFixedTitle = (String) value;
break;
case "hideUrlBar":
hideUrlBar = (boolean) value;
break;
case "hideTitleBar":
hideTitleBar = (boolean) value;
break;
case "closeOnCannotGoBack":
closeOnCannotGoBack = (boolean) value;
break;
case "progressBar":
progressBar = (boolean) value;
break;
}
}

return this;
}

@Override
public HashMap<String, Object> getHashMap() {
final HashMap<String, Object> options = new HashMap<>();
options.put("hidden", hidden);
options.put("toolbarTop", toolbarTop);
options.put("toolbarTopBackgroundColor", toolbarTopBackgroundColor);
options.put("toolbarTopFixedTitle", toolbarTopFixedTitle);
options.put("hideUrlBar", hideUrlBar);
options.put("hideTitleBar", hideTitleBar);
options.put("closeOnCannotGoBack", closeOnCannotGoBack);
options.put("progressBar", progressBar);

return options;
}
}
Loading