Merge commit 'aaadcc73674cc8886e363693a7d7c08ac9b4f516' into feature/4260_merge_foss_1_10_2

# Conflicts:
#	Config/AppVersion.xcconfig
#	Podfile
#	Podfile.lock
#	Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	Riot/Managers/EncryptionKeyManager/EncryptionKeyManager.swift
#	Riot/Modules/Application/LegacyAppDelegate.m
#	Riot/Modules/Authentication/AuthenticationCoordinator.swift
#	Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift
#	Riot/Modules/ContextMenu/ActionProviders/RoomActionProvider.swift
#	Riot/Modules/Home/AllChats/AllChatsViewController.swift
#	Riot/Modules/Room/RoomInfo/RoomInfoCoordinator.swift
#	Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewController.swift
#	Riot/Modules/Room/Settings/RoomSettingsViewController.m
#	fastlane/Fastfile
This commit is contained in:
JanNiklas Grabowski
2023-02-15 14:56:55 +01:00
279 changed files with 7285 additions and 2433 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
@@ -16,10 +16,12 @@
import Foundation
struct MockNotificationPushRule: NotificationPushRuleType {
struct MockNotificationPushRule: NotificationPushRuleType, Equatable {
var ruleId: String!
var enabled: Bool
var ruleActions: NotificationActions? = NotificationStandardActions.notifyDefaultSound.actions
func matches(standardActions: NotificationStandardActions?) -> Bool {
false
standardActions?.actions == ruleActions
}
}
@@ -17,7 +17,7 @@
import Foundation
/// The actions defined on a push rule, used in the static push rule definitions.
struct NotificationActions {
struct NotificationActions: Equatable {
let notify: Bool
let highlight: Bool
let sound: String?
@@ -22,7 +22,7 @@ extension NotificationPushRuleId {
/// It is defined similarly across Web and Android.
/// - Parameter index: The notification index for which to get the actions for.
/// - Returns: The associated `NotificationStandardActions`.
func standardActions(for index: NotificationIndex) -> NotificationStandardActions? {
func standardActions(for index: NotificationIndex) -> NotificationStandardActions {
switch self {
case .containDisplayName:
switch index {
@@ -42,7 +42,7 @@ extension NotificationPushRuleId {
case .silent: return .notify
case .noisy: return .highlight
}
case .oneToOneRoom:
case .oneToOneRoom, .oneToOnePollStart, .msc3930oneToOnePollStart, .oneToOnePollEnd, .msc3930oneToOnePollEnd:
switch index {
case .off: return .dontNotify
case .silent: return .notify
@@ -54,7 +54,7 @@ extension NotificationPushRuleId {
case .silent: return .notify
case .noisy: return .notifyDefaultSound
}
case .allOtherMessages:
case .allOtherMessages, .pollStart, .msc3930pollStart, .pollEnd, .msc3930pollEnd:
switch index {
case .off: return .dontNotify
case .silent: return .notify
@@ -30,6 +30,18 @@ enum NotificationPushRuleId: String {
case allOtherMessages = ".m.rule.message"
case encrypted = ".m.rule.encrypted"
case keywords = "_keywords"
// poll started event
case pollStart = ".m.rule.poll_start"
case msc3930pollStart = ".org.matrix.msc3930.rule.poll_start"
// poll started event (one to one)
case oneToOnePollStart = ".m.rule.poll_start_one_to_one"
case msc3930oneToOnePollStart = ".org.matrix.msc3930.rule.poll_start_one_to_one"
// poll ended event
case pollEnd = ".m.rule.poll_end"
case msc3930pollEnd = ".org.matrix.msc3930.rule.poll_end"
// poll ended event (one to one)
case oneToOnePollEnd = ".m.rule.poll_end_one_to_one"
case msc3930oneToOnePollEnd = ".org.matrix.msc3930.rule.poll_end_one_to_one"
}
extension NotificationPushRuleId: Identifiable {
@@ -65,6 +77,20 @@ extension NotificationPushRuleId {
return VectorL10n.settingsEncryptedGroupMessages
case .keywords:
return VectorL10n.settingsMessagesContainingKeywords
case .pollStart, .msc3930pollStart, .oneToOnePollStart, .msc3930oneToOnePollStart, .pollEnd, .msc3930pollEnd, .oneToOnePollEnd, .msc3930oneToOnePollEnd:
// They don't need to be rendered on the UI
return ""
}
}
var syncedRules: [NotificationPushRuleId] {
switch self {
case .oneToOneRoom:
return [.oneToOnePollStart, .msc3930oneToOnePollStart, .oneToOnePollEnd, .msc3930oneToOnePollEnd]
case .allOtherMessages:
return [.pollStart, .msc3930pollStart, .pollEnd, .msc3930pollEnd]
default:
return []
}
}
}
@@ -19,5 +19,13 @@ import Foundation
protocol NotificationPushRuleType {
var ruleId: String! { get }
var enabled: Bool { get }
var ruleActions: NotificationActions? { get }
func matches(standardActions: NotificationStandardActions?) -> Bool
}
extension NotificationPushRuleType {
var pushRuleId: NotificationPushRuleId? {
ruleId.flatMap(NotificationPushRuleId.init(rawValue:))
}
}