From 6255221d6ad1c6880180c6150a832b328e2cf905 Mon Sep 17 00:00:00 2001 From: Aleksandrs Vitjukovs Date: Mon, 13 Nov 2023 16:52:43 +0200 Subject: [PATCH] Delete `id.xml` shared pref from the correct dir --- .../android/api/session/AccountSessionManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSessionManager.java b/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSessionManager.java index 42e0808b..07e5059d 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSessionManager.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSessionManager.java @@ -181,7 +181,11 @@ public class AccountSessionManager{ if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.N){ MastodonApp.context.deleteSharedPreferences(id); }else{ - new File(MastodonApp.context.getDir("shared_prefs", Context.MODE_PRIVATE), id+".xml").delete(); + String dataDir=MastodonApp.context.getApplicationInfo().dataDir; + if(dataDir!=null){ + File prefsDir=new File(dataDir, "shared_prefs"); + new File(prefsDir, id+".xml").delete(); + } } sessions.remove(id); if(lastActiveAccountID.equals(id)){