Fixed logout issue

This commit is contained in:
Daniele Verducci (Slimpenguin) 2024-02-27 08:18:28 +01:00
parent 28258d8c15
commit 443e954c66
2 changed files with 6 additions and 0 deletions

View File

@ -47,6 +47,7 @@ import it.danieleverducci.nextcloudmaps.activity.mappicker.MapPickerActivity;
import it.danieleverducci.nextcloudmaps.api.ApiProvider; import it.danieleverducci.nextcloudmaps.api.ApiProvider;
import it.danieleverducci.nextcloudmaps.fragments.GeofavoriteListFragment; import it.danieleverducci.nextcloudmaps.fragments.GeofavoriteListFragment;
import it.danieleverducci.nextcloudmaps.fragments.GeofavoriteMapFragment; import it.danieleverducci.nextcloudmaps.fragments.GeofavoriteMapFragment;
import it.danieleverducci.nextcloudmaps.repository.GeofavoriteRepository;
import it.danieleverducci.nextcloudmaps.utils.SettingsManager; import it.danieleverducci.nextcloudmaps.utils.SettingsManager;
public class MainActivity extends NextcloudMapsStyledActivity { public class MainActivity extends NextcloudMapsStyledActivity {
@ -197,6 +198,7 @@ public class MainActivity extends NextcloudMapsStyledActivity {
public void switch_account() { public void switch_account() {
ApiProvider.logout(); ApiProvider.logout();
GeofavoriteRepository.resetInstance();
SingleAccountHelper.applyCurrentAccount(this, null); SingleAccountHelper.applyCurrentAccount(this, null);
Intent intent = new Intent(MainActivity.this, LoginActivity.class); Intent intent = new Intent(MainActivity.this, LoginActivity.class);
startActivity(intent); startActivity(intent);

View File

@ -42,6 +42,10 @@ public class GeofavoriteRepository {
return instance; return instance;
} }
public static void resetInstance() {
instance = null;
}
public MutableLiveData<List<Geofavorite>> getGeofavorites(){ public MutableLiveData<List<Geofavorite>> getGeofavorites(){
if (mGeofavorites == null) { if (mGeofavorites == null) {
mGeofavorites = new MutableLiveData<>(); mGeofavorites = new MutableLiveData<>();