Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 3.50 KB | None | 0 0
  1.     fun trackContactSeller(
  2.         listing: ListingResponse,
  3.         contact_method: String,
  4.         contact_trigger: String,
  5.         contact_screen: String?,
  6.         latitude: Double?,
  7.         longitude: Double?
  8.     ) {
  9.         mpProperties.put("contact_method", contact_method)
  10.         mpProperties.put("car_id", listing.id)
  11.         mpProperties.put("mileage", listing.mileage)
  12.         mpProperties.put("asking_price", listing.price)
  13.         mpProperties.put("negotiated_price", listing.negotiated_price?.toInt())
  14.         mpProperties.put("country_code", listing.country_code)
  15.         mpProperties.put("currency_code", listing.currency)
  16.         mpProperties.put("is_featured", listing.is_featured)
  17.         mpProperties.put("is_certified", listing.is_certified)
  18.         mpProperties.put("body_type_name", bodyTypes[listing.body_type_id?.toInt()])
  19.         mpProperties.put("make_name", listing.make_name)
  20.         mpProperties.put("model_name", listing.model_name)
  21.         mpProperties.put("submodel_name", listing.submodel_name)
  22.         mpProperties.put("trim_name", listing.trim_name)
  23.         mpProperties.put("phone_number", listing.phone_number)
  24.         mpProperties.put("is_new", listing.is_new)
  25.         mpProperties.put("year", listing.year)
  26.         mpProperties.put(
  27.             "car_type",
  28.             if (listing.is_new) "is_new" else if (!listing.is_new) "used" else "lease"
  29.         )
  30.         mpProperties.put("longitude", longitude)
  31.         mpProperties.put("latitude", latitude)
  32.         mpProperties.put("contact_screen", contact_screen)
  33.         mpProperties.put("contact_trigger", contact_trigger)
  34.         mixPanelAPI.track(EVENTS_TRACKING_CONTACT_SELLER_MIXPANEL, mpProperties)
  35.  
  36.         fbProperties.putString("contact_method", contact_method)
  37.         fbProperties.putString("car_id", listing.id)
  38.         fbProperties.putInt("mileage", listing.mileage)
  39.         fbProperties.putInt("asking_price", listing.price)
  40.  
  41.         val negotiatedPrice = listing.negotiated_price
  42.         if (negotiatedPrice != null)
  43.             fbProperties.putInt("negotiated_price", negotiatedPrice.toInt())
  44.  
  45.         fbProperties.putString("country_code", listing.country_code)
  46.  
  47.         fbProperties.putString("currency_code", listing.currency)
  48.         fbProperties.putBoolean("is_featured", listing.is_featured)
  49.         fbProperties.putBoolean("is_certified", listing.is_certified)
  50.         fbProperties.putString("body_type_name", bodyTypes[listing.body_type_id?.toInt()])
  51.         fbProperties.putString("make_name", listing.make_name)
  52.         fbProperties.putString("model_name", listing.model_name)
  53.         fbProperties.putString("submodel_name", listing.submodel_name)
  54.         fbProperties.putString("trim_name", listing.trim_name)
  55.         fbProperties.putString("phone_number", listing.phone_number)
  56.         fbProperties.putBoolean("is_new", listing.is_new)
  57.         fbProperties.putInt("year", listing.year)
  58.         fbProperties.putString(
  59.             "car_type",
  60.             if (listing.is_new) "is_new" else if (!listing.is_new) "used" else "lease"
  61.         )
  62.         if (longitude != null) {
  63.             fbProperties.putDouble("longitude", longitude)
  64.         }
  65.         if (latitude != null) {
  66.             fbProperties.putDouble("latitude", latitude)
  67.         }
  68.         fbProperties.putString("contact_screen", contact_screen)
  69.         fbProperties.putString("contact_trigger", contact_trigger)
  70.         facebookLogger.logEvent(EVENTS_TRACKING_CONTACT_SELLER_FACEBOOK, fbProperties)
  71.  
  72.         clearPropertiesObjects()
  73.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement