pdf-quiz-generator/mobile/node_modules/native-run/dist/android/utils/apk.js
Daniel dc240c31d2 Add Capacitor mobile app wrapper for PedsHub Quiz
- Configurable server URL (default: pedshub.com)
- Android + iOS platforms initialized
- Dark theme matching quiz app (#0f172a)
- Status bar and navigation bar color matched
- Auto-redirect on subsequent launches
- App ID: com.pedshub.quiz, App Name: PedsHub

Build: cd mobile && npx cap sync && npx cap open android

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 05:12:25 +02:00

36 lines
1.5 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getApkInfo = exports.readAndroidManifest = void 0;
const unzip_1 = require("../../utils/unzip");
const binary_xml_parser_1 = require("./binary-xml-parser");
async function readAndroidManifest(apkPath) {
let error;
const chunks = [];
await (0, unzip_1.unzip)(apkPath, async (entry, zipfile, openReadStream) => {
if (entry.fileName === 'AndroidManifest.xml') {
const readStream = await openReadStream(entry);
readStream.on('error', (err) => (error = err));
readStream.on('data', (chunk) => chunks.push(chunk));
readStream.on('end', () => zipfile.close());
}
else {
zipfile.readEntry();
}
});
if (error) {
throw error;
}
const buf = Buffer.concat(chunks);
const manifestBuffer = Buffer.from(buf);
return new binary_xml_parser_1.BinaryXmlParser(manifestBuffer).parse();
}
exports.readAndroidManifest = readAndroidManifest;
async function getApkInfo(apkPath) {
const doc = await readAndroidManifest(apkPath);
const appId = doc.attributes.find((a) => a.name === 'package').value;
const application = doc.childNodes.find((n) => n.nodeName === 'application');
const activity = application.childNodes.find((n) => n.nodeName === 'activity');
const activityName = activity.attributes.find((a) => a.name === 'name').value;
return { appId, activityName };
}
exports.getApkInfo = getApkInfo;