Skip to content

Commit

Permalink
Merge pull request matrix-org#1798 from matrix-org/release/0.26.11/re…
Browse files Browse the repository at this point in the history
…lease

Release 0.26.11
  • Loading branch information
Velin92 committed Jun 13, 2023
2 parents 417ebda + e3ec1eb commit e003a30
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 19 deletions.
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## Changes in 0.26.11 (2023-06-13)

🙌 Improvements

- MSC3912 implementation: the stable property with_relations has been renamed with_rel_types ([#7563](https://github.com/vector-im/element-ios/issues/7563))
- Updated Jitsi meet sdk to 8.1.2-lite. ([#7565](https://github.com/vector-im/element-ios/issues/7565))
- MSC3987 implementation: the 'dont_notify' action for a push_rule is now deprecated and replaced by an empty action list. ([#7576](https://github.com/vector-im/element-ios/issues/7576))

🐛 Bugfixes

- Fixes a bug where an unhelpful message is shown rather than the threads empty state. ([#7551](https://github.com/vector-im/element-ios/issues/7551))


## Changes in 0.26.10 (2023-05-16)

🙌 Improvements
Expand Down
4 changes: 2 additions & 2 deletions MatrixSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "MatrixSDK"
s.version = "0.26.10"
s.version = "0.26.11"
s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)"

s.description = <<-DESC
Expand Down Expand Up @@ -62,7 +62,7 @@ Pod::Spec.new do |s|

# Use WebRTC framework included in Jitsi Meet SDK
# Use the lite version so we don't add a dependency on Giphy.
ss.ios.dependency 'JitsiMeetSDKLite', '7.0.1-lite'
ss.ios.dependency 'JitsiMeetSDKLite', '8.1.2-lite'
end

end
6 changes: 6 additions & 0 deletions MatrixSDK/Background/MXBackgroundPushRulesManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ import Foundation
return false
}

// Support for MSC3987: The dont_notify push rule action is deprecated.
if rule.actions.isEmpty {
return rule.enabled
}

// Compatibility support.
for ruleAction in rule.actions {
guard let action = ruleAction as? MXPushRuleAction else { continue }
if action.actionType == MXPushRuleActionTypeDontNotify {
Expand Down
14 changes: 11 additions & 3 deletions MatrixSDK/JSONModels/Aggregations/MXAggregationPaginatedResponse.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,20 @@ + (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary
MXAggregationPaginatedResponse *paginatedResponse;

NSArray<MXEvent*> *chunk;
MXJSONModelSetMXJSONModelArray(chunk, MXEvent.class, JSONDictionary[@"chunk"])

NSArray *chunkJson = JSONDictionary[@"chunk"];

// For some reason modelsFromJSON returns nil if you pass it an empty array.
// In this case we want an empty array or we get an error.
if([chunkJson isKindOfClass:NSArray.class] && chunkJson.count == 0)
{
chunk = @[];
} else {
MXJSONModelSetMXJSONModelArray(chunk, MXEvent.class, chunkJson)
}

if (chunk)
{
paginatedResponse = [MXAggregationPaginatedResponse new];

paginatedResponse->_chunk = chunk;
MXJSONModelSetString(paginatedResponse->_nextBatch, JSONDictionary[@"next_batch"])

Expand Down
16 changes: 8 additions & 8 deletions MatrixSDK/MXRestClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -1816,43 +1816,43 @@ - (MXHTTPOperation *)addPushRule:(NSString*)ruleId
{
case MXPushRuleKindOverride:
kindString = @"override";
if (conditions.count && actions.count)
if (conditions.count && actions)
{
content = @{@"conditions": conditions, @"actions": actions};
}
else if (actions.count)
else if (actions)
{
content = @{@"actions": actions};
}
break;
case MXPushRuleKindContent:
kindString = @"content";
if (pattern.length && actions.count)
if (pattern.length && actions)
{
content = @{@"pattern": pattern, @"actions": actions};
}
break;
case MXPushRuleKindRoom:
kindString = @"room";
if (actions.count)
if (actions)
{
content = @{@"actions": actions};
}
break;
case MXPushRuleKindSender:
kindString = @"sender";
if (actions.count)
if (actions)
{
content = @{@"actions": actions};
}
break;
case MXPushRuleKindUnderride:
kindString = @"underride";
if (conditions.count && actions.count)
if (conditions.count && actions)
{
content = @{@"conditions": conditions, @"actions": actions};
}
else if (actions.count)
else if (actions)
{
content = @{@"actions": actions};
}
Expand Down Expand Up @@ -3077,7 +3077,7 @@ - (MXHTTPOperation*)redactEvent:(NSString*)eventId

if (relations && [relations count] > 0)
{
NSString* property = withRelationsIsStable ? @"with_relations" : @"org.matrix.msc3912.with_relations";
NSString* property = withRelationsIsStable ? @"with_rel_types" : @"org.matrix.msc3912.with_relations";
parameters[property] = relations;
}

Expand Down
2 changes: 1 addition & 1 deletion MatrixSDK/MatrixSDKVersion.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

#import <Foundation/Foundation.h>

NSString *const MatrixSDKVersion = @"0.26.10";
NSString *const MatrixSDKVersion = @"0.26.11";
8 changes: 3 additions & 5 deletions MatrixSDK/NotificationCenter/MXNotificationCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ - (NSArray*)encodeActionsWithNotify:(BOOL)notify
highlight:(BOOL)highlight
{
NSMutableArray *actions = [NSMutableArray array];
// Support for MSC3987: The dont_notify push rule action is deprecated and replaced by an empty actions list.
if (notify)
{
[actions addObject:@"notify"];
Expand All @@ -597,10 +598,6 @@ - (NSArray*)encodeActionsWithNotify:(BOOL)notify
[actions addObject:@{@"set_tweak": @"highlight", @"value": @NO}];
}
}
else
{
[actions addObject:@"dont_notify"];
}
return actions;
}

Expand All @@ -615,7 +612,8 @@ - (void)shouldNotify:(MXEvent*)event roomState:(MXRoomState*)roomState
if (rule)
{
// Make sure this is not a rule to prevent from generating a notification
BOOL actionNotify = YES;
// Support for MSC3987: The dont_notify push rule action is deprecated and replaced by an empty actions list.
BOOL actionNotify = (rule.actions.count > 0);
if (1 == rule.actions.count)
{
MXPushRuleAction *action = rule.actions[0];
Expand Down
6 changes: 6 additions & 0 deletions MatrixSDK/Space/MXSpaceNotificationCounter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ public class MXSpaceNotificationCounter: NSObject {
continue
}

// Support for MSC3987: The dont_notify push rule action is deprecated.
if rule.actions.isEmpty {
return rule.enabled
}

// Compatibility support.
for ruleAction in ruleActions where ruleAction.actionType == MXPushRuleActionTypeDontNotify {
return rule.enabled
}
Expand Down

0 comments on commit e003a30

Please sign in to comment.