use of org.thoughtcrime.securesms.jobs.ProfileUploadJob in project Signal-Android by WhisperSystems.
the class EditSelfProfileRepository method uploadProfile.
@Override
public void uploadProfile(@NonNull ProfileName profileName, @NonNull String displayName, boolean displayNameChanged, @NonNull String description, boolean descriptionChanged, @Nullable byte[] avatar, boolean avatarChanged, @NonNull Consumer<UploadResult> uploadResultConsumer) {
SimpleTask.run(() -> {
SignalDatabase.recipients().setProfileName(Recipient.self().getId(), profileName);
if (avatarChanged) {
try {
AvatarHelper.setAvatar(context, Recipient.self().getId(), avatar != null ? new ByteArrayInputStream(avatar) : null);
} catch (IOException e) {
return UploadResult.ERROR_IO;
}
}
ApplicationDependencies.getJobManager().startChain(new ProfileUploadJob()).then(Arrays.asList(new MultiDeviceProfileKeyUpdateJob(), new MultiDeviceProfileContentUpdateJob())).enqueue();
RegistrationUtil.maybeMarkRegistrationComplete(context);
if (avatar != null) {
SignalStore.misc().markHasEverHadAnAvatar();
}
return UploadResult.SUCCESS;
}, uploadResultConsumer::accept);
}
use of org.thoughtcrime.securesms.jobs.ProfileUploadJob in project Signal-Android by WhisperSystems.
the class ProfileMigrationJob method performMigration.
@Override
public void performMigration() {
Log.i(TAG, "Scheduling profile upload job");
ApplicationDependencies.getJobManager().add(new ProfileUploadJob());
}
Aggregations