Skip to content

Commit

Permalink
[Backup] Await init complete before call backup process
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangdat committed Sep 21, 2023
1 parent d0f64cf commit caba218
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
15 changes: 7 additions & 8 deletions lib/data/network/recovery_words/recovery_words_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,18 @@ class RecoveryWordsAPI {
}

Future<bool> deleteRecoveryWords() async {
final options = Options(
validateStatus: (status) {
if (status == null) return false;
return status >= 200 && status <= 299 || status == 404;
},
);
final options = Options(validateStatus: _deleteRecoverySuccess);
final response = await _client
.delete(TomEndpoint.recoveryWordsServicePath.path, options: options)
.onError((error, stackTrace) {
Logs().e('RecoveryWordsAPI::deleteRecoveryWords() [Exception]', error);
throw Exception(error);
});
return response.statusCode >= 200 && response.statusCode <= 299 ||
response.statusCode == 404;
return _deleteRecoverySuccess(response?.statusCode);
}

bool _deleteRecoverySuccess(int? statusCode) {
if (statusCode == null) return false;
return statusCode >= 200 && statusCode <= 299 || statusCode == 404;
}
}
1 change: 1 addition & 0 deletions lib/pages/chat_list/chat_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ class ChatListController extends State<ChatList>
await client.accountDataLoading;
if (client.prevBatch == null) {
await client.onSync.stream.first;
await client.initCompleter?.future;

// Display first login bootstrap if enabled
if (client.encryption?.keyManager.enabled == true) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ packages:
description:
path: "."
ref: twake-supported
resolved-ref: "186ded3be6d5acbe3476e61a38f6aeb41cac5347"
resolved-ref: "3cc4ded9cd70652b35b56bfbeb4ca0525ada1166"
url: "[email protected]:linagora/matrix-dart-sdk.git"
source: git
version: "0.22.2"
Expand Down

0 comments on commit caba218

Please sign in to comment.