Skip to content

feat: Expose granular download lifecycle events#51

Merged
syed-tp merged 5 commits intomainfrom
expose_download_events
Mar 5, 2026
Merged

feat: Expose granular download lifecycle events#51
syed-tp merged 5 commits intomainfrom
expose_download_events

Conversation

@syed-tp
Copy link
Contributor

@syed-tp syed-tp commented Mar 4, 2026

  • Implement native listeners for onDownloadStarted, onDownloadPaused, onDownloadResumed, onDownloadCompleted, onDownloadFailed, and onDownloadDeleted

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the download functionality by providing more granular control and feedback on the download lifecycle. Instead of relying solely on a general state change event, consumers can now subscribe to specific events like download start, pause, resume, completion, failure, and deletion. This allows for more precise handling of UI updates and business logic tied to various stages of a download, improving the overall user experience and developer flexibility.

Highlights

  • Granular Download Events: Introduced new native listeners for specific download lifecycle events: onDownloadStarted, onDownloadPaused, onDownloadResumed, onDownloadCompleted, onDownloadFailed, and onDownloadDeleted.
  • Cross-Platform Implementation: Implemented these new granular events across both Android (Kotlin) and iOS (Swift) native modules.
  • JavaScript/TypeScript API Exposure: Exposed the new download lifecycle events through dedicated functions in the TPStreamsDownload.tsx and index.tsx files, allowing developers to subscribe to these specific events.
  • Refactored Event Handling: Refactored existing download state change logic in both native modules to emit these new specific events, while still maintaining the general onDownloadStateChanged event for broader updates.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • android/src/main/java/com/tpstreams/TPStreamsDownloadModule.kt
    • Implemented onDownloadStarted, onDownloadResumed, onDownloadCompleted, onDownloadFailed, and onDownloadDeleted override functions.
    • Refactored the creation of download state event maps into a new private helper function createDownloadStateEventMap.
  • ios/TPStreamsDownloadModule.swift
    • Refactored onStateChange, onDelete, onStart, onComplete, onPause, onResume, and onCanceled methods to emit new granular lifecycle events.
    • Introduced notifyDownloadLifecycleEvent and emitSingleDownloadEvent helper functions for consistent event emission.
    • Updated the supportedEvents list to include all new granular download lifecycle events.
  • src/TPStreamsDownload.tsx
    • Added new exported functions: onDownloadStarted, onDownloadPaused, onDownloadResumed, onDownloadCompleted, onDownloadFailed, and onDownloadDeleted to register listeners for specific events.
  • src/index.tsx
    • Exported the newly added granular download event listener functions from TPStreamsDownload.tsx.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces granular download lifecycle events, which is a great feature. The implementation across Android, iOS, and TypeScript looks mostly good. I've left a few comments with suggestions for improvement:

  • On Android, adding try-catch blocks to the new event handlers would improve robustness and consistency.
  • On iOS, there's a platform inconsistency regarding error reporting for failed downloads that should be addressed or documented.
  • In the TypeScript code, there's an opportunity to reduce code duplication by using a factory function for the new event listeners.
    Addressing these points will help improve the code's quality and maintainability.

@syed-tp syed-tp force-pushed the expose_download_events branch 2 times, most recently from 6ed7971 to e67a560 Compare March 5, 2026 10:49
Base automatically changed from expose/start_download_api to main March 5, 2026 10:50
@syed-tp syed-tp force-pushed the expose_download_events branch from e67a560 to 1c71696 Compare March 5, 2026 10:51
@syed-tp syed-tp merged commit 7b54d68 into main Mar 5, 2026
7 checks passed
@syed-tp syed-tp deleted the expose_download_events branch March 5, 2026 11:27
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