Skip to content

Commit

Permalink
Read the sticker length during backup import.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Feb 28, 2020
1 parent 9c96afe commit 8e795c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.thoughtcrime.securesms.jobmanager.JobManager;
import org.thoughtcrime.securesms.jobs.StickerPackDownloadJob;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.migrations.ApplicationMigrations;
import org.thoughtcrime.securesms.stickers.BlessedPacks;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
Expand All @@ -21,9 +22,13 @@
*/
public final class AppInitialization {

private static final String TAG = Log.tag(AppInitialization.class);

private AppInitialization() {}

public static void onFirstEverAppLaunch(@NonNull Context context) {
Log.i(TAG, "onFirstEverAppLaunch()");

InsightsOptOut.userRequestedOptOut(context);
TextSecurePreferences.setAppMigrationVersion(context, ApplicationMigrations.CURRENT_VERSION);
TextSecurePreferences.setJobManagerVersion(context, JobManager.CURRENT_VERSION);
Expand All @@ -38,6 +43,8 @@ public static void onFirstEverAppLaunch(@NonNull Context context) {
}

public static void onPostBackupRestore(@NonNull Context context) {
Log.i(TAG, "onPostBackupRestore()");

ApplicationDependencies.getMegaphoneRepository().onFirstEverAppLaunch();
SignalStore.onFirstEverAppLaunch();
ApplicationDependencies.getJobManager().add(StickerPackDownloadJob.forInstall(BlessedPacks.ZOZO.getPackId(), BlessedPacks.ZOZO.getPackKey(), false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ private static void processSticker(@NonNull Context context, @NonNull Attachment

ContentValues contentValues = new ContentValues();
contentValues.put(StickerDatabase.FILE_PATH, dataFile.getAbsolutePath());
contentValues.put(StickerDatabase.FILE_LENGTH, sticker.getLength());
contentValues.put(StickerDatabase.FILE_RANDOM, output.first);

db.update(StickerDatabase.TABLE_NAME, contentValues,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ public void onFailure() {

public static final class Factory implements Job.Factory<StickerPackDownloadJob> {
@Override
public @NonNull
StickerPackDownloadJob create(@NonNull Parameters parameters, @NonNull Data data) {
public @NonNull StickerPackDownloadJob create(@NonNull Parameters parameters, @NonNull Data data) {
return new StickerPackDownloadJob(parameters,
data.getString(KEY_PACK_ID),
data.getString(KEY_PACK_KEY),
Expand Down

0 comments on commit 8e795c4

Please sign in to comment.