diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index f0f21f811..555d241af 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -59,7 +59,6 @@ 8CA3889F2B78B1E300F5F91F /* AZVideoPlayer in Frameworks */ = {isa = PBXBuildFile; productRef = 8CA3889E2B78B1E300F5F91F /* AZVideoPlayer */; }; 8CA388A22B78B5D800F5F91F /* BiliFont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8CA388A02B78B5D800F5F91F /* BiliFont.ttf */; }; 8CA388A32B78B5D800F5F91F /* BiliFont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8CA388A02B78B5D800F5F91F /* BiliFont.ttf */; }; - 8CA53B032BB963D700D6D692 /* WatchUIDebugView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CA53B022BB963D700D6D692 /* WatchUIDebugView.swift */; }; 8CA7CBC32B77AC4A008E587F /* MeowBiliApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CA7CBC22B77AC4A008E587F /* MeowBiliApp.swift */; }; 8CA7CBC52B77AC4A008E587F /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CA7CBC42B77AC4A008E587F /* ContentView.swift */; }; 8CA7CBC72B77AC4C008E587F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8CA7CBC62B77AC4C008E587F /* Assets.xcassets */; }; @@ -301,7 +300,6 @@ 8CA1BA152BD2AFAB009BCDFB /* PrivateSymbols.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrivateSymbols.h; sourceTree = ""; }; 8CA370D92B82724400CE0E9E /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 8CA388A02B78B5D800F5F91F /* BiliFont.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = BiliFont.ttf; sourceTree = ""; }; - 8CA53B022BB963D700D6D692 /* WatchUIDebugView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchUIDebugView.swift; sourceTree = ""; }; 8CA7CBC02B77AC4A008E587F /* MeowBili.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MeowBili.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8CA7CBC22B77AC4A008E587F /* MeowBiliApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeowBiliApp.swift; sourceTree = ""; }; 8CA7CBC42B77AC4A008E587F /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -614,7 +612,6 @@ 8CA7CCA02B77B2DC008E587F /* LoginView.swift */, 03B2F80E2C45AED7007EB850 /* PhoneFormatterExt.swift */, 8CA7CCA22B77B2F2008E587F /* NoticeView.swift */, - 8CA53B022BB963D700D6D692 /* WatchUIDebugView.swift */, ); path = Others; sourceTree = ""; @@ -1232,7 +1229,6 @@ 8CBFF1282B861F7F00350E0F /* backtrace.c in Sources */, 8CBFF0EB2B85E55F00350E0F /* FavoriteView.swift in Sources */, 8CBFF0E12B85E55F00350E0F /* UserDynamicMainView.swift in Sources */, - 8CA53B032BB963D700D6D692 /* WatchUIDebugView.swift in Sources */, 8C9776092BCECBC3006EDB58 /* Audio.swift in Sources */, 8CBFF0BA2B85E55F00350E0F /* Passthroughs.swift in Sources */, 8CBFF0B92B85E55F00350E0F /* LinkDetectText.swift in Sources */, diff --git a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index c9c3f8543..83e4f6ffa 100644 --- a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "97df39012f2971497a8865ae77068cc4bbc79ab3288f96b77e2c8898b1305102", + "originHash" : "d28be4d892e241813e1562f4d95d6d86cacedeb289d4f3c74fadfba503aba62d", "pins" : [ { "identity" : "alamofire", diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 650a6b4f1..f57e5dc3c 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -2285,9 +2285,6 @@ } } }, - "DebugVPLD" : { - "shouldTranslate" : false - }, "Dignite" : { "localizations" : { "en" : { @@ -5943,12 +5940,6 @@ } } }, - "TLeft" : { - "shouldTranslate" : false - }, - "TRight" : { - "shouldTranslate" : false - }, "Troubleshoot" : { "localizations" : { "en" : { @@ -7142,9 +7133,6 @@ } } }, - "UIDebug" : { - "shouldTranslate" : false - }, "Update.checking" : { "localizations" : { "en" : { @@ -9098,9 +9086,6 @@ }, "提交反馈" : { - }, - "提交反馈前,请先检查常见问题" : { - }, "搜索" : { "localizations" : { diff --git a/MeowBili/InMain/MainView.swift b/MeowBili/InMain/MainView.swift index a8e4437b3..9f5953977 100644 --- a/MeowBili/InMain/MainView.swift +++ b/MeowBili/InMain/MainView.swift @@ -183,11 +183,6 @@ struct MainView: View { }, label: { Text("Home.debug") }) - #if os(watchOS) - NavigationLink(destination: { WatchUIDebugView() }, label: { - Text("UIDebug") - }) - #endif } if notice != "" { NavigationLink(destination: { NoticeView() }, label: { diff --git a/MeowBili/MeowBiliApp.swift b/MeowBili/MeowBiliApp.swift index da244f8e5..8a246721d 100644 --- a/MeowBili/MeowBiliApp.swift +++ b/MeowBili/MeowBiliApp.swift @@ -167,36 +167,38 @@ struct DarockBili_Watch_AppApp: App { var body: some SwiftUI.Scene { WindowGroup { if fileLockerPwd != "" { - List { - Section { - Text(fileLockerRetryCount == 0 ? "文件保险箱已启用" : "输入错误") - .font(.title3) - .bold() - .listRowBackground(Color.clear) - } - Section { - TextField("密码", text: $fileLockerInput) { - if fileLockerInput == fileLockerPwd { - fileLockerPwd = "" - } else { - fileLockerInput = "" - fileLockerRetryCount++ - } + NavigationStack { + List { + Section { + Text(fileLockerRetryCount == 0 ? "文件保险箱已启用" : "输入错误") + .font(.title3) + .bold() + .listRowBackground(Color.clear) } - .submitLabel(.continue) - } - if fileLockerRetryCount >= 3 { Section { - TextField("使用恢复密钥", text: $recoveryCodeInput) { - if recoveryCodeInput == fileLockerRecoverCode { + TextField("密码", text: $fileLockerInput) { + if fileLockerInput == fileLockerPwd { fileLockerPwd = "" } else { - recoveryCodeInput = "" + fileLockerInput = "" fileLockerRetryCount++ } } .submitLabel(.continue) } + if fileLockerRetryCount >= 3 { + Section { + TextField("使用恢复密钥", text: $recoveryCodeInput) { + if recoveryCodeInput == fileLockerRecoverCode { + fileLockerPwd = "" + } else { + recoveryCodeInput = "" + fileLockerRetryCount++ + } + } + .submitLabel(.continue) + } + } } } } else { diff --git a/MeowBili/Others/LoginView.swift b/MeowBili/Others/LoginView.swift index fec13413c..9c0c4332e 100644 --- a/MeowBili/Others/LoginView.swift +++ b/MeowBili/Others/LoginView.swift @@ -386,8 +386,15 @@ struct LoginView: View { ] AF.request("https://passport.bilibili.com/x/passport-login/web/sms/send", method: .post, parameters: BiliSmsCodePost(cid: Int(displayCC)!, tel: Int(accountInput)!, token: loginToken, challenge: challenge, validate: validate, seccode: seccode), headers: headers).response { response in debugPrint(response) - let json = try! JSON(data: response.data!) - smsLoginToken = json["data"]["captcha_key"].string! + if let json = try? JSON(data: response.data!), let token = json["data"]["captcha_key"].string { + smsLoginToken = token + } else { +#if os(iOS) + AlertKitAPI.present(title: "获取出错", subtitle: "请稍后重试", icon: .error, style: .iOS17AppleMusic, haptic: .error) +#else + tipWithText("获取出错", symbol: "xmark.circle.fill") +#endif + } } } } else { diff --git a/MeowBili/Others/WatchUIDebugView.swift b/MeowBili/Others/WatchUIDebugView.swift deleted file mode 100644 index c01cb0c3e..000000000 --- a/MeowBili/Others/WatchUIDebugView.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// -// WatchUIDebugView.swift -// MeowBili Watch App -// -// Created by memz233 on 2024/3/31. -// -//===----------------------------------------------------------------------===// -// -// This source file is part of the MeowBili open source project -// -// Copyright (c) 2024 Darock Studio and the MeowBili project authors -// Licensed under GNU General Public License v3 -// -// See https://darock.top/LICENSE.txt for license information -// -//===----------------------------------------------------------------------===// - -import SwiftUI - -struct WatchUIDebugView: View { - var body: some View { - List { - NavigationLink(destination: { SegmentedPicker(selection: .constant(0), leftText: "TLeft", rightText: "TRight") }, label: { - Text("DebugVPLD") - }) - } - } - - -} - -#Preview { - WatchUIDebugView() -} diff --git a/MeowBili/Video/VideoPlayerView.swift b/MeowBili/Video/VideoPlayerView.swift index 9ec9187cb..687affc94 100644 --- a/MeowBili/Video/VideoPlayerView.swift +++ b/MeowBili/Video/VideoPlayerView.swift @@ -61,6 +61,11 @@ struct VideoPlayerView: View { @State var isFullScreen = false @State var playbackSpeed = 1.0 @State var jumpToInput = "" + @State var playerScale: CGFloat = 1.0 + @State var __playerScale = 1.0 + @State var playerScaledOffset = CGSizeZero + @State var playerScaledLastOffset = CGSizeZero + @State var cachedPlayerTimeControlStatus = AVPlayer.TimeControlStatus.paused #endif @State var currentTime: Double = 0.0 @State var playerTimer: Timer? @@ -170,11 +175,52 @@ struct VideoPlayerView: View { .rotationEffect(.degrees(isFullScreen ? 90 : 0)) .frame(width: isFullScreen ? WKInterfaceDevice.current().screenBounds.height : nil, height: isFullScreen ? WKInterfaceDevice.current().screenBounds.width : nil) } + if cachedPlayerTimeControlStatus == .paused { + VStack { + ZStack { + Color.accentColor // For tap gesture + .frame(width: 60, height: 40) + .opacity(0.0100000002421438702673861521) + HStack(spacing: 2) { + Image(systemName: "rectangle.portrait.arrowtriangle.2.outward") + .shadow(color: .accentColor, radius: 1) + Text(String(__playerScale)) + .shadow(color: .accentColor, radius: 1) + } + .font(.system(size: 14)) + } + .onTapGesture { + if __playerScale < 10.0 { + __playerScale += 1.0 + playerScale += 1.0 + } else { + __playerScale = 1.0 + playerScale = 1.0 + playerScaledOffset = CGSizeZero + playerScaledLastOffset = CGSizeZero + } + } + Spacer() + } + .ignoresSafeArea() + } } + .animation(.smooth, value: cachedPlayerTimeControlStatus) + .animation(.smooth, value: playerScale) + .animation(.smooth, value: __playerScale) + .scrollIndicators(.never) .tag(1) List { Section { - SegmentedPicker(selection: $isFullScreen, leftText: "正常", rightText: "全屏") + Button(action: { + isFullScreen.toggle() + tabviewChoseTab = 1 + }, label: { + Label( + isFullScreen ? "恢复" : "全屏", + systemImage: isFullScreen ? "arrow.down.right.and.arrow.up.left" : "arrow.down.left.and.arrow.up.right" + ) + }) } header: { Text("画面") } @@ -259,6 +305,14 @@ struct VideoPlayerView: View { }) } } + .onReceive(player.publisher(for: \.timeControlStatus)) { status in + if _slowPath(status != cachedPlayerTimeControlStatus) { + if status == .playing { + player.rate = Float(playbackSpeed) + } + cachedPlayerTimeControlStatus = status + } + } #endif } .onAppear { @@ -372,7 +426,7 @@ struct VideoPlayerView: View { @inline(__always) func UpdateDanmaku() { AF.request("https://api.bilibili.com/x/v1/dm/list.so?oid=\(videoCID)").response { response in - if let danmakus = String(data: response.data!, encoding: .utf8) { + if let respData = response.data, let danmakus = String(data: respData, encoding: .utf8) { if danmakus.contains("")[1].split(separator: "")[0] let danmakuSpd = danmakuOnly.split(separator: "")