fix: update swipe direction for reply functionality in MessageBubble

This commit is contained in:
2026-02-03 22:56:33 +05:00
parent a7268bb986
commit 44a816dedb
3 changed files with 114 additions and 15 deletions

View File

@@ -321,8 +321,8 @@ fun MessageBubble(
detectHorizontalDragGestures(
onDragStart = { },
onDragEnd = {
// Если свайпнули достаточно вправо - reply
if (swipeOffset >= swipeThreshold) {
// Если свайпнули достаточно влево - reply
if (swipeOffset <= -swipeThreshold) {
onSwipeToReply()
}
swipeOffset = 0f
@@ -331,20 +331,20 @@ fun MessageBubble(
swipeOffset = 0f
},
onHorizontalDrag = { change, dragAmount ->
// Только свайп вправо (положительное значение)
if (dragAmount > 0 || swipeOffset > 0) {
// Только свайп влево (отрицательное значение)
if (dragAmount < 0 || swipeOffset < 0) {
change.consume()
val newOffset = swipeOffset + dragAmount
swipeOffset = newOffset.coerceIn(0f, maxSwipe)
swipeOffset = newOffset.coerceIn(-maxSwipe, 0f)
}
}
)
}
) {
// 🔥 Reply icon - слева, появляется при свайпе вправо
// 🔥 Reply icon - справа, появляется при свайпе влево
Box(
modifier =
Modifier.align(Alignment.CenterStart).padding(start = 16.dp).graphicsLayer {
Modifier.align(Alignment.CenterEnd).padding(end = 16.dp).graphicsLayer {
alpha = swipeProgress
scaleX = swipeProgress
scaleY = swipeProgress

View File

@@ -1158,13 +1158,27 @@ private fun TelegramCaptionBar(
}
}
/** Save edited image and return the URI - returns original if no edits, otherwise crops black bars */
/** Save edited image and return the URI - returns ORIGINAL without processing */
private suspend fun saveEditedImage(
context: Context,
photoEditor: PhotoEditor?,
photoEditorView: PhotoEditorView?,
imageUri: Uri,
onResult: (Uri?) -> Unit
) {
// Просто возвращаем оригинальный URI без обработки через PhotoEditor
// Это устраняет проблему с обрезкой изображений
onResult(imageUri)
}
/** OLD VERSION - Save edited image with crop logic (disabled due to cropping issues) */
@Suppress("unused")
private suspend fun saveEditedImageOld(
context: Context,
photoEditor: PhotoEditor?,
photoEditorView: PhotoEditorView?,
imageUri: Uri,
onResult: (Uri?) -> Unit
) {
if (photoEditor == null || photoEditorView == null) {
// Нет редактора - возвращаем оригинал
@@ -1282,12 +1296,25 @@ private suspend fun saveEditedImage(
}
}
/** Save edited image synchronously - returns original if no edits, otherwise crops black bars */
/** Save edited image synchronously - returns ORIGINAL URI without any processing */
private suspend fun saveEditedImageSync(
context: Context,
photoEditor: PhotoEditor?,
photoEditorView: PhotoEditorView?,
imageUri: Uri
): Uri? {
// Просто возвращаем оригинальный URI без обработки
// PhotoEditor вызывает проблемы с обрезкой - пользователь получает оригинал
return imageUri
}
/** Save edited image synchronously - OLD VERSION with crop logic (disabled) */
@Suppress("unused")
private suspend fun saveEditedImageSyncOld(
context: Context,
photoEditor: PhotoEditor?,
photoEditorView: PhotoEditorView?,
imageUri: Uri
): Uri? {
if (photoEditor == null || photoEditorView == null) {
// Нет редактора - возвращаем оригинал