Skip to content

feat: OS widgets foundation + price widget#538

Open
jvsena42 wants to merge 9 commits intomasterfrom
feat/os-widgets
Open

feat: OS widgets foundation + price widget#538
jvsena42 wants to merge 9 commits intomasterfrom
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-05.at.14.21.20.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
Comment thread Bitkit.xcodeproj/project.pbxproj Outdated
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