Skip to content
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/hosted platform views #67

Merged
merged 50 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
a3685af
Added proof for android card platform view
Robert-SD Oct 11, 2023
9b623ba
Added platform card view for ios
Robert-SD Oct 12, 2023
e915c52
Added dynamic platform view height rendering
Robert-SD Oct 18, 2023
7c076c7
Added bottom sheet example and made ios card component transparent
Robert-SD Oct 19, 2023
0fa9b2d
Started with dynamic height for android
Robert-SD Oct 23, 2023
7e7001b
Added dynamic component height for android
Robert-SD Oct 24, 2023
0d35ba1
Cleaned redundant code
Robert-SD Oct 24, 2023
347a7c8
Added separate pigeon pipe for components and added card configuratio…
Robert-SD Oct 25, 2023
9397d23
Started with component wrapper view
Robert-SD Oct 25, 2023
925edb4
Improved component integration
Robert-SD Oct 27, 2023
d5b6015
Improvements for nullsafety
Robert-SD Oct 30, 2023
d50296a
Added proguard rules to support obfuscation
Robert-SD Oct 16, 2023
9f7f741
Updated to gradle 8.1.2 and dropin 5.0.0
Robert-SD Oct 20, 2023
9ded7ec
Moved proguard rules to default config
Robert-SD Oct 24, 2023
3f63efa
Added proof for android card platform view
Robert-SD Oct 11, 2023
964f819
Started with dynamic height for android
Robert-SD Oct 23, 2023
2bc3e3d
Merge branch 'feature/renameDropInOutcome' into feature/hostedPlatfor…
Robert-SD Oct 30, 2023
8839ecd
Added 3DS support for card component on Android
Robert-SD Oct 30, 2023
425ea7f
Prepared card component to support session
Robert-SD Oct 31, 2023
cd17cb5
Aligned initial height adjustment
Robert-SD Oct 31, 2023
e7e49ad
Added session launch and action handling
Robert-SD Oct 31, 2023
45e2ed9
Split into packages for session and advanced flow
Robert-SD Oct 31, 2023
1ecae68
Cleaned code by extracting methods and create more readability
Robert-SD Nov 2, 2023
28e36dd
Started with advanced flow card component integration
Robert-SD Nov 3, 2023
b426015
Improved advanced flow redirection handling for iOS
Robert-SD Nov 6, 2023
71e0eeb
Restructured swift card component code
Robert-SD Nov 7, 2023
c8afa17
Applied code format
Robert-SD Nov 7, 2023
af2bd02
Improved configuration mapping for card component
Robert-SD Nov 7, 2023
124e868
Added component session implementation for iOS
Robert-SD Nov 8, 2023
4d2c375
Added base factory
Robert-SD Nov 9, 2023
fef8051
Aligned card component through base class
Robert-SD Nov 9, 2023
a4bdbdc
Cleaned code and added error handling on native side
Robert-SD Nov 9, 2023
f594a16
Improved code readability
Robert-SD Nov 9, 2023
e8f8b9d
Prevented scrolling of ios native component and added more initial he…
Robert-SD Nov 10, 2023
234417a
Improved gesture detection
Robert-SD Nov 14, 2023
713c841
Improved native view rendering within flutter tree
Robert-SD Nov 16, 2023
0f08d2a
Simplified common code within base card component
Robert-SD Nov 16, 2023
7774c78
Used card component state to trigger height adjustment
Robert-SD Nov 16, 2023
4e4d97b
Fixed bcmc handling on ios and started with android
Robert-SD Nov 21, 2023
7fd21fe
Added bcmc redirect handling for android and improved example code base
Robert-SD Nov 24, 2023
51a0506
Removed material spinner for iOS and deleted redundant code
Robert-SD Nov 27, 2023
f14aa25
Improved code readability
Robert-SD Nov 27, 2023
cb276de
Changed ComponentFlutterAPI to ComponentFlutterInterface in pigeon to…
Robert-SD Nov 27, 2023
ca9d11d
Applied dart lint recommendations
Robert-SD Nov 27, 2023
185a99a
Removed dead code
Robert-SD Nov 27, 2023
f11d5d1
Used let for handling nullability
Robert-SD Nov 27, 2023
83f1158
Added missing clearance of Component platform interface
Robert-SD Nov 27, 2023
287d338
Added weak references to prevent memory leaks
Robert-SD Nov 27, 2023
863360c
Applied changes from code review
Robert-SD Dec 1, 2023
58af2e9
Applied changes from code review
Robert-SD Dec 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ android {
}

dependencies {
implementation 'com.adyen.checkout:drop-in:5.0.0'
implementation 'com.adyen.checkout:drop-in:5.0.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'org.mockito:mockito-core:5.6.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package com.adyen.adyen_checkout

import CheckoutFlutterApi
import CheckoutPlatformInterface
import ComponentFlutterInterface
import ComponentPlatformInterface
import PaymentResultDTO
import PaymentResultEnum
import PaymentResultModelDTO
Expand All @@ -10,6 +12,9 @@ import PlatformCommunicationType
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import com.adyen.adyen_checkout.components.ComponentPlatformApi
import com.adyen.adyen_checkout.components.card.advancedFlow.CardAdvancedFlowComponentFactory
import com.adyen.adyen_checkout.components.card.session.CardSessionFlowComponentFactory
import com.adyen.adyen_checkout.utils.ConfigurationMapper.mapToOrderResponseModel
import com.adyen.adyen_checkout.utils.Constants.Companion.WRONG_FLUTTER_ACTIVITY_USAGE_ERROR_MESSAGE
import com.adyen.checkout.dropin.DropIn
Expand All @@ -18,6 +23,7 @@ import com.adyen.checkout.dropin.DropInResult
import com.adyen.checkout.dropin.SessionDropInCallback
import com.adyen.checkout.dropin.SessionDropInResult
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterPluginBinding
import io.flutter.embedding.engine.plugins.activity.ActivityAware
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
import io.flutter.embedding.engine.plugins.lifecycle.HiddenLifecycleReference
Expand All @@ -26,18 +32,27 @@ import io.flutter.embedding.engine.plugins.lifecycle.HiddenLifecycleReference
class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware {
private var checkoutPlatformApi: CheckoutPlatformApi? = null
private var checkoutFlutterApi: CheckoutFlutterApi? = null
private var componentPlatformApi: ComponentPlatformApi? = null
private var componentFlutterApi: ComponentFlutterInterface? = null
private var lifecycleReference: HiddenLifecycleReference? = null
private var lifecycleObserver: LifecycleEventObserver? = null
private var flutterPluginBinding: FlutterPluginBinding? = null

override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
override fun onAttachedToEngine(flutterPluginBinding: FlutterPluginBinding) {
this.flutterPluginBinding = flutterPluginBinding
checkoutFlutterApi = CheckoutFlutterApi(flutterPluginBinding.binaryMessenger)
checkoutPlatformApi = CheckoutPlatformApi(checkoutFlutterApi)
componentFlutterApi = ComponentFlutterInterface(flutterPluginBinding.binaryMessenger)
componentPlatformApi = ComponentPlatformApi()
CheckoutPlatformInterface.setUp(flutterPluginBinding.binaryMessenger, checkoutPlatformApi)
ComponentPlatformInterface.setUp(flutterPluginBinding.binaryMessenger, componentPlatformApi)
}

override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
override fun onDetachedFromEngine(binding: FlutterPluginBinding) {
CheckoutPlatformInterface.setUp(binding.binaryMessenger, null)
ComponentPlatformInterface.setUp(binding.binaryMessenger, null)
checkoutFlutterApi = null
componentFlutterApi = null
}

override fun onAttachedToActivity(binding: ActivityPluginBinding) = setupActivity(binding)
Expand All @@ -62,6 +77,16 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware {
lifecycleObserver?.let {
lifecycleReference?.lifecycle?.addObserver(it)
}

componentFlutterApi?.let {
flutterPluginBinding?.platformViewRegistry?.registerViewFactory(
"cardComponentAdvancedFlow", CardAdvancedFlowComponentFactory(fragmentActivity, it)
)

flutterPluginBinding?.platformViewRegistry?.registerViewFactory(
"cardComponentSessionFlow", CardSessionFlowComponentFactory(fragmentActivity, it)
)
}
}

private fun lifecycleEventObserver(fragmentActivity: FragmentActivity): LifecycleEventObserver {
Expand Down Expand Up @@ -101,6 +126,7 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware {
PaymentResultModelDTO(
sessionId,
sessionData,
sessionResult,
resultCode,
order?.mapToOrderResponseModel()
)
Expand Down
Loading