Skip to content

fix: limit blocks widget to 4 fields#956

Draft
jvsena42 wants to merge 1 commit into
masterfrom
fix/blocks-widget-948
Draft

fix: limit blocks widget to 4 fields#956
jvsena42 wants to merge 1 commit into
masterfrom
fix/blocks-widget-948

Conversation

@jvsena42
Copy link
Copy Markdown
Member

@jvsena42 jvsena42 commented May 20, 2026

Fixes #948

This PR:

  1. Limits the Bitcoin Blocks widget to a maximum of 4 selectable fields, in-app and on the home screen
  2. Removes the "Source" field from the Blocks widget and moves the mempool.space attribution into the widget description
  3. Refactors the Blocks rows display so every renderer and edit screen is driven by a single ordered field definition

Description

Following up on the Blocks widget edit settings, the field selection is now capped at four. An already-selected field can always be turned off, but a fifth selection is ignored once the limit is reached. The section header now reads "DATA (MAX 4)", and the existing Preview and Reset actions are unchanged.

The "Source" field has been removed everywhere — from the in-app edit/preview screens, the home-screen widget configuration, and the rendered cards — and its data is no longer fetched or stored. The mempool.space attribution now lives in the widget description text instead of a toggleable row.

The row-building logic, which was previously duplicated across the in-app wide and compact cards and the home-screen wide and compact layouts, plus repeated as hardcoded toggle rows in both edit screens, is now driven by a single ordered set of fields (Block, Time, Date, Transactions, Size, Fees). Each ViewModel exposes one toggle entry point that enforces the limit, and legacy preferences imported from the React Native app (which had no cap and more fields) are capped on migration.

This mirrors the already-merged iOS v61 implementation.

Preview

os-widget.webm
in-app-widget.webm

QA Notes

Manual Tests

  • 1. Home → add/edit widget → Bitcoin Blocks → Widget Settings: header reads "DATA (MAX 4)", lists Block/Time/Date/Transactions/Size/Fees, no Source row.
  • 2. Blocks edit (4 selected) → tap Size or Fees: stays unselected (no-op).
  • 3a. Blocks edit → unselect Transactions → tap Size: Size becomes selected.
    • 3b. tap Reset: returns to the default 4 (Block, Time, Date, Transactions).
  • 4. Blocks edit → unselect all: Preview disabled; select one field: Preview enabled.
  • 5. Blocks preview: description ends with "Powered by mempool.space.";
  • 6. Save the Blocks widget → Home: widget shows the selected rows, capped at 4.
  • 7. Home screen (OS) → add Bitcoin Blocks widget → config: same MAX 4 behavior and no Source → save: widget renders the selection.

Automated Checks

  • Unit tests added: cover the MAX-4 toggle guard and limitedToMax migration cap in app/src/test/java/to/bitkit/models/widget/BlocksWidgetFieldTest.kt.
  • Tests modified: rewrite the Block card instrumented tests for the new preferences/block signatures and drop the Source assertions in app/src/androidTest/java/to/bitkit/ui/screens/widgets/blocks/BlockCardTest.kt.
  • Local: compileDevDebugKotlin, testDevDebugUnitTest, detekt, and compileDevDebugAndroidTestKotlin all pass.
  • CI: standard compile, unit test, and detekt checks run by the PR bot.

@jvsena42 jvsena42 self-assigned this May 20, 2026
@jvsena42 jvsena42 added this to the 2.3.0 milestone May 20, 2026
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.

Block widget edit settings follow-up

1 participant