proper read state changes

This commit is contained in:
Ryan Nystrom
2017-06-30 22:33:52 -04:00
parent 1e49658f43
commit 36082fca4a
3 changed files with 11 additions and 5 deletions

View File

@@ -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
}
}

View File

@@ -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>

View File

@@ -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
}