mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 05:35:39 +03:00
commit
4f7b42cc40
5 changed files with 50 additions and 7 deletions
|
@ -1,2 +1,2 @@
|
|||
DO NOT TOUCH; GENERATED BY DRONE
|
||||
<span class="mdl-layout-title">Lint Report: 1 error and 519 warnings</span>
|
||||
<span class="mdl-layout-title">Lint Report: 1 error and 511 warnings</span>
|
||||
|
|
|
@ -46,6 +46,14 @@ public class FilesystemDataProvider {
|
|||
this.contentResolver = contentResolver;
|
||||
}
|
||||
|
||||
public int deleteAllEntriesForSyncedFolder(String syncedFolderId) {
|
||||
return contentResolver.delete(
|
||||
ProviderMeta.ProviderTableMeta.CONTENT_URI_FILESYSTEM,
|
||||
ProviderMeta.ProviderTableMeta.FILESYSTEM_SYNCED_FOLDER_ID + " = ?",
|
||||
new String[]{syncedFolderId}
|
||||
);
|
||||
}
|
||||
|
||||
public void updateFilesystemFileAsSentForUpload(String path, String syncedFolderId) {
|
||||
ContentValues cv = new ContentValues();
|
||||
cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_SENT_FOR_UPLOAD, 1);
|
||||
|
|
|
@ -601,4 +601,12 @@ public class UploadsStorageManager extends Observable {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
public int removeAccountUploads(Account account) {
|
||||
Log_OC.v(TAG, "Delete all uploads for account " + account.name);
|
||||
return getDB().delete(
|
||||
ProviderTableMeta.CONTENT_URI_UPLOADS,
|
||||
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "=?",
|
||||
new String[]{account.name});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,12 +34,19 @@ import com.owncloud.android.MainApp;
|
|||
import com.owncloud.android.authentication.AccountUtils;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
import com.owncloud.android.datamodel.FilesystemDataProvider;
|
||||
import com.owncloud.android.datamodel.SyncedFolder;
|
||||
import com.owncloud.android.datamodel.SyncedFolderProvider;
|
||||
import com.owncloud.android.datamodel.UploadsStorageManager;
|
||||
import com.owncloud.android.ui.events.AccountRemovedEvent;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
import com.owncloud.android.utils.FilesSyncHelper;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static android.content.Context.ACCOUNT_SERVICE;
|
||||
import static com.owncloud.android.ui.activity.ManageAccountsActivity.PENDING_FOR_REMOVAL;
|
||||
|
@ -78,6 +85,32 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
|
|||
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(context.getContentResolver());
|
||||
arbitraryDataProvider.deleteKeyForAccount(account.name, PENDING_FOR_REMOVAL);
|
||||
|
||||
// remove synced folders set for account
|
||||
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(context.getContentResolver());
|
||||
List<SyncedFolder> syncedFolders = syncedFolderProvider.getSyncedFolders();
|
||||
|
||||
List<Long> syncedFolderIds = new ArrayList<>();
|
||||
|
||||
for (SyncedFolder syncedFolder : syncedFolders) {
|
||||
if (syncedFolder.getAccount().equals(account.name)) {
|
||||
arbitraryDataProvider.deleteKeyForAccount(FilesSyncHelper.GLOBAL,
|
||||
FilesSyncHelper.SYNCEDFOLDERINITIATED + syncedFolder.getId());
|
||||
syncedFolderIds.add(syncedFolder.getId());
|
||||
}
|
||||
}
|
||||
|
||||
syncedFolderProvider.deleteSyncFoldersForAccount(account);
|
||||
|
||||
UploadsStorageManager uploadsStorageManager = new UploadsStorageManager(context.getContentResolver(),
|
||||
context);
|
||||
uploadsStorageManager.removeAccountUploads(account);
|
||||
|
||||
FilesystemDataProvider filesystemDataProvider = new FilesystemDataProvider(context.getContentResolver());
|
||||
|
||||
for (long syncedFolderId : syncedFolderIds) {
|
||||
filesystemDataProvider.deleteAllEntriesForSyncedFolder(Long.toString(syncedFolderId));
|
||||
}
|
||||
|
||||
return Result.SUCCESS;
|
||||
} else {
|
||||
return Result.FAILURE;
|
||||
|
|
|
@ -62,7 +62,6 @@ import com.owncloud.android.authentication.AccountUtils;
|
|||
import com.owncloud.android.authentication.AuthenticatorActivity;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||
import com.owncloud.android.datamodel.PushConfigurationState;
|
||||
import com.owncloud.android.datamodel.SyncedFolderProvider;
|
||||
import com.owncloud.android.lib.common.UserInfo;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
|
@ -408,10 +407,6 @@ public class UserInfoActivity extends FileActivity {
|
|||
ContactsPreferenceActivity.cancelContactBackupJobForAccount(getActivity(), account);
|
||||
|
||||
ContentResolver contentResolver = getActivity().getContentResolver();
|
||||
// delete all synced folder for an account
|
||||
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(
|
||||
contentResolver);
|
||||
syncedFolderProvider.deleteSyncFoldersForAccount(account);
|
||||
|
||||
// disable daily backup
|
||||
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(
|
||||
|
@ -421,7 +416,6 @@ public class UserInfoActivity extends FileActivity {
|
|||
ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP,
|
||||
"false");
|
||||
|
||||
|
||||
String arbitraryDataPushString;
|
||||
|
||||
if (!TextUtils.isEmpty(arbitraryDataPushString = arbitraryDataProvider.getValue(
|
||||
|
|
Loading…
Reference in a new issue