Skip to content

Commit

Permalink
Merge pull request #388 from cosmostation/feature/APP-841_dapp_session
Browse files Browse the repository at this point in the history
[APP-841] dapp session bug fixed
  • Loading branch information
wannabit-yongjoo committed Dec 19, 2023
2 parents ee65d91 + b865794 commit 26820c7
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions Cosmostation/Controller/Main/DappStartVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ class DappStartVC: BaseVC {

override func viewDidLoad() {
super.viewDidLoad()
let dataTypes: Set<String> = ["WKWebsiteDataTypeCookies", "WKWebsiteDataTypeLocalStorage"]
WKWebsiteDataStore.default().fetchDataRecords(ofTypes: dataTypes, completionHandler: {
(records) -> Void in
for record in records {
WKWebsiteDataStore.default().removeData(ofTypes: record.dataTypes, for: [record], completionHandler: {})
}
})
initView()
}

func initView() {

let configuration = WKWebViewConfiguration()
configuration.allowsInlineMediaPlayback = true
webView.isOpaque = false
Expand All @@ -30,18 +36,6 @@ class DappStartVC: BaseVC {
webView.uiDelegate = self
webView.allowsLinkPreview = false
webView.scrollView.bounces = false
// WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in
// records.forEach { record in
// WKWebsiteDataStore.default().removeData(ofTypes: record.dataTypes, for: [record], completionHandler: {})
// }
// }
// if let dictionary = Bundle.main.infoDictionary,
// let version = dictionary["CFBundleShortVersionString"] as? String {
// webView.evaluateJavaScript("navigator.userAgent") { (result, error) in
// let originUserAgent = result as! String
// self.webView.customUserAgent = "Cosmostation/APP/iOS/DappTab/\(version) \(originUserAgent)"
// }
// }

if let url = URL(string: "https://dapps.cosmostation.io") {
webView.load(URLRequest(url: url))
Expand All @@ -56,7 +50,6 @@ class DappStartVC: BaseVC {
dappDetail.modalPresentationStyle = .fullScreen
self.present(dappDetail, animated: true)
}

}

extension DappStartVC: WKNavigationDelegate, WKUIDelegate {
Expand Down

0 comments on commit 26820c7

Please sign in to comment.