Do not show user indicators when the view controller is not visible

This commit is contained in:
Andy Uhnak
2022-03-10 15:33:50 +00:00
parent 6b068a6753
commit 863d7ca2bd
4 changed files with 24 additions and 4 deletions
@@ -64,6 +64,10 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
// when the user selects it.
UISearchBar *tableSearchBar;
// Flag determining whether the view controller is ready to use (potentially shared) user indicators
// depending on whether the controller is visible or not
BOOL isUserIndicatorEnabled;
// Observe kThemeServiceDidChangeThemeNotification to handle user interface theme change.
__weak id kThemeServiceDidChangeThemeNotificationObserver;
}
@@ -266,6 +270,8 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
[super viewWillAppear:animated];
[self.screenTracker trackScreen];
isUserIndicatorEnabled = YES;
// Reset back user interactions
self.userInteractionEnabled = YES;
@@ -317,6 +323,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
kMXNotificationCenterDidUpdateRulesObserver = nil;
}
isUserIndicatorEnabled = NO;
[self stopActivityIndicator];
}
@@ -2408,7 +2415,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
}
- (void)startActivityIndicatorWithLabel:(NSString *)label {
if (self.indicatorPresenter) {
if (self.indicatorPresenter && isUserIndicatorEnabled) {
[self.indicatorPresenter presentActivityIndicatorWithLabel:label];
} else {
[super startActivityIndicator];
@@ -2416,7 +2423,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
}
- (void)startActivityIndicator {
if (self.indicatorPresenter) {
if (self.indicatorPresenter && isUserIndicatorEnabled) {
[self.indicatorPresenter presentActivityIndicator];
} else {
[super startActivityIndicator];