Search in sources :

Example 1 with StorageForcePushJob

use of org.thoughtcrime.securesms.jobs.StorageForcePushJob in project Signal-Android by WhisperSystems.

the class StorageCapabilityMigrationJob method performMigration.

@Override
public void performMigration() {
    JobManager jobManager = ApplicationDependencies.getJobManager();
    jobManager.add(new RefreshAttributesJob());
    if (TextSecurePreferences.isMultiDevice(context)) {
        Log.i(TAG, "Multi-device.");
        jobManager.startChain(new StorageForcePushJob()).then(new MultiDeviceKeysUpdateJob()).then(new MultiDeviceStorageSyncRequestJob()).enqueue();
    } else {
        Log.i(TAG, "Single-device.");
        jobManager.add(new StorageForcePushJob());
    }
}
Also used : StorageForcePushJob(org.thoughtcrime.securesms.jobs.StorageForcePushJob) RefreshAttributesJob(org.thoughtcrime.securesms.jobs.RefreshAttributesJob) MultiDeviceStorageSyncRequestJob(org.thoughtcrime.securesms.jobs.MultiDeviceStorageSyncRequestJob) MultiDeviceKeysUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceKeysUpdateJob) JobManager(org.thoughtcrime.securesms.jobmanager.JobManager)

Example 2 with StorageForcePushJob

use of org.thoughtcrime.securesms.jobs.StorageForcePushJob in project Signal-Android by signalapp.

the class StorageCapabilityMigrationJob method performMigration.

@Override
public void performMigration() {
    JobManager jobManager = ApplicationDependencies.getJobManager();
    jobManager.add(new RefreshAttributesJob());
    if (TextSecurePreferences.isMultiDevice(context)) {
        Log.i(TAG, "Multi-device.");
        jobManager.startChain(new StorageForcePushJob()).then(new MultiDeviceKeysUpdateJob()).then(new MultiDeviceStorageSyncRequestJob()).enqueue();
    } else {
        Log.i(TAG, "Single-device.");
        jobManager.add(new StorageForcePushJob());
    }
}
Also used : StorageForcePushJob(org.thoughtcrime.securesms.jobs.StorageForcePushJob) RefreshAttributesJob(org.thoughtcrime.securesms.jobs.RefreshAttributesJob) MultiDeviceStorageSyncRequestJob(org.thoughtcrime.securesms.jobs.MultiDeviceStorageSyncRequestJob) MultiDeviceKeysUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceKeysUpdateJob) JobManager(org.thoughtcrime.securesms.jobmanager.JobManager)

Example 3 with StorageForcePushJob

use of org.thoughtcrime.securesms.jobs.StorageForcePushJob in project Signal-Android by signalapp.

the class PinOptOutMigration method performMigration.

@Override
void performMigration() {
    if (SignalStore.kbsValues().hasOptedOut() && SignalStore.kbsValues().hasPin()) {
        Log.w(TAG, "Discovered a legacy opt-out user! Resetting the state.");
        SignalStore.kbsValues().optOut();
        ApplicationDependencies.getJobManager().add(new RefreshAttributesJob());
        ApplicationDependencies.getJobManager().add(new StorageForcePushJob());
    } else if (SignalStore.kbsValues().hasOptedOut()) {
        Log.i(TAG, "Discovered an opt-out user, but they're already in a good state. No action required.");
    } else {
        Log.i(TAG, "Discovered a normal PIN user. No action required.");
    }
}
Also used : StorageForcePushJob(org.thoughtcrime.securesms.jobs.StorageForcePushJob) RefreshAttributesJob(org.thoughtcrime.securesms.jobs.RefreshAttributesJob)

Example 4 with StorageForcePushJob

use of org.thoughtcrime.securesms.jobs.StorageForcePushJob in project Signal-Android by WhisperSystems.

the class PinOptOutMigration method performMigration.

@Override
void performMigration() {
    if (SignalStore.kbsValues().hasOptedOut() && SignalStore.kbsValues().hasPin()) {
        Log.w(TAG, "Discovered a legacy opt-out user! Resetting the state.");
        SignalStore.kbsValues().optOut();
        ApplicationDependencies.getJobManager().add(new RefreshAttributesJob());
        ApplicationDependencies.getJobManager().add(new StorageForcePushJob());
    } else if (SignalStore.kbsValues().hasOptedOut()) {
        Log.i(TAG, "Discovered an opt-out user, but they're already in a good state. No action required.");
    } else {
        Log.i(TAG, "Discovered a normal PIN user. No action required.");
    }
}
Also used : StorageForcePushJob(org.thoughtcrime.securesms.jobs.StorageForcePushJob) RefreshAttributesJob(org.thoughtcrime.securesms.jobs.RefreshAttributesJob)

Aggregations

RefreshAttributesJob (org.thoughtcrime.securesms.jobs.RefreshAttributesJob)4 StorageForcePushJob (org.thoughtcrime.securesms.jobs.StorageForcePushJob)4 JobManager (org.thoughtcrime.securesms.jobmanager.JobManager)2 MultiDeviceKeysUpdateJob (org.thoughtcrime.securesms.jobs.MultiDeviceKeysUpdateJob)2 MultiDeviceStorageSyncRequestJob (org.thoughtcrime.securesms.jobs.MultiDeviceStorageSyncRequestJob)2