Waseel: driver app, dispatch, POI suggestions, map fixes
This commit is contained in:
+56
-2
@@ -1,3 +1,9 @@
|
||||
// The Gradle build resolves this config in a plain node process that does not
|
||||
// read .env, unlike `expo start` / `expo prebuild`. Without this the release
|
||||
// APK was written with the placeholder origin below and could not reach the
|
||||
// API at all. @expo/env is Expo's own loader — the same one the CLI uses.
|
||||
require("@expo/env").load(__dirname);
|
||||
|
||||
// Dynamic Expo config. We use a JS config (rather than static app.json) so the
|
||||
// Android Google Maps API key can be pulled from EXPO_PUBLIC_GOOGLE_API_KEY
|
||||
// at build time without committing the key to the repo.
|
||||
@@ -11,6 +17,52 @@
|
||||
|
||||
const googleMapsApiKey = process.env.EXPO_PUBLIC_GOOGLE_API_KEY;
|
||||
|
||||
// Expo Router resolves relative API-route fetches ("/(api)/auth/login") against
|
||||
// this origin. In development it is overridden with the dev server URL, so the
|
||||
// placeholder never mattered; a release build has no such override and would
|
||||
// send every request to example.com. Point it at the same host that serves the
|
||||
// API routes.
|
||||
const serverOrigin =
|
||||
process.env.EXPO_PUBLIC_SERVER_URL || "https://example.com/";
|
||||
|
||||
// Adds the SYSTEM_ALERT_WINDOW permission to the AndroidManifest so the app
|
||||
// can request "display over other apps". The grant itself is a special
|
||||
// permission the user must toggle in system settings — it can't be requested
|
||||
// at runtime — but the manifest entry is what makes that system screen offer
|
||||
// the switch for our app.
|
||||
const { withAndroidManifest } = require("@expo/config-plugins");
|
||||
// Release builds block cleartext HTTP: only src/debug/AndroidManifest.xml opts
|
||||
// in. A LAN test build talks to the dev server over http://, so allow it for
|
||||
// every build type. Drop this plugin once the API is served over https.
|
||||
const withCleartextTraffic = (config) =>
|
||||
withAndroidManifest(config, (cfg) => {
|
||||
const application = cfg.modResults.manifest.application?.[0];
|
||||
|
||||
if (application) {
|
||||
application.$["android:usesCleartextTraffic"] = "true";
|
||||
}
|
||||
|
||||
return cfg;
|
||||
});
|
||||
|
||||
const withOverlayPermission = (config) =>
|
||||
withAndroidManifest(config, (cfg) => {
|
||||
const manifest = cfg.modResults.manifest;
|
||||
manifest["uses-permission"] = manifest["uses-permission"] || [];
|
||||
|
||||
const alreadyDeclared = manifest["uses-permission"].some(
|
||||
(entry) => entry.$ && entry.$["android:name"] === "android.permission.SYSTEM_ALERT_WINDOW",
|
||||
);
|
||||
|
||||
if (!alreadyDeclared) {
|
||||
manifest["uses-permission"].push({
|
||||
$: { "android:name": "android.permission.SYSTEM_ALERT_WINDOW" },
|
||||
});
|
||||
}
|
||||
|
||||
return cfg;
|
||||
});
|
||||
|
||||
module.exports = ({ config }) => ({
|
||||
...config,
|
||||
name: "Waseel",
|
||||
@@ -52,16 +104,18 @@ module.exports = ({ config }) => ({
|
||||
[
|
||||
"expo-router",
|
||||
{
|
||||
origin: "https://example.com/",
|
||||
origin: serverOrigin,
|
||||
},
|
||||
],
|
||||
withOverlayPermission,
|
||||
withCleartextTraffic,
|
||||
],
|
||||
experiments: {
|
||||
typedRoutes: true,
|
||||
},
|
||||
extra: {
|
||||
router: {
|
||||
origin: "https://example.com/",
|
||||
origin: serverOrigin,
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user