From 7eada1240ba46859d008eb18cf0dca570f772eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doga=20G=C3=BCrdal?= <7249632+dgrdl@users.noreply.github.com> Date: Fri, 5 Mar 2021 14:58:03 +0100 Subject: [PATCH] fix: remove unnecessary CMP ID check This fixes possible exceptions thrown due to incorrect types occurring from CMPs setting their ID as either Long or Int type. --- .../com/yieldlab/yieldprobe/helper/ConsentHelper.kt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/yieldprobe/src/main/java/com/yieldlab/yieldprobe/helper/ConsentHelper.kt b/src/yieldprobe/src/main/java/com/yieldlab/yieldprobe/helper/ConsentHelper.kt index 12bdfee..bd569bd 100644 --- a/src/yieldprobe/src/main/java/com/yieldlab/yieldprobe/helper/ConsentHelper.kt +++ b/src/yieldprobe/src/main/java/com/yieldlab/yieldprobe/helper/ConsentHelper.kt @@ -5,7 +5,7 @@ import android.preference.PreferenceManager /** * Read out the Consent string. - * The class uses the proposed identifiers: "IABTCF_CmpSdkID" and "IABTCF_TCString" + * The class uses the proposed identifier: "IABTCF_TCString" */ class ConsentHelper { @@ -16,15 +16,7 @@ class ConsentHelper { * @return Consent string */ fun getString(context: Context): String? { - val mPreferences = PreferenceManager.getDefaultSharedPreferences(context) - val consentString = mPreferences.getString("IABTCF_TCString", "") - val cmpPresent = mPreferences.getInt("IABTCF_CmpSdkID", 0) - - if (cmpPresent > 0) { - return consentString - } else { - return null - } + return mPreferences.getString("IABTCF_TCString", null) } }