rebreak-monorepo/apps/rebreak-native/plugins/with-allow-nonmodular-includes.js
chahinebrini 822053e11e feat(calls): CallKit/ConnectionService + VoIP-PushKit + EU-Ringback
Caller/Callee UX:
- lib/ringback.ts + assets/sounds/ringback_eu.mp3 (EU 425Hz Festnetz-Tone)
- stores/call.ts: stopRingback bei connected, hangup-reasons, logCallToChat fix
- locales: 'Wird angerufen…' statt 'Ruft an…'

CallKit (iOS) + ConnectionService (Android):
- lib/callkit.ts: setupCallKeep, displayIncomingCall, startOutgoingCall, reportConnected/Ended (appName 'ReBreak-Audio', includesCallsInRecents=false für DSGVO/DiGA)
- hooks/useCallKeepEvents.ts: native answer/end/mute → useCallStore-Actions
- stores/call.ts: CallKit-Aufrufe an allen lifecycle-Punkten
- app.config.ts: @config-plugins/react-native-callkeep + UIBackgroundModes voip/audio + Android-Telecom-Perms

VoIP-PushKit Backend:
- services/voip-push.ts: @parse/node-apn Provider mit .p12 (Topic org.rebreak.app.voip)
- services/push.ts sendCallRingPush: feuert beide Pfade (VoIP iOS + Expo Android/Fallback)
- prisma: push_tokens.voip_token Column + Migration 20260604
- api/users/me/push-token: optional voipToken im Body
- Env (Infisical): APNS_VOIP_P12_PATH/PASSWORD/TOPIC/PRODUCTION

Push-tap routing + cold-start handling:
- app/_layout.tsx: type:'call' Push → useCallStore.receiveIncoming + /call

Docs: ops/CALLKIT_SETUP.md (Apple-Portal-Steps für VoIP-Cert)
2026-06-04 09:27:13 +02:00

72 lines
3.1 KiB
JavaScript

/* eslint-disable @typescript-eslint/no-var-requires */
/**
* Fix für SDK-54 + prebuilt React Native + react-native-webrtc:
* "include of non-modular header inside framework module"
* (als Fehler, weil Xcode `-Werror=non-modular-include-in-framework-module`
* auf Framework-Module setzt).
*
* Ab RN 0.81 / Expo SDK 54 wird React Native als prebuilt XCFramework
* (React.framework, modular) ausgeliefert. Native Module wie react-native-webrtc
* importieren React-Core-Header non-modular (`#import "React/..."`) → das ist bei
* modularen Frameworks ein -Werror → Build bricht ab.
*
* Lösung (dokumentiert): auf den Pod-Targets non-modular Includes erlauben
* (CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES=YES) + das -Werror
* neutralisieren (-Wno-error=non-modular-include-in-framework-module).
*
* Injiziert in den bestehenden `post_install do |installer|`-Block (ein zweiter
* würde den ersten ersetzen). Idempotent via Marker. Läuft als
* withDangerousMod('ios') während `expo prebuild`, vor `pod install`.
*/
const { withDangerousMod } = require('@expo/config-plugins');
const fs = require('fs');
const path = require('path');
const MARKER = '# REBREAK_ALLOW_NONMODULAR_INCLUDES';
const FIX = `
${MARKER}
# SDK 54 prebuilt React Native: react-native-webrtc & Co. importieren
# React-Header non-modular -> -Werror bricht den Build ab. Auf allen
# Pod-Targets erlauben + -Werror entschärfen.
installer.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
cflags = config.build_settings['OTHER_CFLAGS'] || ['$(inherited)']
cflags = [cflags] unless cflags.is_a?(Array)
unless cflags.include?('-Wno-error=non-modular-include-in-framework-module')
cflags << '-Wno-error=non-modular-include-in-framework-module'
end
config.build_settings['OTHER_CFLAGS'] = cflags
end
end
Pod::UI.puts " -> Allowed non-modular includes on #{installer.pods_project.targets.count} pod targets".green
${MARKER}
`;
module.exports = function withAllowNonModularIncludes(config) {
return withDangerousMod(config, [
'ios',
async (cfg) => {
const podfilePath = path.join(cfg.modRequest.platformProjectRoot, 'Podfile');
if (!fs.existsSync(podfilePath)) {
console.warn('[with-allow-nonmodular-includes] Podfile not found at', podfilePath);
return cfg;
}
let podfile = fs.readFileSync(podfilePath, 'utf-8');
if (podfile.includes(MARKER)) {
return cfg; // schon gepatcht
}
const anchorRe = /(post_install do \|installer\|[^\n]*\n)/;
if (!anchorRe.test(podfile)) {
console.warn('[with-allow-nonmodular-includes] no `post_install do |installer|` block — skipping');
return cfg;
}
podfile = podfile.replace(anchorRe, `$1${FIX}`);
fs.writeFileSync(podfilePath, podfile);
console.log('[with-allow-nonmodular-includes] patched Podfile post_install');
return cfg;
},
]);
};