From 39155b55a0ae75ea9d1b3866e5ef4f620edfc71c Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Mon, 15 Nov 2021 17:12:11 -0500 Subject: [PATCH] Send a sync message to fetch the local profile upon editing your profile. --- .../profiles/manage/ManageProfileRepository.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/ManageProfileRepository.java b/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/ManageProfileRepository.java index 10863ddb8a..3c5bd485e2 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/ManageProfileRepository.java +++ b/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/ManageProfileRepository.java @@ -9,6 +9,8 @@ import androidx.core.util.Consumer; import org.signal.core.util.concurrent.SignalExecutors; import org.signal.core.util.logging.Log; import org.thoughtcrime.securesms.database.DatabaseFactory; +import org.thoughtcrime.securesms.dependencies.ApplicationDependencies; +import org.thoughtcrime.securesms.jobs.MultiDeviceProfileContentUpdateJob; import org.thoughtcrime.securesms.keyvalue.SignalStore; import org.thoughtcrime.securesms.profiles.AvatarHelper; import org.thoughtcrime.securesms.profiles.ProfileName; @@ -28,6 +30,8 @@ final class ManageProfileRepository { try { ProfileUtil.uploadProfileWithName(context, profileName); DatabaseFactory.getRecipientDatabase(context).setProfileName(Recipient.self().getId(), profileName); + ApplicationDependencies.getJobManager().add(new MultiDeviceProfileContentUpdateJob()); + callback.accept(Result.SUCCESS); } catch (IOException e) { Log.w(TAG, "Failed to upload profile during name change.", e); @@ -41,6 +45,8 @@ final class ManageProfileRepository { try { ProfileUtil.uploadProfileWithAbout(context, about, emoji); DatabaseFactory.getRecipientDatabase(context).setAbout(Recipient.self().getId(), about, emoji); + ApplicationDependencies.getJobManager().add(new MultiDeviceProfileContentUpdateJob()); + callback.accept(Result.SUCCESS); } catch (IOException e) { Log.w(TAG, "Failed to upload profile during about change.", e); @@ -55,6 +61,8 @@ final class ManageProfileRepository { ProfileUtil.uploadProfileWithAvatar(context, new StreamDetails(new ByteArrayInputStream(data), contentType, data.length)); AvatarHelper.setAvatar(context, Recipient.self().getId(), new ByteArrayInputStream(data)); SignalStore.misc().markHasEverHadAnAvatar(); + ApplicationDependencies.getJobManager().add(new MultiDeviceProfileContentUpdateJob()); + callback.accept(Result.SUCCESS); } catch (IOException e) { Log.w(TAG, "Failed to upload profile during avatar change.", e); @@ -68,6 +76,7 @@ final class ManageProfileRepository { try { ProfileUtil.uploadProfileWithAvatar(context, null); AvatarHelper.delete(context, Recipient.self().getId()); + ApplicationDependencies.getJobManager().add(new MultiDeviceProfileContentUpdateJob()); callback.accept(Result.SUCCESS); } catch (IOException e) {