|
@@ -0,0 +1,258 @@
|
|
|
+//
|
|
|
+// TSAIListHintBaseVC.swift
|
|
|
+// AIEmoji
|
|
|
+//
|
|
|
+// 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)
|
|
|
+// 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)
|
|
|
+// }
|
|
|
+//}
|