From e40be18306b9e95a5c7b75bb29f978aa288067d6 Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 29 Mar 2017 11:44:16 +0200 Subject: [PATCH] Public rooms: Support new directory search pagination & search APIs #628 ^ that was for ref. This commit improves comments. --- .../RoomList/PublicRoomsDirectoryDataSource.h | 15 ++++++++++----- .../RoomList/PublicRoomsDirectoryDataSource.m | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Riot/Model/RoomList/PublicRoomsDirectoryDataSource.h b/Riot/Model/RoomList/PublicRoomsDirectoryDataSource.h index b4b007029..62aa79ada 100644 --- a/Riot/Model/RoomList/PublicRoomsDirectoryDataSource.h +++ b/Riot/Model/RoomList/PublicRoomsDirectoryDataSource.h @@ -34,21 +34,23 @@ @interface PublicRoomsDirectoryDataSource : MXKDataSource /** - The number of rooms corresponding to the query. + The number of public rooms matching `searchPattern`. It is accurate only if 'moreThanRoomsCount' is NO. */ @property (nonatomic, readonly) NSUInteger roomsCount; /** In case of search with a lot of matching public rooms, we cannot return an accurate - value except by paginating the full list of rooms. + value except by paginating the full list of rooms, which is not expected. + This flag indicates that we know that there is more matching rooms than we got so far. */ @property (nonatomic, readonly) BOOL moreThanRoomsCount; /** - The maximum number of public rooms to retrieve during a pagination. Default is 20. + The maximum number of public rooms to retrieve during a pagination. + Default is 20. */ @property (nonatomic) NSUInteger paginationLimit; @@ -58,7 +60,10 @@ @property (nonatomic, readonly) BOOL hasReachedPaginationEnd; /** - The filter being applied. Nil if there is no filter. + The filter being applied. + + Nil if there is no filter; the data source will get all public rooms. + Default is nil. Setting a new value may trigger a request to the homeserver. So, the data source state may change to MXKDataSourceStatePreparing. @@ -66,7 +71,7 @@ @property (nonatomic) NSString *searchPattern; /** - Paginate more public rooms from the homeserver. + Paginate more public rooms matching `from the homeserver. @param success A block object called when the operation succeeds. It provides the number of got rooms. @param failure A block object called when the operation fails. diff --git a/Riot/Model/RoomList/PublicRoomsDirectoryDataSource.m b/Riot/Model/RoomList/PublicRoomsDirectoryDataSource.m index e5c5ad8aa..15a475649 100644 --- a/Riot/Model/RoomList/PublicRoomsDirectoryDataSource.m +++ b/Riot/Model/RoomList/PublicRoomsDirectoryDataSource.m @@ -129,7 +129,7 @@ double const kPublicRoomsDirectoryDataExpiration = 10; _moreThanRoomsCount = NO; _hasReachedPaginationEnd = NO; - // And do a single pagination so that we can have a self.roomsCount value + // And do a single pagination [self paginate:nil failure:nil]; }