pclubiitk / IITK-Mail-Client

Developing a Mail Client for the IITK Campus Community that would be available across various platforms including Android, iOS, Windows, Web, Linux and Mac
MIT License
3 stars 17 forks source link

A probable fix to the snackbar issue #86

Open himeshps opened 1 month ago

himeshps commented 1 month ago

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. (https://github.com/pclubiitk/IITK-Mail-Client/issues/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

Checklist:

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:

sourcery-ai[bot] commented 1 month ago

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()

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](https://app.sourcery.ai) 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 - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
hardik1408 commented 1 month ago

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

bmerchant22 commented 1 month ago

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