mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Include own profile key in normal contact sync
// FREEBIE
This commit is contained in:
parent
2e5b0bcee2
commit
93395c3ff4
@ -12,6 +12,10 @@ import java.io.IOException;
|
||||
|
||||
public class ProfileKeyUtil {
|
||||
|
||||
public static synchronized boolean hasProfileKey(@NonNull Context context) {
|
||||
return TextSecurePreferences.getProfileKey(context) != null;
|
||||
}
|
||||
|
||||
public static synchronized @NonNull byte[] getProfileKey(@NonNull Context context) {
|
||||
try {
|
||||
String encodedProfileKey = TextSecurePreferences.getProfileKey(context);
|
||||
|
@ -13,6 +13,7 @@ import android.util.Log;
|
||||
import org.thoughtcrime.securesms.contacts.ContactAccessor;
|
||||
import org.thoughtcrime.securesms.contacts.ContactAccessor.ContactData;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.IdentityDatabase;
|
||||
@ -20,6 +21,7 @@ import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.thoughtcrime.securesms.dependencies.SignalCommunicationModule.SignalMessageSenderFactory;
|
||||
import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
@ -137,6 +139,13 @@ public class MultiDeviceContactUpdateJob extends MasterSecretJob implements Inje
|
||||
out.write(new DeviceContact(address.toPhoneString(), name, getAvatar(contactUri), color, verified, profileKey));
|
||||
}
|
||||
|
||||
if (ProfileKeyUtil.hasProfileKey(context)) {
|
||||
out.write(new DeviceContact(TextSecurePreferences.getLocalNumber(context),
|
||||
Optional.absent(), Optional.absent(),
|
||||
Optional.absent(), Optional.absent(),
|
||||
Optional.of(ProfileKeyUtil.getProfileKey(context))));
|
||||
}
|
||||
|
||||
out.close();
|
||||
sendUpdate(messageSender, contactDataFile, true);
|
||||
} catch(InvalidNumberException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user