notify: add typesafe notifications

This commit is contained in:
William Casarin
2023-07-30 10:48:56 -07:00
parent df3b94a1fc
commit 80063af19a
28 changed files with 795 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
//
// LogoutNotify.swift
// damus
//
// Created by William Casarin on 2023-07-30.
//
import Foundation
struct LogoutNotify: Notify {
typealias Payload = ()
var payload: ()
}
extension NotifyHandler {
static var logout: NotifyHandler<LogoutNotify> {
.init()
}
}
extension Notifications {
/// Sign out of damus. Goes back to the login screen.
static var logout: Notifications<LogoutNotify> {
.init(.init(payload: ()))
}
}