2018-09-18 01:07:12 +00:00
|
|
|
//
|
|
|
|
// InAppBrowserOptions.swift
|
2019-11-29 15:59:18 +00:00
|
|
|
// flutter_inappwebview
|
2018-09-18 01:07:12 +00:00
|
|
|
//
|
|
|
|
// Created by Lorenzo on 17/09/18.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
@objcMembers
|
2022-04-23 12:00:47 +00:00
|
|
|
public class InAppBrowserSettings: ISettings<InAppBrowserWebViewController> {
|
2018-09-20 00:48:24 +00:00
|
|
|
|
2018-09-18 01:07:12 +00:00
|
|
|
var hidden = false
|
2021-02-22 11:16:23 +00:00
|
|
|
var hideToolbarTop = true
|
|
|
|
var toolbarTopBackgroundColor: String?
|
2018-09-23 23:53:22 +00:00
|
|
|
var hideUrlBar = false
|
2021-02-22 11:16:23 +00:00
|
|
|
var hideProgressBar = false
|
2018-09-23 23:53:22 +00:00
|
|
|
|
2021-02-22 11:16:23 +00:00
|
|
|
var toolbarTopTranslucent = true
|
|
|
|
var toolbarTopBarTintColor: String?
|
|
|
|
var toolbarTopTintColor: String?
|
|
|
|
var hideToolbarBottom = true
|
|
|
|
var toolbarBottomBackgroundColor: String?
|
|
|
|
var toolbarBottomTintColor: String?
|
2018-09-18 01:07:12 +00:00
|
|
|
var toolbarBottomTranslucent = true
|
2021-02-22 11:16:23 +00:00
|
|
|
var closeButtonCaption: String?
|
|
|
|
var closeButtonColor: String?
|
2018-09-18 01:07:12 +00:00
|
|
|
var presentationStyle = 0 //fullscreen
|
|
|
|
var transitionStyle = 0 //crossDissolve
|
2023-06-10 23:55:42 +00:00
|
|
|
var hideCloseButton = false
|
|
|
|
var menuButtonColor: String?
|
2018-09-18 01:07:12 +00:00
|
|
|
|
2018-09-20 00:48:24 +00:00
|
|
|
override init(){
|
|
|
|
super.init()
|
|
|
|
}
|
|
|
|
|
2022-04-19 23:31:14 +00:00
|
|
|
override func getRealSettings(obj: InAppBrowserWebViewController?) -> [String: Any?] {
|
2020-05-29 17:56:03 +00:00
|
|
|
var realOptions: [String: Any?] = toMap()
|
|
|
|
if let inAppBrowserWebViewController = obj {
|
2022-10-18 16:12:33 +00:00
|
|
|
realOptions["hidden"] = inAppBrowserWebViewController.isHidden
|
2021-02-22 11:16:23 +00:00
|
|
|
realOptions["hideUrlBar"] = inAppBrowserWebViewController.searchBar.isHidden
|
2022-10-19 00:42:23 +00:00
|
|
|
realOptions["hideProgressBar"] = inAppBrowserWebViewController.progressBar.isHidden
|
2021-02-22 11:16:23 +00:00
|
|
|
realOptions["closeButtonCaption"] = inAppBrowserWebViewController.closeButton.title
|
|
|
|
realOptions["closeButtonColor"] = inAppBrowserWebViewController.closeButton.tintColor?.hexString
|
2023-06-10 23:55:42 +00:00
|
|
|
realOptions["menuButtonColor"] = inAppBrowserWebViewController.menuButton?.tintColor?.hexString
|
2021-02-22 11:16:23 +00:00
|
|
|
if let navController = inAppBrowserWebViewController.navigationController {
|
|
|
|
realOptions["hideToolbarTop"] = navController.navigationBar.isHidden
|
|
|
|
realOptions["toolbarTopBackgroundColor"] = navController.navigationBar.backgroundColor?.hexString
|
|
|
|
realOptions["toolbarTopTranslucent"] = navController.navigationBar.isTranslucent
|
|
|
|
realOptions["toolbarTopBarTintColor"] = navController.navigationBar.barTintColor?.hexString
|
|
|
|
realOptions["toolbarTopTintColor"] = navController.navigationBar.tintColor?.hexString
|
|
|
|
realOptions["hideToolbarBottom"] = navController.toolbar.isHidden
|
|
|
|
realOptions["toolbarBottomBackgroundColor"] = navController.toolbar.barTintColor?.hexString
|
|
|
|
realOptions["toolbarBottomTranslucent"] = navController.toolbar.isTranslucent
|
|
|
|
realOptions["toolbarBottomTintColor"] = navController.toolbar.tintColor?.hexString
|
|
|
|
realOptions["presentationStyle"] = navController.modalPresentationStyle.rawValue
|
|
|
|
realOptions["transitionStyle"] = navController.modalTransitionStyle.rawValue
|
|
|
|
}
|
2020-05-29 17:56:03 +00:00
|
|
|
}
|
|
|
|
return realOptions
|
|
|
|
}
|
2018-09-18 01:07:12 +00:00
|
|
|
}
|