Files
TREK/client/scripts/generate-adaptive-icons.mjs
T
Maurice 8963180006 feat(native): everything the App Store and Google Play submissions need
- iOS: microphone usage text for "Take Video", no-export-compliance flag,
  ExportOptions.plist for App Store Connect uploads, the unused push
  forwarders gone; CI builds with Xcode 26 and lints the property lists.
- Android: version and signing from Gradle properties (unsigned without
  them), R8 with keep rules for TREK's and Capacitor's reflective classes,
  no Auto Backup of the session cookie, no external file provider path,
  template and Firebase leftovers removed, keystores and service accounts
  ignored, full-size adaptive icon layers with a monochrome layer; CI also
  builds the release APK.
- native-release.yml: signed bundle to a Play testing track and archive to
  TestFlight, by hand or on a v* tag, behind the store environment.
- Version handshake: the server reports nativeApi 1, the app refuses a
  server below its minimum and tolerates an app older than the offline copy.
- Address screen: privacy policy link, "Try the demo" and "What is a TREK
  server?"; the privacy link also in the app's server settings. Three new
  native strings in all 27 locales.
- Donation links and the notices asking for one are hidden in the app.
- Store listings for "TREK Travel Planner" in client/fastlane: texts, review
  notes with placeholders, privacy and account deletion page drafts, the
  feature graphic and icon, a length and image check in CI, and a Playwright
  store project with the scripts that turn its captures into screenshots.
- Docs: wiki/Native-Apps.md, README no longer says there is no store app.
2026-10-25 18:37:31 +01:00

34 lines
1.4 KiB
JavaScript

/**
* Writes the Android adaptive icon layers at their full size, after
* `npx @capacitor/assets generate` (see the icons:app script).
*
* The assets tool renders the foreground and background layers at the legacy
* launcher size (192 px at xxxhdpi), while an adaptive icon layer is 108 dp
* (432 px at xxxhdpi), so launchers that draw the icon large showed it soft.
* The layers come from the same sources in assets/, and
* mipmap-anydpi-v26/ic_launcher*.xml keeps placing them as before; it also uses
* the foreground as the monochrome layer for themed icons, since the mark is
* white on transparent.
*/
import { dirname, join } from 'path';
import sharp from 'sharp';
import { fileURLToPath } from 'url';
const clientDir = join(dirname(fileURLToPath(import.meta.url)), '..');
const resDir = join(clientDir, 'android', 'app', 'src', 'main', 'res');
/** 108 dp in pixels for each density bucket. */
const DENSITIES = { ldpi: 81, mdpi: 108, hdpi: 162, xhdpi: 216, xxhdpi: 324, xxxhdpi: 432 };
const LAYERS = { ic_launcher_foreground: 'icon-foreground.png', ic_launcher_background: 'icon-background.png' };
for (const [density, size] of Object.entries(DENSITIES)) {
for (const [name, source] of Object.entries(LAYERS)) {
const out = join(resDir, `mipmap-${density}`, `${name}.png`);
await sharp(join(clientDir, 'assets', source))
.resize(size, size)
.png({ compressionLevel: 9 })
.toFile(out);
console.log(`wrote ${out}`);
}
}