From de6d31f1987ed78cafcbad339a97c0636cc6253a Mon Sep 17 00:00:00 2001 From: Hemant Mann Date: Tue, 26 Jan 2021 12:25:14 +0530 Subject: [PATCH] Update ReferrerDetails.kt --- .../cloudstuff/trackiersdk/ReferrerDetails.kt | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/TrackierSDK/sdk-core/src/main/java/com/cloudstuff/trackiersdk/ReferrerDetails.kt b/TrackierSDK/sdk-core/src/main/java/com/cloudstuff/trackiersdk/ReferrerDetails.kt index 165e52e..331f8f2 100644 --- a/TrackierSDK/sdk-core/src/main/java/com/cloudstuff/trackiersdk/ReferrerDetails.kt +++ b/TrackierSDK/sdk-core/src/main/java/com/cloudstuff/trackiersdk/ReferrerDetails.kt @@ -1,30 +1,27 @@ package com.cloudstuff.trackiersdk -import android.net.Uri -import android.util.Log import java.net.URLDecoder data class RefererDetails( - val url: String, - val clickTime: String, - val installTime: String, + val url: String, + val clickTime: String, + val installTime: String, ) { val isOrganic: Boolean get() = clickId.isEmpty() val clickId : String - init { - val afterDecode = URLDecoder.decode(url, "UTF-8").toString() - val params = getQueryKeyValueMap(afterDecode); - clickId = if (params != null) params["tr_clickid"].toString() else "" - } + init { + val afterDecode = URLDecoder.decode(url, "UTF-8").toString() + val params = getQueryKeyValueMap(afterDecode); + clickId = params["tr_clickid"] ?: "" + } - fun getQueryKeyValueMap(url: String): Map { - val map = url.split("?").associate { + private fun getQueryKeyValueMap(url: String): Map { + return url.split("?").associate { val (left, right) = url.split("=") left to right } - return map } companion object {