123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- //
- // TSAppUpdateAlertVC.swift
- // TSLiveWallpaper
- //
- // Created by 100Years on 2025/6/19.
- //
- class TSAppUpdateAlertVC: TSBaseVC {
- lazy var alertContent: UIView = {
- let alertContent = UIView()
- return alertContent
- }()
-
- lazy var closeBtn: TSUIExpandedTouchButton = {
- let closeBtn = TSUIExpandedTouchButton()
- closeBtn.setUpButton(image:.appUpdateClose){ [weak self] in
- guard let self = self else { return }
- self.dismiss(animated: true)
- }
- return closeBtn
- }()
-
- override func createView() {
- setNavBarViewHidden(true)
-
- view.backgroundColor = .black.withAlphaComponent(0.8)
- contentView.addSubview(alertContent)
- alertContent.snp.makeConstraints { make in
- make.leading.equalTo(32)
- make.trailing.equalTo(-32)
- make.centerY.equalToSuperview()
- }
-
- let bgImageView = UIImageView.createImageView(image:.appUpdateBg,contentMode: .scaleToFill)
- bgImageView.cornerRadius = 20.0
- alertContent.addSubview(bgImageView)
- bgImageView.snp.makeConstraints { make in
- make.edges.equalToSuperview()
- }
-
- contentView.addSubview(closeBtn)
- closeBtn.snp.makeConstraints { make in
- make.centerX.equalToSuperview()
- make.top.equalTo(alertContent.snp.bottom).offset(20)
- make.width.height.equalTo(24)
- }
-
- setUpAlertContent()
- }
- }
- extension TSAppUpdateAlertVC {
-
- func setUpAlertContent(){
- let leading = 16.0
-
- let titleLab = UILabel.createLabel(text: "New Update Available!".localized,font: .font(size: 20,weight: .semibold),textColor: .white)
- alertContent.addSubview(titleLab)
- titleLab.snp.makeConstraints { make in
- make.leading.equalTo(leading)
- make.trailing.equalTo(-80)
- make.top.equalTo(24)
- }
-
-
- let iconImageView = UIImageView.createImageView(image:.appUpdateIcon)
- alertContent.addSubview(iconImageView)
- iconImageView.snp.makeConstraints { make in
- make.top.equalTo(-24)
- make.trailing.equalTo(-12)
- make.width.height.equalTo(96)
- }
- let text:String = "🎨 Fresh styles, more vibrant than ever".localized + "\n" + "✨ Trendy effects for more magic".localized + "\n" + "⚡ Even faster speed".localized
- let infoLab = UILabel.createLabel(text: text,font: .font(size: 14),textColor: .white)
- alertContent.addSubview(infoLab)
- infoLab.snp.makeConstraints { make in
- make.top.equalTo(titleLab.snp.bottom).offset(40)
- make.left.equalTo(leading)
- make.right.equalTo(-leading)
- }
-
- infoLab.setLineSpacing(10.0)
-
- let infoLab1 = UILabel.createLabel(text: "Update now to unlock the best experience".localized,font: .font(size: 14),textColor: .white)
- alertContent.addSubview(infoLab1)
- infoLab1.snp.makeConstraints { make in
- make.top.equalTo(infoLab.snp.bottom).offset(30)
- make.leading.equalTo(leading)
- make.trailing.equalTo(-leading)
- }
-
- let updateBtn = UIButton.createButton(title: "Update".localized,backgroundColor: .white,font: .font(size: 16,weight: .medium),titleColor: "#111111".uiColor,corner: 24.0){ [weak self] in
- guard let self = self else { return }
- if let url = URL(string: "https://apps.apple.com/app/id\(appid)"),
- UIApplication.shared.canOpenURL(url) {
- UIApplication.shared.open(url)
- self.dismiss(animated: true)
- }
- }
- alertContent.addSubview(updateBtn)
- updateBtn.snp.makeConstraints { make in
- make.top.equalTo(infoLab1.snp.bottom).offset(24)
- make.leading.equalTo(38)
- make.trailing.equalTo(-38)
- make.height.equalTo(48)
- make.bottom.equalTo(-20)
- }
- }
- }
|