mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 15:09:31 +02:00
Feature/4976 fix for blocking behaviour
This commit is contained in:
@@ -650,9 +650,6 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
|
||||
[MXSDKOptions.sharedInstance.profiler resume];
|
||||
|
||||
_isAppForeground = YES;
|
||||
|
||||
// bwi: check if requests need to be blocked
|
||||
[self checkBlockingServerMaintenance];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application
|
||||
@@ -666,9 +663,6 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
|
||||
self.isApplicationActiveFromSystemAlert = NO;
|
||||
|
||||
[self checkCrossSigningForSession:self.mxSessions.firstObject];
|
||||
|
||||
// bwi: check if requests need to be blocked
|
||||
[self checkBlockingServerMaintenance];
|
||||
}
|
||||
|
||||
- (void)configurePinCodeScreenFor:(UIApplication *)application
|
||||
@@ -4591,19 +4585,6 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
|
||||
[service registerForAppConfig];
|
||||
}
|
||||
|
||||
#pragma mark - bwi blocking maintenance
|
||||
|
||||
// bwi: on appstart and app coming back from background check the current maintenance and block requests if necessary
|
||||
- (void) checkBlockingServerMaintenance {
|
||||
ServerDowntimeDefaultService* service = [[ServerDowntimeDefaultService alloc] init];
|
||||
|
||||
if( [service isDowntimeNow] && [service isBlocking] && ![service isManuallyIgnored] ) {
|
||||
[NSUserDefaults.standardUserDefaults setBool:YES forKey:@"ServerDownTimeBlockingKey"];
|
||||
} else {
|
||||
[NSUserDefaults.standardUserDefaults setBool:NO forKey:@"ServerDownTimeBlockingKey"];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Mandatory SSSS setup
|
||||
|
||||
- (void)presentSecureBackupSetupForSession:(MXSession*)mxSession
|
||||
|
||||
@@ -100,6 +100,8 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
|
||||
// MARK: - Public
|
||||
|
||||
func start() {
|
||||
// bwi: (#4976) when we start onboarding we want to be sure that we don't block requests
|
||||
UserDefaults.standard.set(false, forKey: "ServerDownTimeBlockingKey")
|
||||
// bwi: (#4394) handling of the case of canceled login during pincode stage. Startign the authentication first is needed for startup to work
|
||||
if !MXKAccountManager.shared().accounts.isEmpty && !PinCodePreferences.shared.isPinSet && PinCodePreferences.shared.forcePinProtection {
|
||||
if let session = AppDelegate.theDelegate().mxSessions.first as? MXSession {
|
||||
|
||||
@@ -5355,6 +5355,8 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
- (void) ignoreDowntime:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"ServerDownTimeBlockingKey"];
|
||||
[[[ServerDowntimeDefaultService alloc] init] setManuallyIgnored];
|
||||
|
||||
[self updateSections];
|
||||
}
|
||||
|
||||
#pragma mark - ThreadsBetaCoordinatorBridgePresenterDelegate
|
||||
|
||||
@@ -339,7 +339,7 @@ struct AuthenticationServerSelectionScreen: View {
|
||||
self.showAlertIfNeeded()
|
||||
}
|
||||
} else {
|
||||
service.fetchDowntimesWithDirectRequest { success in
|
||||
service.fetchDowntimesWithDirectRequest(localURLString:viewModel.homeserverAddress) { success in
|
||||
DispatchQueue.main.async {
|
||||
self.isFetchingDowntime = false // hide progressview
|
||||
if success {
|
||||
|
||||
@@ -163,8 +163,14 @@ extension ServerDowntimeDefaultService : ServerDowntimeService {
|
||||
})
|
||||
}
|
||||
|
||||
func fetchDowntimesWithDirectRequest(completion: @escaping (Bool) -> Void) {
|
||||
guard let url = URL(string: AppConfigService.shared.serverUrl() + maintenanceURL) else {
|
||||
func fetchDowntimesWithDirectRequest(localUrlString: String? = nil, completion: @escaping (Bool) -> Void) {
|
||||
var urlString = AppConfigService.shared.serverUrl()
|
||||
|
||||
if let localUrlString = localUrlString {
|
||||
urlString = localUrlString
|
||||
}
|
||||
|
||||
guard let url = URL(string: urlString + maintenanceURL) else {
|
||||
completion(false)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user