Merge pull request #2080 from AlphaWallet/remove-unused-func-arg

Remove unused func arg
pull/2084/head
James Sangalli 4 years ago committed by GitHub
commit 57a260614c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      AlphaWallet/Browser/Factory/WKWebViewConfiguration.swift
  2. 2
      AlphaWallet/Browser/ViewControllers/BrowserViewController.swift
  3. 2
      AlphaWallet/Tokens/Views/TokenInstanceWebView.swift

@ -5,18 +5,18 @@ import WebKit
import JavaScriptCore
enum WebViewType {
case dappBrowser
case dappBrowser(RPCServer)
case tokenScriptRenderer
}
extension WKWebViewConfiguration {
static func make(forType type: WebViewType, server: RPCServer, address: AlphaWallet.Address, in messageHandler: WKScriptMessageHandler) -> WKWebViewConfiguration {
static func make(forType type: WebViewType, address: AlphaWallet.Address, in messageHandler: WKScriptMessageHandler) -> WKWebViewConfiguration {
let webViewConfig = WKWebViewConfiguration()
var js = ""
switch type {
case .dappBrowser:
case .dappBrowser(let server):
guard
let bundlePath = Bundle.main.path(forResource: "AlphaWalletWeb3Provider", ofType: "bundle"),
let bundle = Bundle(path: bundlePath) else { return webViewConfig }
@ -28,7 +28,7 @@ extension WKWebViewConfiguration {
}
js += javaScriptForDappBrowser(server: server, address: address)
case .tokenScriptRenderer:
js += javaScriptForTokenScriptRenderer(server: server, address: address)
js += javaScriptForTokenScriptRenderer(address: address)
js += """
\n
web3.tokens = {
@ -141,7 +141,7 @@ extension WKWebViewConfiguration {
"""
}
fileprivate static func javaScriptForTokenScriptRenderer(server: RPCServer, address: AlphaWallet.Address) -> String {
fileprivate static func javaScriptForTokenScriptRenderer(address: AlphaWallet.Address) -> String {
return """
window.web3CallBacks = {}
window.tokenScriptCallBacks = {}

@ -62,7 +62,7 @@ final class BrowserViewController: UIViewController {
}()
lazy var config: WKWebViewConfiguration = {
let config = WKWebViewConfiguration.make(forType: .dappBrowser, server: server, address: account.address, in: ScriptMessageProxy(delegate: self))
let config = WKWebViewConfiguration.make(forType: .dappBrowser(server), address: account.address, in: ScriptMessageProxy(delegate: self))
config.websiteDataStore = WKWebsiteDataStore.default()
return config
}()

@ -53,7 +53,7 @@ class TokenInstanceWebView: UIView {
private var hashOfLoadedHtml: Int?
lazy private var heightConstraint = heightAnchor.constraint(equalToConstant: 100)
lazy private var webView: WKWebView = {
let webViewConfig = WKWebViewConfiguration.make(forType: .tokenScriptRenderer, server: server, address: walletAddress, in: ScriptMessageProxy(delegate: self))
let webViewConfig = WKWebViewConfiguration.make(forType: .tokenScriptRenderer, address: walletAddress, in: ScriptMessageProxy(delegate: self))
webViewConfig.websiteDataStore = .default()
return .init(frame: .zero, configuration: webViewConfig)
}()

Loading…
Cancel
Save