Add client-side length caps + truncation for Shop name/description#36
Merged
dadachi merged 1 commit intosubstrate-v2from Apr 27, 2026
Merged
Conversation
Mirror the ItemTag pattern (PR #35) for Shop. Server has no caps on Shop name/description; this is a client-only UX guard. ### Changes - NatConstants: MAXIMUM_SHOP_NAME_LENGTH = 100, MAXIMUM_SHOP_DESCRIPTION_LENGTH = 1_000. - strings.xml: new shop_name_is_invalid, shop_description_is_invalid, shop_name_help, shop_description_help (parametric). - ShopCreateViewModel + ShopBasicSettingsViewModel: - UiState gains maximumNameLength / maximumDescriptionLength (defaulted to the constants). - hasInvalidData() splits into hasInvalidDataName() + hasInvalidDataDescription(); the parent now ORs both. - updateName() / updateDescription() reject input over the cap (mirrors the existing ItemTagCreateViewModel / ItemTagEditViewModel Android pattern). - ShopCreateView + ShopBasicSettingsView: switch supportingText to the two-line layout (always-visible help + conditional red "is invalid" line), matching ItemTagCreateView / ItemTagEditView. Description switches to heightIn(min=120) + minLines=4. - Tests: maximumNameLength_matchesConstant / maximumDescriptionLength_matchesConstant, boundary tests at 100 / 101 / 1000 / 1001 chars on both ShopCreateViewModelTest and ShopBasicSettingsViewModelTest. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Mirrors NativeAppTemplate-Android PR #49 (Android port of NativeAppTemplate-iOS#60). Mirror the ItemTag pattern (PR #35) for Shop. Server has no caps on Shop name/description; this is a client-only UX guard.
Changes
NatConstants:MAXIMUM_SHOP_NAME_LENGTH = 100,MAXIMUM_SHOP_DESCRIPTION_LENGTH = 1_000.strings.xml: newshop_name_is_invalid,shop_description_is_invalid,shop_name_help,shop_description_help(parametric).ShopCreateViewModel+ShopBasicSettingsViewModel:UiStategainsmaximumNameLength/maximumDescriptionLength(defaulted to the constants).hasInvalidData()splits intohasInvalidDataName()+hasInvalidDataDescription(); the parent now ORs both.updateName()/updateDescription()reject input over the cap (mirrors the existingItemTagCreateViewModel/ItemTagEditViewModelAndroid pattern).ShopCreateView+ShopBasicSettingsView: switchsupportingTextto the two-line layout (always-visible help + conditional red "is invalid" line), matchingItemTagCreateView/ItemTagEditView. Description switches toheightIn(min = 120.dp)+minLines = 4.maximumNameLength_matchesConstant/maximumDescriptionLength_matchesConstant, boundary tests at 100 / 101 / 1000 / 1001 chars on bothShopCreateViewModelTestandShopBasicSettingsViewModelTest.Test plan
./gradlew test→ BUILD SUCCESSFUL./gradlew assembleDebug→ BUILD SUCCESSFUL./gradlew spotlessCheck→ BUILD SUCCESSFUL./gradlew lint→ BUILD SUCCESSFUL🤖 Generated with Claude Code