diff --git a/MoviaBox/AppDelegate/AppDelegate+OpenApp.swift b/MoviaBox/AppDelegate/AppDelegate+OpenApp.swift index ad7ca0c..882556c 100644 --- a/MoviaBox/AppDelegate/AppDelegate+OpenApp.swift +++ b/MoviaBox/AppDelegate/AppDelegate+OpenApp.swift @@ -8,6 +8,38 @@ import UIKit +extension AppDelegate { + + func registerAPNS() { + let center = UNUserNotificationCenter.current() + center.delegate = self + + center.requestAuthorization(options: [.badge, .sound, .alert]) { grant, error in + if grant { + SPRewardsAPI.requestUploadOpenNotify(completer: nil) + } + } + UIApplication.shared.registerForRemoteNotifications() + } +} + +extension AppDelegate: UNUserNotificationCenterDelegate { + + func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { +// NIMSDK.shared().updateApnsToken(deviceToken) + } + ///APP处于前台是接收通知消息 +// func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { +// completionHandler([.badge]) +// } + + ///点击通知消息进入app + func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { + completionHandler() + } + +} + extension SceneDelegate { diff --git a/MoviaBox/AppDelegate/AppDelegate.swift b/MoviaBox/AppDelegate/AppDelegate.swift index 16e300f..8f5edb2 100644 --- a/MoviaBox/AppDelegate/AppDelegate.swift +++ b/MoviaBox/AppDelegate/AppDelegate.swift @@ -15,6 +15,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { self.appConfig() + ///注册消息通知 + registerAPNS() SPLoginManager.manager.requestVisitorLogin(completer: nil) ///开启网络监控 diff --git a/MoviaBox/Base/View/SPTableView.swift b/MoviaBox/Base/View/SPTableView.swift index 1e1f4bd..4541a44 100644 --- a/MoviaBox/Base/View/SPTableView.swift +++ b/MoviaBox/Base/View/SPTableView.swift @@ -13,7 +13,8 @@ class SPTableView: UITableView { override init(frame: CGRect, style: UITableView.Style) { super.init(frame: frame, style: style) -// separatorColor = .lineColor() + separatorColor = .colorFFFFFF(alpha: 0.1) + separatorInset = .init(top: 0, left: 16, bottom: 0, right: 16) self.backgroundColor = .clear self.contentInsetAdjustmentBehavior = .never diff --git a/MoviaBox/Class/Mine/Controller/SPMineViewController.swift b/MoviaBox/Class/Mine/Controller/SPMineViewController.swift index b0f4f09..0aaf1cf 100644 --- a/MoviaBox/Class/Mine/Controller/SPMineViewController.swift +++ b/MoviaBox/Class/Mine/Controller/SPMineViewController.swift @@ -13,6 +13,7 @@ class SPMineViewController: SPViewController { let arr = [ // SPMineItem(type: .language, iconImage: UIImage(named: "language_icon_01"), title: "Language".localized), SPMineItem(type: .feedBack, iconImage: UIImage(named: "feed_back_icon_01"), title: "FeedBack".localized), + SPMineItem(type: .settings, iconImage: UIImage(named: "settings_icon_01"), title: "Settings".localized), SPMineItem(type: .privacyPolicy, iconImage: UIImage(named: "privacy_policy_icon_01"), title: "Privacy Policy".localized), SPMineItem(type: .userAgreement, iconImage: UIImage(named: "user_agreement_icon_01"), title: "User Agreement".localized), SPMineItem(type: .aboutUs, iconImage: UIImage(named: "about_us_icon_01"), title: "About Us".localized), @@ -121,6 +122,9 @@ extension SPMineViewController: UITableViewDelegate, UITableViewDataSource { let vc = SPFeedbackViewController() self.navigationController?.pushViewController(vc, animated: true) +// case .settings: + + default: break } diff --git a/MoviaBox/Class/Mine/Controller/SPWalletViewController.swift b/MoviaBox/Class/Mine/Controller/SPWalletViewController.swift new file mode 100644 index 0000000..c460c82 --- /dev/null +++ b/MoviaBox/Class/Mine/Controller/SPWalletViewController.swift @@ -0,0 +1,96 @@ +// +// SPWalletViewController.swift +// MoviaBox +// +// Created by 佳尔 on 2025/4/28. +// + +import UIKit + +class SPWalletViewController: SPViewController { + + private lazy var dataArr: [SPMineItem] = { + let arr = [ + SPMineItem(type: .consumptionRecords, iconImage: UIImage(named: "records_icon_01"), title: "Consumption records".localized), + SPMineItem(type: .purchaseRecords, iconImage: UIImage(named: "records_icon_02"), title: "Purchase records".localized), + SPMineItem(type: .rewardCoins, iconImage: UIImage(named: "coin_icon_03"), title: "Reward Coins".localized), + SPMineItem(type: .feedBack, iconImage: UIImage(named: "feed_back_icon_03"), title: "FeedBack".localized), + ] + return arr + }() + + //MARK: UI属性 + private lazy var tableView: SPTableView = { + let tableView = SPTableView(frame: .zero, style: .plain) + tableView.delegate = self + tableView.dataSource = self + tableView.rowHeight = 48 + + SPWalletCell.registerCell(tableView: tableView) + return tableView + }() + + private lazy var headerView: SPWalletHeaderView = { + let view = SPWalletHeaderView(frame: .init(x: 0, y: 0, width: kSPScreenWidth, height: 152)) + return view + }() + + override func viewDidLoad() { + super.viewDidLoad() + self.edgesForExtendedLayout = .top + self.title = "Details".localized + + _setupUI() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.navigationController?.setNavigationBarHidden(false, animated: true) + self.setNavigationNormalStyle(backgroundColor: .clear, isTranslucent: true) + } + + +} + +extension SPWalletViewController { + + private func _setupUI() { + self.tableView.tableHeaderView = self.headerView + view.addSubview(tableView) + + tableView.snp.makeConstraints { make in + make.top.equalToSuperview().offset(kSPNavBarHeight) + make.left.right.bottom.equalToSuperview() + } + } + +} + +//MARK: -------------- UITableViewDelegate & UITableViewDataSource -------------- +extension SPWalletViewController: UITableViewDelegate, UITableViewDataSource { + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = SPWalletCell.dequeueReusableCell(tableView: tableView, indexPath: indexPath) + cell.item = dataArr[indexPath.row] + return cell + } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return dataArr.count + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let item = dataArr[indexPath.row] + + switch item.type { + case .feedBack: + let vc = SPFeedbackViewController() + self.navigationController?.pushViewController(vc, animated: true) + + default: + break + } + + } + +} diff --git a/MoviaBox/Class/Mine/Model/SPMineItem.swift b/MoviaBox/Class/Mine/Model/SPMineItem.swift index aa7366b..b4c5029 100644 --- a/MoviaBox/Class/Mine/Model/SPMineItem.swift +++ b/MoviaBox/Class/Mine/Model/SPMineItem.swift @@ -31,6 +31,14 @@ struct SPMineItem { case persoInforDisclosure ///反馈 case feedBack + ///设置 + case settings + ///消费记录 + case consumptionRecords + ///订单记录 + case purchaseRecords + ///赠币记录 + case rewardCoins } diff --git a/MoviaBox/Class/Mine/View/SPMineWalletView.swift b/MoviaBox/Class/Mine/View/SPMineWalletView.swift index 1d35f07..19da11b 100644 --- a/MoviaBox/Class/Mine/View/SPMineWalletView.swift +++ b/MoviaBox/Class/Mine/View/SPMineWalletView.swift @@ -24,6 +24,7 @@ class SPMineWalletView: UIView { private lazy var moreButton: UIButton = { let button = UIButton(type: .custom) + button.addTarget(self, action: #selector(handleWalletButton), for: .touchUpInside) return button }() @@ -52,6 +53,7 @@ class SPMineWalletView: UIView { button.setTitle("Store".localized, for: .normal) button.setTitleColor(.colorFFFFFF(), for: .normal) button.titleLabel?.font = .fontMedium(ofSize: 18) + button.addTarget(self, action: #selector(handleStoreButton), for: .touchUpInside) return button }() @@ -90,6 +92,18 @@ class SPMineWalletView: UIView { } } +extension SPMineWalletView { + @objc private func handleStoreButton() { + let vc = SPWalletViewController() + self.viewController?.navigationController?.pushViewController(vc, animated: true) + } + + @objc private func handleWalletButton() { + let vc = SPWalletViewController() + self.viewController?.navigationController?.pushViewController(vc, animated: true) + } +} + extension SPMineWalletView { private func _setupUI() { diff --git a/MoviaBox/Class/Mine/View/SPWalletCell.swift b/MoviaBox/Class/Mine/View/SPWalletCell.swift new file mode 100644 index 0000000..a88efbb --- /dev/null +++ b/MoviaBox/Class/Mine/View/SPWalletCell.swift @@ -0,0 +1,61 @@ +// +// SPWalletCell.swift +// MoviaBox +// +// Created by 佳尔 on 2025/4/28. +// + +import UIKit + +class SPWalletCell: SPTableViewCell { + + var item: SPMineItem? { + didSet { + iconImageView.image = item?.iconImage + titleLabel.text = item?.title + } + } + + //MARK: UI属性 + private lazy var iconImageView: UIImageView = { + let imageView = UIImageView() + return imageView + }() + + private lazy var titleLabel: UILabel = { + let label = UILabel() + label.font = .fontMedium(ofSize: 16) + label.textColor = .colorFFFFFF() + return label + }() + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + self.showIndicator = true + _setupUI() + } + + @MainActor required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + +extension SPWalletCell { + + private func _setupUI() { + contentView.addSubview(iconImageView) + contentView.addSubview(titleLabel) + + iconImageView.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.left.equalToSuperview().offset(18) + } + + titleLabel.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.left.equalTo(iconImageView.snp.right).offset(8) + } + } + +} diff --git a/MoviaBox/Class/Mine/View/SPWalletHeaderView.swift b/MoviaBox/Class/Mine/View/SPWalletHeaderView.swift new file mode 100644 index 0000000..e38cd5d --- /dev/null +++ b/MoviaBox/Class/Mine/View/SPWalletHeaderView.swift @@ -0,0 +1,41 @@ +// +// SPWalletHeaderView.swift +// MoviaBox +// +// Created by 佳尔 on 2025/4/28. +// + +import UIKit + +class SPWalletHeaderView: UIView { + + //MARK: UI属性 + private lazy var contentView: SPMineWalletView = { + let view = SPMineWalletView() + return view + }() + + override init(frame: CGRect) { + super.init(frame: frame) + _setupUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + +extension SPWalletHeaderView { + + private func _setupUI() { + addSubview(contentView) + + contentView.snp.makeConstraints { make in + make.left.equalToSuperview() + make.centerX.equalToSuperview() + make.top.equalToSuperview().offset(10) + } + } + +} diff --git a/MoviaBox/Source/Assets.xcassets/icon/coin_icon_03.imageset/Contents.json b/MoviaBox/Source/Assets.xcassets/icon/coin_icon_03.imageset/Contents.json new file mode 100644 index 0000000..f07fde9 --- /dev/null +++ b/MoviaBox/Source/Assets.xcassets/icon/coin_icon_03.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Group 614@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Group 614@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MoviaBox/Source/Assets.xcassets/icon/coin_icon_03.imageset/Group 614@2x.png b/MoviaBox/Source/Assets.xcassets/icon/coin_icon_03.imageset/Group 614@2x.png new file mode 100644 index 0000000..e095f76 Binary files /dev/null and b/MoviaBox/Source/Assets.xcassets/icon/coin_icon_03.imageset/Group 614@2x.png differ diff --git a/MoviaBox/Source/Assets.xcassets/icon/coin_icon_03.imageset/Group 614@3x.png b/MoviaBox/Source/Assets.xcassets/icon/coin_icon_03.imageset/Group 614@3x.png new file mode 100644 index 0000000..696d04e Binary files /dev/null and b/MoviaBox/Source/Assets.xcassets/icon/coin_icon_03.imageset/Group 614@3x.png differ diff --git a/MoviaBox/Source/Assets.xcassets/icon/feed_back_icon_03.imageset/Contents.json b/MoviaBox/Source/Assets.xcassets/icon/feed_back_icon_03.imageset/Contents.json new file mode 100644 index 0000000..5c4d3b1 --- /dev/null +++ b/MoviaBox/Source/Assets.xcassets/icon/feed_back_icon_03.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Frame@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Frame@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MoviaBox/Source/Assets.xcassets/icon/feed_back_icon_03.imageset/Frame@2x.png b/MoviaBox/Source/Assets.xcassets/icon/feed_back_icon_03.imageset/Frame@2x.png new file mode 100644 index 0000000..d19f095 Binary files /dev/null and b/MoviaBox/Source/Assets.xcassets/icon/feed_back_icon_03.imageset/Frame@2x.png differ diff --git a/MoviaBox/Source/Assets.xcassets/icon/feed_back_icon_03.imageset/Frame@3x.png b/MoviaBox/Source/Assets.xcassets/icon/feed_back_icon_03.imageset/Frame@3x.png new file mode 100644 index 0000000..ffd8823 Binary files /dev/null and b/MoviaBox/Source/Assets.xcassets/icon/feed_back_icon_03.imageset/Frame@3x.png differ diff --git a/MoviaBox/Source/Assets.xcassets/icon/records_icon_01.imageset/Contents.json b/MoviaBox/Source/Assets.xcassets/icon/records_icon_01.imageset/Contents.json new file mode 100644 index 0000000..1ac8225 --- /dev/null +++ b/MoviaBox/Source/Assets.xcassets/icon/records_icon_01.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Group 315@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Group 315@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MoviaBox/Source/Assets.xcassets/icon/records_icon_01.imageset/Group 315@2x.png b/MoviaBox/Source/Assets.xcassets/icon/records_icon_01.imageset/Group 315@2x.png new file mode 100644 index 0000000..c17ba50 Binary files /dev/null and b/MoviaBox/Source/Assets.xcassets/icon/records_icon_01.imageset/Group 315@2x.png differ diff --git a/MoviaBox/Source/Assets.xcassets/icon/records_icon_01.imageset/Group 315@3x.png b/MoviaBox/Source/Assets.xcassets/icon/records_icon_01.imageset/Group 315@3x.png new file mode 100644 index 0000000..ea1c263 Binary files /dev/null and b/MoviaBox/Source/Assets.xcassets/icon/records_icon_01.imageset/Group 315@3x.png differ diff --git a/MoviaBox/Source/Assets.xcassets/icon/records_icon_02.imageset/Contents.json b/MoviaBox/Source/Assets.xcassets/icon/records_icon_02.imageset/Contents.json new file mode 100644 index 0000000..3eb7831 --- /dev/null +++ b/MoviaBox/Source/Assets.xcassets/icon/records_icon_02.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Purchase records@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Purchase records@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MoviaBox/Source/Assets.xcassets/icon/records_icon_02.imageset/Purchase records@2x.png b/MoviaBox/Source/Assets.xcassets/icon/records_icon_02.imageset/Purchase records@2x.png new file mode 100644 index 0000000..0f7b013 Binary files /dev/null and b/MoviaBox/Source/Assets.xcassets/icon/records_icon_02.imageset/Purchase records@2x.png differ diff --git a/MoviaBox/Source/Assets.xcassets/icon/records_icon_02.imageset/Purchase records@3x.png b/MoviaBox/Source/Assets.xcassets/icon/records_icon_02.imageset/Purchase records@3x.png new file mode 100644 index 0000000..ac2de21 Binary files /dev/null and b/MoviaBox/Source/Assets.xcassets/icon/records_icon_02.imageset/Purchase records@3x.png differ diff --git a/MoviaBox/Source/Assets.xcassets/icon/settings_icon_01.imageset/Contents.json b/MoviaBox/Source/Assets.xcassets/icon/settings_icon_01.imageset/Contents.json new file mode 100644 index 0000000..5c4d3b1 --- /dev/null +++ b/MoviaBox/Source/Assets.xcassets/icon/settings_icon_01.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Frame@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Frame@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MoviaBox/Source/Assets.xcassets/icon/settings_icon_01.imageset/Frame@2x.png b/MoviaBox/Source/Assets.xcassets/icon/settings_icon_01.imageset/Frame@2x.png new file mode 100644 index 0000000..0f4716b Binary files /dev/null and b/MoviaBox/Source/Assets.xcassets/icon/settings_icon_01.imageset/Frame@2x.png differ diff --git a/MoviaBox/Source/Assets.xcassets/icon/settings_icon_01.imageset/Frame@3x.png b/MoviaBox/Source/Assets.xcassets/icon/settings_icon_01.imageset/Frame@3x.png new file mode 100644 index 0000000..1fb74f4 Binary files /dev/null and b/MoviaBox/Source/Assets.xcassets/icon/settings_icon_01.imageset/Frame@3x.png differ diff --git a/MoviaBox/Source/en.lproj/Localizable.strings b/MoviaBox/Source/en.lproj/Localizable.strings index a7765c4..78f9e2b 100644 --- a/MoviaBox/Source/en.lproj/Localizable.strings +++ b/MoviaBox/Source/en.lproj/Localizable.strings @@ -21,6 +21,7 @@ "Save" = "Save"; "Added" = "Added"; "FeedBack" = "FeedBack"; +"Settings" = "Settings"; "Language" = "Language"; "Privacy Policy" = "Privacy Policy"; "User Agreement" = "User Agreement"; @@ -59,6 +60,10 @@ "My wallet" = "My wallet"; "Store" = "Store"; "Rewards" = "Rewards"; +"Details" = "Details"; +"Consumption records" = "Consumption records"; +"Purchase records" = "Purchase records"; +"Reward Coins" = "Reward Coins"; "kLoginAgreementText" = "By continuing, you agree to the User Agreement and Privacy Policy";