-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a2c2ab4
commit 45915be
Showing
7 changed files
with
73 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
app/src/main/java/org/thoughtcrime/securesms/migrations/AttributesMigrationJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.thoughtcrime.securesms.migrations; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies; | ||
import org.thoughtcrime.securesms.jobmanager.Data; | ||
import org.thoughtcrime.securesms.jobmanager.Job; | ||
import org.thoughtcrime.securesms.jobs.ProfileUploadJob; | ||
import org.thoughtcrime.securesms.jobs.RefreshAttributesJob; | ||
import org.thoughtcrime.securesms.jobs.RefreshOwnProfileJob; | ||
import org.thoughtcrime.securesms.logging.Log; | ||
|
||
/** | ||
* Schedules a re-upload of the users attributes followed by a download of their profile. | ||
*/ | ||
public final class AttributesMigrationJob extends MigrationJob { | ||
|
||
private static final String TAG = Log.tag(AttributesMigrationJob.class); | ||
|
||
public static final String KEY = "AttributesMigrationJob"; | ||
|
||
AttributesMigrationJob() { | ||
this(new Parameters.Builder().build()); | ||
} | ||
|
||
private AttributesMigrationJob(@NonNull Parameters parameters) { | ||
super(parameters); | ||
} | ||
|
||
@Override | ||
public boolean isUiBlocking() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public @NonNull String getFactoryKey() { | ||
return KEY; | ||
} | ||
|
||
@Override | ||
public void performMigration() { | ||
Log.i(TAG, "Scheduling attributes upload and profile refresh job chain"); | ||
ApplicationDependencies.getJobManager().startChain(new RefreshAttributesJob()) | ||
.then(new RefreshOwnProfileJob()) | ||
.enqueue(); | ||
} | ||
|
||
@Override | ||
boolean shouldRetry(@NonNull Exception e) { | ||
return false; | ||
} | ||
|
||
public static class Factory implements Job.Factory<AttributesMigrationJob> { | ||
@Override | ||
public @NonNull AttributesMigrationJob create(@NonNull Parameters parameters, @NonNull Data data) { | ||
return new AttributesMigrationJob(parameters); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters