Merge pull request #5580 from vector-im/andy/4829_activity_indicators

Add new loading indicator on Home screen
This commit is contained in:
Anderas
2022-02-16 15:11:15 +00:00
committed by GitHub
19 changed files with 431 additions and 190 deletions
@@ -29,6 +29,11 @@
{
[super viewDidLoad];
if ([self providesCustomActivityIndicator]) {
// If a subclass provides custom activity indicator, the default one will not even be initialized.
return;
}
// Add default activity indicator
activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
activityIndicator.backgroundColor = [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:1.0];
@@ -56,9 +61,13 @@
#pragma mark - Activity indicator
- (BOOL)providesCustomActivityIndicator {
return NO;
}
- (void)startActivityIndicator
{
if (activityIndicator)
if (activityIndicator && ![self providesCustomActivityIndicator])
{
[self.view bringSubviewToFront:activityIndicator];
[activityIndicator startAnimating];
@@ -79,5 +88,4 @@
[activityIndicator stopAnimating];
}
@end
@@ -220,7 +220,7 @@
if ([MXKRoomDataSourceManager sharedManagerForMatrixSession:mxSession].isServerSyncInProgress)
{
// sync is in progress for at least one data source, keep running the loading wheel
[self.activityIndicator startAnimating];
[self startActivityIndicator];
break;
}
}
@@ -35,6 +35,14 @@
*/
@property (nonatomic) UIActivityIndicatorView *activityIndicator;
/**
A view controller may choose to implement a completely custom activity indicator (e.g. shared toast notification),
In this case the default `activityIndicator` will be hidden, and the view controller is responsible for overriding
`startActivityIndicator` and `stopActivityIndicator` methods to show / hide the custom activity indicator.
*/
@property (nonatomic, readonly) BOOL providesCustomActivityIndicator;
/**
Bring the activity indicator to the front and start it.
*/