Skip to content

Commit

Permalink
群组折叠查看更多按钮改为查看全部
Browse files Browse the repository at this point in the history
  • Loading branch information
Finb committed Dec 30, 2024
1 parent eb77151 commit c1c7ba3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
20 changes: 10 additions & 10 deletions Bark/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -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" : "查看所有铃声"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Controller/MessageListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
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
}
Expand Down
3 changes: 3 additions & 0 deletions Model/MessageSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion View/MessageList/MessageGroupMoreView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MessageGroupMoreView: UIView {

var count: Int = 0 {
didSet {
moreLabel.text = NSLocalizedString("viewMoreMessages").format(count)
moreLabel.text = NSLocalizedString("viewAllMessages").format(count)
}
}

Expand Down
14 changes: 5 additions & 9 deletions View/MessageList/MessageTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ class MessageGroupTableViewCell: UITableViewCell {
}

/// 剩余消息数量
private var moreCount: Int = 0 {
private var totalCount: Int = 0 {
didSet {
moreView.count = moreCount
moreView.count = totalCount
}
}

Expand All @@ -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 ?? []
}
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c1c7ba3

Please sign in to comment.