-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Create Expo managed workflow plugin #288
Conversation
Great thanks @anthlasserre 💚 We will verify this from our side. |
Any updates there @descorp ? |
Hey @anthlasserre I had attempted to run the Expo locally and verify this branch, but my attempt wasn't successful 😅 We are working on the 1.2.0 release; hopefully after that, we are going to address this PR. |
@descorp Hey mate, no worries feel free to reach me if you need some help on your Expo project. |
I'd also be happy to help out in order to get this released 💯 |
just did something similar for use with the drop in components. Tested on ios + android, just popping here to see if it helps in anyway!
|
Any updates on this? |
Just tested this by patching the changes. |
Hey @gunnartorfis 👋🏼 Here is the plugin updated with that. const {
withAndroidManifest,
withMainActivity,
withAppDelegate,
} = require('@expo/config-plugins');
const withAdyenAndroid = config => {
const configWithMainActivity = withMainActivity(config, async config => {
const mainActivity = config.modResults;
mainActivity.contents = mainActivity.contents.replace(
'public class MainActivity extends ReactActivity {',
'import com.adyenreactnativesdk.AdyenCheckout;\n\npublic class MainActivity extends ReactActivity {'
);
mainActivity.contents = mainActivity.contents.replace(
'super.onCreate(null);\n }',
'super.onCreate(null);\n AdyenCheckout.setLauncherActivity(this);\n }'
);
return config;
});
const configWithManifest = withAndroidManifest(
configWithMainActivity,
async config => {
const mainActivity = config.modResults;
// Add com.adyenreactnativesdk.component.dropin.AdyenCheckoutService service
// after com.facebook.react.HeadlessJsTaskService
mainActivity.manifest.application = [
// @ts-expect-error - manifest is not well typed
{
...mainActivity.manifest.application?.[0],
service: [
{
$: {
'android:name':
'com.adyenreactnativesdk.component.dropin.AdyenCheckoutService',
'android:exported': 'false',
},
},
],
},
];
return config;
}
);
return configWithManifest;
};
const withAdyenIos = (config, iosFramework) => {
const importLine = iosFramework === 'static' ? "#import <adyen_react_native/ADYRedirectComponent.h>" : "#import <adyen-react-native/ADYRedirectComponent.h>"
const appDelegate = withAppDelegate(config, async config => {
const appDelegate = config.modResults;
appDelegate.contents = appDelegate.contents.replace(
'#import "AppDelegate.h"\n\n',
`#import "AppDelegate.h"\n\n${importLine}\n`
);
appDelegate.contents = appDelegate.contents.replace(
/\/\/ Linking API.*\n.*\n.*\n}/g,
`// Linking API
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
// Adyen SDK
return [ADYRedirectComponent applicationDidOpenURL:url];
}`
);
return config;
});
return appDelegate;
};
module.exports = function (config, iosFramework = 'dynamic') {
return withAdyenIos(withAdyenAndroid(config), iosFramework);
}; You just need to call the plugin in your app.json in that way after (with {
"plugins": [
["./plugins/adyen-react-native", "dynamic"],
]
} I'll need to update the PR here. But we're waiting for help from the Ably team... |
@anthlasserre Nice, that was fast! 👏 We're just in the initial stages of integrating Adyen in our Expo app - would be lovely to get this merged so we don't have to use a patch on production. |
No worries mate. Adyen is a good choice and we'll be all happy to help their team to bring the Expo support. You don't necessarily need to create a patch I'd say. Just create a {
"plugins": [
["./plugins/adyen-react-native", "dynamic"],
]
} |
@descorp PR updated 🔄 |
Hi all, Thanks a lot for the PR and the feedback! We are keeping track of your comments, but right now our full focus is on the v2 release. After the beta release, we will dive into this PR. Our goal is to release Expo support as a new feature for Adyen React Native v2 by the end of Q1 '24. Stay tuned! |
@camil-adyen Thanks for the update. |
Not yet, since we are still finalising API. Will keep you posted. |
@anthlasserre the plugin wouldn't work with Expo SDK 50 (because of RN 0.73's Kotlin update).
|
Hey @anthlasserre We have completed initial work on supporting Expo for Beta v2 #397 Thank you for your PR! It was very helpful and inspiring for us 💚 |
Summary
Today
@adyen/react-native
is not supported by Expo.This pull request aims to create an Expo configuration plugin for the library, enabling the community to incorporate it into Expo-managed workflow.
Tested scenarios
expo prebuild --clean
in theexample-expo
app./example-expo/ios/ExampleExpo/AppDelegate.mm
./example-expo/android/app/src/main/java/com/onebasketdemo/expo/MainActivity.java
./example-expo/android/app/src/main/AndroidManifest.xml
Fixed issue: #108