From edeabd3f298111ae97122cbe20adee8a2689dd25 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 13 Aug 2018 17:14:32 +0200 Subject: [PATCH] BF: Empty app if initial /sync fails #1975 --- CHANGES.rst | 6 ++++++ Riot/AppDelegate.m | 12 ++++++++++++ Riot/Assets/en.lproj/Vector.strings | 1 + 3 files changed, 19 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 50184430e..22ca1c9c4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +Changes in 0.7.1 (2018-08-14) +=============================================== + +Bug fix: + * Empty app if initial /sync fails (#1975). + Changes in 0.7.0 (2018-08-10) =============================================== diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m index 8047f6841..5ca74f753 100644 --- a/Riot/AppDelegate.m +++ b/Riot/AppDelegate.m @@ -599,6 +599,18 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN } // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + + // Check if an initial sync failure occured while the app was in background + MXSession *mainSession = self.mxSessions.firstObject; + if (mainSession.state == MXSessionStateInitialSyncFailed) + { + // Inform the end user why the app appears blank + NSError *error = [NSError errorWithDomain:NSURLErrorDomain + code:NSURLErrorCannotConnectToHost + userInfo:@{NSLocalizedDescriptionKey : NSLocalizedStringFromTable(@"homeserver_connection_lost", @"Vector", nil)}]; + + [self showErrorAsAlert:error]; + } // Register to GDPR consent not given notification [self registerUserConsentNotGivenNotification]; diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 08b8d3258..7985cbeb5 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -537,6 +537,7 @@ "today" = "Today"; "yesterday" = "Yesterday"; "network_offline_prompt" = "The Internet connection appears to be offline."; +"homeserver_connection_lost" = "Could not connect to the homeserver."; "public_room_section_title" = "Public Rooms (at %@):"; "bug_report_prompt" = "The application has crashed last time. Would you like to submit a crash report?"; "rage_shake_prompt" = "You seem to be shaking the phone in frustration. Would you like to submit a bug report?";