diff --git a/app.json b/app.json
index 25be1c2..3c0a1bb 100644
--- a/app.json
+++ b/app.json
@@ -11,7 +11,7 @@
"backgroundColor": "#FAF3EC",
"ios": {
"icon": "./assets/ios-icon-1024.png",
- "bundleIdentifier": "com.birthmark.app",
+ "bundleIdentifier": "com.htpdevs.birthmark",
"supportsTablet": true,
"requireFullScreen": true,
"infoPlist": {
@@ -22,6 +22,12 @@
"android": {
"package": "com.htpdevs.birthmark",
"allowBackup": false,
+ "blockedPermissions": [
+ "android.permission.INTERNET",
+ "android.permission.SYSTEM_ALERT_WINDOW",
+ "android.permission.READ_EXTERNAL_STORAGE",
+ "android.permission.WRITE_EXTERNAL_STORAGE"
+ ],
"softwareKeyboardLayoutMode": "resize",
"adaptiveIcon": {
"backgroundColor": "#E8775A",
@@ -61,7 +67,8 @@
"imageWidth": 76
}
],
- "./plugins/withNoUserScriptSandboxing"
+ "./plugins/withNoUserScriptSandboxing",
+ "./plugins/withDebugOnlyInternet"
],
"experiments": {
"typedRoutes": true,
diff --git a/assets/README.txt b/assets/README.txt
index 6fd6061..e7aa999 100644
--- a/assets/README.txt
+++ b/assets/README.txt
@@ -11,6 +11,8 @@ LOGO
iOS
ios-icon-1024.png Upload to Xcode / App Store Connect. Square on purpose — iOS rounds the corners.
+ No alpha channel: App Store Connect rejects icons with one.
+ Re-export: magick in.png -background '#E8775A' -alpha remove -alpha off -strip PNG24:ios-icon-1024.png
ANDROID (adaptive icon = two layers that Android stacks and masks)
android-background.svg / -432.png Background layer: solid coral by design
@@ -18,6 +20,9 @@ ANDROID (adaptive icon = two layers that Android stacks and masks)
Looks like "just hands" on white; correct when stacked on coral.
android-monochrome.svg Themed-icon layer (Android 13+)
play-store-512.png Google Play listing icon
+ play-feature-graphic-1024x500.png Google Play feature graphic: lockup.png at 720px wide, centered on cream.
+ 24-bit PNG, no alpha. Rebuild:
+ magick -size 1024x500 xc:'#FAF3EC' \( lockup.png -resize 720x \) -gravity center -composite -alpha off -strip PNG24:play-feature-graphic-1024x500.png
WEB
favicon.svg, favicon-16/32/48.png, apple-touch-icon-180.png
diff --git a/assets/ios-icon-1024.png b/assets/ios-icon-1024.png
index 59afc3e..7e32fd7 100644
Binary files a/assets/ios-icon-1024.png and b/assets/ios-icon-1024.png differ
diff --git a/assets/play-feature-graphic-1024x500.png b/assets/play-feature-graphic-1024x500.png
new file mode 100644
index 0000000..5f523c5
Binary files /dev/null and b/assets/play-feature-graphic-1024x500.png differ
diff --git a/plugins/withDebugOnlyInternet.js b/plugins/withDebugOnlyInternet.js
new file mode 100644
index 0000000..0ce10eb
--- /dev/null
+++ b/plugins/withDebugOnlyInternet.js
@@ -0,0 +1,47 @@
+// Release builds must not hold INTERNET: the app is offline and the privacy
+// policy says nothing leaves the device. app.json blocks it through
+// android.blockedPermissions, which writes a tools:node="remove" entry into the
+// main manifest and strips it from every library manifest too. Debug builds
+// still need it to load the JS bundle from Metro, so this plugin declares it in
+// the debug manifests (debug, and debugOptimized when the template has it),
+// which outrank main in the merge and keep it there.
+const fs = require('fs');
+const path = require('path');
+const { withDangerousMod } = require('expo/config-plugins');
+
+const INTERNET = '';
+const DEV_VARIANTS = ['debug', 'debugOptimized'];
+
+/** Returns the debug manifest with INTERNET declared once, before . */
+function addDebugInternetPermission(xml) {
+ if (/android:name="android\.permission\.INTERNET"/.test(xml)) return xml;
+ const at = xml.indexOf(' element');
+ return `${xml.slice(0, at)}${INTERNET}\n\n ${xml.slice(at)}`;
+}
+
+/** Patches the dev-variant manifests under an android/ project root. Returns the variants patched. */
+function patchDevManifests(androidRoot) {
+ const patched = [];
+ for (const variant of DEV_VARIANTS) {
+ const file = path.join(androidRoot, 'app', 'src', variant, 'AndroidManifest.xml');
+ // debug always exists; a missing one means the template changed, so fail loudly.
+ if (variant !== 'debug' && !fs.existsSync(file)) continue;
+ fs.writeFileSync(file, addDebugInternetPermission(fs.readFileSync(file, 'utf8')));
+ patched.push(variant);
+ }
+ return patched;
+}
+
+const withDebugOnlyInternet = (config) =>
+ withDangerousMod(config, [
+ 'android',
+ async (cfg) => {
+ patchDevManifests(cfg.modRequest.platformProjectRoot);
+ return cfg;
+ },
+ ]);
+
+module.exports = withDebugOnlyInternet;
+module.exports.addDebugInternetPermission = addDebugInternetPermission;
+module.exports.patchDevManifests = patchDevManifests;
diff --git a/tests/appConfig.test.ts b/tests/appConfig.test.ts
index e6720fe..dd9ed15 100644
--- a/tests/appConfig.test.ts
+++ b/tests/appConfig.test.ts
@@ -3,10 +3,14 @@ import { join } from 'path';
const appJson = JSON.parse(readFileSync(join(__dirname, '..', 'app.json'), 'utf8')).expo;
-// The Play Store listing is keyed to this id and it can never change after the
+// Store listings are keyed to these ids and they can never change after the
// first upload, so a rename here would publish a different app.
describe('app config', () => {
it('Android application id is com.htpdevs.birthmark', () => {
expect(appJson.android.package).toBe('com.htpdevs.birthmark');
});
+
+ it('iOS bundle identifier is com.htpdevs.birthmark', () => {
+ expect(appJson.ios.bundleIdentifier).toBe('com.htpdevs.birthmark');
+ });
});
diff --git a/tests/debugOnlyInternet.test.ts b/tests/debugOnlyInternet.test.ts
new file mode 100644
index 0000000..81f90d4
--- /dev/null
+++ b/tests/debugOnlyInternet.test.ts
@@ -0,0 +1,95 @@
+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'fs';
+import { tmpdir } from 'os';
+import { join } from 'path';
+
+// Release builds block INTERNET (app.json android.blockedPermissions), so the
+// offline claim in the privacy policy holds for what ships. Debug builds load
+// the bundle from Metro and need it back; this plugin adds it to the debug
+// manifests, which outrank main in the Gradle merge. Verified on prebuild:
+// release merged manifest has no INTERNET, debug and debugOptimized have it.
+
+// eslint-disable-next-line @typescript-eslint/no-require-imports
+const { addDebugInternetPermission, patchDevManifests } = require('../plugins/withDebugOnlyInternet');
+
+const appJson = JSON.parse(readFileSync(join(__dirname, '..', 'app.json'), 'utf8')).expo;
+
+// The Expo SDK 57 template's android/app/src/debug/AndroidManifest.xml.
+const TEMPLATE = `
+
+
+
+
+
+`;
+
+const count = (xml: string) => (xml.match(/android\.permission\.INTERNET/g) ?? []).length;
+
+describe('debug-only INTERNET plugin', () => {
+ it('adds INTERNET before ', () => {
+ const out = addDebugInternetPermission(TEMPLATE);
+ expect(count(out)).toBe(1);
+ expect(out.indexOf('android.permission.INTERNET')).toBeLessThan(out.indexOf(' {
+ const once = addDebugInternetPermission(TEMPLATE);
+ expect(addDebugInternetPermission(once)).toBe(once);
+ });
+
+ it('fails loudly if the template has no ', () => {
+ expect(() => addDebugInternetPermission('')).toThrow(/no /);
+ });
+
+ describe('on a prebuilt android/ tree', () => {
+ let root: string;
+ const manifest = (variant: string) => join(root, 'app', 'src', variant, 'AndroidManifest.xml');
+ const write = (variant: string) => {
+ mkdirSync(join(root, 'app', 'src', variant), { recursive: true });
+ writeFileSync(manifest(variant), TEMPLATE);
+ };
+
+ beforeEach(() => {
+ root = mkdtempSync(join(tmpdir(), 'birthmark-android-'));
+ });
+ afterEach(() => rmSync(root, { recursive: true, force: true }));
+
+ it('patches debug and debugOptimized, and stays single across repeated prebuilds', () => {
+ write('debug');
+ write('debugOptimized');
+ write('main');
+ expect(patchDevManifests(root)).toEqual(['debug', 'debugOptimized']);
+ patchDevManifests(root);
+ expect(count(readFileSync(manifest('debug'), 'utf8'))).toBe(1);
+ expect(count(readFileSync(manifest('debugOptimized'), 'utf8'))).toBe(1);
+ expect(readFileSync(manifest('main'), 'utf8')).toBe(TEMPLATE);
+ });
+
+ it('skips a missing debugOptimized', () => {
+ write('debug');
+ expect(patchDevManifests(root)).toEqual(['debug']);
+ });
+
+ it('fails when the debug manifest is missing', () => {
+ expect(() => patchDevManifests(root)).toThrow(/ENOENT/);
+ });
+ });
+
+ it('is registered in app.json', () => {
+ expect(appJson.plugins).toContain('./plugins/withDebugOnlyInternet');
+ });
+});
+
+describe('release Android permissions', () => {
+ it('blocks INTERNET, overlay, and legacy storage', () => {
+ // Exact list: blocking a permission a library calls at runtime throws
+ // SecurityException, so additions here need the same release check.
+ expect(appJson.android.blockedPermissions).toEqual([
+ 'android.permission.INTERNET',
+ 'android.permission.SYSTEM_ALERT_WINDOW',
+ 'android.permission.READ_EXTERNAL_STORAGE',
+ 'android.permission.WRITE_EXTERNAL_STORAGE',
+ ]);
+ });
+});
diff --git a/tests/storeAssets.test.ts b/tests/storeAssets.test.ts
new file mode 100644
index 0000000..67c2f50
--- /dev/null
+++ b/tests/storeAssets.test.ts
@@ -0,0 +1,47 @@
+import { readFileSync } from 'fs';
+import { join } from 'path';
+
+// Store upload rules checked against the PNG header (IHDR):
+// - App Store Connect rejects an app icon with an alpha channel.
+// - Google Play's feature graphic must be 1024x500, JPEG or 24-bit PNG, no alpha.
+const ROOT = join(__dirname, '..');
+
+const PNG_SIGNATURE = '89504e470d0a1a0a';
+// IHDR color types: 0 gray, 2 RGB, 3 palette, 4 gray+alpha, 6 RGB+alpha.
+const ALPHA_COLOR_TYPES = [4, 6];
+
+function pngInfo(rel: string) {
+ const buf = readFileSync(join(ROOT, rel));
+ expect(buf.subarray(0, 8).toString('hex')).toBe(PNG_SIGNATURE);
+ expect(buf.subarray(12, 16).toString('ascii')).toBe('IHDR');
+ return {
+ width: buf.readUInt32BE(16),
+ height: buf.readUInt32BE(20),
+ colorType: buf[25],
+ // A palette or gray PNG can still carry transparency in a tRNS chunk.
+ hasTrns: buf.includes(Buffer.from('tRNS', 'ascii')),
+ };
+}
+
+const appJson = JSON.parse(readFileSync(join(ROOT, 'app.json'), 'utf8')).expo;
+
+describe('store assets', () => {
+ it.each([appJson.icon, appJson.ios.icon])('iOS app icon %s is 1024x1024 with no alpha', (rel: string) => {
+ const info = pngInfo(rel);
+ expect([info.width, info.height]).toEqual([1024, 1024]);
+ expect(ALPHA_COLOR_TYPES).not.toContain(info.colorType);
+ expect(info.hasTrns).toBe(false);
+ });
+
+ it('Play feature graphic is a 1024x500 24-bit PNG with no alpha', () => {
+ const info = pngInfo('assets/play-feature-graphic-1024x500.png');
+ expect([info.width, info.height]).toEqual([1024, 500]);
+ expect(info.colorType).toBe(2);
+ expect(info.hasTrns).toBe(false);
+ });
+
+ it('Play listing icon is 512x512', () => {
+ const info = pngInfo('assets/play-store-512.png');
+ expect([info.width, info.height]).toEqual([512, 512]);
+ });
+});