Skip to content

Commit

Permalink
[APPC-4691] WebView Payment: screen resize with keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
rodolfobcardoso committed Jan 8, 2025
1 parent a8cc620 commit 5ad8290
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
<activity
android:name="com.asfoundation.wallet.ui.webview_payment.WebViewPaymentActivity"
android:theme="@style/Theme.AppCompat.Transparent.WebPayment"
android:windowSoftInputMode="adjustPan" />
android:windowSoftInputMode="adjustResize" />

<service
android:name="com.asfoundation.wallet.transactions.PerkBonusAndGamificationService"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ class WebViewPaymentActivity : AppCompatActivity() {
val webView = remember { WebView(context) }

val isLandscape = configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
val topSpacerHeight = if (isLandscape) 36.dp else 176.dp

BackHandler(enabled = true) {
if (webView.canGoBack()) {
Expand All @@ -136,14 +135,22 @@ class WebViewPaymentActivity : AppCompatActivity() {
.fillMaxSize()
.padding(horizontal = if (isLandscape) 56.dp else 0.dp)
) {
Spacer(
modifier = Modifier
.height(topSpacerHeight)
.fillMaxWidth()
.clickable {
finish()
}
)
if (isLandscape) {
Spacer(
modifier = Modifier
.height(36.dp)
.fillMaxWidth()
.clickable { finish() }
)
} else {
Spacer(
modifier = Modifier
.fillMaxWidth()
.weight(0.2f)
.clickable { finish() }
)
}

Box(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -159,6 +166,10 @@ class WebViewPaymentActivity : AppCompatActivity() {
AndroidView(
modifier = Modifier
.fillMaxWidth()
.weight(
if (isLandscape) 1f
else 0.8f
)
.background(styleguide_light_grey),
factory = {
webView.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ class PayFlowRepository @Inject constructor(

fun getPayFlow(
packageName: String,
packageVercode: Int?,
oemid: String?,
): Single<PayFlowResponse> {
return payFlowApi.getPayFlow(
packageName = packageName,
packageVercode = packageVercode,
oemid = oemid?.takeIf { it.isNotEmpty() },
)
.subscribeOn(rxSchedulers.io)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class IsWebViewPaymentFlowUseCase @Inject constructor(
.flatMap { attributionEntity ->
payFlowRepository.getPayFlow(
packageName = transaction.domain,
packageVercode = 0,
oemid = attributionEntity.oemId,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ interface PayFlowApi {
@GET("v2/payment_flow")
fun getPayFlow(
@Query("package") packageName: String,
@Query("package_vercode") packageVercode: Int?,
@Query("oemid") oemid: String?,
): Single<PayFlowResponse>

Expand Down

0 comments on commit 5ad8290

Please sign in to comment.