mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 00:52:43 +02:00
Improve NotificationPushRuleType protocol
This commit is contained in:
+4
@@ -41,6 +41,10 @@ extension MXPushRule: NotificationPushRuleType {
|
||||
return false
|
||||
}
|
||||
|
||||
var ruleActions: NotificationActions? {
|
||||
.init(notify: notify, highlight: highlight, sound: sound)
|
||||
}
|
||||
|
||||
private func getAction(actionType: MXPushRuleActionType, tweakType: String? = nil) -> MXPushRuleAction? {
|
||||
guard let actions = actions as? [MXPushRuleAction] else {
|
||||
return nil
|
||||
|
||||
+2
-2
@@ -19,9 +19,9 @@ import Foundation
|
||||
struct MockNotificationPushRule: NotificationPushRuleType {
|
||||
var ruleId: String!
|
||||
var enabled: Bool
|
||||
var actions: NotificationActions? = NotificationStandardActions.notifyDefaultSound.actions
|
||||
var ruleActions: NotificationActions? = NotificationStandardActions.notifyDefaultSound.actions
|
||||
|
||||
func matches(standardActions: NotificationStandardActions?) -> Bool {
|
||||
standardActions?.actions == actions
|
||||
standardActions?.actions == ruleActions
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ import Foundation
|
||||
protocol NotificationPushRuleType {
|
||||
var ruleId: String! { get }
|
||||
var enabled: Bool { get }
|
||||
var ruleActions: NotificationActions? { get }
|
||||
|
||||
func matches(standardActions: NotificationStandardActions?) -> Bool
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user