钱包页面开发
@ -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 {
|
||||
|
||||
|
@ -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)
|
||||
///开启网络监控
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
96
MoviaBox/Class/Mine/Controller/SPWalletViewController.swift
Normal file
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -31,6 +31,14 @@ struct SPMineItem {
|
||||
case persoInforDisclosure
|
||||
///反馈
|
||||
case feedBack
|
||||
///设置
|
||||
case settings
|
||||
///消费记录
|
||||
case consumptionRecords
|
||||
///订单记录
|
||||
case purchaseRecords
|
||||
///赠币记录
|
||||
case rewardCoins
|
||||
}
|
||||
|
||||
|
||||
|
@ -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() {
|
||||
|
61
MoviaBox/Class/Mine/View/SPWalletCell.swift
Normal file
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
41
MoviaBox/Class/Mine/View/SPWalletHeaderView.swift
Normal file
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
22
MoviaBox/Source/Assets.xcassets/icon/coin_icon_03.imageset/Contents.json
vendored
Normal file
@ -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
|
||||
}
|
||||
}
|
BIN
MoviaBox/Source/Assets.xcassets/icon/coin_icon_03.imageset/Group 614@2x.png
vendored
Normal file
After Width: | Height: | Size: 783 B |
BIN
MoviaBox/Source/Assets.xcassets/icon/coin_icon_03.imageset/Group 614@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.1 KiB |
22
MoviaBox/Source/Assets.xcassets/icon/feed_back_icon_03.imageset/Contents.json
vendored
Normal file
@ -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
|
||||
}
|
||||
}
|
BIN
MoviaBox/Source/Assets.xcassets/icon/feed_back_icon_03.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 421 B |
BIN
MoviaBox/Source/Assets.xcassets/icon/feed_back_icon_03.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 537 B |
22
MoviaBox/Source/Assets.xcassets/icon/records_icon_01.imageset/Contents.json
vendored
Normal file
@ -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
|
||||
}
|
||||
}
|
BIN
MoviaBox/Source/Assets.xcassets/icon/records_icon_01.imageset/Group 315@2x.png
vendored
Normal file
After Width: | Height: | Size: 529 B |
BIN
MoviaBox/Source/Assets.xcassets/icon/records_icon_01.imageset/Group 315@3x.png
vendored
Normal file
After Width: | Height: | Size: 703 B |
22
MoviaBox/Source/Assets.xcassets/icon/records_icon_02.imageset/Contents.json
vendored
Normal file
@ -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
|
||||
}
|
||||
}
|
BIN
MoviaBox/Source/Assets.xcassets/icon/records_icon_02.imageset/Purchase records@2x.png
vendored
Normal file
After Width: | Height: | Size: 604 B |
BIN
MoviaBox/Source/Assets.xcassets/icon/records_icon_02.imageset/Purchase records@3x.png
vendored
Normal file
After Width: | Height: | Size: 778 B |
22
MoviaBox/Source/Assets.xcassets/icon/settings_icon_01.imageset/Contents.json
vendored
Normal file
@ -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
|
||||
}
|
||||
}
|
BIN
MoviaBox/Source/Assets.xcassets/icon/settings_icon_01.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
MoviaBox/Source/Assets.xcassets/icon/settings_icon_01.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 2.7 KiB |
@ -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";
|
||||
|