From 443e954c66109a60f27d98885d484fcd488a01fb Mon Sep 17 00:00:00 2001 From: "Daniele Verducci (Slimpenguin)" Date: Tue, 27 Feb 2024 08:18:28 +0100 Subject: [PATCH] Fixed logout issue --- .../nextcloudmaps/activity/main/MainActivity.java | 2 ++ .../nextcloudmaps/repository/GeofavoriteRepository.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/MainActivity.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/MainActivity.java index 63261d4..ae84b3f 100644 --- a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/MainActivity.java +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/MainActivity.java @@ -47,6 +47,7 @@ import it.danieleverducci.nextcloudmaps.activity.mappicker.MapPickerActivity; import it.danieleverducci.nextcloudmaps.api.ApiProvider; import it.danieleverducci.nextcloudmaps.fragments.GeofavoriteListFragment; import it.danieleverducci.nextcloudmaps.fragments.GeofavoriteMapFragment; +import it.danieleverducci.nextcloudmaps.repository.GeofavoriteRepository; import it.danieleverducci.nextcloudmaps.utils.SettingsManager; public class MainActivity extends NextcloudMapsStyledActivity { @@ -197,6 +198,7 @@ public class MainActivity extends NextcloudMapsStyledActivity { public void switch_account() { ApiProvider.logout(); + GeofavoriteRepository.resetInstance(); SingleAccountHelper.applyCurrentAccount(this, null); Intent intent = new Intent(MainActivity.this, LoginActivity.class); startActivity(intent); diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/repository/GeofavoriteRepository.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/repository/GeofavoriteRepository.java index 9d5e42e..2d4a9e9 100644 --- a/app/src/main/java/it/danieleverducci/nextcloudmaps/repository/GeofavoriteRepository.java +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/repository/GeofavoriteRepository.java @@ -42,6 +42,10 @@ public class GeofavoriteRepository { return instance; } + public static void resetInstance() { + instance = null; + } + public MutableLiveData> getGeofavorites(){ if (mGeofavorites == null) { mGeofavorites = new MutableLiveData<>();