Skip to content

Drop maximum_name_length; remove How-To-Use from Settings#35

Merged
dadachi merged 1 commit intosubstrate-v2from
substrate-v2--drop-maximum-name-length
Apr 27, 2026
Merged

Drop maximum_name_length; remove How-To-Use from Settings#35
dadachi merged 1 commit intosubstrate-v2from
substrate-v2--drop-maximum-name-length

Conversation

@dadachi
Copy link
Copy Markdown
Contributor

@dadachi dadachi commented Apr 27, 2026

Mirrors NativeAppTemplate-Android PR #47. Two unrelated substrate-v2 cleanups bundled here.

1. Drop maximum_name_length from permissions; move to NatConstants

Android port of NativeAppTemplate-iOS#59. The server no longer sends maximum_name_length in /shopkeeper/permissions; the client already tolerated its absence via a default. Promote the value to a constant and drop the dead plumbing.

Stop reading maximum_name_length from /shopkeeper/permissions

  • Meta: drop the @SerialName("maximum_name_length") field.
  • Permissions: drop getMaximumNameLength() helper.
  • UserData: drop maximumNameLength field.
  • user_preferences.proto: reserved 23 (was maximum_name_length) so the wire number isn't reused.
  • NatPreferencesDataSource: drop the read in the userData mapping, the write in setPermissions, and the getMaximumNameLength() flow.
  • LoginRepository (interface + impl + DemoLoginRepository + TestLoginRepository): drop getMaximumNameLength().

Move maximumNameLength to NatConstants

  • NatConstants: add MAXIMUM_ITEM_TAG_NAME_LENGTH = 100.
  • ItemTagCreateViewModel + ItemTagEditViewModel:
    • UiState.maximumNameLength default now reads the constant.
    • Drop the loginRepository constructor param — it was only used for getMaximumNameLength().
    • ItemTagCreateViewModel.reload() simplifies to a state reset.
    • ItemTagEditViewModel.fetchData() drops the combine() pairing the item-tag flow with the maximum-name-length flow.
  • Tests rewritten to drop the now-removed loginRepository wiring and the dead .copy(maximumNameLength = 100) calls; new maximumNameLength_matchesConstant tests assert against the NatConstants value (100).

Backend dependency

Server may stop emitting maximum_name_length in /shopkeeper/permissions meta (the client no longer reads it).

2. Remove "How To Use" entry from Settings

The Settings screen carried a "How To Use" list item linking to myturntag.com/how — a queue-product help page that no longer matches the substrate-v2 generic CRUD app surface. Drop just the SettingsView list item.

The string resource (R.string.how_to_use), the NatConstants.HOW_TO_USE_URL constant, and the OnboardingView call site are left in place because they are still wired and may be repurposed.

Test plan

  • ./gradlew test → BUILD SUCCESSFUL
  • ./gradlew assembleDebug → BUILD SUCCESSFUL
  • ./gradlew spotlessCheck → BUILD SUCCESSFUL
  • ./gradlew lint → BUILD SUCCESSFUL
  • Manual emulator smoke test:
    • Create / edit an ItemTag — name field still caps at 100 characters; help text still displays "max 100".
    • Open Settings — the "How To Use" row no longer appears; the rows above and below it still render with correct dividers.

🤖 Generated with Claude Code

Two unrelated substrate-v2 cleanups bundled here.

## 1. Drop maximum_name_length from permissions; move to NatConstants

The server no longer sends maximum_name_length in /shopkeeper/permissions;
the client already tolerated its absence via a default. Promote the value
to a constant and drop the dead plumbing.

### Stop reading maximum_name_length from /shopkeeper/permissions
- Meta: drop the @SerialName("maximum_name_length") field.
- Permissions: drop getMaximumNameLength() helper.
- UserData: drop maximumNameLength field.
- user_preferences.proto: reserved 23 (was maximum_name_length) so the
  wire number isn't reused.
- NatPreferencesDataSource: drop the read in the userData mapping, the
  write in setPermissions, and the getMaximumNameLength() flow.
- LoginRepository (interface + impl + DemoLoginRepository +
  TestLoginRepository): drop getMaximumNameLength().

### Move maximumNameLength to NatConstants
- NatConstants: add MAXIMUM_ITEM_TAG_NAME_LENGTH = 100.
- ItemTagCreateViewModel + ItemTagEditViewModel:
  - UiState.maximumNameLength default now reads the constant.
  - Drop the loginRepository constructor param — it was only used for
    getMaximumNameLength().
  - ItemTagCreateViewModel.reload() simplifies to a state reset.
  - ItemTagEditViewModel.fetchData() drops the combine() pairing the
    item-tag flow with the maximum-name-length flow.
- Tests rewritten to drop the now-removed loginRepository wiring and
  the dead .copy(maximumNameLength = 100) calls; new
  maximumNameLength_matchesConstant tests assert against the
  NatConstants value (100).

## 2. Remove "How To Use" entry from Settings

Drop the SettingsView list item linking to myturntag.com/how — a
queue-product help page that no longer matches the substrate-v2
generic CRUD app surface.

The string resource (R.string.how_to_use), the
NatConstants.HOW_TO_USE_URL constant, and the OnboardingView call site
are left in place because they are still wired and may be repurposed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dadachi dadachi merged commit 337e164 into substrate-v2 Apr 27, 2026
1 check passed
@dadachi dadachi deleted the substrate-v2--drop-maximum-name-length branch April 27, 2026 09:20
dadachi added a commit that referenced this pull request Apr 27, 2026
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>
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