KI-AGENT: Siri-Kurzbefehle für FEDEO-Todos ergänzen
This commit is contained in:
@@ -3,6 +3,7 @@ const path = require('node:path');
|
||||
const { withXcodeProject } = require('@expo/config-plugins');
|
||||
|
||||
const SHARE_EXTENSION_DIRECTORY = 'InFEDEOhochladen';
|
||||
const SIRI_INTENTS_FILE = 'FEDEOSiriIntents.swift';
|
||||
|
||||
function replaceOnce(source, search, replacement, label) {
|
||||
if (!source.includes(search)) {
|
||||
@@ -13,6 +14,34 @@ function replaceOnce(source, search, replacement, label) {
|
||||
|
||||
module.exports = function withShareIntentMultifile(config) {
|
||||
return withXcodeProject(config, async (modConfig) => {
|
||||
const siriTemplatePath = path.join(__dirname, 'ios', SIRI_INTENTS_FILE);
|
||||
const siriDestinationPath = path.join(modConfig.modRequest.platformProjectRoot, 'FEDEO', SIRI_INTENTS_FILE);
|
||||
fs.copyFileSync(siriTemplatePath, siriDestinationPath);
|
||||
|
||||
const project = modConfig.modResults;
|
||||
const appTarget = project.pbxTargetByName('FEDEO');
|
||||
const appGroup = project.pbxGroupByName('FEDEO');
|
||||
const appTargetUUID = Object.entries(project.pbxNativeTargetSection()).find(
|
||||
([key, entry]) => !key.endsWith('_comment') && entry === appTarget
|
||||
)?.[0];
|
||||
const appGroupUUID = Object.entries(project.hash.project.objects.PBXGroup).find(
|
||||
([key, entry]) => !key.endsWith('_comment') && entry === appGroup
|
||||
)?.[0];
|
||||
const fileReferences = project.pbxFileReferenceSection();
|
||||
const siriFileExists = Object.values(fileReferences).some(
|
||||
(entry) => entry && typeof entry === 'object' && String(entry.path || entry.name || '').includes(SIRI_INTENTS_FILE)
|
||||
);
|
||||
if (!siriFileExists) {
|
||||
if (!appTargetUUID || !appGroupUUID) {
|
||||
throw new Error('FEDEO-App-Target für Siri App Intents wurde nicht gefunden.');
|
||||
}
|
||||
project.addSourceFile(
|
||||
`FEDEO/${SIRI_INTENTS_FILE}`,
|
||||
{ target: appTargetUUID },
|
||||
appGroupUUID
|
||||
);
|
||||
}
|
||||
|
||||
const controllerPath = path.join(
|
||||
modConfig.modRequest.platformProjectRoot,
|
||||
SHARE_EXTENSION_DIRECTORY,
|
||||
|
||||
Reference in New Issue
Block a user