mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-28 20:26:57 +02:00
Implement home screen activity indicators
This commit is contained in:
@@ -17,9 +17,11 @@
|
||||
import Foundation
|
||||
import Intents
|
||||
import MatrixSDK
|
||||
import CommonKit
|
||||
|
||||
#if DEBUG
|
||||
import FLEX
|
||||
import UIKit
|
||||
#endif
|
||||
|
||||
/// The AppCoordinator is responsible of screen navigation and data injection at root application level. It decides
|
||||
@@ -47,7 +49,7 @@ final class AppCoordinator: NSObject, AppCoordinatorType {
|
||||
return AppNavigator(appCoordinator: self)
|
||||
}()
|
||||
|
||||
private weak var splitViewCoordinator: SplitViewCoordinatorType?
|
||||
fileprivate weak var splitViewCoordinator: SplitViewCoordinatorType?
|
||||
fileprivate weak var sideMenuCoordinator: SideMenuCoordinatorType?
|
||||
|
||||
private let userSessionsService: UserSessionsService
|
||||
@@ -296,6 +298,18 @@ fileprivate class AppNavigator: AppNavigatorProtocol {
|
||||
return SideMenuPresenter(sideMenuCoordinator: sideMenuCoordinator)
|
||||
}()
|
||||
|
||||
private var appNavigationVC: UINavigationController {
|
||||
guard
|
||||
let splitVC = appCoordinator.splitViewCoordinator?.toPresentable() as? UISplitViewController,
|
||||
// Picking out the first view controller currently works only on iPhones, not iPads
|
||||
let navigationVC = splitVC.viewControllers.first as? UINavigationController
|
||||
else {
|
||||
MXLog.error("[AppNavigator] Missing root split view controller")
|
||||
return UINavigationController()
|
||||
}
|
||||
return navigationVC
|
||||
}
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
init(appCoordinator: AppCoordinator) {
|
||||
@@ -307,4 +321,16 @@ fileprivate class AppNavigator: AppNavigatorProtocol {
|
||||
func navigate(to destination: AppNavigatorDestination) {
|
||||
self.appCoordinator.navigate(to: destination)
|
||||
}
|
||||
|
||||
func addLoadingActivity() -> Activity {
|
||||
let presenter = ActivityIndicatorToastPresenter(
|
||||
text: VectorL10n.roomParticipantsSecurityLoading,
|
||||
navigationController: appNavigationVC
|
||||
)
|
||||
let request = ActivityRequest(
|
||||
presenter: presenter,
|
||||
dismissal: .manual
|
||||
)
|
||||
return ActivityCenter.shared.add(request)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CommonKit
|
||||
|
||||
/// AppNavigatorProtocol abstract a navigator at app level.
|
||||
/// It enables to perform the navigation within the global app scope (open the side menu, open a room and so on)
|
||||
@@ -26,4 +27,12 @@ protocol AppNavigatorProtocol {
|
||||
/// Navigate to a destination screen or a state
|
||||
/// Do not use protocol with associatedtype for the moment like presented here https://www.swiftbysundell.com/articles/navigation-in-swift/#where-to-navigator use a separate enum
|
||||
func navigate(to destination: AppNavigatorDestination)
|
||||
|
||||
/// Add loading activity to an app-wide queue of other activitie
|
||||
///
|
||||
/// If the queue is empty, the activity will be displayed immediately, otherwise it will be pending
|
||||
/// until the previously added activities have completed / been cancelled.
|
||||
///
|
||||
/// To remove an activity indicator, cancel or deallocate the returned `Activity`
|
||||
func addLoadingActivity() -> Activity
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user