diff --git a/app/build.gradle b/app/build.gradle index 7a55a0769bf..3ad4017cb58 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -212,7 +212,6 @@ dependencies { implementation "androidx.emoji2:emoji2-bundled:${emojiVersion}" implementation "androidx.emoji2:emoji2-views:${emojiVersion}" implementation "androidx.emoji2:emoji2-views-helper:${emojiVersion}" - implementation "androidx.emoji2:emoji2-emojipicker:${emojiVersion}" implementation 'org.michaelevans.colorart:library:0.0.3' implementation "androidx.work:work-runtime:${workVersion}" implementation "androidx.work:work-rxjava2:${workVersion}" diff --git a/app/src/main/java/com/nextcloud/talk/api/NcApiCoroutines.kt b/app/src/main/java/com/nextcloud/talk/api/NcApiCoroutines.kt index 7dec29b47e8..c01d7e3a025 100644 --- a/app/src/main/java/com/nextcloud/talk/api/NcApiCoroutines.kt +++ b/app/src/main/java/com/nextcloud/talk/api/NcApiCoroutines.kt @@ -345,8 +345,6 @@ interface NcApiCoroutines { @Header("Authorization") authorization: String, @Url url: String, @Field("message") message: String, - @Field("actorDisplayName") actorDisplayName: String, - @Field("referenceId") referenceId: String, @Field("replyTo") replyTo: Int?, @Field("silent") sendWithoutNotification: Boolean, @Field("threadTitle") threadTitle: String?, @@ -356,16 +354,12 @@ interface NcApiCoroutines { @FormUrlEncoded @POST - @Suppress("LongParameterList") suspend fun updateScheduledMessage( @Header("Authorization") authorization: String, @Url url: String, @Field("message") message: String, @Field("sendAt") sendAt: Int?, - @Field("replyTo") replyTo: Int?, - @Field("silent") sendWithoutNotification: Boolean, - @Field("threadTitle") threadTitle: String?, - @Field("threadId") threadId: Long? + @Field("silent") sendWithoutNotification: Boolean ): ChatOverallSingleMessage @DELETE diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt index 949e97231fe..62fc0823f42 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -2543,7 +2543,7 @@ class ChatActivity : (layoutManager as LinearLayoutManager).scrollToPositionWithOffset(position, 500) } else { Log.d(TAG, "message $messageId that should be scrolled to was not found (scrollToMessageWithId)") - startContextChatWindowForMessage(messageId, conversationThreadId.toString()) + startContextChatWindowForMessage(messageId, conversationThreadId?.toString()) } } @@ -3523,7 +3523,6 @@ class ChatActivity : roomToken ), message = message, - displayName = conversationUser!!.displayName ?: "", replyTo = replyToMessageId, sendWithoutNotification = sendWithoutNotification, threadTitle = threadTitle, diff --git a/app/src/main/java/com/nextcloud/talk/chat/ScheduleMessageCompose.kt b/app/src/main/java/com/nextcloud/talk/chat/ScheduleMessageCompose.kt index 6327d716d15..e0863d15bc9 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ScheduleMessageCompose.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ScheduleMessageCompose.kt @@ -11,8 +11,6 @@ package com.nextcloud.talk.chat import android.content.Context import android.text.format.DateFormat -import androidx.compose.foundation.background -import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.Column @@ -25,6 +23,7 @@ import androidx.compose.foundation.layout.requiredSizeIn import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.wrapContentHeight +import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll @@ -248,19 +247,35 @@ class ScheduleMessageCompose( val context = LocalContext.current Row( modifier = Modifier - .padding(INT_8.dp) + .padding(start = 8.dp, end = 8.dp, top = 6.dp, bottom = 8.dp) .fillMaxWidth() ) { Text(stringResource(R.string.nc_schedule_message_title), modifier = Modifier.weight(HALF_WEIGHT)) - val timeText = timeState.value.format(DateTimeFormatter.ofPattern(fullPattern(context))) - - Spacer(modifier = Modifier.width(60.dp)) + val dateText = timeState.value.format( + DateTimeFormatter.ofPattern("EEE, dd MMM") + ) - Text( - timeText, - modifier = Modifier.weight(HALF_WEIGHT) + val timeText = timeState.value.format( + DateTimeFormatter.ofPattern( + if (DateFormat.is24HourFormat(context)) { + "HH:mm" + } else { + "hh:mm a" + } + ) ) + + Spacer(modifier = Modifier.width(44.dp)) + + Column(modifier = Modifier.weight(HALF_WEIGHT)) { + Text( + text = dateText + ) + Text( + text = timeText + ) + } } HorizontalDivider() } @@ -363,24 +378,28 @@ class ScheduleMessageCompose( @Composable private fun TimeOption(label: String, timeString: String, selected: Boolean, onClick: () -> Unit) { - Row( + Surface( + onClick = onClick, modifier = Modifier - .fillMaxWidth() - .padding(INT_8.dp) - .background( - if (selected) { - MaterialTheme.colorScheme.primary - } else { - Color - .Transparent - }, - RoundedCornerShape(4.dp) - ) - .clickable { onClick() } + .wrapContentWidth(), + color = if (selected) { + MaterialTheme.colorScheme.inversePrimary + } else { + Color.Transparent + }, + shape = RoundedCornerShape(10.dp) ) { - Text(label, modifier = Modifier.weight(HALF_WEIGHT)) - Spacer(modifier = Modifier.width(60.dp)) - Text(timeString, modifier = Modifier.weight(HALF_WEIGHT)) + Row( + modifier = Modifier + .fillMaxWidth() + .padding(start = 8.dp, end = 6.dp, top = 6.dp, bottom = 8.dp), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween + ) { + Text(text = label, modifier = Modifier.weight(HALF_WEIGHT)) + Spacer(modifier = Modifier.width(44.dp)) + Text(text = timeString, modifier = Modifier.weight(HALF_WEIGHT)) + } } } diff --git a/app/src/main/java/com/nextcloud/talk/chat/ScheduledMessagesActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ScheduledMessagesActivity.kt index fdc7f1aab43..872830b46f8 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ScheduledMessagesActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ScheduledMessagesActivity.kt @@ -7,6 +7,7 @@ package com.nextcloud.talk.chat +import android.content.Intent import android.os.Bundle import androidx.activity.compose.setContent import androidx.compose.foundation.background @@ -17,10 +18,12 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.wrapContentHeight @@ -29,18 +32,20 @@ import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.outlined.ArrowBack -import androidx.compose.material.icons.automirrored.outlined.ScheduleSend import androidx.compose.material.icons.automirrored.outlined.Send import androidx.compose.material.icons.outlined.AccessTime +import androidx.compose.material.icons.outlined.Check +import androidx.compose.material.icons.outlined.Close import androidx.compose.material.icons.outlined.Delete import androidx.compose.material.icons.outlined.Edit +import androidx.compose.material.icons.outlined.InsertEmoticon +import androidx.compose.material.icons.outlined.Keyboard import androidx.compose.material.icons.outlined.NotificationsOff import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ModalBottomSheet -import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarHost import androidx.compose.material3.SnackbarHostState @@ -50,21 +55,22 @@ import androidx.compose.material3.TextButton import androidx.compose.material3.TopAppBar import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable +import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.drawBehind -import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalSoftwareKeyboardController +import androidx.compose.ui.platform.LocalView import androidx.compose.ui.res.colorResource import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource @@ -72,11 +78,12 @@ import androidx.compose.ui.text.TextRange import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.viewinterop.AndroidView -import androidx.emoji2.emojipicker.EmojiPickerView +import androidx.core.widget.addTextChangedListener import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.compose.collectAsStateWithLifecycle import autodagger.AutoInjector @@ -93,12 +100,17 @@ import com.nextcloud.talk.models.json.chat.ChatUtils import com.nextcloud.talk.utils.ApiUtils import com.nextcloud.talk.utils.DateConstants import com.nextcloud.talk.utils.DateUtils +import com.nextcloud.talk.utils.bundle.BundleKeys +import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN +import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_THREAD_ID +import com.vanniktech.emoji.EmojiEditText +import com.vanniktech.emoji.EmojiPopup import java.time.Instant -import javax.inject.Inject import java.time.LocalDate import java.time.ZoneId import java.time.format.DateTimeFormatter import java.time.temporal.ChronoUnit +import javax.inject.Inject @AutoInjector(NextcloudTalkApplication::class) @Suppress("LongMethod", "LargeClass", "TooManyFunctions", "COMPOSE_APPLIER_CALL_MISMATCH") @@ -153,7 +165,10 @@ class ScheduledMessagesActivity : BaseActivity() { onEdit = { message, sendAt -> edit(message, sendAt, user) }, - onDeleteScheduledMessage = { message -> deleteScheduledMessage(message, user) } + onDeleteScheduledMessage = { message -> deleteScheduledMessage(message, user) }, + onOpenParentMessage = { messageId, threadId -> + openParentMessage(messageId, threadId) + } ) } } @@ -198,10 +213,7 @@ class ScheduledMessagesActivity : BaseActivity() { ), message = message.message.orEmpty(), sendAt = sendAt, - replyTo = message.parentMessageId?.toInt(), - sendWithoutNotification = message.silent, - threadTitle = message.threadTitle, - threadId = message.threadId + sendWithoutNotification = message.silent ) } @@ -215,10 +227,7 @@ class ScheduledMessagesActivity : BaseActivity() { ), message = message.message.orEmpty(), sendAt = sendAt, - replyTo = message.parentMessageId?.toInt(), - sendWithoutNotification = message.silent, - threadTitle = message.threadTitle, - threadId = message.threadId + sendWithoutNotification = message.silent ) } @@ -246,7 +255,8 @@ class ScheduledMessagesActivity : BaseActivity() { onSendNow: (ChatMessage) -> Unit, onReschedule: (ChatMessage, Int) -> Unit, onEdit: (ChatMessage, Int) -> Unit, - onDeleteScheduledMessage: (ChatMessage) -> Unit + onDeleteScheduledMessage: (ChatMessage) -> Unit, + onOpenParentMessage: (Long?, Long?) -> Unit ) { val snackBarHostState = remember { SnackbarHostState() } val scheduledState by scheduledMessagesViewModel.getScheduledMessagesState.collectAsStateWithLifecycle() @@ -347,7 +357,8 @@ class ScheduledMessagesActivity : BaseActivity() { } ) }, - snackbarHost = { SnackbarHost(snackBarHostState) } + snackbarHost = { SnackbarHost(snackBarHostState) }, + contentWindowInsets = WindowInsets.safeDrawing ) { paddingValues -> Column( modifier = Modifier.padding(paddingValues) @@ -421,6 +432,14 @@ class ScheduledMessagesActivity : BaseActivity() { parentMessage = parentMessage, dateUtils = dateUtils, viewThemeUtils = viewThemeUtils, + onClick = { + val parentId = message.parentMessageId + if (message.threadId != null) { + onOpenParentMessage(parentId, message.threadId) + } else if (parentId != null) { + onOpenParentMessage(parentId, message.threadId) + } + }, onLongPress = { selectedMessage = message showActionsSheet = true @@ -540,6 +559,7 @@ class ScheduledMessagesActivity : BaseActivity() { text = stringResource(R.string.no_scheduled_messages_offline), fontSize = 12.sp, textAlign = TextAlign.Center, + color = Color.White, modifier = Modifier.padding(4.dp) ) } @@ -590,11 +610,13 @@ class ScheduledMessagesActivity : BaseActivity() { } @Composable + @Suppress("LongMethod", "LongParameterList") private fun ScheduledMessageBubble( message: ChatMessage, parentMessage: ChatMessage?, dateUtils: DateUtils, viewThemeUtils: com.nextcloud.talk.ui.theme.ViewThemeUtils, + onClick: () -> Unit, onLongPress: () -> Unit ) { val context = LocalContext.current @@ -606,6 +628,9 @@ class ScheduledMessagesActivity : BaseActivity() { Color(viewThemeUtils.talk.getOutgoingMessageBubbleColor(context, message.isDeleted, false)) } + val isClickable = remember(message.threadTitle, parentMessage) { + !message.threadTitle.isNullOrBlank() || parentMessage != null + } Row( modifier = Modifier .fillMaxWidth() @@ -618,7 +643,19 @@ class ScheduledMessagesActivity : BaseActivity() { tonalElevation = 1.dp, modifier = Modifier .width(IntrinsicSize.Max) - .combinedClickable(onClick = {}, onLongClick = onLongPress) + .then( + if (isClickable) { + Modifier.combinedClickable( + onClick = onClick, + onLongClick = onLongPress + ) + } else { + Modifier.combinedClickable( + onClick = {}, + onLongClick = onLongPress + ) + } + ) ) { val strokeColor = MaterialTheme.colorScheme.primary Column(modifier = Modifier.padding(8.dp)) { @@ -703,27 +740,27 @@ class ScheduledMessagesActivity : BaseActivity() { @OptIn(ExperimentalMaterial3Api::class) @Suppress("LongMethod") @Composable - private fun ScheduledMessageEditRow( + fun ScheduledMessageEditRow( editValue: TextFieldValue, originalText: String, onEditValueChange: (TextFieldValue) -> Unit, onCancel: () -> Unit, onSend: () -> Unit ) { - var showEmojiPicker by remember { mutableStateOf(false) } - val canSend = editValue.text.isNotBlank() && editValue.text.trim() != originalText.trim() + val rootView = LocalView.current + val keyboardController = LocalSoftwareKeyboardController.current - val keyboardController = androidx.compose.ui.platform.LocalSoftwareKeyboardController.current - val focusManager = androidx.compose.ui.platform.LocalFocusManager.current - val focusRequester = remember { androidx.compose.ui.focus.FocusRequester() } + val emojiEditTextRef = remember { mutableStateOf(null) } + var emojiPopup by remember { mutableStateOf(null) } + var isEmojiOpen by remember { mutableStateOf(false) } - LaunchedEffect(showEmojiPicker) { - if (showEmojiPicker) { - keyboardController?.hide() - focusManager.clearFocus() - } else { - focusRequester.requestFocus() - keyboardController?.show() + val canSend = + editValue.text.isNotBlank() && + editValue.text.trim() != originalText.trim() + + DisposableEffect(rootView) { + onDispose { + emojiPopup?.dismiss() } } @@ -734,25 +771,24 @@ class ScheduledMessagesActivity : BaseActivity() { modifier = Modifier.fillMaxWidth() ) { Icon( - painter = painterResource(R.drawable.ic_edit), + imageVector = Icons.Outlined.Edit, contentDescription = null, - modifier = Modifier.size(20.dp), - tint = MaterialTheme.colorScheme.onSurfaceVariant + modifier = Modifier.size(20.dp) ) - Spacer(modifier = Modifier.width(8.dp)) + Spacer(Modifier.width(8.dp)) Text( text = stringResource(R.string.nc_edit_message_text), style = MaterialTheme.typography.labelLarge, modifier = Modifier.weight(1f) ) IconButton(onClick = { - showEmojiPicker = false + emojiPopup?.dismiss() + keyboardController?.hide() onCancel() }) { Icon( - painter = painterResource(R.drawable.ic_baseline_close_24), - contentDescription = null, - tint = MaterialTheme.colorScheme.onSurfaceVariant + imageVector = Icons.Outlined.Close, + contentDescription = null ) } } @@ -761,64 +797,94 @@ class ScheduledMessagesActivity : BaseActivity() { text = originalText, modifier = Modifier.padding(top = 4.dp, bottom = 8.dp), style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant + maxLines = 1, + overflow = TextOverflow.Ellipsis ) Row( modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically ) { - IconButton( - onClick = { - showEmojiPicker = !showEmojiPicker + IconButton(onClick = { + val editText = emojiEditTextRef.value ?: return@IconButton + + if (emojiPopup == null) { + emojiPopup = EmojiPopup( + rootView = rootView, + editText = editText, + onEmojiPopupShownListener = { + isEmojiOpen = true + }, + onEmojiPopupDismissListener = { + isEmojiOpen = false + keyboardController?.show() + } + ) } - ) { + + emojiPopup?.toggle() + }) { Icon( - painter = painterResource(R.drawable.ic_insert_emoticon_black_24dp), - contentDescription = null + imageVector = if (isEmojiOpen) { + Icons.Outlined.Keyboard + } else { + Icons.Outlined.InsertEmoticon + }, + contentDescription = null, + tint = MaterialTheme.colorScheme.onSurfaceVariant ) } - OutlinedTextField( - value = editValue, - onValueChange = { onEditValueChange(it) }, + AndroidView( modifier = Modifier .weight(1f) - .focusRequester(focusRequester), - placeholder = { Text(stringResource(R.string.nc_hint_enter_a_message)) } + .wrapContentHeight(), + factory = { context -> + EmojiEditText(context).apply { + setText(editValue.text) + setSelection(editValue.text.length) + hint = context.getString(R.string.nc_hint_enter_a_message) + setPadding(INT_24, INT_20, INT_24, INT_20) + emojiEditTextRef.value = this + addTextChangedListener { + val text = it?.toString().orEmpty() + if (text != editValue.text) { + onEditValueChange( + TextFieldValue(text, TextRange(text.length)) + ) + } + } + } + }, + update = { + if (it.text.toString() != editValue.text) { + it.setText(editValue.text) + } + it.setSelection(editValue.text.length) + } ) IconButton( - onClick = { if (canSend) onSend() }, + onClick = { + if (!canSend) return@IconButton + emojiEditTextRef.value?.clearFocus() + emojiPopup?.dismiss() + keyboardController?.hide() + onSend() + }, enabled = canSend ) { Icon( - painter = painterResource(R.drawable.ic_check_24), + imageVector = Icons.Outlined.Check, contentDescription = null, - tint = if (canSend) MaterialTheme.colorScheme.primary else Color.Gray + tint = if (canSend) { + MaterialTheme.colorScheme.primary + } else { + MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.4f) + } ) } } - - if (showEmojiPicker) { - Spacer(modifier = Modifier.height(8.dp)) - val latestEditValue by rememberUpdatedState(editValue) - AndroidView( - modifier = Modifier - .fillMaxWidth() - .height(320.dp), - factory = { context -> - EmojiPickerView(context).apply { - setOnEmojiPickedListener { picked -> - val editedEmoji = latestEditValue.text + picked.emoji - onEditValueChange( - TextFieldValue(editedEmoji, selection = TextRange(editedEmoji.length)) - ) - } - } - } - ) - } } } } @@ -832,7 +898,23 @@ class ScheduledMessagesActivity : BaseActivity() { onDelete: () -> Unit ) { Column(modifier = Modifier.fillMaxWidth()) { - ActionRow(icon = Icons.AutoMirrored.Outlined.ScheduleSend, text = scheduledTime, onClick = {}) + Column( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp, vertical = 12.dp) + ) { + Text( + text = stringResource(R.string.nc_scheduled_time), + fontSize = 13.sp, + color = colorResource(R.color.no_emphasis_text) + ) + Spacer(modifier = Modifier.height(2.dp)) + Text( + text = scheduledTime, + fontSize = 13.sp, + color = colorResource(R.color.no_emphasis_text) + ) + } ActionRow( icon = Icons.Outlined.AccessTime, text = stringResource(R.string.nc_reschedule_message), @@ -848,6 +930,18 @@ class ScheduledMessagesActivity : BaseActivity() { } } + private fun openParentMessage(messageId: Long?, threadId: Long?) { + val intent = Intent(this, ChatActivity::class.java).apply { + putExtra(KEY_ROOM_TOKEN, roomToken) + if (threadId != null && threadId > 0) { + putExtra(KEY_THREAD_ID, threadId) + } else { + messageId?.let { putExtra(BundleKeys.KEY_MESSAGE_ID, it.toString()) } + } + } + startActivity(intent) + } + @Composable private fun ActionRow(icon: ImageVector, text: String, onClick: () -> Unit) { TextButton( @@ -904,5 +998,7 @@ class ScheduledMessagesActivity : BaseActivity() { const val INT_6: Int = 6 const val INT_0: Int = 0 const val INT_1: Int = 1 + const val INT_24: Int = 24 + const val INT_20: Int = 20 } } diff --git a/app/src/main/java/com/nextcloud/talk/chat/data/ChatMessageRepository.kt b/app/src/main/java/com/nextcloud/talk/chat/data/ChatMessageRepository.kt index 854f7821b2d..f040b166589 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/data/ChatMessageRepository.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/data/ChatMessageRepository.kt @@ -133,8 +133,6 @@ interface ChatMessageRepository : LifecycleAwareManager { credentials: String, url: String, message: String, - displayName: String, - referenceId: String, replyTo: Int?, sendWithoutNotification: Boolean, threadTitle: String?, @@ -148,10 +146,7 @@ interface ChatMessageRepository : LifecycleAwareManager { url: String, message: String, sendAt: Int?, - replyTo: Int?, - sendWithoutNotification: Boolean, - threadTitle: String?, - threadId: Long? + sendWithoutNotification: Boolean ): Flow> suspend fun deleteScheduledChatMessage(credentials: String, url: String): Flow> diff --git a/app/src/main/java/com/nextcloud/talk/chat/data/network/ChatNetworkDataSource.kt b/app/src/main/java/com/nextcloud/talk/chat/data/network/ChatNetworkDataSource.kt index 4913b480797..dfd437e24db 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/data/network/ChatNetworkDataSource.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/data/network/ChatNetworkDataSource.kt @@ -85,8 +85,6 @@ interface ChatNetworkDataSource { credentials: String, url: String, message: String, - displayName: String, - referenceId: String, replyTo: Int?, sendWithoutNotification: Boolean, threadTitle: String?, @@ -99,10 +97,7 @@ interface ChatNetworkDataSource { url: String, message: String, sendAt: Int?, - replyTo: Int?, - sendWithoutNotification: Boolean, - threadTitle: String?, - threadId: Long? + sendWithoutNotification: Boolean ): ChatOverallSingleMessage suspend fun deleteScheduledMessage(credentials: String, url: String): GenericOverall diff --git a/app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt b/app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt index 4cb0ef505a0..e77cbadc607 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt @@ -1117,8 +1117,6 @@ class OfflineFirstChatRepository @Inject constructor( credentials: String, url: String, message: String, - displayName: String, - referenceId: String, replyTo: Int?, sendWithoutNotification: Boolean, threadTitle: String?, @@ -1130,8 +1128,6 @@ class OfflineFirstChatRepository @Inject constructor( credentials, url, message, - displayName, - referenceId, replyTo, sendWithoutNotification, threadTitle, @@ -1144,16 +1140,12 @@ class OfflineFirstChatRepository @Inject constructor( emit(Result.failure(e)) } - @Suppress("LongParameterList") override suspend fun updateScheduledChatMessage( credentials: String, url: String, message: String, sendAt: Int?, - replyTo: Int?, - sendWithoutNotification: Boolean, - threadTitle: String?, - threadId: Long? + sendWithoutNotification: Boolean ): Flow> = flow { val response = network.updateScheduledMessage( @@ -1161,10 +1153,7 @@ class OfflineFirstChatRepository @Inject constructor( url, message, sendAt, - replyTo, - sendWithoutNotification, - threadTitle, - threadId + sendWithoutNotification ) val messageJson = response.ocs?.data diff --git a/app/src/main/java/com/nextcloud/talk/chat/data/network/RetrofitChatNetwork.kt b/app/src/main/java/com/nextcloud/talk/chat/data/network/RetrofitChatNetwork.kt index 523a3c8c010..ef42ec91e47 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/data/network/RetrofitChatNetwork.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/data/network/RetrofitChatNetwork.kt @@ -228,8 +228,6 @@ class RetrofitChatNetwork(private val ncApi: NcApi, private val ncApiCoroutines: credentials: String, url: String, message: String, - displayName: String, - referenceId: String, replyTo: Int?, sendWithoutNotification: Boolean, threadTitle: String?, @@ -240,8 +238,6 @@ class RetrofitChatNetwork(private val ncApi: NcApi, private val ncApiCoroutines: credentials, url, message, - displayName, - referenceId, replyTo, sendWithoutNotification, threadTitle, @@ -254,20 +250,14 @@ class RetrofitChatNetwork(private val ncApi: NcApi, private val ncApiCoroutines: url: String, message: String, sendAt: Int?, - replyTo: Int?, - sendWithoutNotification: Boolean, - threadTitle: String?, - threadId: Long? + sendWithoutNotification: Boolean ): ChatOverallSingleMessage = ncApiCoroutines.updateScheduledMessage( credentials, url, message, sendAt, - replyTo, - sendWithoutNotification, - threadTitle, - threadId + sendWithoutNotification ) override suspend fun deleteScheduledMessage(credentials: String, url: String): GenericOverall = diff --git a/app/src/main/java/com/nextcloud/talk/chat/viewmodels/MessageInputViewModel.kt b/app/src/main/java/com/nextcloud/talk/chat/viewmodels/MessageInputViewModel.kt index 8e0efd1b740..4187ae46a5f 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/viewmodels/MessageInputViewModel.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/viewmodels/MessageInputViewModel.kt @@ -305,7 +305,6 @@ class MessageInputViewModel : credentials: String, url: String, message: String, - displayName: String, replyTo: Int?, sendWithoutNotification: Boolean, threadTitle: String?, @@ -320,8 +319,6 @@ class MessageInputViewModel : credentials, url, message, - displayName, - referenceId, replyTo, sendWithoutNotification, threadTitle, diff --git a/app/src/main/java/com/nextcloud/talk/chat/viewmodels/ScheduledMessagesViewModel.kt b/app/src/main/java/com/nextcloud/talk/chat/viewmodels/ScheduledMessagesViewModel.kt index 8b6a5cd7a4c..292391a48d9 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/viewmodels/ScheduledMessagesViewModel.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/viewmodels/ScheduledMessagesViewModel.kt @@ -139,17 +139,7 @@ class ScheduledMessagesViewModel @Inject constructor( } } - @Suppress("LongParameterList") - fun reschedule( - credentials: String, - url: String, - message: String, - sendAt: Int?, - replyTo: Int?, - sendWithoutNotification: Boolean, - threadTitle: String?, - threadId: Long? - ) { + fun reschedule(credentials: String, url: String, message: String, sendAt: Int?, sendWithoutNotification: Boolean) { _rescheduleState.value = ScheduledMessageActionLoadingState viewModelScope.launch { chatRepository.updateScheduledChatMessage( @@ -157,10 +147,7 @@ class ScheduledMessagesViewModel @Inject constructor( url, message, sendAt, - replyTo, - sendWithoutNotification, - threadTitle, - threadId + sendWithoutNotification ).collect { result -> if (result.isSuccess) { _rescheduleState.value = @@ -210,17 +197,7 @@ class ScheduledMessagesViewModel @Inject constructor( chatRepository.getParentMessageById(parentMessageId).firstOrNull() } - @Suppress("LongParameterList") - fun edit( - credentials: String, - url: String, - message: String, - sendAt: Int?, - replyTo: Int?, - sendWithoutNotification: Boolean, - threadTitle: String?, - threadId: Long? - ) { + fun edit(credentials: String, url: String, message: String, sendAt: Int?, sendWithoutNotification: Boolean) { _editState.value = ScheduledMessageActionLoadingState viewModelScope.launch { chatRepository.updateScheduledChatMessage( @@ -228,10 +205,7 @@ class ScheduledMessagesViewModel @Inject constructor( url, message, sendAt, - replyTo, - sendWithoutNotification, - threadTitle, - threadId + sendWithoutNotification ).collect { result -> if (result.isSuccess) { _editState.value =