Skip to content

Commit 8214d9c

Browse files
committed
jump to play store if google pay is not installed
1 parent 96b7592 commit 8214d9c

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [0.39.1]
5+
6+
### Added
7+
- Jump to play store if google pay is not installed
8+
49
## [0.39.0]
510

611
### Added

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ allprojects {
3131
}
3232

3333
project.ext {
34-
sdkVersion='0.39.0'
34+
sdkVersion='0.39.1'
3535
versionCode=1
3636

3737
compileSdkVersion=30

ui/src/main/java/io/snabble/sdk/ui/cart/CheckoutBar.kt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package io.snabble.sdk.ui.cart
22

33
import android.app.ProgressDialog
4+
import android.content.ActivityNotFoundException
45
import android.content.Context
56
import android.content.DialogInterface
7+
import android.content.Intent
8+
import android.content.pm.PackageManager
9+
import android.net.Uri
610
import android.os.Bundle
711
import android.util.AttributeSet
812
import android.view.KeyEvent
@@ -82,7 +86,20 @@ class CheckoutBar @JvmOverloads constructor(
8286
}
8387

8488
googlePayButton.setOneShotClickListener {
85-
payButtonClick()
89+
val packageName = "com.google.android.apps.walletnfcrel"
90+
val pm = context.packageManager
91+
try {
92+
pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES)
93+
payButtonClick()
94+
} catch (e: PackageManager.NameNotFoundException) {
95+
try {
96+
context.startActivity(Intent(Intent.ACTION_VIEW,
97+
Uri.parse("market://details?id=$packageName")))
98+
} catch (e: ActivityNotFoundException) {
99+
context.startActivity(Intent(Intent.ACTION_VIEW,
100+
Uri.parse("https://play.google.com/store/apps/details?id=$packageName")))
101+
}
102+
}
86103
}
87104

88105
cart.addListener(cartChangeListener)

0 commit comments

Comments
 (0)