Skip to content

Commit

Permalink
Fix /issues/6004 - Reset home filters when switching tabs.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Apr 12, 2022
1 parent 87e3c64 commit 4bdef90
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Riot/Modules/Favorites/FavouritesViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ - (void)viewWillAppear:(BOOL)animated
[super viewWillAppear:animated];
[AppDelegate theDelegate].masterTabBarController.tabBar.tintColor = ThemeService.shared.theme.tintColor;

if (recentsDataSource)
if (recentsDataSource.recentsDataSourceMode != RecentsDataSourceModeFavourites)
{
// Take the lead on the shared data source.
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModeFavourites];

// Reset filtering on the shared data source when switching tabs
[recentsDataSource searchWithPatterns:nil];
[self.recentsSearchBar setText:nil];
}
}

Expand Down
4 changes: 4 additions & 0 deletions Riot/Modules/Home/HomeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ - (void)viewWillAppear:(BOOL)animated
{
// Take the lead on the shared data source.
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModeHome];

// Reset filtering on the shared data source when switching tabs
[self searchBarCancelButtonClicked:self.recentsSearchBar];
[self.recentsSearchBar setText:nil];
}
}

Expand Down
11 changes: 10 additions & 1 deletion Riot/Modules/People/PeopleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,16 @@ - (void)viewWillAppear:(BOOL)animated
{
// Take the lead on the shared data source.
recentsDataSource = (RecentsDataSource*)self.dataSource;
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModePeople];

if (recentsDataSource.recentsDataSourceMode != RecentsDataSourceModePeople)
{
// Take the lead on the shared data source.
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModePeople];

// Reset filtering on the shared data source when switching tabs
[recentsDataSource searchWithPatterns:nil];
[self.recentsSearchBar setText:nil];
}
}
}

Expand Down
11 changes: 10 additions & 1 deletion Riot/Modules/Rooms/RoomsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,16 @@ - (void)viewWillAppear:(BOOL)animated
{
// Take the lead on the shared data source.
recentsDataSource = (RecentsDataSource*)self.dataSource;
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModeRooms];

if (recentsDataSource.recentsDataSourceMode != RecentsDataSourceModeRooms)
{
// Take the lead on the shared data source.
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModeRooms];

// Reset filtering on the shared data source when switching tabs
[recentsDataSource searchWithPatterns:nil];
[self.recentsSearchBar setText:nil];
}
}
}

Expand Down
1 change: 1 addition & 0 deletions changelog.d/6004.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reset home filters when switching tabs.

0 comments on commit 4bdef90

Please sign in to comment.