From e1c16bf082753f9bbfa9cb640f5d7644003f7d06 Mon Sep 17 00:00:00 2001 From: giomfo Date: Thu, 2 Jun 2016 11:38:35 +0200 Subject: [PATCH] Directory item in search doesn't open the directory if I don't search https://github.com/vector-im/vector-ios/issues/353 --- .../RoomList/PublicRoomsDirectoryDataSource.m | 14 ++++++++++---- .../Views/RoomList/DirectoryRecentTableViewCell.m | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Vector/Model/RoomList/PublicRoomsDirectoryDataSource.m b/Vector/Model/RoomList/PublicRoomsDirectoryDataSource.m index 591791121..dd01d1953 100644 --- a/Vector/Model/RoomList/PublicRoomsDirectoryDataSource.m +++ b/Vector/Model/RoomList/PublicRoomsDirectoryDataSource.m @@ -82,10 +82,14 @@ double const kPublicRoomsDirectoryDataExpiration = 10; // Do not refresh data if it is not too old if (lastRefreshDate && -lastRefreshDate.timeIntervalSinceNow < kPublicRoomsDirectoryDataExpiration) { - // Apply the new filter on the current data - [self refreshFilteredPublicRooms]; - - [self setState:MXKDataSourceStateReady]; + // Do not disturb the current request if any + if (!publicRoomsRequest) + { + // Apply the new filter on the current data + [self refreshFilteredPublicRooms]; + + [self setState:MXKDataSourceStateReady]; + } } else { @@ -132,6 +136,7 @@ double const kPublicRoomsDirectoryDataExpiration = 10; [self setState:MXKDataSourceStateReady]; } failure:^(NSError *error) { + NSLog(@"[PublicRoomsDirectoryDataSource] Failed to fecth public rooms."); [self setState:MXKDataSourceStateFailed]; @@ -141,6 +146,7 @@ double const kPublicRoomsDirectoryDataExpiration = 10; // Alert user [[AppDelegate theDelegate] showErrorAsAlert:error]; + }]; } } diff --git a/Vector/Views/RoomList/DirectoryRecentTableViewCell.m b/Vector/Views/RoomList/DirectoryRecentTableViewCell.m index 1651eda27..1c82dd3b5 100644 --- a/Vector/Views/RoomList/DirectoryRecentTableViewCell.m +++ b/Vector/Views/RoomList/DirectoryRecentTableViewCell.m @@ -51,7 +51,7 @@ { self.titleLabel.text = NSLocalizedStringFromTable(@"directory_title", @"Vector", nil); self.descriptionLabel.text = [NSString stringWithFormat:NSLocalizedStringFromTable(@"directory_description", @"Vector", nil), - publicRoomsDirectoryDataSource.filteredRooms.count]; + publicRoomsDirectoryDataSource.rooms.count]; }