File tree Expand file tree Collapse file tree
poolakey/src/main/java/ir/cafebazaar/poolakey Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ package ir.cafebazaar.poolakey
22
33import android.app.Activity
44import android.content.Context
5+ import android.os.Build
6+ import android.os.Build.VERSION.SDK_INT
7+ import android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
58import androidx.activity.result.ActivityResult
69import androidx.activity.result.ActivityResultRegistry
710import ir.cafebazaar.poolakey.billing.connection.BillingConnectionCommunicator
@@ -82,6 +85,15 @@ internal class BillingConnection(
8285 onActivityResult(it, purchaseCallback)
8386 }.build()
8487
88+ purchaseRequest.cutoutModeIsShortEdges = if (SDK_INT >= Build .VERSION_CODES .P ) {
89+ (context as ? Activity )
90+ ?.window
91+ ?.attributes
92+ ?.layoutInDisplayCutoutMode == LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
93+ } else {
94+ false
95+ }
96+
8597 runOnCommunicator(TAG_PURCHASE ) { billingCommunicator ->
8698 billingCommunicator.purchase(
8799 requireNotNull(paymentLauncher),
Original file line number Diff line number Diff line change @@ -14,4 +14,5 @@ internal object BazaarIntent {
1414 const val RESPONSE_CHECK_TRIAL_SUBSCRIPTION_DATA = " CHECK_TRIAL_SUBSCRIPTION_DATA"
1515 const val REQUEST_SKU_DETAILS_LIST = " ITEM_ID_LIST"
1616 const val RESPONSE_DYNAMIC_PRICE_TOKEN = " DYNAMIC_PRICE_TOKEN"
17+ const val RESPONSE_CUTOUT_MODE_IS_SHORT_EDGES = " CUTOUT_MODE_IS_SHORT_EDGES"
1718}
Original file line number Diff line number Diff line change @@ -7,10 +7,14 @@ data class PurchaseRequest(
77 val productId : String ,
88 val payload : String? = null ,
99 val dynamicPriceToken : String? = null
10- )
10+ ) {
11+
12+ internal var cutoutModeIsShortEdges = false
13+ }
1114
1215internal fun PurchaseRequest.purchaseExtraData (): Bundle {
1316 return Bundle ().apply {
1417 putString(BazaarIntent .RESPONSE_DYNAMIC_PRICE_TOKEN , dynamicPriceToken)
18+ putBoolean(BazaarIntent .RESPONSE_CUTOUT_MODE_IS_SHORT_EDGES , cutoutModeIsShortEdges)
1519 }
1620}
You can’t perform that action at this time.
0 commit comments