From e8b2c4668fc0d21ec208a376f1c4a74543a5ca7d Mon Sep 17 00:00:00 2001 From: zeng Date: Fri, 9 May 2025 17:31:34 +0800 Subject: [PATCH] =?UTF-8?q?1.0.1=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MoviaBox.xcodeproj/project.pbxproj | 6 ++++-- MoviaBox/AppDelegate/SceneDelegate.swift | 15 ++++++++------- MoviaBox/Base/Networking/API/SPWalletAPI.swift | 8 +++++++- .../Controller/SPGuideViewController.swift | 9 ++++++--- .../Mine/Controller/SPMineViewController.swift | 17 ++++++++++++++--- MoviaBox/Libs/APPTool/SPAPPTool.swift | 4 ++-- MoviaBox/Source/en.lproj/Localizable.strings | 2 ++ 7 files changed, 43 insertions(+), 18 deletions(-) diff --git a/MoviaBox.xcodeproj/project.pbxproj b/MoviaBox.xcodeproj/project.pbxproj index 06b6444..4e2194e 100644 --- a/MoviaBox.xcodeproj/project.pbxproj +++ b/MoviaBox.xcodeproj/project.pbxproj @@ -235,13 +235,14 @@ CODE_SIGN_ENTITLEMENTS = MoviaBox/MoviaBox.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = TWDZ3MP9DV; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = MoviaBox/Source/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = MoviaBox; INFOPLIST_KEY_NSCameraUsageDescription = "The APP needs to access your album to provide screenshots for feedback."; + INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "The APP needs to access your location to recommend better short dramas for you"; INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "The APP needs to access your album to provide screenshots for feedback."; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; @@ -280,13 +281,14 @@ CODE_SIGN_ENTITLEMENTS = MoviaBox/MoviaBox.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = TWDZ3MP9DV; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = MoviaBox/Source/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = MoviaBox; INFOPLIST_KEY_NSCameraUsageDescription = "The APP needs to access your album to provide screenshots for feedback."; + INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "The APP needs to access your location to recommend better short dramas for you"; INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "The APP needs to access your album to provide screenshots for feedback."; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; diff --git a/MoviaBox/AppDelegate/SceneDelegate.swift b/MoviaBox/AppDelegate/SceneDelegate.swift index 3d4b13f..305ea5f 100644 --- a/MoviaBox/AppDelegate/SceneDelegate.swift +++ b/MoviaBox/AppDelegate/SceneDelegate.swift @@ -19,19 +19,20 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { SPAPPTool.mainTabBarController = tabBarController let hasOpenApp = UserDefaults.standard.object(forKey: kSPHasBeenOpenedAPPDefaultsKey) as? Bool + ///引导页 + let guideVc = SPGuideViewController() window = UIWindow(windowScene: windowScene) - if hasOpenApp == true { - SPAPPTool.isAppOpen = true - window?.rootViewController = tabBarController - } else { + if hasOpenApp != true && guideVc.lanuchVC != nil { SPAPPTool.isAppOpen = false - let vc = SPGuideViewController() - vc.openAppBlock = { + guideVc.openAppBlock = { self.handleOpenApp() } - window?.rootViewController = vc + window?.rootViewController = guideVc + } else { + SPAPPTool.isAppOpen = true + window?.rootViewController = tabBarController } window?.makeKeyAndVisible() diff --git a/MoviaBox/Base/Networking/API/SPWalletAPI.swift b/MoviaBox/Base/Networking/API/SPWalletAPI.swift index 90871d0..46364f1 100644 --- a/MoviaBox/Base/Networking/API/SPWalletAPI.swift +++ b/MoviaBox/Base/Networking/API/SPWalletAPI.swift @@ -26,6 +26,7 @@ class SPWalletAPI: NSObject { ///创建内购订单 static func requestCreateOrder(payId: String, shortPlayId: String, videoId: String, completer: ((_ orderModel: SPIAPOrderModel?) -> Void)?) { var param = SPNetworkParameters(path: "/createOrder") + param.isToast = false param.parameters = [ "payment_channel" : "apple", "short_play_id" : shortPlayId, @@ -35,7 +36,12 @@ class SPWalletAPI: NSObject { SPNetwork.request(parameters: param) { (response: SPNetworkResponse) in if let message = response.data?.message, message.count > 0 { - SPToast.show(text: message) + if response.data?.code == 30007 { + SPToast.show(text: "kToastMessage_04".localized) + } else { + SPToast.show(text: message) + } + completer?(nil) } else { completer?(response.data) diff --git a/MoviaBox/Class/Guide/Controller/SPGuideViewController.swift b/MoviaBox/Class/Guide/Controller/SPGuideViewController.swift index e2364de..0bd0735 100644 --- a/MoviaBox/Class/Guide/Controller/SPGuideViewController.swift +++ b/MoviaBox/Class/Guide/Controller/SPGuideViewController.swift @@ -11,7 +11,7 @@ class SPGuideViewController: SPViewController { var openAppBlock: (() -> Void)? - private lazy var lanuchVC: UIViewController = { + private(set) lazy var lanuchVC: UIViewController? = { let vc = SPAPPTool.getLanuchViewController() return vc }() @@ -51,8 +51,11 @@ class SPGuideViewController: SPViewController { extension SPGuideViewController { private func _setupUI() { - addChild(lanuchVC) - view.addSubview(lanuchVC.view) + if let vc = lanuchVC { + addChild(vc) + view.addSubview(vc.view) + } + view.addSubview(button) diff --git a/MoviaBox/Class/Mine/Controller/SPMineViewController.swift b/MoviaBox/Class/Mine/Controller/SPMineViewController.swift index 15336ab..5fe57ec 100644 --- a/MoviaBox/Class/Mine/Controller/SPMineViewController.swift +++ b/MoviaBox/Class/Mine/Controller/SPMineViewController.swift @@ -37,6 +37,9 @@ class SPMineViewController: SPViewController { tableView.delegate = self tableView.dataSource = self tableView.rowHeight = 50 + tableView.sp_addRefreshHeader(insetTop: 0) { [weak self] in + self?.handleHeaderRefresh(nil) + } SPMineCell.registerCell(tableView: tableView) return tableView }() @@ -75,6 +78,11 @@ class SPMineViewController: SPViewController { } + override func handleHeaderRefresh(_ completer: (() -> Void)?) { + requestData { [weak self] in + self?.tableView.sp_endHeaderRefreshing() + } + } } @@ -139,9 +147,11 @@ extension SPMineViewController: UITableViewDelegate, UITableViewDataSource { extension SPMineViewController { - private func requestData() { + private func requestData(completer: (() -> Void)? = nil) { requestUserInfo() - requestPlayHistoryList() + requestPlayHistoryList { + completer?() + } } ///获取用户信息 @@ -151,7 +161,7 @@ extension SPMineViewController { } } ///获取播放记录 - private func requestPlayHistoryList() { + private func requestPlayHistoryList(completer: (() -> Void)? = nil) { SPVideoAPI.requestPlayHistoryList(page: 1, pageSize: 10) { [weak self] listModel in guard let self = self else { return } if let list = listModel?.list { @@ -159,6 +169,7 @@ extension SPMineViewController { self.updateHeaderView() } + completer?() } } diff --git a/MoviaBox/Libs/APPTool/SPAPPTool.swift b/MoviaBox/Libs/APPTool/SPAPPTool.swift index 0cb42b1..bd735a0 100644 --- a/MoviaBox/Libs/APPTool/SPAPPTool.swift +++ b/MoviaBox/Libs/APPTool/SPAPPTool.swift @@ -19,10 +19,10 @@ class SPAPPTool: NSObject { } ///获得启动图 - static func getLanuchViewController() -> UIViewController { + static func getLanuchViewController() -> UIViewController? { let storyboard = UIStoryboard(name: "LaunchScreen", bundle: nil) let vc = storyboard.instantiateInitialViewController() - return vc! + return vc } ///获取根视图 diff --git a/MoviaBox/Source/en.lproj/Localizable.strings b/MoviaBox/Source/en.lproj/Localizable.strings index 74136b4..b8a444f 100644 --- a/MoviaBox/Source/en.lproj/Localizable.strings +++ b/MoviaBox/Source/en.lproj/Localizable.strings @@ -105,6 +105,8 @@ "kToastMessage_02" = "You still have unfinished in-app purchases. Please restore them first."; ///网络错误提示 "kToastMessage_03" = "The service is abnormal. Check the network."; +///已是会员提示 +"kToastMessage_04" = "You are already a member!"; ///请购买上一集提示 "kAlertMessage_01" = "The previous episode of this series has not been unlocked yet. Please unlock the previous episode first.";