Commit 905b16f1 authored by Steven杜宇's avatar Steven杜宇

// 签字

parent fd6abd84
......@@ -39,6 +39,7 @@
0419A0A42C49184300A5FCFA /* YHInvitationNumberItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0419A0A32C49184300A5FCFA /* YHInvitationNumberItemView.swift */; };
042092B32C9D4884001184F0 /* YHURLEncodeHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042092B22C9D4884001184F0 /* YHURLEncodeHelper.swift */; };
042092B52C9D48FC001184F0 /* YHRealNameHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042092B42C9D48FC001184F0 /* YHRealNameHelper.swift */; };
042092B72C9D6719001184F0 /* YHSignatureWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042092B62C9D6719001184F0 /* YHSignatureWebViewController.swift */; };
04213B202C47ADEA00797900 /* ATAuthSDK_D.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04213B1F2C47ADEA00797900 /* ATAuthSDK_D.framework */; };
04213B212C47AE0100797900 /* ATAuthSDK_D.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 04213B1F2C47ADEA00797900 /* ATAuthSDK_D.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
04213B232C48B7F700797900 /* YHIdentityTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04213B222C48B7F700797900 /* YHIdentityTabBar.swift */; };
......@@ -876,6 +877,7 @@
0419A0A32C49184300A5FCFA /* YHInvitationNumberItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInvitationNumberItemView.swift; sourceTree = "<group>"; };
042092B22C9D4884001184F0 /* YHURLEncodeHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHURLEncodeHelper.swift; sourceTree = "<group>"; };
042092B42C9D48FC001184F0 /* YHRealNameHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHRealNameHelper.swift; sourceTree = "<group>"; };
042092B62C9D6719001184F0 /* YHSignatureWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSignatureWebViewController.swift; sourceTree = "<group>"; };
04213B1F2C47ADEA00797900 /* ATAuthSDK_D.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ATAuthSDK_D.framework; path = framework/ATAuthSDK_D.framework; sourceTree = "<group>"; };
04213B222C48B7F700797900 /* YHIdentityTabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIdentityTabBar.swift; sourceTree = "<group>"; };
04213B242C48C15400797900 /* YHHomeIdentityViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeIdentityViewController.swift; sourceTree = "<group>"; };
......@@ -3387,6 +3389,7 @@
children = (
04B4B8DB2C90696E00ED82BC /* YHResignDocumentManagementVC.swift */,
04F243282C942A5500DF2C74 /* YHResignDocumentDetailViewController.swift */,
042092B62C9D6719001184F0 /* YHSignatureWebViewController.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -5172,6 +5175,7 @@
04256DEE2C73338200A37BA4 /* YHGrabingNumberListCell.swift in Sources */,
045EEEEC2B9F171A0022A143 /* YHBrotherInfoVC.swift in Sources */,
0477E17A2BA41C7E00436346 /* YHCertificateModel.swift in Sources */,
042092B72C9D6719001184F0 /* YHSignatureWebViewController.swift in Sources */,
A5CA3F5A2C74B64A00EB22F5 /* YHSmallWhiteNoteTemplateView.swift in Sources */,
045EEF242B9F171A0022A143 /* YHStepView.swift in Sources */,
04CE1AD62C2AD91F001CB80A /* YHApplyActivityResultViewController.swift in Sources */,
......
//
// YHSignatureWebViewController.swift
// galaxy
//
// Created by edy on 2024/9/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHSignatureWebViewController: YHBaseViewController {
var realNameUrl: String = ""
var progBar = UIProgressView()
lazy var webView: WKWebView = {
let webView = WKWebView(frame: CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: KScreenWidth, height: KScreenHeight-k_Height_NavigationtBarAndStatuBar), configuration: self.configuaration)
webView.navigationDelegate = self
return webView
}()
lazy var configuaration: WKWebViewConfiguration = {
let config = WKWebViewConfiguration()
let preferences = WKPreferences()
preferences.javaScriptCanOpenWindowsAutomatically = true
config.preferences = preferences
config.userContentController = self.userContentController
config.allowsInlineMediaPlayback = true
config.defaultWebpagePreferences.preferredContentMode = .mobile
return config
}()
lazy var userContentController = {
let vc = WKUserContentController()
return vc
}()
lazy var progressBar: UIProgressView = {
let progBar = UIProgressView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 30))
progBar.progress = 0.0
progBar.tintColor = UIColor.brandMainColor
return progBar
}()
deinit {
webView.removeObserver(self, forKeyPath: "estimatedProgress")
NotificationCenter.default.removeObserver(self)
}
override func viewDidLoad() {
super.viewDidLoad()
createUI()
}
func createUI() {
webView.addSubview(progBar)
self.view.addSubview(webView)
// 监听网页加载的进度
webView.addObserver(self, forKeyPath: "estimatedProgress", options: .new, context: nil)
if let url = URL(string: realNameUrl) {
webView.load(URLRequest(url: url))
}
}
func handleRequest(_ request: URLRequest) -> Bool {
if let url = request.url {
let handleResult = YHRealNameHelper.handleRealnameURL(url, delegate: self)
return handleResult != .cancel
}
return false
}
// MARK: - KVO
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == "estimatedProgress" {
self.progressBar.alpha = 1.0
progressBar.setProgress(Float(webView.estimatedProgress), animated: true)
//进度条的值最大为1.0
if(self.webView.estimatedProgress >= 1.0) {
UIView.animate(withDuration: 0.3, delay: 0.1, options: .curveEaseInOut, animations: { () -> Void in
self.progressBar.alpha = 0.0
}, completion: { (finished:Bool) -> Void in
self.progressBar.progress = 0
})
}
}
}
}
extension YHSignatureWebViewController: YHRealNameDelegate {
func realnameJumptoAlipay() {
}
func realnameResult(_ result: YHRealnameResult) {
}
func signResult(_ status: Bool) {
}
}
extension YHSignatureWebViewController : WKNavigationDelegate {
// 开始加载
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
}
// 加载完成
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
}
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if let url = navigationAction.request.url {
let absoluteString = url.absoluteString
printLog("\(absoluteString)")
}
let isAllow = self.handleRequest(navigationAction.request)
if (isAllow) {
decisionHandler(.allow);
} else {
decisionHandler(.cancel);
}
}
func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
// 判断服务器采用的验证方法
if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) {
// 如果没有错误的情况下 创建一个凭证,并使用证书
if (challenge.previousFailureCount == 0), let serverTrust = challenge.protectionSpace.serverTrust {
let credential = URLCredential(trust: serverTrust)
completionHandler(.useCredential, credential)
} else {
// 验证失败,取消本次验证
completionHandler(.cancelAuthenticationChallenge, nil)
}
} else {
completionHandler(.cancelAuthenticationChallenge, nil)
}
}
}
......@@ -417,9 +417,10 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
// 根据订单状态获取其可以进入的路由数组
let routers = self.getRoutersForOrderStage(stage)
var routerStringArr = routers.map { page in
let routerStringArr = routers.map { page in
return page.rawValue
}
printLog("\(message.redirectPage)")
if routerStringArr.contains(message.redirectPage) {
self.routeToPage(message)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment