|
@@ -0,0 +1,110 @@
|
|
|
+//
|
|
|
+// 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: UIButton = {
|
|
|
+ let closeBtn = UIButton.createButton(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.6)
|
|
|
+ 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)
|
|
|
+ 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 infoLab = UILabel.createLabel(text: "🎨 Fresh styles, more vibrant than ever\n✨ Trendy effects for more magic\n⚡ Even faster speed".localized,font: .font(size: 14),textColor: .white)
|
|
|
+ alertContent.addSubview(infoLab)
|
|
|
+ infoLab.snp.makeConstraints { make in
|
|
|
+ make.top.equalTo(titleLab.snp.bottom).offset(40)
|
|
|
+ make.leading.equalTo(leading)
|
|
|
+ make.trailing.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){ [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)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|