mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
Merge pull request #1932 from nextcloud/contactBackupRemoval
Contact backup removal
This commit is contained in:
commit
f993c0cd0f
2 changed files with 6 additions and 13 deletions
|
@ -38,6 +38,7 @@ 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.activity.ContactsPreferenceActivity;
|
||||
import com.owncloud.android.ui.events.AccountRemovedEvent;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
import com.owncloud.android.utils.FilesSyncHelper;
|
||||
|
@ -65,9 +66,12 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
|
|||
Context context = MainApp.getAppContext();
|
||||
PersistableBundleCompat bundle = params.getExtras();
|
||||
Account account = AccountUtils.getOwnCloudAccountByName(context, bundle.getString(ACCOUNT, ""));
|
||||
AccountManager am = (AccountManager) context.getSystemService(ACCOUNT_SERVICE);
|
||||
|
||||
if (account != null && am != null) {
|
||||
// disable contact backup job
|
||||
ContactsPreferenceActivity.cancelContactBackupJobForAccount(context, account);
|
||||
|
||||
if (account != null ) {
|
||||
AccountManager am = (AccountManager) context.getSystemService(ACCOUNT_SERVICE);
|
||||
am.removeAccount(account, this, null);
|
||||
|
||||
FileDataStorageManager storageManager = new FileDataStorageManager(account, context.getContentResolver());
|
||||
|
|
|
@ -129,17 +129,6 @@ public class ContactsPreferenceActivity extends FileActivity implements FileFrag
|
|||
.schedule();
|
||||
}
|
||||
|
||||
public static void cancelAllContactBackupJobs(Context context) {
|
||||
Log_OC.d(TAG, "disabling all contacts backup job");
|
||||
|
||||
JobManager jobManager = JobManager.create(context);
|
||||
Set<JobRequest> jobs = jobManager.getAllJobRequestsForTag(ContactsBackupJob.TAG);
|
||||
|
||||
for (JobRequest jobRequest : jobs) {
|
||||
jobManager.cancel(jobRequest.getJobId());
|
||||
}
|
||||
}
|
||||
|
||||
public static void cancelPreviousContactBackupJobForAccount(Context context, Account account) {
|
||||
Log_OC.d(TAG, "disabling existing contacts backup job for account: " + account.name);
|
||||
|
||||
|
|
Loading…
Reference in a new issue