mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-22 01:22:46 +02:00
Merge branch 'develop' into gil/SP1_space_creation
This commit is contained in:
@@ -322,15 +322,40 @@ fileprivate class AppNavigator: AppNavigatorProtocol {
|
||||
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)
|
||||
func addUserIndicator(_ type: AppUserIndicatorType) -> UserIndicator {
|
||||
let request = userIndicatorRequest(for: type)
|
||||
return UserIndicatorQueue.shared.add(request)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func userIndicatorRequest(for type: AppUserIndicatorType) -> UserIndicatorRequest {
|
||||
switch type {
|
||||
case let .loading(label):
|
||||
let presenter = ToastUserIndicatorPresenter(
|
||||
viewState: .init(
|
||||
style: .loading,
|
||||
label: label
|
||||
),
|
||||
navigationController: appNavigationVC
|
||||
)
|
||||
return UserIndicatorRequest(
|
||||
presenter: presenter,
|
||||
dismissal: .manual
|
||||
)
|
||||
case let .success(label):
|
||||
let presenter = ToastUserIndicatorPresenter(
|
||||
viewState: .init(
|
||||
style: .success,
|
||||
label: label
|
||||
),
|
||||
navigationController: appNavigationVC
|
||||
)
|
||||
return UserIndicatorRequest(
|
||||
presenter: presenter,
|
||||
dismissal: .timeout(1.5)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,15 @@
|
||||
import Foundation
|
||||
import CommonKit
|
||||
|
||||
/// Type of indicator to be shown in the app navigator
|
||||
enum AppUserIndicatorType {
|
||||
/// Loading toast with custom label
|
||||
case loading(String)
|
||||
|
||||
/// Success toast with custom label
|
||||
case success(String)
|
||||
}
|
||||
|
||||
/// 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)
|
||||
/// Note: Presentation of the pattern here https://www.swiftbysundell.com/articles/navigation-in-swift/#where-to-navigator
|
||||
@@ -28,11 +37,11 @@ protocol AppNavigatorProtocol {
|
||||
/// 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
|
||||
/// Add new indicator, such as loading spinner or a success message, to an app-wide queue of other indicators
|
||||
///
|
||||
/// 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.
|
||||
/// If the queue is empty, the indicator will be displayed immediately, otherwise it will be pending
|
||||
/// until the previously added indicator have completed / been cancelled.
|
||||
///
|
||||
/// To remove an activity indicator, cancel or deallocate the returned `Activity`
|
||||
func addLoadingActivity() -> Activity
|
||||
/// To remove an indicator, cancel or deallocate the returned `UserIndicator`
|
||||
func addUserIndicator(_ type: AppUserIndicatorType) -> UserIndicator
|
||||
}
|
||||
|
||||
@@ -369,6 +369,24 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
|
||||
// Create message sound
|
||||
NSURL *messageSoundURL = [[NSBundle mainBundle] URLForResource:@"message" withExtension:@"caf"];
|
||||
AudioServicesCreateSystemSoundID((__bridge CFURLRef)messageSoundURL, &_messageSound);
|
||||
|
||||
// Set up runtime language and fallback by considering the userDefaults object shared within the application group.
|
||||
NSUserDefaults *sharedUserDefaults = [MXKAppSettings standardAppSettings].sharedUserDefaults;
|
||||
NSString *language = [sharedUserDefaults objectForKey:@"appLanguage"];
|
||||
if (!language)
|
||||
{
|
||||
// Check whether a langage was only defined at the Riot application level.
|
||||
language = [[NSUserDefaults standardUserDefaults] objectForKey:@"appLanguage"];
|
||||
if (language)
|
||||
{
|
||||
// Move this setting into the shared userDefaults object to apply it to the extensions.
|
||||
[sharedUserDefaults setObject:language forKey:@"appLanguage"];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"appLanguage"];
|
||||
}
|
||||
}
|
||||
[NSBundle mxk_setLanguage:language];
|
||||
[NSBundle mxk_setFallbackLanguage:@"en"];
|
||||
|
||||
// Set app info now as Mac (Designed for iPad) accesses it before didFinishLaunching is called
|
||||
self.appInfo = AppInfo.current;
|
||||
@@ -411,24 +429,6 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
|
||||
// Set up theme
|
||||
ThemeService.shared.themeId = RiotSettings.shared.userInterfaceTheme;
|
||||
|
||||
// Set up runtime language and fallback by considering the userDefaults object shared within the application group.
|
||||
NSUserDefaults *sharedUserDefaults = [MXKAppSettings standardAppSettings].sharedUserDefaults;
|
||||
NSString *language = [sharedUserDefaults objectForKey:@"appLanguage"];
|
||||
if (!language)
|
||||
{
|
||||
// Check whether a langage was only defined at the Riot application level.
|
||||
language = [[NSUserDefaults standardUserDefaults] objectForKey:@"appLanguage"];
|
||||
if (language)
|
||||
{
|
||||
// Move this setting into the shared userDefaults object to apply it to the extensions.
|
||||
[sharedUserDefaults setObject:language forKey:@"appLanguage"];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"appLanguage"];
|
||||
}
|
||||
}
|
||||
[NSBundle mxk_setLanguage:language];
|
||||
[NSBundle mxk_setFallbackLanguage:@"en"];
|
||||
|
||||
mxSessionArray = [NSMutableArray array];
|
||||
callEventsListeners = [NSMutableDictionary dictionary];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user