Commit ec3f1ac52ed4e89898621904452a77b03b0e1856
1 parent
42b1cd93
添加webViewUA
Showing
11 changed files
with
73 additions
and
22 deletions
metaCode/Classes/Environment/CNLiveEnvironment.swift
metaCode/Classes/Main/HomePage/Controller/CNWebViewController.swift
| ... | ... | @@ -27,7 +27,16 @@ class CNWebViewController:CNLiveBaseViewController ,WKNavigationDelegate{ |
| 27 | 27 | _url = newValue! |
| 28 | 28 | if (_url != ""){ |
| 29 | 29 | let webUrl: URL! = URL.init(string: _url!) |
| 30 | - webView.load(URLRequest.init(url:webUrl)) | |
| 30 | + webView.evaluateJavaScript("navigator.userAgent") { [self] result, error in | |
| 31 | + let userAgent = result as! String | |
| 32 | + if error == nil && userAgent.count > 0 { | |
| 33 | + if !userAgent.contains(CNLiveEnvironmentManager.shared.base_web_UA) { | |
| 34 | + let newUserAgent = userAgent + CNLiveEnvironmentManager.shared.base_web_UA | |
| 35 | + webView.customUserAgent = newUserAgent | |
| 36 | + } | |
| 37 | + } | |
| 38 | + webView.load(URLRequest.init(url:webUrl)) | |
| 39 | + } | |
| 31 | 40 | } |
| 32 | 41 | } |
| 33 | 42 | } | ... | ... |
metaCode/Classes/Main/LoginPage/Controller/CNLiveLoginViewController.swift
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | import Foundation |
| 9 | 9 | import UIKit |
| 10 | 10 | import SnapKit |
| 11 | +import APButton | |
| 11 | 12 | |
| 12 | 13 | class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { |
| 13 | 14 | |
| ... | ... | @@ -52,12 +53,13 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { |
| 52 | 53 | return veriText |
| 53 | 54 | }() |
| 54 | 55 | |
| 55 | - lazy var loginButton: UIButton = { | |
| 56 | - let loginButton = UIButton(type: .custom) | |
| 56 | + lazy var loginButton: APButton = { | |
| 57 | + let loginButton = APButton() | |
| 57 | 58 | loginButton.setTitle("登 录", for: .normal) |
| 58 | 59 | loginButton.setTitleColor(.white, for: .normal) |
| 59 | 60 | loginButton.titleLabel?.font = BoldFont_16_Fit |
| 60 | 61 | loginButton.layer.cornerRadius = 20 |
| 62 | + loginButton.activityIndicator.color = .white | |
| 61 | 63 | loginButton.layer.masksToBounds = true |
| 62 | 64 | loginButton.addTarget(self, action: #selector(sendLoginActionMothod), for: .touchUpInside) |
| 63 | 65 | return loginButton |
| ... | ... | @@ -283,7 +285,9 @@ extension CNLiveLoginViewController { |
| 283 | 285 | return |
| 284 | 286 | } |
| 285 | 287 | view.endEditing(true) |
| 286 | - CNLiveLoginViewModel.requestLoginAction(userName: phoneText.text ?? "", countryCode: country, verCode: veriText.text ?? "") { | |
| 288 | + loginButton.startAnimating() | |
| 289 | + CNLiveLoginViewModel.requestLoginAction(userName: phoneText.text ?? "", countryCode: country, verCode: veriText.text ?? "") { [self] in | |
| 290 | + loginButton.stopAnimating() | |
| 287 | 291 | let window = UIApplication.shared.delegate?.window |
| 288 | 292 | window??.rootViewController = CNLiveBaseTabBarViewController.init() |
| 289 | 293 | } | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveInputFeedBackViewController.swift
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | 9 | import HXPHPicker |
| 10 | - | |
| 10 | +import APButton | |
| 11 | 11 | enum InputFeedBackType { |
| 12 | 12 | case problem |
| 13 | 13 | case product |
| ... | ... | @@ -100,13 +100,14 @@ class CNLiveInputFeedBackViewController: CNLiveBaseViewController, UITextViewDel |
| 100 | 100 | return mobileField |
| 101 | 101 | }() |
| 102 | 102 | |
| 103 | - lazy var sendButton: UIButton = { | |
| 104 | - let sendButton = UIButton(type: .custom) | |
| 103 | + lazy var sendButton: APButton = { | |
| 104 | + let sendButton = APButton() | |
| 105 | 105 | sendButton.setTitle("提 交", for: .normal) |
| 106 | 106 | sendButton.setTitleColor(.white, for: .normal) |
| 107 | 107 | sendButton.titleLabel?.font = BoldFont_16_Fit |
| 108 | 108 | sendButton.layer.cornerRadius = 20 |
| 109 | 109 | sendButton.layer.masksToBounds = true |
| 110 | + sendButton.activityIndicator.color = .white | |
| 110 | 111 | sendButton.addTarget(self, action: #selector(sendInfoActionMothod), for: .touchUpInside) |
| 111 | 112 | return sendButton |
| 112 | 113 | }() |
| ... | ... | @@ -212,9 +213,11 @@ class CNLiveInputFeedBackViewController: CNLiveBaseViewController, UITextViewDel |
| 212 | 213 | } |
| 213 | 214 | |
| 214 | 215 | @objc func sendInfoActionMothod() { |
| 215 | - CNLiveMineViewModel.requestFeedBack(text: p_textView.text ?? "", contactWay: UserInfoManager.shared.userInfo.mobile, images: imageUrlArray) { type, result in | |
| 216 | + sendButton.startAnimating() | |
| 217 | + CNLiveMineViewModel.requestFeedBack(text: p_textView.text ?? "", contactWay: UserInfoManager.shared.userInfo.mobile, images: imageUrlArray) { [self] type, result in | |
| 216 | 218 | if result { |
| 217 | 219 | showMessage(message: "内容提交成功") |
| 220 | + sendButton.stopAnimating() | |
| 218 | 221 | self.navigationController?.popViewController(animated: true) |
| 219 | 222 | } |
| 220 | 223 | } | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAddInfoViewController.swift
| ... | ... | @@ -99,6 +99,7 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel |
| 99 | 99 | } |
| 100 | 100 | if _show_type == .info || _show_type == .add { |
| 101 | 101 | showLoading(message: "") |
| 102 | + NotificationCenter.default.addObserver(self, selector: #selector(StandAuthNotificationSuccessAction), name: Notification.Name.StandAuth.StandAuthNotificationSuccess, object: nil) | |
| 102 | 103 | } |
| 103 | 104 | loadData() |
| 104 | 105 | addRefreshView() |
| ... | ... | @@ -110,6 +111,10 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel |
| 110 | 111 | } |
| 111 | 112 | } |
| 112 | 113 | |
| 114 | + deinit { | |
| 115 | + NotificationCenter.default.removeObserver(self, name: Notification.Name.StandAuth.StandAuthNotificationSuccess, object: nil) | |
| 116 | + } | |
| 117 | + | |
| 113 | 118 | private func loadData() { |
| 114 | 119 | if _show_type == .add { |
| 115 | 120 | CNLiveMineViewModel.requestAuthStandList(page: self.pageNum) { [weak self] result, respStatue in |
| ... | ... | @@ -184,13 +189,18 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel |
| 184 | 189 | self!.pageNum = 1 |
| 185 | 190 | self!.loadData() |
| 186 | 191 | }) |
| 187 | - tableView.mj_footer = MJRefreshFooter.init(refreshingBlock: {[weak self] in | |
| 192 | + tableView.mj_footer = MJRefreshBackNormalFooter.init(refreshingBlock: {[weak self] in | |
| 188 | 193 | self!.pageNum += 1 |
| 189 | 194 | self!.loadData() |
| 190 | 195 | }) |
| 191 | 196 | } |
| 192 | 197 | } |
| 193 | 198 | |
| 199 | + @objc func StandAuthNotificationSuccessAction() { | |
| 200 | + self.pageNum = 1 | |
| 201 | + loadData() | |
| 202 | + } | |
| 203 | + | |
| 194 | 204 | |
| 195 | 205 | @objc func noteSetAction() {} |
| 196 | 206 | @objc func backCopyAction() {} | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineEarnListViewController.swift
| ... | ... | @@ -59,11 +59,13 @@ class CNLiveMineEarnListViewController: CNLiveBaseViewController, JXPagingViewLi |
| 59 | 59 | self.pageNum = 1 |
| 60 | 60 | } |
| 61 | 61 | if _show_type == .balance { |
| 62 | - CNLiveMineViewModel.requestWithTradRecord(page: page) { result, respStatue in | |
| 62 | + CNLiveMineViewModel.requestWithTradRecord(page: page) { [self] result, respStatue in | |
| 63 | 63 | if respStatue == .success { |
| 64 | 64 | let listModel = result as! MineTradingRecordBaseModel |
| 65 | 65 | self.network_type = .success |
| 66 | - self.dataArray.removeAllObjects() | |
| 66 | + if pageNum == 1 { | |
| 67 | + self.dataArray.removeAllObjects() | |
| 68 | + } | |
| 67 | 69 | self.dataArray.addObjects(from: listModel.list) |
| 68 | 70 | self.tableView.reloadData() |
| 69 | 71 | self.tableView.mj_header?.endRefreshing() |
| ... | ... | @@ -71,6 +73,10 @@ class CNLiveMineEarnListViewController: CNLiveBaseViewController, JXPagingViewLi |
| 71 | 73 | if self.dataArray.count > 0 { |
| 72 | 74 | self.addRefreshView() |
| 73 | 75 | } |
| 76 | + if listModel.lasePage { | |
| 77 | + self.tableView.mj_footer?.endRefreshing() | |
| 78 | + self.tableView.mj_footer?.endRefreshingWithNoMoreData() | |
| 79 | + } | |
| 74 | 80 | }else if (respStatue == .noNetwork) { |
| 75 | 81 | self.network_type = .noNetwork |
| 76 | 82 | self.tableView.reloadEmptyDataSet() |
| ... | ... | @@ -128,7 +134,7 @@ class CNLiveMineEarnListViewController: CNLiveBaseViewController, JXPagingViewLi |
| 128 | 134 | } |
| 129 | 135 | |
| 130 | 136 | private func addRefreshView() { |
| 131 | - let footerView = MJRefreshAutoNormalFooter.init(refreshingBlock: {[weak self] in | |
| 137 | + let footerView = MJRefreshBackNormalFooter.init(refreshingBlock: {[weak self] in | |
| 132 | 138 | self!.pageNum += 1 |
| 133 | 139 | self!.loadDataWithTradRecord(page: self!.pageNum) {result,respStatue in } |
| 134 | 140 | }) | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineInputViewController.swift
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | import Foundation |
| 9 | 9 | import EmptyDataSet_Swift |
| 10 | 10 | import HXPHPicker |
| 11 | - | |
| 11 | +import APButton | |
| 12 | 12 | typealias resultUploadImageBlock = (_ url: String) -> Void |
| 13 | 13 | class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate, PhotoPickerControllerDelegate{ |
| 14 | 14 | |
| ... | ... | @@ -36,14 +36,15 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg |
| 36 | 36 | return tipLabel |
| 37 | 37 | }() |
| 38 | 38 | |
| 39 | - lazy var sendButton: UIButton = { | |
| 40 | - let sendButton = UIButton(type: .custom) | |
| 39 | + lazy var sendButton: APButton = { | |
| 40 | + let sendButton = APButton() | |
| 41 | 41 | sendButton.setTitle("添加身份", for: .normal) |
| 42 | 42 | sendButton.setTitleColor(.white, for: .normal) |
| 43 | 43 | sendButton.titleLabel?.font = BoldFont_16_Fit |
| 44 | 44 | sendButton.layer.cornerRadius = 20 |
| 45 | 45 | sendButton.layer.masksToBounds = true |
| 46 | 46 | sendButton.isHidden = true |
| 47 | + sendButton.activityIndicator.color = .white | |
| 47 | 48 | sendButton.addTarget(self, action: #selector(sendInfoActionMothod), for: .touchUpInside) |
| 48 | 49 | return sendButton |
| 49 | 50 | }() |
| ... | ... | @@ -133,9 +134,11 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg |
| 133 | 134 | if (self.tempCell != nil) { |
| 134 | 135 | self.tempCell._infoModel?.value = url |
| 135 | 136 | } |
| 137 | + sendButton.startAnimating() | |
| 136 | 138 | CNLiveMineViewModel.requestsPOSTAuthInfo(identityId: "\(_listModel.id)", infos: self.dataArray) { [self] result, respStatue in |
| 137 | 139 | if respStatue == .success { |
| 138 | 140 | showMessage(message: "上传成功") |
| 141 | + sendButton.stopAnimating() | |
| 139 | 142 | DispatchQueue.main.asyncAfter(deadline: .now()+1) { [self] in |
| 140 | 143 | self.navigationController?.pushViewController(CNLiveMineAuthResultViewController.init(listModel: _listModel,show_type: .result_success), animated: true) |
| 141 | 144 | } | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
| ... | ... | @@ -68,7 +68,10 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, |
| 68 | 68 | tableView.snp.makeConstraints { make in |
| 69 | 69 | make.edges.equalToSuperview() |
| 70 | 70 | } |
| 71 | + | |
| 72 | + NotificationCenter.default.addObserver(self, selector: #selector(StandAuthNotificationSuccessAction), name: Notification.Name.StandAuth.StandAuthNotificationSuccess, object: nil) | |
| 71 | 73 | } |
| 74 | + | |
| 72 | 75 | |
| 73 | 76 | public func loadDataWithPoint() { |
| 74 | 77 | CNLiveMineViewModel.requestWithCheckIn { [weak self] result, respStatue in |
| ... | ... | @@ -90,8 +93,13 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, |
| 90 | 93 | return .lightContent |
| 91 | 94 | } |
| 92 | 95 | |
| 96 | + | |
| 97 | + @objc func StandAuthNotificationSuccessAction() { | |
| 98 | + tableView.reloadData() | |
| 99 | + } | |
| 100 | + | |
| 93 | 101 | deinit { |
| 94 | - | |
| 102 | + NotificationCenter.default.removeObserver(self, name: Notification.Name.StandAuth.StandAuthNotificationSuccess, object: nil) | |
| 95 | 103 | } |
| 96 | 104 | } |
| 97 | 105 | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineBodyListView.swift
| ... | ... | @@ -587,13 +587,15 @@ class MineBodyFourViewCell: UITableViewCell { |
| 587 | 587 | |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | + var _listModel: MineTaskCheckListModel! | |
| 590 | 591 | func setupWithData(listModel: MineTaskCheckListModel) { |
| 592 | + _listModel = listModel | |
| 591 | 593 | iconView.kf.indicatorType = .activity |
| 592 | 594 | iconView.kf.setImage(with: URL(string: listModel.icon ?? "") , placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSizeMake(50, 50))) |
| 593 | 595 | nameLabel.text = listModel.title ?? "" |
| 594 | 596 | descLabel.text = "积分值+\(listModel.score ?? "")" |
| 595 | - if listModel.taskId!.contains("check_in") { | |
| 596 | - if listModel.status!.contains("false") { | |
| 597 | + if _listModel.taskId!.contains("check_in") { | |
| 598 | + if _listModel.status!.contains("true") { | |
| 597 | 599 | shareBtn.setTitle("去签到", for: .normal) |
| 598 | 600 | }else{ |
| 599 | 601 | shareBtn.titleEdgeInsets = UIEdgeInsets.zero |
| ... | ... | @@ -617,6 +619,7 @@ class MineBodyFourViewCell: UITableViewCell { |
| 617 | 619 | CNLiveMineViewModel.requestWithCheckInAction { [self] result, respStatue in |
| 618 | 620 | sender.stopAnimating() |
| 619 | 621 | showMessage(message: "签到成功") |
| 622 | + _listModel.status = "false" | |
| 620 | 623 | shareBtn.titleEdgeInsets = UIEdgeInsets.zero |
| 621 | 624 | shareBtn.imageEdgeInsets = UIEdgeInsets.zero |
| 622 | 625 | shareBtn.setTitleColor(HexColor("#999999"), for: .normal) | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| ... | ... | @@ -557,7 +557,6 @@ class CNLiveMineViewModel: NSObject { |
| 557 | 557 | timeCount = timeCount - 1 |
| 558 | 558 | // 时间到了取消时间源 |
| 559 | 559 | if timeCount <= 0 { |
| 560 | - | |
| 561 | 560 | codeTimer.cancel() |
| 562 | 561 | // 返回主线程处理一些事件,更新UI等等 |
| 563 | 562 | DispatchQueue.main.async { |
| ... | ... | @@ -673,8 +672,10 @@ class CNLiveMineViewModel: NSObject { |
| 673 | 672 | let param = NSMutableDictionary() |
| 674 | 673 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "targetId") |
| 675 | 674 | param.setValue("0", forKey: "type")//0全部(默认) 1收入 2支出 |
| 676 | - param.setValue("\((timeStamp * 1000) - 30*24*60*60)", forKey: "startTime")//"1600569015000" | |
| 677 | - param.setValue("\((timeStamp * 1000))", forKey: "endTime")//"1603074615000" | |
| 675 | +// param.setValue("\((timeStamp * 1000) - 30*24*60*60)", forKey: "startTime")//"1600569015000" | |
| 676 | +// param.setValue("\((timeStamp * 1000))", forKey: "endTime")//"1603074615000" | |
| 677 | + param.setValue("1600569015000", forKey: "startTime") | |
| 678 | + param.setValue("1603074615000", forKey: "endTime") | |
| 678 | 679 | param.setValue("10", forKey: "pageSize") |
| 679 | 680 | param.setValue("\(page)", forKey: "pageNo") |
| 680 | 681 | let custom_param = NSMutableDictionary() | ... | ... |
metaCode/Info.plist
| ... | ... | @@ -2,11 +2,13 @@ |
| 2 | 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 3 | 3 | <plist version="1.0"> |
| 4 | 4 | <dict> |
| 5 | + <key>CFBundleDevelopmentRegion</key> | |
| 6 | + <string>zh_CN</string> | |
| 5 | 7 | <key>CFBundleAllowMixedLocalizations</key> |
| 6 | 8 | <true/> |
| 7 | 9 | <key>CFBundleLocalizations</key> |
| 8 | 10 | <array> |
| 9 | - <string>zh</string> | |
| 11 | + <string>zh_CN</string> | |
| 10 | 12 | </array> |
| 11 | 13 | <key>NSAppTransportSecurity</key> |
| 12 | 14 | <dict> | ... | ... |