Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various bug fixes #1809

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading