增加online检测

This commit is contained in:
bluesea 2024-04-12 20:49:39 +08:00
parent 051051b5d8
commit 832447d9cc
7 changed files with 35 additions and 16 deletions

View File

@ -675,10 +675,10 @@
filePath = "SwiftProject/Project/View/FeedbackView/FeedbackView.swift" filePath = "SwiftProject/Project/View/FeedbackView/FeedbackView.swift"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "154" startingLineNumber = "169"
endingLineNumber = "154" endingLineNumber = "169"
landmarkName = "show(praiseCallback:negativeCallback:)" landmarkName = "show(praiseCallback:negativeCallback:)"
landmarkType = "7"> landmarkType = "9">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy <BreakpointProxy

View File

@ -6,7 +6,7 @@
// //
import UIKit import UIKit
import SVProgressHUD
class FeedBackVC: BaseController, UITextViewDelegate, UITextFieldDelegate { class FeedBackVC: BaseController, UITextViewDelegate, UITextFieldDelegate {
//Label //Label
private lazy var problemTitleLabel:UILabel = setLabel(NSLocalizedString("v1.5_problem/suggestion title", comment: ""), color: .init(r: 255, g: 255, b: 255, a: 0.8), font: .systemFont(ofSize: 16, weight: .medium)) private lazy var problemTitleLabel:UILabel = setLabel(NSLocalizedString("v1.5_problem/suggestion title", comment: ""), color: .init(r: 255, g: 255, b: 255, a: 0.8), font: .systemFont(ofSize: 16, weight: .medium))
@ -39,7 +39,7 @@ class FeedBackVC: BaseController, UITextViewDelegate, UITextFieldDelegate {
return textField return textField
}() }()
//Label //Label
private lazy var twoNumbersLabel:UILabel = setLabel("0/30", color: .init(r: 255, g: 255, b: 255, a: 0.5), font: .systemFont(ofSize: 14, weight: .medium)) private lazy var twoNumbersLabel:UILabel = setLabel("0/50", color: .init(r: 255, g: 255, b: 255, a: 0.5), font: .systemFont(ofSize: 14, weight: .medium))
// //
private lazy var submitButton:UIButton = { private lazy var submitButton:UIButton = {
let btn = UIButton() let btn = UIButton()
@ -53,7 +53,7 @@ class FeedBackVC: BaseController, UITextViewDelegate, UITextFieldDelegate {
btn.backgroundColor = .init(r: 42, g: 42, b: 42, a: 1) btn.backgroundColor = .init(r: 42, g: 42, b: 42, a: 1)
btn.layer.masksToBounds = true btn.layer.masksToBounds = true
btn.layer.cornerRadius = 12 btn.layer.cornerRadius = 12
btn.isEnabled = false
return btn return btn
}() }()
override func viewDidLoad() { override func viewDidLoad() {
@ -171,11 +171,11 @@ class FeedBackVC: BaseController, UITextViewDelegate, UITextFieldDelegate {
//MARK: - textField And textView //MARK: - textField And textView
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let text = (textField.text! as NSString).replacingCharacters(in: range, with: string) let text = (textField.text! as NSString).replacingCharacters(in: range, with: string)
guard text.count <= 30 else { guard text.count <= 50 else {
twoNumbersLabel.text = "30/30" twoNumbersLabel.text = "50/50"
return false return false
} }
twoNumbersLabel.text = "\(text.count)/30" twoNumbersLabel.text = "\(text.count)/50"
return true return true
} }
func textViewShouldBeginEditing(_ textView: UITextView) -> Bool { func textViewShouldBeginEditing(_ textView: UITextView) -> Bool {
@ -208,7 +208,7 @@ class FeedBackVC: BaseController, UITextViewDelegate, UITextFieldDelegate {
submitButton.backgroundColor = .init(r: 83, g: 38, b: 214, a: 1) submitButton.backgroundColor = .init(r: 83, g: 38, b: 214, a: 1)
return false return false
} }
if str.count >= 5 { if str.count >= 1 {
submitButton.isEnabled = true submitButton.isEnabled = true
submitButton.backgroundColor = .init(r: 83, g: 38, b: 214, a: 1) submitButton.backgroundColor = .init(r: 83, g: 38, b: 214, a: 1)
}else { }else {
@ -224,13 +224,15 @@ class FeedBackVC: BaseController, UITextViewDelegate, UITextFieldDelegate {
} }
// //
@objc private func submitClick(_ sender:UIButton) { @objc private func submitClick(_ sender:UIButton) {
SVProgressHUD.show(withStatus: NSLocalizedString("v1.5_提交中...", comment: ""))
// //
let probleText = problemTextView.text ?? "" let probleText = problemTextView.text ?? ""
let contact = contactTextField.text ?? "" let contact = contactTextField.text ?? ""
// //
ZNetUtil.postUrl(urlStr: ZNetUtil.kUserFeedbackUrl, params: ["catalog":"feedback","remark":probleText,"contact":contact]) { [weak self] result, error in ZNetUtil.postUrl(urlStr: ZNetUtil.kUserFeedbackUrl, params: ["catalog":"feedback","remark":probleText,"contact":contact]) { [weak self] result, error in
SVProgressHUD.dismiss()
self?.navigationController?.popViewController(animated: true) self?.navigationController?.popViewController(animated: true)
} }
} }

View File

@ -23,8 +23,8 @@ class MenuVC: BaseController,UITableViewDelegate,UITableViewDataSource {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.configureUI() self.configureUI()
let remoteConfig = FirebaseRemoteConfig.RemoteConfig.remoteConfig() // let remoteConfig = FirebaseRemoteConfig.RemoteConfig.remoteConfig()
print("..\(remoteConfig).") // print("..\(remoteConfig).")
// self.configureData() // self.configureData()
// { // {
// "default":[{"icon":"xxxxxx","title":"wecht","url":""}, // "default":[{"icon":"xxxxxx","title":"wecht","url":""},
@ -158,7 +158,7 @@ class MenuVC: BaseController,UITableViewDelegate,UITableViewDataSource {
} }
var localConfig = contactConfig[NSLocalizedString("menu_lang", comment: "")] as? [[String:Any]] var localConfig = contactConfig[NSLocalizedString("v1.5_menu_lang", comment: "")] as? [[String:Any]]
if localConfig == nil { if localConfig == nil {
localConfig = contactConfig["default"] as? [[String:Any]] localConfig = contactConfig["default"] as? [[String:Any]]
} }

View File

@ -8,6 +8,8 @@
import Foundation import Foundation
import UIKit import UIKit
import StoreKit import StoreKit
import Firebase
import FirebaseRemoteConfig
class FeedbackView: UIView { class FeedbackView: UIView {
var scenterBgView:UIView? var scenterBgView:UIView?
var alphaBgView:UIView? var alphaBgView:UIView?
@ -119,6 +121,19 @@ class FeedbackView: UIView {
@objc func praiseAction(sender:UIButton) { @objc func praiseAction(sender:UIButton) {
hiddenSelf() hiddenSelf()
let config = FirebaseRemoteConfig.RemoteConfig.remoteConfig()
let menuParams = config.configValue(forKey: "menuParams")
guard let dicInfo = menuParams.jsonValue as? [String:Any] else {
return
}
guard let isOnline = dicInfo["isOnline"] as? Bool else {
return
}
if isOnline == false {
return
}
guard let praiseCallback else { guard let praiseCallback else {
return return
} }

View File

@ -132,4 +132,5 @@
"v1.5_contact information placeholder" = "Please @xxxx.com"; "v1.5_contact information placeholder" = "Please @xxxx.com";
"v1.5_contact information title" = "Contact information"; "v1.5_contact information title" = "Contact information";
"v1.5_submit" = "Submit"; "v1.5_submit" = "Submit";
"menu_lang" = "en"; "v1.5_menu_lang" = "en";
"v1.5_提交中..." = "submiting...";

View File

@ -128,4 +128,5 @@
"v1.5_contact information title" = "联系信息"; "v1.5_contact information title" = "联系信息";
"v1.5_contact information placeholder" = "请输入 @xxxx.com"; "v1.5_contact information placeholder" = "请输入 @xxxx.com";
"v1.5_submit" = "提交"; "v1.5_submit" = "提交";
"menu_lang" = "zh"; "v1.5_menu_lang" = "en";
"v1.5_提交中..." = "提交中...";