Skip to content

Commit edb1fc8

Browse files
authored
CMM-1040 Edge-to-edge cutoff in support screens (#22397)
* Fix overlapping caused by edge-to-edge support * Undo changes to AttachmentFullscreenVideoPlayer * Restored the SendButton composable
1 parent 6357232 commit edb1fc8

File tree

2 files changed

+56
-40
lines changed

2 files changed

+56
-40
lines changed

WordPress/src/main/java/org/wordpress/android/support/he/ui/HEConversationDetailScreen.kt

Lines changed: 50 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.height
1515
import androidx.compose.foundation.layout.padding
1616
import androidx.compose.foundation.layout.size
1717
import androidx.compose.foundation.layout.FlowRow
18+
import androidx.compose.foundation.layout.navigationBarsPadding
1819
import androidx.compose.foundation.lazy.LazyColumn
1920
import androidx.compose.foundation.lazy.items
2021
import androidx.compose.foundation.lazy.rememberLazyListState
@@ -124,15 +125,17 @@ fun HEConversationDetailScreen(
124125
bottomBar = {
125126
val status = ConversationStatus.fromStatus(conversation.status)
126127
val isClosed = status == ConversationStatus.CLOSED
127-
if (isClosed) {
128-
ClosedConversationBanner()
129-
} else {
130-
ReplyButton(
131-
enabled = !isLoading,
132-
onClick = {
133-
onReplyBottomSheetVisibilityChange(true)
134-
}
135-
)
128+
Box(modifier = Modifier.navigationBarsPadding()) {
129+
if (isClosed) {
130+
ClosedConversationBanner()
131+
} else {
132+
ReplyButton(
133+
enabled = !isLoading,
134+
onClick = {
135+
onReplyBottomSheetVisibilityChange(true)
136+
}
137+
)
138+
}
136139
}
137140
}
138141
) { contentPadding ->
@@ -148,35 +151,35 @@ fun HEConversationDetailScreen(
148151
state = listState,
149152
verticalArrangement = Arrangement.spacedBy(12.dp)
150153
) {
151-
item {
152-
ConversationHeader(
153-
status = conversation.status,
154-
lastUpdated = formatRelativeTime(conversation.lastMessageSentAt, resources),
155-
isLoading = isLoading
156-
)
157-
}
154+
item {
155+
ConversationHeader(
156+
status = conversation.status,
157+
lastUpdated = formatRelativeTime(conversation.lastMessageSentAt, resources),
158+
isLoading = isLoading
159+
)
160+
}
158161

159-
item {
160-
ConversationTitleCard(title = conversation.title)
161-
}
162+
item {
163+
ConversationTitleCard(title = conversation.title)
164+
}
162165

163-
items(
164-
items = conversation.messages,
165-
key = { it.id }
166-
) { message ->
167-
MessageItem(
168-
message = message,
169-
timestamp = formatRelativeTime(message.createdAt, resources),
170-
onPreviewAttachment = { attachment -> previewAttachment = attachment },
171-
onDownloadAttachment = onDownloadAttachment,
172-
onGetAuthorizationHeaderArgument = onGetAuthorizationHeaderArgument
173-
)
174-
}
166+
items(
167+
items = conversation.messages,
168+
key = { it.id }
169+
) { message ->
170+
MessageItem(
171+
message = message,
172+
timestamp = formatRelativeTime(message.createdAt, resources),
173+
onPreviewAttachment = { attachment -> previewAttachment = attachment },
174+
onDownloadAttachment = onDownloadAttachment,
175+
onGetAuthorizationHeaderArgument = onGetAuthorizationHeaderArgument
176+
)
177+
}
175178

176-
item {
177-
Spacer(modifier = Modifier.height(8.dp))
179+
item {
180+
Spacer(modifier = Modifier.height(8.dp))
181+
}
178182
}
179-
}
180183

181184
if (isLoading) {
182185
CircularProgressIndicator(
@@ -238,6 +241,7 @@ fun HEConversationDetailScreen(
238241
}
239242
)
240243
}
244+
241245
AttachmentType.Video -> {
242246
AttachmentFullscreenVideoPlayer(
243247
videoUrl = attachment.url,
@@ -252,6 +256,7 @@ fun HEConversationDetailScreen(
252256
},
253257
)
254258
}
259+
255260
else -> {
256261
// For other types (documents, etc.), do nothing
257262
// They should only be downloadable, not previewable
@@ -269,12 +274,16 @@ private fun ConversationHeader(
269274
val statusText = when (ConversationStatus.fromStatus(status)) {
270275
ConversationStatus.WAITING_FOR_SUPPORT ->
271276
stringResource(R.string.he_support_status_waiting_for_support)
277+
272278
ConversationStatus.WAITING_FOR_USER ->
273279
stringResource(R.string.he_support_status_waiting_for_user)
280+
274281
ConversationStatus.SOLVED ->
275282
stringResource(R.string.he_support_status_solved)
283+
276284
ConversationStatus.CLOSED ->
277285
stringResource(R.string.he_support_status_closed)
286+
278287
ConversationStatus.UNKNOWN ->
279288
stringResource(R.string.he_support_status_unknown)
280289
}
@@ -478,7 +487,8 @@ private fun AttachmentItem(
478487
contentAlignment = Alignment.Center
479488
) {
480489
if (attachment.type == AttachmentType.Image ||
481-
attachment.type == AttachmentType.Video) {
490+
attachment.type == AttachmentType.Video
491+
) {
482492
// Show image/video preview for image and video attachments
483493
SubcomposeAsyncImage(
484494
model = ImageRequest.Builder(LocalContext.current)
@@ -602,8 +612,11 @@ private fun HEConversationDetailScreenPreviewContent(
602612
}
603613

604614
private object ConversationDetailPreviewAttachmentActionsListener : AttachmentActionsListener {
605-
override fun onAddImageClick() { /* Preview stub */ }
606-
override fun onRemoveImage(uri: Uri) { /* Preview stub */ }
615+
override fun onAddImageClick() { /* Preview stub */
616+
}
617+
618+
override fun onRemoveImage(uri: Uri) { /* Preview stub */
619+
}
607620
}
608621

609622
@Preview(showBackground = true, name = "HE Conversation Detail")

WordPress/src/main/java/org/wordpress/android/support/he/ui/HENewTicketScreen.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.fillMaxSize
1111
import androidx.compose.foundation.layout.fillMaxWidth
1212
import androidx.compose.foundation.layout.height
1313
import androidx.compose.foundation.layout.imePadding
14+
import androidx.compose.foundation.layout.navigationBarsPadding
1415
import androidx.compose.foundation.layout.padding
1516
import androidx.compose.foundation.layout.size
1617
import androidx.compose.foundation.rememberScrollState
@@ -147,7 +148,8 @@ private fun HENewTicketScreenContent(
147148
selectedCategory?.let { category ->
148149
onSubmit(category, subject, messageText, siteAddress, includeAppLogs)
149150
}
150-
}
151+
},
152+
modifier = Modifier.navigationBarsPadding()
151153
)
152154
}
153155
) { contentPadding ->
@@ -283,10 +285,11 @@ private fun SectionHeader(
283285
private fun SendButton(
284286
enabled: Boolean,
285287
isLoading: Boolean,
286-
onClick: () -> Unit
288+
onClick: () -> Unit,
289+
modifier: Modifier = Modifier
287290
) {
288291
Surface(
289-
modifier = Modifier.fillMaxWidth(),
292+
modifier = modifier.fillMaxWidth(),
290293
color = MaterialTheme.colorScheme.surface,
291294
shadowElevation = 8.dp
292295
) {

0 commit comments

Comments
 (0)