|
@@ -5,254 +5,263 @@
|
|
|
// Created by 100Years on 2025/4/9.
|
|
|
//
|
|
|
|
|
|
-//import PhotosUI
|
|
|
-//class TSAIListHintBaseVC: TSBaseVC {
|
|
|
-// static var userDefaultsKey:String = "isFirstAIListAge"
|
|
|
-//
|
|
|
-// struct Config {
|
|
|
-// var imageMaxBitSize:Int
|
|
|
-// var goodImageNamed:String
|
|
|
-// var badImageNamed:String
|
|
|
-//
|
|
|
-// var titleText:String
|
|
|
-// var titleSubText:String
|
|
|
-//
|
|
|
-// var goodText:String
|
|
|
-// var goodInfoText:String
|
|
|
-//
|
|
|
-// var badText:String
|
|
|
-// var badInfoText:String
|
|
|
-//
|
|
|
-//
|
|
|
-// init(imageMaxBitSize: Int, goodImageNamed: String, badImageNamed: String, titleText: String, titleSubText: String, goodText: String, goodInfoText: String, badText: String, badInfoText: String) {
|
|
|
-// self.imageMaxBitSize = imageMaxBitSize
|
|
|
-// self.goodImageNamed = goodImageNamed
|
|
|
-// self.badImageNamed = badImageNamed
|
|
|
-// self.titleText = titleText
|
|
|
-// self.titleSubText = titleSubText
|
|
|
-// self.goodText = goodText
|
|
|
-// self.goodInfoText = goodInfoText
|
|
|
-// self.badText = badText
|
|
|
-// self.badInfoText = badInfoText
|
|
|
-// }
|
|
|
-//
|
|
|
-// static func getDefaultConfig(imageMaxBitSize:Int) -> Config {
|
|
|
-// var config = defaultConfig
|
|
|
-// config.imageMaxBitSize = imageMaxBitSize
|
|
|
-// return config
|
|
|
-// }
|
|
|
-//
|
|
|
-// static var defaultConfig:Config {
|
|
|
-// return Config(imageMaxBitSize: kUploadImageMaxBit10Size,
|
|
|
-// goodImageNamed: "ptp_goodImage",
|
|
|
-// badImageNamed: "ptp_badImage",
|
|
|
-// titleText: "Upload your photos".localized,
|
|
|
-// titleSubText: "",
|
|
|
-// goodText: "Good photo examples".localized,
|
|
|
-// goodInfoText: "Fully clear and visible face, in good lighting".localized,
|
|
|
-// badText: "Bad photo examples".localized,
|
|
|
-// badInfoText: "Group photos, covered faces, nudes".localized)
|
|
|
-// }
|
|
|
-//
|
|
|
-// static var changeHairConfig:Config {
|
|
|
-// return Config(imageMaxBitSize: kUploadImageMaxBit5Size,
|
|
|
-// goodImageNamed: "ptp_hair_goodImage",
|
|
|
-// badImageNamed: "ptp_hair_badImage",
|
|
|
-// titleText: "Upload your photos".localized,
|
|
|
-// titleSubText: "",
|
|
|
-// goodText: "Good photo examples".localized,
|
|
|
-// goodInfoText: "Obvious hairstyle, Fully clear and visible face".localized,
|
|
|
-// badText: "Bad photo examples".localized,
|
|
|
-// badInfoText: "Group photos, covered faces, skinhead".localized)
|
|
|
-// }
|
|
|
-//
|
|
|
-// static var catTohumanConfig:Config {
|
|
|
-// return Config(imageMaxBitSize: kUploadImageMaxBit10Size,
|
|
|
-// goodImageNamed: "ptp_catTohuman_goodImage",
|
|
|
-// badImageNamed: "ptp_catTohuman_badImage",
|
|
|
-// titleText: "Upload your photos".localized,
|
|
|
-// titleSubText: "",
|
|
|
-// goodText: "Good photo examples".localized,
|
|
|
-// goodInfoText: "Select pet photos with clear faces".localized,
|
|
|
-// badText: "Bad photo examples".localized,
|
|
|
-// badInfoText: "No clear faces or group shots".localized)
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// static var futureBabyConfig:Config {
|
|
|
-// return Config(imageMaxBitSize: kUploadImageMaxBit10Size,
|
|
|
-// goodImageNamed: "ptp_futureBaby_goodImage",
|
|
|
-// badImageNamed: "ptp_badImage",
|
|
|
-// titleText: "Upload your photos".localized,
|
|
|
-// titleSubText: "",
|
|
|
-// goodText: "Good photo examples".localized,
|
|
|
-// goodInfoText: "Fully clear and visible face, in good lighting".localized,
|
|
|
-// badText: "Bad photo examples".localized,
|
|
|
-// badInfoText: "Group photos, covered faces, nudes".localized)
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// var config:Config = Config.defaultConfig
|
|
|
-// init(config: Config, clickUpImageHandle: ((UIImage?) -> Void)? = nil) {
|
|
|
-// self.config = config
|
|
|
-// self.clickUpImageHandle = clickUpImageHandle
|
|
|
-// super.init()
|
|
|
-// }
|
|
|
-//
|
|
|
-// @MainActor required init?(coder: NSCoder) {
|
|
|
-// fatalError("init(coder:) has not been implemented")
|
|
|
-// }
|
|
|
-//
|
|
|
-// var clickUpImageHandle:((UIImage?)->Void)?
|
|
|
-// lazy var popupContentView: UIView = {
|
|
|
-// let popupContentView = UIView()
|
|
|
-// popupContentView.backgroundColor = "#222222".uiColor
|
|
|
-// popupContentView.cornerRadius = 20.0
|
|
|
-// return popupContentView
|
|
|
-// }()
|
|
|
-//
|
|
|
-// lazy var photoPickerManager: TSPhotoPickerManager = {
|
|
|
-// let photoPickerManager = TSPhotoPickerManager(viewController: self)
|
|
|
-// return photoPickerManager
|
|
|
-// }()
|
|
|
-//
|
|
|
-// lazy var submitBtn: UIButton = {
|
|
|
-// let submitBtn = kCreateNormalSubmitBtn(title: "Upload Photo".localized) { [weak self] in
|
|
|
-// guard let self = self else { return }
|
|
|
-// pickSinglePhoto()
|
|
|
-// }
|
|
|
-// submitBtn.cornerRadius = 24.0
|
|
|
-// return submitBtn
|
|
|
-// }()
|
|
|
-//
|
|
|
-// override func createView() {
|
|
|
-// setNavBarViewHidden(true)
|
|
|
-// view.backgroundColor = .black.withAlphaComponent(0.7)
|
|
|
-//
|
|
|
-// view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(clickView)))
|
|
|
-//
|
|
|
-// contentView.addSubview(popupContentView)
|
|
|
-// popupContentView.center = view.center
|
|
|
-//
|
|
|
-// popupContentView.snp.makeConstraints { make in
|
|
|
-// make.leading.equalTo(20)
|
|
|
-// make.trailing.equalTo(-20)
|
|
|
-// make.center.equalToSuperview()
|
|
|
-// }
|
|
|
-//
|
|
|
-// setUpUI()
|
|
|
-// }
|
|
|
-//
|
|
|
-// @objc func clickView() {
|
|
|
-// dismiss(animated: true)
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// func setUpUI(){
|
|
|
-//
|
|
|
-// let fullText = config.titleText+config.titleSubText
|
|
|
-// let attString = NSMutableAttributedString(string: fullText)
|
|
|
+import PhotosUI
|
|
|
+class TSAIListHintBaseVC: TSBaseVC {
|
|
|
+ static var userDefaultsKey:String = "isFirstAIListAge"
|
|
|
+
|
|
|
+ struct Config {
|
|
|
+ var imageMaxBitSize:Int
|
|
|
+ var goodImageNamed:String
|
|
|
+ var badImageNamed:String
|
|
|
+
|
|
|
+ var titleText:String
|
|
|
+ var titleSubText:String
|
|
|
+
|
|
|
+ var goodText:String
|
|
|
+ var goodInfoText:String
|
|
|
+
|
|
|
+ var badText:String
|
|
|
+ var badInfoText:String
|
|
|
+
|
|
|
+
|
|
|
+ init(imageMaxBitSize: Int, goodImageNamed: String, badImageNamed: String, titleText: String, titleSubText: String, goodText: String, goodInfoText: String, badText: String, badInfoText: String) {
|
|
|
+ self.imageMaxBitSize = imageMaxBitSize
|
|
|
+ self.goodImageNamed = goodImageNamed
|
|
|
+ self.badImageNamed = badImageNamed
|
|
|
+ self.titleText = titleText
|
|
|
+ self.titleSubText = titleSubText
|
|
|
+ self.goodText = goodText
|
|
|
+ self.goodInfoText = goodInfoText
|
|
|
+ self.badText = badText
|
|
|
+ self.badInfoText = badInfoText
|
|
|
+ }
|
|
|
+
|
|
|
+ static func getDefaultConfig(imageMaxBitSize:Int) -> Config {
|
|
|
+ var config = defaultConfig
|
|
|
+ config.imageMaxBitSize = imageMaxBitSize
|
|
|
+ return config
|
|
|
+ }
|
|
|
+
|
|
|
+ static var defaultConfig:Config {
|
|
|
+ return Config(imageMaxBitSize: kUploadImageMaxBit10Size,
|
|
|
+ goodImageNamed: "ptp_goodImage",
|
|
|
+ badImageNamed: "ptp_badImage",
|
|
|
+ titleText: "Upload your photos".localized,
|
|
|
+ titleSubText: "",
|
|
|
+ goodText: "Good photo examples".localized,
|
|
|
+ goodInfoText: "Fully clear and visible face, in good lighting".localized,
|
|
|
+ badText: "Bad photo examples".localized,
|
|
|
+ badInfoText: "Group photos, covered faces, nudes".localized)
|
|
|
+ }
|
|
|
+
|
|
|
+ static var changeHairConfig:Config {
|
|
|
+ return Config(imageMaxBitSize: kUploadImageMaxBit5Size,
|
|
|
+ goodImageNamed: "ptp_hair_goodImage",
|
|
|
+ badImageNamed: "ptp_hair_badImage",
|
|
|
+ titleText: "Upload your photos".localized,
|
|
|
+ titleSubText: "",
|
|
|
+ goodText: "Good photo examples".localized,
|
|
|
+ goodInfoText: "Obvious hairstyle, Fully clear and visible face".localized,
|
|
|
+ badText: "Bad photo examples".localized,
|
|
|
+ badInfoText: "Group photos, covered faces, skinhead".localized)
|
|
|
+ }
|
|
|
+
|
|
|
+ static var catTohumanConfig:Config {
|
|
|
+ return Config(imageMaxBitSize: kUploadImageMaxBit10Size,
|
|
|
+ goodImageNamed: "ptp_catTohuman_goodImage",
|
|
|
+ badImageNamed: "ptp_catTohuman_badImage",
|
|
|
+ titleText: "Upload your photos".localized,
|
|
|
+ titleSubText: "",
|
|
|
+ goodText: "Good photo examples".localized,
|
|
|
+ goodInfoText: "Select pet photos with clear faces".localized,
|
|
|
+ badText: "Bad photo examples".localized,
|
|
|
+ badInfoText: "No clear faces or group shots".localized)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ static var futureBabyConfig:Config {
|
|
|
+ return Config(imageMaxBitSize: kUploadImageMaxBit10Size,
|
|
|
+ goodImageNamed: "ptp_futureBaby_goodImage",
|
|
|
+ badImageNamed: "ptp_badImage",
|
|
|
+ titleText: "Upload your photos".localized,
|
|
|
+ titleSubText: "",
|
|
|
+ goodText: "Good photo examples".localized,
|
|
|
+ goodInfoText: "Fully clear and visible face, in good lighting".localized,
|
|
|
+ badText: "Bad photo examples".localized,
|
|
|
+ badInfoText: "Group photos, covered faces, nudes".localized)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var config:Config = Config.defaultConfig
|
|
|
+ init(config: Config, clickUpImageHandle: ((UIImage?) -> Void)? = nil) {
|
|
|
+ self.config = config
|
|
|
+ self.clickUpImageHandle = clickUpImageHandle
|
|
|
+ super.init()
|
|
|
+ }
|
|
|
+
|
|
|
+ @MainActor required init?(coder: NSCoder) {
|
|
|
+ fatalError("init(coder:) has not been implemented")
|
|
|
+ }
|
|
|
+
|
|
|
+ var clickUpImageHandle:((UIImage?)->Void)?
|
|
|
+ lazy var popupContentView: UIView = {
|
|
|
+ let popupContentView = UIView()
|
|
|
+ popupContentView.backgroundColor = .clear
|
|
|
+ return popupContentView
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var photoPickerManager: TSPhotoPickerManager = {
|
|
|
+ let photoPickerManager = TSPhotoPickerManager(viewController: self)
|
|
|
+ return photoPickerManager
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var submitBtn: UIButton = {
|
|
|
+ let submitBtn = kCreateNormalSubmitBtn(title: "Upload Photo".localized) { [weak self] in
|
|
|
+ guard let self = self else { return }
|
|
|
+ pickSinglePhoto()
|
|
|
+ }
|
|
|
+ submitBtn.cornerRadius = 24.0
|
|
|
+ return submitBtn
|
|
|
+ }()
|
|
|
+
|
|
|
+ override func createView() {
|
|
|
+ addNormalNavBarView()
|
|
|
+ _ = setNavigationItem("", imageName: "ic-close", direction: .right, action: #selector(clickView))
|
|
|
+ view.backgroundColor = .black.withAlphaComponent(0.7)
|
|
|
+
|
|
|
+ contentView.addSubview(popupContentView)
|
|
|
+ popupContentView.center = view.center
|
|
|
+
|
|
|
+ popupContentView.snp.makeConstraints { make in
|
|
|
+ make.top.equalTo(0)
|
|
|
+ make.bottom.equalTo(0)
|
|
|
+ make.leading.equalTo(28)
|
|
|
+ make.trailing.equalTo(-28)
|
|
|
+ }
|
|
|
+
|
|
|
+ setUpUI()
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func clickView() {
|
|
|
+ dismiss(animated: true)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ func setUpUI(){
|
|
|
+
|
|
|
+ let iconImageView:UIImageView = UIImageView.createImageView(image: .hint)
|
|
|
+ iconImageView.addSubview(iconImageView)
|
|
|
+ iconImageView.snp.makeConstraints { make in
|
|
|
+ make.top.equalTo(16)
|
|
|
+ make.leading.equalTo(32)
|
|
|
+ make.trailing.equalTo(-32)
|
|
|
+ }
|
|
|
+
|
|
|
+ let fullText = config.titleText+config.titleSubText
|
|
|
+ let attString = NSMutableAttributedString(string: fullText)
|
|
|
// let mainRange = NSRange(location: 0, length: config.titleText.count)
|
|
|
-// attString.addAttributes([.font:UIFont.font(size: 18,weight: .semibold),.foregroundColor:UIColor.white], range: NSRange(location: 0, length: config.titleText.count))
|
|
|
-// attString.addAttributes([.font:UIFont.font(size: 12),.foregroundColor:UIColor.white.withAlphaComponent(0.6)], range: NSRange(location: config.titleText.count, length: config.titleSubText.count))
|
|
|
-//
|
|
|
-// let titleLabel = UILabel.createLabel(numberOfLines: 0)
|
|
|
-// titleLabel.attributedText = attString
|
|
|
-// popupContentView.addSubview(titleLabel)
|
|
|
-// titleLabel.snp.makeConstraints { make in
|
|
|
-// make.leading.top.equalTo(32)
|
|
|
-// make.trailing.equalTo(-32)
|
|
|
-// }
|
|
|
-//
|
|
|
-// let goodLabel = UILabel.createLabel(text: config.goodText,font: .font(size: 16,weight: .medium),textColor: .white,numberOfLines: 0)
|
|
|
-// popupContentView.addSubview(goodLabel)
|
|
|
-// goodLabel.snp.makeConstraints { make in
|
|
|
-// make.top.equalTo(titleLabel.snp.bottom).offset(28)
|
|
|
-// make.leading.equalTo(32)
|
|
|
-// make.trailing.equalTo(-32)
|
|
|
-// }
|
|
|
-//
|
|
|
-// let goodInfoLabel = UILabel.createLabel(text: config.goodInfoText,font: .font(size: 14),textColor: .white.withAlphaComponent(0.6),numberOfLines: 0)
|
|
|
-// popupContentView.addSubview(goodInfoLabel)
|
|
|
-// goodInfoLabel.snp.makeConstraints { make in
|
|
|
-// make.top.equalTo(goodLabel.snp.bottom).offset(8)
|
|
|
-// make.leading.equalTo(32)
|
|
|
-// make.trailing.equalTo(-32)
|
|
|
-// }
|
|
|
-//
|
|
|
-// let goodImageView = UIImageView.createImageView(imageName: config.goodImageNamed)
|
|
|
-// popupContentView.addSubview(goodImageView)
|
|
|
-// goodImageView.snp.makeConstraints { make in
|
|
|
-// make.top.equalTo(goodInfoLabel.snp.bottom).offset(12)
|
|
|
-// make.leading.equalTo(32)
|
|
|
-// make.trailing.equalTo(-32)
|
|
|
-// make.height.equalTo(108*kDesignScale)
|
|
|
-// }
|
|
|
-//
|
|
|
-// let badLabel = UILabel.createLabel(text: config.badText,font: .font(size: 16,weight: .medium),textColor: .white,numberOfLines: 0)
|
|
|
-// popupContentView.addSubview(badLabel)
|
|
|
-// badLabel.snp.makeConstraints { make in
|
|
|
-// make.top.equalTo(goodImageView.snp.bottom).offset(28)
|
|
|
-// make.leading.equalTo(32)
|
|
|
-// make.trailing.equalTo(-32)
|
|
|
-// }
|
|
|
-//
|
|
|
-// let badInfoLabel = UILabel.createLabel(text: config.badInfoText,font: .font(size: 14),textColor: .white.withAlphaComponent(0.6),numberOfLines: 0)
|
|
|
-// popupContentView.addSubview(badInfoLabel)
|
|
|
-// badInfoLabel.snp.makeConstraints { make in
|
|
|
-// make.top.equalTo(badLabel.snp.bottom).offset(8)
|
|
|
-// make.leading.equalTo(32)
|
|
|
-// make.trailing.equalTo(-32)
|
|
|
-// }
|
|
|
-//
|
|
|
-// let badImageView = UIImageView.createImageView(imageName: config.badImageNamed)
|
|
|
-// popupContentView.addSubview(badImageView)
|
|
|
-// badImageView.snp.makeConstraints { make in
|
|
|
-// make.top.equalTo(badInfoLabel.snp.bottom).offset(12)
|
|
|
-// make.leading.equalTo(32)
|
|
|
-// make.trailing.equalTo(-32)
|
|
|
-// make.height.equalTo(108*kDesignScale)
|
|
|
-// }
|
|
|
-//
|
|
|
-// popupContentView.addSubview(submitBtn)
|
|
|
-// submitBtn.snp.makeConstraints { make in
|
|
|
-// make.top.equalTo(badImageView.snp.bottom).offset(35)
|
|
|
-// make.centerX.equalToSuperview()
|
|
|
-// make.width.equalTo(250*kDesignScale)
|
|
|
-// make.height.equalTo(48)
|
|
|
-// make.bottom.equalTo(-24)
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// static var isShowUploadImageHint:Bool{
|
|
|
-// get {
|
|
|
-// return UserDefaults.standard.string(forKey: userDefaultsKey) == nil
|
|
|
-// }
|
|
|
-//
|
|
|
-// set {
|
|
|
-// UserDefaults.standard.set(newValue ? nil : "1", forKey: userDefaultsKey)
|
|
|
-// UserDefaults.standard.synchronize()
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// func pickSinglePhoto() {
|
|
|
-// self.submitBtn.isUserInteractionEnabled = false
|
|
|
-// photoPickerManager.pickCustomSinglePhoto() { [weak self] image, errorString in
|
|
|
-// guard let self = self else { return }
|
|
|
-// self.submitBtn.isUserInteractionEnabled = true
|
|
|
-// if let errorString = errorString {
|
|
|
-// TSToastShared.showToast(text: errorString)
|
|
|
-// }else{
|
|
|
-// self.clickUpImageHandle?(image)
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// func dismissPageVC(){
|
|
|
-// self.view.isHidden = true
|
|
|
-// self.photoPickerManager.dismissPageVC()
|
|
|
-// self.dismiss(animated: true)
|
|
|
-// }
|
|
|
-//}
|
|
|
+ attString.addAttributes([.font:UIFont.font(name:.ZillaSlabBold ,size: 26,weight: .bold),.foregroundColor:UIColor.white], range: NSRange(location: 0, length: config.titleText.count))
|
|
|
+ attString.addAttributes([.font:UIFont.font(size: 12),.foregroundColor:UIColor.white.withAlphaComponent(0.6)], range: NSRange(location: config.titleText.count, length: config.titleSubText.count))
|
|
|
+
|
|
|
+ let titleLabel = UILabel.createLabel(numberOfLines: 0)
|
|
|
+ titleLabel.attributedText = attString
|
|
|
+ popupContentView.addSubview(titleLabel)
|
|
|
+ titleLabel.snp.makeConstraints { make in
|
|
|
+ make.leading.equalTo(0)
|
|
|
+ make.top.equalTo(iconImageView.snp.bottom).offset(24)
|
|
|
+ make.width.height.equalTo(40)
|
|
|
+ }
|
|
|
+
|
|
|
+ let goodImageView = UIImageView.createImageView(imageName: config.goodImageNamed)
|
|
|
+ popupContentView.addSubview(goodImageView)
|
|
|
+ goodImageView.snp.makeConstraints { make in
|
|
|
+ make.top.equalTo(titleLabel.snp.bottom).offset(32)
|
|
|
+ make.leading.equalTo(0)
|
|
|
+ make.trailing.equalTo(0)
|
|
|
+ make.height.equalTo(112*kDesignScale)
|
|
|
+ }
|
|
|
+
|
|
|
+ let goodLabel = UILabel.createLabel(text: config.goodText,font: .font(size: 16,weight: .medium),textColor: .white,numberOfLines: 0)
|
|
|
+ popupContentView.addSubview(goodLabel)
|
|
|
+ goodLabel.snp.makeConstraints { make in
|
|
|
+ make.top.equalTo(goodImageView.snp.bottom).offset(12)
|
|
|
+ make.leading.equalTo(0)
|
|
|
+ make.trailing.equalTo(0)
|
|
|
+ }
|
|
|
+
|
|
|
+ let goodInfoLabel = UILabel.createLabel(text: config.goodInfoText,font: .font(size: 14),textColor: .white.withAlphaComponent(0.6),numberOfLines: 0)
|
|
|
+ popupContentView.addSubview(goodInfoLabel)
|
|
|
+ goodInfoLabel.snp.makeConstraints { make in
|
|
|
+ make.top.equalTo(goodLabel.snp.bottom).offset(8)
|
|
|
+ make.leading.equalTo(0)
|
|
|
+ make.trailing.equalTo(0)
|
|
|
+ }
|
|
|
+
|
|
|
+ let badImageView = UIImageView.createImageView(imageName: config.badImageNamed)
|
|
|
+ popupContentView.addSubview(badImageView)
|
|
|
+ badImageView.snp.makeConstraints { make in
|
|
|
+ make.top.equalTo(goodInfoLabel.snp.bottom).offset(20)
|
|
|
+ make.leading.equalTo(0)
|
|
|
+ make.trailing.equalTo(0)
|
|
|
+ make.height.equalTo(112*kDesignScale)
|
|
|
+ }
|
|
|
+
|
|
|
+ let badLabel = UILabel.createLabel(text: config.badText,font: .font(size: 16,weight: .medium),textColor: .white,numberOfLines: 0)
|
|
|
+ popupContentView.addSubview(badLabel)
|
|
|
+ badLabel.snp.makeConstraints { make in
|
|
|
+ make.top.equalTo(badImageView.snp.bottom).offset(12)
|
|
|
+ make.leading.equalTo(0)
|
|
|
+ make.trailing.equalTo(0)
|
|
|
+ }
|
|
|
+
|
|
|
+ let badInfoLabel = UILabel.createLabel(text: config.badInfoText,font: .font(size: 14),textColor: .white.withAlphaComponent(0.6),numberOfLines: 0)
|
|
|
+ popupContentView.addSubview(badInfoLabel)
|
|
|
+ badInfoLabel.snp.makeConstraints { make in
|
|
|
+ make.top.equalTo(badLabel.snp.bottom).offset(8)
|
|
|
+ make.leading.equalTo(0)
|
|
|
+ make.trailing.equalTo(0)
|
|
|
+ make.bottom.equalTo(0)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ popupContentView.addSubview(submitBtn)
|
|
|
+ submitBtn.snp.makeConstraints { make in
|
|
|
+ make.centerX.equalToSuperview()
|
|
|
+ make.width.equalTo(248*kDesignScale)
|
|
|
+ make.height.equalTo(48)
|
|
|
+ make.bottom.equalTo(-43-k_Height_safeAreaInsetsBottom())
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ static var isShowUploadImageHint:Bool{
|
|
|
+ get {
|
|
|
+ return UserDefaults.standard.string(forKey: userDefaultsKey) == nil
|
|
|
+ }
|
|
|
+
|
|
|
+ set {
|
|
|
+ UserDefaults.standard.set(newValue ? nil : "1", forKey: userDefaultsKey)
|
|
|
+ UserDefaults.standard.synchronize()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func pickSinglePhoto() {
|
|
|
+ self.submitBtn.isUserInteractionEnabled = false
|
|
|
+ photoPickerManager.pickCustomSinglePhoto() { [weak self] image, errorString in
|
|
|
+ guard let self = self else { return }
|
|
|
+ self.submitBtn.isUserInteractionEnabled = true
|
|
|
+ if let errorString = errorString {
|
|
|
+ TSToastShared.showToast(text: errorString)
|
|
|
+ }else{
|
|
|
+ self.clickUpImageHandle?(image)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ func dismissPageVC(){
|
|
|
+ self.view.isHidden = true
|
|
|
+ self.photoPickerManager.dismissPageVC()
|
|
|
+ self.dismiss(animated: true)
|
|
|
+ }
|
|
|
+}
|