2021-04-12 10:31:53 +02:00
|
|
|
//
|
|
|
|
// NotificationItem.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by sxiaojian on 2021/4/13.
|
|
|
|
//
|
|
|
|
|
|
|
|
import CoreData
|
2021-04-15 04:16:30 +02:00
|
|
|
import Foundation
|
2021-04-12 10:31:53 +02:00
|
|
|
|
|
|
|
enum NotificationItem {
|
2021-04-14 11:37:58 +02:00
|
|
|
case notification(objectID: NSManagedObjectID)
|
2021-04-12 10:31:53 +02:00
|
|
|
|
|
|
|
case bottomLoader
|
|
|
|
}
|
|
|
|
|
|
|
|
extension NotificationItem: Equatable {
|
|
|
|
static func == (lhs: NotificationItem, rhs: NotificationItem) -> Bool {
|
|
|
|
switch (lhs, rhs) {
|
|
|
|
case (.bottomLoader, .bottomLoader):
|
|
|
|
return true
|
2021-04-15 04:16:30 +02:00
|
|
|
case (.notification(let idLeft), .notification(let idRight)):
|
2021-04-12 10:31:53 +02:00
|
|
|
return idLeft == idRight
|
|
|
|
default:
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extension NotificationItem: Hashable {
|
|
|
|
func hash(into hasher: inout Hasher) {
|
|
|
|
switch self {
|
|
|
|
case .notification(let id):
|
|
|
|
hasher.combine(id)
|
|
|
|
case .bottomLoader:
|
|
|
|
hasher.combine(String(describing: NotificationItem.bottomLoader.self))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|