2022-05-29 03:00:17 +04:00

25 lines
714 B
Swift

import Foundation
import SwiftSignalKit
import Postbox
public extension TelegramEngine {
final class Notices {
private let account: Account
init(account: Account) {
self.account = account
}
public func set<T: Codable>(id: NoticeEntryKey, item: T?) -> Signal<Never, NoError> {
return self.account.postbox.transaction { transaction -> Void in
if let item = item, let entry = CodableEntry(item) {
transaction.setNoticeEntry(key: id, value: entry)
} else {
transaction.setNoticeEntry(key: id, value: nil)
}
}
|> ignoreValues
}
}
}