From b347849ce1ebeb9c7311514bbf6efde87dcb6f29 Mon Sep 17 00:00:00 2001 From: WindowsMEMZ Date: Sun, 18 Feb 2024 21:38:23 +0800 Subject: [PATCH] fix(iOS-Comments, Dynamic, VideoDetails): Fixed comments always show 'continue load' & VideoDetailView reload issue --- DarockBili.xcodeproj/project.pbxproj | 16 +++++----- .../xcschemes/MeowBili Watch App.xcscheme | 10 +++++-- .../xcshareddata/xcschemes/MeowBili.xcscheme | 7 +++++ Localizable.xcstrings | 9 ++++++ MeowBili/GlobalView/CommentsView.swift | 29 +++++++++++++------ MeowBili/InMain/SearchView.swift | 28 ++++++++++++++++++ MeowBili/MeowBiliApp.swift | 14 ++++----- MeowBili/PersonalCenter/UserDetailView.swift | 4 +-- MeowBili/UserDynamic/DynamicDetailView.swift | 7 +++++ MeowBili/UserDynamic/ImageViewerView.swift | 11 +++++++ .../UserDynamic/UserDynamicMainView.swift | 1 + MeowBili/Video/VideoDetailView.swift | 2 ++ 12 files changed, 110 insertions(+), 28 deletions(-) diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index f011ca491..010871b8f 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -1407,7 +1407,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 634; + CURRENT_PROJECT_VERSION = 643; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1453,7 +1453,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 634; + CURRENT_PROJECT_VERSION = 643; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1496,7 +1496,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 634; + CURRENT_PROJECT_VERSION = 643; DEVELOPMENT_ASSET_PATHS = "DarockBili\\ Watch\\ App/Preview\\ Content"; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1531,7 +1531,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 634; + CURRENT_PROJECT_VERSION = 643; DEVELOPMENT_ASSET_PATHS = "DarockBili\\ Watch\\ App/Preview\\ Content"; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1687,7 +1687,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 634; + CURRENT_PROJECT_VERSION = 643; DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1720,7 +1720,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 634; + CURRENT_PROJECT_VERSION = 643; DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1753,7 +1753,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 634; + CURRENT_PROJECT_VERSION = 643; DEVELOPMENT_TEAM = B57D8PP775; INFOPLIST_KEY_CFBundleDisplayName = DarockBili; MARKETING_VERSION = 1.0.0; @@ -1769,7 +1769,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 634; + CURRENT_PROJECT_VERSION = 643; DEVELOPMENT_TEAM = B57D8PP775; INFOPLIST_KEY_CFBundleDisplayName = DarockBili; MARKETING_VERSION = 1.0.0; diff --git a/DarockBili.xcodeproj/xcshareddata/xcschemes/MeowBili Watch App.xcscheme b/DarockBili.xcodeproj/xcshareddata/xcschemes/MeowBili Watch App.xcscheme index bdb199c6c..d96dc8339 100644 --- a/DarockBili.xcodeproj/xcshareddata/xcschemes/MeowBili Watch App.xcscheme +++ b/DarockBili.xcodeproj/xcshareddata/xcschemes/MeowBili Watch App.xcscheme @@ -71,8 +71,7 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" - allowLocationSimulation = "YES" - notificationPayloadFile = "PushNotificationPayload.apns"> + allowLocationSimulation = "YES"> + + + + + + + + Bool { - let audioSession = AVAudioSession.sharedInstance() - do { - try audioSession.setCategory(.playback) - try audioSession.setActive(true, options: []) - } catch { - print("Setting category to AVAudioSessionCategoryPlayback failed.") - } +// let audioSession = AVAudioSession.sharedInstance() +// do { +// try audioSession.setCategory(.playback) +// try audioSession.setActive(true, options: []) +// } catch { +// print("Setting category to AVAudioSessionCategoryPlayback failed.") +// } return true } diff --git a/MeowBili/PersonalCenter/UserDetailView.swift b/MeowBili/PersonalCenter/UserDetailView.swift index b81fab022..a5257e5c3 100644 --- a/MeowBili/PersonalCenter/UserDetailView.swift +++ b/MeowBili/PersonalCenter/UserDetailView.swift @@ -491,7 +491,7 @@ struct UserDetailView: View { "cookie": "SESSDATA=\(sessdata); buvid_fp=e651c1a382430ea93631e09474e0b395; buvid3=\(UuidInfoc.gen()); buvid4=buvid4-failed-1", //"origin": "https://space.bilibili.com", //"referer": "https://space.bilibili.com/\(uid)/video", - //"User-Agent": "Mozilla/5.0" // Bypass? drdar://gh/SocialSisterYi/bilibili-API-collect/issues/868/1859065874 + //"User-Agent": "Mozilla/5.0" // Bypass? rdar://gh/SocialSisterYi/bilibili-API-collect/issues/868#1859065874 "User-Agent": "Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", ] // FIXME: Official Wbi crypto logic for this request seems different from other APIs, some IP can get but some can't. It's hard to fix ~_~ @@ -525,7 +525,7 @@ struct UserDetailView: View { let headers: HTTPHeaders = [ "accept-language": "en,zh-CN;q=0.9,zh;q=0.8", "cookie": "SESSDATA=\(sessdata);buvid3=\(globalBuvid3); buvid4=\(globalBuvid4);", - "User-Agent": "Mozilla/5.0" // Bypass? drdar://gh/SocialSisterYi/bilibili-API-collect/issues/868/1859065874 + "User-Agent": "Mozilla/5.0" // Bypass? rdar://gh/SocialSisterYi/bilibili-API-collect/issues/868#1859065874 ] biliWbiSign(paramEncoded: "mid=\(uid)&ps=30&pn=\(articleNowPage)&sort=publish_time&platform=web".base64Encoded()) { signed in if let signed { diff --git a/MeowBili/UserDynamic/DynamicDetailView.swift b/MeowBili/UserDynamic/DynamicDetailView.swift index f336840a3..37150df87 100644 --- a/MeowBili/UserDynamic/DynamicDetailView.swift +++ b/MeowBili/UserDynamic/DynamicDetailView.swift @@ -224,15 +224,22 @@ struct DynamicDetailView: View { } } } + .padding() } .navigationTitle("动态详情") .navigationBarTitleDisplayMode(.inline) .tag(1) + .tabItem { + Label("内容", systemImage: "shippingbox.fill") + } if dynamicDetails["Type"]! as! BiliDynamicType == .text || dynamicDetails["Type"]! as! BiliDynamicType == .forward || dynamicDetails["Type"]! as! BiliDynamicType == .draw { CommentsView(oid: dynamicDetails["DynamicID"]! as! String, type: (dynamicDetails["Type"]! as! BiliDynamicType) == .draw ? 11 : 17) .navigationTitle("动态评论") .navigationBarTitleDisplayMode(.inline) .tag(2) + .tabItem { + Label("评论", systemImage: "bubble.left.and.text.bubble.right.fill") + } } } } diff --git a/MeowBili/UserDynamic/ImageViewerView.swift b/MeowBili/UserDynamic/ImageViewerView.swift index 45e651d40..a2dcd5c00 100644 --- a/MeowBili/UserDynamic/ImageViewerView.swift +++ b/MeowBili/UserDynamic/ImageViewerView.swift @@ -29,6 +29,17 @@ struct ImageViewerView: View { .scaledToFit() .frame(alignment: .center) .modifier(zoomable()) + .toolbar { + ToolbarItem(placement: .topBarTrailing) { + Button(action: { + let img = UIImage(data: try! Data(contentsOf: URL(string: url)!))! + UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil) + AlertKitAPI.present(title: "已保存", subtitle: "图片已保存到相册", icon: .done, style: .iOS17AppleMusic, haptic: .success) + }, label: { + Image(systemName: "square.and.arrow.down") + }) + } + } } } diff --git a/MeowBili/UserDynamic/UserDynamicMainView.swift b/MeowBili/UserDynamic/UserDynamicMainView.swift index 0f26881ae..942a03b16 100644 --- a/MeowBili/UserDynamic/UserDynamicMainView.swift +++ b/MeowBili/UserDynamic/UserDynamicMainView.swift @@ -265,6 +265,7 @@ struct UserDynamicMainView: View { ProgressView() } }) + .buttonStyle(.borderedProminent) } else { ProgressView() } diff --git a/MeowBili/Video/VideoDetailView.swift b/MeowBili/Video/VideoDetailView.swift index 64ddd0b0a..f2f3c2326 100644 --- a/MeowBili/Video/VideoDetailView.swift +++ b/MeowBili/Video/VideoDetailView.swift @@ -477,6 +477,8 @@ struct VideoDetailView: View { .navigationBarTitleDisplayMode(.inline) .scrollDismissesKeyboard(.immediately) .onAppear { + if isDecoded { return } // After user enter a new video then exit, this onAppear method will be re-call + let headers: HTTPHeaders = [ "cookie": "SESSDATA=\(sessdata)", "User-Agent": "Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"