notify: add typesafe notifications
This commit is contained in:
26
damus/Notify/LogoutNotify.swift
Normal file
26
damus/Notify/LogoutNotify.swift
Normal 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: ()))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user