diff --git a/app/src/main/java/foundation/e/drive/receivers/AccountRemoveCallbackReceiver.java b/app/src/main/java/foundation/e/drive/receivers/AccountRemoveCallbackReceiver.java index 339507d81ae07d4bdcd6a2bc126f94dbec0c0e60..c4b08a698482822f8243c684a1354ba81696746f 100644 --- a/app/src/main/java/foundation/e/drive/receivers/AccountRemoveCallbackReceiver.java +++ b/app/src/main/java/foundation/e/drive/receivers/AccountRemoveCallbackReceiver.java @@ -30,6 +30,7 @@ import foundation.e.drive.services.InitializerService; import foundation.e.drive.services.ObserverService; import foundation.e.drive.services.SynchronizationService; import foundation.e.drive.utils.AppConstants; +import foundation.e.drive.utils.DavClientProvider; import foundation.e.drive.utils.ViewUtils; import timber.log.Timber; @@ -54,6 +55,8 @@ public class AccountRemoveCallbackReceiver extends BroadcastReceiver { cleanSharedPreferences(applicationContext, preferences); removeCachedFiles(applicationContext); + DavClientProvider.getInstance().cleanUp(); + ViewUtils.updateWidgetView(applicationContext); } diff --git a/app/src/main/java/foundation/e/drive/services/InitializerService.java b/app/src/main/java/foundation/e/drive/services/InitializerService.java index ecf74702552c742a754d5dc6fd5a529e726389ee..93ddb453bbcc7bec3e42f24b44c0785e418fc214 100644 --- a/app/src/main/java/foundation/e/drive/services/InitializerService.java +++ b/app/src/main/java/foundation/e/drive/services/InitializerService.java @@ -23,6 +23,7 @@ import java.util.List; import foundation.e.drive.models.SyncedFolder; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.CommonUtils; +import foundation.e.drive.utils.DavClientProvider; import foundation.e.drive.utils.RootSyncedFolderProvider; import timber.log.Timber; @@ -48,6 +49,7 @@ public class InitializerService extends Service { @Override public int onStartCommand(@NonNull Intent intent, int flags, int startId) { Timber.i("onStartCommand()"); + DavClientProvider.getInstance().cleanUp(); CommonUtils.setServiceUnCaughtExceptionHandler(this); //Get account diff --git a/app/src/main/java/foundation/e/drive/utils/DavClientProvider.java b/app/src/main/java/foundation/e/drive/utils/DavClientProvider.java index 70514ae3c240557b464c589f24cf32decf98a4c8..deb1974f2c7fe083900d37a3438a7bc0c4e29046 100644 --- a/app/src/main/java/foundation/e/drive/utils/DavClientProvider.java +++ b/app/src/main/java/foundation/e/drive/utils/DavClientProvider.java @@ -90,6 +90,11 @@ public class DavClientProvider { return ncClientInstance; } + public void cleanUp() { + ncClientInstance = null; + ocClientInstance = null; + } + @Nullable private static String getAcountPwd(Account account, Context ctx) throws AccountUtils.AccountNotFoundException { return AccountManager.get(ctx).getPassword(account);