From c1c7ba3b3105b4c27baf2ca62856b22dbc9380bd Mon Sep 17 00:00:00 2001 From: Fin Date: Mon, 30 Dec 2024 10:45:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=A4=E7=BB=84=E6=8A=98=E5=8F=A0=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E6=9B=B4=E5=A4=9A=E6=8C=89=E9=92=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E5=85=A8=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bark/Localizable.xcstrings | 20 ++++++++++---------- Controller/MessageListViewController.swift | 2 +- Model/MessageSection.swift | 3 +++ View/MessageList/MessageGroupMoreView.swift | 2 +- View/MessageList/MessageTableViewCell.swift | 14 +++++--------- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Bark/Localizable.xcstrings b/Bark/Localizable.xcstrings index 7649d3df..a48a9b18 100644 --- a/Bark/Localizable.xcstrings +++ b/Bark/Localizable.xcstrings @@ -3151,48 +3151,48 @@ } } }, - "viewAllSounds" : { + "viewAllMessages" : { "extractionState" : "manual", "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "Click here to view all available sounds." + "value" : "View all %d messages" } }, "tr" : { "stringUnit" : { - "state" : "translated", - "value" : "Mevcut tüm sesleri görüntülemek için buraya tıklayın." + "state" : "needs_review", + "value" : "Tüm %d mesajı görüntüle" } }, "zh-Hans" : { "stringUnit" : { - "state" : "translated", - "value" : "查看所有铃声" + "state" : "needs_review", + "value" : "查看全部%d条消息" } } } }, - "viewMoreMessages" : { + "viewAllSounds" : { "extractionState" : "manual", "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "View %d More Messages" + "value" : "Click here to view all available sounds." } }, "tr" : { "stringUnit" : { "state" : "translated", - "value" : "%d Daha Mesaj Görüntüle" + "value" : "Mevcut tüm sesleri görüntülemek için buraya tıklayın." } }, "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "查看更多%d条消息" + "value" : "查看所有铃声" } } } diff --git a/Controller/MessageListViewController.swift b/Controller/MessageListViewController.swift index 5695b304..c4eda13a 100644 --- a/Controller/MessageListViewController.swift +++ b/Controller/MessageListViewController.swift @@ -171,7 +171,7 @@ class MessageListViewController: BaseViewController { guard let self else { return } self.alertMessage(message: message.attributedText?.string ?? "", sourceView: sourceView) } - cell.cellData = (title, max(0, totalCount - messages.count), messages) + cell.cellData = (title, totalCount, messages) cell.isExpanded = self.expandedGroup.contains(title) return cell } diff --git a/Model/MessageSection.swift b/Model/MessageSection.swift index 56fceef0..45bc3cb4 100644 --- a/Model/MessageSection.swift +++ b/Model/MessageSection.swift @@ -28,6 +28,9 @@ enum MessageListCellItem: Equatable { if lMessages.first?.dateText != rMessages.first?.dateText { return false } + if lMessages.count != rMessages.count { + return false + } for (lMessage, rMessage) in zip(lMessages, rMessages) { if lMessage.id != rMessage.id { return false diff --git a/View/MessageList/MessageGroupMoreView.swift b/View/MessageList/MessageGroupMoreView.swift index 65169b8f..c18f27ac 100644 --- a/View/MessageList/MessageGroupMoreView.swift +++ b/View/MessageList/MessageGroupMoreView.swift @@ -25,7 +25,7 @@ class MessageGroupMoreView: UIView { var count: Int = 0 { didSet { - moreLabel.text = NSLocalizedString("viewMoreMessages").format(count) + moreLabel.text = NSLocalizedString("viewAllMessages").format(count) } } diff --git a/View/MessageList/MessageTableViewCell.swift b/View/MessageList/MessageTableViewCell.swift index 40189a92..921809c8 100644 --- a/View/MessageList/MessageTableViewCell.swift +++ b/View/MessageList/MessageTableViewCell.swift @@ -95,9 +95,9 @@ class MessageGroupTableViewCell: UITableViewCell { } /// 剩余消息数量 - private var moreCount: Int = 0 { + private var totalCount: Int = 0 { didSet { - moreView.count = moreCount + moreView.count = totalCount } } @@ -115,10 +115,10 @@ class MessageGroupTableViewCell: UITableViewCell { } } - var cellData: (groupName: String?, moreCount: Int, messages: [MessageItemModel])? { + var cellData: (groupName: String?, totalCount: Int, messages: [MessageItemModel])? { didSet { groupName = cellData?.groupName ?? "" - moreCount = cellData?.moreCount ?? 0 + totalCount = cellData?.totalCount ?? 0 messages = cellData?.messages ?? [] } } @@ -236,11 +236,7 @@ class MessageGroupTableViewCell: UITableViewCell { make.top.equalTo(messageViews[index - 1].snp.bottom).offset(8) } if index == maxCount - 1 { - if moreCount > 0 { - make.bottom.equalTo(moreView.snp.top).offset(-18) - } else { - make.bottom.equalToSuperview().offset(-18) - } + make.bottom.equalTo(moreView.snp.top).offset(-18) } item.transform = .identity } else {