Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A probable fix to the snackbar issue #86

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

himeshps
Copy link

@himeshps himeshps commented Oct 10, 2024

Description

It turns out that the issue was due to the time sensitivity of Get.isSnackBarOpen , which made it ocassionally miss the rapid toggling of the network connection and hence, persisting with the wrong pop-up even when connected to a network. I've tried fixing the issue by storing the state of the Snack Bar and a conditional check before sending the next command to close or open the pop-up again which avoids any such bug.

Related Issue

I believe it is a very specific issue and there are not any related issues as such.
(#69)

Motivation and Context

I have explained this above briefly. It solves the problem arising due to the time sensitivity of the previous function used.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Summary by Sourcery

Fix the snackbar issue by implementing a state management solution to handle rapid network connection toggling, ensuring the correct snackbar state is displayed.

Bug Fixes:

  • Fix the issue with the snackbar not updating correctly due to time sensitivity by storing its state and adding a conditional check before toggling.

Copy link

sourcery-ai bot commented Oct 10, 2024

Reviewer's Guide by Sourcery

This pull request addresses a bug in the snackbar functionality related to network connection status. The fix involves modifying the NetworkController class to store the state of the Snackbar and implement a conditional check before toggling its visibility.

Updated class diagram for NetworkController

classDiagram
    class NetworkController {
        +bool isSnackBarOpen
        +void checkNetworkStatus()
        +void toggleSnackBar()
    }

    NetworkController : +bool isSnackBarOpen
    NetworkController : +void checkNetworkStatus()
    NetworkController : +void toggleSnackBar()
Loading

File-Level Changes

Change Details Files
Modified NetworkController class to fix snackbar issue
  • Added state tracking for Snackbar visibility
  • Implemented conditional check before opening or closing Snackbar
  • Addressed time sensitivity issue in Get.isSnackBarOpen
lib/network/network_controller.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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @himeshps - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Closing curly brace for the NetworkController class has been removed (link)

Overall Comments:

  • The description mentions changes that are not reflected in the diff. Please ensure all intended changes are committed and included in the pull request.
  • For a timing-related bug fix, it's crucial to include tests that verify the solution. Please add appropriate tests to cover your changes.
  • Could you provide more details on how you've tested this fix, given the time-sensitive nature of the issue?
Here's what I looked at during the review
  • 🔴 General issues: 1 blocking issue
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

lib/network/network_controller.dart Show resolved Hide resolved
@hardik1408
Copy link
Member

@bmerchant22 @yashlm can you please review this and merge?

@bmerchant22
Copy link
Contributor

I think we need to change the way we check connectivity, you can have a look on this question

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.

3 participants