Skip to content

Commit

Permalink
Merge pull request #702 from matrix-org/riot_2591
Browse files Browse the repository at this point in the history
Aggregations: Expose reaction history API
  • Loading branch information
SBiOSoftWhare committed Jul 30, 2019
2 parents 31f1da7 + c938e21 commit 8531484
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Improvements:
* Soft logout: Handle new CS API error code (vector-im/riot-ios/issues/2584).
* MXRoomCreateContent - Update: Add missing fields `room_version` and `m.federate` (Note: `creator` field becomes optional (because of MSC2175)).
* Logs: Remove MXJSONModelSet warnings for MXRoomMemberEventContent and MXGroupProfile.
* Aggregations: Expose reaction history API.

Bug Fix:
* Crypto: Fix a race condition that prevented message from being sent (vector-im/riot-ios/issues/2541).
Expand Down
19 changes: 19 additions & 0 deletions MatrixSDK/Aggregations/MXAggregations.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,25 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)removeListener:(id)listener;

/**
Fetch reaction events for a given event.
@param eventId The id of the event.
@param roomId The id of the room.
@param from The `nextBatch` returned in the previous response.
@param limit (optional, use -1 to not defined this value) the maximum number of messages to return.
@param success A block object called when the operation succeeds. It provides a `MXAggregationPaginatedResponse` object.
@param failure A block object called when the operation fails.
@return a MXHTTPOperation instance.
*/
- (MXHTTPOperation*)reactionsEventsForEvent:(NSString*)eventId
inRoom:(NSString*)roomId
from:(nullable NSString*)from
limit:(NSUInteger)limit
success:(void (^)(MXAggregationPaginatedResponse *paginatedResponse))success
failure:(void (^)(NSError *error))failure;

#pragma mark - Edits

Expand Down
17 changes: 17 additions & 0 deletions MatrixSDK/Aggregations/MXAggregations.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ - (void)removeListener:(id)listener
}
}

- (MXHTTPOperation*)reactionsEventsForEvent:(NSString*)eventId
inRoom:(NSString*)roomId
from:(nullable NSString*)from
limit:(NSUInteger)limit
success:(void (^)(MXAggregationPaginatedResponse *paginatedResponse))success
failure:(void (^)(NSError *error))failure
{
return [self.mxSession.matrixRestClient relationsForEvent:eventId
inRoom:roomId
relationType:MXEventRelationTypeAnnotation
eventType:kMXEventTypeStringReaction
from:from
limit:limit
success:success
failure:failure];
}


#pragma mark - Edits

Expand Down

0 comments on commit 8531484

Please sign in to comment.