Resolves #339 Authenticated webview for panels and config sections

This commit is contained in:
estevez-dev
2019-09-02 21:08:20 +03:00
parent 113cd29f74
commit 6663bcad72
7 changed files with 114 additions and 86 deletions

View File

@ -89,48 +89,6 @@ class HAErrorActionType {
static const OPEN_CONNECTION_SETTINGS = 4;
}
class HAUtils {
static void launchURL(String url) async {
if (await urlLauncher.canLaunch(url)) {
await urlLauncher.launch(url);
} else {
Logger.e( "Could not launch $url");
}
}
static void launchURLInCustomTab({BuildContext context, String url, bool enableDefaultShare: true, bool showPageTitle: true}) async {
try {
await launch(
"$url",
option: new CustomTabsOption(
toolbarColor: Theme.of(context).primaryColor,
enableDefaultShare: enableDefaultShare,
enableUrlBarHiding: true,
showPageTitle: showPageTitle,
animation: new CustomTabsAnimation.slideIn()
// or user defined animation.
/*animation: new CustomTabsAnimation(
startEnter: 'slide_up',
startExit: 'android:anim/fade_out',
endEnter: 'android:anim/fade_in',
endExit: 'slide_down',
)*/,
extraCustomTabs: <String>[
// ref. https://play.google.com/store/apps/details?id=org.mozilla.firefox
'org.mozilla.firefox',
// ref. https://play.google.com/store/apps/details?id=com.microsoft.emmx
'com.microsoft.emmx',
],
),
);
} catch (e) {
Logger.w("Can't open custom tab: ${e.toString()}");
Logger.w("Launching in default browser");
HAUtils.launchURL(url);
}
}
}
class StateChangedEvent {
String entityId;
String newState;