Skip to content

Commit

Permalink
Merge pull request matrix-org#1809 from matrix-org/stefan/variousBugF…
Browse files Browse the repository at this point in the history
…ixes

Various bug fixes
  • Loading branch information
stefanceriu committed Aug 23, 2023
2 parents 71631c1 + ff18f2f commit 33b67a5
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 4 deletions.
8 changes: 6 additions & 2 deletions MatrixSDK/Background/MXBackgroundPushRulesManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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] = []
Expand Down Expand Up @@ -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:
Expand Down
18 changes: 17 additions & 1 deletion MatrixSDK/Data/Store/MXFileStore/MXFileStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion MatrixSDK/Space/MXSpace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions changelog.d/1810.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent keyed archiver encoding crashes when writing read receipts to the file store
1 change: 1 addition & 0 deletions changelog.d/7636.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix incoming push notifications not triggering sounds
1 change: 1 addition & 0 deletions changelog.d/pr-1809.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes power level events force unwrap crash

0 comments on commit 33b67a5

Please sign in to comment.