mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-12 07:36:42 +08:00
447b23f25f
Co-authored-by: EYHN <cneyhn@gmail.com>
52 lines
1.5 KiB
Swift
52 lines
1.5 KiB
Swift
import Capacitor
|
|
import Intelligents
|
|
import UIKit
|
|
|
|
class AFFiNEViewController: CAPBridgeViewController {
|
|
var baseUrl: String? {
|
|
didSet { Intelligents.setUpstreamEndpoint(baseUrl ?? "") }
|
|
}
|
|
var documentID: String?
|
|
var workspaceID: String?
|
|
var documentContent: String?
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
webView?.allowsBackForwardNavigationGestures = true
|
|
navigationController?.navigationBar.isHidden = true
|
|
extendedLayoutIncludesOpaqueBars = false
|
|
edgesForExtendedLayout = []
|
|
let intelligentsButton = installIntelligentsButton()
|
|
intelligentsButton.delegate = self
|
|
dismissIntelligentsButton()
|
|
}
|
|
|
|
override func webViewConfiguration(for instanceConfiguration: InstanceConfiguration) -> WKWebViewConfiguration {
|
|
let configuration = super.webViewConfiguration(for: instanceConfiguration)
|
|
return configuration
|
|
}
|
|
|
|
override func webView(with frame: CGRect, configuration: WKWebViewConfiguration) -> WKWebView {
|
|
return super.webView(with: frame, configuration: configuration)
|
|
}
|
|
|
|
override func capacitorDidLoad() {
|
|
let plugins: [CAPPlugin] = [
|
|
AuthPlugin(),
|
|
CookiePlugin(),
|
|
HashcashPlugin(),
|
|
NavigationGesturePlugin(),
|
|
IntelligentsPlugin(representController: self),
|
|
NbStorePlugin(),
|
|
]
|
|
plugins.forEach { bridge?.registerPluginInstance($0) }
|
|
}
|
|
|
|
override func viewDidAppear(_ animated: Bool) {
|
|
super.viewDidAppear(animated)
|
|
navigationController?.setNavigationBarHidden(false, animated: animated)
|
|
}
|
|
}
|
|
|
|
|