Intelligence, Advanced Charting & Trading Platform

1 # ChartNova iOS + real WidgetKit extension
2
3 This folder contains the **native iPhone companion app and Home Screen widget source**, not a web shortcut. Unlike a PWA, the WidgetKit target appears in the iOS **Add Widget** picker after the containing app has been built, signed and installed.
4
5 ## Features
6
7 - One widget with the standard iOS small, medium and large families, showing **2 / 4 / 6** user-selected instruments respectively.
8 - App screen to select up to six market symbols from ChartNova's live 58-symbol watchlist, favorite/unfavorite, reorder and choose Nova Glass, dark or light appearance.
9 - Shared App Group `group.ir.chartnova.widgets` persists preferences between app and widget.
10 - HTTPS `GET https://app.chartnova.ir/api/widget?symbols=...` with the selected ordered symbols. Zero API keys in the binary; request is served by Cloudflare KV and does not consume 250-per-day upstream requests per widget view.
11 - WidgetKit timeline asks for a refresh after 15 minutes; **iOS may defer updates** depending on power, budget, connectivity and system policy.
12 - When offline, last valid response is used and prominently marked as cached / stale. Placeholder **does not invent prices**.
13 - Tapping widget opens the companion app through `chartnova://widget`.
14
15 ## Building on macOS (required)
16
17 1. Use a Mac with an Xcode version that supports iOS 17 or later.
18 2. Install **XcodeGen** (e.g. `brew install xcodegen`).
19 3. Run `cd ios/ChartNova && xcodegen generate`, then open `ChartNova.xcodeproj` in Xcode.
20 4. Select your Apple development team under Signing & Capabilities for both `ChartNova` and `ChartNovaWidgets`.
21 5. Register and enable the same **App Groups** capability, `group.ir.chartnova.widgets`, for both bundle IDs. Change the sample bundle IDs and group ID if your team's identifiers are different; update both `project.yml` and `Shared/WidgetSettings.swift`.
22 6. Build and run the **ChartNova** scheme on your physical iPhone; trust the developer identity if prompted.
23 7. Open ChartNova once, select favorites and rearrange the widget list. On the iPhone Home Screen, long-press empty space → **Edit → Add Widget** → search **ChartNova** → choose a size → Add Widget.
24 8. For iOS unit tests run `xcodebuild test -project ChartNova.xcodeproj -scheme ChartNova -destination 'platform=iOS Simulator,name=iPhone 16'`; choose an available simulator name if different.
25
26 The App Group and development provisioning are Apple-controlled; without them the widget cannot securely share app preferences. A paid Apple Developer membership may be required for distribution and/or capabilities. Nothing has been published to the App Store or installed on an actual iPhone by this repository change.
27
28 ## Security & correctness
29
30 - Uses HTTPS-only ChartNova backend. No credentials, bearer tokens or API secret keys in the app.
31 - All selected symbols are allowlisted to uppercase `BASE-QUOTE` pairs with a six-symbol cap.
32 - Network data is decoded and validated before being cached, with explicit provider timestamps / stale indicators.
33 - Price values are **provider sell quotes**, not necessarily executable exchange prices, and are not guaranteed to update in real time.
34 - The iOS application and widget targets share code from `Shared/`. Native widget settings are separate from the browser's localStorage-based preview; automatic cross-device/browser sync requires account support and has **not** been built.
35
36 ## Validation evidence
37
38 Automated tests against the real live ChartNova widget API and static project validation are possible from Windows/Linux. **Xcode compilation, simulator WidgetKit integration and physical iPhone installation require macOS/Xcode and must not be claimed passed until run.**