use of org.thoughtcrime.securesms.database.model.ReactionRecord in project Signal-Android by WhisperSystems.
the class MessageSender method sendNewReaction.
public static void sendNewReaction(@NonNull Context context, @NonNull MessageId messageId, @NonNull String emoji) {
ReactionRecord reaction = new ReactionRecord(emoji, Recipient.self().getId(), System.currentTimeMillis(), System.currentTimeMillis());
SignalDatabase.reactions().addReaction(messageId, reaction);
try {
ApplicationDependencies.getJobManager().add(ReactionSendJob.create(context, messageId, reaction, false));
onMessageSent();
} catch (NoSuchMessageException e) {
Log.w(TAG, "[sendNewReaction] Could not find message! Ignoring.");
}
}
use of org.thoughtcrime.securesms.database.model.ReactionRecord in project Signal-Android by WhisperSystems.
the class ConversationParentFragment method onReactionSelected.
@Override
public void onReactionSelected(MessageRecord messageRecord, String emoji) {
final Context context = requireContext().getApplicationContext();
reactionDelegate.hide();
SignalExecutors.BOUNDED.execute(() -> {
ReactionRecord oldRecord = Stream.of(messageRecord.getReactions()).filter(record -> record.getAuthor().equals(Recipient.self().getId())).findFirst().orElse(null);
if (oldRecord != null && oldRecord.getEmoji().equals(emoji)) {
MessageSender.sendReactionRemoval(context, new MessageId(messageRecord.getId(), messageRecord.isMms()), oldRecord);
} else {
MessageSender.sendNewReaction(context, new MessageId(messageRecord.getId(), messageRecord.isMms()), emoji);
}
});
}
use of org.thoughtcrime.securesms.database.model.ReactionRecord in project Signal-Android by WhisperSystems.
the class ReactWithAnyEmojiRepository method addEmojiToMessage.
void addEmojiToMessage(@NonNull String emoji, @NonNull MessageId messageId) {
SignalExecutors.BOUNDED.execute(() -> {
ReactionRecord oldRecord = Stream.of(SignalDatabase.reactions().getReactions(messageId)).filter(record -> record.getAuthor().equals(Recipient.self().getId())).findFirst().orElse(null);
if (oldRecord != null && oldRecord.getEmoji().equals(emoji)) {
MessageSender.sendReactionRemoval(context, messageId, oldRecord);
} else {
MessageSender.sendNewReaction(context, messageId, emoji);
ThreadUtil.runOnMain(() -> recentEmojiPageModel.onCodePointSelected(emoji));
}
});
}
Aggregations