Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop into master

See merge request sdk_group/store-android-sdk!235
  • Loading branch information
olga-salina committed Aug 22, 2024
2 parents 909b88f + 28cd7db commit aa9e39e
Show file tree
Hide file tree
Showing 16 changed files with 516 additions and 46 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
# Changelog
## [2.5.10] - Store SDK - 2024-08-21
### Changed
- `createOrderFromCartById`, `createOrderFromCurrentCart`, and `createOrderByItemSku` SDK methods. Added an optional parameter `externalTransactionToken`.

## [1.4.1] - Payments SDK - 2024-08-21
### Changed
- `XPayments.IntentBuilder` class. Added new callbacks:
- `payStationClosedCallback` — handles the closure of the payment UI. It includes the `isManually` parameter, which specifies whether the UI was closed manually or automatically.
- `statusReceivedCallback` — handles changes in payment status. It receives the `InvoicesDataResponse` object, which contains an array of invoices. If any invoice has a status of `DONE`, it implies a successful purchase.

### Added
- `getStatus` SDK method. Returns invoice data for a specified order.

### Fixed
- Fixed a crash that occurs when `activityType` is set to Custom Tabs, but they are not supported by the user’s device.
- Redirects for Web Views are now case-insensitive.

## [2.2.13] - Demo Apps - 2024-08-21
### Fixed
- Fixed an issue where the catalog was empty after closing the bundle preview.

## [2.5.9] - Store SDK - 2024-07-25
### Changed
- `PaymentOptions` data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.net.Uri
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.widget.Button
Expand Down Expand Up @@ -50,10 +51,14 @@ import com.xsolla.android.storesdkexample.ui.vm.VmGooglePlay
import com.xsolla.android.storesdkexample.ui.vm.VmProfile
import com.xsolla.android.storesdkexample.ui.vm.base.ViewModelFactory
import com.xsolla.android.appcore.utils.MiscUtils
import com.xsolla.android.payments.callbacks.PayStationClosedCallback
import com.xsolla.android.payments.callbacks.StatusReceivedCallback
import com.xsolla.android.payments.entity.response.InvoicesDataResponse

class StoreActivity : AppCompatActivity(R.layout.activity_store) {

companion object {
private const val TAG: String = "StoreActivity"
private const val RC_PAYSTATION = 1
}

Expand Down Expand Up @@ -102,6 +107,16 @@ class StoreActivity : AppCompatActivity(R.layout.activity_store) {
.accessToken(AccessToken(token))
.isSandbox(BuildConfig.IS_SANDBOX)
.setActivityType(MiscUtils.deduceXPaymentsActivityType(this))
.setPayStationClosedCallback(object : PayStationClosedCallback {
override fun onSuccess(isManually: Boolean) {
Log.d(TAG, "PayStationClosedCallback is fired. isManually = $isManually")
}
})
.setStatusReceivedCallback(object : StatusReceivedCallback {
override fun onSuccess(data: InvoicesDataResponse) {
Log.d(TAG, "StatusReceivedCallback is fired. Result data = $data")
}
})
.build()
startActivityForResult(intent, RC_PAYSTATION)
}
Expand Down Expand Up @@ -152,18 +167,6 @@ class StoreActivity : AppCompatActivity(R.layout.activity_store) {
findViewById<Toolbar>(R.id.mainToolbar).title = ""
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == RC_PAYSTATION) {
val (status, _) = XPayments.Result.fromResultIntent(data)
when (status) {
XPayments.Status.COMPLETED -> showSnack(getString(R.string.payment_completed))
XPayments.Status.CANCELLED -> showSnack(getString(R.string.payment_cancelled))
XPayments.Status.UNKNOWN -> showSnack(getString(R.string.payment_unknown))
}
}
}

private fun initVirtualBalance() {
val balanceContainer: LinearLayout = findViewById(R.id.balanceContainer)
vmBalance.virtualBalance.observe(this) { virtualBalanceList ->
Expand All @@ -189,6 +192,14 @@ class StoreActivity : AppCompatActivity(R.layout.activity_store) {
val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout)
val navView: NavigationView = findViewById(R.id.nav_view)
val navController = findNavController(R.id.nav_host_fragment)
navController.addOnDestinationChangedListener { _, destination, _ ->
binding.root.closeDrawers()
if (destination.id == R.id.nav_vi) {
Handler(Looper.getMainLooper()).postDelayed({
callActivateUI()
}, 100)
}
}
appBarConfiguration = AppBarConfiguration(
setOf(
R.id.nav_vi,
Expand All @@ -213,38 +224,27 @@ class StoreActivity : AppCompatActivity(R.layout.activity_store) {

findViewById<View>(R.id.itemAccount).setOnClickListener {
navController.navigate(R.id.nav_profile)
binding.root.closeDrawers()
}
findViewById<View>(R.id.itemInventory).setOnClickListener {
navController.navigate(R.id.nav_inventory)
binding.root.closeDrawers()
}
findViewById<View>(R.id.itemAttributes).setOnClickListener {
navController.navigate(R.id.nav_attributes)
binding.root.closeDrawers()
}
findViewById<View>(R.id.itemFriends).setOnClickListener {
navController.navigate(R.id.nav_friends)
binding.root.closeDrawers()
}
findViewById<View>(R.id.itemVirtualItems).setOnClickListener {
navController.navigate(R.id.nav_vi)
binding.root.closeDrawers()
Handler(Looper.getMainLooper()).postDelayed({
callActivateUI()
}, 100)
}
findViewById<View>(R.id.itemVirtualCurrency).setOnClickListener {
navController.navigate(R.id.nav_vc)
binding.root.closeDrawers()
}
findViewById<View>(R.id.itemCoupon).setOnClickListener {
navController.navigate(R.id.nav_redeem_coupon)
binding.root.closeDrawers()
}
findViewById<View>(R.id.itemWebStore).setOnClickListener {
openWebStore()
binding.root.closeDrawers()
}
findViewById<View>(R.id.itemWebStore).isVisible =
!StoreUtils.isAppInstalledFromGooglePlay(this)
Expand Down
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

buildscript {

ext.payments_sdk_version_name = '1.4.0'
ext.store_sdk_version_name = '2.5.9'
ext.payments_sdk_version_name = '1.4.1'
ext.store_sdk_version_name = '2.5.10'
ext.inventory_sdk_version_name = '2.0.4'
ext.login_sdk_version_name = '6.0.9'

ext.googleplay_sdk_version_name = "0.0.1"

ext.sample_app_version_name = '2.2.12'
ext.sample_app_version_code = 41
ext.sample_app_version_name = '2.2.13'
ext.sample_app_version_code = 42

ext.sdk_min = 21
ext.sdk_target = 33
Expand All @@ -19,6 +19,7 @@ buildscript {
ext.kotlin_version = '1.7.0'
ext.retrofit_version = '2.9.0'
ext.ktor_version = '2.1.0'
ext.okhttp_version = "4.10.0"

ext.junit_version = '4.13.2'
ext.robolectric_version = '4.11.1'
Expand Down
4 changes: 4 additions & 0 deletions xsolla-payments-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ dependencies {

// Needed for `TrustedWebActivity`.
implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.5.0'

implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1'
}

dokkaHtmlPartial {
Expand Down
Loading

0 comments on commit aa9e39e

Please sign in to comment.