use of org.thoughtcrime.securesms.jobs.MultiDeviceProfileContentUpdateJob in project Signal-Android by signalapp.
the class ManageProfileRepository method setAbout.
public void setAbout(@NonNull Context context, @NonNull String about, @NonNull String emoji, @NonNull Consumer<Result> callback) {
SignalExecutors.UNBOUNDED.execute(() -> {
try {
ProfileUtil.uploadProfileWithAbout(context, about, emoji);
SignalDatabase.recipients().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);
callback.accept(Result.FAILURE_NETWORK);
}
});
}
use of org.thoughtcrime.securesms.jobs.MultiDeviceProfileContentUpdateJob in project Signal-Android by signalapp.
the class ManageProfileRepository method setAvatar.
public void setAvatar(@NonNull Context context, @NonNull byte[] data, @NonNull String contentType, @NonNull Consumer<Result> callback) {
SignalExecutors.UNBOUNDED.execute(() -> {
try {
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);
callback.accept(Result.FAILURE_NETWORK);
}
});
}
Aggregations