Commit e2c6c7b8 authored by pete谢兆麟's avatar pete谢兆麟

弹窗逻辑

parent dbb85ff5
...@@ -1213,6 +1213,7 @@ ...@@ -1213,6 +1213,7 @@
04AFEF592D6C8CE00007A011 /* YHVipLevelRightHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AFEF582D6C8CDF0007A011 /* YHVipLevelRightHeaderView.swift */; }; 04AFEF592D6C8CE00007A011 /* YHVipLevelRightHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AFEF582D6C8CDF0007A011 /* YHVipLevelRightHeaderView.swift */; };
04E4CF3E2D5C6D32004D4013 /* YHCountryMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E4CF3D2D5C6D32004D4013 /* YHCountryMessageView.swift */; }; 04E4CF3E2D5C6D32004D4013 /* YHCountryMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E4CF3D2D5C6D32004D4013 /* YHCountryMessageView.swift */; };
04E4CF402D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E4CF3F2D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift */; }; 04E4CF402D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E4CF3F2D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift */; };
04E507D62D6EE856005F758B /* YHUserLevelAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E507D52D6EE856005F758B /* YHUserLevelAlertView.swift */; };
04EA376D2BEA06EF00DBAF64 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376C2BEA06EF00DBAF64 /* WebKit.framework */; }; 04EA376D2BEA06EF00DBAF64 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376C2BEA06EF00DBAF64 /* WebKit.framework */; };
04EA376F2BEA071600DBAF64 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376E2BEA070500DBAF64 /* libc++.tbd */; }; 04EA376F2BEA071600DBAF64 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376E2BEA070500DBAF64 /* libc++.tbd */; };
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; }; 6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; };
...@@ -2462,6 +2463,7 @@ ...@@ -2462,6 +2463,7 @@
04AFEF582D6C8CDF0007A011 /* YHVipLevelRightHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVipLevelRightHeaderView.swift; sourceTree = "<group>"; }; 04AFEF582D6C8CDF0007A011 /* YHVipLevelRightHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVipLevelRightHeaderView.swift; sourceTree = "<group>"; };
04E4CF3D2D5C6D32004D4013 /* YHCountryMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCountryMessageView.swift; sourceTree = "<group>"; }; 04E4CF3D2D5C6D32004D4013 /* YHCountryMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCountryMessageView.swift; sourceTree = "<group>"; };
04E4CF3F2D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSelectPhoneCountryViewController.swift; sourceTree = "<group>"; }; 04E4CF3F2D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSelectPhoneCountryViewController.swift; sourceTree = "<group>"; };
04E507D52D6EE856005F758B /* YHUserLevelAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHUserLevelAlertView.swift; sourceTree = "<group>"; };
04EA376C2BEA06EF00DBAF64 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 04EA376C2BEA06EF00DBAF64 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
04EA376E2BEA070500DBAF64 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; 04EA376E2BEA070500DBAF64 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
04FA8B2D2C084C7E00ABE43F /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = ATAuthSDK.bundle; path = "galaxy/Classes/Modules/AutoLogin(一键登录)/framework/ATAuthSDK_D.framework/ATAuthSDK.bundle"; sourceTree = "<group>"; }; 04FA8B2D2C084C7E00ABE43F /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = ATAuthSDK.bundle; path = "galaxy/Classes/Modules/AutoLogin(一键登录)/framework/ATAuthSDK_D.framework/ATAuthSDK.bundle"; sourceTree = "<group>"; };
...@@ -3224,6 +3226,7 @@ ...@@ -3224,6 +3226,7 @@
045C0AFF2D12CA5E00BD2DC0 /* YHServiceOrderAlertView.swift */, 045C0AFF2D12CA5E00BD2DC0 /* YHServiceOrderAlertView.swift */,
045C0B002D12CA5E00BD2DC0 /* YHStatusAdvantageBottomView.swift */, 045C0B002D12CA5E00BD2DC0 /* YHStatusAdvantageBottomView.swift */,
045C0B012D12CA5E00BD2DC0 /* YHTalentProgramEvaluationView.swift */, 045C0B012D12CA5E00BD2DC0 /* YHTalentProgramEvaluationView.swift */,
04E507D52D6EE856005F758B /* YHUserLevelAlertView.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -7145,6 +7148,7 @@ ...@@ -7145,6 +7148,7 @@
045C10972D12CA5F00BD2DC0 /* YHMaterialListCell.swift in Sources */, 045C10972D12CA5F00BD2DC0 /* YHMaterialListCell.swift in Sources */,
045C10982D12CA5F00BD2DC0 /* YHTravelDocsPreparationListModel.swift in Sources */, 045C10982D12CA5F00BD2DC0 /* YHTravelDocsPreparationListModel.swift in Sources */,
045C10992D12CA5F00BD2DC0 /* YHCertificateAppointOptionCell.swift in Sources */, 045C10992D12CA5F00BD2DC0 /* YHCertificateAppointOptionCell.swift in Sources */,
04E507D62D6EE856005F758B /* YHUserLevelAlertView.swift in Sources */,
045C109A2D12CA5F00BD2DC0 /* YhCacheTool.swift in Sources */, 045C109A2D12CA5F00BD2DC0 /* YhCacheTool.swift in Sources */,
045C109B2D12CA5F00BD2DC0 /* YHHomeInfoDetailViewController.swift in Sources */, 045C109B2D12CA5F00BD2DC0 /* YHHomeInfoDetailViewController.swift in Sources */,
045C109C2D12CA5F00BD2DC0 /* YHAdopterChinaViewController.swift in Sources */, 045C109C2D12CA5F00BD2DC0 /* YHAdopterChinaViewController.swift in Sources */,
......
...@@ -609,7 +609,7 @@ extension YHHomeHoldViewPageViewController : UITabBarControllerDelegate { ...@@ -609,7 +609,7 @@ extension YHHomeHoldViewPageViewController : UITabBarControllerDelegate {
//MARK: 弹窗相关的逻辑 //MARK: 弹窗相关的逻辑
private extension YHHomeHoldViewPageViewController { private extension YHHomeHoldViewPageViewController {
// 1、强升级 弹窗 > 2、签约用户新人指引 > 3、原则批/正式批 弹窗 > 4、建议更新 // 1、强升级 弹窗 > 2、签约用户新人指引 > 3、原则批/正式批 弹窗 > 4、建议更新 > 5 会员弹窗
func checkHomeAlertView() { func checkHomeAlertView() {
self.showFlowAlertView { showFlag in self.showFlowAlertView { showFlag in
if !showFlag { if !showFlag {
...@@ -639,11 +639,58 @@ private extension YHHomeHoldViewPageViewController { ...@@ -639,11 +639,58 @@ private extension YHHomeHoldViewPageViewController {
alertView.updateContentArray(arr) alertView.updateContentArray(arr)
alertView.show() alertView.show()
alertView.cancleBlock = { alertView.cancleBlock = {
self.showUserLevelAlertView()
}
}
} else {
showUserLevelAlertView()
}
}
func showUserLevelAlertView() {
if let configModel = YHConfigManager.shared.reqVM.configModel,configModel.is_integral_open {
if shouldShowPopup() {
if YHLoginManager.shared.isLogin() {
let view = YHUserLevelAlertView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.block = { [weak self] index in
guard let self = self else { return }
if index == 1 {
let vc = YHMemberCenterViewController()
self.navigationController?.pushViewController(vc)
}
}
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
// 更新 UserDefaults 中的版本号
updateAppVersion()
} }
} }
} }
} }
private func shouldShowPopup() -> Bool {
// 获取当前应用的版本号
guard let currentVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String else {
return false
}
// 获取 UserDefaults 中存储的最后一个显示弹出框的版本号
let lastShownVersion = UserDefaults.standard.string(forKey: "lastShownPopupVersion")
// 如果版本号不同,则显示弹出框
return lastShownVersion != currentVersion
}
private func updateAppVersion() {
// 获取当前应用的版本号
guard let currentVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String else {
return
}
// 将当前版本号保存到 UserDefaults
UserDefaults.standard.set(currentVersion, forKey: "lastShownPopupVersion")
}
//银河管家 引导弹窗 //银河管家 引导弹窗
func showYHManagerTipsView() { func showYHManagerTipsView() {
if YHUatHelper.shared.getUatModuleStatusBy(module: .QiYu_Service) != 1 { if YHUatHelper.shared.getUatModuleStatusBy(module: .QiYu_Service) != 1 {
......
//
// YHUserLevelAlertView.swift
// galaxy
//
// Created by EDY on 2025/2/26.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHUserLevelAlertView: UIView {
typealias Block = (Int) -> ()
var block: Block?
var centerView: UIView!
var topImageView: UIImageView!
var bgImageView: UIImageView!
var closeButton: UIButton!
var shareButton: UIButton!
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor(white: 0.5, alpha: 0.1)
// let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap))
// tap.delegate = self
// addGestureRecognizer(tap)
setView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setView() {
backgroundColor = UIColor(hex: 0x000000, alpha: 0.5)
centerView = {
let view = UIView()
view.backgroundColor = .clear
return view
}()
addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.right.top.bottom.equalToSuperview()
}
topImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "home_user_level_bg")
return imageView
}()
centerView.addSubview(topImageView)
topImageView.snp.makeConstraints { make in
make.center.equalToSuperview()
make.height.equalTo(421)
make.width.equalTo(299)
}
closeButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "home_user_level_close"), for: .normal)
button.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
return button
}()
centerView.addSubview(closeButton)
closeButton.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.height.equalTo(24)
make.width.equalTo(24)
make.top.equalTo(topImageView.snp.bottom).offset(18)
}
shareButton = {
let button = UIButton(type: .custom)
button.addTarget(self, action: #selector(share), for: .touchUpInside)
return button
}()
centerView.addSubview(shareButton)
shareButton.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.height.equalTo(48)
make.width.equalTo(247)
make.bottom.equalTo(topImageView.snp.bottom).offset(-28)
}
}
@objc private func handleTap(_ sender: AnyObject?) {
print("处理点击手势")
dismiss()
}
@objc func dismiss() {
removeFromSuperview()
block?(0)
}
@objc func share() {
removeFromSuperview()
block?(1)
}
}
extension YHUserLevelAlertView: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer:UIGestureRecognizer, shouldReceive touch:UITouch) -> Bool {
if touch.view == self {
return true
}
return false
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "home_user_level_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "home_user_level_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "home_user_level_close@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "home_user_level_close@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment