Fix vector-im/element-ios/issues/6004 - Reset home filters when switching tabs.

This commit is contained in:
Stefan Ceriu 2022-04-12 11:23:26 +03:00 committed by Stefan Ceriu
parent c4b4a33ffb
commit 671197699a
5 changed files with 30 additions and 3 deletions

View file

@ -64,10 +64,14 @@
[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];
}
}

View file

@ -112,6 +112,10 @@
{
// 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];
}
}

View file

@ -90,7 +90,16 @@
{
// 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];
}
}
}

View file

@ -72,7 +72,16 @@
{
// 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];
}
}
}

1
changelog.d/6004.bugfix Normal file
View file

@ -0,0 +1 @@
Reset home filters when switching tabs.