Skip to content

feat(android): add JSON share intent for AI-assisted meal import - #587

Open
Marc4k wants to merge 2 commits into
simonoppowa:developfrom
Marc4k:feature/share-intent-json
Open

feat(android): add JSON share intent for AI-assisted meal import#587
Marc4k wants to merge 2 commits into
simonoppowa:developfrom
Marc4k:feature/share-intent-json

Conversation

@Marc4k

@Marc4k Marc4k commented Jul 25, 2026

Copy link
Copy Markdown

Summary

Adds Android share intent support so any app — including AI assistants
using the bundled food-tracker skill — can share meal JSON directly to
OpenNutriTracker. The skill accepts natural-language descriptions and
food photos; it generates the app's existing JSON export format and the
user taps Share → OpenNutriTracker, confirms the import dialog, and the
meals land in their diary.

iOS share intent is out of scope for this PR (no Share Extension target
exists yet). The Flutter service returns null on iOS so there is no
regression — tracked as a follow-up.

Ai Skill

food-tracker.skill.zip

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • CI / tooling
  • Localization
  • Other

Related issues

Changes

  • AndroidAndroidManifest.xml registers ACTION_SEND intent-filters
    for text/plain and application/json so the app appears in the system
    share sheet
  • AndroidMainActivity.kt captures the shared text via a
    MethodChannel and holds it until Flutter reads it (handles both cold-start
    and singleTop onNewIntent)
  • FlutterShareIntentService bridges the channel; returns null on
    iOS (no-op fallback)
  • FlutterMainScreen checks for a pending share on cold start and on
    every foreground resume via AppLifecycleListener, shows a confirmation
    dialog, and imports approved meals using the existing
    ImportMealsJsonUsecase
  • l10n — two new strings (shareJsonImportContent,
    shareJsonImportErrorLabel) added to all 9 supported locales (EN + DE, CS,
    IT, PL, SK, TR, UK, ZH)
  • fix — pre-existing curly_braces_in_flow_control_structures lint in
    meal_relevance_ranker.dart that blocked CI

Screenshots / recordings

example.mp4

Test plan

  • Described steps below were followed locally
  • Unit / widget tests added or updated (if applicable)
  • Manual check on Android
  • Manual check on iOS (if applicable) — N/A, iOS not yet supported

Steps

  1. Build and install the app (fvm flutter run --flavor develop)
  2. Use the food-tracker AI skill to generate a meal — it outputs JSON in
    ONT's export format
  3. In the AI app, tap Share → OpenNutriTracker
  4. Confirm the import dialog — meals appear in today's diary
  5. Share invalid/non-JSON text to ONT — error snackbar is shown, no crash

Checklist

  • Code follows project style (just format / 120-char line width)
  • New interactive widgets include Semantics(identifier: '...') where
    needed (share-json-import-confirm on the dialog confirm button)
  • Localization updated in ARBs and lib/generated/ when user-facing
    strings change
  • Codegen ran if DBOs/DTOs/env changed (just build) — no codegen changes
  • No secrets or .env values committed
  • PR title follows conventional commit style (e.g. feat:, fix:, chore:)

@Marc4k Marc4k changed the title Feature/share intent json feat(android): add JSON share intent for AI-assisted meal import Jul 25, 2026
@Marc4k

Marc4k commented Jul 31, 2026

Copy link
Copy Markdown
Author

@simonoppowa, any updates on this one? I use it daily and would love to switch back to the main app instead of running my fork. Happy to also implement iOS support if that's a blocker for merging.

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