diff --git a/Podfile b/Podfile index 5600633..2b8ac15 100644 --- a/Podfile +++ b/Podfile @@ -1,5 +1,5 @@ # Uncomment the next line to define a global platform for your project -platform :ios, '13.0' +platform :ios, '15.6' #source 'https://github.com/CocoaPods/Specs' source 'https://cdn.cocoapods.org/' diff --git a/Thimra.xcodeproj/project.pbxproj b/Thimra.xcodeproj/project.pbxproj index f2d7797..f000d78 100644 --- a/Thimra.xcodeproj/project.pbxproj +++ b/Thimra.xcodeproj/project.pbxproj @@ -179,7 +179,7 @@ }; 99BF4E2B3615B1F54D05DA28 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; + buildActionMask = 12; files = ( ); inputFileListPaths = ( @@ -214,9 +214,10 @@ ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = TWDZ3MP9DV; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Thimra/Source/Info.plist; @@ -232,15 +233,16 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = cn.com.boytv.ShortPlay; + PRODUCT_BUNDLE_IDENTIFIER = com.thimratv.app; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OBJC_BRIDGING_HEADER = "Thimra/Source/Thimra-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; - VALID_ARCHS = "arm64 arm64e x86_64"; + VALID_ARCHS = "arm64 arm64e armv7s x86_64"; }; name = Debug; }; @@ -251,9 +253,10 @@ ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = TWDZ3MP9DV; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Thimra/Source/Info.plist; @@ -269,15 +272,16 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = cn.com.boytv.ShortPlay; + PRODUCT_BUNDLE_IDENTIFIER = com.thimratv.app; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OBJC_BRIDGING_HEADER = "Thimra/Source/Thimra-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; - VALID_ARCHS = "arm64 arm64e x86_64"; + VALID_ARCHS = "arm64 arm64e armv7s x86_64"; }; name = Release; }; diff --git a/Thimra.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Thimra.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..0c67376 --- /dev/null +++ b/Thimra.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/Thimra/AppDelegate/AppDelegate.swift b/Thimra/AppDelegate/AppDelegate.swift index 8a924ac..888bcc2 100644 --- a/Thimra/AppDelegate/AppDelegate.swift +++ b/Thimra/AppDelegate/AppDelegate.swift @@ -23,7 +23,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { NotificationCenter.default.addObserver(self, selector: #selector(reachabilityDidChangeNotification), name: SPNetworkReachabilityManager.reachabilityDidChangeNotification, object: nil) - NetworkObserver.share.startMonitoring() + SPNetworkReachabilityManager.manager.startMonitoring() return true @@ -45,9 +45,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { @objc private func reachabilityDidChangeNotification() { -// if SPNetworkReachabilityManager.manager.isReachable { -// SPLoginManager.manager.requestVisitorLogin(completer: nil) -// } + if SPNetworkReachabilityManager.manager.isReachable == true { + SPLoginManager.manager.requestVisitorLogin(completer: nil) + } } } diff --git a/Thimra/Base/Controller/SPViewController.swift b/Thimra/Base/Controller/SPViewController.swift index f20f99c..12ca2fd 100644 --- a/Thimra/Base/Controller/SPViewController.swift +++ b/Thimra/Base/Controller/SPViewController.swift @@ -88,7 +88,7 @@ class SPViewController: UIViewController, JYPageChildContollerProtocol { if let statusBarStyle = statusBarStyle { return statusBarStyle } else { - return .default + return .lightContent } } override var prefersStatusBarHidden: Bool { diff --git a/Thimra/Base/Networking/Base/SPNetworkReachabilityManager.swift b/Thimra/Base/Networking/Base/SPNetworkReachabilityManager.swift index 6bf6f37..149973a 100644 --- a/Thimra/Base/Networking/Base/SPNetworkReachabilityManager.swift +++ b/Thimra/Base/Networking/Base/SPNetworkReachabilityManager.swift @@ -20,20 +20,11 @@ class SPNetworkReachabilityManager { static let manager: SPNetworkReachabilityManager = SPNetworkReachabilityManager() - private let reachabilityManager = NetworkReachabilityManager() - ///是否有网 -// @objc var isReachable: Bool { -// switch currentReachabilityStatus { -// case .notReachable: -// return false -// case .reachableViaWiFi, .reachableViaWWAN: -// return true -// -// default: -// return false -// } -// } + var isReachable: Bool? + + /* + private let reachabilityManager = NetworkReachabilityManager() func startMonitoring() { @@ -51,6 +42,45 @@ class SPNetworkReachabilityManager { }) } + */ + + private let monitor = NWPathMonitor() + private let queue = DispatchQueue(label: "NetworkMonitorQueue") + + func startMonitoring() { + + monitor.pathUpdateHandler = { [weak self] path in + guard let self = self else { return } + if path.status == .satisfied { + if self.isReachable == false { + print("++++++有网") + NotificationCenter.default.post(name: SPNetworkReachabilityManager.reachabilityDidChangeNotification, object: nil) + } + self.isReachable = true + + } else { + if self.isReachable == true { + print("++++++无网") + NotificationCenter.default.post(name: SPNetworkReachabilityManager.reachabilityDidChangeNotification, object: nil) + } + self.isReachable = false + } + +// if path.usesInterfaceType(.wifi) { +// print("++++++Using Wi-Fi") +// } +// +// if path.usesInterfaceType(.cellular) { +// print("++++++Using Cellular") +// } + } + + monitor.start(queue: queue) + } + + func stopMonitoring() { + monitor.cancel() + } } diff --git a/Thimra/Class/Home/Controller/SPHomeViewController.swift b/Thimra/Class/Home/Controller/SPHomeViewController.swift index 8027c5b..c64b54c 100644 --- a/Thimra/Class/Home/Controller/SPHomeViewController.swift +++ b/Thimra/Class/Home/Controller/SPHomeViewController.swift @@ -62,9 +62,8 @@ class SPHomeViewController: SPHomeChildController { super.viewDidLoad() NotificationCenter.default.addObserver(self, selector: #selector(reachabilityDidChangeNotification), name: SPNetworkReachabilityManager.reachabilityDidChangeNotification, object: nil) - requestModuleData() - requestPlayHistory() - requestListDataArr(page: 1, completer: nil) + + updateAllData(completer: nil) _setupUI() @@ -76,9 +75,8 @@ class SPHomeViewController: SPHomeChildController { } override func handleHeaderRefresh(_ completer: (() -> Void)?) { - requestModuleData() - requestPlayHistory() - requestListDataArr(page: 1) { [weak self] in + + updateAllData { [weak self] in self?.collectionView.sp_endHeaderRefreshing() } } @@ -89,6 +87,7 @@ class SPHomeViewController: SPHomeChildController { } } + } extension SPHomeViewController { @@ -124,7 +123,9 @@ extension SPHomeViewController { } @objc private func reachabilityDidChangeNotification() { - + if SPNetworkReachabilityManager.manager.isReachable == true, self.viewModel.moduleModel == nil { + updateAllData(completer: nil) + } } } @@ -164,6 +165,13 @@ extension SPHomeViewController: UICollectionViewDelegate, UICollectionViewDataSo extension SPHomeViewController { + private func updateAllData(completer: (() -> Void)?) { + requestModuleData() + requestPlayHistory() + requestListDataArr(page: 1) { + completer?() + } + } private func requestModuleData() { SPHomeAPI.requestHomeModuleData { [weak self] model in diff --git a/Thimra/Class/Home/View/SPHomeHotSearchView.swift b/Thimra/Class/Home/View/SPHomeHotSearchView.swift index a1ad5da..00f8a49 100644 --- a/Thimra/Class/Home/View/SPHomeHotSearchView.swift +++ b/Thimra/Class/Home/View/SPHomeHotSearchView.swift @@ -42,6 +42,7 @@ class SPHomeHotSearchView: UIView { tableView.separatorStyle = .none tableView.showsVerticalScrollIndicator = false tableView.showsHorizontalScrollIndicator = false + tableView.keyboardDismissMode = .onDrag tableView.contentInset = .init(top: 0, left: 0, bottom: kSPTabbarSafeBottomMargin, right: 0) SPHomeHotSearchCell.registerCell(tableView: tableView) return tableView diff --git a/Thimra/Class/Player/Controller/SPPlayerListViewController.swift b/Thimra/Class/Player/Controller/SPPlayerListViewController.swift index dcbbeb2..92cfe67 100644 --- a/Thimra/Class/Player/Controller/SPPlayerListViewController.swift +++ b/Thimra/Class/Player/Controller/SPPlayerListViewController.swift @@ -165,8 +165,13 @@ class SPPlayerListViewController: SPViewController { if isFirstPlay { isFirstPlay = false - let offset = self.collectionView.contentOffset.y + 0.5 + let offset = self.collectionView.contentOffset.y + 0.2 self.collectionView.setContentOffset(CGPoint(x: 0, y: offset), animated: false) + + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + let offset = self.collectionView.contentOffset.y + self.collectionView.setContentOffset(CGPoint(x: 0, y: floor(offset)), animated: false) + } } if currentIndexPath.row <= 2 { diff --git a/Thimra/Libs/Reachability/NetworkObserver.swift b/Thimra/Libs/Reachability/NetworkObserver.swift deleted file mode 100644 index b04aecc..0000000 --- a/Thimra/Libs/Reachability/NetworkObserver.swift +++ /dev/null @@ -1,72 +0,0 @@ -// -// NetworkObserver.swift -// Thimra -// -// Created by Overseas on 2025/4/21. -// - -import UIKit -import Network -import Reachability - - -class NetworkObserver { - static let share = NetworkObserver() - - - private let monitor = NWPathMonitor() - private let queue = DispatchQueue(label: "NetworkMonitorQueue") - - func startMonitoring() { - monitor.pathUpdateHandler = { path in - if path.status == .satisfied { - print("++++++有网") - } else { - print("++++++无网") - } - -// if path.usesInterfaceType(.wifi) { -// print("++++++Using Wi-Fi") -// } -// -// if path.usesInterfaceType(.cellular) { -// print("++++++Using Cellular") -// } - } - - monitor.start(queue: queue) - } - - func stopMonitoring() { - monitor.cancel() - } - - /* - private let reachability = try! Reachability() - - func startMonitoring() { - reachability.whenReachable = { reachability in - if reachability.connection == .wifi { - print("++++++Network reachable via Wi-Fi") - } else if reachability.connection == .cellular { - print("++++++Network reachable via Cellular") - } - } - - reachability.whenUnreachable = { _ in - print("++++++Network not reachable") - } - - do { - try reachability.startNotifier() - } catch { - print("++++++Unable to start notifier") - } - } - - func stopMonitoring() { - reachability.stopNotifier() - } - */ - -}