From 6e424dc85404961504fd5ca53a8e90e033db1fa9 Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 19 Jan 2022 09:48:16 +0000 Subject: [PATCH] Change HomeViewControllerWithBannerWrapperViewController to MXKViewControllerActivityHandling conformance. --- Riot/Modules/Application/LegacyAppDelegate.m | 14 +++++++------ ...ollerWithBannerWrapperViewController.swift | 20 ++++++++++++++++++- changelog.d/5407.bugfix | 1 + 3 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 changelog.d/5407.bugfix diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index fd6354ad3..fc7e503a2 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1372,9 +1372,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni else { void(^findRoom)(void) = ^{ - if ([_masterTabBarController.selectedViewController isKindOfClass:MXKActivityHandlingViewController.class]) + if ([_masterTabBarController.selectedViewController conformsToProtocol:@protocol(MXKViewControllerActivityHandling)]) { - MXKActivityHandlingViewController *homeViewController = (MXKActivityHandlingViewController*)_masterTabBarController.selectedViewController; + UIViewController *homeViewController = (UIViewController*)_masterTabBarController.selectedViewController; [homeViewController startActivityIndicator]; @@ -1651,11 +1651,13 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni // Try to get more information about the room before opening its preview [roomPreviewData peekInRoom:^(BOOL succeeded) { MXStrongifyAndReturnIfNil(self); - - MXKViewController *homeViewController = (MXKViewController*)self.masterTabBarController.selectedViewController; + if ([self.masterTabBarController.selectedViewController conformsToProtocol:@protocol(MXKViewControllerActivityHandling)]) + { + UIViewController *homeViewController = (UIViewController*)self.masterTabBarController.selectedViewController; - // Note: the activity indicator will not disappear if the session is not ready - [homeViewController stopActivityIndicator]; + // Note: the activity indicator will not disappear if the session is not ready + [homeViewController stopActivityIndicator]; + } // If no data is available for this room, we name it with the known room alias (if any). if (!succeeded && self->universalLinkFragmentPendingRoomAlias[roomIdOrAlias]) diff --git a/Riot/Modules/Home/VersionCheck/HomeViewControllerWithBannerWrapperViewController.swift b/Riot/Modules/Home/VersionCheck/HomeViewControllerWithBannerWrapperViewController.swift index 85abec4d1..764dc2d59 100644 --- a/Riot/Modules/Home/VersionCheck/HomeViewControllerWithBannerWrapperViewController.swift +++ b/Riot/Modules/Home/VersionCheck/HomeViewControllerWithBannerWrapperViewController.swift @@ -16,7 +16,7 @@ import Foundation -class HomeViewControllerWithBannerWrapperViewController: MXKActivityHandlingViewController, BannerPresentationProtocol { +class HomeViewControllerWithBannerWrapperViewController: UIViewController, MXKViewControllerActivityHandling, BannerPresentationProtocol { @objc let homeViewController: HomeViewController private var bannerContainerView: UIView! @@ -85,4 +85,22 @@ class HomeViewControllerWithBannerWrapperViewController: MXKActivityHandlingView bannerView.removeFromSuperview() } } + + // MARK: - MXKViewControllerActivityHandling + var activityIndicator: UIActivityIndicatorView! { + get { + return homeViewController.activityIndicator + } + set { + homeViewController.activityIndicator = newValue + } + } + + func startActivityIndicator() { + homeViewController.startActivityIndicator() + } + + func stopActivityIndicator() { + homeViewController.stopActivityIndicator() + } } diff --git a/changelog.d/5407.bugfix b/changelog.d/5407.bugfix new file mode 100644 index 000000000..f4ed72863 --- /dev/null +++ b/changelog.d/5407.bugfix @@ -0,0 +1 @@ +Fix grey spinner showing indefinitely over the home view after launch.