mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-05-10 12:54:15 +08:00
proper read state changes
This commit is contained in:
@@ -14,7 +14,6 @@ final class NotificationSectionController: ListGenericSectionController<Notifica
|
||||
SwipeCollectionViewCellDelegate {
|
||||
|
||||
private let client: NotificationClient
|
||||
private var opened = false
|
||||
|
||||
init(client: NotificationClient) {
|
||||
self.client = client
|
||||
@@ -33,7 +32,9 @@ SwipeCollectionViewCellDelegate {
|
||||
else { fatalError("Collection context must be set, missing object, or cell incorrect type") }
|
||||
cell.delegate = self
|
||||
cell.configure(object)
|
||||
cell.isRead = opened || object.read
|
||||
|
||||
cell.isRead = object.read || client.optimisticReadIDs.contains(object.id)
|
||||
|
||||
return cell
|
||||
}
|
||||
|
||||
@@ -42,9 +43,7 @@ SwipeCollectionViewCellDelegate {
|
||||
guard let cell = collectionContext?.cellForItem(at: index, sectionController: self) as? NotificationCell
|
||||
else { fatalError("Cell missing or incorrect type") }
|
||||
|
||||
opened = true
|
||||
cell.isRead = true
|
||||
|
||||
client.markNotificationRead(id: object.id, optimistic: false)
|
||||
|
||||
let controller = NavigateToNotificationContent(object: object, client: client.githubClient)
|
||||
@@ -78,4 +77,10 @@ SwipeCollectionViewCellDelegate {
|
||||
return [action]
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, editActionsOptionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeTableOptions {
|
||||
var options = SwipeTableOptions()
|
||||
options.expansionStyle = .destructive
|
||||
return options
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>220</string>
|
||||
<string>222</string>
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
<array>
|
||||
<string>org-appextension-feature-password-management</string>
|
||||
|
||||
@@ -46,6 +46,7 @@ class MailCollectioViewController: UICollectionViewController, UICollectionViewD
|
||||
cell.subjectLabel.text = email.subject
|
||||
cell.bodyLabel.text = email.body
|
||||
cell.unread = email.unread
|
||||
cell.canDelete = true
|
||||
|
||||
return cell
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user