mirror of
https://github.com/home-assistant/iOS.git
synced 2026-02-18 23:10:10 -06:00
Adds new fastlane lanes: - `fastlane lint` which checks the linters - `fastlane autocorrect` which applies the linters which can autocorrect (Rubocop, SwiftFormat) Adds a build step to the Codegen abstract target which runs SwiftFormat in lint mode, pointing out what it's going to change when run. Applies SwiftFormat to nearly all code -- exempts a few externally-sourced files and generated code.
29 lines
1.1 KiB
Swift
29 lines
1.1 KiB
Swift
import PromiseKit
|
|
import Shared
|
|
import UserNotifications
|
|
|
|
final class NotificationService: UNNotificationServiceExtension {
|
|
override func didReceive(
|
|
_ request: UNNotificationRequest,
|
|
withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void
|
|
) {
|
|
Current.Log.info("didReceive \(request), user info \(request.content.userInfo)")
|
|
|
|
Current.api.then(on: nil) { api in
|
|
NotificationAttachmentManager().content(from: request.content, api: api)
|
|
}.recover { error in
|
|
Current.Log.error("failed to get content, giving default: \(error)")
|
|
return .value(request.content)
|
|
}.done {
|
|
contentHandler($0)
|
|
}
|
|
}
|
|
|
|
override func serviceExtensionTimeWillExpire() {
|
|
// Called just before the extension will be terminated by the system.
|
|
// Use this as an opportunity to deliver your "best attempt" at modified content,
|
|
// otherwise the original push payload will be used.
|
|
Current.Log.warning("serviceExtensionTimeWillExpire")
|
|
}
|
|
}
|