From 021af620d0913092f28e253b9abf1ee3339ee0b1 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 20 Nov 2023 20:10:14 +0100 Subject: [PATCH] Fix to delete user when unregister for notifications failed Whenever there was an error when unregistering from notifications, the user was not deleted. This could lead to multiple bugs. Furthermore, external signaling server connection and arbitrary storage is now always handled for user deletion, which was not the case before. Signed-off-by: Marcel Hibbe --- .../nextcloud/talk/jobs/AccountRemovalWorker.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java index 940d6780d00..d2405f95e75 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java @@ -129,6 +129,7 @@ public void onNext(@io.reactivex.annotations.NonNull GenericOverall genericOvera @Override public void onError(@io.reactivex.annotations.NonNull Throwable e) { Log.e(TAG, "error while trying to unregister Device For Notifications", e); + initiateUserDeletion(user); } @Override @@ -137,7 +138,7 @@ public void onComplete() { } }); } else { - deleteUser(user); + initiateUserDeletion(user); } } @@ -172,10 +173,7 @@ public void onNext(Void aVoid) { } } - if (user.getId() != null) { - WebSocketConnectionHelper.deleteExternalSignalingInstanceForUserEntity(user.getId()); - } - deleteAllEntriesForAccountIdentifier(user); + initiateUserDeletion(user); } @Override @@ -190,8 +188,10 @@ public void onComplete() { }); } - private void deleteAllEntriesForAccountIdentifier(User user) { + private void initiateUserDeletion(User user) { if (user.getId() != null) { + WebSocketConnectionHelper.deleteExternalSignalingInstanceForUserEntity(user.getId()); + try { arbitraryStorageManager.deleteAllEntriesForAccountIdentifier(user.getId()); deleteUser(user);