diff --git a/samples/app/src/main/java/com/sourcepoint/app/v6/MainActivityKotlin.kt b/samples/app/src/main/java/com/sourcepoint/app/v6/MainActivityKotlin.kt index 7c57fa3a3..17a372285 100644 --- a/samples/app/src/main/java/com/sourcepoint/app/v6/MainActivityKotlin.kt +++ b/samples/app/src/main/java/com/sourcepoint/app/v6/MainActivityKotlin.kt @@ -19,7 +19,6 @@ import com.sourcepoint.cmplibrary.core.nativemessage.NativeComponent import com.sourcepoint.cmplibrary.creation.delegate.spConsentLibLazy import com.sourcepoint.cmplibrary.exception.CampaignType import com.sourcepoint.cmplibrary.model.ConsentAction -import com.sourcepoint.cmplibrary.model.MessageLanguage import com.sourcepoint.cmplibrary.model.PMTab import com.sourcepoint.cmplibrary.model.exposed.NativeMessageActionType import com.sourcepoint.cmplibrary.model.exposed.SPConsents @@ -69,11 +68,11 @@ class MainActivityKotlin : AppCompatActivity() { clearAllData(this) } + storeDiagnosticObj(dataProvider.diagnostic) + val sp = PreferenceManager.getDefaultSharedPreferences(this) sp.edit().putString(CLIENT_PREF_KEY, CLIENT_PREF_VAL).apply() - gracefulDegradationTest(sp, dataProvider) // 4 testing - setContentView(R.layout.activity_main_v7) review_consents_gdpr.setOnClickListener { _v: View? -> spConsentLib.loadPrivacyManager( @@ -90,7 +89,10 @@ class MainActivityKotlin : AppCompatActivity() { CampaignType.CCPA ) } - clear_all.setOnClickListener { _v: View? -> clearAllData(this) } + clear_all.setOnClickListener { _v: View? -> + clearAllData(this) + PreferenceManager.getDefaultSharedPreferences(this).edit().clear().apply() + } auth_id_activity.setOnClickListener { _v: View? -> startActivity(Intent(this, MainActivityAuthId::class.java)) } @@ -124,17 +126,6 @@ class MainActivityKotlin : AppCompatActivity() { startActivity(Intent(this, WebConsentTransferTestActivity::class.java)) } - private fun gracefulDegradationTest(sp: SharedPreferences, dataProvider: DataProvider) { - if (dataProvider.storeStateGdpr) { - sp.edit().putString("sp.gdpr.consent.resp", "fake state").apply() - sp.edit().putBoolean("sp.key.saved.consent", true).apply() - } - if (dataProvider.storeStateCcpa) { - sp.edit().putString("sp.ccpa.consent.resp", "fake state").apply() - sp.edit().putBoolean("sp.key.saved.consent", true).apply() - } - } - override fun onResume() { super.onResume() executeCmpLib() @@ -350,6 +341,17 @@ class MainActivityKotlin : AppCompatActivity() { null } } + + private fun storeDiagnosticObj(list: List>) { + val sp = PreferenceManager.getDefaultSharedPreferences(this) + val spEditor = sp.edit() + list.forEach { + check { it.second as? String }?.let { v -> spEditor.putString(it.first, v) } + check { it.second as? Boolean }?.let { v -> spEditor.putBoolean(it.first, v) } + check { it.second as? Int }?.let { v -> spEditor.putInt(it.first, v) } + } + spEditor.apply() + } } val consent = """ diff --git a/samples/metaapp/src/main/java/com/sourcepointmeta/metaapp/util/DefaultProperties.kt b/samples/metaapp/src/main/java/com/sourcepointmeta/metaapp/util/DefaultProperties.kt index 98398ae6d..3e7fdd087 100644 --- a/samples/metaapp/src/main/java/com/sourcepointmeta/metaapp/util/DefaultProperties.kt +++ b/samples/metaapp/src/main/java/com/sourcepointmeta/metaapp/util/DefaultProperties.kt @@ -202,7 +202,7 @@ val defaultProperty11 = Property( is_staging = false, targetingParameters = emptyList(), timeout = 3000, - authId = null, + authId = "test0954052023", messageLanguage = "ENGLISH", pmTab = "DEFAULT", statusCampaignSet = setOf( @@ -275,7 +275,6 @@ val oldV6Consent = """ "IABTCF_PurposeConsents": "1110000010", "sp.gdpr.key.consent.status": "{\n \"consentedToAll\": false,\n \"cookies\": [\n {\n \"key\": \"consentUUID\",\n \"maxAge\": 31536000,\n \"shareRootDomain\": false,\n \"value\": \"98a3b758-3a0c-4c8c-8e9f-50294d608da8_14\"\n }\n ],\n \"legIntCategories\": [\n \"608bad95d08d3112188e0e2f\"\n ],\n \"rejectedAny\": true,\n \"specialFeatures\": [\n ],\n \"addtlConsent\": \"1~\",\n \"consentStatus\": {\n \"consentedAll\": false,\n \"consentedToAny\": true,\n \"granularStatus\": {\n \"defaultConsent\": false,\n \"previousOptInAll\": false,\n \"purposeConsent\": \"NONE\",\n \"purposeLegInt\": \"ALL\",\n \"vendorConsent\": \"NONE\",\n \"vendorLegInt\": \"ALL\"\n },\n \"hasConsentData\": true,\n \"rejectedAny\": true,\n \"rejectedLI\": false\n },\n \"dateCreated\": \"2022-12-07T15:03:32.459Z\",\n \"euconsent\": \"CPjnmsAPjnmsAAGABBENCtCgAAAAAEAAAAYgAAAAAAAA.YAAAAAAAAAAA\",\n \"grants\": {\n \"5e7ced57b8e05c485246cce0\": {\n \"vendorGrant\": false,\n \"purposeGrants\": {\n \"608bad95d08d3112188e0e29\": false,\n \"608bad95d08d3112188e0e36\": false,\n \"608bad96d08d3112188e0e59\": false,\n \"60b65857619abe242bed971e\": false\n }\n },\n \"5f1b2fbeb8e05c306f2a1eb9\": {\n \"vendorGrant\": false,\n \"purposeGrants\": {\n \"608bad95d08d3112188e0e29\": false,\n \"608bad95d08d3112188e0e2f\": true\n }\n },\n \"5ff4d000a228633ac048be41\": {\n \"vendorGrant\": false,\n \"purposeGrants\": {\n \"608bad95d08d3112188e0e2f\": false,\n \"608bad95d08d3112188e0e36\": false\n }\n }\n },\n \"TCData\": {\n \"IABTCF_AddtlConsent\": \"1~\",\n \"IABTCF_CmpSdkID\": \"6\",\n \"IABTCF_CmpSdkVersion\": \"2\",\n \"IABTCF_PolicyVersion\": \"2\",\n \"IABTCF_PublisherCC\": \"DE\",\n \"IABTCF_PurposeOneTreatment\": \"0\",\n \"IABTCF_UseNonStandardStacks\": \"0\",\n \"IABTCF_TCString\": \"CPjnmsAPjnmsAAGABBENCtCgAAAAAEAAAAYgAAAAAAAA.YAAAAAAAAAAA\",\n \"IABTCF_VendorConsents\": \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\n \"IABTCF_VendorLegitimateInterests\": \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\n \"IABTCF_PurposeConsents\": \"0000000000\",\n \"IABTCF_PurposeLegitimateInterests\": \"0100000000\",\n \"IABTCF_SpecialFeaturesOptIns\": \"00\",\n \"IABTCF_PublisherConsent\": \"0000000000\",\n \"IABTCF_PublisherLegitimateInterests\": \"0000000000\",\n \"IABTCF_PublisherCustomPurposesConsents\": \"0000000000\",\n \"IABTCF_PublisherCustomPurposesLegitimateInterests\": \"0000000000\",\n \"IABTCF_gdprApplies\": \"1\"\n },\n \"uuid\": \"98a3b758-3a0c-4c8c-8e9f-50294d608da8_14\",\n \"acceptedCategories\": [\n ],\n \"acceptedVendors\": [\n ]\n}", "sp.key.ccpa": "{\"applies\":true,\"message\":{\"message_choice\":[{\"button_text\":\"Dismiss\",\"choice_id\":5681956,\"iframe_url\":null,\"type\":15},{\"button_text\":\"1623758277257\",\"choice_id\":5681957,\"iframe_url\":\"https:\\/\\/ccpa-notice.sp-prod.net\\/ccpa_pm\\/index.html?message_id=509688\",\"type\":12},{\"button_text\":\"1623758165801\",\"choice_id\":5681958,\"iframe_url\":null,\"type\":13},{\"button_text\":\"1623758176582\",\"choice_id\":5681959,\"iframe_url\":null,\"type\":11}],\"message_json\":{\"message_json_string\":\"{\\\"type\\\":\\\"Notice\\\",\\\"name\\\":\\\"CCPA Message\\\",\\\"settings\\\":{},\\\"children\\\":[{\\\"type\\\":\\\"Text\\\",\\\"name\\\":\\\"Text\\\",\\\"settings\\\":{\\\"languages\\\":{\\\"EN\\\":{\\\"text\\\":\\\"

CCPA Message<\\/p>\\\"}},\\\"text\\\":\\\"

CCPA Message<\\/p>\\\"},\\\"children\\\":[]},{\\\"type\\\":\\\"Button\\\",\\\"name\\\":\\\"Button\\\",\\\"settings\\\":{\\\"languages\\\":{\\\"EN\\\":{\\\"text\\\":\\\"Show Options\\\"}},\\\"text\\\":\\\"Show Options\\\",\\\"choice_option\\\":{\\\"type\\\":12,\\\"data\\\":{\\\"button_text\\\":\\\"1623758277257\\\",\\\"privacy_manager_iframe_url\\\":\\\"https:\\/\\/ccpa-notice.sp-prod.net\\/ccpa_pm\\/index.html?message_id=509688\\\",\\\"consent_origin\\\":\\\"https:\\/\\/ccpa-service.sp-prod.net\\\"}}},\\\"children\\\":[]},{\\\"type\\\":\\\"Button\\\",\\\"name\\\":\\\"Button\\\",\\\"settings\\\":{\\\"languages\\\":{\\\"EN\\\":{\\\"text\\\":\\\"Reject All\\\"}},\\\"text\\\":\\\"Reject All\\\",\\\"choice_option\\\":{\\\"type\\\":13,\\\"data\\\":{\\\"button_text\\\":\\\"1623758165801\\\",\\\"consent_origin\\\":\\\"https:\\/\\/ccpa-service.sp-prod.net\\\",\\\"consent_language\\\":\\\"EN\\\"}},\\\"background\\\":\\\"#9a244f\\\"},\\\"children\\\":[]},{\\\"type\\\":\\\"Button\\\",\\\"name\\\":\\\"Button\\\",\\\"settings\\\":{\\\"languages\\\":{\\\"EN\\\":{\\\"text\\\":\\\"Accept All\\\"}},\\\"text\\\":\\\"Accept All\\\",\\\"choice_option\\\":{\\\"type\\\":11,\\\"data\\\":{\\\"button_text\\\":\\\"1623758176582\\\",\\\"consent_origin\\\":\\\"https:\\/\\/ccpa-service.sp-prod.net\\\",\\\"consent_language\\\":\\\"EN\\\"}},\\\"background\\\":\\\"#4f7a28\\\"},\\\"children\\\":[]}],\\\"compliance_status\\\":false,\\\"compliance_list\\\":[]}\",\"name\":\"CCPA Message\",\"settings\":{},\"signature\":[180,139,208,159,150,52,33,251,87,207,64,248,255,84,201,7,141,197,107,32,181,3,205,144,199,255,101,82,87,35,123,41,52,2,44,110,7,114,9,78,242,57,177,23,70,241,39,206,92,37,120,165,67,42,243,33,96,114,75,181,13,206,191,7],\"type\":\"Notice\"},\"site_id\":16893},\"messageMetaData\":{\"bucket\":237,\"categoryId\":2,\"messageId\":616558,\"msgDescription\":\"\",\"prtnUUID\":\"5cfc830e-3d3a-4b18-979d-c543dd065516\",\"subCategoryId\":1},\"type\":\"CCPA\",\"url\":\"https:\\/\\/cdn.privacy-mgmt.com\\/index.html?ccpaUUID=08dcd5d5-738f-4e0d-8bd8-7ee9f24ac053&message_id=616558&consentLanguage=EN&preload_message=true&version=v1\",\"userConsent\":{\"dateCreated\":\"2022-12-08T08:39:27.203Z\",\"newUser\":false,\"rejectedAll\":false,\"rejectedCategories\":[],\"rejectedVendors\":[],\"signedLspa\":false,\"status\":\"rejectedNone\",\"uspstring\":\"1YNN\"}}", - "sp.key.property.id": 16893, "sp.key.gdpr.applies": true } """.trimIndent() @@ -348,7 +347,6 @@ val oldV6ConsentFinnish690 = """ "sp.gdpr.consentUUID": "699f12fe-2387-43e0-ad05-93b5dbe1dc10_24", "IABTCF_UseNonStandardTexts": 0, "IABTCF_PurposeConsents": "1111111111", - "sp.key.property.id": 26891, "sp.key.gdpr.applies": true } """.trimIndent()