Skip to content

Commit

Permalink
Fix to delete user when unregister for notifications failed
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mahibi committed Nov 20, 2023
1 parent e659456 commit 021af62
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -137,7 +138,7 @@ public void onComplete() {
}
});
} else {
deleteUser(user);
initiateUserDeletion(user);
}
}

Expand Down Expand Up @@ -172,10 +173,7 @@ public void onNext(Void aVoid) {
}
}

if (user.getId() != null) {
WebSocketConnectionHelper.deleteExternalSignalingInstanceForUserEntity(user.getId());
}
deleteAllEntriesForAccountIdentifier(user);
initiateUserDeletion(user);
}

@Override
Expand All @@ -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);
Expand Down

0 comments on commit 021af62

Please sign in to comment.