mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2025-12-22 00:14:25 +01:00
* Add Swift notification plugin * Hash the metadata * Validate min sendable amount * Remove initializer as base class, UNNotificationServiceExtension, has no default initializer * Set the PaymentMethod * Handle PaymentDetails in SwapUpdated * Improve payment text
34 lines
1.0 KiB
Swift
34 lines
1.0 KiB
Swift
import UserNotifications
|
|
|
|
public protocol TaskProtocol : EventListener {
|
|
var payload: String { get set }
|
|
var contentHandler: ((UNNotificationContent) -> Void)? { get set }
|
|
var bestAttemptContent: UNMutableNotificationContent? { get set }
|
|
|
|
func start(liquidSDK: BindingLiquidSdk) throws
|
|
func onShutdown()
|
|
}
|
|
|
|
extension TaskProtocol {
|
|
func displayPushNotification(title: String, body: String? = nil, logger: ServiceLogger, threadIdentifier: String? = nil) {
|
|
logger.log(tag: "TaskProtocol", line:"displayPushNotification \(title)", level: "INFO")
|
|
guard
|
|
let contentHandler = contentHandler,
|
|
let bestAttemptContent = bestAttemptContent
|
|
else {
|
|
return
|
|
}
|
|
|
|
if let body = body {
|
|
bestAttemptContent.body = body
|
|
}
|
|
|
|
if let threadIdentifier = threadIdentifier {
|
|
bestAttemptContent.threadIdentifier = threadIdentifier
|
|
}
|
|
|
|
bestAttemptContent.title = title
|
|
contentHandler(bestAttemptContent)
|
|
}
|
|
}
|