diff --git a/MatrixSDK/Background/MXBackgroundPushRulesManager.swift b/MatrixSDK/Background/MXBackgroundPushRulesManager.swift index da793d2eef..8c3d3bffc0 100644 --- a/MatrixSDK/Background/MXBackgroundPushRulesManager.swift +++ b/MatrixSDK/Background/MXBackgroundPushRulesManager.swift @@ -42,7 +42,9 @@ import Foundation } } - flatRules = tmpRules + // vector-im/element-ios/issues/7636 + // Intentionally disable new backend push rules as they're not handle properly and break notification sounds + flatRules = tmpRules.filter { $0.ruleId != ".m.rule.is_user_mention" && $0.ruleId != ".m.rule.is_room_mention" } } } private var flatRules: [MXPushRule] = [] @@ -129,7 +131,9 @@ import Foundation var conditionsOk: Bool = true var runEquivalent: Bool = false - guard let kind = MXPushRuleKind(identifier: rule.kind) else { continue } + guard let kind = MXPushRuleKind(identifier: rule.kind) else { + continue + } switch kind { case .override, .underride: diff --git a/MatrixSDK/Data/Store/MXFileStore/MXFileStore.m b/MatrixSDK/Data/Store/MXFileStore/MXFileStore.m index e2bfc932f1..5207df6c6a 100644 --- a/MatrixSDK/Data/Store/MXFileStore/MXFileStore.m +++ b/MatrixSDK/Data/Store/MXFileStore/MXFileStore.m @@ -2209,7 +2209,23 @@ - (void)saveReceipts // Store new data [self checkFolderExistenceForRoom:roomId forBackup:NO]; - [NSKeyedArchiver archiveRootObject:receiptsStore toFile:file]; + + NSError *error = nil; + NSData *result = [NSKeyedArchiver archivedDataWithRootObject:receiptsStore requiringSecureCoding:false error:&error]; + + if (error != nil) + { + MXLogErrorDetails(@"Failed archiving receipts store", error); + continue; + } + + [result writeToURL:[NSURL fileURLWithPath:file] options: NSDataWritingAtomic error: &error]; + + if (error != nil) + { + MXLogErrorDetails(@"Failed writing receipts store to file", error); + continue; + } } } } diff --git a/MatrixSDK/Space/MXSpace.swift b/MatrixSDK/Space/MXSpace.swift index 6c1533c436..c60312cde9 100644 --- a/MatrixSDK/Space/MXSpace.swift +++ b/MatrixSDK/Space/MXSpace.swift @@ -346,7 +346,11 @@ public class MXSpace: NSObject { /// /// - Returns: the mimnimum power level required to add a room to this space public func minimumPowerLevelForAddingRoom(with powerLevels: MXRoomPowerLevels) -> Int { - return powerLevels.events["m.space.child"] as? Int ?? powerLevels.stateDefault + guard let events = powerLevels.events else { + return powerLevels.stateDefault + } + + return events["m.space.child"] as? Int ?? powerLevels.stateDefault } // MARK: - Private diff --git a/changelog.d/1810.bugfix b/changelog.d/1810.bugfix new file mode 100644 index 0000000000..a81a4fd724 --- /dev/null +++ b/changelog.d/1810.bugfix @@ -0,0 +1 @@ +Prevent keyed archiver encoding crashes when writing read receipts to the file store \ No newline at end of file diff --git a/changelog.d/7636.bugfix b/changelog.d/7636.bugfix new file mode 100644 index 0000000000..b338f87889 --- /dev/null +++ b/changelog.d/7636.bugfix @@ -0,0 +1 @@ +Fix incoming push notifications not triggering sounds \ No newline at end of file diff --git a/changelog.d/pr-1809.bugfix b/changelog.d/pr-1809.bugfix new file mode 100644 index 0000000000..2991fed95c --- /dev/null +++ b/changelog.d/pr-1809.bugfix @@ -0,0 +1 @@ +Fixes power level events force unwrap crash \ No newline at end of file