Repository navigation
Epic 10 — Importação Foundry VTT - #68
Merged
Merged
Conversation
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.
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.
Resumo
FoundryParserextrai name/type/hp/ac de um export de ator do Foundry (D&D 5e), com tryParse+defaults e log de campos não reconhecidos.characterscomsourceSystem: dnd5eerawJson.npc_templatespúblicos comsourceSystem: dnd5e.file_pickernão compilava no Android com o toolchain do projeto (AGP 9.0.1 + Kotlin 2.3.20) — trocado porfile_selector.Closes #43, #44, #45, #42
Test plan
flutter analyzesem issuesflutter test(133/133)dart format --set-exit-if-changed .sem mudançasfile_selector