Skip to content

Commit 6711976

Browse files
committed
Fix /issues/6004 - Reset home filters when switching tabs.
1 parent c4b4a33 commit 6711976

File tree

5 files changed

+30
-3
lines changed

5 files changed

+30
-3
lines changed

Riot/Modules/Favorites/FavouritesViewController.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,14 @@ - (void)viewWillAppear:(BOOL)animated
6464
[super viewWillAppear:animated];
6565
[AppDelegate theDelegate].masterTabBarController.tabBar.tintColor = ThemeService.shared.theme.tintColor;
6666

67-
if (recentsDataSource)
67+
if (recentsDataSource.recentsDataSourceMode != RecentsDataSourceModeFavourites)
6868
{
6969
// Take the lead on the shared data source.
7070
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModeFavourites];
71+
72+
// Reset filtering on the shared data source when switching tabs
73+
[recentsDataSource searchWithPatterns:nil];
74+
[self.recentsSearchBar setText:nil];
7175
}
7276
}
7377

Riot/Modules/Home/HomeViewController.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ - (void)viewWillAppear:(BOOL)animated
112112
{
113113
// Take the lead on the shared data source.
114114
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModeHome];
115+
116+
// Reset filtering on the shared data source when switching tabs
117+
[self searchBarCancelButtonClicked:self.recentsSearchBar];
118+
[self.recentsSearchBar setText:nil];
115119
}
116120
}
117121

Riot/Modules/People/PeopleViewController.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,16 @@ - (void)viewWillAppear:(BOOL)animated
9090
{
9191
// Take the lead on the shared data source.
9292
recentsDataSource = (RecentsDataSource*)self.dataSource;
93-
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModePeople];
93+
94+
if (recentsDataSource.recentsDataSourceMode != RecentsDataSourceModePeople)
95+
{
96+
// Take the lead on the shared data source.
97+
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModePeople];
98+
99+
// Reset filtering on the shared data source when switching tabs
100+
[recentsDataSource searchWithPatterns:nil];
101+
[self.recentsSearchBar setText:nil];
102+
}
94103
}
95104
}
96105

Riot/Modules/Rooms/RoomsViewController.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,16 @@ - (void)viewWillAppear:(BOOL)animated
7272
{
7373
// Take the lead on the shared data source.
7474
recentsDataSource = (RecentsDataSource*)self.dataSource;
75-
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModeRooms];
75+
76+
if (recentsDataSource.recentsDataSourceMode != RecentsDataSourceModeRooms)
77+
{
78+
// Take the lead on the shared data source.
79+
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModeRooms];
80+
81+
// Reset filtering on the shared data source when switching tabs
82+
[recentsDataSource searchWithPatterns:nil];
83+
[self.recentsSearchBar setText:nil];
84+
}
7685
}
7786
}
7887

changelog.d/6004.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Reset home filters when switching tabs.

0 commit comments

Comments
 (0)