Skip to content

Commit

Permalink
Revert "Merge pull request #1702 from matrix-org/alfogrillo/sync_poll…
Browse files Browse the repository at this point in the history
…s_rules"

This reverts commit 9e36625, reversing
changes made to d772603.
  • Loading branch information
Anderas committed Feb 2, 2023
1 parent 97f7a52 commit ecee616
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
10 changes: 3 additions & 7 deletions MatrixSDK/NotificationCenter/MXNotificationCenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
#import "MXPushRuleConditionChecker.h"
#import "MXHTTPOperation.h"

@class MXSession;

MX_ASSUME_MISSING_NULLABILITY_BEGIN
@class MXSession;

/**
Posted when an existing push rule will be modified (pause, resume, delete) or when a new rule will be added.
Expand Down Expand Up @@ -198,9 +197,8 @@ extern NSString *const kMXNotificationCenterAllOtherRoomMessagesRuleID;
@param pushRule the push rule to update
@param enable YES to enable.
@param completion an optional completion block for the operation.
*/
- (void)enableRule:(MXPushRule*)pushRule isEnabled:(BOOL)enable completion:(nullable void (^)(NSError * _Nullable error))completion;
- (void)enableRule:(MXPushRule*)pushRule isEnabled:(BOOL)enable;

/**
Update the actions for an existing push rule.
Expand All @@ -210,14 +208,12 @@ extern NSString *const kMXNotificationCenterAllOtherRoomMessagesRuleID;
@param notify enable/disable notification.
@param soundName the name of the sound to apply (`ring`, `default`, etc).
@param highlight enable/disable highlight option.
@param completion an optional completion block for the operation.
*/
- (void)updatePushRuleActions:(NSString*)ruleId
kind:(MXPushRuleKind)kind
notify:(BOOL)notify
soundName:(NSString*)soundName
highlight:(BOOL)highlight
completion:(nullable void (^)(NSError * _Nullable error))completion;
highlight:(BOOL)highlight;

/**
Create a content push rule, see MXNotificationCenter notifications for operation result.
Expand Down
22 changes: 4 additions & 18 deletions MatrixSDK/NotificationCenter/MXNotificationCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ - (void)removeRule:(MXPushRule*)pushRule
}
}

- (void)enableRule:(MXPushRule*)pushRule isEnabled:(BOOL)enable completion:(nullable void (^)(NSError * _Nullable error))completion;
- (void)enableRule:(MXPushRule*)pushRule isEnabled:(BOOL)enable
{
if (pushRule)
{
Expand Down Expand Up @@ -426,15 +426,10 @@ - (void)enableRule:(MXPushRule*)pushRule isEnabled:(BOOL)enable completion:(null

[[NSNotificationCenter defaultCenter] postNotificationName:kMXNotificationCenterDidUpdateRules object:self userInfo:nil];

if (completion) {
completion(nil);
}
} failure:^(NSError *error) {

[[NSNotificationCenter defaultCenter] postNotificationName:kMXNotificationCenterDidFailRulesUpdate object:self userInfo:@{kMXNotificationCenterErrorKey:error}];

if (completion) {
completion(error);
}
}];
}
}
Expand All @@ -444,7 +439,6 @@ - (void)updatePushRuleActions:(NSString*)ruleId
notify:(BOOL)notify
soundName:(NSString*)soundName
highlight:(BOOL)highlight
completion:(nullable void (^)(NSError * _Nullable error))completion
{

NSArray *actions = [self encodeActionsWithNotify:notify soundName:soundName highlight:highlight];
Expand All @@ -456,20 +450,12 @@ - (void)updatePushRuleActions:(NSString*)ruleId
// Refresh locally rules
[self refreshRules:^{
[[NSNotificationCenter defaultCenter] postNotificationName:kMXNotificationCenterDidUpdateRules object:self userInfo:nil];
if (completion) {
completion(nil);
}
} failure:^(NSError *error) {
[[NSNotificationCenter defaultCenter] postNotificationName:kMXNotificationCenterDidFailRulesUpdate object:self userInfo:@{kMXNotificationCenterErrorKey:error}];
if (completion) {
completion(nil);
}
}];
} failure:^(NSError *error) {
}
failure:^(NSError *error) {
[[NSNotificationCenter defaultCenter] postNotificationName:kMXNotificationCenterDidFailRulesUpdate object:self userInfo:@{kMXNotificationCenterErrorKey:error}];
if (completion) {
completion(error);
}
}];
}

Expand Down
1 change: 0 additions & 1 deletion changelog.d/pr-1702.change

This file was deleted.

0 comments on commit ecee616

Please sign in to comment.