Swift notification plugin (#436)

* 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
This commit is contained in:
Ross Savage
2024-08-30 09:20:13 +02:00
committed by GitHub
parent 0053007000
commit b493f3dc03
12 changed files with 600 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import Foundation
import os.log
#if DEBUG && true
fileprivate var logger = OSLog(
subsystem: Bundle.main.bundleIdentifier!,
category: "ServiceLogger"
)
#else
fileprivate var logger = OSLog.disabled
#endif
open class ServiceLogger {
var logStream: Logger?
init(logStream: Logger?) {
self.logStream = logStream
}
public func log(tag: String, line: String, level: String) {
if let logger = logStream {
logger.log(l: LogEntry(line: line, level: level))
} else {
switch(level) {
case "ERROR":
os_log("[%{public}@] %{public}@", log: logger, type: .error, tag, line)
break
case "INFO", "WARN":
os_log("[%{public}@] %{public}@", log: logger, type: .info, tag, line)
break
case "TRACE":
os_log("[%{public}@] %{public}@", log: logger, type: .debug, tag, line)
break
default:
os_log("[%{public}@] %{public}@", log: logger, type: .default, tag, line)
return
}
}
}
}