From 9c44a0c7d3fae07eb81d63264eb1cbe52b528055 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Thu, 9 Jul 2020 07:57:37 -0400 Subject: [PATCH] Don't run ProfileUploadJob if you're not registered. --- .../thoughtcrime/securesms/jobs/ProfileUploadJob.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/ProfileUploadJob.java b/app/src/main/java/org/thoughtcrime/securesms/jobs/ProfileUploadJob.java index c62e3362c3..78259b157b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/ProfileUploadJob.java +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/ProfileUploadJob.java @@ -11,14 +11,18 @@ import org.thoughtcrime.securesms.dependencies.ApplicationDependencies; import org.thoughtcrime.securesms.jobmanager.Data; import org.thoughtcrime.securesms.jobmanager.Job; import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint; +import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.profiles.AvatarHelper; import org.thoughtcrime.securesms.profiles.ProfileName; import org.thoughtcrime.securesms.recipients.Recipient; +import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.whispersystems.signalservice.api.SignalServiceAccountManager; import org.whispersystems.signalservice.api.util.StreamDetails; public final class ProfileUploadJob extends BaseJob { + private static final String TAG = Log.tag(ProfileUploadJob.class); + public static final String KEY = "ProfileUploadJob"; public static final String QUEUE = "ProfileAlteration"; @@ -45,6 +49,11 @@ public final class ProfileUploadJob extends BaseJob { @Override protected void onRun() throws Exception { + if (!TextSecurePreferences.isPushRegistered(context)) { + Log.w(TAG, "Not registered. Skipping."); + return; + } + ProfileKey profileKey = ProfileKeyUtil.getSelfProfileKey(); ProfileName profileName = Recipient.self().getProfileName(); String avatarPath;