Send a sync message to fetch the local profile upon editing your profile.

fork-5.53.8
Greyson Parrelli 2021-11-15 17:12:11 -05:00 zatwierdzone przez Cody Henthorne
rodzic 02dc457636
commit 39155b55a0
1 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -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) {