سلام وقت بخیر من تمام کتابخونهها و اینا رو درست کردم ولی توی این کلاس به مشکل خوردم
package com.sevenlearn.nikestore.feature.checkout
import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.observe
import com.sevenlearn.nikestore.R
import com.sevenlearn.nikestore.common.EXTRA_KEY_ID
import com.sevenlearn.nikestore.common.formatPrice
import com.sevenlearn.nikestore.databinding.ActivityCheckOutBinding // Import your generated binding class
import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.parameter.parametersOf
class CheckOutActivity : AppCompatActivity() {
private lateinit var binding: ActivityCheckOutBinding // Declare your binding variable
val viewModel: CheckoutViewModel by viewModel <CheckoutViewModel> {
val uri: Uri? = intent.data
if (uri != null)
parametersOf(uri.getQueryParameter("order_id")!!.toInt())
else
parametersOf(intent.extras!!.getInt(EXTRA_KEY_ID))
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityCheckOutBinding.inflate(layoutInflater) // Inflate the binding
setContentView(binding.root) // Set the content view using the binding root
viewModel.checkoutLiveData.observe(this) {
binding.orderPriceTv.text = formatPrice(it.payable_price) // Use binding instead of synthetic
binding.orderStatusTv.text = it.payment_status
binding.purchaseStatusTv.text =
if (it.purchase_success) "خرید با موفقیت انجام شد" else "خرید ناموفق"
}
}
}
error:
Overload resolution ambiguity. All these functions match.
public inline fun <reified T : ViewModel> ComponentActivity.viewModel(qualifier: Qualifier? = ..., noinline extrasProducer: (() → CreationExtras)? = ..., noinline parameters: (() → ParametersHolder)? = ...): Lazy<TypeVariable(T)> defined in org.koin.androidx.viewmodel.ext.android
public inline fun <reified T : ViewModel> ComponentActivity.viewModel(qualifier: Qualifier? = ..., noinline state: BundleDefinition? /* = (() → Bundle)? */ = ..., noinline owner: ViewModelOwnerDefinition /* = () → ViewModelOwner */ = ..., noinline parameters: ParametersDefinition? /* = (() → DefinitionParameters)? */ = ...): Lazy<TypeVariable(T)> defined in org.koin.androidx.viewmodel.ext.android
public inline fun <reified T : ViewModel> ViewModelStoreOwner.viewModel(qualifier: Qualifier? = ..., noinline state: BundleDefinition? /* = (() → Bundle)? */ = ..., mode: LazyThreadSafetyMode = ..., noinline parameters: ParametersDefinition? /* = (() → DefinitionParameters)? */ = ...): Lazy<TypeVariable(T)> defined in org.koin.androidx.viewmodel.ext.android