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

Update Compose and set sheetGesturesEnabled to false #7142

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ allprojects {
}

ext {
buildToolsVersion = "30.0.3"
compileSdkVersion = 33
buildToolsVersion = "34.0.0"
compileSdkVersion = 34

group_name = GROUP
version_name = VERSION_NAME
Expand Down
7 changes: 3 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
ext.versions = [
accompanist : '0.30.1',
alipay : '15.8.12',
androidGradlePlugin : '8.0.2',
androidGradlePlugin : '8.1.0',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can/should do this independently. (8.1.1 is the latest stable)

androidTest : '1.5.0',
androidTestJunit : '1.1.5',
androidTestOrchestrator : '1.4.2',
androidTestRunner : '1.5.2',
androidxActivity : '1.7.2',
androidxActivity : '1.8.0-alpha06',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the latest. But do we need this? Can we do without it?

androidxAnnotation : '1.6.0',
androidxAppcompat : '1.6.1',
androidxArchCore : '2.2.0',
androidxBrowser : '1.5.0',
androidxCompose : '1.4.3',
androidxCompose : '1.5.0',
androidxComposeCompiler : '1.4.1',
androidxComposeRuntime : '1.4.3',
androidxComposeUi : '1.4.3',
Expand All @@ -25,7 +25,6 @@ ext.versions = [
androidxRecyclerview : '1.2.1',
androidxSecurity : '1.1.0-alpha05',
binaryCompatibilityValidator: '0.13.1',
buildTools : "30.0.3",
cameraX : '1.2.3',
dagger : '2.48',
detekt : "1.22.0",
Expand Down
6 changes: 1 addition & 5 deletions payments-core/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@

<style name="StripePaymentSheetDefaultTheme" parent="StripePaymentSheetBaseTheme" />

<style name="StripeGooglePayDefaultTheme" parent="StripePaymentSheetBaseTheme">
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
<style name="StripeGooglePayDefaultTheme" parent="StripePaymentSheetBaseTheme" />

<style name="StripePayLauncherDefaultTheme" parent="@style/Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
Expand All @@ -50,7 +48,5 @@
<item name="android:windowAnimationStyle">@null</item>
<item name="colorSurface">@color/stripe_paymentsheet_background</item>
<item name="actionMenuTextColor">@color/stripe_paymentsheet_toolbar_items_color</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.stripe.android.googlepaylauncher
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.bundleOf
Expand Down Expand Up @@ -41,6 +42,7 @@ internal class GooglePayLauncherActivity : AppCompatActivity() {

@SuppressLint("SourceLockedOrientationActivity")
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)

setFadeAnimations()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.stripe.android.googlepaylauncher

import android.content.Intent
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.bundleOf
Expand Down Expand Up @@ -36,6 +37,7 @@ internal class GooglePayPaymentMethodLauncherActivity : AppCompatActivity() {
private lateinit var args: GooglePayPaymentMethodLauncherContractV2.Args

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)

setFadeAnimations()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.app.Activity
import android.content.Intent
import android.os.Bundle
import androidx.activity.addCallback
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.annotation.VisibleForTesting
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -32,6 +33,7 @@ internal class PaymentLauncherConfirmationActivity : AppCompatActivity() {

@SuppressLint("SourceLockedOrientationActivity")
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)

setFadeAnimations()
Expand Down
5 changes: 1 addition & 4 deletions paymentsheet/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
<item name="actionMenuTextColor">@color/stripe_paymentsheet_toolbar_items_color</item>
</style>

<style name="StripePaymentSheetDefaultTheme" parent="StripePaymentSheetBaseTheme">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="StripePaymentSheetDefaultTheme" parent="StripePaymentSheetBaseTheme" />

<style name="StripePaymentSheetAddPaymentMethodTheme">
<item name="colorOnSurface">@color/stripe_paymentsheet_form</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ internal fun BottomSheet(
topStart = MaterialTheme.stripeShapes.cornerRadius.dp,
topEnd = MaterialTheme.stripeShapes.cornerRadius.dp,
),
sheetGesturesEnabled = false,
sheetContent = {
Box(modifier = Modifier.testTag(BottomSheetContentTestTag)) {
sheetContent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import android.content.Intent
import android.os.Bundle
import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.annotation.VisibleForTesting
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.core.view.WindowCompat
import androidx.lifecycle.ViewModelProvider
import com.stripe.android.common.ui.BottomSheet
import com.stripe.android.common.ui.rememberBottomSheetState
Expand Down Expand Up @@ -39,10 +39,9 @@ internal class CustomerSheetActivity : AppCompatActivity() {

@OptIn(ExperimentalMaterialApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)

WindowCompat.setDecorFitsSystemWindows(window, false)

viewModel.registerFromActivity(
activityResultCaller = this,
lifecycleOwner = this,
Expand Down Expand Up @@ -83,10 +82,7 @@ internal class CustomerSheetActivity : AppCompatActivity() {
private fun finishWithResult(result: InternalCustomerSheetResult) {
setResult(RESULT_OK, Intent().putExtras(result.toBundle()))
finish()
}

override fun finish() {
super.finish()
@Suppress("DEPRECATION")
overridePendingTransition(AnimationConstants.FADE_IN, AnimationConstants.FADE_OUT)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.annotation.VisibleForTesting
import androidx.compose.animation.ExperimentalAnimationApi
Expand All @@ -13,7 +14,6 @@ import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.Surface
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.core.view.WindowCompat
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.NavHostController
import androidx.navigation.NavType
Expand Down Expand Up @@ -47,9 +47,9 @@ internal class AddressElementActivity : ComponentActivity() {

@OptIn(ExperimentalAnimationApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)

WindowCompat.setDecorFitsSystemWindows(window, false)
starterArgs.config?.appearance?.parseAppearance()

setContent {
Expand Down Expand Up @@ -129,6 +129,7 @@ internal class AddressElementActivity : ComponentActivity() {

override fun finish() {
super.finish()
@Suppress("DEPRECATION")
overridePendingTransition(AnimationConstants.FADE_IN, AnimationConstants.FADE_OUT)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import android.content.Intent
import android.os.Bundle
import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.core.view.WindowCompat
import androidx.lifecycle.ViewModelProvider
import com.stripe.android.common.ui.BottomSheet
import com.stripe.android.common.ui.rememberBottomSheetState
Expand Down Expand Up @@ -40,10 +40,9 @@ internal class PollingActivity : AppCompatActivity() {

@OptIn(ExperimentalMaterialApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)

WindowCompat.setDecorFitsSystemWindows(window, false)

setContent {
StripeTheme {
val state = rememberBottomSheetState(confirmValueChange = { false })
Expand Down Expand Up @@ -81,6 +80,7 @@ internal class PollingActivity : AppCompatActivity() {
Intent().putExtras(result.toBundle())
)
finish()
@Suppress("DEPRECATION")
overridePendingTransition(0, AnimationConstants.FADE_OUT)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import android.content.pm.ActivityInfo
import android.os.Build
import android.os.Bundle
import androidx.activity.addCallback
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.WindowCompat
import com.stripe.android.paymentsheet.LinkHandler
import com.stripe.android.paymentsheet.viewmodels.BaseSheetViewModel
import com.stripe.android.utils.AnimationConstants
Expand All @@ -21,6 +21,7 @@ internal abstract class BaseSheetActivity<ResultType> : AppCompatActivity() {
abstract fun setActivityResult(result: ResultType)

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)

if (earlyExitDueToIllegalState) {
Expand All @@ -33,23 +34,14 @@ internal abstract class BaseSheetActivity<ResultType> : AppCompatActivity() {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}

renderEdgeToEdge()

onBackPressedDispatcher.addCallback {
viewModel.handleBackPressed()
}
}

override fun finish() {
super.finish()
@Suppress("DEPRECATION")
overridePendingTransition(AnimationConstants.FADE_IN, AnimationConstants.FADE_OUT)
}

private fun renderEdgeToEdge() {
if (Build.VERSION.SDK_INT < 30) {
return
}

WindowCompat.setDecorFitsSystemWindows(window, false)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.stripe.android.paymentsheet.ui

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -86,7 +87,7 @@ internal fun PaymentElement(
}
}

if (showLinkInlineSignup) {
AnimatedVisibility(visible = showLinkInlineSignup) {
LinkInlineSignup(
linkConfigurationCoordinator = linkConfigurationCoordinator,
enabled = enabled,
Expand Down
1 change: 1 addition & 0 deletions stripe-ui-core/src/test/resources/robolectric.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sdk=33