Skip to content

Commit 3a8fe0a

Browse files
proggeramlugclaude
andcommitted
Document splash screen feature in project config, platform guides, and changelog
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a3afdf5 commit 3a8fe0a

4 files changed

Lines changed: 145 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
Detailed changelog for Perry. See CLAUDE.md for concise summaries.
44

5+
## v0.2.178
6+
- **Splash screen support for iOS and Android**
7+
- Parse `perry.splash` config from `package.json` with three tiers: universal (single image + color), per-platform overrides, full custom file override
8+
- iOS: auto-generate LaunchScreen.storyboard with centered image (128x128pt, scaleAspectFit) and custom background color; or use a custom storyboard
9+
- Android: `Theme.Perry.Splash` style with `windowBackground` layer-list drawable; activity calls `setTheme()` in `onCreate` to switch to normal theme
10+
- New template file: `perry-ui-android/template/app/src/main/res/drawable/splash_background.xml`
11+
- Modified: `compile.rs` (iOS storyboard generation), `themes.xml`, `AndroidManifest.xml`, `PerryActivity.kt`
12+
513
## v0.2.147
614
- **Mark-sweep garbage collection** for bounded memory in long-running programs
715
- New `crates/perry-runtime/src/gc.rs`: full GC infrastructure

docs/src/getting-started/project-config.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,80 @@ When a package is listed here, Perry:
4848

4949
This is useful for pure TypeScript/JavaScript packages that don't rely on Node.js APIs. Packages that use native bindings, `eval()`, or dynamic `require()` won't work.
5050

51+
#### `splash`
52+
53+
Configure a native splash screen for iOS and Android. The splash screen appears instantly during cold start, before your app code runs.
54+
55+
**Minimal (both platforms share the same splash):**
56+
57+
```json
58+
{
59+
"perry": {
60+
"splash": {
61+
"image": "logo/icon-256.png",
62+
"background": "#FFF5EE"
63+
}
64+
}
65+
}
66+
```
67+
68+
**Per-platform overrides:**
69+
70+
```json
71+
{
72+
"perry": {
73+
"splash": {
74+
"image": "logo/icon-256.png",
75+
"background": "#FFF5EE",
76+
"ios": {
77+
"image": "logo/splash-ios.png",
78+
"background": "#FFFFFF"
79+
},
80+
"android": {
81+
"image": "logo/splash-android.png",
82+
"background": "#FFFFFF"
83+
}
84+
}
85+
}
86+
}
87+
```
88+
89+
**Full custom override (complete control):**
90+
91+
```json
92+
{
93+
"perry": {
94+
"splash": {
95+
"ios": {
96+
"storyboard": "splash/LaunchScreen.storyboard"
97+
},
98+
"android": {
99+
"layout": "splash/splash_background.xml",
100+
"theme": "splash/themes.xml"
101+
}
102+
}
103+
}
104+
}
105+
```
106+
107+
| Field | Description |
108+
|-------|-------------|
109+
| `splash.image` | Path to a PNG image, centered on the splash screen (both platforms) |
110+
| `splash.background` | Hex color for the background (default: `#FFFFFF`) |
111+
| `splash.ios.image` | iOS-specific image override |
112+
| `splash.ios.background` | iOS-specific background color |
113+
| `splash.ios.storyboard` | Custom LaunchScreen.storyboard (compiled with ibtool) |
114+
| `splash.android.image` | Android-specific image override |
115+
| `splash.android.background` | Android-specific background color |
116+
| `splash.android.layout` | Custom drawable XML for `windowBackground` |
117+
| `splash.android.theme` | Custom themes.xml |
118+
119+
**Resolution order** per platform:
120+
1. Custom file override (storyboard / layout+theme)
121+
2. Platform-specific image/color (`splash.{platform}.image`)
122+
3. Universal image/color (`splash.image`)
123+
4. No `splash` key → blank white screen (backward compatible)
124+
51125
## Using npm Packages
52126

53127
Perry natively supports many popular npm packages without any configuration:

docs/src/platforms/android.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,40 @@ Perry maps UI widgets to Android views via JNI:
4848
- **Alerts**: `PerryBridge.showAlert`
4949
- **Sheets**: Dialog (modal)
5050

51+
## Splash Screen
52+
53+
Perry's Android template includes a splash theme (`Theme.Perry.Splash`) that displays a `windowBackground` drawable during cold start. Configure it via `perry.splash` in `package.json`:
54+
55+
```json
56+
{
57+
"perry": {
58+
"splash": {
59+
"image": "logo/icon-256.png",
60+
"background": "#FFF5EE"
61+
}
62+
}
63+
}
64+
```
65+
66+
The image is centered via a `layer-list` drawable with a solid background color. The activity switches to the normal theme in `onCreate` before inflating the layout, so the splash disappears as soon as the app is ready.
67+
68+
For full control, provide custom drawable and theme XML files:
69+
70+
```json
71+
{
72+
"perry": {
73+
"splash": {
74+
"android": {
75+
"layout": "splash/splash_background.xml",
76+
"theme": "splash/themes.xml"
77+
}
78+
}
79+
}
80+
}
81+
```
82+
83+
See [Project Configuration](../getting-started/project-config.md#splash) for the full config reference.
84+
5185
## Differences from Desktop
5286

5387
- **Touch-only**: No hover events, no right-click context menus

docs/src/platforms/ios.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,35 @@ perry widget.ts --target ios-widget
7070

7171
See [Widgets (WidgetKit)](../widgets/overview.md) for details.
7272

73+
## Splash Screen
74+
75+
Perry auto-generates a native `LaunchScreen.storyboard` from the `perry.splash` config in `package.json`. The splash screen appears instantly during cold start.
76+
77+
```json
78+
{
79+
"perry": {
80+
"splash": {
81+
"image": "logo/icon-256.png",
82+
"background": "#FFF5EE"
83+
}
84+
}
85+
}
86+
```
87+
88+
The image is centered at 128x128pt with `scaleAspectFit`. You can provide a custom storyboard for full control:
89+
90+
```json
91+
{
92+
"perry": {
93+
"splash": {
94+
"ios": { "storyboard": "splash/LaunchScreen.storyboard" }
95+
}
96+
}
97+
}
98+
```
99+
100+
See [Project Configuration](../getting-started/project-config.md#splash) for the full config reference.
101+
73102
## Differences from macOS
74103

75104
- **No menu bar**: iOS doesn't support menu bars. Use toolbar or navigation patterns.

0 commit comments

Comments
 (0)