iosWebViewFix/ios/Classes/SafariBrowserOptions.swift

40 lines
1.3 KiB
Swift
Executable File

//
// SafariBrowserOptions.swift
// flutter_inappwebview
//
// Created by Lorenzo on 26/09/18.
//
import Foundation
@available(iOS 9.0, *)
@objcMembers
public class SafariBrowserOptions: Options<SafariViewController> {
var entersReaderIfAvailable = false
var barCollapsingEnabled = false
var dismissButtonStyle = 0 //done
var preferredBarTintColor = ""
var preferredControlTintColor = ""
var presentationStyle = 0 //fullscreen
var transitionStyle = 0 //crossDissolve
override init(){
super.init()
}
override func getRealOptions(obj: SafariViewController?) -> [String: Any?] {
var realOptions: [String: Any?] = toMap()
if let safariViewController = obj {
if #available(iOS 11.0, *) {
realOptions["entersReaderIfAvailable"] = safariViewController.configuration.entersReaderIfAvailable
realOptions["barCollapsingEnabled"] = safariViewController.configuration.barCollapsingEnabled
realOptions["dismissButtonStyle"] = safariViewController.dismissButtonStyle.rawValue
}
realOptions["presentationStyle"] = safariViewController.modalPresentationStyle.rawValue
realOptions["transitionStyle"] = safariViewController.modalTransitionStyle.rawValue
}
return realOptions
}
}