diff --git a/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java b/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java index a48f9061ba..43b9820d76 100644 --- a/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java +++ b/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java @@ -40,6 +40,7 @@ import org.thoughtcrime.securesms.preferences.AdvancedRingtonePreference; import org.thoughtcrime.securesms.preferences.ColorPreference; import org.thoughtcrime.securesms.recipients.RecipientFactory; import org.thoughtcrime.securesms.recipients.Recipients; +import org.thoughtcrime.securesms.util.DirectoryHelper; import org.thoughtcrime.securesms.util.DynamicLanguage; import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme; import org.thoughtcrime.securesms.util.DynamicTheme; @@ -388,9 +389,13 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi DatabaseFactory.getRecipientPreferenceDatabase(context) .setColor(recipients, selectedColor); - ApplicationContext.getInstance(context) - .getJobManager() - .add(new MultiDeviceContactUpdateJob(context, recipients.getPrimaryRecipient().getRecipientId())); + if (DirectoryHelper.getUserCapabilities(context, recipients) + .getTextCapability() == DirectoryHelper.UserCapabilities.Capability.SUPPORTED) + { + ApplicationContext.getInstance(context) + .getJobManager() + .add(new MultiDeviceContactUpdateJob(context, recipients.getPrimaryRecipient().getRecipientId())); + } return null; } }.execute(); diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java index 450feabc60..9ac4f2d865 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java @@ -19,6 +19,7 @@ import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement; import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.RecipientFactory; import org.thoughtcrime.securesms.recipients.Recipients; +import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.whispersystems.jobqueue.JobParameters; import org.whispersystems.jobqueue.requirements.NetworkRequirement; import org.whispersystems.libsignal.util.guava.Optional; @@ -69,6 +70,11 @@ public class MultiDeviceContactUpdateJob extends MasterSecretJob implements Inje public void onRun(MasterSecret masterSecret) throws IOException, UntrustedIdentityException, NetworkException { + if (!TextSecurePreferences.isMultiDevice(context)) { + Log.w(TAG, "Not multi device, aborting..."); + return; + } + if (recipientId <= 0) generateFullContactUpdate(); else generateSingleContactUpdate(recipientId); } @@ -76,8 +82,8 @@ public class MultiDeviceContactUpdateJob extends MasterSecretJob implements Inje private void generateSingleContactUpdate(long recipientId) throws IOException, UntrustedIdentityException, NetworkException { - SignalServiceMessageSender messageSender = messageSenderFactory.create(); - File contactDataFile = createTempFile("multidevice-contact-update"); + SignalServiceMessageSender messageSender = messageSenderFactory.create(); + File contactDataFile = createTempFile("multidevice-contact-update"); try { DeviceContactsOutputStream out = new DeviceContactsOutputStream(new FileOutputStream(contactDataFile));