Skip to content

Commit

Permalink
Convert Pay Pal Native Fragment to Compose UI (#192)
Browse files Browse the repository at this point in the history
* Stub out PayPal Native Compose UI view.

* Remove CreateOrderFragment from nav graph.

* Add PayPalNativeUiState.

* Update PayPalNative fragment to use create order form.

* Update PayPal Native Checkout fragment to be more compose friendly.

* Add order creation form with shipping preference.

* Replace all fragment related UI logic with view model and compose UI bindings.

* Show alert dialog when an unkown error occurs.

* Remove alert dialog.

* Remove CreateOrderFragment.

* Cleanup Android lint errors.

* Move PayPalNativeFragment into .paypal package.

* Fix rebase errors.

* Fix detekt errors.

* Remove classes that are no longer needed.

* Move Feature enum into FeaturesFragment.

* Remove unused imports.

* Update copy paste typo.

* Add toast for error messaging when coroutine exception is thrown.
  • Loading branch information
sshropshire authored Sep 26, 2023
1 parent 2a686a5 commit 9857d30
Show file tree
Hide file tree
Showing 23 changed files with 526 additions and 831 deletions.
9 changes: 0 additions & 9 deletions Demo/src/main/java/com/paypal/android/api/model/Amount.kt

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions Demo/src/main/java/com/paypal/android/api/model/Payee.kt

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions Demo/src/main/java/com/paypal/android/ui/features/Feature.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.paypal.android.ui.features
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.annotation.StringRes
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
Expand Down Expand Up @@ -45,6 +46,14 @@ class FeaturesFragment : Fragment() {
val chevronTint = Color(138, 137, 142)
}

enum class Feature(@StringRes val stringRes: Int) {
CARD_APPROVE_ORDER(R.string.feature_approve_order),
CARD_VAULT(R.string.feature_vault),
PAYPAL_WEB(R.string.feature_paypal_web),
PAYPAL_BUTTONS(R.string.feature_paypal_buttons),
PAYPAL_NATIVE(R.string.feature_paypal_native)
}

private val cardFeatures = listOf(
Feature.CARD_APPROVE_ORDER,
Feature.CARD_VAULT
Expand Down Expand Up @@ -86,16 +95,19 @@ class FeaturesFragment : Fragment() {
Feature.PAYPAL_BUTTONS -> {
FeaturesFragmentDirections.actionPaymentMethodsFragmentToPayPalButtonsFragment()
}

Feature.PAYPAL_WEB -> {
FeaturesFragmentDirections.actionPaymentMethodsFragmentToPayPalWebFragment()
}

Feature.PAYPAL_NATIVE -> {
FeaturesFragmentDirections.actionPaymentMethodsFragmentToCreateOrderFragment(feature)
FeaturesFragmentDirections.actionPaymentMethodsFragmentToPayPalNativeFragment()
}

Feature.CARD_APPROVE_ORDER -> {
FeaturesFragmentDirections.actionPaymentMethodsFragmentToCardFragment()
}

Feature.CARD_VAULT -> {
FeaturesFragmentDirections.actionPaymentMethodsFragmentToVaultFragment()
}
Expand Down
Loading

0 comments on commit 9857d30

Please sign in to comment.