mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 09:17:44 +00:00
Don't transmit SMS contact information to multi-device on change
Fixes #5710 // FREEBIE
This commit is contained in:
parent
2f9bf27ed7
commit
7d1c5a0d40
@ -40,6 +40,7 @@ import org.thoughtcrime.securesms.preferences.AdvancedRingtonePreference;
|
|||||||
import org.thoughtcrime.securesms.preferences.ColorPreference;
|
import org.thoughtcrime.securesms.preferences.ColorPreference;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||||
|
import org.thoughtcrime.securesms.util.DirectoryHelper;
|
||||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
@ -388,9 +389,13 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
|||||||
DatabaseFactory.getRecipientPreferenceDatabase(context)
|
DatabaseFactory.getRecipientPreferenceDatabase(context)
|
||||||
.setColor(recipients, selectedColor);
|
.setColor(recipients, selectedColor);
|
||||||
|
|
||||||
ApplicationContext.getInstance(context)
|
if (DirectoryHelper.getUserCapabilities(context, recipients)
|
||||||
.getJobManager()
|
.getTextCapability() == DirectoryHelper.UserCapabilities.Capability.SUPPORTED)
|
||||||
.add(new MultiDeviceContactUpdateJob(context, recipients.getPrimaryRecipient().getRecipientId()));
|
{
|
||||||
|
ApplicationContext.getInstance(context)
|
||||||
|
.getJobManager()
|
||||||
|
.add(new MultiDeviceContactUpdateJob(context, recipients.getPrimaryRecipient().getRecipientId()));
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}.execute();
|
}.execute();
|
||||||
|
@ -19,6 +19,7 @@ import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement;
|
|||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||||
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
import org.whispersystems.jobqueue.JobParameters;
|
import org.whispersystems.jobqueue.JobParameters;
|
||||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||||
import org.whispersystems.libsignal.util.guava.Optional;
|
import org.whispersystems.libsignal.util.guava.Optional;
|
||||||
@ -69,6 +70,11 @@ public class MultiDeviceContactUpdateJob extends MasterSecretJob implements Inje
|
|||||||
public void onRun(MasterSecret masterSecret)
|
public void onRun(MasterSecret masterSecret)
|
||||||
throws IOException, UntrustedIdentityException, NetworkException
|
throws IOException, UntrustedIdentityException, NetworkException
|
||||||
{
|
{
|
||||||
|
if (!TextSecurePreferences.isMultiDevice(context)) {
|
||||||
|
Log.w(TAG, "Not multi device, aborting...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (recipientId <= 0) generateFullContactUpdate();
|
if (recipientId <= 0) generateFullContactUpdate();
|
||||||
else generateSingleContactUpdate(recipientId);
|
else generateSingleContactUpdate(recipientId);
|
||||||
}
|
}
|
||||||
@ -76,8 +82,8 @@ public class MultiDeviceContactUpdateJob extends MasterSecretJob implements Inje
|
|||||||
private void generateSingleContactUpdate(long recipientId)
|
private void generateSingleContactUpdate(long recipientId)
|
||||||
throws IOException, UntrustedIdentityException, NetworkException
|
throws IOException, UntrustedIdentityException, NetworkException
|
||||||
{
|
{
|
||||||
SignalServiceMessageSender messageSender = messageSenderFactory.create();
|
SignalServiceMessageSender messageSender = messageSenderFactory.create();
|
||||||
File contactDataFile = createTempFile("multidevice-contact-update");
|
File contactDataFile = createTempFile("multidevice-contact-update");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
DeviceContactsOutputStream out = new DeviceContactsOutputStream(new FileOutputStream(contactDataFile));
|
DeviceContactsOutputStream out = new DeviceContactsOutputStream(new FileOutputStream(contactDataFile));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user