Search in sources :

Example 1 with RefreshAttributesJob

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

the class ApplicationContext method initializeSetVideoCapable.

private void initializeSetVideoCapable() {
    if (TextSecurePreferences.isPushRegistered(this) && !TextSecurePreferences.isWebrtcCallingEnabled(this)) {
        TextSecurePreferences.setWebrtcCallingEnabled(this, true);
        jobManager.add(new RefreshAttributesJob(this));
    }
}
Also used : RefreshAttributesJob(org.thoughtcrime.securesms.jobs.RefreshAttributesJob)

Example 2 with RefreshAttributesJob

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

the class AttributesMigrationJob method performMigration.

@Override
public void performMigration() {
    Log.i(TAG, "Scheduling attributes upload and profile refresh job chain");
    ApplicationDependencies.getJobManager().startChain(new RefreshAttributesJob()).then(new RefreshOwnProfileJob()).enqueue();
}
Also used : RefreshAttributesJob(org.thoughtcrime.securesms.jobs.RefreshAttributesJob) RefreshOwnProfileJob(org.thoughtcrime.securesms.jobs.RefreshOwnProfileJob)

Example 3 with RefreshAttributesJob

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

the class LegacyMigrationJob method performMigration.

@Override
void performMigration() throws RetryLaterException {
    Log.i(TAG, "Running background upgrade..");
    int lastSeenVersion = VersionTracker.getLastSeenVersion(context);
    MasterSecret masterSecret = KeyCachingService.getMasterSecret(context);
    if (lastSeenVersion < SQLCIPHER && masterSecret != null) {
        SignalDatabase.onApplicationLevelUpgrade(context, masterSecret, lastSeenVersion, (progress, total) -> {
            Log.i(TAG, "onApplicationLevelUpgrade: " + progress + "/" + total);
        });
    } else if (lastSeenVersion < SQLCIPHER) {
        throw new RetryLaterException();
    }
    if (lastSeenVersion < NO_V1_VERSION) {
        File v1sessions = new File(context.getFilesDir(), "sessions");
        if (v1sessions.exists() && v1sessions.isDirectory()) {
            File[] contents = v1sessions.listFiles();
            if (contents != null) {
                for (File session : contents) {
                    session.delete();
                }
            }
            v1sessions.delete();
        }
    }
    if (lastSeenVersion < SIGNED_PREKEY_VERSION) {
        CreateSignedPreKeyJob.enqueueIfNeeded();
    }
    if (lastSeenVersion < NO_DECRYPT_QUEUE_VERSION) {
        scheduleMessagesInPushDatabase(context);
    }
    if (lastSeenVersion < PUSH_DECRYPT_SERIAL_ID_VERSION) {
        scheduleMessagesInPushDatabase(context);
    }
    if (lastSeenVersion < MIGRATE_SESSION_PLAINTEXT) {
        // new TextSecureSessionStore(context, masterSecret).migrateSessions();
        // new TextSecurePreKeyStore(context, masterSecret).migrateRecords();
        scheduleMessagesInPushDatabase(context);
        ;
    }
    if (lastSeenVersion < CONTACTS_ACCOUNT_VERSION) {
        ApplicationDependencies.getJobManager().add(new DirectoryRefreshJob(false));
    }
    if (lastSeenVersion < MEDIA_DOWNLOAD_CONTROLS_VERSION) {
        schedulePendingIncomingParts(context);
    }
    if (lastSeenVersion < REDPHONE_SUPPORT_VERSION) {
        ApplicationDependencies.getJobManager().add(new RefreshAttributesJob());
        ApplicationDependencies.getJobManager().add(new DirectoryRefreshJob(false));
    }
    if (lastSeenVersion < PROFILES) {
        ApplicationDependencies.getJobManager().add(new DirectoryRefreshJob(false));
    }
    if (lastSeenVersion < SCREENSHOTS) {
        boolean screenSecurity = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(TextSecurePreferences.SCREEN_SECURITY_PREF, true);
        TextSecurePreferences.setScreenSecurityEnabled(context, screenSecurity);
    }
    if (lastSeenVersion < PERSISTENT_BLOBS) {
        File externalDir = context.getExternalFilesDir(null);
        if (externalDir != null && externalDir.isDirectory() && externalDir.exists()) {
            for (File blob : externalDir.listFiles()) {
                if (blob.exists() && blob.isFile())
                    blob.delete();
            }
        }
    }
    if (lastSeenVersion < INTERNALIZE_CONTACTS) {
        if (SignalStore.account().isRegistered()) {
            TextSecurePreferences.setHasSuccessfullyRetrievedDirectory(context, true);
        }
    }
    if (lastSeenVersion < SQLCIPHER) {
        scheduleMessagesInPushDatabase(context);
    }
    if (lastSeenVersion < SQLCIPHER_COMPLETE) {
        File file = context.getDatabasePath("messages.db");
        if (file != null && file.exists())
            file.delete();
    }
    if (lastSeenVersion < REMOVE_JOURNAL) {
        File file = context.getDatabasePath("messages.db-journal");
        if (file != null && file.exists())
            file.delete();
    }
    if (lastSeenVersion < REMOVE_CACHE) {
        FileUtils.deleteDirectoryContents(context.getCacheDir());
    }
    if (lastSeenVersion < IMAGE_CACHE_CLEANUP) {
        FileUtils.deleteDirectoryContents(context.getExternalCacheDir());
        GlideApp.get(context).clearDiskCache();
    }
    if (lastSeenVersion < COLOR_MIGRATION) {
        long startTime = System.currentTimeMillis();
        // noinspection deprecation
        SignalDatabase.recipients().updateSystemContactColors();
        Log.i(TAG, "Color migration took " + (System.currentTimeMillis() - startTime) + " ms");
    }
    if (lastSeenVersion < UNIDENTIFIED_DELIVERY) {
        Log.i(TAG, "Scheduling UD attributes refresh.");
        ApplicationDependencies.getJobManager().add(new RefreshAttributesJob());
    }
    if (lastSeenVersion < SIGNALING_KEY_DEPRECATION) {
        Log.i(TAG, "Scheduling a RefreshAttributesJob to remove the signaling key remotely.");
        ApplicationDependencies.getJobManager().add(new RefreshAttributesJob());
    }
}
Also used : MasterSecret(org.thoughtcrime.securesms.crypto.MasterSecret) RefreshAttributesJob(org.thoughtcrime.securesms.jobs.RefreshAttributesJob) DirectoryRefreshJob(org.thoughtcrime.securesms.jobs.DirectoryRefreshJob) RetryLaterException(org.thoughtcrime.securesms.transport.RetryLaterException) File(java.io.File)

Example 4 with RefreshAttributesJob

use of org.thoughtcrime.securesms.jobs.RefreshAttributesJob 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 5 with RefreshAttributesJob

use of org.thoughtcrime.securesms.jobs.RefreshAttributesJob 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)

Aggregations

RefreshAttributesJob (org.thoughtcrime.securesms.jobs.RefreshAttributesJob)11 StorageForcePushJob (org.thoughtcrime.securesms.jobs.StorageForcePushJob)4 File (java.io.File)2 MasterSecret (org.thoughtcrime.securesms.crypto.MasterSecret)2 GroupDatabase (org.thoughtcrime.securesms.database.GroupDatabase)2 SyncMessageId (org.thoughtcrime.securesms.database.MessageDatabase.SyncMessageId)2 MessageId (org.thoughtcrime.securesms.database.model.MessageId)2 PendingRetryReceiptModel (org.thoughtcrime.securesms.database.model.PendingRetryReceiptModel)2 BadGroupIdException (org.thoughtcrime.securesms.groups.BadGroupIdException)2 GroupId (org.thoughtcrime.securesms.groups.GroupId)2 JobManager (org.thoughtcrime.securesms.jobmanager.JobManager)2 DirectoryRefreshJob (org.thoughtcrime.securesms.jobs.DirectoryRefreshJob)2 MultiDeviceKeysUpdateJob (org.thoughtcrime.securesms.jobs.MultiDeviceKeysUpdateJob)2 MultiDeviceStorageSyncRequestJob (org.thoughtcrime.securesms.jobs.MultiDeviceStorageSyncRequestJob)2 RefreshOwnProfileJob (org.thoughtcrime.securesms.jobs.RefreshOwnProfileJob)2 Recipient (org.thoughtcrime.securesms.recipients.Recipient)2 RetryLaterException (org.thoughtcrime.securesms.transport.RetryLaterException)2 SignalServiceDataMessage (org.whispersystems.signalservice.api.messages.SignalServiceDataMessage)2 SignalServiceReceiptMessage (org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage)2 SignalServiceCallMessage (org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage)2