Improve NotificationPushRuleType protocol

This commit is contained in:
Alfonso Grillo
2023-02-02 15:33:20 +01:00
parent ddc268b01e
commit 11c3a1d880
5 changed files with 11 additions and 10 deletions
@@ -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
@@ -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
}