Skip to content

Commit

Permalink
3.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
adyen-git-manager committed Sep 13, 2019
1 parent 88f29b7 commit 77aecb1
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 232 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
[//]: <> (Add changes that not released yet into `Unreleased` section)
[//]: <> (Comment `Unreleased` section if there are no changes)
[//]: <> (## [Unreleased])
## [3.3.1] - 2019-09-13
### Fixed
- There was issue with ConstraintLayout's Flow related to [ClassNotFoundException androidx.constraintlayout.widget.helper.Flow](https://github.com/Adyen/adyen-android/issues/109) fixed
- Created method to save the state of an ActionComponent when the Activity gets destroyed to persist the `paymentData`.
## [3.3.0] - 2019-09-11
### Added
- Created SepaComponent
Expand Down
25 changes: 2 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ The Components are available through [jcenter][dl], you only need to add the Gra
Import the Component module for the Payment Method you want to use by adding it to your `build.gradle` file.
For example, for the Drop-in solution you should add:
```groovy
implementation "com.adyen.checkout:drop-in:3.3.0"
implementation "com.adyen.checkout:drop-in:3.3.1"
```
For a Credit Card component you should add:
```groovy
implementation "com.adyen.checkout:card-ui:3.3.0"
```
For and iDeal component you should add:
```groovy
implementation "com.adyen.checkout:ideal-ui:3.3.0"
implementation "com.adyen.checkout:card-ui:3.3.1"
```

## Drop-in
Expand Down Expand Up @@ -115,23 +111,6 @@ cardComponent.observe(this@MainActivity, Observer {
})
```

### Available Components

You can find a list of currently available components in the `PaymentMethodTypes.SUPPORTED_PAYMENT_METHODS` with the corresponding payment method type.

- Credit Card
- iDeal
- Dotpay
- MOLPay
- EPS
- Entercash
- Open banking

You can also find the components that can handle the `action` object.

- Redirect
- 3DS2 (Fingerprint and Challenge)

## ProGuard

If you use ProGuard or R8, the following rules should be enough to maintain all expected functionality.
Expand Down
21 changes: 0 additions & 21 deletions README_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ For a Credit Card component you should add:
```groovy
implementation "com.adyen.checkout:card-ui:<latest-version>"
```
For and iDeal component you should add:
```groovy
implementation "com.adyen.checkout:ideal-ui:<latest-version>"
```

## Drop-in

Expand Down Expand Up @@ -115,23 +111,6 @@ cardComponent.observe(this@MainActivity, Observer {
})
```

### Available Components

You can find a list of currently available components in the `PaymentMethodTypes.SUPPORTED_PAYMENT_METHODS` with the corresponding payment method type.

- Credit Card
- iDeal
- Dotpay
- MOLPay
- EPS
- Entercash
- Open banking

You can also find the components that can handle the `action` object.

- Redirect
- 3DS2 (Fingerprint and Challenge)

## ProGuard

If you use ProGuard or R8, the following rules should be enough to maintain all expected functionality.
Expand Down
1 change: 0 additions & 1 deletion RELEASE_NOTES
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<ul>
<li>Added SEPA payment method</li>
<li>Bug Fixes</li>
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@
import android.arch.lifecycle.LifecycleOwner;
import android.arch.lifecycle.MutableLiveData;
import android.arch.lifecycle.Observer;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.adyen.checkout.base.ActionComponent;
import com.adyen.checkout.base.ActionComponentData;
import com.adyen.checkout.base.ComponentError;
import com.adyen.checkout.base.model.payments.response.Action;
import com.adyen.checkout.core.exeption.CheckoutException;
import com.adyen.checkout.core.exeption.ComponentException;
import com.adyen.checkout.core.log.LogUtil;
import com.adyen.checkout.core.log.Logger;
import com.adyen.checkout.core.util.StringUtil;

import org.json.JSONObject;

import java.util.List;

public abstract class BaseActionComponent extends AndroidViewModel implements ActionComponent {
private static final String TAG = LogUtil.getTag();

private static final String PAYMENT_DATA_KEY = "payment_data";

private final MutableLiveData<ActionComponentData> mResultLiveData = new MutableLiveData<>();

Expand Down Expand Up @@ -72,6 +80,31 @@ public void observeErrors(@NonNull LifecycleOwner lifecycleOwner, @NonNull Obser
mErrorMutableLiveData.observe(lifecycleOwner, observer);
}

/**
* Call this method to save the current data of the Component to the Bundle from {@link Activity#onSaveInstanceState(Bundle)}.
*
* @param bundle The bundle to save the sate into.
*/
public void saveState(@Nullable Bundle bundle) {
if (bundle != null && StringUtil.hasContent(mPaymentData)) {
if (bundle.containsKey(PAYMENT_DATA_KEY)) {
Logger.d(TAG, "bundle already has paymentData, overriding");
}
bundle.putString(PAYMENT_DATA_KEY, mPaymentData);
}
}

/**
* Call this method to restore the current data of the Component from the savedInstanceState Bundle from {@link Activity#onCreate(Bundle)}}.
*
* @param bundle The bundle to restore the sate from.
*/
public void restoreState(@Nullable Bundle bundle) {
if (bundle != null && bundle.containsKey(PAYMENT_DATA_KEY) && !StringUtil.hasContent(mPaymentData)) {
mPaymentData = bundle.getString(PAYMENT_DATA_KEY);
}
}

protected abstract void handleActionInternal(@NonNull Activity activity, @NonNull Action action) throws ComponentException;

protected void notifyDetails(@NonNull JSONObject details) throws ComponentException {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ allprojects {
// just for example app, don't need to increment
ext.version_code = 1
// The version_name format is "major.minor.patch(-(alpha|beta|rc)[0-9]{2}){0,1}" (e.g. 3.0.0, 3.1.1-alpha04 or 3.1.4-rc01 etc).
ext.version_name = "3.3.0"
ext.version_name = "3.3.1"

// Code quality
ext.version_ktlint = '0.34.2'
Expand Down
1 change: 0 additions & 1 deletion drop-in/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ dependencies {

// Dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$version_kotlin"
implementation "com.android.support.constraint:constraint-layout:$version_constraint_layout"
implementation "com.android.support:recyclerview-v7:$version_support_library"
implementation "com.android.support:design:$version_support_library"
}
Expand Down
11 changes: 11 additions & 0 deletions drop-in/src/main/java/com/adyen/checkout/dropin/ActionHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package com.adyen.checkout.dropin

import android.arch.lifecycle.Observer
import android.net.Uri
import android.os.Bundle
import android.support.v4.app.FragmentActivity
import com.adyen.checkout.adyen3ds2.Adyen3DS2Component
import com.adyen.checkout.base.ActionComponentData
Expand Down Expand Up @@ -47,6 +48,16 @@ class ActionHandler(activity: FragmentActivity, private val callback: DetailsReq
}
}

fun saveState(bundle: Bundle?) {
redirectComponent.saveState(bundle)
adyen3DS2Component.saveState(bundle)
}

fun restoreState(bundle: Bundle?) {
redirectComponent.restoreState(bundle)
adyen3DS2Component.restoreState(bundle)
}

fun handleAction(activity: FragmentActivity, action: Action, sendResult: (String) -> Unit) {
when {
redirectComponent.canHandleAction(action) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class LoadingActivity : AppCompatActivity(), ActionHandler.DetailsRequestedInter
}

actionHandler = ActionHandler(this, this)
actionHandler.restoreState(savedInstanceState)

if (savedInstanceState == null) {
handleIntent(intent)
Expand All @@ -134,6 +135,11 @@ class LoadingActivity : AppCompatActivity(), ActionHandler.DetailsRequestedInter
}
}

override fun onSaveInstanceState(outState: Bundle?) {
actionHandler.saveState(outState)
super.onSaveInstanceState(outState)
}

override fun onPause() {
super.onPause()
Logger.d(TAG, "onPause")
Expand Down

This file was deleted.

Loading

0 comments on commit 77aecb1

Please sign in to comment.