Merge pull request #5408 from vector-im/langleyd/5407_fix_indefinite_grey_spinner_on_home

Fix indefinite grey spinner on home view banner wrapper.
This commit is contained in:
David Langley 2022-01-24 14:45:59 +00:00 committed by GitHub
commit a8d9a0f926
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 7 deletions

View file

@ -1372,9 +1372,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
else else
{ {
void(^findRoom)(void) = ^{ void(^findRoom)(void) = ^{
if ([_masterTabBarController.selectedViewController isKindOfClass:MXKActivityHandlingViewController.class]) if ([_masterTabBarController.selectedViewController conformsToProtocol:@protocol(MXKViewControllerActivityHandling)])
{ {
MXKActivityHandlingViewController *homeViewController = (MXKActivityHandlingViewController*)_masterTabBarController.selectedViewController; UIViewController<MXKViewControllerActivityHandling> *homeViewController = (UIViewController<MXKViewControllerActivityHandling>*)_masterTabBarController.selectedViewController;
[homeViewController startActivityIndicator]; [homeViewController startActivityIndicator];
@ -1651,11 +1651,13 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
// Try to get more information about the room before opening its preview // Try to get more information about the room before opening its preview
[roomPreviewData peekInRoom:^(BOOL succeeded) { [roomPreviewData peekInRoom:^(BOOL succeeded) {
MXStrongifyAndReturnIfNil(self); MXStrongifyAndReturnIfNil(self);
if ([self.masterTabBarController.selectedViewController conformsToProtocol:@protocol(MXKViewControllerActivityHandling)])
MXKViewController *homeViewController = (MXKViewController*)self.masterTabBarController.selectedViewController; {
UIViewController<MXKViewControllerActivityHandling> *homeViewController = (UIViewController<MXKViewControllerActivityHandling>*)self.masterTabBarController.selectedViewController;
// Note: the activity indicator will not disappear if the session is not ready // Note: the activity indicator will not disappear if the session is not ready
[homeViewController stopActivityIndicator]; [homeViewController stopActivityIndicator];
}
// If no data is available for this room, we name it with the known room alias (if any). // If no data is available for this room, we name it with the known room alias (if any).
if (!succeeded && self->universalLinkFragmentPendingRoomAlias[roomIdOrAlias]) if (!succeeded && self->universalLinkFragmentPendingRoomAlias[roomIdOrAlias])

View file

@ -16,7 +16,7 @@
import Foundation import Foundation
class HomeViewControllerWithBannerWrapperViewController: MXKActivityHandlingViewController, BannerPresentationProtocol { class HomeViewControllerWithBannerWrapperViewController: UIViewController, MXKViewControllerActivityHandling, BannerPresentationProtocol {
@objc let homeViewController: HomeViewController @objc let homeViewController: HomeViewController
private var bannerContainerView: UIView! private var bannerContainerView: UIView!
@ -85,4 +85,22 @@ class HomeViewControllerWithBannerWrapperViewController: MXKActivityHandlingView
bannerView.removeFromSuperview() bannerView.removeFromSuperview()
} }
} }
// MARK: - MXKViewControllerActivityHandling
var activityIndicator: UIActivityIndicatorView! {
get {
return homeViewController.activityIndicator
}
set {
homeViewController.activityIndicator = newValue
}
}
func startActivityIndicator() {
homeViewController.startActivityIndicator()
}
func stopActivityIndicator() {
homeViewController.stopActivityIndicator()
}
} }

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

@ -0,0 +1 @@
Fix grey spinner showing indefinitely over the home view after launch.