From 4cf0da6c19ecb80e73cfcd0fdc6eaea6133edfff Mon Sep 17 00:00:00 2001 From: WindowsMEMZ Date: Mon, 29 Jul 2024 00:28:47 +0800 Subject: [PATCH] feat: Show pictures in comment --- DarockBili.xcodeproj/project.pbxproj | 2 +- Localizable.xcstrings | 3 --- MeowBili/Extension/CodeExt.swift | 6 ++++++ MeowBili/GlobalView/CommentsView.swift | 23 ++++++++++++++++++++++- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index c5291d0c3..1f901aa83 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 56; + objectVersion = 70; objects = { /* Begin PBXAggregateTarget section */ diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 3f5ed5984..41b68437f 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -8941,9 +8941,6 @@ } } } - }, - "手记建议" : { - }, "扩展的触感反馈" : { "localizations" : { diff --git a/MeowBili/Extension/CodeExt.swift b/MeowBili/Extension/CodeExt.swift index 112a32009..28191fbe0 100644 --- a/MeowBili/Extension/CodeExt.swift +++ b/MeowBili/Extension/CodeExt.swift @@ -638,3 +638,9 @@ public func debugPrint(_ items: Any..., separator: String = " ", terminator: Str } } } + +extension String: @retroactive Identifiable { + public var id: Self { + self + } +} diff --git a/MeowBili/GlobalView/CommentsView.swift b/MeowBili/GlobalView/CommentsView.swift index f2497dc4a..2ca91fedd 100644 --- a/MeowBili/GlobalView/CommentsView.swift +++ b/MeowBili/GlobalView/CommentsView.swift @@ -44,6 +44,7 @@ struct CommentsView: View { @State var presentRepliesGoto = "" @State var presentRepliesRootData = [String: String]() @State var isCommentRepliesPresented = false + @State var presentImageItem: String? var body: some View { ScrollView { LazyVStack { @@ -93,6 +94,19 @@ struct CommentsView: View { #endif Spacer() } + if !comments[i]["Pictures"]!.isEmpty { + let picUrls = comments[i]["Pictures"]!.components(separatedBy: "|") + ForEach(0..