andrew-levy / react-native-safari-extension Goto Github PK
View Code? Open in Web Editor NEWExpo Config Plugin to add a Safari Extension to a React Native iOS App
Home Page: https://react-native-safari-extension.vercel.app
Expo Config Plugin to add a Safari Extension to a React Native iOS App
Home Page: https://react-native-safari-extension.vercel.app
could be nice to link to apple's website describing safari extensions
Basically, we want to see if the resources folder can live outside of the ios dir and then have xcode reference them from that other location. This would mean we wouldn't have to copy files over to the ios dir directly i think?
Hi, I'm getting error: index.js: Cannot find module 'react-native-reanimated/plugin'
when running the extension app. I have the plugin on my babel.config.js and everything works fine on the main Expo application.
If I remove the plugin from the config I get a new error about another npm dependency (base-64
required by react-native-polyfill-globals
), it looks like it's failing to find some node_modules?
Do you have any idea?
I'm able to build the project locally via expo run:ios, but whenever I run eas build, it fails on the fast lane step with
`CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
error: Build input file cannot be found: '/Users/andrewlevy/exampleApp/ios/exampleAppExtension/SafariWebExtensionHandler.swift' (in target 'exampleAppExtension' from project 'exampleApp')`
I'm running into this error when building a Expo Dev Client locally:
โ error: The file "/var/folders/px/xg99v_l53hbc4yy9_58c23q00000gn/T/eas-build-local-nodejs/7a5ecf27-d085-4f25-8c3c-427341cfcdb1/build/ios/DEVExtension/DEVExtension.entitlements" could not be opened. Verify the value of the CODE_SIGN_ENTITLEMENTS build setting for target "DEVExtension" is correct and that the file exists on disk. (in target 'DEVExtension' from project 'DEV')
I tried commenting out the CODE_SIGN_ENTITLEMENTS in addXCConfigurationList
:
// CODE_SIGN_ENTITLEMENTS: `${extensionFolder}/${extensionFolder}.entitlements`,
but then I get Signing for "DEVExtension" requires a development team
- which I guess makes sense.
Any ideas on how to proceed? How do I generate the entitlements? Does it require an AppStore build maybe?
Please add a section in your documentation to explain how we can debug Safari javascript extension.
Hi! I'm getting this error trying to make a local build:
error: Provisioning profile "*[expo] dev.mozzius.graysky.OpenInGrayskyExtension AppStore 2023-12-07T16:48:33.829Z" doesn't support the Push Notifications capability. (in target 'OpenInGrayskyExtension' from project 'Graysky')
error: Provisioning profile "*[expo] dev.mozzius.graysky.OpenInGrayskyExtension AppStore 2023-12-07T16:48:33.829Z" doesn't include the aps-environment entitlement. (in target 'OpenInGrayskyExtension' from project 'Graysky')
I do want to use expo-notifications in my main app, but it seems this breaks the safari extension. Looking at the code, it seems the config plugin does try to delete the aps-environment entitlement - not sure if that's just not working, or if something else is going on.
Hello. I'm unable to update to Expo 50 due to a problem with the React Native Podfile post-install hook.
[!] An error occurred while processing the post-install hook of the Podfile.
[!] The plist file at path `/Users/samuel.newman/Documents/Other/graysky/apps/expo/ios/Info.plist` doesn't exist.
/opt/homebrew/Cellar/cocoapods/1.14.3/libexec/gems/xcodeproj-1.23.0/lib/xcodeproj/plist.rb:17:in `read_from_path'
/Users/samuel.newman/Documents/Other/graysky/node_modules/react-native/scripts/cocoapods/utils.rb:557:in `block in update_ats_in_plist'
/Users/samuel.newman/Documents/Other/graysky/node_modules/react-native/scripts/cocoapods/utils.rb:554:in `each'
/Users/samuel.newman/Documents/Other/graysky/node_modules/react-native/scripts/cocoapods/utils.rb:554:in `update_ats_in_plist'
/Users/samuel.newman/Documents/Other/graysky/node_modules/react-native/scripts/cocoapods/utils.rb:579:in `apply_ats_config'
/Users/samuel.newman/Documents/Other/graysky/node_modules/react-native/scripts/react_native_pods.rb:310:in `react_native_post_install'
/Users/samuel.newman/Documents/Other/graysky/apps/expo/ios/Podfile:57:in `block (3 levels) in from_ruby'
Seems it tries to find all Info.plist
files using this code:
def self.get_plist_paths_from(user_project)
info_plists = user_project
.files
.select { |p|
p.name&.end_with?('Info.plist')
}
return info_plists
end
However, printing all the paths for these files shows this:
Expo.plist
Graysky/AppDelegate.h
Graysky/AppDelegate.mm
Graysky/Images.xcassets
Graysky/Info.plist
Graysky/main.m
Graysky/SplashScreen.storyboard
Graysky/noop-file.swift
Graysky/Graysky-Bridging-Header.h
Graysky.app
System/Library/Frameworks/JavaScriptCore.framework
libPods-Graysky.a
Target Support Files/Pods-Graysky/Pods-Graysky.debug.xcconfig
Target Support Files/Pods-Graysky/Pods-Graysky.release.xcconfig
Pods/Target Support Files/Pods-Graysky/ExpoModulesProvider.swift
src
assets
manifest.json
Info.plist
SafariWebExtensionHandler.swift
OpenInGrayskyExtension.appex
Since these extension files don't have the correct paths (specifically the Info.plist
file), when it tries to open /ios/Info.plist
it breaks.
If you open up the project or workspace in xcode after prebuilding, there is a Recovered References folder being added that shouldn't be. This is due to an issue in the pbxproj setup.
Are we able to see the status of the browser extension via a call?
Are there any plans to add support for sending messages from extension to the native app? as described in the docs here: https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_between_the_app_and_javascript_in_a_safari_web_extension
Great job on the config plugin! Running into an issue when attempting to build via expo. After I run
yarn eas build --profile preview --platform ios
I get the following error
๐ iOS build failed:
Starting from Xcode 14, resource bundles are signed by default, which requires setting the development team for each resource bundle target.
To resolve this issue, downgrade to an older Xcode version using the "image" field in eas.json, or upgrade to SDK 46 or higher.
Learn more: https://docs.expo.dev/build-reference/infrastructure/#ios-build-server-configurations
I have gone ahead and done what the resolution suggests but still can not seem to get this to work. Is this something that you guys have run into, if so any suggestions?
How to access the currently loaded web page from the extension?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.