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

fix: sciencelab instance mgmt #2627

Merged
merged 1 commit into from
Feb 10, 2025
Merged

fix: sciencelab instance mgmt #2627

merged 1 commit into from
Feb 10, 2025

Conversation

adityastic
Copy link
Collaborator

@adityastic adityastic commented Feb 10, 2025

No description provided.

Copy link

sourcery-ai bot commented Feb 10, 2025

Reviewer's Guide by Sourcery

This pull request refactors the iOS communication logic by introducing a new CommunicationHandler interface and corresponding platform-specific implementations, updates dependency injection via getIt, and makes minor UI and plugin registration adjustments. The changes modify how ScienceLabCommon is created and used, moving away from a singleton factory pattern toward explicit instantiation with dependency injection and separating out iOS and Android communication handlers.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Refactored the communication handling infrastructure.
  • Replaced the old CommunicationHandler with a new interface defined in a dedicated base file.
  • Introduced platform-specific handlers: AndroidUSBCommunicationHandler and IosNoOpCommunicationHandler.
  • Updated ScienceLabCommon to use an explicit constructor taking a CommunicationHandler, and added helper functions such as initialize, setConnected, isConnected, and isDeviceFound.
  • Updated dependent files to import the new CommunicationHandler base and handler implementations.
lib/others/science_lab_common.dart
lib/communication/handler/base.dart
lib/communication/handler/android_comms_handler.dart
lib/communication/handler/ios_comms_handler.dart
lib/communication/packet_handler.dart
lib/communication/science_lab.dart
Switched to dependency injection using getIt.
  • Modified the locator to register lazy singletons for CommunicationHandler, ScienceLabCommon, and ScienceLab based on the platform.
  • Updated BoardStateProvider to retrieve ScienceLabCommon via getIt and removed direct instantiation of CommunicationHandler.
  • Updated OscilloscopeStateProvider to obtain ScienceLab from the locator instead of using static access.
lib/providers/board_state_provider.dart
lib/providers/oscilloscope_state_provider.dart
lib/providers/locator.dart
Adjusted UI layouts and plugin registrations.
  • Moved the SafeArea widget to wrap the inner container within the CommonScaffold in OscilloscopeScreen.
  • Added new plugin registrations for flutter_audio_capture on Linux and permission_handler_windows on Windows.
  • Updated related cmake and generated plugin registrant files.
lib/view/oscilloscope_screen.dart
linux/flutter/generated_plugin_registrant.cc
linux/flutter/generated_plugins.cmake
windows/flutter/generated_plugin_registrant.cc
windows/flutter/generated_plugins.cmake

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!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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

@adityastic adityastic changed the title Ios comms fix fix: sciencelab instance mgmt Feb 10, 2025
@adityastic adityastic merged commit fc94232 into flutter Feb 10, 2025
2 of 4 checks passed
@adityastic adityastic deleted the ios_comms_fix branch February 10, 2025 15:05
Copy link

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.

2 participants