Skip to content

feat: facts widget v61 + OS widget#926

Open
jvsena42 wants to merge 17 commits intofeat/blocks-v61from
feat/facts-v61
Open

feat: facts widget v61 + OS widget#926
jvsena42 wants to merge 17 commits intofeat/blocks-v61from
feat/facts-v61

Conversation

@jvsena42
Copy link
Copy Markdown
Member

@jvsena42 jvsena42 commented May 1, 2026

FIGMA

  1. Adds a Glance-backed Bitcoin Facts home screen widget with Wide and Compact layouts
  2. Migrates FactsCard and FactsPreviewScreen to the v61 design
  3. Removes the Facts edit screen, the showSource toggle, and the FactsPreferences plumbing (no per-widget settings)

Description

FactsGlanceWidget uses SizeMode.Exact and a single Box layout: Wide places the headline + Bitcoin badge top-right with end-padding; Compact moves the badge to the bottom-right. maxLines adapts to height (2 for Wide+1cell, 5 for Wide+2cells and Compact). WIDE_LAYOUT_MIN_WIDTH = CELL * 3 = 210dp, so 3+ cell widths use Wide. The widget skips the config activity — registration and the initial fetchFacts() happen inside provideGlance. Fact rotation is deterministic (cachedFacts[factsRotationTick.mod(size)]) so the headline doesn't shuffle on size swaps.

In-app, FactsCard is split into wide / compact variants and FactsPreviewScreen mirrors Headlines and Blocks (top-bar, description, divider, WidgetSizeCarousel, Save / Delete). FactsEditScreen, FactsPreferences, the factsPreferences field on WidgetsData / HomeUiState, and the related MigrationService blocks are deleted. Legacy on-disk JSON is safe (ignoreUnknownKeys = true).

Manifest and appwidget_info_facts.xml register the provider with a 4×1 default placement and 40dp minHeight / minResizeHeight.

Preview

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

QA Notes

System widget

  1. Widgets picker → "Bitcoin Facts" preview shows Wide layout with badge top-right.
  2. Drop at default 4×1 — Wide, 2-line headline, badge top-right.
  3. Resize to 4×2 — Wide, maxLines jumps to 5.
  4. Resize to 2×2 — Compact, badge bottom-right, BodyMSB (17sp).
  5. Resize to 3×1 — Wide. Resize to 2×1 — Compact.
  6. Wait for refresh tick — displayed fact advances deterministically.
  7. Remove widget — entry cleared from appwidget_data.json.

In-app widget

  1. Widgets feed → Bitcoin Facts — preview screen shows v61 layout (no Widget Settings row, no edit screen).
  2. Swipe carousel — small/wide cards render with badge in matching corner.
  3. Save and verify the in-app FactsCard on Home reflects v61.
  4. With widget added, reopen preview — Delete + Save both appear; Delete removes the in-app card.
  5. Existing install with legacy {"factsPreferences": {...}} on disk — app launches without serialization errors.

@jvsena42 jvsena42 self-assigned this May 1, 2026
Comment thread app/src/main/java/to/bitkit/appwidget/model/AppWidgetPreferences.kt
Comment thread app/src/main/java/to/bitkit/ui/screens/widgets/facts/FactsCard.kt
@ovitrif ovitrif added this to the 2.3.0 milestone May 1, 2026
@claude

This comment has been minimized.

@jvsena42 jvsena42 requested a review from ovitrif May 4, 2026 13:05
@piotr-iohk

This comment was marked as resolved.

@jvsena42
Copy link
Copy Markdown
Member Author

jvsena42 commented May 4, 2026

The support for in-app compact widgets will be implemented in other PR. I did the redesign now to don't double work on OS widgets later

https://www.figma.com/design/ltqvnKiejWj0JQiqtDf2JJ/Bitkit-Wallet?node-id=43100-273252&m=dev

@jvsena42
Copy link
Copy Markdown
Member Author

jvsena42 commented May 4, 2026

Issue encountered - taping on "fact" widgets leads to empty screen:

Fixed

@jvsena42
Copy link
Copy Markdown
Member Author

jvsena42 commented May 4, 2026

Suggestion (I think Figma does not precise this): On OS widgets addition screen it would be good to order widgets to have price and block widgets on top - they seem to be most useful - currently price widget is at the bottom.

I'll check how the preview ordering works

@claude

This comment has been minimized.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 4, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

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.

3 participants