From e804491df0532e69855af944a26f03d89d60624d Mon Sep 17 00:00:00 2001 From: WindowsMEMZ Date: Mon, 12 Feb 2024 16:47:58 +0800 Subject: [PATCH] Optimized iOS setting --- DarockBili.xcodeproj/project.pbxproj | 16 ++++++------- .../xcschemes/DarockBili Watch App.xcscheme | 3 +-- .../xcschemes/MeowBili Watch App.xcscheme | 3 +-- MeowBili/Others/SettingsView.swift | 14 ++++++----- MeowBili/Video/VideoDetailView.swift | 6 ----- MeowBili/Video/VideoPlayerView.swift | 24 +++++++++---------- 6 files changed, 30 insertions(+), 36 deletions(-) diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index c6126e47d..39aa13047 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -1367,7 +1367,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 439; + CURRENT_PROJECT_VERSION = 440; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1410,7 +1410,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 439; + CURRENT_PROJECT_VERSION = 440; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1451,7 +1451,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 439; + CURRENT_PROJECT_VERSION = 440; DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1483,7 +1483,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 439; + CURRENT_PROJECT_VERSION = 440; DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1636,7 +1636,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 439; + CURRENT_PROJECT_VERSION = 440; DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1668,7 +1668,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 439; + CURRENT_PROJECT_VERSION = 440; DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1700,7 +1700,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 439; + CURRENT_PROJECT_VERSION = 440; DEVELOPMENT_TEAM = B57D8PP775; INFOPLIST_KEY_CFBundleDisplayName = DarockBili; MARKETING_VERSION = 1.0.0; @@ -1716,7 +1716,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 439; + CURRENT_PROJECT_VERSION = 440; DEVELOPMENT_TEAM = B57D8PP775; INFOPLIST_KEY_CFBundleDisplayName = DarockBili; MARKETING_VERSION = 1.0.0; diff --git a/DarockBili.xcodeproj/xcshareddata/xcschemes/DarockBili Watch App.xcscheme b/DarockBili.xcodeproj/xcshareddata/xcschemes/DarockBili Watch App.xcscheme index b2aeed0a6..bb841095b 100644 --- a/DarockBili.xcodeproj/xcshareddata/xcschemes/DarockBili Watch App.xcscheme +++ b/DarockBili.xcodeproj/xcshareddata/xcschemes/DarockBili Watch App.xcscheme @@ -70,8 +70,7 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" - allowLocationSimulation = "YES" - notificationPayloadFile = "PushNotificationPayload.apns"> + allowLocationSimulation = "YES"> diff --git a/DarockBili.xcodeproj/xcshareddata/xcschemes/MeowBili Watch App.xcscheme b/DarockBili.xcodeproj/xcshareddata/xcschemes/MeowBili Watch App.xcscheme index 336828e1a..c8fda6026 100644 --- a/DarockBili.xcodeproj/xcshareddata/xcschemes/MeowBili Watch App.xcscheme +++ b/DarockBili.xcodeproj/xcshareddata/xcschemes/MeowBili Watch App.xcscheme @@ -70,8 +70,7 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" - allowLocationSimulation = "YES" - notificationPayloadFile = "PushNotificationPayload.apns"> + allowLocationSimulation = "YES"> ") { videoDetails["Title"] = "\(String(videoDetails["Title"]!.hasPrefix("") ? "" : (videoDetails["Title"]!.split(separator: "")[0])))\(String(videoDetails["Title"]!.split(separator: "")[videoDetails["Title"]!.hasPrefix("") ? 0 : 1].split(separator: "")[0]))\(String(videoDetails["Title"]!.hasSuffix("") ? "" : videoDetails["Title"]!.split(separator: "")[1]))" diff --git a/MeowBili/Video/VideoPlayerView.swift b/MeowBili/Video/VideoPlayerView.swift index 0c801cff0..b55d3c06b 100644 --- a/MeowBili/Video/VideoPlayerView.swift +++ b/MeowBili/Video/VideoPlayerView.swift @@ -29,7 +29,7 @@ struct VideoPlayerView: View { @AppStorage("DedeUserID__ckMd5") var dedeUserID__ckMd5 = "" @AppStorage("SESSDATA") var sessdata = "" @AppStorage("bili_jct") var biliJct = "" - @AppStorage("RecordHistoryTime") var recordHistoryTime = "into" + @AppStorage("IsRecordHistory") var isRecordHistory = true @State var currentTime: Double = 0.0 @State var playerTimer: Timer? @State var danmakuTimer: Timer? @@ -55,20 +55,20 @@ struct VideoPlayerView: View { let headers: HTTPHeaders = [ "cookie": "SESSDATA=\(sessdata)" ] - if recordHistoryTime == "play" { + if isRecordHistory { AF.request("https://api.bilibili.com/x/click-interface/web/heartbeat", method: .post, parameters: ["bvid": VideoDetailView.willPlayVideoBV, "mid": dedeUserID, "type": 3, "dt": 2, "play_type": 2, "csrf": biliJct], headers: headers).response { response in debugPrint(response) } - } - - Timer.scheduledTimer(withTimeInterval: 15, repeats: true) { timer in - playerTimer = timer - debugPrint(player.currentTime()) - let headers: HTTPHeaders = [ - "cookie": "SESSDATA=\(sessdata)" - ] - AF.request("https://api.bilibili.com/x/click-interface/web/heartbeat", method: .post, parameters: ["bvid": VideoDetailView.willPlayVideoBV, "mid": dedeUserID, "played_time": Int(player.currentTime().seconds), "type": 3, "dt": 2, "play_type": 0, "csrf": biliJct], headers: headers).response { response in - debugPrint(response) + + Timer.scheduledTimer(withTimeInterval: 15, repeats: true) { timer in + playerTimer = timer + debugPrint(player.currentTime()) + let headers: HTTPHeaders = [ + "cookie": "SESSDATA=\(sessdata)" + ] + AF.request("https://api.bilibili.com/x/click-interface/web/heartbeat", method: .post, parameters: ["bvid": VideoDetailView.willPlayVideoBV, "mid": dedeUserID, "played_time": Int(player.currentTime().seconds), "type": 3, "dt": 2, "play_type": 0, "csrf": biliJct], headers: headers).response { response in + debugPrint(response) + } } }