Skip to content

Commit

Permalink
Pass fake result
Browse files Browse the repository at this point in the history
  • Loading branch information
AmniX committed Oct 3, 2024
1 parent 6508f8f commit 99ba6c7
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ import androidx.compose.ui.unit.sp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import cafe.adriel.voyager.core.model.rememberScreenModel
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import com.google.pay.button.ButtonTheme
import com.google.pay.button.ButtonType
import com.google.pay.button.PayButton
import com.komoju.android.sdk.KomojuSDK
import com.komoju.android.sdk.R
import com.komoju.android.sdk.navigation.paymentResultScreenModel
import com.komoju.android.sdk.ui.composables.ThemedCircularProgressIndicator
import com.komoju.android.sdk.ui.screens.RouterEffect
import com.komoju.android.sdk.ui.screens.payment.composables.PaymentMethodForm
Expand Down Expand Up @@ -70,6 +73,7 @@ internal data class KomojuPaymentScreen(private val sdkConfiguration: KomojuSDK.
override fun Content() {
val screenViewModel = rememberScreenModel { KomojuPaymentScreenModel(sdkConfiguration) }
val uiState by screenViewModel.state.collectAsStateWithLifecycle()
val resultScreenModel = LocalNavigator.currentOrThrow.paymentResultScreenModel()
LaunchedEffect(sdkConfiguration.sessionId) {
screenViewModel.init()
}
Expand All @@ -85,7 +89,10 @@ internal data class KomojuPaymentScreen(private val sdkConfiguration: KomojuSDK.
modifier = Modifier
.testTag("payButton")
.fillMaxWidth().padding(12.dp),
onClick = screenViewModel::onGooglePayButtonClicked,
onClick = {
resultScreenModel.setResult(KomojuSDK.PaymentResult(isSuccessFul = true))
screenViewModel.onGooglePayButtonClicked()
},
allowedPaymentMethods = allowedPaymentMethods,
theme = ButtonTheme.Dark,
type = ButtonType.Pay,
Expand Down

0 comments on commit 99ba6c7

Please sign in to comment.