Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(mobile): raise pod deployment targets to the app's iOS floor (#2307)

Chad Pihad61e52137a41
diff --git a/openwhispr-mobile/app.base.json b/openwhispr-mobile/app.base.json
index 088f662d4..2366d7e09 100644
--- a/openwhispr-mobile/app.base.json
+++ b/openwhispr-mobile/app.base.json
@@ -73,6 +73,7 @@
],
"expo-apple-authentication",
"./plugins/ios-cxx-standard/withIosCxxStandard",
+ "./plugins/pod-deployment-target/withPodDeploymentTarget",
"./plugins/storekit/withStoreKitConfiguration",
"./plugins/keyboard-extension/withKeyboardExtension",
"./plugins/activity-extension/withActivityExtension",
diff --git a/openwhispr-mobile/plugins/pod-deployment-target/__tests__/withPodDeploymentTarget.test.ts b/openwhispr-mobile/plugins/pod-deployment-target/__tests__/withPodDeploymentTarget.test.ts
new file mode 100644
index 000000000..b273756ad
--- /dev/null
+++ b/openwhispr-mobile/plugins/pod-deployment-target/__tests__/withPodDeploymentTarget.test.ts
@@ -0,0 +1,57 @@
+const { addPodDeploymentTargetFloor } = require('../withPodDeploymentTarget');
+
+const EXPO_TEMPLATE_PODFILE = `platform :ios, podfile_properties['ios.deploymentTarget'] || '15.1'
+
+target 'OpenWhispr' do
+ use_expo_modules!
+ config = use_native_modules!(config_command)
+
+ post_install do |installer|
+ react_native_post_install(
+ installer,
+ config[:reactNativePath],
+ :mac_catalyst_enabled => false,
+ :ccache_enabled => ccache_enabled?(podfile_properties),
+ )
+ end
+end
+`;
+
+function postInstallBlock(podfile: string): string {
+ const start = podfile.indexOf('post_install do |installer|');
+ return podfile.slice(start, podfile.indexOf('\n end\n', start));
+}
+
+describe('withPodDeploymentTarget', () => {
+ it('adds the deployment-target floor inside the existing post_install block', () => {
+ const podfile = addPodDeploymentTargetFloor(EXPO_TEMPLATE_PODFILE);
+ const block = postInstallBlock(podfile);
+
+ expect(podfile.match(/post_install do/g)).toHaveLength(1);
+ expect(block).toContain(
+ 'app_deployment_target = installer.aggregate_targets.map { |target| target.platform.deployment_target }.min',
+ );
+ expect(block).toContain('installer.pods_project.targets.each do |target|');
+ expect(block).toContain(
+ "build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = app_deployment_target.to_s",
+ );
+ expect(block).toContain('react_native_post_install(');
+ });
+
+ it('is idempotent across prebuilds', () => {
+ const once = addPodDeploymentTargetFloor(EXPO_TEMPLATE_PODFILE);
+
+ expect(addPodDeploymentTargetFloor(once)).toBe(once);
+ });
+
+ it('fails loudly when the generated Podfile has no post_install block', () => {
+ const podfileWithoutPostInstall = EXPO_TEMPLATE_PODFILE.replace(
+ 'post_install do |installer|',
+ 'pre_install do |installer|',
+ );
+
+ expect(() => addPodDeploymentTargetFloor(podfileWithoutPostInstall)).toThrow(
+ 'withPodDeploymentTarget: post_install block not found in the generated Podfile',
+ );
+ });
+});
diff --git a/openwhispr-mobile/plugins/pod-deployment-target/withPodDeploymentTarget.js b/openwhispr-mobile/plugins/pod-deployment-target/withPodDeploymentTarget.js
new file mode 100644
index 000000000..7dc1403df
--- /dev/null
+++ b/openwhispr-mobile/plugins/pod-deployment-target/withPodDeploymentTarget.js
@@ -0,0 +1,40 @@
+const { withPodfile } = require('expo/config-plugins');
+
+// Pod resource-bundle targets (SDWebImage, Sentry, RevenueCat, ...) keep the
+// deployment target from their podspec, as low as 9.0. React Native's
+// post_install raises only the pods' code targets (to 15.1), so Xcode 27, which
+// supports 15.0+, rejects the bundles during build planning. Raise every Pods
+// target below the app's own deployment target, which CocoaPods resolves from
+// the Podfile's `platform :ios` line (expo-build-properties' ios.deploymentTarget).
+const POST_INSTALL_ANCHOR = 'post_install do |installer|';
+const DEPLOYMENT_TARGET_SNIPPET = `
+ app_deployment_target = installer.aggregate_targets.map { |target| target.platform.deployment_target }.min
+ installer.pods_project.targets.each do |target|
+ target.build_configurations.each do |build_configuration|
+ pod_deployment_target = build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
+ if pod_deployment_target && Pod::Version.new(pod_deployment_target) < app_deployment_target
+ build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = app_deployment_target.to_s
+ end
+ end
+ end
+`;
+
+function addPodDeploymentTargetFloor(contents) {
+ if (contents.includes(DEPLOYMENT_TARGET_SNIPPET)) return contents;
+ if (!contents.includes(POST_INSTALL_ANCHOR)) {
+ throw new Error(
+ 'withPodDeploymentTarget: post_install block not found in the generated Podfile',
+ );
+ }
+ return contents.replace(POST_INSTALL_ANCHOR, POST_INSTALL_ANCHOR + DEPLOYMENT_TARGET_SNIPPET);
+}
+
+function withPodDeploymentTarget(config) {
+ return withPodfile(config, (cfg) => {
+ cfg.modResults.contents = addPodDeploymentTargetFloor(cfg.modResults.contents);
+ return cfg;
+ });
+}
+
+module.exports = withPodDeploymentTarget;
+module.exports.addPodDeploymentTargetFloor = addPodDeploymentTargetFloor;