I don't know why all fields in my document have the $app_debug
at the end of the name like this:
Update: Shop is created this way
private var shop = Shop()
with(binding) {
shop.name = edtName.text.toString()
shop.address = edtAddress.text.toString()
shop.phone = edtPhone.text.toString()
shop.openTime = edtOpenTime.text.toString()
shop.website = edtWebsite.text.toString()
shop.owner = edtOwner.text.toString()
shop.imageUrl = imageUrl
}
shop.pendingApprove = true
shop.created = false
shop.lastModifiedTime = Calendar.getInstance().timeInMillis.toDouble()
Here is my way to put data to firestore
db.collection(SHOP_PENDING_COLLECTION)
.document(Firebase.auth.uid)
.set(shop)
.addOnSuccessListener {
hideProgressbar()
startActivity(Intent(this@AddNewShopActivity, ShopMainActivity::class.java).apply {
putExtra(EXTRA_CREATED_SHOP, "created")
})
finish()
}
.addOnFailureListener { e ->
hideProgressbar()
Utils.showShortToast(
this@AddNewShopActivity, getString(R.string.fail_to_create_shop)
)
Log.e(ContentValues.TAG, "Error adding document", e)
}
and my Shop.kt
model
@Parcelize data class Shop(
internal var uid: String? = null,
internal var name: String? = null,
internal var owner: String? = null,
internal var address: String? = null,
internal var phone: String? = null,
internal var openTime: String? = null,
internal var website: String? = null,
internal var imageUrl: String? = null,
internal var service: String? = null,
internal var rating: Double? = null,
internal var reviewCount: Long? = null,
internal var location: @RawValue HashMap<String, Any>? = null,
internal var pendingApprove: Boolean? = null,
internal var created: Boolean? = null,
internal var lastModifiedTime: Double? = null,
internal var fcmToken: String? = null
) : Parcelable
I was trying to looking solution but can't find anywhere. I would appreciate any help!