Disable scheduling of voice note messages.
This commit is contained in:
parent
834283ba9b
commit
b94f5501d9
2 changed files with 20 additions and 11 deletions
|
@ -174,7 +174,7 @@ class SendButton(context: Context, attributeSet: AttributeSet?) : AppCompatImage
|
|||
|
||||
val scheduleListener = scheduledSendListener
|
||||
if (availableSendTypes.size == 1) {
|
||||
return if (scheduleListener != null) {
|
||||
return if (scheduleListener?.canSchedule() == true) {
|
||||
scheduleListener.onSendScheduled()
|
||||
true
|
||||
} else if (!SignalStore.misc().smsExportPhase.allowSmsFeatures()) {
|
||||
|
@ -202,7 +202,7 @@ class SendButton(context: Context, attributeSet: AttributeSet?) : AppCompatImage
|
|||
action = { setSendType(option) }
|
||||
)
|
||||
}.toMutableList()
|
||||
if (allowScheduling && listener != null) {
|
||||
if (allowScheduling && listener?.canSchedule() == true) {
|
||||
items += ActionItem(
|
||||
iconRes = R.drawable.ic_calendar_24,
|
||||
title = context.getString(R.string.conversation_activity__option_schedule_message),
|
||||
|
@ -222,5 +222,6 @@ class SendButton(context: Context, attributeSet: AttributeSet?) : AppCompatImage
|
|||
|
||||
interface ScheduledSendListener {
|
||||
fun onSendScheduled()
|
||||
fun canSchedule(): Boolean
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2086,15 +2086,23 @@ public class ConversationParentFragment extends Fragment
|
|||
attachButton.setOnLongClickListener(new AttachButtonLongClickListener());
|
||||
sendButton.setOnClickListener(sendButtonListener);
|
||||
if (FeatureFlags.scheduledMessageSends()) {
|
||||
sendButton.setScheduledSendListener(() -> {
|
||||
ScheduleMessageContextMenu.show(sendButton, (ViewGroup) requireView(), time -> {
|
||||
if (time == -1) {
|
||||
ScheduleMessageTimePickerBottomSheet.showSchedule(getChildFragmentManager());
|
||||
} else {
|
||||
sendMessage(null, time);
|
||||
}
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
sendButton.setScheduledSendListener(new SendButton.ScheduledSendListener() {
|
||||
@Override
|
||||
public void onSendScheduled() {
|
||||
ScheduleMessageContextMenu.show(sendButton, (ViewGroup) requireView(), time -> {
|
||||
if (time == -1) {
|
||||
ScheduleMessageTimePickerBottomSheet.showSchedule(getChildFragmentManager());
|
||||
} else {
|
||||
sendMessage(null, time);
|
||||
}
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSchedule() {
|
||||
return !(inputPanel.isRecordingInLockedMode() || draftViewModel.getVoiceNoteDraft() != null);
|
||||
}
|
||||
});
|
||||
}
|
||||
sendButton.setEnabled(true);
|
||||
|
|
Loading…
Add table
Reference in a new issue