about summary refs log tree commit diff
path: root/plugins/shareExtension/withExtensionViewController.js
diff options
context:
space:
mode:
authorMinseo Lee <itoupluk427@gmail.com>2024-02-28 13:03:55 +0900
committerGitHub <noreply@github.com>2024-02-28 13:03:55 +0900
commit3767e763906088d410da9ca99532c093368ca196 (patch)
tree533df6df19320459b69c54c7b26fac5b59279e5e /plugins/shareExtension/withExtensionViewController.js
parent41e69651f97cc95d42ff4ae247706604faca51ae (diff)
parentc4d30a0b7fb3e73b208a01d0f62130535d549392 (diff)
downloadvoidsky-3767e763906088d410da9ca99532c093368ca196.tar.zst
Merge branch 'bluesky-social:main' into patch-3
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}