about summary refs log tree commit diff
path: root/plugins/shareExtension/withExtensionViewController.js
diff options
context:
space:
mode:
authorJan-Olof Eriksson <jan-olof.eriksson@iki.fi>2024-02-29 11:55:03 +0200
committerGitHub <noreply@github.com>2024-02-29 11:55:03 +0200
commit963a44ab872a1044d6997a8fcf7b2fc754ac618a (patch)
treebbd64f464a8f14e55cbb06e28811cdc43f059d29 /plugins/shareExtension/withExtensionViewController.js
parent1f9562847512bb41cd8bb381b735a388be4db59b (diff)
parenta35976cdc9b6467ad8b6e0c4ff46ba684fee9064 (diff)
downloadvoidsky-963a44ab872a1044d6997a8fcf7b2fc754ac618a.tar.zst
Merge branch 'bluesky-social:main' into main
Diffstat (limited to 'plugins/shareExtension/withExtensionViewController.js')
-rw-r--r--plugins/shareExtension/withExtensionViewController.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/shareExtension/withExtensionViewController.js b/plugins/shareExtension/withExtensionViewController.js
new file mode 100644
index 000000000..cd29bea7d
--- /dev/null
+++ b/plugins/shareExtension/withExtensionViewController.js
@@ -0,0 +1,31 @@
+const {withXcodeProject} = require('@expo/config-plugins')
+const path = require('path')
+const fs = require('fs')
+
+const withExtensionViewController = (
+  config,
+  {controllerName, extensionName},
+) => {
+  // eslint-disable-next-line no-shadow
+  return withXcodeProject(config, config => {
+    const controllerPath = path.join(
+      config.modRequest.projectRoot,
+      'modules',
+      extensionName,
+      `${controllerName}.swift`,
+    )
+
+    const targetPath = path.join(
+      config.modRequest.platformProjectRoot,
+      extensionName,
+      `${controllerName}.swift`,
+    )
+
+    fs.mkdirSync(path.dirname(targetPath), {recursive: true})
+    fs.copyFileSync(controllerPath, targetPath)
+
+    return config
+  })
+}
+
+module.exports = {withExtensionViewController}