Merge pull request #1936 from michalsrutek/feature/swift-code-improvements
Swift code improvements
This commit is contained in:
commit
bccd7535ce
|
@ -9,8 +9,9 @@ import Foundation
|
||||||
|
|
||||||
public class CredentialDatabase: ChannelDelegate {
|
public class CredentialDatabase: ChannelDelegate {
|
||||||
static let METHOD_CHANNEL_NAME = "com.pichillilorenzo/flutter_inappwebview_credential_database"
|
static let METHOD_CHANNEL_NAME = "com.pichillilorenzo/flutter_inappwebview_credential_database"
|
||||||
var plugin: SwiftFlutterPlugin?
|
static let credentialStore = URLCredentialStorage.shared
|
||||||
static var credentialStore = URLCredentialStorage.shared
|
|
||||||
|
private var plugin: SwiftFlutterPlugin?
|
||||||
|
|
||||||
init(plugin: SwiftFlutterPlugin) {
|
init(plugin: SwiftFlutterPlugin) {
|
||||||
super.init(channel: FlutterMethodChannel(name: CredentialDatabase.METHOD_CHANNEL_NAME, binaryMessenger: plugin.registrar!.messenger()))
|
super.init(channel: FlutterMethodChannel(name: CredentialDatabase.METHOD_CHANNEL_NAME, binaryMessenger: plugin.registrar!.messenger()))
|
||||||
|
@ -44,7 +45,7 @@ public class CredentialDatabase: ChannelDelegate {
|
||||||
let host = arguments!["host"] as! String
|
let host = arguments!["host"] as! String
|
||||||
let urlProtocol = arguments!["protocol"] as? String
|
let urlProtocol = arguments!["protocol"] as? String
|
||||||
let urlPort = arguments!["port"] as? Int ?? 0
|
let urlPort = arguments!["port"] as? Int ?? 0
|
||||||
var realm = arguments!["realm"] as? String;
|
var realm = arguments!["realm"] as? String
|
||||||
if let r = realm, r.isEmpty {
|
if let r = realm, r.isEmpty {
|
||||||
realm = nil
|
realm = nil
|
||||||
}
|
}
|
||||||
|
@ -64,7 +65,7 @@ public class CredentialDatabase: ChannelDelegate {
|
||||||
let host = arguments!["host"] as! String
|
let host = arguments!["host"] as! String
|
||||||
let urlProtocol = arguments!["protocol"] as? String
|
let urlProtocol = arguments!["protocol"] as? String
|
||||||
let urlPort = arguments!["port"] as? Int ?? 0
|
let urlPort = arguments!["port"] as? Int ?? 0
|
||||||
var realm = arguments!["realm"] as? String;
|
var realm = arguments!["realm"] as? String
|
||||||
if let r = realm, r.isEmpty {
|
if let r = realm, r.isEmpty {
|
||||||
realm = nil
|
realm = nil
|
||||||
}
|
}
|
||||||
|
@ -80,14 +81,14 @@ public class CredentialDatabase: ChannelDelegate {
|
||||||
let host = arguments!["host"] as! String
|
let host = arguments!["host"] as! String
|
||||||
let urlProtocol = arguments!["protocol"] as? String
|
let urlProtocol = arguments!["protocol"] as? String
|
||||||
let urlPort = arguments!["port"] as? Int ?? 0
|
let urlPort = arguments!["port"] as? Int ?? 0
|
||||||
var realm = arguments!["realm"] as? String;
|
var realm = arguments!["realm"] as? String
|
||||||
if let r = realm, r.isEmpty {
|
if let r = realm, r.isEmpty {
|
||||||
realm = nil
|
realm = nil
|
||||||
}
|
}
|
||||||
let username = arguments!["username"] as! String
|
let username = arguments!["username"] as! String
|
||||||
let password = arguments!["password"] as! String
|
let password = arguments!["password"] as! String
|
||||||
|
|
||||||
var credential: URLCredential? = nil;
|
var credential: URLCredential? = nil
|
||||||
var protectionSpaceCredential: URLProtectionSpace? = nil
|
var protectionSpaceCredential: URLProtectionSpace? = nil
|
||||||
|
|
||||||
for (protectionSpace, credentials) in CredentialDatabase.credentialStore.allCredentials {
|
for (protectionSpace, credentials) in CredentialDatabase.credentialStore.allCredentials {
|
||||||
|
@ -116,12 +117,12 @@ public class CredentialDatabase: ChannelDelegate {
|
||||||
let host = arguments!["host"] as! String
|
let host = arguments!["host"] as! String
|
||||||
let urlProtocol = arguments!["protocol"] as? String
|
let urlProtocol = arguments!["protocol"] as? String
|
||||||
let urlPort = arguments!["port"] as? Int ?? 0
|
let urlPort = arguments!["port"] as? Int ?? 0
|
||||||
var realm = arguments!["realm"] as? String;
|
var realm = arguments!["realm"] as? String
|
||||||
if let r = realm, r.isEmpty {
|
if let r = realm, r.isEmpty {
|
||||||
realm = nil
|
realm = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var credentialsToRemove: [URLCredential] = [];
|
var credentialsToRemove: [URLCredential] = []
|
||||||
var protectionSpaceCredential: URLProtectionSpace? = nil
|
var protectionSpaceCredential: URLProtectionSpace? = nil
|
||||||
|
|
||||||
for (protectionSpace, credentials) in CredentialDatabase.credentialStore.allCredentials {
|
for (protectionSpace, credentials) in CredentialDatabase.credentialStore.allCredentials {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class FindInteractionChannelDelegate : ChannelDelegate {
|
public class FindInteractionChannelDelegate: ChannelDelegate {
|
||||||
private weak var findInteractionController: FindInteractionController?
|
private weak var findInteractionController: FindInteractionController?
|
||||||
|
|
||||||
public init(findInteractionController: FindInteractionController, channel: FlutterMethodChannel) {
|
public init(findInteractionController: FindInteractionController, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -8,14 +8,14 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import Flutter
|
import Flutter
|
||||||
|
|
||||||
public class FindInteractionController : NSObject, Disposable {
|
public class FindInteractionController: NSObject, Disposable {
|
||||||
|
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_find_interaction_"
|
||||||
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_find_interaction_";
|
|
||||||
var plugin: SwiftFlutterPlugin?
|
|
||||||
var webView: InAppWebView?
|
var webView: InAppWebView?
|
||||||
var channelDelegate: FindInteractionChannelDelegate?
|
var channelDelegate: FindInteractionChannelDelegate?
|
||||||
var settings: FindInteractionSettings?
|
|
||||||
var shouldCallOnRefresh = false
|
private var plugin: SwiftFlutterPlugin?
|
||||||
|
private var settings: FindInteractionSettings?
|
||||||
|
|
||||||
private var _searchText: String? = nil
|
private var _searchText: String? = nil
|
||||||
var searchText: String? {
|
var searchText: String? {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class FindInteractionSettings : ISettings<FindInteractionController> {
|
public class FindInteractionSettings: ISettings<FindInteractionController> {
|
||||||
|
|
||||||
override init(){
|
override init(){
|
||||||
super.init()
|
super.init()
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class HeadlessInAppWebView : Disposable {
|
public class HeadlessInAppWebView: Disposable {
|
||||||
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_headless_inappwebview_"
|
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_headless_inappwebview_"
|
||||||
|
|
||||||
var id: String
|
var id: String
|
||||||
var channelDelegate: HeadlessWebViewChannelDelegate?
|
var channelDelegate: HeadlessWebViewChannelDelegate?
|
||||||
var flutterWebView: FlutterWebViewController?
|
var flutterWebView: FlutterWebViewController?
|
||||||
|
@ -24,7 +25,7 @@ public class HeadlessInAppWebView : Disposable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public func onWebViewCreated() {
|
public func onWebViewCreated() {
|
||||||
channelDelegate?.onWebViewCreated();
|
channelDelegate?.onWebViewCreated()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func prepare(params: NSDictionary) {
|
public func prepare(params: NSDictionary) {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class HeadlessWebViewChannelDelegate : ChannelDelegate {
|
public class HeadlessWebViewChannelDelegate: ChannelDelegate {
|
||||||
private weak var headlessWebView: HeadlessInAppWebView?
|
private weak var headlessWebView: HeadlessInAppWebView?
|
||||||
|
|
||||||
public init(headlessWebView: HeadlessInAppWebView, channel: FlutterMethodChannel) {
|
public init(headlessWebView: HeadlessInAppWebView, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class InAppBrowserChannelDelegate : ChannelDelegate {
|
public class InAppBrowserChannelDelegate: ChannelDelegate {
|
||||||
public override init(channel: FlutterMethodChannel) {
|
public override init(channel: FlutterMethodChannel) {
|
||||||
super.init(channel: channel)
|
super.init(channel: channel)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import WebKit
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class InAppBrowserWebViewController: UIViewController, InAppBrowserDelegate, UIScrollViewDelegate, UISearchBarDelegate, Disposable {
|
public class InAppBrowserWebViewController: UIViewController, InAppBrowserDelegate, UIScrollViewDelegate, UISearchBarDelegate, Disposable {
|
||||||
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappbrowser_";
|
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappbrowser_"
|
||||||
|
|
||||||
var closeButton: UIBarButtonItem!
|
var closeButton: UIBarButtonItem!
|
||||||
var reloadButton: UIBarButtonItem!
|
var reloadButton: UIBarButtonItem!
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class ContextMenuSettings: ISettings<NSObject> {
|
public class ContextMenuSettings: ISettings<NSObject> {
|
||||||
|
|
||||||
var hideDefaultSystemContextMenuItems = false;
|
var hideDefaultSystemContextMenuItems = false
|
||||||
|
|
||||||
override init(){
|
override init(){
|
||||||
super.init()
|
super.init()
|
||||||
|
|
|
@ -10,8 +10,8 @@ import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
@available(iOS 11.0, *)
|
@available(iOS 11.0, *)
|
||||||
public class CustomSchemeHandler : NSObject, WKURLSchemeHandler {
|
public class CustomSchemeHandler: NSObject, WKURLSchemeHandler {
|
||||||
var schemeHandlers: [Int:WKURLSchemeTask] = [:]
|
var schemeHandlers: [Int: WKURLSchemeTask] = [:]
|
||||||
|
|
||||||
public func webView(_ webView: WKWebView, start urlSchemeTask: WKURLSchemeTask) {
|
public func webView(_ webView: WKWebView, start urlSchemeTask: WKURLSchemeTask) {
|
||||||
schemeHandlers[urlSchemeTask.hash] = urlSchemeTask
|
schemeHandlers[urlSchemeTask.hash] = urlSchemeTask
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
WKDownloadDelegate,
|
WKDownloadDelegate,
|
||||||
PullToRefreshDelegate,
|
PullToRefreshDelegate,
|
||||||
Disposable {
|
Disposable {
|
||||||
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_"
|
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_"
|
||||||
|
|
||||||
var id: Any? // viewId
|
var id: Any? // viewId
|
||||||
var plugin: SwiftFlutterPlugin?
|
var plugin: SwiftFlutterPlugin?
|
||||||
|
@ -26,14 +26,14 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
var settings: InAppWebViewSettings?
|
var settings: InAppWebViewSettings?
|
||||||
var pullToRefreshControl: PullToRefreshControl?
|
var pullToRefreshControl: PullToRefreshControl?
|
||||||
var findInteractionController: FindInteractionController?
|
var findInteractionController: FindInteractionController?
|
||||||
var webMessageChannels: [String:WebMessageChannel] = [:]
|
var webMessageChannels: [String: WebMessageChannel] = [:]
|
||||||
var webMessageListeners: [WebMessageListener] = []
|
var webMessageListeners: [WebMessageListener] = []
|
||||||
var currentOriginalUrl: URL?
|
var currentOriginalUrl: URL?
|
||||||
var inFullscreen = false
|
var inFullscreen = false
|
||||||
var preventGestureDelay = false
|
var preventGestureDelay = false
|
||||||
|
|
||||||
static var sslCertificatesMap: [String: SslCertificate] = [:] // [URL host name : SslCertificate]
|
private static var sslCertificatesMap: [String: SslCertificate] = [:] // [URL host name : SslCertificate]
|
||||||
static var credentialsProposed: [URLCredential] = []
|
private static var credentialsProposed: [URLCredential] = []
|
||||||
|
|
||||||
var lastScrollX: CGFloat = 0
|
var lastScrollX: CGFloat = 0
|
||||||
var lastScrollY: CGFloat = 0
|
var lastScrollY: CGFloat = 0
|
||||||
|
@ -103,14 +103,14 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
set {
|
set {
|
||||||
super.frame = newValue
|
super.frame = newValue
|
||||||
|
|
||||||
self.scrollView.contentInset = UIEdgeInsets.zero;
|
self.scrollView.contentInset = .zero
|
||||||
if #available(iOS 11, *) {
|
if #available(iOS 11, *) {
|
||||||
// Above iOS 11, adjust contentInset to compensate the adjustedContentInset so the sum will
|
// Above iOS 11, adjust contentInset to compensate the adjustedContentInset so the sum will
|
||||||
// always be 0.
|
// always be 0.
|
||||||
if (scrollView.adjustedContentInset != UIEdgeInsets.zero) {
|
if (scrollView.adjustedContentInset != UIEdgeInsets.zero) {
|
||||||
let insetToAdjust = self.scrollView.adjustedContentInset;
|
let insetToAdjust = self.scrollView.adjustedContentInset
|
||||||
scrollView.contentInset = UIEdgeInsets(top: -insetToAdjust.top, left: -insetToAdjust.left,
|
scrollView.contentInset = UIEdgeInsets(top: -insetToAdjust.top, left: -insetToAdjust.left,
|
||||||
bottom: -insetToAdjust.bottom, right: -insetToAdjust.right);
|
bottom: -insetToAdjust.bottom, right: -insetToAdjust.right)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2190,17 +2190,16 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IdentityAndTrust {
|
struct IdentityAndTrust {
|
||||||
|
var identityRef: SecIdentity
|
||||||
var identityRef:SecIdentity
|
var trust: SecTrust
|
||||||
var trust:SecTrust
|
var certArray: AnyObject
|
||||||
var certArray:AnyObject
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractIdentity(PKCS12Data:NSData, password: String) -> IdentityAndTrust? {
|
func extractIdentity(PKCS12Data: NSData, password: String) -> IdentityAndTrust? {
|
||||||
var identityAndTrust:IdentityAndTrust?
|
var identityAndTrust: IdentityAndTrust?
|
||||||
var securityError:OSStatus = errSecSuccess
|
var securityError: OSStatus = errSecSuccess
|
||||||
|
|
||||||
var importResult: CFArray? = nil
|
var importResult: CFArray?
|
||||||
securityError = SecPKCS12Import(
|
securityError = SecPKCS12Import(
|
||||||
PKCS12Data as NSData,
|
PKCS12Data as NSData,
|
||||||
[kSecImportExportPassphrase as String: password] as NSDictionary,
|
[kSecImportExportPassphrase as String: password] as NSDictionary,
|
||||||
|
@ -2208,27 +2207,27 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
)
|
)
|
||||||
|
|
||||||
if securityError == errSecSuccess {
|
if securityError == errSecSuccess {
|
||||||
let certItems:CFArray = importResult! as CFArray;
|
let certItems: CFArray = importResult! as CFArray
|
||||||
let certItemsArray:Array = certItems as Array
|
let certItemsArray: Array = certItems as Array
|
||||||
let dict:AnyObject? = certItemsArray.first;
|
let dict: AnyObject? = certItemsArray.first
|
||||||
if let certEntry:Dictionary = dict as? Dictionary<String, AnyObject> {
|
if let certEntry: Dictionary = dict as? Dictionary<String, AnyObject> {
|
||||||
// grab the identity
|
// grab the identity
|
||||||
let identityPointer:AnyObject? = certEntry["identity"];
|
let identityPointer: AnyObject? = certEntry["identity"]
|
||||||
let secIdentityRef:SecIdentity = (identityPointer as! SecIdentity?)!;
|
let secIdentityRef:SecIdentity = (identityPointer as! SecIdentity?)!
|
||||||
// grab the trust
|
// grab the trust
|
||||||
let trustPointer:AnyObject? = certEntry["trust"];
|
let trustPointer: AnyObject? = certEntry["trust"]
|
||||||
let trustRef:SecTrust = trustPointer as! SecTrust;
|
let trustRef:SecTrust = trustPointer as! SecTrust
|
||||||
// grab the cert
|
// grab the cert
|
||||||
let chainPointer:AnyObject? = certEntry["chain"];
|
let chainPointer: AnyObject? = certEntry["chain"]
|
||||||
identityAndTrust = IdentityAndTrust(identityRef: secIdentityRef, trust: trustRef, certArray: chainPointer!);
|
identityAndTrust = IdentityAndTrust(identityRef: secIdentityRef, trust: trustRef, certArray: chainPointer!)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print("Security Error: " + securityError.description)
|
print("Security Error: " + securityError.description)
|
||||||
if #available(iOS 11.3, *) {
|
if #available(iOS 11.3, *) {
|
||||||
print(SecCopyErrorMessageString(securityError,nil) ?? "")
|
print(SecCopyErrorMessageString(securityError, nil) ?? "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return identityAndTrust;
|
return identityAndTrust
|
||||||
}
|
}
|
||||||
|
|
||||||
func createAlertDialog(message: String?, responseMessage: String?, confirmButtonTitle: String?, completionHandler: @escaping () -> Void) {
|
func createAlertDialog(message: String?, responseMessage: String?, confirmButtonTitle: String?, completionHandler: @escaping () -> Void) {
|
||||||
|
@ -2239,7 +2238,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
|
|
||||||
alertController.addAction(UIAlertAction(title: okButton, style: UIAlertAction.Style.default) {
|
alertController.addAction(UIAlertAction(title: okButton, style: UIAlertAction.Style.default) {
|
||||||
_ in completionHandler()}
|
_ in completionHandler()}
|
||||||
);
|
)
|
||||||
|
|
||||||
guard let presentingViewController = inAppBrowserDelegate != nil ? inAppBrowserDelegate as? InAppBrowserWebViewController : window?.rootViewController else {
|
guard let presentingViewController = inAppBrowserDelegate != nil ? inAppBrowserDelegate as? InAppBrowserWebViewController : window?.rootViewController else {
|
||||||
completionHandler()
|
completionHandler()
|
||||||
|
@ -2463,16 +2462,16 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
let disableHorizontalScroll = settings?.disableHorizontalScroll ?? false
|
let disableHorizontalScroll = settings?.disableHorizontalScroll ?? false
|
||||||
if startedByUser {
|
if startedByUser {
|
||||||
if disableVerticalScroll && disableHorizontalScroll {
|
if disableVerticalScroll && disableHorizontalScroll {
|
||||||
scrollView.contentOffset = CGPoint(x: lastScrollX, y: lastScrollY);
|
scrollView.contentOffset = CGPoint(x: lastScrollX, y: lastScrollY)
|
||||||
}
|
}
|
||||||
else if disableVerticalScroll {
|
else if disableVerticalScroll {
|
||||||
if scrollView.contentOffset.y >= 0 || scrollView.contentOffset.y < 0 {
|
if scrollView.contentOffset.y >= 0 || scrollView.contentOffset.y < 0 {
|
||||||
scrollView.contentOffset = CGPoint(x: scrollView.contentOffset.x, y: lastScrollY);
|
scrollView.contentOffset = CGPoint(x: scrollView.contentOffset.x, y: lastScrollY)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if disableHorizontalScroll {
|
else if disableHorizontalScroll {
|
||||||
if scrollView.contentOffset.x >= 0 || scrollView.contentOffset.x < 0 {
|
if scrollView.contentOffset.x >= 0 || scrollView.contentOffset.x < 0 {
|
||||||
scrollView.contentOffset = CGPoint(x: lastScrollX, y: scrollView.contentOffset.y);
|
scrollView.contentOffset = CGPoint(x: lastScrollX, y: scrollView.contentOffset.y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2789,24 +2788,24 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
||||||
switch (message.name) {
|
switch (message.name) {
|
||||||
case "consoleLog":
|
case "consoleLog":
|
||||||
messageLevel = 1
|
messageLevel = 1
|
||||||
break;
|
break
|
||||||
case "consoleDebug":
|
case "consoleDebug":
|
||||||
// on Android, console.debug is TIP
|
// on Android, console.debug is TIP
|
||||||
messageLevel = 0
|
messageLevel = 0
|
||||||
break;
|
break
|
||||||
case "consoleError":
|
case "consoleError":
|
||||||
messageLevel = 3
|
messageLevel = 3
|
||||||
break;
|
break
|
||||||
case "consoleInfo":
|
case "consoleInfo":
|
||||||
// on Android, console.info is LOG
|
// on Android, console.info is LOG
|
||||||
messageLevel = 1
|
messageLevel = 1
|
||||||
break;
|
break
|
||||||
case "consoleWarn":
|
case "consoleWarn":
|
||||||
messageLevel = 2
|
messageLevel = 2
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
messageLevel = 1
|
messageLevel = 1
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
let consoleMessage = body["message"] as? String ?? ""
|
let consoleMessage = body["message"] as? String ?? ""
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class WebMessageChannel : FlutterMethodCallDelegate {
|
public class WebMessageChannel: FlutterMethodCallDelegate {
|
||||||
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_web_message_channel_"
|
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_web_message_channel_"
|
||||||
var id: String
|
var id: String
|
||||||
var plugin: SwiftFlutterPlugin?
|
var plugin: SwiftFlutterPlugin?
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class WebMessageChannelChannelDelegate : ChannelDelegate {
|
public class WebMessageChannelChannelDelegate: ChannelDelegate {
|
||||||
private weak var webMessageChannel: WebMessageChannel?
|
private weak var webMessageChannel: WebMessageChannel?
|
||||||
|
|
||||||
public init(webMessageChannel: WebMessageChannel, channel: FlutterMethodChannel) {
|
public init(webMessageChannel: WebMessageChannel, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
public class WebMessageListener : FlutterMethodCallDelegate {
|
public class WebMessageListener: FlutterMethodCallDelegate {
|
||||||
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_web_message_listener_"
|
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_web_message_listener_"
|
||||||
var id: String
|
var id: String
|
||||||
var jsObjectName: String
|
var jsObjectName: String
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class WebMessageListenerChannelDelegate : ChannelDelegate {
|
public class WebMessageListenerChannelDelegate: ChannelDelegate {
|
||||||
private weak var webMessageListener: WebMessageListener?
|
private weak var webMessageListener: WebMessageListener?
|
||||||
|
|
||||||
public init(webMessageListener: WebMessageListener, channel: FlutterMethodChannel) {
|
public init(webMessageListener: WebMessageListener, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
public class WebViewChannelDelegate : ChannelDelegate {
|
public class WebViewChannelDelegate: ChannelDelegate {
|
||||||
private weak var webView: InAppWebView?
|
private weak var webView: InAppWebView?
|
||||||
|
|
||||||
public init(webView: InAppWebView, channel: FlutterMethodChannel) {
|
public init(webView: InAppWebView, channel: FlutterMethodChannel) {
|
||||||
|
@ -743,7 +743,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onExitFullscreen", arguments: arguments)
|
channel?.invokeMethod("onExitFullscreen", arguments: arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class JsAlertCallback : BaseCallbackResult<JsAlertResponse> {
|
public class JsAlertCallback: BaseCallbackResult<JsAlertResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -769,7 +769,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onJsAlert", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onJsAlert", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class JsConfirmCallback : BaseCallbackResult<JsConfirmResponse> {
|
public class JsConfirmCallback: BaseCallbackResult<JsConfirmResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -795,7 +795,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onJsConfirm", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onJsConfirm", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class JsPromptCallback : BaseCallbackResult<JsPromptResponse> {
|
public class JsPromptCallback: BaseCallbackResult<JsPromptResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -822,7 +822,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onJsPrompt", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onJsPrompt", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateWindowCallback : BaseCallbackResult<Bool> {
|
public class CreateWindowCallback: BaseCallbackResult<Bool> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -866,7 +866,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onTitleChanged", arguments: arguments)
|
channel?.invokeMethod("onTitleChanged", arguments: arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PermissionRequestCallback : BaseCallbackResult<PermissionResponse> {
|
public class PermissionRequestCallback: BaseCallbackResult<PermissionResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -887,7 +887,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onPermissionRequest", arguments: request.toMap(), callback: callback)
|
channel?.invokeMethod("onPermissionRequest", arguments: request.toMap(), callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShouldOverrideUrlLoadingCallback : BaseCallbackResult<WKNavigationActionPolicy> {
|
public class ShouldOverrideUrlLoadingCallback: BaseCallbackResult<WKNavigationActionPolicy> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -945,7 +945,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onReceivedHttpError", arguments: arguments)
|
channel?.invokeMethod("onReceivedHttpError", arguments: arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ReceivedHttpAuthRequestCallback : BaseCallbackResult<HttpAuthResponse> {
|
public class ReceivedHttpAuthRequestCallback: BaseCallbackResult<HttpAuthResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -977,7 +977,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ReceivedServerTrustAuthRequestCallback : BaseCallbackResult<ServerTrustAuthResponse> {
|
public class ReceivedServerTrustAuthRequestCallback: BaseCallbackResult<ServerTrustAuthResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -1009,7 +1009,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ReceivedClientCertRequestCallback : BaseCallbackResult<ClientCertResponse> {
|
public class ReceivedClientCertRequestCallback: BaseCallbackResult<ClientCertResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -1056,7 +1056,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onPageCommitVisible", arguments: arguments)
|
channel?.invokeMethod("onPageCommitVisible", arguments: arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LoadResourceWithCustomSchemeCallback : BaseCallbackResult<CustomSchemeResponse> {
|
public class LoadResourceWithCustomSchemeCallback: BaseCallbackResult<CustomSchemeResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -1074,7 +1074,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onLoadResourceWithCustomScheme", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onLoadResourceWithCustomScheme", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CallJsHandlerCallback : BaseCallbackResult<Any> {
|
public class CallJsHandlerCallback: BaseCallbackResult<Any> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -1095,7 +1095,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onCallJsHandler", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onCallJsHandler", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NavigationResponseCallback : BaseCallbackResult<WKNavigationResponsePolicy> {
|
public class NavigationResponseCallback: BaseCallbackResult<WKNavigationResponsePolicy> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -1119,7 +1119,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onNavigationResponse", arguments: navigationResponse.toMap(), callback: callback)
|
channel?.invokeMethod("onNavigationResponse", arguments: navigationResponse.toMap(), callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShouldAllowDeprecatedTLSCallback : BaseCallbackResult<Bool> {
|
public class ShouldAllowDeprecatedTLSCallback: BaseCallbackResult<Bool> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -1182,7 +1182,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onMicrophoneCaptureStateChanged", arguments: arguments)
|
channel?.invokeMethod("onMicrophoneCaptureStateChanged", arguments: arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PrintRequestCallback : BaseCallbackResult<Bool> {
|
public class PrintRequestCallback: BaseCallbackResult<Bool> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
|
|
@ -11,8 +11,9 @@ import WebKit
|
||||||
@available(iOS 11.0, *)
|
@available(iOS 11.0, *)
|
||||||
public class MyCookieManager: ChannelDelegate {
|
public class MyCookieManager: ChannelDelegate {
|
||||||
static let METHOD_CHANNEL_NAME = "com.pichillilorenzo/flutter_inappwebview_cookiemanager"
|
static let METHOD_CHANNEL_NAME = "com.pichillilorenzo/flutter_inappwebview_cookiemanager"
|
||||||
var plugin: SwiftFlutterPlugin?
|
static let httpCookieStore = WKWebsiteDataStore.default().httpCookieStore
|
||||||
static var httpCookieStore = WKWebsiteDataStore.default().httpCookieStore
|
|
||||||
|
private var plugin: SwiftFlutterPlugin?
|
||||||
|
|
||||||
init(plugin: SwiftFlutterPlugin) {
|
init(plugin: SwiftFlutterPlugin) {
|
||||||
super.init(channel: FlutterMethodChannel(name: MyCookieManager.METHOD_CHANNEL_NAME, binaryMessenger: plugin.registrar!.messenger()))
|
super.init(channel: FlutterMethodChannel(name: MyCookieManager.METHOD_CHANNEL_NAME, binaryMessenger: plugin.registrar!.messenger()))
|
||||||
|
@ -64,13 +65,13 @@ public class MyCookieManager: ChannelDelegate {
|
||||||
let path = arguments!["path"] as! String
|
let path = arguments!["path"] as! String
|
||||||
let domain = arguments!["domain"] as? String
|
let domain = arguments!["domain"] as? String
|
||||||
MyCookieManager.deleteCookie(url: url, name: name, path: path, domain: domain, result: result)
|
MyCookieManager.deleteCookie(url: url, name: name, path: path, domain: domain, result: result)
|
||||||
break;
|
break
|
||||||
case "deleteCookies":
|
case "deleteCookies":
|
||||||
let url = arguments!["url"] as! String
|
let url = arguments!["url"] as! String
|
||||||
let path = arguments!["path"] as! String
|
let path = arguments!["path"] as! String
|
||||||
let domain = arguments!["domain"] as? String
|
let domain = arguments!["domain"] as? String
|
||||||
MyCookieManager.deleteCookies(url: url, path: path, domain: domain, result: result)
|
MyCookieManager.deleteCookies(url: url, path: path, domain: domain, result: result)
|
||||||
break;
|
break
|
||||||
case "deleteAllCookies":
|
case "deleteAllCookies":
|
||||||
MyCookieManager.deleteAllCookies(result: result)
|
MyCookieManager.deleteAllCookies(result: result)
|
||||||
break
|
break
|
||||||
|
|
|
@ -11,8 +11,9 @@ import WebKit
|
||||||
@available(iOS 9.0, *)
|
@available(iOS 9.0, *)
|
||||||
public class MyWebStorageManager: ChannelDelegate {
|
public class MyWebStorageManager: ChannelDelegate {
|
||||||
static let METHOD_CHANNEL_NAME = "com.pichillilorenzo/flutter_inappwebview_webstoragemanager"
|
static let METHOD_CHANNEL_NAME = "com.pichillilorenzo/flutter_inappwebview_webstoragemanager"
|
||||||
var plugin: SwiftFlutterPlugin?
|
static let websiteDataStore = WKWebsiteDataStore.default()
|
||||||
static var websiteDataStore = WKWebsiteDataStore.default()
|
|
||||||
|
private var plugin: SwiftFlutterPlugin?
|
||||||
|
|
||||||
init(plugin: SwiftFlutterPlugin) {
|
init(plugin: SwiftFlutterPlugin) {
|
||||||
super.init(channel: FlutterMethodChannel(name: MyWebStorageManager.METHOD_CHANNEL_NAME, binaryMessenger: plugin.registrar!.messenger()))
|
super.init(channel: FlutterMethodChannel(name: MyWebStorageManager.METHOD_CHANNEL_NAME, binaryMessenger: plugin.registrar!.messenger()))
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class CustomUIPrintPageRenderer : UIPrintPageRenderer {
|
public class CustomUIPrintPageRenderer: UIPrintPageRenderer {
|
||||||
private var _numberOfPages: Int?
|
private var _numberOfPages: Int?
|
||||||
private var forceRenderingQuality: Int?
|
private var forceRenderingQuality: Int?
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class PrintAttributes : NSObject {
|
public class PrintAttributes: NSObject {
|
||||||
var orientation: UIPrintInfo.Orientation?
|
var orientation: UIPrintInfo.Orientation?
|
||||||
var duplex: UIPrintInfo.Duplex?
|
var duplex: UIPrintInfo.Duplex?
|
||||||
var outputType: UIPrintInfo.OutputType?
|
var outputType: UIPrintInfo.OutputType?
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class PrintJobChannelDelegate : ChannelDelegate {
|
public class PrintJobChannelDelegate: ChannelDelegate {
|
||||||
private weak var printJobController: PrintJobController?
|
private weak var printJobController: PrintJobController?
|
||||||
|
|
||||||
public init(printJobController: PrintJobController, channel: FlutterMethodChannel) {
|
public init(printJobController: PrintJobController, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ public enum PrintJobState: Int {
|
||||||
case canceled = 7
|
case canceled = 7
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PrintJobController : NSObject, Disposable, UIPrintInteractionControllerDelegate {
|
public class PrintJobController: NSObject, Disposable, UIPrintInteractionControllerDelegate {
|
||||||
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_printjobcontroller_"
|
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_printjobcontroller_"
|
||||||
var id: String
|
var id: String
|
||||||
var plugin: SwiftFlutterPlugin?
|
var plugin: SwiftFlutterPlugin?
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class PrintJobInfo : NSObject {
|
public class PrintJobInfo: NSObject {
|
||||||
var state: PrintJobState
|
var state: PrintJobState
|
||||||
var attributes: PrintAttributes
|
var attributes: PrintAttributes
|
||||||
var creationTime: Int64
|
var creationTime: Int64
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class PullToRefreshChannelDelegate : ChannelDelegate {
|
public class PullToRefreshChannelDelegate: ChannelDelegate {
|
||||||
private weak var pullToRefreshControl: PullToRefreshControl?
|
private weak var pullToRefreshControl: PullToRefreshControl?
|
||||||
|
|
||||||
public init(pullToRefreshControl: PullToRefreshControl, channel: FlutterMethodChannel) {
|
public init(pullToRefreshControl: PullToRefreshControl, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -8,8 +8,9 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import Flutter
|
import Flutter
|
||||||
|
|
||||||
public class PullToRefreshControl : UIRefreshControl, Disposable {
|
public class PullToRefreshControl: UIRefreshControl, Disposable {
|
||||||
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_pull_to_refresh_";
|
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_pull_to_refresh_"
|
||||||
|
|
||||||
var plugin: SwiftFlutterPlugin?
|
var plugin: SwiftFlutterPlugin?
|
||||||
var channelDelegate: PullToRefreshChannelDelegate?
|
var channelDelegate: PullToRefreshChannelDelegate?
|
||||||
var settings: PullToRefreshSettings?
|
var settings: PullToRefreshSettings?
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class PullToRefreshSettings : ISettings<PullToRefreshControl> {
|
public class PullToRefreshSettings: ISettings<PullToRefreshControl> {
|
||||||
|
|
||||||
var enabled = true
|
var enabled = true
|
||||||
var color: String?
|
var color: String?
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class CustomUIActivity : UIActivity {
|
class CustomUIActivity: UIActivity {
|
||||||
var plugin: SwiftFlutterPlugin
|
var plugin: SwiftFlutterPlugin
|
||||||
var viewId: String
|
var viewId: String
|
||||||
var id: Int64
|
var id: Int64
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class SafariViewControllerChannelDelegate : ChannelDelegate {
|
public class SafariViewControllerChannelDelegate: ChannelDelegate {
|
||||||
private weak var safariViewController: SafariViewController?
|
private weak var safariViewController: SafariViewController?
|
||||||
|
|
||||||
public init(safariViewController: SafariViewController, channel: FlutterMethodChannel) {
|
public init(safariViewController: SafariViewController, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class BaseCallbackResult<T> : CallbackResult<T> {
|
public class BaseCallbackResult<T>: CallbackResult<T> {
|
||||||
|
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class CallbackResult<T> : MethodChannelResult {
|
public class CallbackResult<T>: MethodChannelResult {
|
||||||
public var notImplemented: () -> Void = {}
|
public var notImplemented: () -> Void = {}
|
||||||
public var success: (Any?) -> Void = {_ in }
|
public var success: (Any?) -> Void = {_ in }
|
||||||
public var error: (String, String?, Any?) -> Void = {_,_,_ in }
|
public var error: (String, String?, Any?) -> Void = {_,_,_ in }
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class ChannelDelegate : FlutterMethodCallDelegate, Disposable {
|
public class ChannelDelegate: FlutterMethodCallDelegate, Disposable {
|
||||||
var channel: FlutterMethodChannel?
|
var channel: FlutterMethodChannel?
|
||||||
|
|
||||||
public init(channel: FlutterMethodChannel) {
|
public init(channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class ClientCertResponse : NSObject {
|
public class ClientCertResponse: NSObject {
|
||||||
var certificatePath: String
|
var certificatePath: String
|
||||||
var certificatePassword: String?
|
var certificatePassword: String?
|
||||||
var keyStoreType: String?
|
var keyStoreType: String?
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
public class CreateWindowAction : NSObject {
|
public class CreateWindowAction: NSObject {
|
||||||
var navigationAction: WKNavigationAction
|
var navigationAction: WKNavigationAction
|
||||||
var windowId: Int64
|
var windowId: Int64
|
||||||
var windowFeatures: WKWindowFeatures
|
var windowFeatures: WKWindowFeatures
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class CustomSchemeResponse : NSObject {
|
public class CustomSchemeResponse: NSObject {
|
||||||
var data: Data
|
var data: Data
|
||||||
var contentType: String
|
var contentType: String
|
||||||
var contentEncoding: String
|
var contentEncoding: String
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class HttpAuthResponse : NSObject {
|
public class HttpAuthResponse: NSObject {
|
||||||
var username: String
|
var username: String
|
||||||
var password: String
|
var password: String
|
||||||
var permanentPersistence: Bool
|
var permanentPersistence: Bool
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class PermissionResponse : NSObject {
|
public class PermissionResponse: NSObject {
|
||||||
var resources: [Any]
|
var resources: [Any]
|
||||||
var action: Int?
|
var action: Int?
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
public class PluginScript : UserScript {
|
public class PluginScript: UserScript {
|
||||||
var requiredInAllContentWorlds = false
|
var requiredInAllContentWorlds = false
|
||||||
var messageHandlerNames: [String] = []
|
var messageHandlerNames: [String] = []
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class ServerTrustAuthResponse : NSObject {
|
public class ServerTrustAuthResponse: NSObject {
|
||||||
var action: Int?
|
var action: Int?
|
||||||
|
|
||||||
public init(action: Int? = nil) {
|
public init(action: Int? = nil) {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class Size2D : NSObject {
|
public class Size2D: NSObject {
|
||||||
var width: Double
|
var width: Double
|
||||||
var height: Double
|
var height: Double
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
public class UserScript : WKUserScript {
|
public class UserScript: WKUserScript {
|
||||||
var groupName: String?
|
var groupName: String?
|
||||||
|
|
||||||
private var contentWorldWrapper: Any?
|
private var contentWorldWrapper: Any?
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class WebMessage : NSObject, Disposable {
|
public class WebMessage: NSObject, Disposable {
|
||||||
var data: Any?
|
var data: Any?
|
||||||
var type: WebMessageType
|
var type: WebMessageType
|
||||||
var ports: [WebMessagePort]?
|
var ports: [WebMessagePort]?
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class WebMessagePort : NSObject {
|
public class WebMessagePort: NSObject {
|
||||||
var name: String
|
var name: String
|
||||||
var index: Int64
|
var index: Int64
|
||||||
var webMessageChannelId: String
|
var webMessageChannelId: String
|
||||||
|
|
|
@ -9,7 +9,7 @@ import Foundation
|
||||||
import AuthenticationServices
|
import AuthenticationServices
|
||||||
import SafariServices
|
import SafariServices
|
||||||
|
|
||||||
public class WebAuthenticationSession : NSObject, ASWebAuthenticationPresentationContextProviding, Disposable {
|
public class WebAuthenticationSession: NSObject, ASWebAuthenticationPresentationContextProviding, Disposable {
|
||||||
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_webauthenticationsession_"
|
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_webauthenticationsession_"
|
||||||
var id: String
|
var id: String
|
||||||
var plugin: SwiftFlutterPlugin?
|
var plugin: SwiftFlutterPlugin?
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class WebAuthenticationSessionChannelDelegate : ChannelDelegate {
|
public class WebAuthenticationSessionChannelDelegate: ChannelDelegate {
|
||||||
private weak var webAuthenticationSession: WebAuthenticationSession?
|
private weak var webAuthenticationSession: WebAuthenticationSession?
|
||||||
|
|
||||||
public init(webAuthenticationSession: WebAuthenticationSession, channel: FlutterMethodChannel) {
|
public init(webAuthenticationSession: WebAuthenticationSession, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class FindInteractionChannelDelegate : ChannelDelegate {
|
public class FindInteractionChannelDelegate: ChannelDelegate {
|
||||||
private weak var findInteractionController: FindInteractionController?
|
private weak var findInteractionController: FindInteractionController?
|
||||||
|
|
||||||
public init(findInteractionController: FindInteractionController, channel: FlutterMethodChannel) {
|
public init(findInteractionController: FindInteractionController, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class FindInteractionController : NSObject, Disposable {
|
public class FindInteractionController: NSObject, Disposable {
|
||||||
|
|
||||||
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_find_interaction_";
|
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_find_interaction_";
|
||||||
var plugin: InAppWebViewFlutterPlugin?
|
var plugin: InAppWebViewFlutterPlugin?
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class FindInteractionSettings : ISettings<FindInteractionController> {
|
public class FindInteractionSettings: ISettings<FindInteractionController> {
|
||||||
|
|
||||||
override init(){
|
override init(){
|
||||||
super.init()
|
super.init()
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class HeadlessInAppWebView : Disposable {
|
public class HeadlessInAppWebView: Disposable {
|
||||||
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_headless_inappwebview_"
|
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_headless_inappwebview_"
|
||||||
var id: String
|
var id: String
|
||||||
var channelDelegate: HeadlessWebViewChannelDelegate?
|
var channelDelegate: HeadlessWebViewChannelDelegate?
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class HeadlessWebViewChannelDelegate : ChannelDelegate {
|
public class HeadlessWebViewChannelDelegate: ChannelDelegate {
|
||||||
private weak var headlessWebView: HeadlessInAppWebView?
|
private weak var headlessWebView: HeadlessInAppWebView?
|
||||||
|
|
||||||
public init(headlessWebView: HeadlessInAppWebView, channel: FlutterMethodChannel) {
|
public init(headlessWebView: HeadlessInAppWebView, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class InAppBrowserChannelDelegate : ChannelDelegate {
|
public class InAppBrowserChannelDelegate: ChannelDelegate {
|
||||||
public override init(channel: FlutterMethodChannel) {
|
public override init(channel: FlutterMethodChannel) {
|
||||||
super.init(channel: channel)
|
super.init(channel: channel)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct ToolbarIdentifiers {
|
||||||
static let menuButton = NSToolbarItem.Identifier(rawValue: "MenuButton")
|
static let menuButton = NSToolbarItem.Identifier(rawValue: "MenuButton")
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InAppBrowserWindow : NSWindow, NSWindowDelegate, NSToolbarDelegate, NSSearchFieldDelegate {
|
public class InAppBrowserWindow: NSWindow, NSWindowDelegate, NSToolbarDelegate, NSSearchFieldDelegate {
|
||||||
var searchItem: NSToolbarItem?
|
var searchItem: NSToolbarItem?
|
||||||
var backItem: NSToolbarItem?
|
var backItem: NSToolbarItem?
|
||||||
var forwardItem: NSToolbarItem?
|
var forwardItem: NSToolbarItem?
|
||||||
|
|
|
@ -10,8 +10,8 @@ import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
@available(macOS 10.13, *)
|
@available(macOS 10.13, *)
|
||||||
public class CustomSchemeHandler : NSObject, WKURLSchemeHandler {
|
public class CustomSchemeHandler: NSObject, WKURLSchemeHandler {
|
||||||
var schemeHandlers: [Int:WKURLSchemeTask] = [:]
|
var schemeHandlers: [Int: WKURLSchemeTask] = [:]
|
||||||
|
|
||||||
public func webView(_ webView: WKWebView, start urlSchemeTask: WKURLSchemeTask) {
|
public func webView(_ webView: WKWebView, start urlSchemeTask: WKURLSchemeTask) {
|
||||||
schemeHandlers[urlSchemeTask.hash] = urlSchemeTask
|
schemeHandlers[urlSchemeTask.hash] = urlSchemeTask
|
||||||
|
|
|
@ -1571,15 +1571,14 @@ public class InAppWebView: WKWebView, WKUIDelegate,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IdentityAndTrust {
|
struct IdentityAndTrust {
|
||||||
|
var identityRef: SecIdentity
|
||||||
var identityRef:SecIdentity
|
var trust: SecTrust
|
||||||
var trust:SecTrust
|
var certArray: AnyObject
|
||||||
var certArray:AnyObject
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractIdentity(PKCS12Data:NSData, password: String) -> IdentityAndTrust? {
|
func extractIdentity(PKCS12Data: NSData, password: String) -> IdentityAndTrust? {
|
||||||
var identityAndTrust:IdentityAndTrust?
|
var identityAndTrust: IdentityAndTrust?
|
||||||
var securityError:OSStatus = errSecSuccess
|
var securityError: OSStatus = errSecSuccess
|
||||||
|
|
||||||
var importResult: CFArray? = nil
|
var importResult: CFArray? = nil
|
||||||
securityError = SecPKCS12Import(
|
securityError = SecPKCS12Import(
|
||||||
|
@ -1589,19 +1588,19 @@ public class InAppWebView: WKWebView, WKUIDelegate,
|
||||||
)
|
)
|
||||||
|
|
||||||
if securityError == errSecSuccess {
|
if securityError == errSecSuccess {
|
||||||
let certItems:CFArray = importResult! as CFArray;
|
let certItems: CFArray = importResult! as CFArray;
|
||||||
let certItemsArray:Array = certItems as Array
|
let certItemsArray: Array = certItems as Array
|
||||||
let dict:AnyObject? = certItemsArray.first;
|
let dict: AnyObject? = certItemsArray.first;
|
||||||
if let certEntry:Dictionary = dict as? Dictionary<String, AnyObject> {
|
if let certEntry: Dictionary = dict as? Dictionary<String, AnyObject> {
|
||||||
// grab the identity
|
// grab the identity
|
||||||
let identityPointer:AnyObject? = certEntry["identity"];
|
let identityPointer: AnyObject? = certEntry["identity"]
|
||||||
let secIdentityRef:SecIdentity = (identityPointer as! SecIdentity?)!;
|
let secIdentityRef:SecIdentity = (identityPointer as! SecIdentity?)!
|
||||||
// grab the trust
|
// grab the trust
|
||||||
let trustPointer:AnyObject? = certEntry["trust"];
|
let trustPointer: AnyObject? = certEntry["trust"]
|
||||||
let trustRef:SecTrust = trustPointer as! SecTrust;
|
let trustRef:SecTrust = trustPointer as! SecTrust
|
||||||
// grab the cert
|
// grab the cert
|
||||||
let chainPointer:AnyObject? = certEntry["chain"];
|
let chainPointer: AnyObject? = certEntry["chain"]
|
||||||
identityAndTrust = IdentityAndTrust(identityRef: secIdentityRef, trust: trustRef, certArray: chainPointer!);
|
identityAndTrust = IdentityAndTrust(identityRef: secIdentityRef, trust: trustRef, certArray: chainPointer!)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print("Security Error: " + securityError.description)
|
print("Security Error: " + securityError.description)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class WebMessageChannel : FlutterMethodCallDelegate {
|
public class WebMessageChannel: FlutterMethodCallDelegate {
|
||||||
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_web_message_channel_"
|
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_web_message_channel_"
|
||||||
var id: String
|
var id: String
|
||||||
var plugin: InAppWebViewFlutterPlugin?
|
var plugin: InAppWebViewFlutterPlugin?
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class WebMessageChannelChannelDelegate : ChannelDelegate {
|
public class WebMessageChannelChannelDelegate: ChannelDelegate {
|
||||||
private weak var webMessageChannel: WebMessageChannel?
|
private weak var webMessageChannel: WebMessageChannel?
|
||||||
|
|
||||||
public init(webMessageChannel: WebMessageChannel, channel: FlutterMethodChannel) {
|
public init(webMessageChannel: WebMessageChannel, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class WebMessageListener : FlutterMethodCallDelegate {
|
public class WebMessageListener: FlutterMethodCallDelegate {
|
||||||
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_web_message_listener_"
|
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_web_message_listener_"
|
||||||
var id: String
|
var id: String
|
||||||
var jsObjectName: String
|
var jsObjectName: String
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class WebMessageListenerChannelDelegate : ChannelDelegate {
|
public class WebMessageListenerChannelDelegate: ChannelDelegate {
|
||||||
private weak var webMessageListener: WebMessageListener?
|
private weak var webMessageListener: WebMessageListener?
|
||||||
|
|
||||||
public init(webMessageListener: WebMessageListener, channel: FlutterMethodChannel) {
|
public init(webMessageListener: WebMessageListener, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class WebViewChannelDelegate : ChannelDelegate {
|
public class WebViewChannelDelegate: ChannelDelegate {
|
||||||
private weak var webView: InAppWebView?
|
private weak var webView: InAppWebView?
|
||||||
|
|
||||||
public init(webView: InAppWebView, channel: FlutterMethodChannel) {
|
public init(webView: InAppWebView, channel: FlutterMethodChannel) {
|
||||||
|
@ -718,7 +718,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onExitFullscreen", arguments: arguments)
|
channel?.invokeMethod("onExitFullscreen", arguments: arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class JsAlertCallback : BaseCallbackResult<JsAlertResponse> {
|
public class JsAlertCallback: BaseCallbackResult<JsAlertResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -740,7 +740,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onJsAlert", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onJsAlert", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class JsConfirmCallback : BaseCallbackResult<JsConfirmResponse> {
|
public class JsConfirmCallback: BaseCallbackResult<JsConfirmResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -762,7 +762,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onJsConfirm", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onJsConfirm", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class JsPromptCallback : BaseCallbackResult<JsPromptResponse> {
|
public class JsPromptCallback: BaseCallbackResult<JsPromptResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -785,7 +785,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onJsPrompt", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onJsPrompt", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateWindowCallback : BaseCallbackResult<Bool> {
|
public class CreateWindowCallback: BaseCallbackResult<Bool> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -829,7 +829,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onTitleChanged", arguments: arguments)
|
channel?.invokeMethod("onTitleChanged", arguments: arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PermissionRequestCallback : BaseCallbackResult<PermissionResponse> {
|
public class PermissionRequestCallback: BaseCallbackResult<PermissionResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -850,7 +850,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onPermissionRequest", arguments: request.toMap(), callback: callback)
|
channel?.invokeMethod("onPermissionRequest", arguments: request.toMap(), callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShouldOverrideUrlLoadingCallback : BaseCallbackResult<WKNavigationActionPolicy> {
|
public class ShouldOverrideUrlLoadingCallback: BaseCallbackResult<WKNavigationActionPolicy> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -908,7 +908,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onReceivedHttpError", arguments: arguments)
|
channel?.invokeMethod("onReceivedHttpError", arguments: arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ReceivedHttpAuthRequestCallback : BaseCallbackResult<HttpAuthResponse> {
|
public class ReceivedHttpAuthRequestCallback: BaseCallbackResult<HttpAuthResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -940,7 +940,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ReceivedServerTrustAuthRequestCallback : BaseCallbackResult<ServerTrustAuthResponse> {
|
public class ReceivedServerTrustAuthRequestCallback: BaseCallbackResult<ServerTrustAuthResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -972,7 +972,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ReceivedClientCertRequestCallback : BaseCallbackResult<ClientCertResponse> {
|
public class ReceivedClientCertRequestCallback: BaseCallbackResult<ClientCertResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -1019,7 +1019,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onPageCommitVisible", arguments: arguments)
|
channel?.invokeMethod("onPageCommitVisible", arguments: arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LoadResourceWithCustomSchemeCallback : BaseCallbackResult<CustomSchemeResponse> {
|
public class LoadResourceWithCustomSchemeCallback: BaseCallbackResult<CustomSchemeResponse> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -1037,7 +1037,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onLoadResourceWithCustomScheme", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onLoadResourceWithCustomScheme", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CallJsHandlerCallback : BaseCallbackResult<Any> {
|
public class CallJsHandlerCallback: BaseCallbackResult<Any> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -1058,7 +1058,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onCallJsHandler", arguments: arguments, callback: callback)
|
channel?.invokeMethod("onCallJsHandler", arguments: arguments, callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NavigationResponseCallback : BaseCallbackResult<WKNavigationResponsePolicy> {
|
public class NavigationResponseCallback: BaseCallbackResult<WKNavigationResponsePolicy> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -1082,7 +1082,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onNavigationResponse", arguments: navigationResponse.toMap(), callback: callback)
|
channel?.invokeMethod("onNavigationResponse", arguments: navigationResponse.toMap(), callback: callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShouldAllowDeprecatedTLSCallback : BaseCallbackResult<Bool> {
|
public class ShouldAllowDeprecatedTLSCallback: BaseCallbackResult<Bool> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
@ -1145,7 +1145,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||||
channel?.invokeMethod("onMicrophoneCaptureStateChanged", arguments: arguments)
|
channel?.invokeMethod("onMicrophoneCaptureStateChanged", arguments: arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PrintRequestCallback : BaseCallbackResult<Bool> {
|
public class PrintRequestCallback: BaseCallbackResult<Bool> {
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
self.decodeResult = { (obj: Any?) in
|
self.decodeResult = { (obj: Any?) in
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
//
|
//
|
||||||
//public class CustomUIPrintPageRenderer : UIPrintPageRenderer {
|
//public class CustomUIPrintPageRenderer: UIPrintPageRenderer {
|
||||||
// private var _numberOfPages: Int?
|
// private var _numberOfPages: Int?
|
||||||
// private var forceRenderingQuality: Int?
|
// private var forceRenderingQuality: Int?
|
||||||
//
|
//
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class PrintAttributes : NSObject {
|
public class PrintAttributes: NSObject {
|
||||||
var orientation: NSPrintInfo.PaperOrientation?
|
var orientation: NSPrintInfo.PaperOrientation?
|
||||||
var margins: NSEdgeInsets?
|
var margins: NSEdgeInsets?
|
||||||
var paperRect: CGRect?
|
var paperRect: CGRect?
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class PrintJobChannelDelegate : ChannelDelegate {
|
public class PrintJobChannelDelegate: ChannelDelegate {
|
||||||
private weak var printJobController: PrintJobController?
|
private weak var printJobController: PrintJobController?
|
||||||
|
|
||||||
public init(printJobController: PrintJobController, channel: FlutterMethodChannel) {
|
public init(printJobController: PrintJobController, channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ public enum PrintJobState: Int {
|
||||||
case canceled = 7
|
case canceled = 7
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PrintJobController : NSObject, Disposable {
|
public class PrintJobController: NSObject, Disposable {
|
||||||
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_printjobcontroller_"
|
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_printjobcontroller_"
|
||||||
var id: String
|
var id: String
|
||||||
var plugin: InAppWebViewFlutterPlugin?
|
var plugin: InAppWebViewFlutterPlugin?
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class PrintJobInfo : NSObject {
|
public class PrintJobInfo: NSObject {
|
||||||
var state: PrintJobState
|
var state: PrintJobState
|
||||||
var attributes: PrintAttributes
|
var attributes: PrintAttributes
|
||||||
var creationTime: Int64
|
var creationTime: Int64
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class BaseCallbackResult<T> : CallbackResult<T> {
|
public class BaseCallbackResult<T>: CallbackResult<T> {
|
||||||
|
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class CallbackResult<T> : MethodChannelResult {
|
public class CallbackResult<T>: MethodChannelResult {
|
||||||
public var notImplemented: () -> Void = {}
|
public var notImplemented: () -> Void = {}
|
||||||
public var success: (Any?) -> Void = {_ in }
|
public var success: (Any?) -> Void = {_ in }
|
||||||
public var error: (String, String?, Any?) -> Void = {_,_,_ in }
|
public var error: (String, String?, Any?) -> Void = {_,_,_ in }
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class ChannelDelegate : FlutterMethodCallDelegate, Disposable {
|
public class ChannelDelegate: FlutterMethodCallDelegate, Disposable {
|
||||||
var channel: FlutterMethodChannel?
|
var channel: FlutterMethodChannel?
|
||||||
|
|
||||||
public init(channel: FlutterMethodChannel) {
|
public init(channel: FlutterMethodChannel) {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class ClientCertResponse : NSObject {
|
public class ClientCertResponse: NSObject {
|
||||||
var certificatePath: String
|
var certificatePath: String
|
||||||
var certificatePassword: String?
|
var certificatePassword: String?
|
||||||
var keyStoreType: String?
|
var keyStoreType: String?
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
public class CreateWindowAction : NSObject {
|
public class CreateWindowAction: NSObject {
|
||||||
var navigationAction: WKNavigationAction
|
var navigationAction: WKNavigationAction
|
||||||
var windowId: Int64
|
var windowId: Int64
|
||||||
var windowFeatures: WKWindowFeatures
|
var windowFeatures: WKWindowFeatures
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class CustomSchemeResponse : NSObject {
|
public class CustomSchemeResponse: NSObject {
|
||||||
var data: Data
|
var data: Data
|
||||||
var contentType: String
|
var contentType: String
|
||||||
var contentEncoding: String
|
var contentEncoding: String
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class HttpAuthResponse : NSObject {
|
public class HttpAuthResponse: NSObject {
|
||||||
var username: String
|
var username: String
|
||||||
var password: String
|
var password: String
|
||||||
var permanentPersistence: Bool
|
var permanentPersistence: Bool
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class PermissionResponse : NSObject {
|
public class PermissionResponse: NSObject {
|
||||||
var resources: [Any]
|
var resources: [Any]
|
||||||
var action: Int?
|
var action: Int?
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
public class PluginScript : UserScript {
|
public class PluginScript: UserScript {
|
||||||
var requiredInAllContentWorlds = false
|
var requiredInAllContentWorlds = false
|
||||||
var messageHandlerNames: [String] = []
|
var messageHandlerNames: [String] = []
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class ServerTrustAuthResponse : NSObject {
|
public class ServerTrustAuthResponse: NSObject {
|
||||||
var action: Int?
|
var action: Int?
|
||||||
|
|
||||||
public init(action: Int? = nil) {
|
public init(action: Int? = nil) {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class Size2D : NSObject {
|
public class Size2D: NSObject {
|
||||||
var width: Double
|
var width: Double
|
||||||
var height: Double
|
var height: Double
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
public class UserScript : WKUserScript {
|
public class UserScript: WKUserScript {
|
||||||
var groupName: String?
|
var groupName: String?
|
||||||
|
|
||||||
private var contentWorldWrapper: Any?
|
private var contentWorldWrapper: Any?
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class WebMessage : NSObject, Disposable {
|
public class WebMessage: NSObject, Disposable {
|
||||||
var data: Any?
|
var data: Any?
|
||||||
var type: WebMessageType
|
var type: WebMessageType
|
||||||
var ports: [WebMessagePort]?
|
var ports: [WebMessagePort]?
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class WebMessagePort : NSObject {
|
public class WebMessagePort: NSObject {
|
||||||
var name: String
|
var name: String
|
||||||
var index: Int64
|
var index: Int64
|
||||||
var webMessageChannelId: String
|
var webMessageChannelId: String
|
||||||
|
|
|
@ -10,7 +10,7 @@ import AuthenticationServices
|
||||||
import SafariServices
|
import SafariServices
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class WebAuthenticationSession : NSObject, ASWebAuthenticationPresentationContextProviding, Disposable {
|
public class WebAuthenticationSession: NSObject, ASWebAuthenticationPresentationContextProviding, Disposable {
|
||||||
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_webauthenticationsession_"
|
static let METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_webauthenticationsession_"
|
||||||
var id: String
|
var id: String
|
||||||
var plugin: InAppWebViewFlutterPlugin?
|
var plugin: InAppWebViewFlutterPlugin?
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class WebAuthenticationSessionChannelDelegate : ChannelDelegate {
|
public class WebAuthenticationSessionChannelDelegate: ChannelDelegate {
|
||||||
private weak var webAuthenticationSession: WebAuthenticationSession?
|
private weak var webAuthenticationSession: WebAuthenticationSession?
|
||||||
|
|
||||||
public init(webAuthenticationSession: WebAuthenticationSession, channel: FlutterMethodChannel) {
|
public init(webAuthenticationSession: WebAuthenticationSession, channel: FlutterMethodChannel) {
|
||||||
|
|
Loading…
Reference in New Issue