kopia lustrzana https://github.com/ryukoposting/Signal-Android
Send a sync message to fetch the local profile upon editing your profile.
rodzic
02dc457636
commit
39155b55a0
|
@ -9,6 +9,8 @@ import androidx.core.util.Consumer;
|
||||||
import org.signal.core.util.concurrent.SignalExecutors;
|
import org.signal.core.util.concurrent.SignalExecutors;
|
||||||
import org.signal.core.util.logging.Log;
|
import org.signal.core.util.logging.Log;
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
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.keyvalue.SignalStore;
|
||||||
import org.thoughtcrime.securesms.profiles.AvatarHelper;
|
import org.thoughtcrime.securesms.profiles.AvatarHelper;
|
||||||
import org.thoughtcrime.securesms.profiles.ProfileName;
|
import org.thoughtcrime.securesms.profiles.ProfileName;
|
||||||
|
@ -28,6 +30,8 @@ final class ManageProfileRepository {
|
||||||
try {
|
try {
|
||||||
ProfileUtil.uploadProfileWithName(context, profileName);
|
ProfileUtil.uploadProfileWithName(context, profileName);
|
||||||
DatabaseFactory.getRecipientDatabase(context).setProfileName(Recipient.self().getId(), profileName);
|
DatabaseFactory.getRecipientDatabase(context).setProfileName(Recipient.self().getId(), profileName);
|
||||||
|
ApplicationDependencies.getJobManager().add(new MultiDeviceProfileContentUpdateJob());
|
||||||
|
|
||||||
callback.accept(Result.SUCCESS);
|
callback.accept(Result.SUCCESS);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, "Failed to upload profile during name change.", e);
|
Log.w(TAG, "Failed to upload profile during name change.", e);
|
||||||
|
@ -41,6 +45,8 @@ final class ManageProfileRepository {
|
||||||
try {
|
try {
|
||||||
ProfileUtil.uploadProfileWithAbout(context, about, emoji);
|
ProfileUtil.uploadProfileWithAbout(context, about, emoji);
|
||||||
DatabaseFactory.getRecipientDatabase(context).setAbout(Recipient.self().getId(), about, emoji);
|
DatabaseFactory.getRecipientDatabase(context).setAbout(Recipient.self().getId(), about, emoji);
|
||||||
|
ApplicationDependencies.getJobManager().add(new MultiDeviceProfileContentUpdateJob());
|
||||||
|
|
||||||
callback.accept(Result.SUCCESS);
|
callback.accept(Result.SUCCESS);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, "Failed to upload profile during about change.", 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));
|
ProfileUtil.uploadProfileWithAvatar(context, new StreamDetails(new ByteArrayInputStream(data), contentType, data.length));
|
||||||
AvatarHelper.setAvatar(context, Recipient.self().getId(), new ByteArrayInputStream(data));
|
AvatarHelper.setAvatar(context, Recipient.self().getId(), new ByteArrayInputStream(data));
|
||||||
SignalStore.misc().markHasEverHadAnAvatar();
|
SignalStore.misc().markHasEverHadAnAvatar();
|
||||||
|
ApplicationDependencies.getJobManager().add(new MultiDeviceProfileContentUpdateJob());
|
||||||
|
|
||||||
callback.accept(Result.SUCCESS);
|
callback.accept(Result.SUCCESS);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, "Failed to upload profile during avatar change.", e);
|
Log.w(TAG, "Failed to upload profile during avatar change.", e);
|
||||||
|
@ -68,6 +76,7 @@ final class ManageProfileRepository {
|
||||||
try {
|
try {
|
||||||
ProfileUtil.uploadProfileWithAvatar(context, null);
|
ProfileUtil.uploadProfileWithAvatar(context, null);
|
||||||
AvatarHelper.delete(context, Recipient.self().getId());
|
AvatarHelper.delete(context, Recipient.self().getId());
|
||||||
|
ApplicationDependencies.getJobManager().add(new MultiDeviceProfileContentUpdateJob());
|
||||||
|
|
||||||
callback.accept(Result.SUCCESS);
|
callback.accept(Result.SUCCESS);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
Ładowanie…
Reference in New Issue