mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-26 19:34:25 +02:00
Server Offline Activity Indicator (#6314)
* Server Offline Activity Indicator - implemented
This commit is contained in:
@@ -24,6 +24,13 @@ import CommonKit
|
||||
private let presenter: UserIndicatorTypePresenterProtocol
|
||||
private var indicators: [UserIndicator]
|
||||
|
||||
@objc init(from viewController: UIViewController) {
|
||||
self.presenter = UserIndicatorTypePresenter(presentingViewController: viewController)
|
||||
self.indicators = []
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
init(presenter: UserIndicatorTypePresenterProtocol) {
|
||||
self.presenter = presenter
|
||||
self.indicators = []
|
||||
@@ -59,4 +66,24 @@ import CommonKit
|
||||
let indicator = presenter.present(.success(label: label))
|
||||
indicators.append(indicator)
|
||||
}
|
||||
|
||||
/// Present an error message that will be automatically dismissed after a few seconds.
|
||||
///
|
||||
/// Note: This is a convenience function callable by objective-c code
|
||||
@objc func presentFailure(label: String) {
|
||||
let indicator = presenter.present(.failure(label: label))
|
||||
indicators.append(indicator)
|
||||
}
|
||||
|
||||
/// Present an custom message
|
||||
/// To remove the indicator call the returned `UserIndicatorCancel` function
|
||||
///
|
||||
/// Note: This is a convenience function callable by objective-c code
|
||||
@objc func presentCustom(label: String, icon: UIImage?) -> UserIndicatorCancel {
|
||||
let indicator = presenter.present(.custom(label: label, icon: icon))
|
||||
indicators.append(indicator)
|
||||
return {
|
||||
indicator.cancel()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user