From 50595f872b44243ca4185c39ffbf182e0932706a Mon Sep 17 00:00:00 2001 From: WindowsMEMZ Date: Sat, 16 Mar 2024 17:35:37 +0800 Subject: [PATCH] fix: Crash when enter video --- DarockBili.xcodeproj/project.pbxproj | 24 +- .../xcshareddata/swiftpm/Package.resolved | 212 ------------------ MeowBili/Bangumi/BangumiPlayerView.swift | 7 +- MeowBili/InMain/SearchView.swift | 3 - MeowBili/Video/VideoDetailView.swift | 5 +- MeowBili/Video/VideoPlayerView.swift | 6 +- 6 files changed, 17 insertions(+), 240 deletions(-) delete mode 100644 DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index d023b2f28..bb9dc4ce3 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -1579,7 +1579,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 885; + CURRENT_PROJECT_VERSION = 893; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1610,7 +1610,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 885; + CURRENT_PROJECT_VERSION = 893; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1646,7 +1646,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Vision App.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 885; + CURRENT_PROJECT_VERSION = 893; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1681,7 +1681,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Vision App.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 885; + CURRENT_PROJECT_VERSION = 893; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1718,7 +1718,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 885; + CURRENT_PROJECT_VERSION = 893; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1765,7 +1765,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 885; + CURRENT_PROJECT_VERSION = 893; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1809,7 +1809,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 885; + CURRENT_PROJECT_VERSION = 893; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1845,7 +1845,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 885; + CURRENT_PROJECT_VERSION = 893; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1884,7 +1884,7 @@ CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Mac App.entitlements"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 885; + CURRENT_PROJECT_VERSION = 893; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_HARDENED_RUNTIME = YES; @@ -1917,7 +1917,7 @@ CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Mac App.entitlements"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 885; + CURRENT_PROJECT_VERSION = 893; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_HARDENED_RUNTIME = YES; @@ -1946,7 +1946,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 885; + CURRENT_PROJECT_VERSION = 893; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -1969,7 +1969,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 885; + CURRENT_PROJECT_VERSION = 893; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; diff --git a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 4fac1da04..000000000 --- a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,212 +0,0 @@ -{ - "pins" : [ - { - "identity" : "alamofire", - "kind" : "remoteSourceControl", - "location" : "https://github.com/Alamofire/Alamofire", - "state" : { - "revision" : "3dc6a42c7727c49bf26508e29b0a0b35f9c7e1ad", - "version" : "5.8.1" - } - }, - { - "identity" : "alertkit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/sparrowcode/AlertKit", - "state" : { - "revision" : "3d35de60ad26aab58395ebecdd63b533546862ed", - "version" : "5.1.8" - } - }, - { - "identity" : "alerttoast", - "kind" : "remoteSourceControl", - "location" : "https://github.com/elai950/AlertToast", - "state" : { - "revision" : "b39252eacd159904afd7d718bba0afabb87f2f2f", - "version" : "1.3.9" - } - }, - { - "identity" : "azvideoplayer", - "kind" : "remoteSourceControl", - "location" : "https://github.com/adamzarn/AZVideoPlayer", - "state" : { - "revision" : "e2dde8754ee34706cc69fa640cde85506e239742", - "version" : "1.0.0" - } - }, - { - "identity" : "darockkit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/Darock-Studio/DarockKit", - "state" : { - "branch" : "main", - "revision" : "b4d26e8c8c37572708f2aa13eb6377c55f18dabc" - } - }, - { - "identity" : "dynamic", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mhdhejazi/Dynamic", - "state" : { - "revision" : "ab9a2570862d54aed2663691bb767f881226a12f", - "version" : "1.2.0" - } - }, - { - "identity" : "efqrcode", - "kind" : "remoteSourceControl", - "location" : "https://github.com/EFPrefix/EFQRCode", - "state" : { - "revision" : "2991c2f318ad9529d93b2a73a382a3f9c72c64ce", - "version" : "6.2.2" - } - }, - { - "identity" : "libwebp-xcode", - "kind" : "remoteSourceControl", - "location" : "https://github.com/SDWebImage/libwebp-Xcode.git", - "state" : { - "revision" : "b2b1d20a90b14d11f6ef4241da6b81c1d3f171e4", - "version" : "1.3.2" - } - }, - { - "identity" : "marquee", - "kind" : "remoteSourceControl", - "location" : "https://github.com/SwiftUIKit/Marquee", - "state" : { - "revision" : "69d7b7c6c34ed41d9299cfa8406f91f529c4fef3", - "version" : "0.3.0" - } - }, - { - "identity" : "mixpanel-swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mixpanel/mixpanel-swift", - "state" : { - "branch" : "master", - "revision" : "9438b4a5f76bf2108b09f8fed1abbad8f353e1a2" - } - }, - { - "identity" : "screenshotableview", - "kind" : "remoteSourceControl", - "location" : "https://github.com/RickeyBoy/ScreenshotableView", - "state" : { - "revision" : "3c140215fb12c7e8aef78e853006110350455c5b", - "version" : "1.0.0" - } - }, - { - "identity" : "sdwebimage", - "kind" : "remoteSourceControl", - "location" : "https://github.com/SDWebImage/SDWebImage.git", - "state" : { - "revision" : "b11493f76481dff17ac8f45274a6b698ba0d3af5", - "version" : "5.18.11" - } - }, - { - "identity" : "sdwebimagepdfcoder", - "kind" : "remoteSourceControl", - "location" : "https://github.com/SDWebImage/SDWebImagePDFCoder", - "state" : { - "revision" : "2aecb0a16e4d054c7f36a140f7feef6e1ede7bb6", - "version" : "1.0.1" - } - }, - { - "identity" : "sdwebimagesvgcoder", - "kind" : "remoteSourceControl", - "location" : "https://github.com/SDWebImage/SDWebImageSVGCoder", - "state" : { - "revision" : "950167445ab703740569869c8b7510efc9d09a26", - "version" : "1.7.0" - } - }, - { - "identity" : "sdwebimageswiftui", - "kind" : "remoteSourceControl", - "location" : "https://github.com/SDWebImage/SDWebImageSwiftUI.git", - "state" : { - "revision" : "261b6cec35686d2dc192b809ab50742b4502a73b", - "version" : "2.2.6" - } - }, - { - "identity" : "sdwebimagewebpcoder", - "kind" : "remoteSourceControl", - "location" : "https://github.com/SDWebImage/SDWebImageWebPCoder", - "state" : { - "revision" : "8a33fb3ca75a01267f775f891f7d61f675e95072", - "version" : "0.14.5" - } - }, - { - "identity" : "sfsymbol", - "kind" : "remoteSourceControl", - "location" : "https://github.com/Nirma/SFSymbol", - "state" : { - "revision" : "1b127194b976a58ea460a2cbe10f00fa994b1ece", - "version" : "2.3.0" - } - }, - { - "identity" : "swift_qrcodejs", - "kind" : "remoteSourceControl", - "location" : "https://github.com/ApolloZhu/swift_qrcodejs.git", - "state" : { - "revision" : "374dc7f7b9e76c6aeb393f6a84590c6d387e1ecb", - "version" : "2.2.2" - } - }, - { - "identity" : "swiftdate", - "kind" : "remoteSourceControl", - "location" : "https://github.com/malcommac/SwiftDate", - "state" : { - "revision" : "5d943224c3bb173e6ecf27295611615eba90c80e", - "version" : "7.0.0" - } - }, - { - "identity" : "swiftsoup", - "kind" : "remoteSourceControl", - "location" : "https://github.com/scinfu/SwiftSoup", - "state" : { - "revision" : "1d39e56d364cba79ce43b341f9661b534cccb18d", - "version" : "2.7.1" - } - }, - { - "identity" : "swiftui-cached-async-image", - "kind" : "remoteSourceControl", - "location" : "https://github.com/lorenzofiamingo/swiftui-cached-async-image", - "state" : { - "revision" : "467a3d17479887943ab917a379e62bbaff60ac8a", - "version" : "2.1.1" - } - }, - { - "identity" : "swiftyjson", - "kind" : "remoteSourceControl", - "location" : "https://github.com/SwiftyJSON/SwiftyJSON.git", - "state" : { - "revision" : "2b6054efa051565954e1d2b9da831680026cd768", - "version" : "4.3.0" - } - }, - { - "identity" : "ziparchive", - "kind" : "remoteSourceControl", - "location" : "https://github.com/ZipArchive/ZipArchive", - "state" : { - "revision" : "79d4dc9729096c6ad83dd3cee2b9f354d1b4ab7b", - "version" : "2.5.5" - } - } - ], - "version" : 2 -} diff --git a/MeowBili/Bangumi/BangumiPlayerView.swift b/MeowBili/Bangumi/BangumiPlayerView.swift index 0341d520a..8a58d9856 100644 --- a/MeowBili/Bangumi/BangumiPlayerView.swift +++ b/MeowBili/Bangumi/BangumiPlayerView.swift @@ -108,7 +108,7 @@ struct BangumiPlayerView: View { } .ignoresSafeArea() #else - AZVideoPlayer(player: player, willBeginFullScreenPresentationWithAnimationCoordinator: willBeginFullScreen, willEndFullScreenPresentationWithAnimationCoordinator: willEndFullScreen) + AZVideoPlayer(player: player, willBeginFullScreenPresentationWithAnimationCoordinator: willBeginFullScreen, willEndFullScreenPresentationWithAnimationCoordinator: willEndFullScreen, pausesWhenFullScreenPlaybackEnds: false) #endif } .onAppear { @@ -137,10 +137,7 @@ struct BangumiPlayerView: View { willBeginFullScreenPresentation = true } func willEndFullScreen(_ playerViewController: AVPlayerViewController, _ coordinator: UIViewControllerTransitionCoordinator) { - // This is a static helper method provided by AZVideoPlayer to keep - // the video playing if it was playing when full screen presentation ended - AZVideoPlayer.continuePlayingIfPlaying(player, coordinator) + } #endif } - diff --git a/MeowBili/InMain/SearchView.swift b/MeowBili/InMain/SearchView.swift index 090a39d8d..0a5656158 100644 --- a/MeowBili/InMain/SearchView.swift +++ b/MeowBili/InMain/SearchView.swift @@ -60,9 +60,6 @@ struct SearchMainView: View { UserDefaults.standard.set([searchText] + searchHistory, forKey: "SearchHistory") } } - .onDisappear { - searchText = "" - } .onChange(of: searchText) { value in if value != "" { let headers: HTTPHeaders = [ diff --git a/MeowBili/Video/VideoDetailView.swift b/MeowBili/Video/VideoDetailView.swift index 69b660ab7..8138c9480 100644 --- a/MeowBili/Video/VideoDetailView.swift +++ b/MeowBili/Video/VideoDetailView.swift @@ -775,7 +775,6 @@ struct VideoDetailView: View { debugPrint(respJson) if !CheckBApiError(from: respJson) { return } videoDetails.updateValue(respJson["data"]["title"].string ?? "[加载失败]", forKey: "Title") - videoDetails.updateValue(respJson["data"]["pic"].string ?? "E", forKey: "Pic") videoDetails.updateValue(String(respJson["data"]["stat"]["view"].int ?? 0), forKey: "View") videoDetails.updateValue(String(respJson["data"]["stat"]["danmaku"].int ?? 0), forKey: "Danmaku") @@ -848,9 +847,7 @@ struct VideoDetailView: View { DecodeVideo() #else if recordHistoryTime == "into" { - AF.request("https://api.bilibili.com/x/click-interface/web/heartbeat", method: .post, parameters: ["bvid": videoDetails["BV"]!, "mid": dedeUserID, "type": 3, "dt": 2, "play_type": 2, "csrf": biliJct], headers: headers).response { response in - debugPrint(response) - } + AF.request("https://api.bilibili.com/x/click-interface/web/heartbeat", method: .post, parameters: ["bvid": videoDetails["BV"]!, "mid": dedeUserID, "type": 3, "dt": 2, "play_type": 2, "csrf": biliJct], headers: headers).response { _ in } } #endif diff --git a/MeowBili/Video/VideoPlayerView.swift b/MeowBili/Video/VideoPlayerView.swift index f8bb44543..516b9ab54 100644 --- a/MeowBili/Video/VideoPlayerView.swift +++ b/MeowBili/Video/VideoPlayerView.swift @@ -67,7 +67,7 @@ struct VideoPlayerView: View { var body: some View { Group { #if !os(watchOS) - AZVideoPlayer(player: player, willBeginFullScreenPresentationWithAnimationCoordinator: willBeginFullScreen, willEndFullScreenPresentationWithAnimationCoordinator: willEndFullScreen) + AZVideoPlayer(player: player, willBeginFullScreenPresentationWithAnimationCoordinator: willBeginFullScreen, willEndFullScreenPresentationWithAnimationCoordinator: willEndFullScreen, pausesWhenFullScreenPlaybackEnds: false) .overlay { ZStack { if isDanmakuEnabled { @@ -394,9 +394,7 @@ struct VideoPlayerView: View { willBeginFullScreenPresentation = true } func willEndFullScreen(_ playerViewController: AVPlayerViewController, _ coordinator: UIViewControllerTransitionCoordinator) { - // This is a static helper method provided by AZVideoPlayer to keep - // the video playing if it was playing when full screen presentation ended - AZVideoPlayer.continuePlayingIfPlaying(player, coordinator) + } struct StrokeText: View {