Skip to content

App Android Widget#1198

Draft
apedley wants to merge 3 commits intoCodeWithCJ:mainfrom
apedley:app-android-widget
Draft

App Android Widget#1198
apedley wants to merge 3 commits intoCodeWithCJ:mainfrom
apedley:app-android-widget

Conversation

@apedley
Copy link
Copy Markdown
Contributor

@apedley apedley commented Apr 24, 2026

Tip

Help us review and merge your PR faster!
Please ensure you have completed the Checklist below.
For Frontend changes, please run pnpm run validate to check for any errors.
PRs that include tests and clear screenshots are highly preferred!
Note: AI-generated descriptions must be manually edited for conciseness. Do not paste raw AI summaries.

Description

This PR adds an android widget for calorie tracking. I am not ashamed to say this was a struggle so Android gets one widget for now. At least now I can say I know a little Kotlin.

Androids widget system is a lot less flexible than iOS and I couldn't make the calorie ring function well on all the launchers so the widget is a bit simplified.

Linked Issue: #

How to Test

  1. Run app
  2. Add widget to home screen launcher

PR Type

  • Issue (bug fix)
  • New Feature
  • Refactor
  • Documentation

Checklist

All PRs:

  • [MANDATORY - ALL] Integrity & License: I certify this is my own work, free of malicious code, and I agree to the License terms.

New features only:

  • [MANDATORY for new feature] Alignment: I have raised a GitHub issue and it was reviewed/approved by maintainers or it was approved on Discord.

Frontend changes (SparkyFitnessFrontend/ or src/):

  • [MANDATORY for Frontend changes] Quality: I have run pnpm run validate and it passes.
  • [MANDATORY for Frontend changes] Translations: I have only updated the English (en) translation file.

Backend changes (SparkyFitnessServer/):

  • [MANDATORY for Backend changes] Code Quality: I have run typecheck, lint, and tests. New files use TypeScript, new endpoints have Zod schemas, and new endpoints include tests.
  • [MANDATORY for Backend changes] Database Security: I have updated rls_policies.sql for any new user-specific tables.

UI changes (components, screens, pages):

  • [MANDATORY for UI changes] Screenshots: I have attached Before/After screenshots below.

Screenshots

image

Notes for Reviewers

Optional — use this for anything that doesn't fit above: known tradeoffs, areas you'd like specific feedback on, qustions you have or context that helps reviewers.

Copy link
Copy Markdown
Contributor

@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 Android widget support using Jetpack Glance. It includes new Expo config plugins to configure the Android build environment (Compose support, dependencies) and register the calorie widget. The useWidgetSync hook is updated to push calorie data to the Android widget via a new native bridge. Feedback suggests optimizing the synchronization logic to prevent excessive bridge calls, improving the robustness of the plugin's regex-based code injection, and dynamically handling the Kotlin version in the build configuration.

Comment thread SparkyFitnessMobile/src/hooks/useWidgetSync.ts
Comment thread SparkyFitnessMobile/plugins/withCalorieWidget.ts
Comment thread SparkyFitnessMobile/plugins/withGlanceAndroidSupport.ts Outdated
@apedley apedley marked this pull request as ready for review April 24, 2026 16:31
@apedley apedley marked this pull request as draft April 25, 2026 00:28
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