use of org.thoughtcrime.securesms.jobs.MultiDeviceProfileContentUpdateJob in project Signal-Android by WhisperSystems.
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 WhisperSystems.
the class ManageProfileRepository method clearAvatar.
public void clearAvatar(@NonNull Context context, @NonNull Consumer<Result> callback) {
SignalExecutors.UNBOUNDED.execute(() -> {
try {
ProfileUtil.uploadProfileWithAvatar(context, null);
AvatarHelper.delete(context, Recipient.self().getId());
ApplicationDependencies.getJobManager().add(new MultiDeviceProfileContentUpdateJob());
callback.accept(Result.SUCCESS);
} catch (IOException e) {
Log.w(TAG, "Failed to upload profile during name change.", e);
callback.accept(Result.FAILURE_NETWORK);
}
});
}
use of org.thoughtcrime.securesms.jobs.MultiDeviceProfileContentUpdateJob in project Signal-Android by WhisperSystems.
the class RegistrationCompleteFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
FragmentActivity activity = requireActivity();
RegistrationViewModel viewModel = new ViewModelProvider(activity).get(RegistrationViewModel.class);
if (SignalStore.storageService().needsAccountRestore()) {
Log.i(TAG, "Performing pin restore");
activity.startActivity(new Intent(activity, PinRestoreActivity.class));
} else if (!viewModel.isReregister()) {
boolean needsProfile = Recipient.self().getProfileName().isEmpty() || !AvatarHelper.hasAvatar(activity, Recipient.self().getId());
boolean needsPin = !SignalStore.kbsValues().hasPin();
Log.i(TAG, "Pin restore flow not required." + " profile name: " + Recipient.self().getProfileName().isEmpty() + " profile avatar: " + !AvatarHelper.hasAvatar(activity, Recipient.self().getId()) + " needsPin:" + needsPin);
Intent startIntent = MainActivity.clearTop(activity);
if (needsPin) {
startIntent = chainIntents(CreateKbsPinActivity.getIntentForPinCreate(requireContext()), startIntent);
}
if (needsProfile) {
startIntent = chainIntents(EditProfileActivity.getIntentForUserProfile(activity), startIntent);
}
if (!needsProfile && !needsPin) {
ApplicationDependencies.getJobManager().startChain(new ProfileUploadJob()).then(Arrays.asList(new MultiDeviceProfileKeyUpdateJob(), new MultiDeviceProfileContentUpdateJob())).enqueue();
RegistrationUtil.maybeMarkRegistrationComplete(requireContext());
}
activity.startActivity(startIntent);
}
activity.finish();
ActivityNavigator.applyPopAnimationsToPendingTransition(activity);
}
use of org.thoughtcrime.securesms.jobs.MultiDeviceProfileContentUpdateJob in project Signal-Android by signalapp.
the class ManageProfileRepository method setName.
public void setName(@NonNull Context context, @NonNull ProfileName profileName, @NonNull Consumer<Result> callback) {
SignalExecutors.UNBOUNDED.execute(() -> {
try {
ProfileUtil.uploadProfileWithName(context, profileName);
SignalDatabase.recipients().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);
callback.accept(Result.FAILURE_NETWORK);
}
});
}
use of org.thoughtcrime.securesms.jobs.MultiDeviceProfileContentUpdateJob in project Signal-Android by signalapp.
the class ManageProfileRepository method clearAvatar.
public void clearAvatar(@NonNull Context context, @NonNull Consumer<Result> callback) {
SignalExecutors.UNBOUNDED.execute(() -> {
try {
ProfileUtil.uploadProfileWithAvatar(context, null);
AvatarHelper.delete(context, Recipient.self().getId());
ApplicationDependencies.getJobManager().add(new MultiDeviceProfileContentUpdateJob());
callback.accept(Result.SUCCESS);
} catch (IOException e) {
Log.w(TAG, "Failed to upload profile during name change.", e);
callback.accept(Result.FAILURE_NETWORK);
}
});
}
Aggregations