> ## Documentation Index
> Fetch the complete documentation index at: https://285e39fd5e337e58f16290.sightscreen.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Build & deploy

> Build configuration, scripts, and deployment.

## Build script

The app is built using `scripts/build-ios.sh`, which handles configuration, SDK selection, and API URL injection.

```bash theme={null}
# Usage
./scripts/build-ios.sh [Configuration] [SDK]
```

The script injects the correct API URL at build time based on the configuration and environment.

***

## API sources

| Environment | URL                        | Purpose                              |
| ----------- | -------------------------- | ------------------------------------ |
| Production  | `api.sightscreen.app`      | Live production API                  |
| Fake        | `fake-api.sightscreen.app` | Fake API for development and testing |

### URL resolution order

The API base URL is resolved in this priority order:

<Steps>
  <Step title="Build-time override">
    If an explicit API URL is passed to the build script, it takes priority.
  </Step>

  <Step title="SANDBOX_API_URL environment variable">
    If set, this env var overrides the default. Useful for pointing at local or staging servers.
  </Step>

  <Step title="Default">
    Falls back to the production URL (`api.sightscreen.app`).
  </Step>
</Steps>

<Tip>
  To test against the fake API locally, set `SANDBOX_API_URL=https://fake-api.sightscreen.app` before building.
</Tip>

***

## Info.plist configuration

Key entries in the app's `Info.plist`:

| Key                                       | Value                          | Purpose                                               |
| ----------------------------------------- | ------------------------------ | ----------------------------------------------------- |
| `NSSupportsLiveActivities`                | `YES`                          | Enables Live Activity support                         |
| `NSSupportsLiveActivitiesFrequentUpdates` | `YES`                          | Allows more frequent APNs updates for Live Activities |
| `UIBackgroundModes`                       | `fetch`, `remote-notification` | Enables background fetch and push processing          |

<Warning>
  All three Info.plist entries are required. `fetch` enables periodic stale-detection checks. `remote-notification` enables silent push processing for Live Activity token management. `NSSupportsLiveActivitiesFrequentUpdates` unlocks the higher update budget needed for ball-by-ball cricket scoring.
</Warning>

***

## Bundle identifiers

| Target   | Bundle ID                               |
| -------- | --------------------------------------- |
| Main app | `com.sightscreen.ios`                   |
| Widget   | `com.sightscreen.ios.SightscreenWidget` |

The main app bundle ID is registered with APNs for push notifications and Live Activity updates.

***

## Widget target

The widget target `SightscreenWidget` is a separate build target that shares models with the main app.

| Shared resource  | How                                                                   |
| ---------------- | --------------------------------------------------------------------- |
| Generated models | All `.generated.swift` files included in both targets                 |
| Cached images    | App group shared container (`ImageCacheService` writes, widget reads) |
| Constants        | Shared constants file for match IDs, URLs, etc.                       |

***

## Fonts

The app uses two custom font families:

| Font              | Usage                                    |
| ----------------- | ---------------------------------------- |
| **Clash Display** | Headings, scores, large display text     |
| **Satoshi**       | Body text, labels, secondary information |

Both are bundled in the app and registered in `Info.plist`.

***

## Theme system

Visual theming is managed through three files:

| File                 | Purpose                                                                                     |
| -------------------- | ------------------------------------------------------------------------------------------- |
| `Colors.swift`       | App-wide color definitions (background, text, accent, etc.)                                 |
| `Typography.swift`   | Font size and weight presets mapped to Clash Display and Satoshi                            |
| `TeamBranding.swift` | IPL team-specific colors (primary, secondary, gradient) for match cards and Live Activities |

<Accordion title="Example: TeamBranding lookup">
  ```swift theme={null}
  struct TeamBranding {
      let primary: Color
      let secondary: Color
      let gradient: [Color]

      static func branding(for teamAbbr: String) -> TeamBranding {
          switch teamAbbr {
          case "MI": return TeamBranding(
              primary: .blue,
              secondary: .gold,
              gradient: [.blue, .darkBlue]
          )
          case "CSK": return TeamBranding(
              primary: .yellow,
              secondary: .blue,
              gradient: [.yellow, .darkYellow]
          )
          // ... other IPL teams
          default: return defaultBranding
          }
      }
  }
  ```
</Accordion>

<Note>
  Team branding colors are one of the few things defined on the client side, since they are purely visual and do not depend on match state or backend logic.
</Note>
