Skip to content

fix: replace filename truncation with user warning#3180

Closed
Diksha-MukherjeeAgarwal wants to merge 5 commits into
fossasia:flutterfrom
Diksha-MukherjeeAgarwal:patch-7
Closed

fix: replace filename truncation with user warning#3180
Diksha-MukherjeeAgarwal wants to merge 5 commits into
fossasia:flutterfrom
Diksha-MukherjeeAgarwal:patch-7

Conversation

@Diksha-MukherjeeAgarwal

@Diksha-MukherjeeAgarwal Diksha-MukherjeeAgarwal commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Added validation to prevent users from saving filenames longer than 200 characters and surfacing a warning via Snackbar instead of silently truncating the input.

Summary by Sourcery

Bug Fixes:

  • Prevent filenames longer than 200 characters from being saved by validating input before closing the dialog.

Added validation to prevent users from saving filenames longer than 200 characters and surfacing a warning via Snackbar instead of silently truncating the input.
@sourcery-ai

sourcery-ai Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds filename length validation when saving recordings, warning the user via a Snackbar and preventing silent truncation, while normalizing the saved filename text.

Sequence diagram for filename save validation and Snackbar warning

sequenceDiagram
  actor User
  participant SoundMeterScreenState
  participant AlertDialog
  participant ScaffoldMessenger
  participant SnackBar
  participant CsvService

  User->>SoundMeterScreenState: tapSaveRecording()
  SoundMeterScreenState->>AlertDialog: showSaveRecordingDialog(maxLength 200)
  User->>AlertDialog: enterFilename()
  User->>AlertDialog: pressSave()
  AlertDialog->>SoundMeterScreenState: onSavePressed(filenameController.text.trim())
  alt filename length > 200
    SoundMeterScreenState->>ScaffoldMessenger: showSnackBar()
    ScaffoldMessenger->>SnackBar: construct(message "File name must be less than 200 characters.")
    SnackBar-->>User: displayWarning()
    SoundMeterScreenState-->>AlertDialog: keepDialogOpen()
  else filename length <= 200
    SoundMeterScreenState->>AlertDialog: Navigator.pop(context, text)
    AlertDialog-->>SoundMeterScreenState: returnFileName(text)
    SoundMeterScreenState->>CsvService: writeMetaData(fileName)
    CsvService-->>SoundMeterScreenState: metaDataWritten()
  end
Loading

File-Level Changes

Change Details Files
Validate and normalize the filename before saving, and show a Snackbar warning if it exceeds 200 characters instead of silently truncating.
  • Set a 200-character maxLength on the filename TextField in the save recording dialog.
  • Trim the filename text before use and reuse the trimmed value for saving.
  • Add a length check in the save button handler that shows a Snackbar warning when the filename exceeds 200 characters and aborts closing the dialog in that case.
  • Pass the validated, trimmed filename back via Navigator.pop instead of the raw controller text.
lib/view/soundmeter_screen.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions

github-actions Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Build Status

Build successful. APKs to test: https://github.com/fossasia/pslab-app/actions/runs/24446765001/artifacts/6447325389.

Screenshots

Android Screenshots
iPhone Screenshots
iPad Screenshots

@Diksha-MukherjeeAgarwal

Copy link
Copy Markdown
Contributor Author

Closing this duplicate PR. All of these changes have been added to the original PR #3177 to keep the commit history and conversation in one place.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant