mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-16 19:18:52 +01:00
Set user property for upgraded status
This commit is contained in:
@@ -21,9 +21,13 @@ package common.util
|
||||
import android.content.Context
|
||||
import com.amplitude.api.Amplitude
|
||||
import com.amplitude.api.AmplitudeClient
|
||||
import com.amplitude.api.Identify
|
||||
import com.mixpanel.android.mpmetrics.MixpanelAPI
|
||||
import com.moez.QKSMS.BuildConfig
|
||||
import manager.AnalyticsManager
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@@ -41,4 +45,30 @@ class AnalyticsManagerImpl @Inject constructor(context: Context): AnalyticsManag
|
||||
})
|
||||
}
|
||||
|
||||
override fun setUserProperty(key: String, value: Any) {
|
||||
|
||||
// Set the value in Mixpanel
|
||||
val properties = JSONObject()
|
||||
properties.put(key, value)
|
||||
mixpanel.registerSuperProperties(properties)
|
||||
|
||||
// Set the value in Amplitude
|
||||
when (value) {
|
||||
is Boolean -> Identify().set(key, value)
|
||||
is BooleanArray -> Identify().set(key, value)
|
||||
is Double -> Identify().set(key, value)
|
||||
is DoubleArray -> Identify().set(key, value)
|
||||
is Float -> Identify().set(key, value)
|
||||
is FloatArray -> Identify().set(key, value)
|
||||
is Int -> Identify().set(key, value)
|
||||
is IntArray -> Identify().set(key, value)
|
||||
is Long -> Identify().set(key, value)
|
||||
is LongArray -> Identify().set(key, value)
|
||||
is String -> Identify().set(key, value)
|
||||
is JSONArray -> Identify().set(key, value)
|
||||
is JSONObject -> Identify().set(key, value)
|
||||
else -> Timber.e("Value of type ${value::class.java} not supported")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user