Skip to content

Commit 96f2e12

Browse files
Prepare Android beta branding and review diff UI
- Add variant-specific mobile app assets and Play Store images - Improve Android review diff rendering, gestures, and file headers
1 parent c1ec191 commit 96f2e12

21 files changed

Lines changed: 1276 additions & 452 deletions

‎apps/mobile/app-variants.test.ts‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import * as NodeFS from "node:fs";
2+
import * as NodeURL from "node:url";
3+
4+
import { describe, expect, it } from "vite-plus/test";
5+
6+
import { APP_VARIANT_CONFIG, resolveAppVariant } from "./app-variants";
7+
8+
function pngDimensions(path: string): { readonly width: number; readonly height: number } {
9+
const file = NodeFS.readFileSync(NodeURL.fileURLToPath(new URL(path, import.meta.url)));
10+
return {
11+
width: file.readUInt32BE(16),
12+
height: file.readUInt32BE(20),
13+
};
14+
}
15+
16+
describe("mobile app variants", () => {
17+
it("defaults unknown or missing variants to production", () => {
18+
expect(resolveAppVariant(undefined)).toBe("production");
19+
expect(resolveAppVariant("unknown")).toBe("production");
20+
expect(resolveAppVariant("development")).toBe("development");
21+
expect(resolveAppVariant("preview")).toBe("preview");
22+
expect(resolveAppVariant("production")).toBe("production");
23+
});
24+
25+
it("keeps blueprint branding exclusive to development builds", () => {
26+
expect(APP_VARIANT_CONFIG.development.assets).toMatchObject({
27+
appIcon: "./assets/splash-icon-dev.png",
28+
androidAdaptiveForeground: "./assets/android-icon-dev-foreground.png",
29+
});
30+
expect(APP_VARIANT_CONFIG.preview.assets).toBe(APP_VARIANT_CONFIG.production.assets);
31+
expect(APP_VARIANT_CONFIG.production.assets).toMatchObject({
32+
appIcon: "./assets/splash-icon-prod.png",
33+
androidAdaptiveForeground: "./assets/android-icon-mark.png",
34+
androidAdaptiveBackgroundColor: "#000000",
35+
});
36+
});
37+
38+
it("references assets that exist for every build variant", () => {
39+
for (const variant of Object.values(APP_VARIANT_CONFIG)) {
40+
for (const [name, path] of Object.entries(variant.assets)) {
41+
if (!name.endsWith("Color")) {
42+
expect(
43+
NodeFS.existsSync(NodeURL.fileURLToPath(new URL(path, import.meta.url))),
44+
path,
45+
).toBe(true);
46+
}
47+
}
48+
}
49+
});
50+
51+
it.each([
52+
["./assets/splash-icon-dev.png", 1024, 1024],
53+
["./assets/splash-icon-prod.png", 1024, 1024],
54+
["./assets/android-icon-dev-foreground.png", 432, 432],
55+
["./assets/android-icon-mark.png", 432, 432],
56+
["./assets/android-notification-icon.png", 96, 96],
57+
["./store-assets/google-play-icon.png", 512, 512],
58+
["./store-assets/google-play-feature-graphic.png", 1024, 500],
59+
] as const)("keeps %s at its required %ix%i dimensions", (path, width, height) => {
60+
expect(pngDimensions(path)).toEqual({ width, height });
61+
});
62+
});

‎apps/mobile/app-variants.ts‎

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
export type AppVariant = "development" | "preview" | "production";
2+
3+
export interface AppVariantAssets {
4+
readonly appIcon: string;
5+
readonly iosIcon: string;
6+
readonly splashIcon: string;
7+
readonly androidAdaptiveForeground: string;
8+
readonly androidAdaptiveBackgroundColor: string;
9+
readonly androidMonochromeIcon: string;
10+
readonly androidNotificationIcon: string;
11+
readonly androidNotificationColor: string;
12+
}
13+
14+
export interface AppVariantConfig {
15+
readonly appName: string;
16+
readonly scheme: string;
17+
readonly iosBundleIdentifier: string;
18+
readonly androidPackage: string;
19+
readonly relyingParty?: string;
20+
readonly assets: AppVariantAssets;
21+
}
22+
23+
const DEVELOPMENT_ASSETS = {
24+
appIcon: "./assets/splash-icon-dev.png",
25+
iosIcon: "./assets/icon-composer-dev.icon",
26+
splashIcon: "./assets/splash-icon-dev.png",
27+
androidAdaptiveForeground: "./assets/android-icon-dev-foreground.png",
28+
androidAdaptiveBackgroundColor: "#00639B",
29+
androidMonochromeIcon: "./assets/android-icon-mark.png",
30+
androidNotificationIcon: "./assets/android-notification-icon.png",
31+
androidNotificationColor: "#00639B",
32+
} as const satisfies AppVariantAssets;
33+
34+
const RELEASE_ASSETS = {
35+
appIcon: "./assets/splash-icon-prod.png",
36+
iosIcon: "./assets/icon-composer-prod.icon",
37+
splashIcon: "./assets/splash-icon-prod.png",
38+
androidAdaptiveForeground: "./assets/android-icon-mark.png",
39+
androidAdaptiveBackgroundColor: "#000000",
40+
androidMonochromeIcon: "./assets/android-icon-mark.png",
41+
androidNotificationIcon: "./assets/android-notification-icon.png",
42+
androidNotificationColor: "#FFFFFF",
43+
} as const satisfies AppVariantAssets;
44+
45+
export const APP_VARIANT_CONFIG = {
46+
development: {
47+
appName: "T3 Code Dev",
48+
scheme: "t3code-dev",
49+
iosBundleIdentifier: "com.t3tools.t3code.dev",
50+
androidPackage: "com.t3tools.t3code.dev",
51+
relyingParty: "clerk.t3.codes",
52+
assets: DEVELOPMENT_ASSETS,
53+
},
54+
preview: {
55+
appName: "T3 Code Preview",
56+
scheme: "t3code-preview",
57+
iosBundleIdentifier: "com.t3tools.t3code.preview",
58+
androidPackage: "com.t3tools.t3code.preview",
59+
relyingParty: "clerk.t3.codes",
60+
assets: RELEASE_ASSETS,
61+
},
62+
production: {
63+
appName: "T3 Code",
64+
scheme: "t3code",
65+
iosBundleIdentifier: "com.t3tools.t3code",
66+
androidPackage: "com.t3tools.t3code",
67+
relyingParty: "clerk.t3.codes",
68+
assets: RELEASE_ASSETS,
69+
},
70+
} as const satisfies Record<AppVariant, AppVariantConfig>;
71+
72+
export function resolveAppVariant(value: string | undefined): AppVariant {
73+
switch (value) {
74+
case "development":
75+
case "preview":
76+
case "production":
77+
return value;
78+
default:
79+
return "production";
80+
}
81+
}

‎apps/mobile/app.config.ts‎

Lines changed: 22 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { ExpoConfig } from "expo/config";
22

33
import { loadRepoEnv } from "../../scripts/lib/public-config.ts";
4-
5-
type AppVariant = "development" | "preview" | "production";
4+
import { APP_VARIANT_CONFIG, resolveAppVariant } from "./app-variants.ts";
65

76
const repoEnv = loadRepoEnv();
87
Object.assign(process.env, repoEnv);
@@ -23,59 +22,7 @@ if (
2322
);
2423
}
2524

26-
const VARIANT_CONFIG: Record<
27-
AppVariant,
28-
{
29-
readonly appName: string;
30-
readonly scheme: string;
31-
readonly iosIcon: string;
32-
readonly splashIcon: string;
33-
readonly iosBundleIdentifier: string;
34-
readonly androidPackage: string;
35-
readonly relyingParty?: string;
36-
}
37-
> = {
38-
development: {
39-
appName: "T3 Code Dev",
40-
scheme: "t3code-dev",
41-
iosIcon: "./assets/icon-composer-dev.icon",
42-
splashIcon: "./assets/splash-icon-dev.png",
43-
iosBundleIdentifier: "com.t3tools.t3code.dev",
44-
androidPackage: "com.t3tools.t3code.dev",
45-
relyingParty: "clerk.t3.codes",
46-
},
47-
preview: {
48-
appName: "T3 Code Preview",
49-
scheme: "t3code-preview",
50-
iosIcon: "./assets/icon-composer-prod.icon",
51-
splashIcon: "./assets/splash-icon-prod.png",
52-
iosBundleIdentifier: "com.t3tools.t3code.preview",
53-
androidPackage: "com.t3tools.t3code.preview",
54-
relyingParty: "clerk.t3.codes",
55-
},
56-
production: {
57-
appName: "T3 Code",
58-
scheme: "t3code",
59-
iosIcon: "./assets/icon-composer-prod.icon",
60-
splashIcon: "./assets/splash-icon-prod.png",
61-
iosBundleIdentifier: "com.t3tools.t3code",
62-
androidPackage: "com.t3tools.t3code",
63-
relyingParty: "clerk.t3.codes",
64-
},
65-
};
66-
67-
function resolveAppVariant(value: string | undefined): AppVariant {
68-
switch (value) {
69-
case "development":
70-
case "preview":
71-
case "production":
72-
return value;
73-
default:
74-
return "production";
75-
}
76-
}
77-
78-
const variant = VARIANT_CONFIG[APP_VARIANT];
25+
const variant = APP_VARIANT_CONFIG[APP_VARIANT];
7926

8027
const dmSansFonts = {
8128
regular: "@expo-google-fonts/dm-sans/400Regular/DMSans_400Regular.ttf",
@@ -121,7 +68,7 @@ const config: ExpoConfig = {
12168
policy: process.env.MOBILE_VERSION_POLICY ?? "fingerprint",
12269
},
12370
orientation: "portrait",
124-
icon: "./assets/icon.png",
71+
icon: variant.assets.appIcon,
12572
userInterfaceStyle: "automatic",
12673
updates: {
12774
enabled: true,
@@ -130,7 +77,7 @@ const config: ExpoConfig = {
13077
fallbackToCacheTimeout: 0,
13178
},
13279
ios: {
133-
icon: variant.iosIcon,
80+
icon: variant.assets.iosIcon,
13481
supportsTablet: true,
13582
bundleIdentifier: variant.iosBundleIdentifier,
13683
// Pin code signing to the T3 Tools team so non-interactive `expo run:ios`
@@ -151,21 +98,20 @@ const config: ExpoConfig = {
15198
},
15299
},
153100
android: {
154-
icon: "./assets/icon.png",
101+
icon: variant.assets.appIcon,
155102
package: variant.androidPackage,
156103
adaptiveIcon: {
157-
backgroundColor: "#E6F4FE",
158-
foregroundImage: "./assets/android-icon-foreground.png",
159-
backgroundImage: "./assets/android-icon-background.png",
160-
monochromeImage: "./assets/android-icon-monochrome.png",
104+
backgroundColor: variant.assets.androidAdaptiveBackgroundColor,
105+
foregroundImage: variant.assets.androidAdaptiveForeground,
106+
monochromeImage: variant.assets.androidMonochromeIcon,
161107
},
162108
// Opts into OnBackInvokedCallback-based back dispatch (Android 13+).
163109
// JS back handling survives it via react-native's Android 16 shim plus
164110
// withAndroidPredictiveBackCompat on Android 13-15.
165111
predictiveBackGestureEnabled: true,
166112
},
167113
web: {
168-
favicon: "./assets/favicon.png",
114+
favicon: variant.assets.appIcon,
169115
},
170116
plugins: [
171117
"expo-asset",
@@ -195,6 +141,14 @@ const config: ExpoConfig = {
195141
],
196142
"expo-secure-store",
197143
"expo-sqlite",
144+
[
145+
"expo-notifications",
146+
{
147+
icon: variant.assets.androidNotificationIcon,
148+
color: variant.assets.androidNotificationColor,
149+
mode: APP_VARIANT === "development" ? "development" : "production",
150+
},
151+
],
198152
// appleSignIn must be gated here: withoutIosPersonalTeamCapabilities.cjs runs before
199153
// plugins earlier in this array, so it cannot strip the entitlement Clerk would add.
200154
["@clerk/expo", { theme: "./clerk-theme.json", appleSignIn: !isIosPersonalTeamBuild }],
@@ -206,8 +160,8 @@ const config: ExpoConfig = {
206160
// the shortcut items set in src/features/shortcuts.
207161
androidIcons: {
208162
shortcut_icon: {
209-
foregroundImage: "./assets/android-icon-foreground.png",
210-
backgroundColor: "#E6F4FE",
163+
foregroundImage: variant.assets.androidAdaptiveForeground,
164+
backgroundColor: variant.assets.androidAdaptiveBackgroundColor,
211165
},
212166
},
213167
},
@@ -217,17 +171,18 @@ const config: ExpoConfig = {
217171
{
218172
cameraPermission: "Allow T3 Code to access your camera so you can scan pairing QR codes.",
219173
barcodeScannerEnabled: true,
174+
recordAudioAndroid: false,
220175
},
221176
],
222177
[
223178
"expo-splash-screen",
224179
{
225-
image: variant.splashIcon,
180+
image: variant.assets.splashIcon,
226181
resizeMode: "contain",
227182
backgroundColor: "#ffffff",
228183
imageWidth: 220,
229184
dark: {
230-
image: variant.splashIcon,
185+
image: variant.assets.splashIcon,
231186
backgroundColor: "#0a0a0a",
232187
},
233188
},
File renamed without changes.
-323 KB
Binary file not shown.
3.58 KB
Loading
-323 KB
Binary file not shown.
733 Bytes
Loading

‎apps/mobile/assets/favicon.png‎

-73.7 KB
Binary file not shown.

‎apps/mobile/assets/icon.png‎

-2.04 MB
Binary file not shown.

0 commit comments

Comments
 (0)