File tree Expand file tree Collapse file tree
app/src/main/java/com/nextcloud/talk/chat Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -959,6 +959,7 @@ class ChatActivity :
959959 val scheduledTimeText = dateUtils.getLocalDateTimeStringFromTimestamp(
960960 scheduledAt * DateConstants .SECOND_DIVIDER
961961 )
962+ messageInputFragment.onScheduledMessageSent()
962963 Snackbar .make(
963964 binding.root,
964965 getString(R .string.nc_message_scheduled_at, scheduledTimeText),
Original file line number Diff line number Diff line change @@ -374,6 +374,12 @@ class MessageInputFragment : Fragment() {
374374 }
375375 }
376376
377+ fun onScheduledMessageSent () {
378+ binding.fragmentMessageInputView.inputEditText?.setText(" " )
379+ cancelReply()
380+ cancelCreateThread()
381+ }
382+
377383 private fun restoreState () {
378384 CoroutineScope (Dispatchers .IO ).launch {
379385 if (! hasSharedText) {
@@ -804,15 +810,12 @@ class MessageInputFragment : Fragment() {
804810 if (message.isBlank()) {
805811 return
806812 }
807- binding.fragmentMessageInputView.inputEditText?.setText(" " )
808813 chatActivity.showScheduleMessageDialog(
809814 message = message,
810815 sendWithoutNotification = sendWithoutNotification,
811816 replyToMessageId = chatActivity.getReplyToMessageId(),
812817 threadTitle = chatActivity.chatViewModel.messageDraft.threadTitle
813818 )
814- cancelReply()
815- cancelCreateThread()
816819 }
817820 }
818821
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ import java.time.LocalDateTime
6666import java.time.ZoneId
6767import java.time.ZoneOffset
6868import java.time.format.DateTimeFormatter
69+ import java.time.temporal.ChronoUnit
6970import java.time.temporal.TemporalAdjusters.nextOrSame
7071
7172class ScheduleMessageCompose (
@@ -79,7 +80,8 @@ class ScheduleMessageCompose(
7980 private val timeState = mutableStateOf(initialTime())
8081
8182 private fun initialTime (): LocalDateTime {
82- val scheduled = initialScheduledAt ? : return LocalDateTime .now()
83+ val scheduled = initialScheduledAt
84+ ? : return LocalDateTime .now().truncatedTo(ChronoUnit .HOURS ).plusHours(1 )
8385 return LocalDateTime .ofInstant(Instant .ofEpochSecond(scheduled), ZoneId .systemDefault())
8486 }
8587
You can’t perform that action at this time.
0 commit comments