Skip to content

feat: Add BottomSheet for screencapture on QR code success screen#624

Open
aymericmariaux wants to merge 11 commits intomainfrom
screenshot-bottomsheet
Open

feat: Add BottomSheet for screencapture on QR code success screen#624
aymericmariaux wants to merge 11 commits intomainfrom
screenshot-bottomsheet

Conversation

@aymericmariaux
Copy link
Copy Markdown

Added a bottom sheet when capturing the QR code after a successful link transfer

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

PR Reviewer Guide 🔍

(Review updated until commit 19f7765)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing Bottom Button

The component retrieves buttonCopyLinkLabel and passes both button labels to assembleWithBoldArgument, implying two buttons should be displayed. However, only topButton is implemented (Share), while bottomButton (Copy Link) is missing despite being referenced in the description text.

val descriptionTemplate = stringResource(R.string.quickSharingDescription)
val buttonShareLabel = stringResource(R.string.buttonShare)
val buttonCopyLinkLabel = stringResource(R.string.buttonCopyLink)

SwissTransferBottomSheet(
    onDismissRequest = onDismissRequest,
    sheetState = sheetState,
    topButton = {
        LargeButton(
            modifier = it,
            title = stringResource(R.string.buttonShare),
            onClick = {
                MatomoSwissTransfer.trackNewTransferEvent(MatomoName.Share)
                context.shareText(transferLink)
                sheetState.dismissGracefully(scope, { onDismissRequest() })
            },
        )
    },
    imageVector = AppImages.AppIllus.Lightbulb.image(),
    title = stringResource(R.string.oneClickSharing),
    annotatedDescription = TextUtils.assembleWithBoldArgument(descriptionTemplate, buttonShareLabel, buttonCopyLinkLabel),
)
Incomplete Text Styling

The function uses indexOf to locate arguments for styling, which only finds the first occurrence. If an argument text appears multiple times in the template, subsequent occurrences won't be bolded. Additionally, if arguments are substrings of each other (e.g., "Share" and "Share Link"), styling may apply to incorrect segments.

fun assembleWithBoldArgument(template: String, argument1: String, argument2: String? = null): AnnotatedString {
    val description = try {
        if (argument2 != null) {
            String.format(template, argument1, argument2)
        } else {
            String.format(template, argument1)
        }
    } catch (e: java.util.IllegalFormatException) {
        template
    }

    return buildAnnotatedString {
        append(description)

        val startIndex1 = description.indexOf(argument1)
        if (startIndex1 != -1) {
            addStyle(
                style = SpanStyle(fontWeight = FontWeight.Bold, color = SwissTransferTheme.colors.primaryTextColor),
                start = startIndex1,
                end = startIndex1 + argument1.length
            )
        }

        if (argument2 != null) {
            val startIndex2 = description.indexOf(argument2)
            if (startIndex2 != -1) {
                addStyle(
                    style = SpanStyle(fontWeight = FontWeight.Bold, color = SwissTransferTheme.colors.primaryTextColor),
                    start = startIndex2,
                    end = startIndex2 + argument2.length
                )
            }
        }
    }

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a “quick sharing” bottom sheet that appears when a user captures the screen on the upload success QR screen, nudging them toward Share/Copy actions instead of screenshots.

Changes:

  • Detect screen capture on the QR success screen and display a new ScreenshotBottomSheet.
  • Extend SwissTransferBottomSheet/TextUtils to support an annotated (bolded) description with up to two highlighted arguments.
  • Add new localized strings and a new light/dark illustration for the bottom sheet.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
app/src/main/res/values/strings.xml Adds new bottom-sheet title/description/button strings (EN).
app/src/main/res/values-sv/strings.xml Adds Swedish translations for the new bottom-sheet strings.
app/src/main/res/values-pt/strings.xml Adds Portuguese translations for the new bottom-sheet strings.
app/src/main/res/values-pl/strings.xml Adds Polish translations for the new bottom-sheet strings.
app/src/main/res/values-nl/strings.xml Adds Dutch translations for the new bottom-sheet strings.
app/src/main/res/values-nb/strings.xml Adds Norwegian Bokmål translations for the new bottom-sheet strings.
app/src/main/res/values-it/strings.xml Adds Italian translations for the new bottom-sheet strings.
app/src/main/res/values-fr/strings.xml Adds French translations for the new bottom-sheet strings.
app/src/main/res/values-fi/strings.xml Adds Finnish translations for the new bottom-sheet strings.
app/src/main/res/values-es/strings.xml Adds Spanish translations for the new bottom-sheet strings.
app/src/main/res/values-el/strings.xml Adds Greek translations for the new bottom-sheet strings.
app/src/main/res/values-de/strings.xml Adds German translations for the new bottom-sheet strings.
app/src/main/res/values-da/strings.xml Adds Danish translations for the new bottom-sheet strings.
app/src/main/java/com/infomaniak/swisstransfer/ui/utils/TextUtils.kt Updates bold-assembly helper to support two arguments (annotated text).
app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/ScreenshotBottomSheet.kt Introduces the new bottom sheet UI and share action.
app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessQrScreen.kt Registers screen-capture callback and triggers the bottom sheet.
app/src/main/java/com/infomaniak/swisstransfer/ui/images/illus/screenshotBottomSheet/LightbulbLight.kt Adds light-mode vector for the bottom sheet illustration.
app/src/main/java/com/infomaniak/swisstransfer/ui/images/illus/screenshotBottomSheet/LightbulbDark.kt Adds dark-mode vector for the bottom sheet illustration.
app/src/main/java/com/infomaniak/swisstransfer/ui/images/illus/screenshotBottomSheet/Lightbulb.kt Adds themed wrapper selecting light/dark vectors.
app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferBottomSheet.kt Adds annotatedDescription rendering to the shared bottom sheet component.
app/src/main/AndroidManifest.xml Declares the screen-capture detection permission.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aymericmariaux aymericmariaux force-pushed the screenshot-bottomsheet branch from a9863fd to a3a5dff Compare April 21, 2026 08:31
@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit a3a5dff

Comment thread app/src/main/java/com/infomaniak/swisstransfer/ui/utils/TextUtils.kt Outdated
@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 19f41f4

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/main/java/com/infomaniak/swisstransfer/ui/utils/TextUtils.kt Outdated
Comment thread app/src/main/res/values/strings.xml Outdated
@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 19f7765

@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

@aymericmariaux aymericmariaux force-pushed the screenshot-bottomsheet branch from 19f7765 to 56902c2 Compare April 22, 2026 08:03
@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants