Skip to content

Commit

Permalink
Use public rememberCustomerSheet
Browse files Browse the repository at this point in the history
  • Loading branch information
samer-stripe committed Apr 29, 2024
1 parent 6e5ce07 commit 78dc8c4
Showing 1 changed file with 2 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.stripe.android.customersheet.CustomerAdapter
import com.stripe.android.customersheet.CustomerSheet
import com.stripe.android.customersheet.CustomerSheetResultCallback
import com.stripe.android.customersheet.ExperimentalCustomerSheetApi
import com.stripe.android.customersheet.rememberCustomerSheet
import com.stripe.android.paymentsheet.example.playground.activity.AppearanceBottomSheetDialogFragment
import com.stripe.android.paymentsheet.example.playground.activity.AppearanceStore
import com.stripe.android.paymentsheet.example.playground.activity.QrCodeActivity
Expand Down Expand Up @@ -167,7 +165,7 @@ internal class CustomerSheetPlaygroundActivity : AppCompatActivity() {

val customerSheet = rememberCustomerSheet(
configuration = playgroundState.customerSheetConfiguration(),
adapter = playgroundState.adapter,
customerAdapter = playgroundState.adapter,
callback = callback,
)

Expand All @@ -185,23 +183,6 @@ internal class CustomerSheetPlaygroundActivity : AppCompatActivity() {
onClick = customerSheet::present
)
}

@OptIn(ExperimentalCustomerSheetApi::class)
@Composable
private fun rememberCustomerSheet(
configuration: CustomerSheet.Configuration,
adapter: CustomerAdapter,
callback: CustomerSheetResultCallback,
): CustomerSheet {
return remember(configuration, adapter, callback) {
CustomerSheet.create(
activity = this,
configuration = configuration,
customerAdapter = adapter,
callback = callback,
)
}
}
}

@Composable
Expand Down

0 comments on commit 78dc8c4

Please sign in to comment.