Skip to content

feat: OS widgets foundation + price widget#538

Open
jvsena42 wants to merge 18 commits into
masterfrom
feat/os-widgets
Open

feat: OS widgets foundation + price widget#538
jvsena42 wants to merge 18 commits into
masterfrom
feat/os-widgets

Conversation

@jvsena42
Copy link
Copy Markdown
Member

@jvsena42 jvsena42 commented May 5, 2026

Description

This PR adds the foundation for native iOS Home Screen widgets via WidgetKit, with the Bitcoin price widget as the first concrete example mirroring its in-app counterpart.

The foundation establishes the contract that future home-screen widgets will reuse:

  • App Group group.bitkit is the only sync channel between the main app and the widget extension — no shared MMKV, redux-persist, or keychain.
  • Per-widget options stores save/load configuration in App Group UserDefaults and trigger WidgetCenter.reloadTimelines whenever the in-app editor saves changes, so the home-screen widget reflects edits within ~1s.
  • A stale-while-revalidate caching strategy: the main app writes the latest payload to the App Group, and the widget extension reads it synchronously from placeholder / getSnapshot, kicks off a fresh fetch in getTimeline, and falls back to cache (or a graceful error state) when offline.
  • Shared models and styles (Inter Tight fonts, Colors, Fonts, TextStyle) are wired into both targets via PBXFileSystemSynchronizedBuildFileExceptionSet, keeping the extension binary minimal.
  • Widgets honor widgetRenderingMode so they render correctly in both full-color and accented (Liquid Glass / StandBy) modes.

The price widget itself ships small, medium, and large families. Small shows the price and 24h change badge. Medium and large add a Charts-based sparkline that picks color from the change direction and respects rendering mode. Selected pairs, period, and the optional Bitfinex.com source line all flow from the in-app price widget editor.

Linked Issues/Tasks

Mirrors the foundation introduced on Android in bitkit-android#895.

Screenshot / Video

Simulator.Screen.Recording.-.iPhone.16.-.2026-05-05.at.14.09.49.mp4
Simulator.Screen.Recording.-.iPhone.16.-.2026-05-06.at.07.11.40.mp4

QA Notes

1. Add the widget from the gallery

  • Long-press the home screen, tap +, search "Bitkit".
  • Confirm "Bitcoin Price" appears with Small, Medium, and Large previews.
  • Add Medium and confirm the price, change badge, and sparkline render with cached or live data.

2. Configuration flows through App Group

  • Open Bitkit, edit the in-app price widget: change selectedPairs to include BTC/EUR, switch period to 1W, toggle showSource on.
  • Within ~1s, confirm the home-screen widget reloads with the new pairs, the new period label, and the "Bitfinex.com" footer.

3. Rendering modes

  • On iOS 18+, switch the home screen to the tinted/Liquid Glass style and confirm the widget renders with Color.clear background and tint-friendly text.

4. Unrelated regressions

  • Open the in-app widgets editor and confirm Blocks, Facts, News, Weather, Calculator, Suggestions still render the same as on master.
  • Run the unit tests in Xcode (Cmd+U) — no test changes are expected.

@jvsena42 jvsena42 self-assigned this May 5, 2026
Comment thread BitkitWidget/BitkitWidget.entitlements
@jvsena42 jvsena42 marked this pull request as ready for review May 5, 2026 16:46
@jvsena42
Copy link
Copy Markdown
Member Author

jvsena42 commented May 5, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 95e132a147

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread BitkitWidget/PriceWidgetService.swift Outdated
Comment thread Bitkit.xcodeproj/project.pbxproj Outdated
Comment thread BitkitWidget/PriceWidgetService.swift
Comment thread BitkitWidget/PriceHomeScreenWidget.swift Outdated
Comment thread WIDGET_SETUP.md Outdated
Comment thread changelog.d/next/538.added.md
@jvsena42
Copy link
Copy Markdown
Member Author

jvsena42 commented May 6, 2026

Large widget removed in #542

Comment thread BitkitWidget/PriceWidgetService.swift Outdated
Comment thread BitkitWidget/PriceWidgetService.swift Outdated
Comment thread WIDGET_SETUP.md Outdated
Comment thread BitkitWidget/PriceWidgetService.swift Outdated
@jvsena42 jvsena42 mentioned this pull request May 6, 2026
15 tasks
@jvsena42 jvsena42 requested a review from pwltr May 6, 2026 16:20
Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test body only

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no inline threads test

@claude

This comment was marked as resolved.

@jvsena42
Copy link
Copy Markdown
Member Author

jvsena42 commented May 7, 2026

@piotr-iohk probably still need E2E update here

jvsena42 and others added 2 commits May 14, 2026 18:13
* feat: port price widgets related screens to figma V61

* fix: spacing and alignment

* feat: hide menu button from nabigation bar

* fix: padding

* fix: remove systemLarge widget option

* fix: collect results in input order instead of completion order

* fix: pr comments

* fix: pr comments

* refactor: simplify doc

* refactor: replace onApper with task

* refactor: replace onChange with task id

* refactor: simplify comments

* refactor: simplyfy comments

* refactor: simplify comments

* refactor: simplify comments

* refactor: simplify comments

* refactor: remove multi-pair legacy code

* fix:  fallback to  os widget options after remove in-app

* fix: make chart height adaptable

* feat:  set backgroud color  Gray7

* fix: reuse existing text component and remove  scale factor

* fix: display white32 checkmark for unselected item

* fix: vertical padding anchored to checkbox image

* fix: remove the gray bg and custom bg from Navigation bar

* fix: try to fetch real data for preview

* refactor: make string keys generic to be reused in the furue implementtions

* fix: make prevew frame height adaptable

* fix: remove app group fallback

* test: widget test ids adjustment

* fixes

---------

Co-authored-by: Piotr Stachyra <piotr.stachyra@gmail.com>
Co-authored-by: Philipp Walter <philippwalter@proton.me>
* feat: port price widgets related screens to figma V61

* fix: spacing and alignment

* feat: hide menu button from nabigation bar

* fix: padding

* fix: remove systemLarge widget option

* fix: collect results in input order instead of completion order

* fix: pr comments

* fix: pr comments

* refactor: simplify doc

* refactor: replace onApper with task

* refactor: replace onChange with task id

* refactor: simplify comments

* refactor: simplyfy comments

* refactor: simplify comments

* refactor: simplify comments

* refactor: simplify comments

* refactor: remove multi-pair legacy code

* fix:  fallback to  os widget options after remove in-app

* fix: make chart height adaptable

* feat:  set backgroud color  Gray7

* feat: migrate news widget to design v61 and port OS widget

* fix: push source text to bottom

* refactor: extract articles url to a shared files

* feat: open browser on widget click

* doc: changelog entry

* fix: small and medium sizes displaying different random url

* chore: remove schedule file

* fix: replace onAppear with task

* fix: use stable dafe format identifier

* fix: reuse existing text component and remove  scale factor

* fix: display white32 checkmark for unselected item

* fix: vertical padding anchored to checkbox image

* fix: remove the gray bg and custom bg from Navigation bar

* fix: try to fetch real data for preview

* refactor: make string keys generic to be reused in the furue implementtions

* fix: make prevew frame height adaptable

* fix: display checkmark for title

* fix: remove app group fallback

* test: widget test ids adjustment

* test: widget test ids adjustment

* fixes

* fixes

* fixes

---------

Co-authored-by: Piotr Stachyra <piotr.stachyra@gmail.com>
Co-authored-by: Philipp Walter <philippwalter@proton.me>
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.

2 participants