Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@ class ChatActivity :
val scheduledTimeText = dateUtils.getLocalDateTimeStringFromTimestamp(
scheduledAt * DateConstants.SECOND_DIVIDER
)
messageInputFragment.onScheduledMessageSent()
Snackbar.make(
binding.root,
getString(R.string.nc_message_scheduled_at, scheduledTimeText),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,12 @@ class MessageInputFragment : Fragment() {
}
}

fun onScheduledMessageSent() {
binding.fragmentMessageInputView.inputEditText?.setText("")
cancelReply()
cancelCreateThread()
}

private fun restoreState() {
CoroutineScope(Dispatchers.IO).launch {
if (!hasSharedText) {
Expand Down Expand Up @@ -804,15 +810,12 @@ class MessageInputFragment : Fragment() {
if (message.isBlank()) {
return
}
binding.fragmentMessageInputView.inputEditText?.setText("")
chatActivity.showScheduleMessageDialog(
message = message,
sendWithoutNotification = sendWithoutNotification,
replyToMessageId = chatActivity.getReplyToMessageId(),
threadTitle = chatActivity.chatViewModel.messageDraft.threadTitle
)
cancelReply()
cancelCreateThread()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import java.time.LocalDateTime
import java.time.ZoneId
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit
import java.time.temporal.TemporalAdjusters.nextOrSame

class ScheduleMessageCompose(
Expand All @@ -79,7 +80,8 @@ class ScheduleMessageCompose(
private val timeState = mutableStateOf(initialTime())

private fun initialTime(): LocalDateTime {
val scheduled = initialScheduledAt ?: return LocalDateTime.now()
val scheduled = initialScheduledAt
?: return LocalDateTime.now().truncatedTo(ChronoUnit.HOURS).plusHours(1)
return LocalDateTime.ofInstant(Instant.ofEpochSecond(scheduled), ZoneId.systemDefault())
}

Expand Down
Loading