Skip to content

Commit

Permalink
Add the "My Daily Life" sticker pack by Plastic Thing.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal authored and alex-signal committed Aug 5, 2021
1 parent 3fca46d commit 89b1243
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import org.thoughtcrime.securesms.migrations.StickerAdditionMigrationJob;
import org.thoughtcrime.securesms.migrations.StickerDayByDayMigrationJob;
import org.thoughtcrime.securesms.migrations.StickerLaunchMigrationJob;
import org.thoughtcrime.securesms.migrations.StickerMyDailyLifeMigrationJob;
import org.thoughtcrime.securesms.migrations.StorageCapabilityMigrationJob;
import org.thoughtcrime.securesms.migrations.StorageServiceMigrationJob;
import org.thoughtcrime.securesms.migrations.TrimByLengthSettingsMigrationJob;
Expand Down Expand Up @@ -190,6 +191,7 @@ public static Map<String, Job.Factory> getJobFactories(@NonNull Application appl
put(StickerLaunchMigrationJob.KEY, new StickerLaunchMigrationJob.Factory());
put(StickerAdditionMigrationJob.KEY, new StickerAdditionMigrationJob.Factory());
put(StickerDayByDayMigrationJob.KEY, new StickerDayByDayMigrationJob.Factory());
put(StickerMyDailyLifeMigrationJob.KEY, new StickerMyDailyLifeMigrationJob.Factory());

This comment has been minimized.

Copy link
@Sgn-32

Sgn-32 Aug 5, 2021

Contributor

some spaces are missing

put(StorageCapabilityMigrationJob.KEY, new StorageCapabilityMigrationJob.Factory());
put(StorageServiceMigrationJob.KEY, new StorageServiceMigrationJob.Factory());
put(TrimByLengthSettingsMigrationJob.KEY, new TrimByLengthSettingsMigrationJob.Factory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ private static final class Version {
static final int LOG_CLEANUP = 39;
static final int ATTACHMENT_CLEANUP_2 = 40;
static final int ANNOUNCEMENT_GROUP_CAPABILITY = 41;
static final int STICKER_MY_DAILY_LIFE = 42;
}

public static final int CURRENT_VERSION = 41;
public static final int CURRENT_VERSION = 42;

/**
* This *must* be called after the {@link JobManager} has been instantiated, but *before* the call
Expand Down Expand Up @@ -357,6 +358,10 @@ private static LinkedHashMap<Integer, MigrationJob> getMigrationJobs(@NonNull Co
jobs.put(Version.ANNOUNCEMENT_GROUP_CAPABILITY, new AttributesMigrationJob());
}

if (lastSeenVersion < Version.STICKER_MY_DAILY_LIFE) {
jobs.put(Version.STICKER_MY_DAILY_LIFE, new StickerMyDailyLifeMigrationJob());
}

return jobs;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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.StickerPackDownloadJob;
import org.thoughtcrime.securesms.stickers.BlessedPacks;

/**
* Installs Piece of Cake blessed pack.
*/
public class StickerMyDailyLifeMigrationJob extends MigrationJob {

public static final String KEY = "StickerMyDailyLifeMigrationJob";

StickerMyDailyLifeMigrationJob() {
this(new Parameters.Builder().build());
}

private StickerMyDailyLifeMigrationJob(@NonNull Parameters parameters) {
super(parameters);
}

@Override
public boolean isUiBlocking() {
return false;
}

@Override
public @NonNull String getFactoryKey() {
return KEY;
}

@Override
public void performMigration() {
ApplicationDependencies.getJobManager().add(StickerPackDownloadJob.forInstall(BlessedPacks.MY_DAILY_LIFE.getPackId(), BlessedPacks.MY_DAILY_LIFE.getPackKey(), false));
}

@Override
boolean shouldRetry(@NonNull Exception e) {
return false;
}

public static class Factory implements Job.Factory<StickerMyDailyLifeMigrationJob> {
@Override
public @NonNull StickerMyDailyLifeMigrationJob create(@NonNull Parameters parameters, @NonNull Data data) {
return new StickerMyDailyLifeMigrationJob(parameters);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@
*/
public final class BlessedPacks {

public static final Pack ZOZO = new Pack("fb535407d2f6497ec074df8b9c51dd1d", "17e971c134035622781d2ee249e6473b774583750b68c11bb82b7509c68b6dfd");
public static final Pack BANDIT = new Pack("9acc9e8aba563d26a4994e69263e3b25", "5a6dff3948c28efb9b7aaf93ecc375c69fc316e78077ed26867a14d10a0f6a12");
public static final Pack SWOON_HANDS = new Pack("e61fa0867031597467ccc036cc65d403", "13ae7b1a7407318280e9b38c1261ded38e0e7138b9f964a6ccbb73e40f737a9b");
public static final Pack SWOON_FACES = new Pack("cca32f5b905208b7d0f1e17f23fdc185", "8bf8e95f7a45bdeafe0c8f5b002ef01ab95b8f1b5baac4019ccd6b6be0b1837a");
public static final Pack DAY_BY_DAY = new Pack("cfc50156556893ef9838069d3890fe49", "5f5beab7d382443cb00a1e48eb95297b6b8cadfd0631e5d0d9dc949e6999ff4b");
public static final Pack ZOZO = new Pack("fb535407d2f6497ec074df8b9c51dd1d", "17e971c134035622781d2ee249e6473b774583750b68c11bb82b7509c68b6dfd");
public static final Pack BANDIT = new Pack("9acc9e8aba563d26a4994e69263e3b25", "5a6dff3948c28efb9b7aaf93ecc375c69fc316e78077ed26867a14d10a0f6a12");
public static final Pack SWOON_HANDS = new Pack("e61fa0867031597467ccc036cc65d403", "13ae7b1a7407318280e9b38c1261ded38e0e7138b9f964a6ccbb73e40f737a9b");
public static final Pack SWOON_FACES = new Pack("cca32f5b905208b7d0f1e17f23fdc185", "8bf8e95f7a45bdeafe0c8f5b002ef01ab95b8f1b5baac4019ccd6b6be0b1837a");
public static final Pack DAY_BY_DAY = new Pack("cfc50156556893ef9838069d3890fe49", "5f5beab7d382443cb00a1e48eb95297b6b8cadfd0631e5d0d9dc949e6999ff4b");
public static final Pack MY_DAILY_LIFE = new Pack("ccc89a05dc077856b57351e90697976c", "45730e60f09d5566115223744537a6b7d9ea99ceeacb77a1fbd6801b9607fbcf");

private static final Set<String> BLESSED_PACK_IDS = new HashSet<String>() {{
add(ZOZO.getPackId());
add(BANDIT.getPackId());
add(SWOON_HANDS.getPackId());
add(SWOON_FACES.getPackId());
add(DAY_BY_DAY.getPackId());
add(MY_DAILY_LIFE.getPackId());
}};

public static boolean contains(@NonNull String packId) {
Expand Down

0 comments on commit 89b1243

Please sign in to comment.