Skip to content

Commit

Permalink
Null check for expert_Connect api response.
Browse files Browse the repository at this point in the history
  • Loading branch information
faraz-nowfloats committed May 12, 2023
1 parent 2d6ecc5 commit d31cf52
Showing 1 changed file with 30 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1275,35 +1275,38 @@ class MarketPlaceActivity : AppBaseActivity<ActivityMarketplaceBinding, MarketPl
})

viewModel.getExpertConnectDetails().observe(this, androidx.lifecycle.Observer {
Log.e("getYoutubeVideoDetails", it.toString())
// Log.e("getYoutubeVideoDetails", it.toString())
val expertConnectDetails = it
if (it.is_online) {
prefs.storeExpertContact(it.contact_number)
callnow_layout.visibility = View.VISIBLE
callnow_image.visibility = View.VISIBLE
callnow_title.setText(it.line1)
callnow_desc.setText(it.line2)
callnow_button.setOnClickListener {
WebEngageController.trackEvent(
ADDONS_MARKETPLACE_EXPERT_SPEAK,
CLICK,
NO_EVENT_VALUE
)
val callIntent = Intent(Intent.ACTION_DIAL)
callIntent.data = Uri.parse("tel:" + expertConnectDetails.contact_number)
startActivity(Intent.createChooser(callIntent, "Call by:"))
}
mp_talk_expert_tv.setOnClickListener {
WebEngageController.trackEvent(
ADDONS_MARKETPLACE_WAITING_CART_EXPERT_CALL_CLICKED,
EVENT_LABEL_ADDONS_MARKETPLACE_WAITING_CART_EXPERT_CALL_CLICKED,
NO_EVENT_VALUE
)
val callExpertIntent = Intent(Intent.ACTION_DIAL)
callExpertIntent.data = Uri.parse("tel:" + expertConnectDetails.contact_number)
startActivity(Intent.createChooser(callExpertIntent, "Call by:"))
if (it!=null){
if (it.is_online) {
prefs.storeExpertContact(it.contact_number)
callnow_layout.visibility = View.VISIBLE
callnow_image.visibility = View.VISIBLE
callnow_title.setText(it.line1)
callnow_desc.setText(it.line2)
callnow_button.setOnClickListener {
WebEngageController.trackEvent(
ADDONS_MARKETPLACE_EXPERT_SPEAK,
CLICK,
NO_EVENT_VALUE
)
val callIntent = Intent(Intent.ACTION_DIAL)
callIntent.data = Uri.parse("tel:" + expertConnectDetails.contact_number)
startActivity(Intent.createChooser(callIntent, "Call by:"))
}
mp_talk_expert_tv.setOnClickListener {
WebEngageController.trackEvent(
ADDONS_MARKETPLACE_WAITING_CART_EXPERT_CALL_CLICKED,
EVENT_LABEL_ADDONS_MARKETPLACE_WAITING_CART_EXPERT_CALL_CLICKED,
NO_EVENT_VALUE
)
val callExpertIntent = Intent(Intent.ACTION_DIAL)
callExpertIntent.data = Uri.parse("tel:" + expertConnectDetails.contact_number)
startActivity(Intent.createChooser(callExpertIntent, "Call by:"))
}
}
} else {
}
else {
callnow_layout.visibility = View.GONE
callnow_image.visibility = View.GONE

Expand Down

0 comments on commit d31cf52

Please sign in to comment.