Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
skyler-stripe committed May 16, 2022
2 parents f12f0f5 + 69e28cc commit 544d9ee
Show file tree
Hide file tree
Showing 424 changed files with 9,698 additions and 2,775 deletions.
50 changes: 46 additions & 4 deletions .github/workflows/instrumentation_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
script: |
adb logcat -c
adb logcat &
./gradlew connectedAndroidTest
./gradlew connectedAndroidTest -x :paymentsheet-example:connectedAndroidTest
env:
STRIPE_EXAMPLE_BACKEND_URL: ${{ secrets.STRIPE_EXAMPLE_BACKEND_URL }}
STRIPE_EXAMPLE_PUBLISHABLE_KEY: ${{ secrets.STRIPE_EXAMPLE_PUBLISHABLE_KEY }}
Expand All @@ -33,19 +33,18 @@ jobs:
if: failure()
with:
name: instrumentation-test-report
path: example/build/reports/androidTests/connected/index.html
path: example/build/reports/androidTests/connected/index.html | paymentsheet-example/build/reports/androidTests/connected/index.html

- name: Notify failure endpoint
id: notifyFailureEndpoint
if: failure()
run: ./scripts/notify_failure_enpiont.rb ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT }} ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT_HMAC_KEY }} ${{ github.run_id }}


# This should be updated to use the browserstack github actions when supported
browserstack-instrumentation-tests:
name: Browserstack Instrumentation tests
runs-on: ubuntu-latest
timeout-minutes: 35
timeout-minutes: 55
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
Expand Down Expand Up @@ -78,3 +77,46 @@ jobs:
id: notifyFailureEndpoint
if: failure()
run: ./scripts/notify_failure_enpiont.rb ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT }} ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT_HMAC_KEY }} ${{ github.run_id }}

screenshot-regression-tests:
runs-on: macos-latest
steps:
- name: checkout
uses: actions/checkout@v3

- name: Gradle cache
uses: gradle/gradle-build-action@v2

- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 28
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
disable-animations: true
sdcard-path-or-size: 512M
profile: Nexus 6
script: ./gradlew executeScreenshotTests -Pandroid.testInstrumentationRunnerArguments.package=com.stripe.android.screenshot
- uses: actions/upload-artifact@v2
with:
name: screenshot-test-report
path: /Users/runner/work/stripe-android/stripe-android/paymentsheet-example/build/reports/shot/debug/verification/
- name: Notify failure endpoint
id: notifyFailureEndpoint
if: failure()
run: ./scripts/notify_failure_enpiont.rb ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT }} ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT_HMAC_KEY }} ${{ github.run_id }}
11 changes: 10 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
name: paymentsheet-example size diff
on: [pull_request]
on:
pull_request:
paths:
- 'payments/**'
- 'payments-core/**'
- 'payments-model/**'
- 'stripe-core/**'
- 'payments-model/**'
- 'link/**'
- 'dependencies.gradle'
jobs:
# Checkout master branch and build the APK
build-master:
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# CHANGELOG
## XX.X.X - 2022-05.XX
This release adds `us_bank_account` PaymentMethod to PaymentSheet.

### PaymentSheet
* [FIXED][5011](https://github.com/stripe/stripe-android/pull/5011) fix flying payment sheet by downgrading material from 1.6 to 1.5
* [ADDED][4964](https://github.com/stripe/stripe-android/pull/4964) `us_bank_account` PaymentMethod is now available in PaymentSheet

## 20.2.2 - 2022-05-09
This release contains bug fixes in PaymentSheet.

### PaymentSheet
* [FIXED][4966](https://github.com/stripe/stripe-android/pull/4966) Replaced alpha androidx.lifecycle dependencies with stable versions
* [FIXED][4961](https://github.com/stripe/stripe-android/pull/4961) Fix issue entering text with small forms.

## 20.2.1 - 2022-05-03
This release contains bug fixes in PaymentSheet and Payments.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Add `stripe-android` to your `build.gradle` dependencies.

```
dependencies {
implementation 'com.stripe:stripe-android:20.2.1'
implementation 'com.stripe:stripe-android:20.2.2'
}
```

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.2.1
20.2.2
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ ext {
androidxSecurityVersion = '1.1.0-alpha03'

kotlinCoroutinesVersion = '1.6.1'
kotlinSerializationVersion = '1.3.2'
kotlinSerializationVersion = '1.3.3'
flowlayoutVersion = '0.23.1'
ktlintVersion = '0.45.2'
// material 1.6 causes paymentsheet to not render correctly.
// see here: https://github.com/material-components/material-components-android/issues/2702
materialVersion = '1.5.0'
daggerVersion = '2.41'
playServicesWalletVersion = '19.1.0'
Expand Down
1 change: 1 addition & 0 deletions camera-core/api/camera-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public final class com/stripe/android/camera/framework/image/BitmapExtensionsKt
public static synthetic fun scale$default (Landroid/graphics/Bitmap;Landroid/util/Size;ZILjava/lang/Object;)Landroid/graphics/Bitmap;
public static synthetic fun scaleAndCrop$default (Landroid/graphics/Bitmap;Landroid/util/Size;ZILjava/lang/Object;)Landroid/graphics/Bitmap;
public static synthetic fun toJpeg$default (Landroid/graphics/Bitmap;IILjava/lang/Object;)[B
public static synthetic fun toWebP$default (Landroid/graphics/Bitmap;IILjava/lang/Object;)[B
}

public final class com/stripe/android/camera/framework/image/ImageKt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import com.stripe.android.camera.framework.image.NV21Image
import com.stripe.android.camera.framework.image.getRenderScript
import com.stripe.android.camera.framework.util.retrySync
import java.lang.ref.WeakReference
import java.util.ArrayList
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min
Expand Down Expand Up @@ -81,14 +80,16 @@ class Camera1Adapter(
private val previewView: ViewGroup,
private val minimumResolution: Size,
private val cameraErrorListener: CameraErrorListener,
startWithBackCamera: Boolean = true
) : CameraAdapter<CameraPreviewImage<Bitmap>>(), PreviewCallback {
override val implementationName: String = "Camera1"

private var mCamera: Camera? = null
private var cameraPreview: CameraPreview? = null
private var mRotation = 0
private var onCameraAvailableListener: WeakReference<((Camera) -> Unit)?> = WeakReference(null)
private var currentCameraId = 0
private var currentCameraId =
if (startWithBackCamera) Camera.CameraInfo.CAMERA_FACING_BACK else Camera.CameraInfo.CAMERA_FACING_FRONT

private val mainThreadHandler = Handler(activity.mainLooper)
private var cameraThread: HandlerThread? = null
Expand Down Expand Up @@ -159,7 +160,13 @@ class Camera1Adapter(
CameraPreviewImage(
image = NV21Image(imageWidth, imageHeight, bytes)
.toBitmap(getRenderScript(activity))
.rotate(mRotation.toFloat()),
.rotate(
if (currentCameraId == Camera.CameraInfo.CAMERA_FACING_BACK) {
mRotation.toFloat()
} else {
-mRotation.toFloat()
}
),
viewBounds = Rect(
previewView.left,
previewView.top,
Expand Down Expand Up @@ -404,7 +411,7 @@ class Camera1Adapter(
private fun setCameraDisplayOrientation(activity: Activity) {
val camera = mCamera ?: return
val info = Camera.CameraInfo()
Camera.getCameraInfo(Camera.CameraInfo.CAMERA_FACING_BACK, info)
Camera.getCameraInfo(currentCameraId, info)

val rotation = activity.windowManager.defaultDisplay.rotation
val degrees = rotation.rotationToDegrees()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import kotlin.math.min

@CheckResult
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
fun Bitmap.toWebP(): ByteArray =
fun Bitmap.toWebP(quality: Int = 92): ByteArray =
ByteArrayOutputStream().use {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
this.compress(Bitmap.CompressFormat.WEBP_LOSSY, 92, it)
this.compress(Bitmap.CompressFormat.WEBP_LOSSY, quality, it)
} else {
@Suppress("deprecation")
this.compress(Bitmap.CompressFormat.WEBP, 92, it)
this.compress(Bitmap.CompressFormat.WEBP, quality, it)
}
it.flush()
it.toByteArray()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package com.stripe.android.stripecardscan.framework.util
package com.stripe.android.camera.framework.util

import androidx.annotation.CheckResult
import androidx.annotation.RestrictTo
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import java.util.LinkedList

/**
* Save data frames for later retrieval.
*/
internal abstract class FrameSaver<Identifier, Frame, MetaData> {
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
abstract class FrameSaver<Identifier, Frame, MetaData> {

private val saveFrameMutex = Mutex()
private val savedFrames = mutableMapOf<Identifier, LinkedList<Frame>>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.stripe.android.stripecardscan.framework.util
package com.stripe.android.camera.framework.util

import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
Expand Down
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ext.versions = [
detekt: "1.19.0",
detekt: "1.20.0",
]

ext.buildLibs = [
Expand All @@ -11,5 +11,5 @@ ext.configs = [
]

ext.testLibs = [
turbine: "app.cash.turbine:turbine:0.7.0"
turbine: "app.cash.turbine:turbine:0.8.0"
]
Loading

0 comments on commit 544d9ee

Please sign in to comment.