feat(webservices): add GitHub firmware update checking - #189
Draft
byamo wants to merge 9 commits into
Draft
Conversation
Add data classes for GitHub API integration: - GithubRelease: represents a GitHub release with assets - GithubSource: represents a GitHub repository source - GithubToken: represents GitHub authentication token These types enable fetching firmware releases from GitHub
Add suspend functions for fetching GitHub releases and downloading assets: - fetchGithubReleases(source: GithubSource, token: String?): Outcome<List<GithubRelease>> - downloadGithubAsset(asset: GithubAsset, token: String?): Outcome<File>
Implement GithubClientImpl for fetching releases from GitHub API: - Fetch and parse releases from GitHub repositories - Map GitHub assets to domain model (GithubAsset) - Handle browser_download_url mapping to download_url - Filter out assets without download URLs - Add proper error handling and logging
- Add fetchGithubReleases implementation calling GithubClient - Add downloadGithubAsset implementation with context-aware cache directory - Use Dispatchers.IO for background operations
- Add GithubPreferencesRepository for managing GitHub preferences - Add GithubProviders for dependency injection setup - Enable configuration of GitHub API settings
- Add checkGithubUpdates() function to fetch and filter releases - Add downloadFromGithub() function to download firmware assets - Filter releases by watch hardware platform revision (e.g., obelix_pvt) - Filter releases by firmware version (show only newer versions) - Add githubReleases and downloadProgress state flows - Handle empty results (watch is up to date)
- Add Check GitHub for updates button - Display GitHub releases with PBZ assets in cards - Show release tag, name, and published date - Add loading state with CircularProgressIndicator - Add error handling for GitHub API failures - Restrict GitHub auto-download to core devices (asterix, obelix, getafix) - Fix locale observation in Composable functions - Add string resources for GitHub-related messages
matejdro
reviewed
Jul 29, 2026
matejdro
reviewed
Jul 29, 2026
matejdro
reviewed
Jul 29, 2026
| } | ||
| } | ||
|
|
||
| private var client: HttpClient? = null |
Owner
There was a problem hiding this comment.
We should share HttpClient with all other app parts (such as appstore). Http client is a pretty heavy thing and should only be created once and reused.
matejdro
reviewed
Jul 29, 2026
matejdro
reviewed
Jul 29, 2026
| } | ||
|
|
||
| @ContributesTo(AppScope::class) | ||
| interface GithubPreferencesProviders { |
Owner
There was a problem hiding this comment.
DI should be in a separate file than the repository.
matejdro
reviewed
Jul 29, 2026
| } | ||
|
|
||
| object GithubPreferencesSerializer : androidx.datastore.core.Serializer<GithubPreferences> { | ||
| private val json = Json { |
Owner
There was a problem hiding this comment.
Json is created multiple times throughout the app. This is a bit wasteful. Can we create it once via DI and then inject it everywhere?
matejdro
reviewed
Jul 29, 2026
| } | ||
| } | ||
|
|
||
| object GithubPreferencesSerializer : androidx.datastore.core.Serializer<GithubPreferences> { |
Owner
There was a problem hiding this comment.
Please do not use objects, use DI + Singleton instead.
matejdro
reviewed
Jul 29, 2026
matejdro
reviewed
Jul 29, 2026
…ializer - Use @ContributesBinding for GithubClientImpl instead of @ContributesTo providers - Add GithubClient interface in API module for better DI practices - Update WebservicesClientImpl to inject GithubClient interface instead of concrete class - Remove GithubProviders interface (boilerplate) - Replace @contextual with static InstantComponentSerializer for published_at field
- Move companion object to end of file
- Replace withContext(Dispatchers.IO) with withIO {}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the ability to check for and download firmware updates directly from GitHub repositories (coredevices/PebbleOS).
Features:
Technical Details:
GithubRelease,GithubSource,GithubToken.GithubClientImplwith proper Kotlin Serialization mapping.Partially addresses #34