Skip to content

Epic 10 — Importação Foundry VTT - #68

Merged
egionCode merged 5 commits into
mainfrom
feature/epic-10-foundry-import
Aug 2, 2026
Merged

egionCode merged 5 commits into
mainfrom
feature/epic-10-foundry-import

Conversation

@egionCode

Copy link
Copy Markdown
Owner

Resumo

  • Story 10.1: FoundryParser extrai name/type/hp/ac de um export de ator do Foundry (D&D 5e), com tryParse+defaults e log de campos não reconhecidos.
  • Story 10.2: fluxo de importação de ficha (seletor de arquivo → preview → confirmar) em "Minhas Fichas", criando characters com sourceSystem: dnd5e e rawJson.
  • Story 10.3: mesmo fluxo reaproveitado na Biblioteca de NPCs, criando npc_templates públicos com sourceSystem: dnd5e.
  • Correção no meio do caminho: file_picker não compilava no Android com o toolchain do projeto (AGP 9.0.1 + Kotlin 2.3.20) — trocado por file_selector.

Closes #43, #44, #45, #42

Test plan

  • flutter analyze sem issues
  • flutter test (133/133)
  • dart format --set-exit-if-changed . sem mudanças
  • Smoke test manual em Web (Chrome/Brave) e Android (emulador) — build Android só passou após a troca para file_selector

FoundryParser reads name/type/hp/ac from a Foundry D&D 5e actor export,
tryParse-ing numeric fields (Foundry sometimes stores them as strings)
and defaulting missing ones instead of failing the whole import.
Unrecognized top-level fields are collected instead of dropped, so
future support can be prioritized by what's actually showing up in
real exports. Raises FoundryParseException with a user-facing message
for invalid JSON or a missing name, for the import flows (10.2/10.3)
to show directly.
FoundryImportDialog is a shared file-picker -> parse -> preview ->
confirm flow (reused by NPC import in the next commit). Wired into
"Minhas Fichas" via an app bar action; on confirm it creates a
character with sourceSystem: dnd5e and the original JSON kept in
rawJson.
Reuses FoundryImportDialog and the existing createNpcTemplate(...,
sourceSystem, isPublic) signature (Story 6.1) - no new provider method
needed. Imported NPCs land in the community library as public,
sourceSystem: dnd5e templates.
Adds an injectable pickFile hook to FoundryImportDialog so tests don't
depend on the real file_picker platform channel, plus a fix for a
button label that overflowed at the dialog's width. Covers
CharactersNotifier.createFromFoundry (sourceSystem/rawJson persisted
correctly) and the dialog's pick -> preview -> confirm -> error paths.
file_picker 11.0.3's Kotlin plugin didn't compile under this project's
toolchain (AGP 9.0.1 + Gradle 9.1.0 + Kotlin 2.3.20): the generated
plugin registrant referenced FilePickerPlugin but the class wasn't
produced, failing compileDebugJavaWithJavac on Android. file_selector
has no such issue and covers the same need (pick a .json file, read
its bytes). FoundryImportDialog's injectable pickFile hook now returns
raw bytes instead of a file_picker-specific result type.
@egionCode egionCode added the feature New feature or request label Aug 2, 2026
@egionCode
egionCode merged commit e6a676b into main Aug 2, 2026
1 check passed
@egionCode
egionCode deleted the feature/epic-10-foundry-import branch August 2, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Story 10.1 — Parser do JSON Foundry (D&D 5e)

1 participant