author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
116,612
12.10.2021 17:48:10
-19,080
e6f3d6a3e1dbc886cc82449008cd378fe1be75ef
task(android12_support): Update androidx.test dependency to support exported attribute for unit tests
[ { "change_type": "MODIFY", "old_path": "buildSrc/settings.gradle.kts", "new_path": "buildSrc/settings.gradle.kts", "diff": "pluginManagement {\nplugins {\nid(\"de.fayard.refreshVersions\") version \"0.10.0\"\n+//// # available:\"0.10.1\"\n+//// # available:\"0.11.0\"\n+//// # available:\"0.20.0\"\n+//// # available:\"0.21.0\"\n+//// # available:\"0.22.0\"\n+//// # available:\"0.23.0\"\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "settings.gradle", "new_path": "settings.gradle", "diff": "plugins {\nid 'de.fayard.refreshVersions' version '0.10.0'\n+//// # available:'0.10.1'\n+//// # available:'0.11.0'\n+//// # available:'0.20.0'\n+//// # available:'0.21.0'\n+//// # available:'0.22.0'\n+//// # available:'0.23.0'\nid \"com.gradle.enterprise\" version \"3.6.3\"\n+//// # available:\"3.6.4\"\n+//// # available:\"3.7\"\n}\ninclude ':test_shared'\ninclude ':clevertap-core'\n" }, { "change_type": "MODIFY", "old_path": "versions.properties", "new_path": "versions.properties", "diff": "####\n#### suppress inspection \"SpellCheckingInspection\" for whole file\n#### suppress inspection \"UnusedProperty\" for whole file\n+\nplugin.android=4.2.1\n+## # available=4.2.2\n## # available=7.0.0-alpha01\n## # available=7.0.0-alpha02\n## # available=7.0.0-alpha03\n@@ -25,9 +27,27 @@ plugin.android=4.2.1\n## # available=7.0.0-beta01\n## # available=7.0.0-beta02\n## # available=7.0.0-beta03\n+## # available=7.0.0-beta04\n+## # available=7.0.0-beta05\n+## # available=7.0.0-rc01\n+## # available=7.0.0\n+## # available=7.0.1\n+## # available=7.0.2\n+## # available=7.0.3\n## # available=7.1.0-alpha01\n## # available=7.1.0-alpha02\n-version.androidx.test=1.3.0\n+## # available=7.1.0-alpha03\n+## # available=7.1.0-alpha04\n+## # available=7.1.0-alpha05\n+## # available=7.1.0-alpha06\n+## # available=7.1.0-alpha07\n+## # available=7.1.0-alpha08\n+## # available=7.1.0-alpha09\n+## # available=7.1.0-alpha10\n+## # available=7.1.0-alpha11\n+## # available=7.1.0-alpha12\n+## # available=7.1.0-alpha13\n+version.androidx.test=1.4.0\n## # available=1.3.1-alpha01\n## # available=1.3.1-alpha02\n## # available=1.3.1-alpha03\n@@ -36,7 +56,12 @@ version.androidx.test=1.3.0\n## # available=1.4.0-alpha06\n## # available=1.4.0-beta01\n## # available=1.4.0-beta02\n-version.androidx.test.core=1.3.0\n+## # available=1.4.0-rc01\n+## # available=1.4.0\n+## # available=1.4.1-alpha01\n+## # available=1.4.1-alpha02\n+## # available=1.4.1-alpha03\n+version.androidx.test.core=1.4.0\n## # available=1.3.1-alpha01\n## # available=1.3.1-alpha02\n## # available=1.3.1-alpha03\n@@ -45,6 +70,11 @@ version.androidx.test.core=1.3.0\n## # available=1.4.0-alpha06\n## # available=1.4.0-beta01\n## # available=1.4.0-beta02\n+## # available=1.4.0-rc01\n+## # available=1.4.0\n+## # available=1.4.1-alpha01\n+## # available=1.4.1-alpha02\n+## # available=1.4.1-alpha03\nversion.androidx.test.espresso=3.3.0\n## # available=3.4.0-alpha01\n## # available=3.4.0-alpha02\n@@ -54,6 +84,11 @@ version.androidx.test.espresso=3.3.0\n## # available=3.4.0-alpha06\n## # available=3.4.0-beta01\n## # available=3.4.0-beta02\n+## # available=3.4.0-rc01\n+## # available=3.4.0\n+## # available=3.5.0-alpha01\n+## # available=3.5.0-alpha02\n+## # available=3.5.0-alpha03\nversion.androidx.test.ext.junit=1.1.2\n## # available=1.1.3-alpha01\n## # available=1.1.3-alpha02\n@@ -63,23 +98,73 @@ version.androidx.test.ext.junit=1.1.2\n## # available=1.1.3-alpha06\n## # available=1.1.3-beta01\n## # available=1.1.3-beta02\n+## # available=1.1.3-rc01\n+## # available=1.1.3\n+## # available=1.1.4-alpha01\n+## # available=1.1.4-alpha02\n+## # available=1.1.4-alpha03\nversion.com.google.code.gson..gson=2.8.6\n+## # available=2.8.7\n+## # available=2.8.8\nversion.com.google.gms..google-services=4.3.3\n+## # available=4.3.4\n+## # available=4.3.5\n+## # available=4.3.6\n+## # available=4.3.7\n+## # available=4.3.8\n+## # available=4.3.9\n+## # available=4.3.10\nversion.com.google.truth..truth=1.1.3\nversion.com.huawei.agconnect..agcp=1.4.2.300\n+## # available=1.6.1.200\nversion.com.huawei.hms..push=6.1.0.300\nversion.eu.codearte.catch-exception..catch-exception=2.0\n## # available=2.0.0-ALPHA-1\n## # available=2.0.0-beta-1\nversion.junit=5.7.2\n### available=5.8.0-M1\n+### available=5.8.0-RC1\n+### available=5.8.0\n+### available=5.8.1\nversion.kotlin=1.3.72\n+## # available=1.4.0-rc\n+## # available=1.4.0\n+## # available=1.4.10\n+## # available=1.4.20-M1\n+## # available=1.4.20-M2\n+## # available=1.4.20-RC\n+## # available=1.4.20\n+## # available=1.4.21\n+## # available=1.4.21-2\n+## # available=1.4.30-M1\n+## # available=1.4.30-RC\n+## # available=1.4.30\n+## # available=1.4.31\n+## # available=1.4.32\n+## # available=1.5.0-M1\n+## # available=1.5.0-M2\n+## # available=1.5.0-RC\n+## # available=1.5.0\n+## # available=1.5.10\n## # available=1.5.20-M1\n## # available=1.5.20-RC\n+## # available=1.5.20\n+## # available=1.5.21\n+## # available=1.5.30-M1\n+## # available=1.5.30-RC\n+## # available=1.5.30\n+## # available=1.5.31\n+## # available=1.6.0-M1\n+## # available=1.6.0-RC\nversion.org.awaitility..awaitility=4.1.0\nversion.org.jacoco..org.jacoco.core=0.8.7\nversion.org.junit.platform..junit-platform-runner=1.7.0\n+## # available=1.7.1\n+## # available=1.7.2\n## # available=1.8.0-M1\n+## # available=1.8.0-RC1\n+## # available=1.8.0\n+## # available=1.8.1\nversion.org.opentest4j..opentest4j=1.2.0\nversion.org.powermock..powermock-api-mockito2=2.0.9\nversion.org.powermock..powermock-classloading-xstream=2.0.9\n@@ -89,19 +174,150 @@ version.org.powermock..powermock-module-junit4-rule=2.0.9\nversion.org.skyscreamer..jsonassert=1.5.0\nversion.org.sonarsource.scanner.gradle..sonarqube-gradle-plugin=3.3\nversion.androidx.annotation=1.1.0\n+## # available=1.2.0-alpha01\n+## # available=1.2.0-beta01\n+## # available=1.2.0-rc01\n+## # available=1.2.0\n+## # available=1.3.0-alpha01\n+## # available=1.3.0-beta01\nversion.androidx.appcompat=1.2.0\n+## # available=1.3.0-alpha01\n+## # available=1.3.0-alpha02\n+## # available=1.3.0-beta01\n+## # available=1.3.0-rc01\n+## # available=1.3.0\n+## # available=1.3.1\n+## # available=1.4.0-alpha01\n+## # available=1.4.0-alpha02\n+## # available=1.4.0-alpha03\n+## # available=1.4.0-beta01\nversion.androidx.concurrent=1.0.0\n+## # available=1.1.0-alpha01\n+## # available=1.1.0-beta01\n+## # available=1.1.0-rc01\n+## # available=1.1.0\nversion.androidx.constraintlayout=2.0.1\nversion.androidx.coordinatorlayout=1.1.0\nversion.androidx.core=1.3.0\n+## # available=1.3.1\n+## # available=1.3.2\n+## # available=1.4.0-alpha01\n+## # available=1.5.0-alpha01\n+## # available=1.5.0-alpha02\n+## # available=1.5.0-alpha03\n+## # available=1.5.0-alpha04\n+## # available=1.5.0-alpha05\n+## # available=1.5.0-beta01\n+## # available=1.5.0-beta02\n+## # available=1.5.0-beta03\n+## # available=1.5.0-rc01\n+## # available=1.5.0-rc02\n+## # available=1.5.0\n+## # available=1.6.0-alpha01\n+## # available=1.6.0-alpha02\n+## # available=1.6.0-alpha03\n+## # available=1.6.0-beta01\n+## # available=1.6.0-beta02\n+## # available=1.6.0-rc01\n+## # available=1.6.0\n+## # available=1.7.0-alpha01\n+## # available=1.7.0-alpha02\n+## # available=1.7.0-beta01\n+## # available=1.7.0-beta02\nversion.androidx.databinding=4.2.1\nversion.androidx.fragment=1.1.0\n+## # available=1.2.0-alpha01\n+## # available=1.2.0-alpha02\n+## # available=1.2.0-alpha03\n+## # available=1.2.0-alpha04\n+## # available=1.2.0-beta01\n+## # available=1.2.0-beta02\n+## # available=1.2.0-rc01\n+## # available=1.2.0-rc02\n+## # available=1.2.0-rc03\n+## # available=1.2.0-rc04\n+## # available=1.2.0-rc05\n+## # available=1.2.0\n+## # available=1.2.1\n+## # available=1.2.2\n+## # available=1.2.3\n+## # available=1.2.4\n+## # available=1.2.5\n+## # available=1.3.0-alpha01\n+## # available=1.3.0-alpha02\n+## # available=1.3.0-alpha03\n+## # available=1.3.0-alpha04\n+## # available=1.3.0-alpha05\n+## # available=1.3.0-alpha06\n+## # available=1.3.0-alpha07\n+## # available=1.3.0-alpha08\n+## # available=1.3.0-beta01\n+## # available=1.3.0-beta02\n+## # available=1.3.0-rc01\n+## # available=1.3.0-rc02\n+## # available=1.3.0\n+## # available=1.3.1\n+## # available=1.3.2\n+## # available=1.3.3\n+## # available=1.3.4\n+## # available=1.3.5\n+## # available=1.3.6\n+## # available=1.4.0-alpha01\n+## # available=1.4.0-alpha02\n+## # available=1.4.0-alpha03\n+## # available=1.4.0-alpha04\n+## # available=1.4.0-alpha05\n+## # available=1.4.0-alpha06\n+## # available=1.4.0-alpha07\n+## # available=1.4.0-alpha08\n+## # available=1.4.0-alpha09\n+## # available=1.4.0-alpha10\nversion.androidx.lifecycle=2.2.0\nversion.androidx.multidex=2.0.1\nversion.androidx.recyclerview=1.1.0\n+## # available=1.2.0-alpha01\n+## # available=1.2.0-alpha02\n+## # available=1.2.0-alpha03\n+## # available=1.2.0-alpha04\n+## # available=1.2.0-alpha05\n+## # available=1.2.0-alpha06\n+## # available=1.2.0-beta01\n+## # available=1.2.0-beta02\n+## # available=1.2.0-rc01\n+## # available=1.2.0\n+## # available=1.2.1\n+## # available=1.3.0-alpha01\nversion.androidx.viewpager=1.0.0\n+## # available=1.1.0-alpha01\nversion.androidx.work=2.3.4\n+## # available=2.4.0-alpha01\n+## # available=2.4.0-alpha02\n+## # available=2.4.0-alpha03\n+## # available=2.4.0-beta01\n+## # available=2.4.0-rc01\n+## # available=2.4.0\n+## # available=2.5.0-alpha01\n+## # available=2.5.0-alpha02\n+## # available=2.5.0-alpha03\n+## # available=2.5.0-beta01\n+## # available=2.5.0-beta02\n+## # available=2.5.0-rc01\n+## # available=2.5.0\n+## # available=2.6.0-alpha01\n+## # available=2.6.0-alpha02\n+## # available=2.6.0-beta01\n+## # available=2.6.0-beta02\n+## # available=2.6.0-rc01\n+## # available=2.6.0\n+## # available=2.7.0-alpha01\n+## # available=2.7.0-alpha02\n+## # available=2.7.0-alpha03\n+## # available=2.7.0-alpha04\n+## # available=2.7.0-alpha05\n+## # available=2.7.0-beta01\n+## # available=2.7.0-rc01\nversion.com.android.installreferrer..installreferrer=2.1\n+## # available=2.2\nversion.com.android.tools.lint..lint-api=27.0.1\nversion.com.android.tools.lint..lint-checks=27.0.1\nversion.com.clevertap.android..clevertap-android-sdk=4.2.0\n@@ -109,16 +325,124 @@ version.com.clevertap.android..clevertap-geofence-sdk=1.0.2\nversion.com.clevertap.android..clevertap-hms-sdk=1.0.2\nversion.com.clevertap.android..clevertap-xiaomi-sdk=1.0.2\nversion.com.github.bumptech.glide..glide=4.11.0\n+## # available=4.12.0\nversion.com.google.android.exoplayer..exoplayer=2.11.5\n+## # available=2.11.6\n+## # available=2.11.7\n+## # available=2.11.8\n+## # available=2.12.0\n+## # available=2.12.1\n+## # available=2.12.2\n+## # available=2.12.3\n+## # available=2.13.0\n+## # available=2.13.1\n+## # available=2.13.2\n+## # available=2.13.3\n+## # available=2.14.0\n+## # available=2.14.1\n+## # available=2.14.2\n+## # available=2.15.0\n+## # available=2.15.1\nversion.com.google.android.exoplayer..exoplayer-hls=2.11.5\n+## # available=2.11.6\n+## # available=2.11.7\n+## # available=2.11.8\n+## # available=2.12.0\n+## # available=2.12.1\n+## # available=2.12.2\n+## # available=2.12.3\n+## # available=2.13.0\n+## # available=2.13.1\n+## # available=2.13.2\n+## # available=2.13.3\n+## # available=2.14.0\n+## # available=2.14.1\n+## # available=2.14.2\n+## # available=2.15.0\n+## # available=2.15.1\nversion.com.google.android.exoplayer..exoplayer-ui=2.11.5\n+## # available=2.11.6\n+## # available=2.11.7\n+## # available=2.11.8\n+## # available=2.12.0\n+## # available=2.12.1\n+## # available=2.12.2\n+## # available=2.12.3\n+## # available=2.13.0\n+## # available=2.13.1\n+## # available=2.13.2\n+## # available=2.13.3\n+## # available=2.14.0\n+## # available=2.14.1\n+## # available=2.14.2\n+## # available=2.15.0\n+## # available=2.15.1\nversion.firebase-messaging=20.2.4\n+## # available=20.3.0\n+## # available=21.0.0\n+## # available=21.0.1\n+## # available=21.1.0\n+## # available=22.0.0\nversion.google.android.material=1.2.1\n+## # available=1.3.0-alpha01\n+## # available=1.3.0-alpha02\n+## # available=1.3.0-alpha03\n+## # available=1.3.0-alpha04\n+## # available=1.3.0-beta01\n+## # available=1.3.0-rc01\n+## # available=1.3.0\n+## # available=1.4.0-alpha01\n+## # available=1.4.0-alpha02\n+## # available=1.4.0-beta01\n+## # available=1.4.0-rc01\n+## # available=1.4.0\n+## # available=1.5.0-alpha01\n+## # available=1.5.0-alpha02\n+## # available=1.5.0-alpha03\n+## # available=1.5.0-alpha04\nversion.google.android.play-services-ads=19.4.0\nversion.google.android.play-services-location=17.0.0\n+## # available=17.1.0\n+## # available=18.0.0\nversion.junit.junit=4.13\nversion.mockito=3.5.11\n+## # available=3.5.13\n+## # available=3.5.15\n+## # available=3.6.0\n+## # available=3.6.26\n+## # available=3.6.28\n+## # available=3.7.0\n+## # available=3.7.7\n+## # available=3.8.0\n+## # available=3.10.0\n+## # available=3.11.0\n+## # available=3.11.1\n+## # available=3.11.2\n+## # available=3.12.0\n+## # available=3.12.1\n+## # available=3.12.2\n+## # available=3.12.3\n+## # available=3.12.4\n+## # available=4.0.0\nversion.org.jacoco..org.jacoco.agent=0.7.9\nversion.org.jacoco..org.jacoco.ant=0.7.9\nversion.robolectric=4.3.1\n+## # available=4.4-alpha-1\n+## # available=4.4-alpha-2\n+## # available=4.4-alpha-3\n+## # available=4.4-alpha-4\n+## # available=4.4-alpha-5\n+## # available=4.4-beta-1\n+## # available=4.4\n+## # available=4.4.1\n+## # available=4.5-alpha-1\n+## # available=4.5-alpha-2\n+## # available=4.5-alpha-3\n+## # available=4.5-beta-1\n+## # available=4.5\n+## # available=4.5.1\n+## # available=4.6-alpha-1\n+## # available=4.6-alpha-2\n+## # available=4.6\n+## # available=4.6.1\nversion.xmlpull..xmlpull=1.1.3.1\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support): Update androidx.test dependency to support exported attribute for unit tests SDK-1111
116,612
13.10.2021 13:46:21
-19,080
e067124a22b646fc53a9bfa5be65c70d378898c7
task(android12_support): Update PendingIntent flags to support mutability
[ { "change_type": "MODIFY", "old_path": "clevertap-geofence/src/main/java/com/clevertap/android/geofence/PendingIntentFactory.java", "new_path": "clevertap-geofence/src/main/java/com/clevertap/android/geofence/PendingIntentFactory.java", "diff": "@@ -53,7 +53,8 @@ class PendingIntentFactory {\nthrow new IllegalArgumentException(\"invalid pendingIntentType\");\n}\n- return PendingIntent.getBroadcast(context.getApplicationContext(), broadcastSenderRequestCode, intent, flags);\n+ return PendingIntent.getBroadcast(context.getApplicationContext(), broadcastSenderRequestCode, intent,\n+ flags | PendingIntent.FLAG_MUTABLE/*used by android framework*/);\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support): Update PendingIntent flags to support mutability SDK-1113
116,612
13.10.2021 14:47:40
-19,080
a49144c3d479210df5a50d4d7b19a4fc9b8de793
task(android12_support): Add sdk 31 check in mutable flag to support pending intent mutability
[ { "change_type": "MODIFY", "old_path": "clevertap-geofence/src/main/java/com/clevertap/android/geofence/PendingIntentFactory.java", "new_path": "clevertap-geofence/src/main/java/com/clevertap/android/geofence/PendingIntentFactory.java", "diff": "@@ -3,6 +3,7 @@ package com.clevertap.android.geofence;\nimport android.app.PendingIntent;\nimport android.content.Context;\nimport android.content.Intent;\n+import android.os.Build.VERSION;\nimport androidx.annotation.Nullable;\n/**\n@@ -53,8 +54,13 @@ class PendingIntentFactory {\nthrow new IllegalArgumentException(\"invalid pendingIntentType\");\n}\n+ if (VERSION.SDK_INT >= 31)//Android S\n+ {\n+ flags |= PendingIntent.FLAG_MUTABLE/*used by android framework*/;\n+ }\n+\nreturn PendingIntent.getBroadcast(context.getApplicationContext(), broadcastSenderRequestCode, intent,\n- flags | PendingIntent.FLAG_MUTABLE/*used by android framework*/);\n+ flags);\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support): Add sdk 31 check in mutable flag to support pending intent mutability SDK-1113
116,612
14.10.2021 09:56:55
-19,080
40f79701c11d673bd7ed12d582fa6148dc6dc7a8
task(android12_support-geofence_sdk): Update dependencies to support pending intent mutability
[ { "change_type": "MODIFY", "old_path": "versions.properties", "new_path": "versions.properties", "diff": "@@ -191,7 +191,7 @@ version.androidx.appcompat=1.2.0\n## # available=1.4.0-alpha02\n## # available=1.4.0-alpha03\n## # available=1.4.0-beta01\n-version.androidx.concurrent=1.0.0\n+version.androidx.concurrent=1.1.0\n## # available=1.1.0-alpha01\n## # available=1.1.0-beta01\n## # available=1.1.0-rc01\n@@ -289,7 +289,7 @@ version.androidx.recyclerview=1.1.0\n## # available=1.3.0-alpha01\nversion.androidx.viewpager=1.0.0\n## # available=1.1.0-alpha01\n-version.androidx.work=2.3.4\n+version.androidx.work=2.7.0-rc01\n## # available=2.4.0-alpha01\n## # available=2.4.0-alpha02\n## # available=2.4.0-alpha03\n@@ -401,7 +401,7 @@ version.google.android.material=1.2.1\n## # available=1.5.0-alpha03\n## # available=1.5.0-alpha04\nversion.google.android.play-services-ads=19.4.0\n-version.google.android.play-services-location=17.0.0\n+version.google.android.play-services-location=18.0.0\n## # available=17.1.0\n## # available=18.0.0\nversion.junit.junit=4.13\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-geofence_sdk): Update dependencies to support pending intent mutability SDK-1113
116,612
14.10.2021 09:58:06
-19,080
bdf504c8c7e84712416aa9ba6ca94a9ad754d484
task(android12_support-sample_app): Update dependencies to support pending intent mutability
[ { "change_type": "MODIFY", "old_path": "sample/build.gradle", "new_path": "sample/build.gradle", "diff": "@@ -63,9 +63,9 @@ dependencies {\n//implementation 'com.clevertap.android:clevertap-hms-sdk:1.0.0'\n//implementation 'com.huawei.hms:push:5.0.0.300'\n- implementation 'com.google.android.gms:play-services-location:17.0.0'// Needed for geofence\n- implementation 'androidx.work:work-runtime:2.3.4'// Needed for geofence\n- implementation 'androidx.concurrent:concurrent-futures:1.0.0'// Needed for geofence\n+ implementation 'com.google.android.gms:play-services-location:18.0.0'// Needed for geofence\n+ implementation 'androidx.work:work-runtime:2.7.0-rc01'// Needed for geofence\n+ implementation 'androidx.concurrent:concurrent-futures:1.1.0'// Needed for geofence\nimplementation 'com.google.firebase:firebase-messaging:20.2.4' //Needed for FCM\nimplementation 'com.google.android.gms:play-services-ads:19.4.0' //Needed to use Google Ad Ids\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-sample_app): Update dependencies to support pending intent mutability SDK-1114
116,612
14.10.2021 12:21:02
-19,080
0e2ee8c3b3b7783875565df9be131025423d4d1a
task(android12_support-sample_app): Update kotlin-gradle-dependency for androidx.work compilation
[ { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenViewModel.kt", "new_path": "sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenViewModel.kt", "diff": "@@ -29,22 +29,22 @@ class HomeScreenViewModel(private val cleverTapAPI: CleverTapAPI?) : ViewModel()\n}\n\"02\" -> {\n//Record a Charged (Transactional) event\n- val chargeDetails = hashMapOf(\n+ val chargeDetails = hashMapOf<String, Any>(\n\"Amount\" to 300, \"Payment Mode\" to \"Credit card\",\n\"Charged ID\" to 24052013\n)\n- val item1 = hashMapOf(\n+ val item1 = hashMapOf<String, Any>(\n\"Product category\" to \"books\",\n\"Book name\" to \"The Millionaire next door\", \"Quantity\" to 1\n)\n- val item2 = hashMapOf(\n+ val item2 = hashMapOf<String, Any>(\n\"Product category\" to \"books\",\n\"Book name\" to \"Achieving inner zen\", \"Quantity\" to 1\n)\n- val item3 = hashMapOf(\n+ val item3 = hashMapOf<String, Any>(\n\"Product category\" to \"books\",\n\"Book name\" to \"Chuck it, let's do it\", \"Quantity\" to 5\n)\n@@ -255,7 +255,7 @@ class HomeScreenViewModel(private val cleverTapAPI: CleverTapAPI?) : ViewModel()\n} ?: println(\"DisplayUnit Id is null\")\n}\n\"40\" -> {\n- val hashMap = hashMapOf(\n+ val hashMap = hashMapOf<String, Any>(\n\"text color\" to \"red\", \"msg count\" to 100, \"price\" to 100.50, \"is shown\" to true,\n\"json\" to \"\"\"{\"key\":\"val\",\"key2\":50}\"\"\"\n)\n" }, { "change_type": "MODIFY", "old_path": "versions.properties", "new_path": "versions.properties", "diff": "@@ -126,7 +126,7 @@ version.junit=5.7.2\n### available=5.8.0-RC1\n### available=5.8.0\n### available=5.8.1\n-version.kotlin=1.3.72\n+version.kotlin=1.5.31\n## # available=1.4.0-rc\n## # available=1.4.0\n## # available=1.4.10\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-sample_app): Update kotlin-gradle-dependency for androidx.work compilation SDK-1114
116,612
14.10.2021 14:49:44
-19,080
2b2c11b853568ecbea0f3399488d670a72b37e19
task(android12_support): Update flags to support PendingIntent mutability
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "diff": "@@ -25,6 +25,7 @@ import android.graphics.Color;\nimport android.media.RingtoneManager;\nimport android.net.Uri;\nimport android.os.Build;\n+import android.os.Build.VERSION;\nimport android.os.Bundle;\nimport android.os.SystemClock;\nimport android.text.TextUtils;\n@@ -946,8 +947,13 @@ public class PushProviders implements CTPushProviderListener {\n// Take all the properties from the notif and add it to the intent\nlaunchIntent.putExtras(extras);\nlaunchIntent.removeExtra(Constants.WZRK_ACTIONS);\n+ int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n+ if (VERSION.SDK_INT >= 23)//Android M\n+ {\n+ flagsLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n+ }\npIntent = PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n- launchIntent, PendingIntent.FLAG_UPDATE_CURRENT);\n+ launchIntent, flagsLaunchPendingIntent);\nNotificationCompat.Style style;\nString bigPictureUrl = extras.getString(Constants.WZRK_BIG_PICTURE);\n@@ -1216,12 +1222,17 @@ public class PushProviders implements CTPushProviderListener {\nPendingIntent actionIntent;\nint requestCode = ((int) System.currentTimeMillis()) + i;\n+ int flagsActionLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n+ if (VERSION.SDK_INT >= 23)//Android M\n+ {\n+ flagsActionLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n+ }\nif (sendToCTIntentService) {\nactionIntent = PendingIntent.getService(context, requestCode,\n- actionLaunchIntent, PendingIntent.FLAG_UPDATE_CURRENT);\n+ actionLaunchIntent, flagsActionLaunchPendingIntent);\n} else {\nactionIntent = PendingIntent.getActivity(context, requestCode,\n- actionLaunchIntent, PendingIntent.FLAG_UPDATE_CURRENT);\n+ actionLaunchIntent, flagsActionLaunchPendingIntent);\n}\nnb.addAction(icon, label, actionIntent);\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support): Update flags to support PendingIntent mutability SDK-1111
116,616
15.10.2021 11:13:56
-19,080
3f07edffda246863d6942b9f062f507cf901bb4e
task(SDK-1117) - Add getMetrics() equivalent using WindowMetrics for API30 and above
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/DeviceInfo.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/DeviceInfo.java", "diff": "@@ -9,12 +9,15 @@ import android.content.pm.ApplicationInfo;\nimport android.content.pm.PackageInfo;\nimport android.content.pm.PackageManager;\nimport android.content.res.Configuration;\n+import android.graphics.Insets;\nimport android.net.ConnectivityManager;\nimport android.net.NetworkInfo;\nimport android.os.Build;\nimport android.telephony.TelephonyManager;\nimport android.util.DisplayMetrics;\n+import android.view.WindowInsets;\nimport android.view.WindowManager;\n+import android.view.WindowMetrics;\nimport androidx.annotation.IntDef;\nimport androidx.annotation.RestrictTo;\nimport androidx.annotation.RestrictTo.Scope;\n@@ -147,20 +150,53 @@ public class DeviceInfo {\nif (wm == null) {\nreturn 0;\n}\n+ //Returns the dpi using Device Configuration API for API30 above\n+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {\n+ Configuration configuration = context.getResources().getConfiguration();\n+ Logger.d(\"DeviceInfo-getDPI()\", \"dpi-> \" + configuration.densityDpi);\n+ return configuration.densityDpi;\n+ }else {\nDisplayMetrics dm = new DisplayMetrics();\nwm.getDefaultDisplay().getMetrics(dm);\n+ Logger.d(\"DeviceInfo-getDPI()\", \"dpi-> \" + dm.densityDpi);\nreturn dm.densityDpi;\n}\n+ }\nprivate double getHeight() {\n+ int height;\n+ float dpi;\n+\nWindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);\nif (wm == null) {\nreturn 0.0;\n}\n+\n+ //Returns height using WindowMetrics API for API30 above\n+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {\n+ WindowMetrics windowMetrics = wm.getCurrentWindowMetrics();\n+ Configuration configuration = context.getResources().getConfiguration();\n+ Insets insets = windowMetrics.getWindowInsets()\n+ .getInsetsIgnoringVisibility(WindowInsets.Type.systemGestures());\n+\n+ height = windowMetrics.getBounds().height() -\n+ insets.top - insets.bottom;\n+\n+ dpi = configuration.densityDpi;\n+\n+ }else {\nDisplayMetrics dm = new DisplayMetrics();\nwm.getDefaultDisplay().getMetrics(dm);\n- // Calculate the height in inches\n- double rHeight = dm.heightPixels / dm.ydpi;\n+\n+ height = dm.heightPixels;\n+ dpi = dm.ydpi;\n+ }\n+ // Calculate the width in inches\n+ double rHeight = height / dpi;\n+ Logger.d(\"DeviceInfo-getHeight()\", \"dm.heightPixels-> \" + height);\n+ Logger.d(\"DeviceInfo-getHeight()\", \"dpi-> \" + dpi);\n+ Logger.d(\"DeviceInfo-getHeight()\", \"rHeight-> \" + rHeight);\n+ Logger.d(\"DeviceInfo-getHeight()\", \"toTwoPlaces(rHeight)-> \" + toTwoPlaces(rHeight));\nreturn toTwoPlaces(rHeight);\n}\n@@ -169,10 +205,22 @@ public class DeviceInfo {\nif (wm == null) {\nreturn 0;\n}\n+ //Returns height in pixels using WindowMetrics API for API30 above\n+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {\n+ WindowMetrics windowMetrics = wm.getCurrentWindowMetrics();\n+ Insets insets = windowMetrics.getWindowInsets()\n+ .getInsetsIgnoringVisibility( WindowInsets.Type.systemGestures());\n+ int heightInPixel = windowMetrics.getBounds().height() -\n+ insets.top - insets.bottom;\n+ Logger.d(\"DeviceInfo-getHeight()\", \"getHeightPixels()-> \" + heightInPixel);\n+ return heightInPixel;\n+ }else {\nDisplayMetrics dm = new DisplayMetrics();\nwm.getDefaultDisplay().getMetrics(dm);\n+ Logger.d(\"DeviceInfo-getHeight()\", \"getHeightPixels()-> \" + dm.heightPixels);\nreturn dm.heightPixels;\n}\n+ }\nprivate String getManufacturer() {\nreturn Build.MANUFACTURER;\n@@ -224,14 +272,38 @@ public class DeviceInfo {\n}\nprivate double getWidth() {\n+ int width;\n+ float dpi;\n+\nWindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);\nif (wm == null) {\nreturn 0.0;\n}\n+\n+ //Returns width using WindowMetrics API for API30 above\n+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {\n+ WindowMetrics windowMetrics = wm.getCurrentWindowMetrics();\n+ Configuration configuration = context.getResources().getConfiguration();\n+ Insets insets = windowMetrics.getWindowInsets()\n+ .getInsetsIgnoringVisibility(WindowInsets.Type.systemGestures());\n+ width = windowMetrics.getBounds().width() -\n+ insets.right - insets.left;\n+\n+ dpi = configuration.densityDpi;\n+\n+ }else {\nDisplayMetrics dm = new DisplayMetrics();\nwm.getDefaultDisplay().getMetrics(dm);\n+\n+ width = dm.widthPixels;\n+ dpi = dm.xdpi;\n+ }\n// Calculate the width in inches\n- double rWidth = dm.widthPixels / dm.xdpi;\n+ double rWidth = width / dpi;\n+ Logger.d(\"DeviceInfo-getWidth()\", \"dm.widthPixels-> \" + width);\n+ Logger.d(\"DeviceInfo-getWidth()\", \"dpi-> \" + dpi);\n+ Logger.d(\"DeviceInfo-getWidth()\", \"rWidth-> \" + rWidth);\n+ Logger.d(\"DeviceInfo-getWidth()\", \"toTwoPlaces(rWidth)-> \" + toTwoPlaces(rWidth));\nreturn toTwoPlaces(rWidth);\n}\n@@ -241,10 +313,22 @@ public class DeviceInfo {\nif (wm == null) {\nreturn 0;\n}\n+ //Returns width in pixels using WindowMetrics API for API30 above\n+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {\n+ WindowMetrics windowMetrics = wm.getCurrentWindowMetrics();\n+ Insets insets = windowMetrics.getWindowInsets()\n+ .getInsetsIgnoringVisibility(WindowInsets.Type.systemGestures());\n+ int widthInPixel = windowMetrics.getBounds().width() -\n+ insets.right - insets.left;\n+ Logger.d(\"DeviceInfo-getWidth()\", \"getWidthPixels()-> \" + widthInPixel);\n+ return widthInPixel;\n+ }else {\nDisplayMetrics dm = new DisplayMetrics();\nwm.getDefaultDisplay().getMetrics(dm);\n+ Logger.d(\"DeviceInfo-getWidth()\", \"getWidthPixels()-> \" + dm.widthPixels);\nreturn dm.widthPixels;\n}\n+ }\nprivate double toTwoPlaces(double n) {\ndouble result = n * 100;\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/inapp/CTInAppBaseFullNativeFragment.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/inapp/CTInAppBaseFullNativeFragment.java", "diff": "package com.clevertap.android.sdk.inapp;\nimport android.content.Context;\n+import android.content.res.Configuration;\nimport android.graphics.Color;\nimport android.graphics.Paint;\nimport android.graphics.drawable.Drawable;\nimport android.graphics.drawable.LayerDrawable;\nimport android.graphics.drawable.ShapeDrawable;\nimport android.graphics.drawable.shapes.RoundRectShape;\n+import android.os.Build;\nimport android.util.DisplayMetrics;\nimport android.view.View;\nimport android.view.WindowManager;\nimport android.widget.Button;\n+import com.clevertap.android.sdk.Logger;\n+\npublic abstract class CTInAppBaseFullNativeFragment extends CTInAppBaseFullFragment {\nint getDPI() {\n@@ -19,10 +23,18 @@ public abstract class CTInAppBaseFullNativeFragment extends CTInAppBaseFullFragm\nif (wm == null) {\nreturn 0;\n}\n+ //Returns the dpi using Device Configuration API for API30 above\n+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {\n+ Configuration configuration = context.getResources().getConfiguration();\n+ Logger.d(\"DeviceInfo-getDPI()\", \"dpi-> \" + configuration.densityDpi);\n+ return configuration.densityDpi;\n+ }else {\nDisplayMetrics dm = new DisplayMetrics();\nwm.getDefaultDisplay().getMetrics(dm);\n+ Logger.d(\"DeviceInfo-getDPI()\", \"dpi-> \" + dm.densityDpi);\nreturn dm.densityDpi;\n}\n+ }\nvoid setupInAppButton(Button inAppButton, final CTInAppNotificationButton inAppNotificationButton,\nfinal int buttonIndex) {\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1117) - Add getMetrics() equivalent using WindowMetrics for API30 and above
116,612
18.10.2021 15:05:41
-19,080
3191ab8d8a47fa80d89f580f1563c043c5f54ec8
task(android12_support-core_sdk): Update exoplayer dependencies to support pending intent mutability
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/customviews/MediaPlayerRecyclerView.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/customviews/MediaPlayerRecyclerView.java", "diff": "@@ -18,15 +18,11 @@ import androidx.recyclerview.widget.RecyclerView;\nimport com.clevertap.android.sdk.R;\nimport com.clevertap.android.sdk.inbox.CTInboxActivity;\nimport com.clevertap.android.sdk.inbox.CTInboxBaseMessageViewHolder;\n-import com.google.android.exoplayer2.ExoPlaybackException;\n-import com.google.android.exoplayer2.PlaybackParameters;\nimport com.google.android.exoplayer2.Player;\nimport com.google.android.exoplayer2.SimpleExoPlayer;\n-import com.google.android.exoplayer2.source.TrackGroupArray;\nimport com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;\nimport com.google.android.exoplayer2.trackselection.DefaultTrackSelector;\n-import com.google.android.exoplayer2.trackselection.TrackSelection;\n-import com.google.android.exoplayer2.trackselection.TrackSelectionArray;\n+import com.google.android.exoplayer2.trackselection.ExoTrackSelection;\nimport com.google.android.exoplayer2.trackselection.TrackSelector;\nimport com.google.android.exoplayer2.ui.AspectRatioFrameLayout;\nimport com.google.android.exoplayer2.ui.PlayerView;\n@@ -187,7 +183,7 @@ public class MediaPlayerRecyclerView extends RecyclerView {\nDrawable artwork = ResourcesCompat.getDrawable(context.getResources(), R.drawable.ct_audio, null);\nvideoSurfaceView.setDefaultArtwork(artwork);\n- TrackSelection.Factory videoTrackSelectionFactory =\n+ ExoTrackSelection.Factory videoTrackSelectionFactory =\nnew AdaptiveTrackSelection.Factory();\nTrackSelector trackSelector =\nnew DefaultTrackSelector(appContext, videoTrackSelectionFactory);\n@@ -225,21 +221,9 @@ public class MediaPlayerRecyclerView extends RecyclerView {\n}\n}\n});\n- player.addListener(new Player.EventListener() {\n+ player.addListener(new Player.Listener() {\n@Override\n- public void onLoadingChanged(boolean isLoading) {\n- }\n-\n- @Override\n- public void onPlaybackParametersChanged(@NonNull PlaybackParameters playbackParameters) {\n- }\n-\n- @Override\n- public void onPlayerError(@NonNull ExoPlaybackException error) {\n- }\n-\n- @Override\n- public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {\n+ public void onPlaybackStateChanged(final int playbackState) {\nswitch (playbackState) {\ncase Player.STATE_BUFFERING:\nif (playingHolder != null) {\n@@ -265,26 +249,6 @@ public class MediaPlayerRecyclerView extends RecyclerView {\nbreak;\n}\n}\n-\n- @Override\n- public void onPositionDiscontinuity(int reason) {\n- }\n-\n- @Override\n- public void onRepeatModeChanged(int repeatMode) {\n- }\n-\n- @Override\n- public void onSeekProcessed() {\n- }\n-\n- @Override\n- public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {\n- }\n-\n- @Override\n- public void onTracksChanged(@NonNull TrackGroupArray trackGroups, @NonNull TrackSelectionArray trackSelections) {\n- }\n});\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/inapp/CTInAppNativeInterstitialFragment.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/inapp/CTInAppNativeInterstitialFragment.java", "diff": "@@ -37,7 +37,7 @@ import com.google.android.exoplayer2.SimpleExoPlayer;\nimport com.google.android.exoplayer2.source.hls.HlsMediaSource;\nimport com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;\nimport com.google.android.exoplayer2.trackselection.DefaultTrackSelector;\n-import com.google.android.exoplayer2.trackselection.TrackSelection;\n+import com.google.android.exoplayer2.trackselection.ExoTrackSelection;\nimport com.google.android.exoplayer2.trackselection.TrackSelector;\nimport com.google.android.exoplayer2.ui.PlayerView;\nimport com.google.android.exoplayer2.upstream.BandwidthMeter;\n@@ -420,7 +420,7 @@ public class CTInAppNativeInterstitialFragment extends CTInAppBaseFullNativeFrag\n// 1. Create a default TrackSelector\nBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter.Builder(this.context).build();\n- TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory();\n+ ExoTrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory();\nTrackSelector trackSelector = new DefaultTrackSelector(this.context,\nvideoTrackSelectionFactory);\n// 2. Create the player\n" }, { "change_type": "MODIFY", "old_path": "versions.properties", "new_path": "versions.properties", "diff": "@@ -326,7 +326,7 @@ version.com.clevertap.android..clevertap-hms-sdk=1.0.2\nversion.com.clevertap.android..clevertap-xiaomi-sdk=1.0.2\nversion.com.github.bumptech.glide..glide=4.11.0\n## # available=4.12.0\n-version.com.google.android.exoplayer..exoplayer=2.11.5\n+version.com.google.android.exoplayer..exoplayer=2.15.1\n## # available=2.11.6\n## # available=2.11.7\n## # available=2.11.8\n@@ -343,7 +343,7 @@ version.com.google.android.exoplayer..exoplayer=2.11.5\n## # available=2.14.2\n## # available=2.15.0\n## # available=2.15.1\n-version.com.google.android.exoplayer..exoplayer-hls=2.11.5\n+version.com.google.android.exoplayer..exoplayer-hls=2.15.1\n## # available=2.11.6\n## # available=2.11.7\n## # available=2.11.8\n@@ -360,7 +360,7 @@ version.com.google.android.exoplayer..exoplayer-hls=2.11.5\n## # available=2.14.2\n## # available=2.15.0\n## # available=2.15.1\n-version.com.google.android.exoplayer..exoplayer-ui=2.11.5\n+version.com.google.android.exoplayer..exoplayer-ui=2.15.1\n## # available=2.11.6\n## # available=2.11.7\n## # available=2.11.8\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-core_sdk): Update exoplayer dependencies to support pending intent mutability SDK-1111
116,612
18.10.2021 15:06:55
-19,080
e6f84c309d814e1c0ec5c07d65a95e12f3306a94
task(android12_support-sample_app): Update exoplayer dependencies to support pending intent mutability
[ { "change_type": "MODIFY", "old_path": "sample/build.gradle", "new_path": "sample/build.gradle", "diff": "@@ -70,9 +70,9 @@ dependencies {\nimplementation 'com.google.firebase:firebase-messaging:20.2.4' //Needed for FCM\nimplementation 'com.google.android.gms:play-services-ads:19.4.0' //Needed to use Google Ad Ids\n//ExoPlayer Libraries for Audio/Video InApp Notifications\n- implementation 'com.google.android.exoplayer:exoplayer:2.11.5'\n- implementation 'com.google.android.exoplayer:exoplayer-hls:2.11.5'\n- implementation 'com.google.android.exoplayer:exoplayer-ui:2.11.5'\n+ implementation 'com.google.android.exoplayer:exoplayer:2.15.1'\n+ implementation 'com.google.android.exoplayer:exoplayer-hls:2.15.1'\n+ implementation 'com.google.android.exoplayer:exoplayer-ui:2.15.1'\nimplementation 'com.github.bumptech.glide:glide:4.11.0'\n//Mandatory if you are using Notification Inbox\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/HomeScreenActivity.kt", "new_path": "sample/src/main/java/com/clevertap/demo/HomeScreenActivity.kt", "diff": "@@ -7,7 +7,7 @@ import androidx.fragment.app.commitNow\nimport com.clevertap.android.sdk.CTFeatureFlagsListener\nimport com.clevertap.android.sdk.CTInboxListener\nimport com.clevertap.android.sdk.CleverTapAPI\n-import com.clevertap.android.sdk.CleverTapAPI.LogLevel.DEBUG\n+import com.clevertap.android.sdk.CleverTapAPI.LogLevel.VERBOSE\nimport com.clevertap.android.sdk.SyncListener\nimport com.clevertap.android.sdk.displayunits.DisplayUnitListener\nimport com.clevertap.android.sdk.displayunits.model.CleverTapDisplayUnit\n@@ -38,7 +38,7 @@ class HomeScreenActivity : AppCompatActivity(), CTInboxListener, DisplayUnitList\nprivate fun initCleverTap() {\n//Set Debug level for CleverTap\n- CleverTapAPI.setDebugLevel(DEBUG)\n+ CleverTapAPI.setDebugLevel(VERBOSE)\n//Create CleverTap's default instance\ncleverTapDefaultInstance = CleverTapAPI.getDefaultInstance(this)\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenViewModel.kt", "new_path": "sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenViewModel.kt", "diff": "@@ -26,6 +26,8 @@ class HomeScreenViewModel(private val cleverTapAPI: CleverTapAPI?) : ViewModel()\n\"Category\" to \"Mens Accessories\", \"Price\" to 59.99, \"Date\" to Date()\n)\ncleverTapAPI?.pushEvent(\"Product viewed\", prodViewedAction)\n+ cleverTapAPI?.pushEvent(\"video-inapp\")\n+ cleverTapAPI?.pushEvent(\"video-inbox\")\n}\n\"02\" -> {\n//Record a Charged (Transactional) event\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-sample_app): Update exoplayer dependencies to support pending intent mutability SDK-1114
116,612
19.10.2021 14:26:16
-19,080
4acbd52a97273981b0a528d970ade13872651081
task(android12_support-core_sdk): Update glide dependency
[ { "change_type": "MODIFY", "old_path": "clevertap-core/build.gradle", "new_path": "clevertap-core/build.gradle", "diff": "@@ -15,7 +15,7 @@ ext {\napply from: \"../gradle-scripts/commons.gradle\"\ndependencies {\n- compileOnly Libs.firebase_messaging\n+ compileOnly Libs.firebase_messaging//TODO update\ncompileOnly Libs.exoplayer\ncompileOnly Libs.exoplayer_hls\ncompileOnly Libs.exoplayer_ui\n" }, { "change_type": "MODIFY", "old_path": "versions.properties", "new_path": "versions.properties", "diff": "@@ -324,7 +324,7 @@ version.com.clevertap.android..clevertap-android-sdk=4.2.0\nversion.com.clevertap.android..clevertap-geofence-sdk=1.0.2\nversion.com.clevertap.android..clevertap-hms-sdk=1.0.2\nversion.com.clevertap.android..clevertap-xiaomi-sdk=1.0.2\n-version.com.github.bumptech.glide..glide=4.11.0\n+version.com.github.bumptech.glide..glide=4.12.0\n## # available=4.12.0\nversion.com.google.android.exoplayer..exoplayer=2.15.1\n## # available=2.11.6\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-core_sdk): Update glide dependency SDK-1111
116,612
19.10.2021 14:26:52
-19,080
a99feb9eba059c720ab93032197e34a122a4fd9a
task(android12_support-sample_app): Update glide dependency
[ { "change_type": "MODIFY", "old_path": "sample/build.gradle", "new_path": "sample/build.gradle", "diff": "@@ -73,7 +73,7 @@ dependencies {\nimplementation 'com.google.android.exoplayer:exoplayer:2.15.1'\nimplementation 'com.google.android.exoplayer:exoplayer-hls:2.15.1'\nimplementation 'com.google.android.exoplayer:exoplayer-ui:2.15.1'\n- implementation 'com.github.bumptech.glide:glide:4.11.0'\n+ implementation 'com.github.bumptech.glide:glide:4.12.0'\n//Mandatory if you are using Notification Inbox\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenViewModel.kt", "new_path": "sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenViewModel.kt", "diff": "@@ -26,8 +26,10 @@ class HomeScreenViewModel(private val cleverTapAPI: CleverTapAPI?) : ViewModel()\n\"Category\" to \"Mens Accessories\", \"Price\" to 59.99, \"Date\" to Date()\n)\ncleverTapAPI?.pushEvent(\"Product viewed\", prodViewedAction)\n- cleverTapAPI?.pushEvent(\"video-inapp\")\n- cleverTapAPI?.pushEvent(\"video-inbox\")\n+ //cleverTapAPI?.pushEvent(\"video-inapp\")\n+ //cleverTapAPI?.pushEvent(\"video-inbox\")\n+ cleverTapAPI?.pushEvent(\"caurousel-inapp\")\n+ cleverTapAPI?.pushEvent(\"icon-inbox\")\n}\n\"02\" -> {\n//Record a Charged (Transactional) event\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-sample_app): Update glide dependency SDK-1114
116,612
19.10.2021 14:45:11
-19,080
2350761806e9353a369174934d64bb28e53a86c1
task(android12_support-core_sdk): Update androidx.core and androidx.core-ktx dependency
[ { "change_type": "MODIFY", "old_path": "versions.properties", "new_path": "versions.properties", "diff": "@@ -198,7 +198,7 @@ version.androidx.concurrent=1.1.0\n## # available=1.1.0\nversion.androidx.constraintlayout=2.0.1\nversion.androidx.coordinatorlayout=1.1.0\n-version.androidx.core=1.3.0\n+version.androidx.core=1.6.0\n## # available=1.3.1\n## # available=1.3.2\n## # available=1.4.0-alpha01\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-core_sdk): Update androidx.core and androidx.core-ktx dependency SDK-1111
116,612
19.10.2021 14:45:47
-19,080
7174b604245bd413fec399042b9c603b178557de
task(android12_support-sample_app): Update androidx.core dependency
[ { "change_type": "MODIFY", "old_path": "sample/build.gradle", "new_path": "sample/build.gradle", "diff": "@@ -40,7 +40,7 @@ android {\ndependencies {\ndef lifecycle_version = \"2.2.0\"\n- implementation 'androidx.core:core:1.3.0'\n+ implementation 'androidx.core:core:1.6.0'\nimplementation 'androidx.constraintlayout:constraintlayout:2.0.1'\nimplementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'\nimplementation \"org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72\"\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-sample_app): Update androidx.core dependency SDK-1114
116,612
19.10.2021 14:51:15
-19,080
05536c2d4f178233f4670fdd8a584bf34a02b703
task(android12_support-core_sdk): Update androidx.viewpager dependency
[ { "change_type": "MODIFY", "old_path": "versions.properties", "new_path": "versions.properties", "diff": "@@ -287,7 +287,7 @@ version.androidx.recyclerview=1.1.0\n## # available=1.2.0\n## # available=1.2.1\n## # available=1.3.0-alpha01\n-version.androidx.viewpager=1.0.0\n+version.androidx.viewpager=1.1.0-alpha01\n## # available=1.1.0-alpha01\nversion.androidx.work=2.7.0-rc01\n## # available=2.4.0-alpha01\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-core_sdk): Update androidx.viewpager dependency SDK-1111
116,612
19.10.2021 14:56:35
-19,080
66fee00f7238cd597fa7cb52fa75c216f95f97f9
task(android12_support-sample_app): Update androidx.viewpager dependency
[ { "change_type": "MODIFY", "old_path": "sample/build.gradle", "new_path": "sample/build.gradle", "diff": "@@ -81,7 +81,7 @@ dependencies {\nimplementation 'androidx.fragment:fragment:1.2.5'\nimplementation 'androidx.appcompat:appcompat:1.2.0'\nimplementation 'androidx.recyclerview:recyclerview:1.1.0'\n- implementation 'androidx.viewpager:viewpager:1.0.0'\n+ implementation 'androidx.viewpager:viewpager:1.1.0-alpha01'\nimplementation 'com.android.installreferrer:installreferrer:2.1'\n// Mandatory for v3.6.4 and above\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-sample_app): Update androidx.viewpager dependency SDK-1114
116,612
19.10.2021 16:06:47
-19,080
8800d8ab0acf8936b5ed6e7fa48cc158f935b8be
task(android12_support-core_sdk): Update appcompat,fragment,recyclerview,material dependencies and downgrade androidx.core, viewpager dependency
[ { "change_type": "MODIFY", "old_path": "versions.properties", "new_path": "versions.properties", "diff": "@@ -180,7 +180,7 @@ version.androidx.annotation=1.1.0\n## # available=1.2.0\n## # available=1.3.0-alpha01\n## # available=1.3.0-beta01\n-version.androidx.appcompat=1.2.0\n+version.androidx.appcompat=1.3.1\n## # available=1.3.0-alpha01\n## # available=1.3.0-alpha02\n## # available=1.3.0-beta01\n@@ -198,7 +198,7 @@ version.androidx.concurrent=1.1.0\n## # available=1.1.0\nversion.androidx.constraintlayout=2.0.1\nversion.androidx.coordinatorlayout=1.1.0\n-version.androidx.core=1.6.0\n+version.androidx.core=1.3.0\n## # available=1.3.1\n## # available=1.3.2\n## # available=1.4.0-alpha01\n@@ -225,7 +225,7 @@ version.androidx.core=1.6.0\n## # available=1.7.0-beta01\n## # available=1.7.0-beta02\nversion.androidx.databinding=4.2.1\n-version.androidx.fragment=1.1.0\n+version.androidx.fragment=1.3.6\n## # available=1.2.0-alpha01\n## # available=1.2.0-alpha02\n## # available=1.2.0-alpha03\n@@ -274,7 +274,7 @@ version.androidx.fragment=1.1.0\n## # available=1.4.0-alpha10\nversion.androidx.lifecycle=2.2.0\nversion.androidx.multidex=2.0.1\n-version.androidx.recyclerview=1.1.0\n+version.androidx.recyclerview=1.2.1\n## # available=1.2.0-alpha01\n## # available=1.2.0-alpha02\n## # available=1.2.0-alpha03\n@@ -287,7 +287,7 @@ version.androidx.recyclerview=1.1.0\n## # available=1.2.0\n## # available=1.2.1\n## # available=1.3.0-alpha01\n-version.androidx.viewpager=1.1.0-alpha01\n+version.androidx.viewpager=1.0.0\n## # available=1.1.0-alpha01\nversion.androidx.work=2.7.0-rc01\n## # available=2.4.0-alpha01\n@@ -383,7 +383,7 @@ version.firebase-messaging=20.2.4\n## # available=21.0.1\n## # available=21.1.0\n## # available=22.0.0\n-version.google.android.material=1.2.1\n+version.google.android.material=1.4.0\n## # available=1.3.0-alpha01\n## # available=1.3.0-alpha02\n## # available=1.3.0-alpha03\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-core_sdk): Update appcompat,fragment,recyclerview,material dependencies and downgrade androidx.core, viewpager dependency SDK-1111
116,612
19.10.2021 16:07:14
-19,080
ef18a51fcf6a08f53f292b7e5f3a0a05e01e07f9
task(android12_support-sample_app): Update appcompat,fragment,recyclerview,material dependencies and downgrade androidx.core, viewpager dependency
[ { "change_type": "MODIFY", "old_path": "sample/build.gradle", "new_path": "sample/build.gradle", "diff": "@@ -40,7 +40,7 @@ android {\ndependencies {\ndef lifecycle_version = \"2.2.0\"\n- implementation 'androidx.core:core:1.6.0'\n+ implementation 'androidx.core:core:1.3.0'\nimplementation 'androidx.constraintlayout:constraintlayout:2.0.1'\nimplementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'\nimplementation \"org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72\"\n@@ -77,11 +77,11 @@ dependencies {\n//Mandatory if you are using Notification Inbox\n- implementation 'com.google.android.material:material:1.2.1'\n- implementation 'androidx.fragment:fragment:1.2.5'\n- implementation 'androidx.appcompat:appcompat:1.2.0'\n- implementation 'androidx.recyclerview:recyclerview:1.1.0'\n- implementation 'androidx.viewpager:viewpager:1.1.0-alpha01'\n+ implementation 'com.google.android.material:material:1.4.0'\n+ implementation 'androidx.fragment:fragment:1.3.6'\n+ implementation 'androidx.appcompat:appcompat:1.3.1'\n+ implementation 'androidx.recyclerview:recyclerview:1.2.1'\n+ implementation 'androidx.viewpager:viewpager:1.0.0'\nimplementation 'com.android.installreferrer:installreferrer:2.1'\n// Mandatory for v3.6.4 and above\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-sample_app): Update appcompat,fragment,recyclerview,material dependencies and downgrade androidx.core, viewpager dependency SDK-1114
116,612
19.10.2021 16:19:24
-19,080
b776f02bfa4823801b8890d8e449523da9814056
task(android12_support-core_sdk): Update install referrer dependency
[ { "change_type": "MODIFY", "old_path": "clevertap-core/build.gradle", "new_path": "clevertap-core/build.gradle", "diff": "@@ -21,8 +21,8 @@ dependencies {\ncompileOnly Libs.exoplayer_ui\ncompileOnly Libs.glide\n//for notification\n- compileOnly Libs.androidx_core_core\n- compileOnly Libs.viewpager\n+ compileOnly Libs.androidx_core_core//TODO update-conflict with firebase\n+ compileOnly Libs.viewpager//TODO update-conflict with latest core\nimplementation Libs.appcompat\nimplementation Libs.recyclerview\ncompileOnly Libs.material\n" }, { "change_type": "MODIFY", "old_path": "versions.properties", "new_path": "versions.properties", "diff": "@@ -316,7 +316,7 @@ version.androidx.work=2.7.0-rc01\n## # available=2.7.0-alpha05\n## # available=2.7.0-beta01\n## # available=2.7.0-rc01\n-version.com.android.installreferrer..installreferrer=2.1\n+version.com.android.installreferrer..installreferrer=2.2\n## # available=2.2\nversion.com.android.tools.lint..lint-api=27.0.1\nversion.com.android.tools.lint..lint-checks=27.0.1\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-core_sdk): Update install referrer dependency SDK-1111
116,612
19.10.2021 16:19:40
-19,080
a96c6843edf003f65352653cfb41f02e5d67aadb
task(android12_support-sample_app): Update install referrer dependency
[ { "change_type": "MODIFY", "old_path": "sample/build.gradle", "new_path": "sample/build.gradle", "diff": "@@ -83,7 +83,7 @@ dependencies {\nimplementation 'androidx.recyclerview:recyclerview:1.2.1'\nimplementation 'androidx.viewpager:viewpager:1.0.0'\n- implementation 'com.android.installreferrer:installreferrer:2.1'\n+ implementation 'com.android.installreferrer:installreferrer:2.2'\n// Mandatory for v3.6.4 and above\nimplementation 'androidx.multidex:multidex:2.0.1'\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-sample_app): Update install referrer dependency SDK-1114
116,612
19.10.2021 16:26:44
-19,080
1f67174b42f40df1e9cca076dfb1c45442a70392
task(android12_support-core_sdk): Update androidx.annotation dependency
[ { "change_type": "MODIFY", "old_path": "buildSrc/src/main/kotlin/Libs.kt", "new_path": "buildSrc/src/main/kotlin/Libs.kt", "diff": "@@ -59,7 +59,7 @@ object Libs {\nconst val viewpager: String = \"androidx.viewpager:viewpager:_\"\n- const val work_runtime: String = \"androidx.work:work-runtime:_\"\n+ const val work_runtime: String = \"androidx.work:work-runtime:_\"//TODO check RC version\nconst val work_testing: String = \"androidx.work:work-testing:_\"\n" }, { "change_type": "MODIFY", "old_path": "versions.properties", "new_path": "versions.properties", "diff": "@@ -173,7 +173,7 @@ version.org.powermock..powermock-module-junit4=2.0.9\nversion.org.powermock..powermock-module-junit4-rule=2.0.9\nversion.org.skyscreamer..jsonassert=1.5.0\nversion.org.sonarsource.scanner.gradle..sonarqube-gradle-plugin=3.3\n-version.androidx.annotation=1.1.0\n+version.androidx.annotation=1.2.0\n## # available=1.2.0-alpha01\n## # available=1.2.0-beta01\n## # available=1.2.0-rc01\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-core_sdk): Update androidx.annotation dependency SDK-1111
116,612
19.10.2021 16:57:56
-19,080
cb81bb0f6460aeb60898f047a3a969e0640b3a17
task(android12_support-sample_app): Update constraintlayout,androidx.lifecycle,fragment-ktx,kotlin-stdlib-jdk8 dependencies
[ { "change_type": "MODIFY", "old_path": "sample/build.gradle", "new_path": "sample/build.gradle", "diff": "@@ -38,16 +38,16 @@ android {\n}\ndependencies {\n- def lifecycle_version = \"2.2.0\"\n+ def lifecycle_version = \"2.3.1\"\nimplementation 'androidx.core:core:1.3.0'\n- implementation 'androidx.constraintlayout:constraintlayout:2.0.1'\n+ implementation 'androidx.constraintlayout:constraintlayout:2.1.1'\nimplementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'\n- implementation \"org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72\"\n+ implementation \"org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31\"\n// LiveData\nimplementation \"androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version\"\nimplementation \"androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version\"\n- implementation \"androidx.fragment:fragment-ktx:1.2.5\"\n+ implementation \"androidx.fragment:fragment-ktx:1.3.6\"\ntestImplementation 'junit:junit:4.13'\n//CleverTap Android SDK, make sure the AAR file is in the libs folder\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-sample_app): Update constraintlayout,androidx.lifecycle,fragment-ktx,kotlin-stdlib-jdk8 dependencies SDK-1114
116,612
21.10.2021 11:19:34
-19,080
5019acb6156156fdf952fa15e41a3e4a6cd3aa37
task(sample_app): add CTPushNotificationListener
[ { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/MyApplication.kt", "new_path": "sample/src/main/java/com/clevertap/demo/MyApplication.kt", "diff": "package com.clevertap.demo\nimport android.app.NotificationManager\n+import android.util.Log\nimport androidx.multidex.MultiDexApplication\nimport com.clevertap.android.sdk.ActivityLifecycleCallback\nimport com.clevertap.android.sdk.CleverTapAPI\nimport com.clevertap.android.sdk.CleverTapAPI.LogLevel.VERBOSE\nimport com.clevertap.android.sdk.SyncListener\n+import com.clevertap.android.sdk.pushnotification.CTPushNotificationListener\nimport org.json.JSONObject\n+import java.util.HashMap\n-class MyApplication : MultiDexApplication() {\n+class MyApplication : MultiDexApplication(), CTPushNotificationListener {\noverride fun onCreate() {\n@@ -27,6 +30,8 @@ class MyApplication : MultiDexApplication() {\n}\n}\n+ defaultInstance?.ctPushNotificationListener = this\n+\ndefaultInstance?.getCleverTapID {\nprintln(\n\"CleverTap DeviceID from Application class= $it\"\n@@ -42,4 +47,8 @@ class MyApplication : MultiDexApplication() {\n\"All Offers\", NotificationManager.IMPORTANCE_MAX, true\n)\n}\n+\n+ override fun onNotificationClickedPayloadReceived(payload: HashMap<String, Any>?) {\n+ Log.i(\"MyApplication\", \"onNotificationClickedPayloadReceived = $payload\")\n+ }\n}\n\\ No newline at end of file\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(sample_app): add CTPushNotificationListener SDK-1114
116,616
22.10.2021 13:03:53
-19,080
d817b357e21148d13f6afdd253dd1f82205f4fdb
task(SDK-1122) - Add StandbyBucket info for API28 and above
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/DeviceInfo.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/DeviceInfo.java", "diff": "@@ -3,6 +3,8 @@ package com.clevertap.android.sdk;\nimport android.Manifest;\nimport android.annotation.SuppressLint;\nimport android.app.UiModeManager;\n+import android.app.usage.UsageStats;\n+import android.app.usage.UsageStatsManager;\nimport android.bluetooth.BluetoothAdapter;\nimport android.content.Context;\nimport android.content.pm.ApplicationInfo;\n@@ -19,6 +21,7 @@ import android.view.WindowInsets;\nimport android.view.WindowManager;\nimport android.view.WindowMetrics;\nimport androidx.annotation.IntDef;\n+import androidx.annotation.RequiresApi;\nimport androidx.annotation.RestrictTo;\nimport androidx.annotation.RestrictTo.Scope;\nimport androidx.core.app.NotificationManagerCompat;\n@@ -37,11 +40,19 @@ import java.util.UUID;\nimport java.util.concurrent.Callable;\nimport org.json.JSONObject;\n+import static android.content.Context.USAGE_STATS_SERVICE;\n+\n@RestrictTo(Scope.LIBRARY)\npublic class DeviceInfo {\nprivate class DeviceCachedInfo {\n+ private final static String STANDBY_BUCKET_ACTIVE = \"active\";\n+ private final static String STANDBY_BUCKET_FREQUENT = \"frequent\";\n+ private final static String STANDBY_BUCKET_RARE = \"rare\";\n+ private final static String STANDBY_BUCKET_RESTRICTED = \"restricted\";\n+ private final static String STANDBY_BUCKET_WORKING_SET = \"working_set\";\n+\nprivate final String bluetoothVersion;\nprivate final int build;\n@@ -76,6 +87,8 @@ public class DeviceInfo {\nprivate final int widthPixels;\n+ private String appBucket;\n+\nDeviceCachedInfo() {\nversionName = getVersionName();\nosName = getOsName();\n@@ -94,6 +107,9 @@ public class DeviceInfo {\nwidthPixels = getWidthPixels();\ndpi = getDPI();\nnotificationsEnabled = getNotificationEnabledForUser();\n+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {\n+ appBucket = getAppBucket();\n+ }\n}\nprivate String getBluetoothVersion() {\n@@ -226,6 +242,33 @@ public class DeviceInfo {\nreturn Build.MANUFACTURER;\n}\n+ /*\n+ This method gets the standby values for app.Standby buckets are divided into the following:-\n+ STANDBY_BUCKET_ACTIVE - The app was used very recently, currently in use or likely to be used very soon.\n+ STANDBY_BUCKET_FREQUENT - The app was used in the last few days and/or likely to be used in the next few days.\n+ STANDBY_BUCKET_RARE - The app has not be used for several days and/or is unlikely to be used for several days.\n+ STANDBY_BUCKET_RESTRICTED - The app has not be used for several days, is unlikely to be used for several days, and has\n+ been misbehaving in some manner.\n+ STANDBY_BUCKET_WORKING_SET - The app was used recently and/or likely to be used in the next few hours.\n+ */\n+ @RequiresApi(api = Build.VERSION_CODES.P)\n+ private String getAppBucket(){\n+ UsageStatsManager usm = (UsageStatsManager) context.getSystemService(USAGE_STATS_SERVICE);\n+ switch (usm.getAppStandbyBucket()) {\n+ case UsageStatsManager.STANDBY_BUCKET_ACTIVE:\n+ return STANDBY_BUCKET_ACTIVE;\n+ case UsageStatsManager.STANDBY_BUCKET_FREQUENT:\n+ return STANDBY_BUCKET_FREQUENT;\n+ case UsageStatsManager.STANDBY_BUCKET_RARE:\n+ return STANDBY_BUCKET_RARE;\n+ case UsageStatsManager.STANDBY_BUCKET_RESTRICTED:\n+ return STANDBY_BUCKET_RESTRICTED;\n+ case UsageStatsManager.STANDBY_BUCKET_WORKING_SET:\n+ return STANDBY_BUCKET_WORKING_SET;\n+ default: return \"\";\n+ }\n+ }\n+\nprivate String getModel() {\nString model = Build.MODEL;\nmodel = model.replace(getManufacturer(), \"\");\n@@ -593,6 +636,10 @@ public class DeviceInfo {\nreturn getDeviceCachedInfo().manufacturer;\n}\n+ public String getAppBucket() {\n+ return getDeviceCachedInfo().appBucket;\n+ }\n+\npublic String getModel() {\nreturn getDeviceCachedInfo().model;\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/utils/CTJsonConverter.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/utils/CTJsonConverter.java", "diff": "package com.clevertap.android.sdk.utils;\nimport android.location.Location;\n+import android.os.Build;\nimport android.os.Bundle;\nimport androidx.annotation.NonNull;\nimport androidx.annotation.RestrictTo;\n@@ -82,6 +83,10 @@ public class CTJsonConverter {\nevtData.put(\"hgt\", deviceInfo.getHeight());\nevtData.put(\"dpi\", deviceInfo.getDPI());\nevtData.put(\"dt\", DeviceInfo.getDeviceType(deviceInfo.getContext()));\n+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//Sends StandbyBucket info on API 28 and above.\n+ evtData.put(\"abckt\", deviceInfo.getAppBucket());\n+ Logger.d(\"CTJsonConverter\", deviceInfo.getAppBucket());\n+ }\nif (deviceInfo.getLibrary() != null) {\nevtData.put(\"lib\", deviceInfo.getLibrary());\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/test/java/com/clevertap/android/sdk/MockDeviceInfo.kt", "new_path": "clevertap-core/src/test/java/com/clevertap/android/sdk/MockDeviceInfo.kt", "diff": "@@ -120,6 +120,10 @@ class MockDeviceInfo(\nreturn true\n}\n+ override fun getAppBucket(): String {\n+ return \"active\"\n+ }\n+\noverride fun getAppLaunchedFields(): JSONObject {\nval obj = JSONObject()\nobj.put(\"Build\", \"1\")\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1122) - Add StandbyBucket info for API28 and above
116,612
22.10.2021 15:21:12
-19,080
65198344f7f3d275a05892835d9e3ceb159080cb
task(android12_support-core_sdk): Update notification launcher and CTA launcher logic to support trampoline
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CTNotificationIntentService.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CTNotificationIntentService.java", "diff": "package com.clevertap.android.sdk.pushnotification;\n+import android.annotation.SuppressLint;\nimport android.app.IntentService;\nimport android.app.NotificationManager;\nimport android.content.Context;\n@@ -9,6 +10,10 @@ import android.os.Bundle;\nimport com.clevertap.android.sdk.Logger;\nimport com.clevertap.android.sdk.Utils;\n+/**\n+ * In order to support Android 12 notification trampoline, this class is being deprecated from 4.3.0 onwards\n+ */\n+@Deprecated(since = \"4.3.0\")\npublic class CTNotificationIntentService extends IntentService {\npublic final static String MAIN_ACTION = \"com.clevertap.PUSH_EVENT\";\n@@ -35,6 +40,7 @@ public class CTNotificationIntentService extends IntentService {\n}\n}\n+ @SuppressLint(\"MissingPermission\")\nprivate void handleActionButtonClick(Bundle extras) {\ntry {\nboolean autoCancel = extras.getBoolean(\"autoCancel\", false);\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CTPushNotificationReceiver.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CTPushNotificationReceiver.java", "diff": "@@ -10,7 +10,10 @@ import com.clevertap.android.sdk.Constants;\nimport com.clevertap.android.sdk.Logger;\nimport com.clevertap.android.sdk.Utils;\n-\n+/**\n+ * In order to support Android 12 notification trampoline, this class is being deprecated from 4.3.0 onwards\n+ */\n+@Deprecated(since = \"4.3.0\")\npublic class CTPushNotificationReceiver extends BroadcastReceiver {\n@Override\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "diff": "@@ -26,6 +26,7 @@ import android.media.RingtoneManager;\nimport android.net.Uri;\nimport android.os.Build;\nimport android.os.Build.VERSION;\n+import android.os.Build.VERSION_CODES;\nimport android.os.Bundle;\nimport android.os.SystemClock;\nimport android.text.TextUtils;\n@@ -906,6 +907,64 @@ public class PushProviders implements CTPushProviderListener {\n}\n}\n+ private static class LaunchPendingIntentFactory {\n+\n+ static PendingIntent getLaunchPendingIntent(@NonNull Bundle extras, @NonNull Context context) {\n+ Intent launchIntent;\n+ PendingIntent pIntent;\n+ if (VERSION.SDK_INT >= VERSION_CODES.S) {\n+ if (extras.containsKey(Constants.DEEP_LINK_KEY)) {\n+ launchIntent = new Intent(Intent.ACTION_VIEW,\n+ Uri.parse(extras.getString(Constants.DEEP_LINK_KEY)));\n+ Utils.setPackageNameFromResolveInfoList(context, launchIntent);\n+ } else {\n+ launchIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());\n+ if (launchIntent == null) {\n+ return null;\n+ }\n+ }\n+\n+ launchIntent.setFlags(\n+ Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP\n+ | Intent.FLAG_ACTIVITY_SINGLE_TOP);\n+\n+ // Take all the properties from the notif and add it to the intent\n+ launchIntent.putExtras(extras);\n+ launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n+\n+ int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ | PendingIntent.FLAG_IMMUTABLE;\n+\n+ pIntent = PendingIntent.getActivity(context, (int) System.currentTimeMillis(), launchIntent,\n+ flagsLaunchPendingIntent);\n+ } else {\n+ launchIntent = new Intent(context, CTPushNotificationReceiver.class);\n+ // Take all the properties from the notif and add it to the intent\n+ launchIntent.putExtras(extras);\n+ launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n+\n+ int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n+ if (VERSION.SDK_INT >= VERSION_CODES.M)//Android M\n+ {\n+ flagsLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n+ }\n+ pIntent = PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n+ launchIntent, flagsLaunchPendingIntent);\n+ }\n+ return pIntent;\n+ }\n+ }\n+\n+ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)\n+ private static JobInfo getJobInfo(int jobId, JobScheduler jobScheduler) {\n+ for (JobInfo jobInfo : jobScheduler.getAllPendingJobs()) {\n+ if (jobInfo.getId() == jobId) {\n+ return jobInfo;\n+ }\n+ }\n+ return null;\n+ }\n+\nprivate void triggerNotification(Context context, Bundle extras, String notifMessage, String notifTitle,\nint notificationId) {\nNotificationManager notificationManager =\n@@ -940,20 +999,6 @@ public class PushProviders implements CTPushProviderListener {\n}\nString icoPath = extras.getString(Constants.NOTIF_ICON);\n- Intent launchIntent = new Intent(context, CTPushNotificationReceiver.class);\n-\n- PendingIntent pIntent;\n-\n- // Take all the properties from the notif and add it to the intent\n- launchIntent.putExtras(extras);\n- launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n- int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n- if (VERSION.SDK_INT >= 23)//Android M\n- {\n- flagsLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n- }\n- pIntent = PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n- launchIntent, flagsLaunchPendingIntent);\nNotificationCompat.Style style;\nString bigPictureUrl = extras.getString(Constants.WZRK_BIG_PICTURE);\n@@ -1092,7 +1137,7 @@ public class PushProviders implements CTPushProviderListener {\nnb.setContentTitle(notifTitle)\n.setContentText(notifMessage)\n- .setContentIntent(pIntent)\n+ .setContentIntent(LaunchPendingIntentFactory.getLaunchPendingIntent(extras, context))\n.setAutoCancel(true)\n.setStyle(style)\n.setPriority(priorityInt)\n@@ -1190,7 +1235,8 @@ public class PushProviders implements CTPushProviderListener {\n}\n}\n- boolean sendToCTIntentService = (autoCancel && isCTIntentServiceAvailable);\n+ boolean sendToCTIntentService = (VERSION.SDK_INT < VERSION_CODES.S && autoCancel\n+ && isCTIntentServiceAvailable);\nIntent actionLaunchIntent;\nif (sendToCTIntentService) {\n@@ -1223,8 +1269,7 @@ public class PushProviders implements CTPushProviderListener {\nPendingIntent actionIntent;\nint requestCode = ((int) System.currentTimeMillis()) + i;\nint flagsActionLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n- if (VERSION.SDK_INT >= 23)//Android M\n- {\n+ if (VERSION.SDK_INT >= VERSION_CODES.M) {\nflagsActionLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n}\nif (sendToCTIntentService) {\n@@ -1266,14 +1311,4 @@ public class PushProviders implements CTPushProviderListener {\n}\nanalyticsManager.pushNotificationViewedEvent(extras);\n}\n-\n- @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)\n- private static JobInfo getJobInfo(int jobId, JobScheduler jobScheduler) {\n- for (JobInfo jobInfo : jobScheduler.getAllPendingJobs()) {\n- if (jobInfo.getId() == jobId) {\n- return jobInfo;\n- }\n- }\n- return null;\n- }\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/AndroidManifest.xml", "new_path": "sample/src/main/AndroidManifest.xml", "diff": "<meta-data\nandroid:name=\"CLEVERTAP_ACTIVITY_EXCLUDE\"\nandroid:value=\"HomeScreenActivity\" />\n+\n<service\nandroid:name=\"com.clevertap.android.sdk.pushnotification.fcm.FcmMessageListenerService\"\nandroid:exported=\"true\">\n<activity\nandroid:name=\".WebViewActivity\"\n- android:label=\"WebView\" />\n+ android:exported=\"true\"\n+ android:label=\"WebView\">\n+ <intent-filter>\n+ <action android:name=\"android.intent.action.VIEW\" />\n+\n+ <category android:name=\"android.intent.category.DEFAULT\" />\n+ <category android:name=\"android.intent.category.BROWSABLE\" />\n+\n+ <!-- If a user clicks on a shared link that uses the \"http\" scheme, your\n+ app should be able to delegate that traffic to \"https\". -->\n+ <data\n+ android:host=\"${applicationId}\"\n+ android:pathPrefix=\"/WebViewActivity\"\n+ android:scheme=\"ctdemo\" />\n+\n+ </intent-filter>\n+ </activity>\n</application>\n</manifest>\n\\ No newline at end of file\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-core_sdk): Update notification launcher and CTA launcher logic to support trampoline SDK-1111
116,612
22.10.2021 16:22:10
-19,080
720fdc9959c21a9d1c7bc5d032ba5d4f0efa6c2b
task(android12_support-core_sdk): Update PendingIntent flags to support mutability
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/AndroidManifest.xml", "new_path": "clevertap-core/src/main/AndroidManifest.xml", "diff": "android:exported=\"false\"\nandroid:permission=\"android.permission.BIND_JOB_SERVICE\" />\n+ <meta-data\n+ android:name=\"CLEVERTAP_BACKGROUND_SYNC\"\n+ android:value=\"1\" />\n+\n</application>\n</manifest>\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "diff": "@@ -388,72 +388,51 @@ public class PushProviders implements CTPushProviderListener {\n});\n}\n- public void runInstanceJobWork(final Context context, final JobParameters parameters) {\n- Task<Void> task = CTExecutorFactory.executors(config).postAsyncSafelyTask();\n- task.execute(\"runningJobService\", new Callable<Void>() {\n- @Override\n- public Void call() {\n- if (isNotificationSupported()) {\n- Logger.v(config.getAccountId(), \"Token is not present, not running the Job\");\n+ private static class LaunchPendingIntentFactory {\n+\n+ static PendingIntent getLaunchPendingIntent(@NonNull Bundle extras, @NonNull Context context) {\n+ Intent launchIntent;\n+ PendingIntent pIntent;\n+ if (VERSION.SDK_INT >= VERSION_CODES.S) {\n+ if (extras.containsKey(Constants.DEEP_LINK_KEY)) {\n+ launchIntent = new Intent(Intent.ACTION_VIEW,\n+ Uri.parse(extras.getString(Constants.DEEP_LINK_KEY)));\n+ Utils.setPackageNameFromResolveInfoList(context, launchIntent);\n+ } else {\n+ launchIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());\n+ if (launchIntent == null) {\nreturn null;\n}\n+ }\n- Calendar now = Calendar.getInstance();\n-\n- int hour = now.get(Calendar.HOUR_OF_DAY); // Get hour in 24 hour format\n- int minute = now.get(Calendar.MINUTE);\n-\n- Date currentTime = parseTimeToDate(hour + \":\" + minute);\n- Date startTime = parseTimeToDate(Constants.DND_START);\n- Date endTime = parseTimeToDate(Constants.DND_STOP);\n+ launchIntent.setFlags(\n+ Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP\n+ | Intent.FLAG_ACTIVITY_SINGLE_TOP);\n- if (isTimeBetweenDNDTime(startTime, endTime, currentTime)) {\n- Logger.v(config.getAccountId(), \"Job Service won't run in default DND hours\");\n- return null;\n- }\n+ // Take all the properties from the notif and add it to the intent\n+ launchIntent.putExtras(extras);\n+ launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n- long lastTS = baseDatabaseManager.loadDBAdapter(context).getLastUninstallTimestamp();\n+ int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ | PendingIntent.FLAG_IMMUTABLE;\n- if (lastTS == 0 || lastTS > System.currentTimeMillis() - 24 * 60 * 60 * 1000) {\n- try {\n- JSONObject eventObject = new JSONObject();\n- eventObject.put(\"bk\", 1);\n- analyticsManager.sendPingEvent(eventObject);\n+ pIntent = PendingIntent.getActivity(context, (int) System.currentTimeMillis(), launchIntent,\n+ flagsLaunchPendingIntent);\n+ } else {\n+ launchIntent = new Intent(context, CTPushNotificationReceiver.class);\n+ // Take all the properties from the notif and add it to the intent\n+ launchIntent.putExtras(extras);\n+ launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n- if (parameters == null) {\n- int pingFrequency = getPingFrequency(context);\n- AlarmManager alarmManager = (AlarmManager) context\n- .getSystemService(Context.ALARM_SERVICE);\n- Intent cancelIntent = new Intent(CTBackgroundIntentService.MAIN_ACTION);\n- cancelIntent.setPackage(context.getPackageName());\n- PendingIntent alarmPendingIntent = PendingIntent\n- .getService(context, config.getAccountId().hashCode(), cancelIntent,\n- PendingIntent.FLAG_UPDATE_CURRENT);\n- if (alarmManager != null) {\n- alarmManager.cancel(alarmPendingIntent);\n- }\n- Intent alarmIntent = new Intent(CTBackgroundIntentService.MAIN_ACTION);\n- alarmIntent.setPackage(context.getPackageName());\n- PendingIntent alarmServicePendingIntent = PendingIntent\n- .getService(context, config.getAccountId().hashCode(), alarmIntent,\n- PendingIntent.FLAG_UPDATE_CURRENT);\n- if (alarmManager != null) {\n- if (pingFrequency != -1) {\n- alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,\n- SystemClock.elapsedRealtime() + (pingFrequency\n- * Constants.ONE_MIN_IN_MILLIS),\n- Constants.ONE_MIN_IN_MILLIS * pingFrequency, alarmServicePendingIntent);\n- }\n- }\n- }\n- } catch (JSONException e) {\n- Logger.v(\"Unable to raise background Ping event\");\n+ int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n+ if (VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n}\n-\n+ pIntent = PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n+ launchIntent, flagsLaunchPendingIntent);\n}\n- return null;\n+ return pIntent;\n}\n- });\n}\n/**\n@@ -503,20 +482,77 @@ public class PushProviders implements CTPushProviderListener {\nreturn alreadyAvailable;\n}\n- private void createAlarmScheduler(Context context) {\n+ public void runInstanceJobWork(final Context context, final JobParameters parameters) {\n+ Task<Void> task = CTExecutorFactory.executors(config).postAsyncSafelyTask();\n+ task.execute(\"runningJobService\", new Callable<Void>() {\n+ @Override\n+ public Void call() {\n+ if (isNotificationSupported()) {\n+ Logger.v(config.getAccountId(), \"Token is not present, not running the Job\");\n+ return null;\n+ }\n+\n+ Calendar now = Calendar.getInstance();\n+\n+ int hour = now.get(Calendar.HOUR_OF_DAY); // Get hour in 24 hour format\n+ int minute = now.get(Calendar.MINUTE);\n+\n+ Date currentTime = parseTimeToDate(hour + \":\" + minute);\n+ Date startTime = parseTimeToDate(Constants.DND_START);\n+ Date endTime = parseTimeToDate(Constants.DND_STOP);\n+\n+ if (isTimeBetweenDNDTime(startTime, endTime, currentTime)) {\n+ Logger.v(config.getAccountId(), \"Job Service won't run in default DND hours\");\n+ return null;\n+ }\n+\n+ long lastTS = baseDatabaseManager.loadDBAdapter(context).getLastUninstallTimestamp();\n+\n+ if (lastTS == 0 || lastTS > System.currentTimeMillis() - 24 * 60 * 60 * 1000) {\n+ try {\n+ JSONObject eventObject = new JSONObject();\n+ eventObject.put(\"bk\", 1);\n+ analyticsManager.sendPingEvent(eventObject);\n+\n+ int flagsAlarmPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n+ if (VERSION.SDK_INT >= VERSION_CODES.S) {\n+ flagsAlarmPendingIntent |= PendingIntent.FLAG_MUTABLE;\n+ }\n+\n+ if (parameters == null) {\nint pingFrequency = getPingFrequency(context);\n- if (pingFrequency > 0) {\n- AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n- Intent intent = new Intent(CTBackgroundIntentService.MAIN_ACTION);\n- intent.setPackage(context.getPackageName());\n+ AlarmManager alarmManager = (AlarmManager) context\n+ .getSystemService(Context.ALARM_SERVICE);\n+ Intent cancelIntent = new Intent(CTBackgroundIntentService.MAIN_ACTION);\n+ cancelIntent.setPackage(context.getPackageName());\nPendingIntent alarmPendingIntent = PendingIntent\n- .getService(context, config.getAccountId().hashCode(), intent,\n- PendingIntent.FLAG_UPDATE_CURRENT);\n+ .getService(context, config.getAccountId().hashCode(), cancelIntent,\n+ flagsAlarmPendingIntent);\nif (alarmManager != null) {\n- alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(),\n- Constants.ONE_MIN_IN_MILLIS * pingFrequency, alarmPendingIntent);\n+ alarmManager.cancel(alarmPendingIntent);\n+ }\n+ Intent alarmIntent = new Intent(CTBackgroundIntentService.MAIN_ACTION);\n+ alarmIntent.setPackage(context.getPackageName());\n+ PendingIntent alarmServicePendingIntent = PendingIntent\n+ .getService(context, config.getAccountId().hashCode(), alarmIntent,\n+ flagsAlarmPendingIntent);\n+ if (alarmManager != null) {\n+ if (pingFrequency != -1) {\n+ alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,\n+ SystemClock.elapsedRealtime() + (pingFrequency\n+ * Constants.ONE_MIN_IN_MILLIS),\n+ Constants.ONE_MIN_IN_MILLIS * pingFrequency, alarmServicePendingIntent);\n+ }\n+ }\n+ }\n+ } catch (JSONException e) {\n+ Logger.v(\"Unable to raise background Ping event\");\n}\n+\n+ }\n+ return null;\n}\n+ });\n}\n@SuppressLint(\"MissingPermission\")\n@@ -895,66 +931,43 @@ public class PushProviders implements CTPushProviderListener {\nStorageHelper.putInt(context, Constants.PING_FREQUENCY, pingFrequency);\n}\n+ private void createAlarmScheduler(Context context) {\n+ int pingFrequency = getPingFrequency(context);\n+ if (pingFrequency > 0) {\n+ AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n+ Intent intent = new Intent(CTBackgroundIntentService.MAIN_ACTION);\n+ intent.setPackage(context.getPackageName());\n+\n+ int flagsAlarmPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n+ if (VERSION.SDK_INT >= VERSION_CODES.S) {\n+ flagsAlarmPendingIntent |= PendingIntent.FLAG_MUTABLE;\n+ }\n+ PendingIntent alarmPendingIntent = PendingIntent\n+ .getService(context, config.getAccountId().hashCode(), intent,\n+ flagsAlarmPendingIntent);\n+ if (alarmManager != null) {\n+ alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(),\n+ Constants.ONE_MIN_IN_MILLIS * pingFrequency, alarmPendingIntent);\n+ }\n+ }\n+ }\n+\nprivate void stopAlarmScheduler(Context context) {\nAlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\nIntent cancelIntent = new Intent(CTBackgroundIntentService.MAIN_ACTION);\ncancelIntent.setPackage(context.getPackageName());\n+ int flagsAlarmPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n+ if (VERSION.SDK_INT >= VERSION_CODES.S) {\n+ flagsAlarmPendingIntent |= PendingIntent.FLAG_MUTABLE;\n+ }\nPendingIntent alarmPendingIntent = PendingIntent\n.getService(context, config.getAccountId().hashCode(), cancelIntent,\n- PendingIntent.FLAG_UPDATE_CURRENT);\n+ flagsAlarmPendingIntent);\nif (alarmManager != null && alarmPendingIntent != null) {\nalarmManager.cancel(alarmPendingIntent);\n}\n}\n- private static class LaunchPendingIntentFactory {\n-\n- static PendingIntent getLaunchPendingIntent(@NonNull Bundle extras, @NonNull Context context) {\n- Intent launchIntent;\n- PendingIntent pIntent;\n- if (VERSION.SDK_INT >= VERSION_CODES.S) {\n- if (extras.containsKey(Constants.DEEP_LINK_KEY)) {\n- launchIntent = new Intent(Intent.ACTION_VIEW,\n- Uri.parse(extras.getString(Constants.DEEP_LINK_KEY)));\n- Utils.setPackageNameFromResolveInfoList(context, launchIntent);\n- } else {\n- launchIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());\n- if (launchIntent == null) {\n- return null;\n- }\n- }\n-\n- launchIntent.setFlags(\n- Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP\n- | Intent.FLAG_ACTIVITY_SINGLE_TOP);\n-\n- // Take all the properties from the notif and add it to the intent\n- launchIntent.putExtras(extras);\n- launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n-\n- int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n- | PendingIntent.FLAG_IMMUTABLE;\n-\n- pIntent = PendingIntent.getActivity(context, (int) System.currentTimeMillis(), launchIntent,\n- flagsLaunchPendingIntent);\n- } else {\n- launchIntent = new Intent(context, CTPushNotificationReceiver.class);\n- // Take all the properties from the notif and add it to the intent\n- launchIntent.putExtras(extras);\n- launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n-\n- int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n- if (VERSION.SDK_INT >= VERSION_CODES.M)//Android M\n- {\n- flagsLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n- }\n- pIntent = PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n- launchIntent, flagsLaunchPendingIntent);\n- }\n- return pIntent;\n- }\n- }\n-\n@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)\nprivate static JobInfo getJobInfo(int jobId, JobScheduler jobScheduler) {\nfor (JobInfo jobInfo : jobScheduler.getAllPendingJobs()) {\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-core_sdk): Update PendingIntent flags to support mutability SDK-1111
116,612
22.10.2021 16:23:33
-19,080
869103b2c56baa1077e299ea356115b7fea9ece3
task(android12_support-geofence_sdk): remove hardcoded sdk int
[ { "change_type": "MODIFY", "old_path": "clevertap-geofence/src/main/java/com/clevertap/android/geofence/PendingIntentFactory.java", "new_path": "clevertap-geofence/src/main/java/com/clevertap/android/geofence/PendingIntentFactory.java", "diff": "@@ -4,6 +4,7 @@ import android.app.PendingIntent;\nimport android.content.Context;\nimport android.content.Intent;\nimport android.os.Build.VERSION;\n+import android.os.Build.VERSION_CODES;\nimport androidx.annotation.Nullable;\n/**\n@@ -54,8 +55,7 @@ class PendingIntentFactory {\nthrow new IllegalArgumentException(\"invalid pendingIntentType\");\n}\n- if (VERSION.SDK_INT >= 31)//Android S\n- {\n+ if (VERSION.SDK_INT >= VERSION_CODES.S) {\nflags |= PendingIntent.FLAG_MUTABLE/*used by android framework*/;\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-geofence_sdk): remove hardcoded sdk int SDK-1113
116,616
22.10.2021 16:49:15
-19,080
1b2a61ac8590b4f74b03abadd6a8cfae5ac40b15
task(SDK-1123) - Add FCM<>Custom SenderID log info
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/utils/CTJsonConverter.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/utils/CTJsonConverter.java", "diff": "@@ -3,12 +3,14 @@ package com.clevertap.android.sdk.utils;\nimport android.location.Location;\nimport android.os.Build;\nimport android.os.Bundle;\n+import android.text.TextUtils;\nimport androidx.annotation.NonNull;\nimport androidx.annotation.RestrictTo;\nimport androidx.annotation.RestrictTo.Scope;\nimport com.clevertap.android.sdk.Constants;\nimport com.clevertap.android.sdk.DeviceInfo;\nimport com.clevertap.android.sdk.Logger;\n+import com.clevertap.android.sdk.ManifestInfo;\nimport com.clevertap.android.sdk.db.DBAdapter;\nimport com.clevertap.android.sdk.inapp.CTInAppNotification;\nimport com.clevertap.android.sdk.inbox.CTInboxMessage;\n@@ -90,6 +92,10 @@ public class CTJsonConverter {\nif (deviceInfo.getLibrary() != null) {\nevtData.put(\"lib\", deviceInfo.getLibrary());\n}\n+ String fcmSenderId = ManifestInfo.getInstance(deviceInfo.getContext()).getFCMSenderId();\n+ if (!TextUtils.isEmpty(fcmSenderId)) {//only for 4.3.0 for tracking custom sender ID users.\n+ evtData.put(\"fcmsid\", true);\n+ }\nString cc = deviceInfo.getCountryCode();\nif (cc != null && !cc.equals(\"\")) {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/validation/ManifestValidator.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/validation/ManifestValidator.java", "diff": "@@ -6,11 +6,13 @@ import android.content.pm.ActivityInfo;\nimport android.content.pm.PackageInfo;\nimport android.content.pm.PackageManager;\nimport android.content.pm.ServiceInfo;\n+import android.text.TextUtils;\nimport com.clevertap.android.sdk.ActivityLifecycleCallback;\nimport com.clevertap.android.sdk.CleverTapAPI;\nimport com.clevertap.android.sdk.DeviceInfo;\nimport com.clevertap.android.sdk.InAppNotificationActivity;\nimport com.clevertap.android.sdk.Logger;\n+import com.clevertap.android.sdk.ManifestInfo;\nimport com.clevertap.android.sdk.Utils;\nimport com.clevertap.android.sdk.inbox.CTInboxActivity;\nimport com.clevertap.android.sdk.pushnotification.CTNotificationIntentService;\n@@ -33,6 +35,12 @@ public final class ManifestValidator {\ncheckSDKVersion(deviceInfo);\nvalidationApplicationLifecyleCallback(context);\ncheckReceiversServices(context, pushProviders);\n+ if (!TextUtils.isEmpty(ManifestInfo.getInstance(context).getFCMSenderId())){\n+ Logger.i(\"We have noticed that your app is using a custom FCM Sender ID, this feature will \" +\n+ \"be DISCONTINUED from the next version of the CleverTap Android SDK. With the next release, \" +\n+ \"CleverTap Android SDK will only fetch the token using the google-services.json.\" +\n+ \" Please reach out to CleverTap Support for any questions.\");\n+ }\n}\nprivate static void checkApplicationClass(final Context context) {\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1123) - Add FCM<>Custom SenderID log info
116,623
22.10.2021 17:19:48
-19,080
abed72ee1c68d84c0160d53e48ac8f3cab53baad
task(SDK-1069): Checking for string of zeroes in Google Ad ID flow while generating CTID
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/DeviceInfo.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/DeviceInfo.java", "diff": "@@ -396,17 +396,64 @@ public class DeviceInfo {\nprivate final Object deviceIDLock = new Object();\n+ private boolean enableNetworkInfoReporting = false;\n+\nprivate String googleAdID = null;\nprivate String library;\nprivate boolean limitAdTracking = false;\n+ private final CoreMetaData mCoreMetaData;\n+\nprivate final ArrayList<ValidationResult> validationResults = new ArrayList<>();\n- private boolean enableNetworkInfoReporting = false;\n+ /**\n+ * Returns the integer identifier for the default app icon.\n+ *\n+ * @param context The Android context\n+ * @return The integer identifier for the image resource\n+ */\n+ public static int getAppIconAsIntId(final Context context) {\n+ ApplicationInfo ai = context.getApplicationInfo();\n+ return ai.icon;\n+ }\n- private final CoreMetaData mCoreMetaData;\n+ /**\n+ * Determines if a device is tablet, smart phone or TV\n+ *\n+ * @param context context\n+ * @return one of the possible value of {@link DeviceType}\n+ */\n+ @DeviceType\n+ public static int getDeviceType(final Context context) {\n+\n+ if (sDeviceType == NULL) {\n+\n+ try {\n+ UiModeManager uiModeManager = (UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE);\n+ if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {\n+ sDeviceType = TV;\n+ return sDeviceType;\n+ }\n+ } catch (Exception e) {\n+ //uiModeManager or context is null\n+ Logger.d(\"Failed to decide whether device is a TV!\");\n+ e.printStackTrace();\n+ }\n+\n+ try {\n+ sDeviceType = context.getResources().getBoolean(R.bool.ctIsTablet) ? TABLET : SMART_PHONE;\n+ } catch (Exception e) {\n+ // resource not found or context is null\n+ Logger.d(\"Failed to decide whether device is a smart phone or tablet!\");\n+ e.printStackTrace();\n+ sDeviceType = UNKNOWN;\n+ }\n+\n+ }\n+ return sDeviceType;\n+ }\nDeviceInfo(Context context, CleverTapInstanceConfig config, String cleverTapID,\nCoreMetaData coreMetaData) {\n@@ -418,41 +465,6 @@ public class DeviceInfo {\ngetConfigLogger().verbose(config.getAccountId() + \":async_deviceID\", \"DeviceInfo() called\");\n}\n- void onInitDeviceInfo(final String cleverTapID) {\n- Task<Void> taskDeviceCachedInfo = CTExecutorFactory.executors(config).ioTask();\n- taskDeviceCachedInfo.execute(\"getDeviceCachedInfo\", new Callable<Void>() {\n- @Override\n- public Void call() throws Exception {\n- getDeviceCachedInfo();\n- return null;\n- }\n- });\n-\n- Task<Void> task = CTExecutorFactory.executors(config).ioTask();\n- task.addOnSuccessListener(new OnSuccessListener<Void>() {\n- // callback on main thread\n- @Override\n- public void onSuccess(final Void aVoid) {\n- getConfigLogger().verbose(config.getAccountId() + \":async_deviceID\",\n- \"DeviceID initialized successfully!\" + Thread.currentThread());\n- // No need to put getDeviceID() on background thread because prefs already loaded\n- CleverTapAPI.instanceWithConfig(context, config).deviceIDCreated(getDeviceID());\n- }\n- });\n- task.execute(\"initDeviceID\", new Callable<Void>() {\n- @Override\n- public Void call() throws Exception {\n- initDeviceID(cleverTapID);\n- return null;\n- }\n- });\n-\n- }\n-\n- public boolean isErrorDeviceId() {\n- return getDeviceID() != null && getDeviceID().startsWith(Constants.ERROR_PROFILE_PREFIX);\n- }\n-\npublic void forceNewDeviceID() {\nString deviceID = generateGUID();\nforceUpdateDeviceId(deviceID);\n@@ -487,46 +499,6 @@ public class DeviceInfo {\n}\n}\n- String getAttributionID() {\n- return getDeviceID();\n- }\n-\n- /**\n- * Determines if a device is tablet, smart phone or TV\n- *\n- * @param context context\n- * @return one of the possible value of {@link DeviceType}\n- */\n- @DeviceType\n- public static int getDeviceType(final Context context) {\n-\n- if (sDeviceType == NULL) {\n-\n- try {\n- UiModeManager uiModeManager = (UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE);\n- if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {\n- sDeviceType = TV;\n- return sDeviceType;\n- }\n- } catch (Exception e) {\n- //uiModeManager or context is null\n- Logger.d(\"Failed to decide whether device is a TV!\");\n- e.printStackTrace();\n- }\n-\n- try {\n- sDeviceType = context.getResources().getBoolean(R.bool.ctIsTablet) ? TABLET : SMART_PHONE;\n- } catch (Exception e) {\n- // resource not found or context is null\n- Logger.d(\"Failed to decide whether device is a smart phone or tablet!\");\n- e.printStackTrace();\n- sDeviceType = UNKNOWN;\n- }\n-\n- }\n- return sDeviceType;\n- }\n-\n//Event\npublic JSONObject getAppLaunchedFields() {\n@@ -559,10 +531,6 @@ public class DeviceInfo {\nreturn context;\n}\n- public String getDeviceID() {\n- return _getDeviceID() != null ? _getDeviceID() : getFallBackDeviceID();\n- }\n-\npublic String getCountryCode() {\nreturn getDeviceCachedInfo().countryCode;\n}\n@@ -571,6 +539,10 @@ public class DeviceInfo {\nreturn getDeviceCachedInfo().dpi;\n}\n+ public String getDeviceID() {\n+ return _getDeviceID() != null ? _getDeviceID() : getFallBackDeviceID();\n+ }\n+\npublic String getGoogleAdID() {\nsynchronized (adIDLock) {\nreturn googleAdID;\n@@ -613,6 +585,10 @@ public class DeviceInfo {\nreturn getDeviceCachedInfo().osVersion;\n}\n+ public int getSdkVersion() {\n+ return getDeviceCachedInfo().sdkVersion;\n+ }\n+\npublic ArrayList<ValidationResult> getValidationResults() {\n// noinspection unchecked\nArrayList<ValidationResult> tempValidationResults = (ArrayList<ValidationResult>) validationResults.clone();\n@@ -620,10 +596,6 @@ public class DeviceInfo {\nreturn tempValidationResults;\n}\n- public int getSdkVersion() {\n- return getDeviceCachedInfo().sdkVersion;\n- }\n-\npublic String getVersionName() {\nreturn getDeviceCachedInfo().versionName;\n}\n@@ -651,6 +623,10 @@ public class DeviceInfo {\nreturn isBluetoothEnabled;\n}\n+ public boolean isErrorDeviceId() {\n+ return getDeviceID() != null && getDeviceID().startsWith(Constants.ERROR_PROFILE_PREFIX);\n+ }\n+\npublic boolean isLimitAdTrackingEnabled() {\nsynchronized (adIDLock) {\nreturn limitAdTracking;\n@@ -675,6 +651,87 @@ public class DeviceInfo {\nreturn ret;\n}\n+ public void setCurrentUserOptOutStateFromStorage() {\n+ String key = optOutKey();\n+ if (key == null) {\n+ config.getLogger().verbose(config.getAccountId(),\n+ \"Unable to set current user OptOut state from storage: storage key is null\");\n+ return;\n+ }\n+ boolean storedOptOut = StorageHelper.getBooleanFromPrefs(context, config, key);\n+ mCoreMetaData.setCurrentUserOptedOut(storedOptOut);\n+ config.getLogger().verbose(config.getAccountId(),\n+ \"Set current user OptOut state from storage to: \" + storedOptOut + \" for key: \" + key);\n+ }\n+\n+ void enableDeviceNetworkInfoReporting(boolean value) {\n+ enableNetworkInfoReporting = value;\n+ StorageHelper.putBoolean(context, StorageHelper.storageKeyWithSuffix(config, Constants.NETWORK_INFO),\n+ enableNetworkInfoReporting);\n+ config.getLogger()\n+ .verbose(config.getAccountId(),\n+ \"Device Network Information reporting set to \" + enableNetworkInfoReporting);\n+ }\n+\n+ String getAttributionID() {\n+ return getDeviceID();\n+ }\n+\n+ int getHeightPixels() {\n+ return getDeviceCachedInfo().heightPixels;\n+ }\n+\n+ int getWidthPixels() {\n+ return getDeviceCachedInfo().widthPixels;\n+ }\n+\n+ void onInitDeviceInfo(final String cleverTapID) {\n+ Task<Void> taskDeviceCachedInfo = CTExecutorFactory.executors(config).ioTask();\n+ taskDeviceCachedInfo.execute(\"getDeviceCachedInfo\", new Callable<Void>() {\n+ @Override\n+ public Void call() throws Exception {\n+ getDeviceCachedInfo();\n+ return null;\n+ }\n+ });\n+\n+ Task<Void> task = CTExecutorFactory.executors(config).ioTask();\n+ task.addOnSuccessListener(new OnSuccessListener<Void>() {\n+ // callback on main thread\n+ @Override\n+ public void onSuccess(final Void aVoid) {\n+ getConfigLogger().verbose(config.getAccountId() + \":async_deviceID\",\n+ \"DeviceID initialized successfully!\" + Thread.currentThread());\n+ // No need to put getDeviceID() on background thread because prefs already loaded\n+ CleverTapAPI.instanceWithConfig(context, config).deviceIDCreated(getDeviceID());\n+ }\n+ });\n+ task.execute(\"initDeviceID\", new Callable<Void>() {\n+ @Override\n+ public Void call() throws Exception {\n+ initDeviceID(cleverTapID);\n+ return null;\n+ }\n+ });\n+\n+ }\n+\n+ String optOutKey() {\n+ String guid = getDeviceID();\n+ if (guid == null) {\n+ return null;\n+ }\n+ return \"OptOut:\" + guid;\n+ }\n+\n+ void setDeviceNetworkInfoReportingFromStorage() {\n+ boolean enabled = StorageHelper.getBooleanFromPrefs(context, config, Constants.NETWORK_INFO);\n+ config.getLogger()\n+ .verbose(config.getAccountId(),\n+ \"Setting device network info reporting state from storage to \" + enabled);\n+ enableNetworkInfoReporting = enabled;\n+ }\n+\nprivate String _getDeviceID() {\nsynchronized (deviceIDLock) {\nif (this.config.isDefaultInstance()) {\n@@ -718,6 +775,12 @@ public class DeviceInfo {\n}\nif (advertisingID != null && advertisingID.trim().length() > 2) {\nsynchronized (adIDLock) {\n+ if (advertisingID.contains(\"00000000\")) {\n+ //Device has opted out of sharing Google Advertising ID\n+ getConfigLogger().debug(config.getAccountId(),\n+ \"Device user has opted out of sharing Advertising ID, falling back to random UUID for CleverTap ID generation\");\n+ return;\n+ }\ngoogleAdID = advertisingID.replace(\"-\", \"\");\n}\n}\n@@ -844,61 +907,4 @@ public class DeviceInfo {\ngetConfigLogger().verbose(this.config.getAccountId(), \"Updating the fallback id - \" + fallbackId);\nStorageHelper.putString(context, getFallbackIdStorageKey(), fallbackId);\n}\n-\n- /**\n- * Returns the integer identifier for the default app icon.\n- *\n- * @param context The Android context\n- * @return The integer identifier for the image resource\n- */\n- public static int getAppIconAsIntId(final Context context) {\n- ApplicationInfo ai = context.getApplicationInfo();\n- return ai.icon;\n- }\n-\n- int getHeightPixels() {\n- return getDeviceCachedInfo().heightPixels;\n- }\n-\n- void enableDeviceNetworkInfoReporting(boolean value) {\n- enableNetworkInfoReporting = value;\n- StorageHelper.putBoolean(context, StorageHelper.storageKeyWithSuffix(config, Constants.NETWORK_INFO),\n- enableNetworkInfoReporting);\n- config.getLogger()\n- .verbose(config.getAccountId(),\n- \"Device Network Information reporting set to \" + enableNetworkInfoReporting);\n- }\n-\n- void setDeviceNetworkInfoReportingFromStorage() {\n- boolean enabled = StorageHelper.getBooleanFromPrefs(context, config, Constants.NETWORK_INFO);\n- config.getLogger()\n- .verbose(config.getAccountId(),\n- \"Setting device network info reporting state from storage to \" + enabled);\n- enableNetworkInfoReporting = enabled;\n- }\n-\n- int getWidthPixels() {\n- return getDeviceCachedInfo().widthPixels;\n- }\n-\n- public void setCurrentUserOptOutStateFromStorage() {\n- String key = optOutKey();\n- if (key == null) {\n- config.getLogger().verbose(config.getAccountId(),\n- \"Unable to set current user OptOut state from storage: storage key is null\");\n- return;\n- }\n- boolean storedOptOut = StorageHelper.getBooleanFromPrefs(context, config, key);\n- mCoreMetaData.setCurrentUserOptedOut(storedOptOut);\n- config.getLogger().verbose(config.getAccountId(),\n- \"Set current user OptOut state from storage to: \" + storedOptOut + \" for key: \" + key);\n- }\n-\n- String optOutKey() {\n- String guid = getDeviceID();\n- if (guid == null) {\n- return null;\n- }\n- return \"OptOut:\" + guid;\n- }\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1069): Checking for string of zeroes in Google Ad ID flow while generating CTID
116,612
27.10.2021 14:01:44
-19,080
6117a24d79fb5b3d3bb3af58bcddefd07a020c91
task(android12_support-core_sdk): Update work dependency from RC to stable and update clevertap sdk versions
[ { "change_type": "MODIFY", "old_path": "buildSrc/src/main/kotlin/Libs.kt", "new_path": "buildSrc/src/main/kotlin/Libs.kt", "diff": "@@ -59,7 +59,7 @@ object Libs {\nconst val viewpager: String = \"androidx.viewpager:viewpager:_\"\n- const val work_runtime: String = \"androidx.work:work-runtime:_\"//TODO check RC version\n+ const val work_runtime: String = \"androidx.work:work-runtime:_\"\nconst val work_testing: String = \"androidx.work:work-testing:_\"\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/build.gradle", "new_path": "clevertap-core/build.gradle", "diff": "@@ -14,15 +14,22 @@ ext {\napply from: \"../gradle-scripts/commons.gradle\"\n+android {\n+ compileOptions {\n+ sourceCompatibility JavaVersion.VERSION_1_8\n+ targetCompatibility JavaVersion.VERSION_1_8\n+ }\n+}\n+\ndependencies {\n- compileOnly Libs.firebase_messaging//TODO update\n+ compileOnly Libs.firebase_messaging\ncompileOnly Libs.exoplayer\ncompileOnly Libs.exoplayer_hls\ncompileOnly Libs.exoplayer_ui\ncompileOnly Libs.glide\n//for notification\n- compileOnly Libs.androidx_core_core//TODO update-conflict with firebase\n- compileOnly Libs.viewpager//TODO update-conflict with latest core\n+ compileOnly Libs.androidx_core_core\n+ compileOnly Libs.viewpager\nimplementation Libs.appcompat\nimplementation Libs.recyclerview\ncompileOnly Libs.material\n" }, { "change_type": "MODIFY", "old_path": "clevertap-geofence/src/main/java/com/clevertap/android/geofence/PendingIntentFactory.java", "new_path": "clevertap-geofence/src/main/java/com/clevertap/android/geofence/PendingIntentFactory.java", "diff": "@@ -56,7 +56,8 @@ class PendingIntentFactory {\n}\nif (VERSION.SDK_INT >= VERSION_CODES.S) {\n- flags |= PendingIntent.FLAG_MUTABLE/*used by android framework*/;\n+ /*require mutable PendingIntent object for requesting device location information*/\n+ flags |= PendingIntent.FLAG_MUTABLE;\n}\nreturn PendingIntent.getBroadcast(context.getApplicationContext(), broadcastSenderRequestCode, intent,\n" }, { "change_type": "MODIFY", "old_path": "versions.properties", "new_path": "versions.properties", "diff": "@@ -289,7 +289,7 @@ version.androidx.recyclerview=1.2.1\n## # available=1.3.0-alpha01\nversion.androidx.viewpager=1.0.0\n## # available=1.1.0-alpha01\n-version.androidx.work=2.7.0-rc01\n+version.androidx.work=2.7.0\n## # available=2.4.0-alpha01\n## # available=2.4.0-alpha02\n## # available=2.4.0-alpha03\n@@ -320,10 +320,10 @@ version.com.android.installreferrer..installreferrer=2.2\n## # available=2.2\nversion.com.android.tools.lint..lint-api=27.0.1\nversion.com.android.tools.lint..lint-checks=27.0.1\n-version.com.clevertap.android..clevertap-android-sdk=4.2.0\n-version.com.clevertap.android..clevertap-geofence-sdk=1.0.2\n-version.com.clevertap.android..clevertap-hms-sdk=1.0.2\n-version.com.clevertap.android..clevertap-xiaomi-sdk=1.0.2\n+version.com.clevertap.android..clevertap-android-sdk=4.3.0\n+version.com.clevertap.android..clevertap-geofence-sdk=1.1.0\n+version.com.clevertap.android..clevertap-hms-sdk=1.1.0\n+version.com.clevertap.android..clevertap-xiaomi-sdk=1.1.0\nversion.com.github.bumptech.glide..glide=4.12.0\n## # available=4.12.0\nversion.com.google.android.exoplayer..exoplayer=2.15.1\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-core_sdk): Update work dependency from RC to stable and update clevertap sdk versions SDK-1111
116,612
27.10.2021 14:04:18
-19,080
bee249243675ee4a6d71349893b9a657c6c70fea
task(android12_support-sample_app): Update play-services-ads, work and clevertap sdk dependencies
[ { "change_type": "MODIFY", "old_path": "sample/build.gradle", "new_path": "sample/build.gradle", "diff": "@@ -52,23 +52,23 @@ dependencies {\n//CleverTap Android SDK, make sure the AAR file is in the libs folder\nimplementation project(':clevertap-core')\n- //implementation \"com.clevertap.android:clevertap-android-sdk:4.1.1\"\n+ //implementation \"com.clevertap.android:clevertap-android-sdk:4.3.0\"\nimplementation project(':clevertap-geofence')\n- //implementation \"com.clevertap.android:clevertap-geofence-sdk:1.0.2\"\n+ //implementation \"com.clevertap.android:clevertap-geofence-sdk:1.1.0\"\nimplementation project(':clevertap-xps')\n// For Xiaomi Push use\n- //implementation 'com.clevertap.android:clevertap-xiaomi-sdk:1.0.2'\n+ //implementation 'com.clevertap.android:clevertap-xiaomi-sdk:1.1.0'\nimplementation project(':clevertap-hms')\n// For Huawei Push use\n- //implementation 'com.clevertap.android:clevertap-hms-sdk:1.0.0'\n- //implementation 'com.huawei.hms:push:5.0.0.300'\n+ //implementation 'com.clevertap.android:clevertap-hms-sdk:1.1.0'\n+ //implementation 'com.huawei.hms:push:6.1.0.300'\nimplementation 'com.google.android.gms:play-services-location:18.0.0'// Needed for geofence\n- implementation 'androidx.work:work-runtime:2.7.0-rc01'// Needed for geofence\n+ implementation 'androidx.work:work-runtime:2.7.0'// Needed for geofence\nimplementation 'androidx.concurrent:concurrent-futures:1.1.0'// Needed for geofence\nimplementation 'com.google.firebase:firebase-messaging:20.2.4' //Needed for FCM\n- implementation 'com.google.android.gms:play-services-ads:19.4.0' //Needed to use Google Ad Ids\n+ implementation 'com.google.android.gms:play-services-ads:20.4.0' //Needed to use Google Ad Ids\n//ExoPlayer Libraries for Audio/Video InApp Notifications\nimplementation 'com.google.android.exoplayer:exoplayer:2.15.1'\nimplementation 'com.google.android.exoplayer:exoplayer-hls:2.15.1'\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-sample_app): Update play-services-ads, work and clevertap sdk dependencies SDK-1114
116,612
27.10.2021 14:05:39
-19,080
8e3d2881ccc98d4cdf43570d063e4335b464d377
task(android12_support-core_sdk): Extract static nested class LaunchPendingIntentFactory
[ { "change_type": "ADD", "old_path": null, "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/LaunchPendingIntentFactory.java", "diff": "+package com.clevertap.android.sdk.pushnotification;\n+\n+import android.app.PendingIntent;\n+import android.content.Context;\n+import android.content.Intent;\n+import android.net.Uri;\n+import android.os.Build.VERSION;\n+import android.os.Build.VERSION_CODES;\n+import android.os.Bundle;\n+import androidx.annotation.NonNull;\n+import com.clevertap.android.sdk.Constants;\n+import com.clevertap.android.sdk.Utils;\n+\n+class LaunchPendingIntentFactory {\n+\n+ static PendingIntent getLaunchPendingIntent(@NonNull Bundle extras, @NonNull Context context) {\n+ Intent launchIntent;\n+ PendingIntent pIntent;\n+ if (VERSION.SDK_INT >= VERSION_CODES.S) {\n+ if (extras.containsKey(Constants.DEEP_LINK_KEY)) {\n+ launchIntent = new Intent(Intent.ACTION_VIEW,\n+ Uri.parse(extras.getString(Constants.DEEP_LINK_KEY)));\n+ Utils.setPackageNameFromResolveInfoList(context, launchIntent);\n+ } else {\n+ launchIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());\n+ if (launchIntent == null) {\n+ return null;\n+ }\n+ }\n+\n+ launchIntent.setFlags(\n+ Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP\n+ | Intent.FLAG_ACTIVITY_SINGLE_TOP);\n+\n+ // Take all the properties from the notif and add it to the intent\n+ launchIntent.putExtras(extras);\n+ launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n+\n+ int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ | PendingIntent.FLAG_IMMUTABLE;\n+\n+ pIntent = PendingIntent.getActivity(context, (int) System.currentTimeMillis(), launchIntent,\n+ flagsLaunchPendingIntent);\n+ } else {\n+ launchIntent = new Intent(context, CTPushNotificationReceiver.class);\n+ // Take all the properties from the notif and add it to the intent\n+ launchIntent.putExtras(extras);\n+ launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n+\n+ int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n+ if (VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n+ }\n+ pIntent = PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n+ launchIntent, flagsLaunchPendingIntent);\n+ }\n+ return pIntent;\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "diff": "@@ -388,53 +388,6 @@ public class PushProviders implements CTPushProviderListener {\n});\n}\n- private static class LaunchPendingIntentFactory {\n-\n- static PendingIntent getLaunchPendingIntent(@NonNull Bundle extras, @NonNull Context context) {\n- Intent launchIntent;\n- PendingIntent pIntent;\n- if (VERSION.SDK_INT >= VERSION_CODES.S) {\n- if (extras.containsKey(Constants.DEEP_LINK_KEY)) {\n- launchIntent = new Intent(Intent.ACTION_VIEW,\n- Uri.parse(extras.getString(Constants.DEEP_LINK_KEY)));\n- Utils.setPackageNameFromResolveInfoList(context, launchIntent);\n- } else {\n- launchIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());\n- if (launchIntent == null) {\n- return null;\n- }\n- }\n-\n- launchIntent.setFlags(\n- Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP\n- | Intent.FLAG_ACTIVITY_SINGLE_TOP);\n-\n- // Take all the properties from the notif and add it to the intent\n- launchIntent.putExtras(extras);\n- launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n-\n- int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n- | PendingIntent.FLAG_IMMUTABLE;\n-\n- pIntent = PendingIntent.getActivity(context, (int) System.currentTimeMillis(), launchIntent,\n- flagsLaunchPendingIntent);\n- } else {\n- launchIntent = new Intent(context, CTPushNotificationReceiver.class);\n- // Take all the properties from the notif and add it to the intent\n- launchIntent.putExtras(extras);\n- launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n-\n- int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n- if (VERSION.SDK_INT >= VERSION_CODES.M) {\n- flagsLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n- }\n- pIntent = PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n- launchIntent, flagsLaunchPendingIntent);\n- }\n- return pIntent;\n- }\n- }\n-\n/**\n* Unregister the token for a push type from Clevertap's server.\n* Devices with unregistered token wont be reachable.\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-core_sdk): Extract static nested class LaunchPendingIntentFactory SDK-1111
116,612
27.10.2021 14:06:47
-19,080
80eb1ce6883014df40a6c105e6d737b184c1e72d
task(android12_support-geofence_sdk): Ignore play-services-location related test cases due to powermock error
[ { "change_type": "MODIFY", "old_path": "clevertap-geofence/src/test/java/com/clevertap/android/geofence/GoogleGeofenceAdapterTest.java", "new_path": "clevertap-geofence/src/test/java/com/clevertap/android/geofence/GoogleGeofenceAdapterTest.java", "diff": "@@ -42,6 +42,7 @@ import org.robolectric.annotation.Config;\n@PowerMockIgnore({\"org.mockito.*\", \"org.robolectric.*\", \"android.*\", \"androidx.*\", \"org.json.*\"})\n@PrepareForTest({CTGeofenceAPI.class, Utils.class, CleverTapAPI.class\n, LocationServices.class, Tasks.class})\n+@Ignore\npublic class GoogleGeofenceAdapterTest extends BaseTestCase {\n@Mock\n@@ -161,7 +162,7 @@ public class GoogleGeofenceAdapterTest extends BaseTestCase {\nGoogleGeofenceAdapter geofenceAdapter = new GoogleGeofenceAdapter(application);\ngeofenceAdapter.removeAllGeofence(null, onSuccessListener);\n- verify(geofencingClient, never()).removeGeofences(ArgumentMatchers.<String>anyList());\n+ verify(geofencingClient, never()).removeGeofences(ArgumentMatchers.anyList());\n}\n@@ -171,7 +172,7 @@ public class GoogleGeofenceAdapterTest extends BaseTestCase {\nGoogleGeofenceAdapter geofenceAdapter = new GoogleGeofenceAdapter(application);\ngeofenceAdapter.removeAllGeofence(new ArrayList<String>(), onSuccessListener);\n- verify(geofencingClient, never()).removeGeofences(ArgumentMatchers.<String>anyList());\n+ verify(geofencingClient, never()).removeGeofences(ArgumentMatchers.anyList());\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-geofence/src/test/java/com/clevertap/android/geofence/GoogleLocationAdapterTest.java", "new_path": "clevertap-geofence/src/test/java/com/clevertap/android/geofence/GoogleLocationAdapterTest.java", "diff": "@@ -53,6 +53,7 @@ import org.robolectric.annotation.Config;\n@PowerMockIgnore({\"org.mockito.*\", \"org.robolectric.*\", \"android.*\", \"androidx.*\", \"org.json.*\"})\n@PrepareForTest({CTGeofenceAPI.class, Utils.class, CleverTapAPI.class\n, LocationServices.class, Tasks.class})\n+@Ignore\npublic class GoogleLocationAdapterTest extends BaseTestCase {\n@Mock\n" }, { "change_type": "MODIFY", "old_path": "clevertap-geofence/src/test/java/com/clevertap/android/geofence/PushGeofenceEventTaskTest.java", "new_path": "clevertap-geofence/src/test/java/com/clevertap/android/geofence/PushGeofenceEventTaskTest.java", "diff": "@@ -38,6 +38,7 @@ import org.skyscreamer.jsonassert.JSONAssert;\n@PowerMockIgnore({\"org.mockito.*\", \"org.robolectric.*\", \"android.*\", \"androidx.*\", \"org.json.*\"})\n@PrepareForTest({CTGeofenceAPI.class, CleverTapAPI.class, Utils.class, GeofencingEvent.class\n, FileUtils.class})\n+@Ignore\npublic class PushGeofenceEventTaskTest extends BaseTestCase {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-geofence/src/test/java/com/clevertap/android/geofence/PushLocationEventTaskTest.java", "new_path": "clevertap-geofence/src/test/java/com/clevertap/android/geofence/PushLocationEventTaskTest.java", "diff": "@@ -30,6 +30,7 @@ import org.robolectric.annotation.Config;\n)\n@PowerMockIgnore({\"org.mockito.*\", \"org.robolectric.*\", \"android.*\", \"androidx.*\", \"org.json.*\"})\n@PrepareForTest({CTGeofenceAPI.class, CleverTapAPI.class, Utils.class, LocationResult.class})\n+@Ignore\npublic class PushLocationEventTaskTest extends BaseTestCase {\n@Mock\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-geofence_sdk): Ignore play-services-location related test cases due to powermock error SDK-1113
116,616
27.10.2021 18:17:47
-19,080
d4e1dfabfa007ca1f1c46503324926098061f90b
task(SDK-1117) - Remove all loggers from DeviceInfo and update javadoc for getAppStandbyBucket()
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/DeviceInfo.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/DeviceInfo.java", "diff": "@@ -169,12 +169,10 @@ public class DeviceInfo {\n//Returns the dpi using Device Configuration API for API30 above\nif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {\nConfiguration configuration = context.getResources().getConfiguration();\n- Logger.d(\"DeviceInfo-getDPI()\", \"dpi-> \" + configuration.densityDpi);\nreturn configuration.densityDpi;\n} else {\nDisplayMetrics dm = new DisplayMetrics();\nwm.getDefaultDisplay().getMetrics(dm);\n- Logger.d(\"DeviceInfo-getDPI()\", \"dpi-> \" + dm.densityDpi);\nreturn dm.densityDpi;\n}\n}\n@@ -209,10 +207,6 @@ public class DeviceInfo {\n}\n// Calculate the width in inches\ndouble rHeight = height / dpi;\n- Logger.d(\"DeviceInfo-getHeight()\", \"dm.heightPixels-> \" + height);\n- Logger.d(\"DeviceInfo-getHeight()\", \"dpi-> \" + dpi);\n- Logger.d(\"DeviceInfo-getHeight()\", \"rHeight-> \" + rHeight);\n- Logger.d(\"DeviceInfo-getHeight()\", \"toTwoPlaces(rHeight)-> \" + toTwoPlaces(rHeight));\nreturn toTwoPlaces(rHeight);\n}\n@@ -228,12 +222,10 @@ public class DeviceInfo {\n.getInsetsIgnoringVisibility(WindowInsets.Type.systemGestures());\nint heightInPixel = windowMetrics.getBounds().height() -\ninsets.top - insets.bottom;\n- Logger.d(\"DeviceInfo-getHeight()\", \"getHeightPixels()-> \" + heightInPixel);\nreturn heightInPixel;\n} else {\nDisplayMetrics dm = new DisplayMetrics();\nwm.getDefaultDisplay().getMetrics(dm);\n- Logger.d(\"DeviceInfo-getHeight()\", \"getHeightPixels()-> \" + dm.heightPixels);\nreturn dm.heightPixels;\n}\n}\n@@ -242,7 +234,8 @@ public class DeviceInfo {\nreturn Build.MANUFACTURER;\n}\n- /*\n+ /**\n+ * This method is used for devices above API 28\nThis method gets the standby values for app.Standby buckets are divided into the following:-\nSTANDBY_BUCKET_ACTIVE - The app was used very recently, currently in use or likely to be used very soon.\nSTANDBY_BUCKET_FREQUENT - The app was used in the last few days and/or likely to be used in the next few days.\n@@ -250,6 +243,9 @@ public class DeviceInfo {\nSTANDBY_BUCKET_RESTRICTED - The app has not be used for several days, is unlikely to be used for several days, and has\nbeen misbehaving in some manner.\nSTANDBY_BUCKET_WORKING_SET - The app was used recently and/or likely to be used in the next few hours.\n+\n+ @return one of the possible String value of AppStandbyBucket(). If no AppBucket info is found,\n+ returns empty String\n*/\n@RequiresApi(api = Build.VERSION_CODES.P)\nprivate String getAppBucket(){\n@@ -343,10 +339,6 @@ public class DeviceInfo {\n}\n// Calculate the width in inches\ndouble rWidth = width / dpi;\n- Logger.d(\"DeviceInfo-getWidth()\", \"dm.widthPixels-> \" + width);\n- Logger.d(\"DeviceInfo-getWidth()\", \"dpi-> \" + dpi);\n- Logger.d(\"DeviceInfo-getWidth()\", \"rWidth-> \" + rWidth);\n- Logger.d(\"DeviceInfo-getWidth()\", \"toTwoPlaces(rWidth)-> \" + toTwoPlaces(rWidth));\nreturn toTwoPlaces(rWidth);\n}\n@@ -363,12 +355,10 @@ public class DeviceInfo {\n.getInsetsIgnoringVisibility(WindowInsets.Type.systemGestures());\nint widthInPixel = windowMetrics.getBounds().width() -\ninsets.right - insets.left;\n- Logger.d(\"DeviceInfo-getWidth()\", \"getWidthPixels()-> \" + widthInPixel);\nreturn widthInPixel;\n} else {\nDisplayMetrics dm = new DisplayMetrics();\nwm.getDefaultDisplay().getMetrics(dm);\n- Logger.d(\"DeviceInfo-getWidth()\", \"getWidthPixels()-> \" + dm.widthPixels);\nreturn dm.widthPixels;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/utils/CTJsonConverter.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/utils/CTJsonConverter.java", "diff": "@@ -85,9 +85,8 @@ public class CTJsonConverter {\nevtData.put(\"hgt\", deviceInfo.getHeight());\nevtData.put(\"dpi\", deviceInfo.getDPI());\nevtData.put(\"dt\", DeviceInfo.getDeviceType(deviceInfo.getContext()));\n- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//Sends StandbyBucket info on API 28 and above.\n+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {\nevtData.put(\"abckt\", deviceInfo.getAppBucket());\n- Logger.d(\"CTJsonConverter\", deviceInfo.getAppBucket());\n}\nif (deviceInfo.getLibrary() != null) {\nevtData.put(\"lib\", deviceInfo.getLibrary());\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1117) - Remove all loggers from DeviceInfo and update javadoc for getAppStandbyBucket()
116,616
29.10.2021 11:05:34
-19,080
864181a49f9759d2089eee2fa47bcdaaf736a284
task(SDK-1117) - Remove all logs in CTInAppBaseFullNativeFragment
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/inapp/CTInAppBaseFullNativeFragment.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/inapp/CTInAppBaseFullNativeFragment.java", "diff": "@@ -26,12 +26,10 @@ public abstract class CTInAppBaseFullNativeFragment extends CTInAppBaseFullFragm\n//Returns the dpi using Device Configuration API for API30 above\nif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {\nConfiguration configuration = context.getResources().getConfiguration();\n- Logger.d(\"DeviceInfo-getDPI()\", \"dpi-> \" + configuration.densityDpi);\nreturn configuration.densityDpi;\n}else {\nDisplayMetrics dm = new DisplayMetrics();\nwm.getDefaultDisplay().getMetrics(dm);\n- Logger.d(\"DeviceInfo-getDPI()\", \"dpi-> \" + dm.densityDpi);\nreturn dm.densityDpi;\n}\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1117) - Remove all logs in CTInAppBaseFullNativeFragment
116,623
01.11.2021 14:09:07
-19,080
8b6de71bf7dededfc1a33a85437097983ba27abf
(bugfix:SDK-1108): Allowing pushDeepLink to be called if instance is created and not relying on accountId check
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/ActivityLifeCycleManager.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/ActivityLifeCycleManager.java", "diff": "@@ -112,9 +112,9 @@ class ActivityLifeCycleManager {\ninAppController.checkPendingInAppNotifications(activity);\n}\n- public void onActivityCreated(final Bundle notification, final Uri deepLink) {\n+ public void onActivityCreated(final Bundle notification, final Uri deepLink, String accountId) {\ntry {\n- boolean shouldProcess = config.isDefaultInstance();\n+ boolean shouldProcess = (accountId == null && config.isDefaultInstance()) || config.getAccountId().equals(accountId);\nif (shouldProcess) {\nif (notification != null && !notification.isEmpty() && notification\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java", "diff": "@@ -2577,7 +2577,7 @@ public class CleverTapAPI implements CTInboxActivity.InboxActivityListener {\ndeepLink = intent.getData();\nif (deepLink != null) {\nBundle queryArgs = UriHelper.getAllKeyValuePairs(deepLink.toString(), true);\n- _accountId = queryArgs.getString(Constants.WZRK_ACCT_ID_KEY);\n+ _accountId = queryArgs.getString(Constants.WZRK_ACCT_ID_KEY);//null\n}\n} catch (Throwable t) {\n// Ignore\n@@ -2609,9 +2609,15 @@ public class CleverTapAPI implements CTInboxActivity.InboxActivityListener {\nreturn;\n}\n- CleverTapAPI instance = CleverTapAPI.instances.get(_accountId);\n+ try{\n+ for(String accountId : CleverTapAPI.instances.keySet()){\n+ CleverTapAPI instance = CleverTapAPI.instances.get(accountId);\nif(instance != null){\n- instance.coreState.getActivityLifeCycleManager().onActivityCreated(notification, deepLink);\n+ instance.coreState.getActivityLifeCycleManager().onActivityCreated(notification, deepLink, _accountId);\n+ }\n+ }\n+ }catch (Throwable t){\n+ Logger.v(\"Throwable - \" + t.getLocalizedMessage());\n}\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
(bugfix:SDK-1108): Allowing pushDeepLink to be called if instance is created and not relying on accountId check
116,616
01.11.2021 14:11:12
-19,080
b2b584cedf3102977ec3d3a1c5ff373a0d4dbab5
task(SDK-1069) - Add log for limitAdTracking-true
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/DeviceInfo.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/DeviceInfo.java", "diff": "@@ -3,7 +3,6 @@ package com.clevertap.android.sdk;\nimport android.Manifest;\nimport android.annotation.SuppressLint;\nimport android.app.UiModeManager;\n-import android.app.usage.UsageStats;\nimport android.app.usage.UsageStatsManager;\nimport android.bluetooth.BluetoothAdapter;\nimport android.content.Context;\n@@ -797,6 +796,8 @@ public class DeviceInfo {\ngetConfigLogger().verbose(config.getAccountId() + \":async_deviceID\",\n\"limitAdTracking = \" + limitAdTracking);\nif (limitAdTracking) {\n+ getConfigLogger().debug(config.getAccountId(),\n+ \"Device user has opted out of sharing Advertising ID, falling back to random UUID for CleverTap ID generation\");\nreturn;\n}\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1069) - Add log for limitAdTracking-true
116,612
01.11.2021 14:13:12
-19,080
d736752c9d1ae8ce645ae2e1e728e89fef27b114
task(android12_support-core_sdk): Fix isNotificationSupported for runInstanceJobWork
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "diff": "@@ -440,7 +440,7 @@ public class PushProviders implements CTPushProviderListener {\ntask.execute(\"runningJobService\", new Callable<Void>() {\n@Override\npublic Void call() {\n- if (isNotificationSupported()) {\n+ if (!isNotificationSupported()) {\nLogger.v(config.getAccountId(), \"Token is not present, not running the Job\");\nreturn null;\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-core_sdk): Fix isNotificationSupported for runInstanceJobWork SDK-1111
116,612
01.11.2021 14:14:30
-19,080
c8ab3fddd115fdbdaf39282c452dd122f887c3dd
task(android12_support-sample_app): Fix TLS support for API <= 19 emulators
[ { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/MyApplication.kt", "new_path": "sample/src/main/java/com/clevertap/demo/MyApplication.kt", "diff": "package com.clevertap.demo\nimport android.app.NotificationManager\n+import android.content.Context\n+import android.content.Intent\nimport android.util.Log\n+import androidx.multidex.MultiDex\nimport androidx.multidex.MultiDexApplication\nimport com.clevertap.android.sdk.ActivityLifecycleCallback\nimport com.clevertap.android.sdk.CleverTapAPI\nimport com.clevertap.android.sdk.CleverTapAPI.LogLevel.VERBOSE\nimport com.clevertap.android.sdk.SyncListener\nimport com.clevertap.android.sdk.pushnotification.CTPushNotificationListener\n+import com.google.android.gms.security.ProviderInstaller\n+import com.google.android.gms.security.ProviderInstaller.ProviderInstallListener\nimport org.json.JSONObject\nimport java.util.HashMap\n@@ -18,6 +23,14 @@ class MyApplication : MultiDexApplication(), CTPushNotificationListener {\nCleverTapAPI.setDebugLevel(VERBOSE)\nActivityLifecycleCallback.register(this)\nsuper.onCreate()\n+\n+ ProviderInstaller.installIfNeededAsync(this, object : ProviderInstallListener {\n+ override fun onProviderInstalled() {}\n+ override fun onProviderInstallFailed(i: Int, intent: Intent?) {\n+ Log.i(\"ProviderInstaller\", \"Provider install failed ($i) : SSL Problems may occurs\")\n+ }\n+ })\n+\nval defaultInstance = CleverTapAPI.getDefaultInstance(this)\ndefaultInstance?.syncListener = object : SyncListener {\noverride fun profileDataUpdated(updates: JSONObject?) {//no op\n@@ -51,4 +64,9 @@ class MyApplication : MultiDexApplication(), CTPushNotificationListener {\noverride fun onNotificationClickedPayloadReceived(payload: HashMap<String, Any>?) {\nLog.i(\"MyApplication\", \"onNotificationClickedPayloadReceived = $payload\")\n}\n+\n+ override fun attachBaseContext(base: Context?) {\n+ super.attachBaseContext(base)\n+ MultiDex.install(this)\n+ }\n}\n\\ No newline at end of file\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-sample_app): Fix TLS support for API <= 19 emulators SDK-1114
116,623
01.11.2021 14:42:06
-19,080
7b4dff128c5351e9ad83246bf5b5c88dbea0db33
task(SDK-1067): Added proper javadoc for deprecated classes CTNotificationIntentService and CTPushNotificationReceiver
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CTNotificationIntentService.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CTNotificationIntentService.java", "diff": "@@ -11,7 +11,18 @@ import com.clevertap.android.sdk.Logger;\nimport com.clevertap.android.sdk.Utils;\n/**\n- * In order to support Android 12 notification trampoline, this class is being deprecated from 4.3.0 onwards\n+ * Android 12 prevents components that start other activities inside services or broadcast receivers when notification is opened.\n+ * If this requirement is not met, the system will prevent the activity from starting.\n+ *\n+ * As a part of these Android OS changes, CleverTap will be deprecating the CTNotificationIntentService class from v4.3.0\n+ *\n+ * CTNotificationIntentService was used to handle Push notifications with action buttons. The service used to open the deeplink\n+ * and close the notification tray.\n+ *\n+ * From Android 12, closing of the notification tray is now handled by the OS when it opens an Activity.\n+ * If the action buttons are redirecting the user to an existing activity inside the app, then\n+ * the Notification Clicked event will be triggered with the event properties mentioning which action button was clicked.\n+ * If the deep link is to a third-party application or a URL, then the Notification Clicked event will not be tracked.\n*/\n@Deprecated(since = \"4.3.0\")\npublic class CTNotificationIntentService extends IntentService {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CTPushNotificationReceiver.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CTPushNotificationReceiver.java", "diff": "@@ -11,7 +11,18 @@ import com.clevertap.android.sdk.Logger;\nimport com.clevertap.android.sdk.Utils;\n/**\n- * In order to support Android 12 notification trampoline, this class is being deprecated from 4.3.0 onwards\n+ * Android 12 prevents components that start other activities inside services or broadcast receivers when notification is opened.\n+ * If this requirement is not met, the system will prevent the activity from starting.\n+ *\n+ * As a part of these Android OS changes, CleverTap will be deprecating the CTPushNotificationReceiver class from v4.3.0\n+ *\n+ * CTPushNotificationReceiver was used to handle Push notifications with deep links pointing inside the app or third-party applications/URLs.\n+ * The receiver would first raise the Notification Clicked event and then open the Activity as mentioned in the deep link.\n+ *\n+ * Android 12 restricts usage of notification trampolines, meaning that notification must start the activity directly on the notification tap.\n+ * Tracking of Notification Clicked events now happens in the {@link CleverTapAPI} }instance registered by {@link com.clevertap.android.sdk.ActivityLifecycleCallback}.\n+ * The push payload is attached as an extra to the notification intent and processed when the notification is tapped.\n+ * If the deep link is to a third-party application or a URL, then the Notification Clicked event will NO LONGER be tracked.\n*/\n@Deprecated(since = \"4.3.0\")\npublic class CTPushNotificationReceiver extends BroadcastReceiver {\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1067): Added proper javadoc for deprecated classes CTNotificationIntentService and CTPushNotificationReceiver
116,623
01.11.2021 14:45:12
-19,080
f4d480a38956a3ef6c130e806554f03039f6be24
bugfix(SDK-1108): code cleanup
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java", "diff": "@@ -2577,7 +2577,7 @@ public class CleverTapAPI implements CTInboxActivity.InboxActivityListener {\ndeepLink = intent.getData();\nif (deepLink != null) {\nBundle queryArgs = UriHelper.getAllKeyValuePairs(deepLink.toString(), true);\n- _accountId = queryArgs.getString(Constants.WZRK_ACCT_ID_KEY);//null\n+ _accountId = queryArgs.getString(Constants.WZRK_ACCT_ID_KEY);\n}\n} catch (Throwable t) {\n// Ignore\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
bugfix(SDK-1108): code cleanup
116,623
02.11.2021 11:51:10
-19,080
69f8bc4a80a1665aff09845886db2f5dcc12cc84
task(SDK-1067): Updated all CHANGELOGs and README for v4.3.0 release
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "## CHANGE LOG\n+### November 2, 2021\n+\n+* [CleverTap Android SDK v4.3.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md)\n+* [CleverTap Geofence SDK v1.1.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTGEOFENCECHANGELOG.md)\n+* [CleverTap Xiaomi Push SDK v1.1.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTXIAOMIPUSHCHANGELOG.md)\n+* [CleverTap Huawei Push SDK v1.1.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTHUAWEIPUSHCHANGELOG.md)\n+\n+\n### July 15, 2021\n* [CleverTap Android SDK v4.2.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md)\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -24,7 +24,7 @@ We publish the SDK to `mavenCentral` as an `AAR` file. Just declare it as depend\n```groovy\ndependencies {\n- implementation \"com.clevertap.android:clevertap-android-sdk:4.2.0\"\n+ implementation \"com.clevertap.android:clevertap-android-sdk:4.3.0\"\n}\n```\n@@ -32,7 +32,7 @@ Alternatively, you can download and add the AAR file included in this repo in yo\n```groovy\ndependencies {\n- implementation (name: \"clevertap-android-sdk-4.2.0\", ext: 'aar')\n+ implementation (name: \"clevertap-android-sdk-4.3.0\", ext: 'aar')\n}\n```\n@@ -44,11 +44,11 @@ Add the Firebase Messaging library and Android Support Library v4 as dependencie\n```groovy\ndependencies {\n- implementation \"com.clevertap.android:clevertap-android-sdk:4.2.0\"\n+ implementation \"com.clevertap.android:clevertap-android-sdk:4.3.0\"\nimplementation \"androidx.core:core:1.3.0\"\nimplementation \"com.google.firebase:firebase-messaging:20.2.4\"\nimplementation \"com.google.android.gms:play-services-ads:19.4.0\" // Required only if you enable Google ADID collection in the SDK (turned off by default).\n- implementation \"com.android.installreferrer:installreferrer:2.1\" // Mandatory for v3.6.4 and above\n+ implementation \"com.android.installreferrer:installreferrer:2.2\" // Mandatory for v3.6.4 and above\n}\n```\n@@ -86,9 +86,9 @@ apply plugin: 'com.google.gms.google-services'\nInterstitial InApp Notification templates support Audio and Video with the help of ExoPlayer. To enable Audio/Video in your Interstitial InApp Notifications, add the following dependencies in your `build.gradle` file :\n```groovy\n- implementation \"com.google.android.exoplayer:exoplayer:2.11.5\"\n- implementation \"com.google.android.exoplayer:exoplayer-hls:2.11.5\"\n- implementation \"com.google.android.exoplayer:exoplayer-ui:2.11.5\"\n+ implementation \"com.google.android.exoplayer:exoplayer:2.15.1\"\n+ implementation \"com.google.android.exoplayer:exoplayer-hls:2.15.1\"\n+ implementation \"com.google.android.exoplayer:exoplayer-ui:2.15.1\"\n```\nOnce you've updated your module `build.gradle` file, make sure you have specified `mavenCentral()` and `google()` as a repositories in your project `build.gradle` and then sync your project in File -> Sync Project with Gradle Files.\n" }, { "change_type": "MODIFY", "old_path": "docs/CTCORECHANGELOG.md", "new_path": "docs/CTCORECHANGELOG.md", "diff": "## CleverTap Android SDK CHANGE LOG\n+### Version 4.3.0 (November 2, 2021)\n+* Adds support for [apps targeting Android 12 (API 31)](https://developer.android.com/about/versions/12/behavior-changes-12)\n+ This version is compatible with all new Android 12 changes like Notification Trampolines, Pending Intents Mutability and Safer Component Exporting.\n+ For more information check out the [CleverTap documentation for Android 12 here](https://developer.clevertap.com/docs/android-12-changes)\n+* Deprecated `CTPushNotificationReceiver` and `CTNotificationIntentService` as a part of Notification Trampoline restrictions in Android 12 (API 31)\n+* Last version with support for custom FCM Sender ID for generating the FCM token\n+* Fixes a bug where `UTM Visited` event was not being raised on click of a direct deep link\n+\n### Version 4.2.0 (July 15, 2021)\n* Adds public methods for suspending/discarding & resuming InApp Notifications\n* Adds public methods to increment/decrement values set via User properties\n" }, { "change_type": "MODIFY", "old_path": "docs/CTGEOFENCECHANGELOG.md", "new_path": "docs/CTGEOFENCECHANGELOG.md", "diff": "## CleverTap Geofence SDK CHANGE LOG\n+### Version 1.1.0 (November 2, 2021)\n+* Added support for Android 12 changes\n+* Added support for CleverTap Android SDK v4.3.0\n+\n### Version 1.0.2 (April 13, 2021)\n* Added new method in `CTGeofenceSettings` - `setGeofenceNotificationResponsiveness()`\n* Add support for CleverTap Android SDK v4.1.0\n" }, { "change_type": "MODIFY", "old_path": "docs/CTHUAWEIPUSHCHANGELOG.md", "new_path": "docs/CTHUAWEIPUSHCHANGELOG.md", "diff": "## CleverTap Huawei Push SDK CHANGE LOG\n+### Version 1.1.0 (November 2, 2021)\n+* Updated Huawei Push SDK to v6.1.0.300\n+* Supports CleverTap Android SDK v4.3.0\n+\n### Version 1.0.2 (July 15, 2021)\n* Updated Huawei Push SDK to v5.3.0.304\n* Supports CleverTap Android SDK v4.2.0\n" }, { "change_type": "MODIFY", "old_path": "docs/CTXIAOMIPUSHCHANGELOG.md", "new_path": "docs/CTXIAOMIPUSHCHANGELOG.md", "diff": "## CleverTap Xiaomi Push SDK CHANGE LOG\n+### Version 1.1.0 (November 2, 2021)\n+* Updated Xiaomi Push SDK to v4.8.2\n+* Supports CleverTap Android SDK v4.3.0\n+\n### Version 1.0.2 (May 4, 2021)\n* Fixes the \"unspecified\" error during Gradle build\n* Please do not use v1.0.1 and use this version instead\n" }, { "change_type": "MODIFY", "old_path": "docs/EXAMPLES.md", "new_path": "docs/EXAMPLES.md", "diff": "@@ -150,16 +150,16 @@ Use `onUserLogin` to maintain multiple distinct user profiles on the same device\nAdd the following dependencies in your app's `build.gradle`\n```groovy\n-implementation \"androidx.appcompat:appcompat:1.2.0\"//MANDATORY for App Inbox\n-implementation \"androidx.recyclerview:recyclerview:1.1.0\"//MANDATORY for App Inbox\n+implementation \"androidx.appcompat:appcompat:1.3.1\"//MANDATORY for App Inbox\n+implementation \"androidx.recyclerview:recyclerview:1.2.1\"//MANDATORY for App Inbox\nimplementation \"androidx.viewpager:viewpager:1.0.0\"//MANDATORY for App Inbox\n-implementation \"com.google.android.material:material:1.2.1\"//MANDATORY for App Inbox\n-implementation \"com.github.bumptech.glide:glide:4.11.0\"//MANDATORY for App Inbox\n+implementation \"com.google.android.material:material:1.4.0\"//MANDATORY for App Inbox\n+implementation \"com.github.bumptech.glide:glide:4.12.0\"//MANDATORY for App Inbox\n//Optional ExoPlayer Libraries for Audio/Video Inbox Messages. Audio/Video messages will be dropped without these dependencies\n-implementation \"com.google.android.exoplayer:exoplayer:2.11.5\"\n-implementation \"com.google.android.exoplayer:exoplayer-hls:2.11.5\"\n-implementation \"com.google.android.exoplayer:exoplayer-ui:2.11.5\"\n+implementation \"com.google.android.exoplayer:exoplayer:2.15.1\"\n+implementation \"com.google.android.exoplayer:exoplayer-hls:2.15.1\"\n+implementation \"com.google.android.exoplayer:exoplayer-ui:2.15.1\"\n```\n#### Initializing the Inbox\n@@ -337,5 +337,5 @@ To support in-app notifications, register the following activity in your Android\nFrom CleverTap SDK v3.6.4 onwards, just remove the above the Broadcast Receiver if you are using it and add the following gradle dependency to capture UTM details, app install time, referrer click time and other metrics provided by the Google Install Referrer Library.\n```groovy\n- implementation \"com.android.installreferrer:installreferrer:2.1\"\n+ implementation \"com.android.installreferrer:installreferrer:2.2\"\n```\n" }, { "change_type": "MODIFY", "old_path": "templates/CTCORECHANGELOG.md", "new_path": "templates/CTCORECHANGELOG.md", "diff": "## CleverTap Android SDK CHANGE LOG\n+### Version 4.3.0 (November 2, 2021)\n+* Adds support for [apps targeting Android 12 (API 31)](https://developer.android.com/about/versions/12/behavior-changes-12)\n+ This version is compatible with all new Android 12 changes like Notification Trampolines, Pending Intents Mutability and Safer Component Exporting.\n+ For more information check out the [CleverTap documentation for Android 12 here](https://developer.clevertap.com/docs/android-12-changes)\n+* Deprecated `CTPushNotificationReceiver` and `CTNotificationIntentService` as a part of Notification Trampoline restrictions in Android 12 (API 31)\n+* Last version with support for custom FCM Sender ID for generating the FCM token\n+* Fixes a bug where `UTM Visited` event was not being raised on click of a direct deep link\n+\n### Version 4.2.0 (July 15, 2021)\n* Adds public methods for suspending/discarding & resuming InApp Notifications\n* Adds public methods to increment/decrement values set via User properties\n" }, { "change_type": "MODIFY", "old_path": "templates/CTGEOFENCECHANGELOG.md", "new_path": "templates/CTGEOFENCECHANGELOG.md", "diff": "## CleverTap Geofence SDK CHANGE LOG\n+### Version 1.1.0 (November 2, 2021)\n+* Added support for Android 12 changes\n+* Added support for CleverTap Android SDK v4.3.0\n+\n### Version 1.0.2 (April 13, 2021)\n* Added new method in `CTGeofenceSettings` - `setGeofenceNotificationResponsiveness()`\n* Add support for CleverTap Android SDK v4.1.0\n" }, { "change_type": "MODIFY", "old_path": "templates/CTHUAWEIPUSHCHANGELOG.md", "new_path": "templates/CTHUAWEIPUSHCHANGELOG.md", "diff": "## CleverTap Huawei Push SDK CHANGE LOG\n+### Version 1.1.0 (November 2, 2021)\n+* Updated Huawei Push SDK to v6.1.0.300\n+* Supports CleverTap Android SDK v4.3.0\n+\n### Version 1.0.2 (July 15, 2021)\n* Updated Huawei Push SDK to v5.3.0.304\n* Supports CleverTap Android SDK v4.2.0\n" }, { "change_type": "MODIFY", "old_path": "templates/CTXIAOMIPUSHCHANGELOG.md", "new_path": "templates/CTXIAOMIPUSHCHANGELOG.md", "diff": "## CleverTap Xiaomi Push SDK CHANGE LOG\n+### Version 1.1.0 (November 2, 2021)\n+* Updated Xiaomi Push SDK to v4.8.2\n+* Supports CleverTap Android SDK v4.3.0\n+\n### Version 1.0.2 (May 4, 2021)\n* Fixes the \"unspecified\" error during Gradle build\n* Please do not use v1.0.1 and use this version instead\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1067): Updated all CHANGELOGs and README for v4.3.0 release
116,612
02.11.2021 13:00:10
-19,080
80146b1289f62b893a770caa79c176434cc54378
task(android12_support-geofence_sdk): Add COARSE_LOCATION permission in manifest as required from Android S onward
[ { "change_type": "MODIFY", "old_path": "clevertap-geofence/src/main/AndroidManifest.xml", "new_path": "clevertap-geofence/src/main/AndroidManifest.xml", "diff": "xmlns:android=\"http://schemas.android.com/apk/res/android\">\n<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />\n+ <uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />\n<uses-permission android:name=\"android.permission.ACCESS_BACKGROUND_LOCATION\" />\n<uses-permission android:name=\"android.permission.WAKE_LOCK\" />\n<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\" />\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-geofence_sdk): Add COARSE_LOCATION permission in manifest as required from Android S onward SDK-1113
116,612
02.11.2021 13:00:40
-19,080
c72e6a2435c35d5b37accf917a3d1ae352e82180
task(android12_support-sample_app): update message for location permission
[ { "change_type": "MODIFY", "old_path": "sample/src/main/res/values/strings.xml", "new_path": "sample/src/main/res/values/strings.xml", "diff": "<!-- Geofence -->\n<string name=\"ok\">OK</string>\n<string name=\"permission_rationale\">All the time location permission required for core functionality</string>\n- <string name=\"permission_denied_explanation\">Permission was denied, but is needed for core\n- functionality.</string>\n+ <string name=\"permission_denied_explanation\">Please provide All time Precise location Permission from settings.</string>\n<string name=\"settings\">Settings</string>\n</resources>\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(android12_support-sample_app): update message for location permission SDK-1114
116,612
16.11.2021 10:22:40
-19,080
eadfa81edf1732c1d6be0d3a1eb0f5b13d56636c
task(refactor): Add push templates to sample app
[ { "change_type": "MODIFY", "old_path": "sample/build.gradle", "new_path": "sample/build.gradle", "diff": "@@ -59,6 +59,7 @@ dependencies {\n// For Xiaomi Push use\n//implementation 'com.clevertap.android:clevertap-xiaomi-sdk:1.1.0'\nimplementation project(':clevertap-hms')\n+ implementation project(':clevertap-pushTemplate')\n// For Huawei Push use\n//implementation 'com.clevertap.android:clevertap-hms-sdk:1.1.0'\n//implementation 'com.huawei.hms:push:6.1.0.300'\n" }, { "change_type": "MODIFY", "old_path": "sample/google-services.json", "new_path": "sample/google-services.json", "diff": "},\n{\n\"client_info\": {\n- \"mobilesdk_app_id\": \"1:112273261716:android:2c6b3cc8d6c84037066081\",\n+ \"mobilesdk_app_id\": \"1:112273261716:android:177a7432d484a24c066081\",\n\"android_client_info\": {\n\"package_name\": \"com.clevertap.demo\"\n}\n]\n}\n}\n+ },\n+ {\n+ \"client_info\": {\n+ \"mobilesdk_app_id\": \"1:112273261716:android:41c9fcb7276cd134066081\",\n+ \"android_client_info\": {\n+ \"package_name\": \"com.clevertap.templateapp\"\n+ }\n+ },\n+ \"oauth_client\": [\n+ {\n+ \"client_id\": \"112273261716-9vd03s0ivfqgh4q3lklb2i1ksroga18k.apps.googleusercontent.com\",\n+ \"client_type\": 3\n+ }\n+ ],\n+ \"api_key\": [\n+ {\n+ \"current_key\": \"AIzaSyBbQ8Qu2N_xktuRxIBxzNNoOWIvVB3OXoY\"\n+ }\n+ ],\n+ \"services\": {\n+ \"appinvite_service\": {\n+ \"other_platform_oauth_client\": [\n+ {\n+ \"client_id\": \"112273261716-9vd03s0ivfqgh4q3lklb2i1ksroga18k.apps.googleusercontent.com\",\n+ \"client_type\": 3\n+ },\n+ {\n+ \"client_id\": \"112273261716-kv2gfoeh8rjmqtbfrv437ppjan06tdll.apps.googleusercontent.com\",\n+ \"client_type\": 2,\n+ \"ios_info\": {\n+ \"bundle_id\": \"com.clevertap.BeardedRobot\"\n+ }\n+ }\n+ ]\n+ }\n+ }\n}\n],\n\"configuration_version\": \"1\"\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/AndroidManifest.xml", "new_path": "sample/src/main/AndroidManifest.xml", "diff": "<!-- Add meta data for CleverTap Account Id and Account Token -->\n<meta-data\nandroid:name=\"CLEVERTAP_ACCOUNT_ID\"\n- android:value=\"TEST-46W-WWR-R85Z\" />\n+ android:value=\"ZWW-WWW-WWRZ\" />\n<meta-data\nandroid:name=\"CLEVERTAP_TOKEN\"\n- android:value=\"TEST-200-064\" />\n+ android:value=\"000-001\" />\n<!-- Xiaomi Push -->\n<meta-data\n<action android:name=\"com.clevertap.PUSH_EVENT\" />\n</intent-filter>\n</service>\n+ <receiver\n+ android:name=\"com.clevertap.android.pushtemplates.PTPushNotificationReceiver\"\n+ android:exported=\"false\"\n+ android:enabled=\"true\">\n+ </receiver>\n+\n+ <receiver\n+ android:name=\"com.clevertap.android.pushtemplates.PushTemplateReceiver\"\n+ android:exported=\"false\"\n+ android:enabled=\"true\">\n+ </receiver>\n<activity\nandroid:name=\".WebViewActivity\"\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/MyApplication.kt", "new_path": "sample/src/main/java/com/clevertap/demo/MyApplication.kt", "diff": "@@ -6,10 +6,13 @@ import android.content.Intent\nimport android.util.Log\nimport androidx.multidex.MultiDex\nimport androidx.multidex.MultiDexApplication\n+import com.clevertap.android.pushtemplates.PushTemplateNotificationHandler\n+import com.clevertap.android.pushtemplates.TemplateRenderer\nimport com.clevertap.android.sdk.ActivityLifecycleCallback\nimport com.clevertap.android.sdk.CleverTapAPI\nimport com.clevertap.android.sdk.CleverTapAPI.LogLevel.VERBOSE\nimport com.clevertap.android.sdk.SyncListener\n+import com.clevertap.android.sdk.interfaces.NotificationHandler\nimport com.clevertap.android.sdk.pushnotification.CTPushNotificationListener\nimport com.google.android.gms.security.ProviderInstaller\nimport com.google.android.gms.security.ProviderInstaller.ProviderInstallListener\n@@ -21,6 +24,8 @@ class MyApplication : MultiDexApplication(), CTPushNotificationListener {\noverride fun onCreate() {\nCleverTapAPI.setDebugLevel(VERBOSE)\n+ TemplateRenderer.debugLevel = 3;\n+ CleverTapAPI.setNotificationHandler(PushTemplateNotificationHandler() as NotificationHandler);\nActivityLifecycleCallback.register(this)\nsuper.onCreate()\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenModel.kt", "new_path": "sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenModel.kt", "diff": "@@ -41,7 +41,9 @@ object HomeScreenModel {\n\"FEATURE FLAGS\" to listOf(\"Get Feature Flag\"),\n\"WEBVIEW\" to listOf(\"Raise events from WebView\"),\n\"GEOFENCE\" to listOf(\"Init Geofence\", \"Trigger Location\", \"Deactivate Geofence\"),\n- \"DEVICE IDENTIFIERS\" to listOf(\"Fetch CleverTapAttribution Identifier\", \"Fetch CleverTap ID\")\n+ \"DEVICE IDENTIFIERS\" to listOf(\"Fetch CleverTapAttribution Identifier\", \"Fetch CleverTap ID\"),\n+ \"PUSH TEMPLATES\" to listOf(\"Basic Push\", \"Carousel Push\", \"Manual Carousel Push\", \"FilmStrip Carousel Push\",\n+ \"Rating Push\",\"Product Display\",\"Linear Product Display\",\"Five CTA\",\"Zero Bezel\",\"Timer Push\",\"Input Box Push\")\n)\n}\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenViewModel.kt", "new_path": "sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenViewModel.kt", "diff": "@@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData\nimport androidx.lifecycle.ViewModel\nimport com.clevertap.android.sdk.CTInboxStyleConfig\nimport com.clevertap.android.sdk.CleverTapAPI\n+import java.util.ArrayList\nimport java.util.Date\nclass HomeScreenViewModel(private val cleverTapAPI: CleverTapAPI?) : ViewModel() {\n@@ -294,6 +295,17 @@ class HomeScreenViewModel(private val cleverTapAPI: CleverTapAPI?) : ViewModel()\n}\"\n)\n}\n+ \"90\"-> cleverTapAPI?.pushEvent(\"Send Basic Push\")\n+ \"91\"-> cleverTapAPI?.pushEvent(\"Send Auto Carousel Push\")\n+ \"92\"-> cleverTapAPI?.pushEvent(\"Send Manual Carousel Push\")\n+ \"93\"-> cleverTapAPI?.pushEvent(\"Send Filmstrip Carousel Push\")\n+ \"94\"-> cleverTapAPI?.pushEvent(\"Send Rating Push\")\n+ \"95\"-> cleverTapAPI?.pushEvent(\"Send Product Display Notification\")\n+ \"96\"-> cleverTapAPI?.pushEvent(\"Send Linear Product Display Push\")\n+ \"97\"-> cleverTapAPI?.pushEvent(\"Send CTA Notification\")\n+ \"98\"-> cleverTapAPI?.pushEvent(\"Send Zero Bezel Notification\")\n+ \"99\"-> cleverTapAPI?.pushEvent(\"Send Timer Notification\")\n+ \"910\"-> cleverTapAPI?.pushEvent(\"Send Input Box Notification\")\n//\"60\" -> webViewClickListener?.onWebViewClick()\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Add push templates to sample app SDK-1056
116,612
16.11.2021 10:26:54
-19,080
bb41f1bb5f131445875026cd63b8655eb0cda854
task(refactor): Make ValidatorFactory companion object and createKeysMap public
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/validators/ValidatorFactory.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/validators/ValidatorFactory.kt", "diff": "@@ -39,21 +39,19 @@ const val PT_ACTIONS = \"PT_ACTIONS\"\nfun Iterable<Checker<out Any>>.and(): Boolean {\nvar and: Boolean = true\nfor (element in this) {\n- and = element.check() && and // checking first will allow us to execute all checks instead of short circuiting\n+ and =\n+ element.check() && and // checking first will allow us to execute all checks(for printing errors) instead of short circuiting\n}\nreturn and\n}\n-class ValidatorFactory {\n+internal class ValidatorFactory {\n+ companion object{\nprivate lateinit var keys: Map<String, Checker<out Any>>\n- private var keysLoaded: Boolean = false\n- private fun getValidator(templateType: TemplateType, templateRenderer: TemplateRenderer): Validator? {\n-\n- if (!keysLoaded){\n+ fun getValidator(templateType: TemplateType, templateRenderer: TemplateRenderer): Validator? {\nkeys = createKeysMap(templateRenderer)\n- }\nreturn when (templateType) {\nBASIC -> BasicTemplateValidator(ContentValidator(keys))\n@@ -69,7 +67,7 @@ class ValidatorFactory {\n}\n- private fun createKeysMap(templateRenderer: TemplateRenderer): Map<String, Checker<out Any>>{\n+ fun createKeysMap(templateRenderer: TemplateRenderer): Map<String, Checker<out Any>> {\nval hashMap = HashMap<String, Checker<out Any>>()\n//----------BASIC-------------\nhashMap[PT_TITLE] = StringSizeChecker(templateRenderer.pt_title, 0, \"Title is missing or empty\")\n@@ -77,30 +75,41 @@ class ValidatorFactory {\nhashMap[PT_BG] = StringSizeChecker(templateRenderer.pt_bg, 0, \"Background colour is missing or empty\")\n//----------CAROUSEL-------------\nhashMap[PT_DEEPLINK_LIST] = ListSizeChecker(templateRenderer.deepLinkList, 1, \"Deeplink is missing or empty\")\n- hashMap[PT_THREE_IMAGE_LIST]=ListSizeChecker(templateRenderer.imageList,3,\"Three required images not present\")\n+ hashMap[PT_THREE_IMAGE_LIST] =\n+ ListSizeChecker(templateRenderer.imageList, 3, \"Three required images not present\")\n//----------RATING-------------\n- hashMap[PT_RATING_DEFAULT_DL]=StringSizeChecker(templateRenderer.pt_rating_default_dl, 0,\"Default deeplink is missing or empty\")\n+ hashMap[PT_RATING_DEFAULT_DL] =\n+ StringSizeChecker(templateRenderer.pt_rating_default_dl, 0, \"Default deeplink is missing or empty\")\n//----------FIVE ICON-------------\n- hashMap[PT_FIVE_DEEPLINK_LIST]=ListSizeChecker(templateRenderer.deepLinkList,5,\"Five required deeplinks not present\")\n- hashMap[PT_FIVE_IMAGE_LIST]=ListSizeChecker(templateRenderer.imageList,5,\"Five required images not present\")\n+ hashMap[PT_FIVE_DEEPLINK_LIST] =\n+ ListSizeChecker(templateRenderer.deepLinkList, 5, \"Five required deeplinks not present\")\n+ hashMap[PT_FIVE_IMAGE_LIST] =\n+ ListSizeChecker(templateRenderer.imageList, 5, \"Five required images not present\")\n//----------PROD DISPLAY-------------\n- hashMap[PT_THREE_DEEPLINK_LIST]=ListSizeChecker(templateRenderer.deepLinkList,3,\"Three required deeplinks not present\")\n- hashMap[PT_BIG_TEXT_LIST]=ListSizeChecker(templateRenderer.bigTextList,3,\"Three required product titles not present\")\n- hashMap[PT_SMALL_TEXT_LIST]=ListSizeChecker(templateRenderer.smallTextList,3,\"Three required product descriptions not present\")\n- hashMap[PT_PRODUCT_DISPLAY_ACTION]=StringSizeChecker(templateRenderer.pt_product_display_action,0,\"Button label is missing or empty\")\n- hashMap[PT_PRODUCT_DISPLAY_ACTION_CLR]=StringSizeChecker(templateRenderer.pt_product_display_action_clr,0,\"Button colour is missing or empty\")\n+ hashMap[PT_THREE_DEEPLINK_LIST] =\n+ ListSizeChecker(templateRenderer.deepLinkList, 3, \"Three required deeplinks not present\")\n+ hashMap[PT_BIG_TEXT_LIST] =\n+ ListSizeChecker(templateRenderer.bigTextList, 3, \"Three required product titles not present\")\n+ hashMap[PT_SMALL_TEXT_LIST] =\n+ ListSizeChecker(templateRenderer.smallTextList, 3, \"Three required product descriptions not present\")\n+ hashMap[PT_PRODUCT_DISPLAY_ACTION] =\n+ StringSizeChecker(templateRenderer.pt_product_display_action, 0, \"Button label is missing or empty\")\n+ hashMap[PT_PRODUCT_DISPLAY_ACTION_CLR] =\n+ StringSizeChecker(templateRenderer.pt_product_display_action_clr, 0, \"Button colour is missing or empty\")\n//----------ZERO BEZEL----------------\nhashMap[PT_BIG_IMG] = StringSizeChecker(templateRenderer.pt_big_img, 0, \"Display Image is missing or empty\")\n//----------TIMER----------------\n- hashMap[PT_TIMER_THRESHOLD]= IntSizeChecker(templateRenderer.pt_timer_threshold,-1,\"Timer Threshold or End time not defined\")\n- hashMap[PT_TIMER_END]= IntSizeChecker(templateRenderer.pt_timer_end,-1,\"Timer Threshold or End time not defined\")\n+ hashMap[PT_TIMER_THRESHOLD] =\n+ IntSizeChecker(templateRenderer.pt_timer_threshold, -1, \"Timer Threshold or End time not defined\")\n+ hashMap[PT_TIMER_END] =\n+ IntSizeChecker(templateRenderer.pt_timer_end, -1, \"Timer Threshold or End time not defined\")\n//----------INPUT BOX----------------\n- hashMap[PT_INPUT_FEEDBACK]=StringSizeChecker(templateRenderer.pt_input_feedback,0,\"Feedback Text or Actions is missing or empty\")\n- hashMap[PT_ACTIONS]=JsonArraySizeChecker(templateRenderer.actions,0,\"Feedback Text or Actions is missing or empty\")\n-\n- keysLoaded=true\n+ hashMap[PT_INPUT_FEEDBACK] =\n+ StringSizeChecker(templateRenderer.pt_input_feedback, 0, \"Feedback Text or Actions is missing or empty\")\n+ hashMap[PT_ACTIONS] =\n+ JsonArraySizeChecker(templateRenderer.actions, 0, \"Feedback Text or Actions is missing or empty\")\nreturn hashMap\n}\n-\n+ }\n}\n\\ No newline at end of file\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Make ValidatorFactory companion object and createKeysMap public SDK-1056
116,612
16.11.2021 10:29:04
-19,080
88043be5f692981607c44bab005d73eaa9cd4453
task(refactor): Replace legacy check logic with ValidatorFactory
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "diff": "package com.clevertap.android.pushtemplates\n-import android.app.Notification\nimport android.app.NotificationManager\n-import android.app.PendingIntent\nimport android.content.Context\n-import android.content.Intent\nimport android.graphics.Bitmap\n-import android.net.Uri\nimport android.os.*\n-import android.text.Html\n-import android.view.View\nimport android.widget.RemoteViews\nimport androidx.annotation.RequiresApi\nimport androidx.core.app.NotificationCompat\n-import androidx.core.app.RemoteInput\nimport com.clevertap.android.pushtemplates.styles.*\n+import com.clevertap.android.pushtemplates.validators.ValidatorFactory\nimport com.clevertap.android.sdk.CleverTapAPI\nimport com.clevertap.android.sdk.CleverTapInstanceConfig\nimport com.clevertap.android.sdk.Constants\n-import com.clevertap.android.sdk.pushnotification.CTNotificationIntentService\nimport com.clevertap.android.sdk.pushnotification.INotificationRenderer\nimport com.clevertap.android.sdk.pushnotification.PushNotificationUtil\nimport org.json.JSONArray\n@@ -27,6 +20,7 @@ import org.json.JSONObject\nimport java.util.*\nclass TemplateRenderer : INotificationRenderer {\n+\nprivate var pt_id: String? = null\nprivate var templateType: TemplateType? = null\ninternal var pt_title: String? = null\n@@ -105,12 +99,12 @@ class TemplateRenderer : INotificationRenderer {\nsetUp(context, extras, config)\n}\n- override fun getMessage(extras: Bundle): String {\n- return pt_msg!! // TODO: Check if set properly before caller calls this\n+ override fun getMessage(extras: Bundle): String? {\n+ return pt_msg // TODO: Check if set properly before caller calls this\n}\n- override fun getTitle(extras: Bundle, context: Context): String {\n- return pt_title!! // TODO: Check if set properly before caller calls this\n+ override fun getTitle(extras: Bundle, context: Context): String? {\n+ return pt_title // TODO: Check if set properly before caller calls this\n}\noverride fun renderNotification(\n@@ -125,44 +119,49 @@ class TemplateRenderer : INotificationRenderer {\nthis.notificationId = notificationId\nwhen (templateType) {\nTemplateType.BASIC ->\n- if(hasAllBasicNotifKeys())\n+ if (ValidatorFactory.getValidator(TemplateType.BASIC, this)?.validate() == true)\nreturn BasicStyle(this).builderFromStyle(context, extras, notificationId, nb)\nTemplateType.AUTO_CAROUSEL ->\n- if (hasAllCarouselNotifKeys())\n+ if (ValidatorFactory.getValidator(TemplateType.AUTO_CAROUSEL, this)?.validate() == true)\nreturn AutoCarouselStyle(this).builderFromStyle(context, extras, notificationId, nb)\nTemplateType.MANUAL_CAROUSEL ->\n- if (hasAllManualCarouselNotifKeys())\n+ if (ValidatorFactory.getValidator(TemplateType.MANUAL_CAROUSEL, this)?.validate() == true)\nreturn ManualCarouselStyle(this, extras).builderFromStyle(context, extras, notificationId, nb)\nTemplateType.RATING ->\n- if (hasAllRatingNotifKeys())\n+ if (ValidatorFactory.getValidator(TemplateType.RATING, this)?.validate() == true)\nreturn RatingStyle(this, extras).builderFromStyle(context, extras, notificationId, nb)\nTemplateType.FIVE_ICONS ->\n- if (hasAll5IconNotifKeys())\n- return FiveIconStyle(this,extras).builderFromStyle(context, extras, notificationId, nb).setOngoing(true)\n+ if (ValidatorFactory.getValidator(TemplateType.FIVE_ICONS, this)?.validate() == true)\n+ return FiveIconStyle(this, extras).builderFromStyle(context, extras, notificationId, nb)\n+ .setOngoing(true)\n- TemplateType.PRODUCT_DISPLAY -> if (hasAllProdDispNotifKeys())\n+ TemplateType.PRODUCT_DISPLAY -> if (ValidatorFactory.getValidator(TemplateType.PRODUCT_DISPLAY, this)\n+ ?.validate() == true\n+ )\nreturn ProductDisplayStyle(this, extras).builderFromStyle(context, extras, notificationId, nb)\nTemplateType.ZERO_BEZEL ->\n- if (hasAllZeroBezelNotifKeys())\n+ if (ValidatorFactory.getValidator(TemplateType.ZERO_BEZEL, this)?.validate() == true)\nreturn ZeroBezelStyle(this).builderFromStyle(context, extras, notificationId, nb)\nTemplateType.TIMER -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {\n- if (hasAllTimerKeys()){\n+ if (ValidatorFactory.getValidator(TemplateType.TIMER, this)?.validate() == true) {\nreturn TimerStyle(this, extras).builderFromStyle(context, extras, notificationId, nb)\n}\n} else {\nPTLog.debug(\"Push Templates SDK supports Timer Notifications only on or above Android Nougat, reverting to basic template\")\n- if (hasAllBasicNotifKeys()) {\n+ if (ValidatorFactory.getValidator(TemplateType.BASIC, this)?.validate() == true) {\nreturn BasicStyle(this).builderFromStyle(context, extras, notificationId, nb)\n}\n}\n- TemplateType.INPUT_BOX -> if (hasAllInputBoxKeys())\n+ TemplateType.INPUT_BOX -> if (ValidatorFactory.getValidator(TemplateType.INPUT_BOX, this)\n+ ?.validate() == true\n+ )\nreturn InputBoxStyle(this).builderFromStyle(context, extras, notificationId, nb)\nTemplateType.CANCEL -> renderCancelNotification(context)\n@@ -922,8 +921,8 @@ class TemplateRenderer : INotificationRenderer {\n}\n}\n- override fun getCollapseKey(extras: Bundle): Any {\n- return pt_collapse_key!! // TODO: Check if set properly before caller calls this\n+ override fun getCollapseKey(extras: Bundle): Any? {\n+ return pt_collapse_key // TODO: Check if set properly before caller calls this\n}\nprivate fun setUp(context: Context, extras: Bundle, config: CleverTapInstanceConfig?) {\n@@ -1002,215 +1001,6 @@ class TemplateRenderer : INotificationRenderer {\n// }\n// }\n- private fun hasAllBasicNotifKeys(): Boolean {\n- var result = true\n- if (pt_title == null || pt_title!!.isEmpty()) {\n- PTLog.verbose(\"Title is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_msg == null || pt_msg!!.isEmpty()) {\n- PTLog.verbose(\"Message is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_bg == null || pt_bg!!.isEmpty()) {\n- PTLog.verbose(\"Background colour is missing or empty. Not showing notification\")\n- result = false\n- }\n- return result\n- }\n-\n- private fun hasAllZeroBezelNotifKeys(): Boolean {\n- var result = true\n- if (pt_title == null || pt_title!!.isEmpty()) {\n- PTLog.verbose(\"Title is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_msg == null || pt_msg!!.isEmpty()) {\n- PTLog.verbose(\"Message is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (deepLinkList == null || deepLinkList!!.size == 0) {\n- PTLog.verbose(\"Deeplink is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_big_img == null || pt_big_img!!.isEmpty()) {\n- PTLog.verbose(\"Display Image is missing or empty. Not showing notification\")\n- result = false\n- }\n- return result\n- }\n-\n- private fun hasAllCarouselNotifKeys(): Boolean {\n- var result = true\n- if (pt_title == null || pt_title!!.isEmpty()) {\n- PTLog.verbose(\"Title is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_msg == null || pt_msg!!.isEmpty()) {\n- PTLog.verbose(\"Message is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (deepLinkList == null || deepLinkList!!.size == 0) {\n- PTLog.verbose(\"Deeplink is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (imageList == null || imageList!!.size < 3) {\n- PTLog.verbose(\"Three required images not present. Not showing notification\")\n- result = false\n- }\n- if (pt_bg == null || pt_bg!!.isEmpty()) {\n- PTLog.verbose(\"Background colour is missing or empty. Not showing notification\")\n- result = false\n- }\n- return result\n- }\n-\n- private fun hasAllManualCarouselNotifKeys(): Boolean {\n- var result = true\n- if (pt_title == null || pt_title!!.isEmpty()) {\n- PTLog.verbose(\"Title is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_msg == null || pt_msg!!.isEmpty()) {\n- PTLog.verbose(\"Message is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (deepLinkList == null || deepLinkList!!.size == 0) {\n- PTLog.verbose(\"Deeplink is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (imageList == null || imageList!!.size < 3) {\n- PTLog.verbose(\"Three required images not present. Not showing notification\")\n- result = false\n- }\n- if (pt_bg == null || pt_bg!!.isEmpty()) {\n- PTLog.verbose(\"Background colour is missing or empty. Not showing notification\")\n- result = false\n- }\n- return result\n- }\n-\n- private fun hasAllRatingNotifKeys(): Boolean {\n- var result = true\n- if (pt_title == null || pt_title!!.isEmpty()) {\n- PTLog.verbose(\"Title is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_msg == null || pt_msg!!.isEmpty()) {\n- PTLog.verbose(\"Message is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_rating_default_dl == null || pt_rating_default_dl!!.isEmpty()) {\n- PTLog.verbose(\"Default deeplink is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (deepLinkList == null || deepLinkList!!.size == 0) {\n- PTLog.verbose(\"At least one deeplink is required. Not showing notification\")\n- result = false\n- }\n- if (pt_bg == null || pt_bg!!.isEmpty()) {\n- PTLog.verbose(\"Background colour is missing or empty. Not showing notification\")\n- result = false\n- }\n- return result\n- }\n-\n- private fun hasAll5IconNotifKeys(): Boolean {\n- var result = true\n- if (deepLinkList == null || deepLinkList!!.size < 5) {\n- PTLog.verbose(\"Five required deeplinks not present. Not showing notification\")\n- result = false\n- }\n- if (imageList == null || imageList!!.size < 5) {\n- PTLog.verbose(\"Five required images not present. Not showing notification\")\n- result = false\n- }\n- if (pt_bg == null || pt_bg!!.isEmpty()) {\n- PTLog.verbose(\"Background colour is missing or empty. Not showing notification\")\n- result = false\n- }\n- return result\n- }\n-\n- private fun hasAllProdDispNotifKeys(): Boolean {\n- var result = true\n- if (pt_title == null || pt_title!!.isEmpty()) {\n- PTLog.verbose(\"Title is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_msg == null || pt_msg!!.isEmpty()) {\n- PTLog.verbose(\"Message is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (bigTextList == null || bigTextList!!.size < 3) {\n- PTLog.verbose(\"Three required product titles not present. Not showing notification\")\n- result = false\n- }\n- if (smallTextList == null || smallTextList!!.size < 3) {\n- PTLog.verbose(\"Three required product descriptions not present. Not showing notification\")\n- result = false\n- }\n- if (deepLinkList == null || deepLinkList!!.size < 3) {\n- PTLog.verbose(\"Three required deeplinks not present. Not showing notification\")\n- result = false\n- }\n- if (imageList == null || imageList!!.size < 3) {\n- PTLog.verbose(\"Three required images not present. Not showing notification\")\n- result = false\n- }\n- if (pt_bg == null || pt_bg!!.isEmpty()) {\n- PTLog.verbose(\"Background colour is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_product_display_action == null || pt_product_display_action!!.isEmpty()) {\n- PTLog.verbose(\"Button label is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_product_display_action_clr == null || pt_product_display_action_clr!!.isEmpty()) {\n- PTLog.verbose(\"Button colour is missing or empty. Not showing notification\")\n- result = false\n- }\n- return result\n- }\n-\n- private fun hasAllTimerKeys(): Boolean {\n- var result = true\n- if (pt_title == null || pt_title!!.isEmpty()) {\n- PTLog.verbose(\"Title is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_msg == null || pt_msg!!.isEmpty()) {\n- PTLog.verbose(\"Message is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_timer_threshold == -1 && pt_timer_end == -1) {\n- PTLog.verbose(\"Timer Threshold or End time not defined. Not showing notification\")\n- result = false\n- }\n- if (pt_bg == null || pt_bg!!.isEmpty()) {\n- PTLog.verbose(\"Background colour is missing or empty. Not showing notification\")\n- result = false\n- }\n- return result\n- }\n-\n- private fun hasAllInputBoxKeys(): Boolean {\n- var result = true\n- if (pt_title == null || pt_title!!.isEmpty()) {\n- PTLog.verbose(\"Title is missing or empty. Not showing notification\")\n- result = false\n- }\n- if (pt_msg == null || pt_msg!!.isEmpty()) {\n- PTLog.verbose(\"Message is missing or empty. Not showing notification\")\n- result = false\n- }\n- if ((pt_input_feedback == null || pt_input_feedback!!.isEmpty()) && actions == null) {\n- PTLog.verbose(\"Feedback Text or Actions is missing or empty. Not showing notification\")\n- result = false\n- }\n- return result\n- }\n-\n// private fun renderAutoCarouselNotification(\n// context: Context,\n// extras: Bundle,\n@@ -1279,7 +1069,6 @@ class TemplateRenderer : INotificationRenderer {\n// return nb\n// }\n-\n// private fun setCustomContentViewViewFlipperInterval(contentView: RemoteViews, interval: Int) {\n// contentView.setInt(R.id.view_flipper, \"setFlipInterval\", interval)\n// }\n@@ -1335,7 +1124,6 @@ class TemplateRenderer : INotificationRenderer {\n// return nb\n// }\n-\n// private fun setCustomContentViewText(contentView: RemoteViews, resourceId: Int, s: String) {\n// if (s.isNotEmpty()) {\n// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {\n@@ -1912,59 +1700,6 @@ class TemplateRenderer : INotificationRenderer {\n// }\n// }\n//\n- @RequiresApi(Build.VERSION_CODES.M)//TODO Need to check this\n- private fun timerRunner(context: Context, extras: Bundle, notificationId: Int, delay: Int) {\n- val handler = Handler(Looper.getMainLooper())\n- extras.remove(\"wzrk_rnv\")\n- if (pt_title_alt != null && pt_title_alt!!.isNotEmpty()) {\n- pt_title = pt_title_alt\n- }\n- if (pt_big_img_alt != null && pt_big_img_alt!!.isNotEmpty()) {\n- pt_big_img = pt_big_img_alt\n- }\n- if (pt_msg_alt != null && pt_msg_alt!!.isNotEmpty()) {\n- pt_msg = pt_msg_alt\n- }\n-\n- /*handler.postDelayed(new Runnable() {\n- @RequiresApi(api = Build.VERSION_CODES.M)\n- @Override\n- public void run() {\n- if (Utils.isNotificationInTray(context, notificationId)) {\n- asyncHelper.postAsyncSafely(\"TemplateRenderer#timerRunner\", new Runnable() {\n- @Override\n- public void run() {\n- if (hasAllBasicNotifKeys()) {\n- renderBasicTemplateNotification(context, extras, _root_ide_package_.PTConstants.EMPTY_NOTIFICATION_ID);\n- }\n- }\n- });\n- }\n- }\n- }, delay - 100);*/handler.postDelayed({\n- if (Utils.isNotificationInTray(context, notificationId) && hasAllBasicNotifKeys()) {\n- val applicationContext = context.applicationContext\n- val basicTemplateBundle = extras.clone() as Bundle\n- basicTemplateBundle.putString(Constants.WZRK_PUSH_ID, null) // skip dupe check\n- basicTemplateBundle.putString(PTConstants.PT_ID, \"pt_basic\") // set to basic\n- // force random id generation\n- basicTemplateBundle.putString(PTConstants.PT_COLLAPSE_KEY, null)\n- basicTemplateBundle.putString(Constants.WZRK_COLLAPSE, null)\n- val templateRenderer: INotificationRenderer =\n- TemplateRenderer(applicationContext, basicTemplateBundle)\n- val cleverTapAPI = CleverTapAPI\n- .getGlobalInstance(\n- applicationContext,\n- PushNotificationUtil.getAccountIdFromNotificationBundle(basicTemplateBundle)\n- )\n- cleverTapAPI?.renderPushNotification(\n- templateRenderer,\n- applicationContext,\n- basicTemplateBundle\n- )\n- }\n- }, (delay - 100).toLong())\n- }\n//\n// private fun setCustomContentViewSmallIcon(contentView: RemoteViews) {\n// if (pt_small_icon != null) {\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Replace legacy check logic with ValidatorFactory SDK-1056
116,612
16.11.2021 10:37:36
-19,080
e8d4aa98daad6037fd5ff3c4d1c45da20356cb43
task(refactor): Remove redundant check from StringSizeChecker
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/checkers/StringSizeChecker.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/checkers/StringSizeChecker.kt", "diff": "@@ -6,7 +6,7 @@ class StringSizeChecker(var entity: String?, var size: Int, var errorMsg: String\nSizeChecker<String>(entity, size, errorMsg) {\noverride fun check(): Boolean {\n- val b = entity == null || entity?.trim()?.length ?: -1 <= size\n+ val b = entity?.trim()?.length ?: -1 <= size\nif (b) {\nPTLog.verbose(\"$errorMsg. Not showing notification\")\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Remove redundant check from StringSizeChecker SDK-1056
116,612
16.11.2021 10:41:26
-19,080
bd5ae36c500d6308f201c9e689a4579cf336a3c0
task(refactor): Replace && with and to avoid short circuit
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/validators/BasicTemplateValidator.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/validators/BasicTemplateValidator.kt", "diff": "@@ -7,7 +7,7 @@ class BasicTemplateValidator(private var validator: Validator): TemplateValidato\n) {\noverride fun validate(): Boolean {\n- return validator.validate() && super.validateKeys()// All check must be true\n+ return validator.validate() and super.validateKeys()// All check must be true\n}\noverride fun loadKeys(): List<Checker<out Any>> {\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Replace && with and to avoid short circuit SDK-1056
116,612
16.11.2021 10:45:06
-19,080
fc1421781f819bbaf747b2abaa91db28472bf8ca
task(refactor): Add nullable annotations to INotificationRenderer to avoid java kotlin inter-op issues and merge android 12 logic to CoreNotificationRenderer
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CoreNotificationRenderer.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CoreNotificationRenderer.java", "diff": "@@ -7,7 +7,10 @@ import android.graphics.Bitmap;\nimport android.graphics.Color;\nimport android.net.Uri;\nimport android.os.Build;\n+import android.os.Build.VERSION;\n+import android.os.Build.VERSION_CODES;\nimport android.os.Bundle;\n+import androidx.annotation.Nullable;\nimport androidx.annotation.RestrictTo;\nimport androidx.core.app.NotificationCompat;\nimport androidx.core.app.NotificationCompat.Builder;\n@@ -29,7 +32,7 @@ public class CoreNotificationRenderer implements INotificationRenderer {\nprivate int smallIcon;\n@Override\n- public Object getCollapseKey(final Bundle extras) {\n+ public @Nullable Object getCollapseKey(final Bundle extras) {\nObject collapse_key = extras.get(Constants.WZRK_COLLAPSE);\nreturn collapse_key;\n}\n@@ -51,15 +54,6 @@ public class CoreNotificationRenderer implements INotificationRenderer {\npublic NotificationCompat.Builder renderNotification(final Bundle extras, final Context context,\nfinal Builder nb, final CleverTapInstanceConfig config, final int notificationId) {\nString icoPath = extras.getString(Constants.NOTIF_ICON);// uncommon\n- Intent launchIntent = new Intent(context, CTPushNotificationReceiver.class);// uncommon 1\n-\n- PendingIntent pIntent;\n-\n- // Take all the properties from the notif and add it to the intent\n- launchIntent.putExtras(extras);// u1\n- launchIntent.removeExtra(Constants.WZRK_ACTIONS);//u1\n- pIntent = PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n- launchIntent, PendingIntent.FLAG_UPDATE_CURRENT);//u1\n// uncommon - START\nNotificationCompat.Style style;\n@@ -109,7 +103,7 @@ public class CoreNotificationRenderer implements INotificationRenderer {\n// uncommon\nnb.setContentTitle(notifTitle)\n.setContentText(notifMessage)\n- .setContentIntent(pIntent)\n+ .setContentIntent(LaunchPendingIntentFactory.getLaunchPendingIntent(extras, context))\n.setAutoCancel(true)\n.setStyle(style)\n.setSmallIcon(smallIcon);\n@@ -177,7 +171,8 @@ public class CoreNotificationRenderer implements INotificationRenderer {\n}\n}\n- boolean sendToCTIntentService = (autoCancel && isCTIntentServiceAvailable);\n+ boolean sendToCTIntentService = (VERSION.SDK_INT < VERSION_CODES.S && autoCancel\n+ && isCTIntentServiceAvailable);\nIntent actionLaunchIntent;\nif (sendToCTIntentService) {\n@@ -209,12 +204,16 @@ public class CoreNotificationRenderer implements INotificationRenderer {\nPendingIntent actionIntent;\nint requestCode = ((int) System.currentTimeMillis()) + i;\n+ int flagsActionLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n+ if (VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsActionLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n+ }\nif (sendToCTIntentService) {\nactionIntent = PendingIntent.getService(context, requestCode,\n- actionLaunchIntent, PendingIntent.FLAG_UPDATE_CURRENT);\n+ actionLaunchIntent, flagsActionLaunchPendingIntent);\n} else {\nactionIntent = PendingIntent.getActivity(context, requestCode,\n- actionLaunchIntent, PendingIntent.FLAG_UPDATE_CURRENT);\n+ actionLaunchIntent, flagsActionLaunchPendingIntent);\n}\nnb.addAction(icon, label, actionIntent);\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/INotificationRenderer.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/INotificationRenderer.java", "diff": "@@ -2,19 +2,20 @@ package com.clevertap.android.sdk.pushnotification;\nimport android.content.Context;\nimport android.os.Bundle;\n+import androidx.annotation.Nullable;\nimport androidx.core.app.NotificationCompat;\nimport androidx.core.app.NotificationCompat.Builder;\nimport com.clevertap.android.sdk.CleverTapInstanceConfig;\npublic interface INotificationRenderer {\n- Object getCollapseKey(final Bundle extras);\n+ @Nullable Object getCollapseKey(final Bundle extras);\n- String getMessage(Bundle extras);\n+ @Nullable String getMessage(Bundle extras);\n- String getTitle(Bundle extras, final Context context);\n+ @Nullable String getTitle(Bundle extras, final Context context);\n- NotificationCompat.Builder renderNotification(final Bundle extras, final Context context,\n+ @Nullable NotificationCompat.Builder renderNotification(final Bundle extras, final Context context,\nfinal Builder nb, final CleverTapInstanceConfig config, final int notificationId);\nvoid setSmallIcon(int smallIcon, final Context context);\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Add nullable annotations to INotificationRenderer to avoid java kotlin inter-op issues and merge android 12 logic to CoreNotificationRenderer SDK-1056
116,616
16.11.2021 12:34:28
-19,080
8d514599ec93326a0a9887e48716449bfa5507fd
task(Refactor-Android12) - Update PendingIntentFactory.kt and remove unused classes
[ { "change_type": "DELETE", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplate.kt", "new_path": null, "diff": "-package com.clevertap.android.pushtemplates\n-\n-internal data class PushTemplate (\n- internal val basicTemplate: PushTemplateType.BasicTemplate,\n- internal val manualCarouselTemplate: PushTemplateType.ManualCarouselTemplate,\n- internal val autoCarouselTemplate: PushTemplateType.AutoCarouselTemplate\n-)\n\\ No newline at end of file\n" }, { "change_type": "DELETE", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateType.kt", "new_path": null, "diff": "-package com.clevertap.android.pushtemplates\n-\n-import android.graphics.Bitmap\n-\n-sealed class PushTemplateType {\n-\n- data class BasicTemplate(\n- var title: CharSequence,\n- var message: CharSequence,\n- var backgroundColor: Int,\n- var titleColor: Int,\n- var messageColor: Int,\n- var messageSummary: CharSequence,\n- var smallIcon: Bitmap,\n- var dotSeparator: Bitmap,\n- var bigImage: Bitmap,\n- var largeIcon: Bitmap\n- )\n-\n- data class ManualCarouselTemplate(\n- var title: CharSequence,\n- var message: CharSequence,\n- var backgroundColor: Int,\n- var titleColor: Int,\n- var messageColor: Int,\n- var messageSummary: CharSequence,\n- var smallIcon: Bitmap,\n- var dotSeparator: Bitmap,\n- var bigImage: Bitmap,\n- var largeIcon: Bitmap,\n- var imageList: ArrayList<String>\n- )\n-\n-\n- data class AutoCarouselTemplate(\n- var title: CharSequence,\n- var message: CharSequence,\n- var backgroundColor: Int,\n- var titleColor: Int,\n- var messageColor: Int,\n- var messageSummary: CharSequence,\n- var smallIcon: Bitmap,\n- var dotSeparator: Bitmap,\n- var bigImage: Bitmap,\n- var largeIcon: Bitmap,\n- var imageList: ArrayList<String>\n- )\n-}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "diff": "@@ -3,6 +3,8 @@ package com.clevertap.android.pushtemplates.content\nimport android.app.PendingIntent\nimport android.content.Context\nimport android.content.Intent\n+import android.os.Build\n+import android.os.Build.VERSION_CODES\nimport android.os.Bundle\nimport com.clevertap.android.pushtemplates.PTConstants\nimport com.clevertap.android.pushtemplates.PTPushNotificationReceiver\n@@ -63,9 +65,13 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM)\nlaunchIntent.flags =\nIntent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_IMMUTABLE\n+ }\nreturn PendingIntent.getBroadcast(\ncontext, System.currentTimeMillis().toInt(),\n- launchIntent, PendingIntent.FLAG_UPDATE_CURRENT\n+ launchIntent, flagsLaunchPendingIntent\n)\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Refactor-Android12) - Update PendingIntentFactory.kt and remove unused classes
116,616
17.11.2021 17:16:49
-19,080
90749d61f1ec90f56a0d247bb308974b44b249ce
task(Refactor-Android12) - Update PendingIntentFactory.kt and PushTemplateReceiver.java with FLAG_MUTABLE intent flag
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -19,6 +19,7 @@ import android.widget.RemoteViews;\nimport androidx.core.app.NotificationCompat;\nimport androidx.core.app.RemoteInput;\n+import com.clevertap.android.pushtemplates.content.PendingIntentFactory;\nimport com.clevertap.android.sdk.CleverTapInstanceConfig;\nimport com.clevertap.android.sdk.Constants;\n@@ -682,8 +683,12 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nlaunchIntent.removeExtra(Constants.WZRK_ACTIONS);\nlaunchIntent.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM);\nlaunchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);\n+ int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n+ flagsLaunchPendingIntent |= PendingIntent.FLAG_MUTABLE;\n+ }\nreturn PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n- launchIntent, PendingIntent.FLAG_UPDATE_CURRENT);\n+ launchIntent, flagsLaunchPendingIntent);\n}\nprivate PendingIntent setDismissIntent(Context context, Bundle extras, Intent intent) {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "diff": "@@ -67,7 +67,7 @@ internal object PendingIntentFactory {\nIntent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK\nvar flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\nif (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n- flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_IMMUTABLE\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n}\nreturn PendingIntent.getBroadcast(\ncontext, System.currentTimeMillis().toInt(),\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Refactor-Android12) - Update PendingIntentFactory.kt and PushTemplateReceiver.java with FLAG_MUTABLE intent flag
116,616
18.11.2021 10:06:14
-19,080
e61a16ccc71ba8ec241d8cfc490f6d0dedb1b116
Fix(SDK-1163) - InAppFCManager init moved to task in CleverTapFactory.java
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/CleverTapFactory.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/CleverTapFactory.java", "diff": "@@ -9,10 +9,14 @@ import com.clevertap.android.sdk.inapp.InAppController;\nimport com.clevertap.android.sdk.login.LoginController;\nimport com.clevertap.android.sdk.network.NetworkManager;\nimport com.clevertap.android.sdk.pushnotification.PushProviders;\n+import com.clevertap.android.sdk.task.CTExecutorFactory;\nimport com.clevertap.android.sdk.task.MainLooperHandler;\n+import com.clevertap.android.sdk.task.Task;\nimport com.clevertap.android.sdk.validation.ValidationResultStack;\nimport com.clevertap.android.sdk.validation.Validator;\n+import java.util.concurrent.Callable;\n+\nclass CleverTapFactory {\nstatic CoreState getCoreState(Context context, CleverTapInstanceConfig cleverTapInstanceConfig,\n@@ -58,6 +62,11 @@ class CleverTapFactory {\nctLockManager, callbackManager, deviceInfo, baseDatabaseManager);\ncoreState.setControllerManager(controllerManager);\n+ //Get device id should be async to avoid strict mode policy.\n+ Task<Void> taskDeviceId = CTExecutorFactory.executors(config).ioTask();\n+ taskDeviceId.execute(\"getDeviceId\", new Callable<Void>() {\n+ @Override\n+ public Void call() throws Exception {\nif (coreState.getDeviceInfo() != null && coreState.getDeviceInfo().getDeviceID() != null\n&& controllerManager.getInAppFCManager() == null) {\ncoreState.getConfig().getLogger()\n@@ -66,6 +75,11 @@ class CleverTapFactory {\ncontrollerManager\n.setInAppFCManager(new InAppFCManager(context, config, coreState.getDeviceInfo().getDeviceID()));\n}\n+ return null;\n+ }\n+ });\n+\n+\nNetworkManager networkManager = new NetworkManager(context, config, deviceInfo, coreMetaData,\nvalidationResultStack, controllerManager, baseDatabaseManager,\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
Fix(SDK-1163) - InAppFCManager init moved to task in CleverTapFactory.java
116,616
18.11.2021 13:16:11
-19,080
4d56a99ebf1e88086f16d2618c4c137521a62ec6
Fix(SDK-1163) - Add log for ctFeatureFlagsController and inAppFCManager null case, move initFeatureFlags to task
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/CleverTapFactory.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/CleverTapFactory.java", "diff": "@@ -63,8 +63,8 @@ class CleverTapFactory {\ncoreState.setControllerManager(controllerManager);\n//Get device id should be async to avoid strict mode policy.\n- Task<Void> taskDeviceId = CTExecutorFactory.executors(config).ioTask();\n- taskDeviceId.execute(\"getDeviceId\", new Callable<Void>() {\n+ Task<Void> taskInitFCManager = CTExecutorFactory.executors(config).ioTask();\n+ taskInitFCManager.execute(\"initFCManager\", new Callable<Void>() {\n@Override\npublic Void call() throws Exception {\nif (coreState.getDeviceInfo() != null && coreState.getDeviceInfo().getDeviceID() != null\n@@ -103,7 +103,16 @@ class CleverTapFactory {\ncoreState.setInAppController(inAppController);\ncoreState.getControllerManager().setInAppController(inAppController);\n+ Task<Void> taskInitFeatureFlags = CTExecutorFactory.executors(config).ioTask();\n+ taskInitFeatureFlags.execute(\"initFeatureFlags\", new Callable<Void>() {\n+ @Override\n+ public Void call() throws Exception {\ninitFeatureFlags(context, controllerManager, config, deviceInfo, callbackManager, analyticsManager);\n+ return null;\n+ }\n+ });\n+\n+\nLocationManager locationManager = new LocationManager(context, config, coreMetaData, baseEventQueueManager);\ncoreState.setLocationManager(locationManager);\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/login/LoginController.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/login/LoginController.java", "diff": "@@ -284,6 +284,9 @@ public class LoginController {\n.isInitialized()) {\nctFeatureFlagsController.resetWithGuid(deviceInfo.getDeviceID());\nctFeatureFlagsController.fetchFeatureFlags();\n+ }else {\n+ config.getLogger().verbose(config.getAccountId(),\n+ Constants.FEATURE_DISPLAY_UNIT + \"Can't reset Display Units, CTFeatureFlagsController is null\");\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/response/FeatureFlagResponse.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/response/FeatureFlagResponse.java", "diff": "@@ -71,6 +71,9 @@ public class FeatureFlagResponse extends CleverTapResponseDecorator {\nif (kvArray != null && controllerManager.getCTFeatureFlagsController() != null) {\ncontrollerManager.getCTFeatureFlagsController().updateFeatureFlags(responseKV);\n+ }else {\n+ config.getLogger().verbose(config.getAccountId(),\n+ Constants.FEATURE_FLAG_UNIT + \"Can't parse feature flags, CTFeatureFlagsController is null\");\n}\n}\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
Fix(SDK-1163) - Add log for ctFeatureFlagsController and inAppFCManager null case, move initFeatureFlags to task
116,612
19.11.2021 19:17:48
-19,080
202da76a064f0fe2211d89c16a92683bfedccf34
fix(strict mode): update sample and core sdk version
[ { "change_type": "MODIFY", "old_path": "sample/src/main/AndroidManifest.xml", "new_path": "sample/src/main/AndroidManifest.xml", "diff": "<!-- Add Permissions needed for CleverTap -->\n<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\n+ <uses-feature android:name=\"android.hardware.ram.low\" android:required=\"true\"/>\n<application\nandroid:name=\".MyApplication\"\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/MyApplication.kt", "new_path": "sample/src/main/java/com/clevertap/demo/MyApplication.kt", "diff": "@@ -3,6 +3,7 @@ package com.clevertap.demo\nimport android.app.NotificationManager\nimport android.content.Context\nimport android.content.Intent\n+import android.os.StrictMode\nimport android.util.Log\nimport androidx.multidex.MultiDex\nimport androidx.multidex.MultiDexApplication\n@@ -20,6 +21,21 @@ class MyApplication : MultiDexApplication(), CTPushNotificationListener {\noverride fun onCreate() {\n+ StrictMode.setThreadPolicy(\n+ StrictMode.ThreadPolicy.Builder()\n+ .detectAll() // or .detectAll() for all detectable problems\n+ .penaltyLog()\n+ //.penaltyDeath()\n+ .build()\n+ );\n+ StrictMode.setVmPolicy(\n+ StrictMode.VmPolicy.Builder()\n+ .detectAll()\n+ .penaltyLog()\n+ //.penaltyDeath()\n+ .build()\n+ );\n+\nCleverTapAPI.setDebugLevel(VERBOSE)\nActivityLifecycleCallback.register(this)\nsuper.onCreate()\n" }, { "change_type": "MODIFY", "old_path": "versions.properties", "new_path": "versions.properties", "diff": "@@ -320,7 +320,7 @@ version.com.android.installreferrer..installreferrer=2.2\n## # available=2.2\nversion.com.android.tools.lint..lint-api=27.0.1\nversion.com.android.tools.lint..lint-checks=27.0.1\n-version.com.clevertap.android..clevertap-android-sdk=4.3.0\n+version.com.clevertap.android..clevertap-android-sdk=4.3.1\nversion.com.clevertap.android..clevertap-geofence-sdk=1.1.0\nversion.com.clevertap.android..clevertap-hms-sdk=1.1.0\nversion.com.clevertap.android..clevertap-xiaomi-sdk=1.1.0\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
fix(strict mode): update sample and core sdk version
116,612
22.11.2021 14:40:44
-19,080
10ac4983ff84ff84de08608486d2826641060286
task(refactor): remove Drawable to BitmapDrawable cast to fix small icon tint
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/Utils.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/Utils.java", "diff": "@@ -110,9 +110,9 @@ public class Utils {\nstatic Bitmap drawableToBitmap(Drawable drawable)\nthrows NullPointerException {\n- if (drawable instanceof BitmapDrawable) {\n+ /*if (drawable instanceof BitmapDrawable) {\nreturn ((BitmapDrawable) drawable).getBitmap();\n- }\n+ }*/\nBitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),\ndrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): remove Drawable to BitmapDrawable cast to fix small icon tint SDK-1056 SDK-1102
116,612
22.11.2021 15:12:41
-19,080
b50d30cab2fae97f053be462bc8317cd448b0c17
task(refactor): fix small icon color issue when notification drawer is scrolled down
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/Style.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/Style.kt", "diff": "@@ -2,6 +2,7 @@ package com.clevertap.android.pushtemplates.styles\nimport android.app.PendingIntent\nimport android.content.Context\n+import android.graphics.Color\nimport android.os.Bundle\nimport android.text.Html\nimport android.widget.RemoteViews\n@@ -32,6 +33,7 @@ abstract class Style(private var renderer: TemplateRenderer) {\n.setContentIntent(pIntent)\n.setVibrate(longArrayOf(0L))\n.setWhen(System.currentTimeMillis())\n+ .setColor(Color.parseColor(renderer.pt_small_icon_clr?:\"#FFFFFF\"))\n.setAutoCancel(true)\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): fix small icon color issue when notification drawer is scrolled down SDK-1056 SDK-1102
116,612
22.11.2021 15:16:53
-19,080
b45d51a0380417ef6e934a5b5c4976903a6122ae
task(refactor): increase height of notification header by 4dp
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "diff": "@@ -69,7 +69,7 @@ class TemplateRenderer : INotificationRenderer {\ninternal var pt_product_display_linear: String? = null\ninternal var pt_meta_clr: String? = null\ninternal var pt_product_display_action_text_clr: String? = null\n- private var pt_small_icon_clr: String? = null\n+ internal var pt_small_icon_clr: String? = null\ninternal var pt_small_icon: Bitmap? = null\ninternal var pt_dot_sep: Bitmap? = null\nprivate var pt_cancel_notif_id: String? = null\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/metadata.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/metadata.xml", "diff": "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:app=\"http://schemas.android.com/apk/res-auto\"\nandroid:layout_width=\"wrap_content\"\n- android:layout_height=\"16dp\"\n+ android:layout_height=\"20dp\"\nandroid:gravity=\"center\">\n<ImageView\nandroid:layout_width=\"@dimen/metadata_small_icon_x\"\nandroid:layout_height=\"@dimen/metadata_small_icon_y\"\nandroid:layout_alignParentStart=\"true\"\n- android:layout_marginEnd=\"@dimen/metadata_margin_x\" />\n+ android:layout_marginEnd=\"@dimen/metadata_margin_x\"\n+ android:layout_centerVertical=\"true\"/>\n<TextView\nandroid:id=\"@+id/app_name\"\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): increase height of notification header by 4dp SDK-1056 SDK-1102
116,612
22.11.2021 15:18:51
-19,080
6cf3c51dcd0a96377800fd8dd402fb96996a48dd
task(refactor): restrict collapsed remote view message to single line ellipsize
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/content_view_small.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/content_view_small.xml", "diff": "android:layout_alignParentStart=\"true\"\nandroid:layout_toStartOf=\"@+id/large_icon\"\nandroid:text=\"message message\"\n- android:textAppearance=\"@style/PushMessage\" />\n+ android:textAppearance=\"@style/PushMessage\"\n+ android:maxLines=\"1\"\n+ android:ellipsize=\"end\"\n+ />\n<ImageView\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): restrict collapsed remote view message to single line ellipsize SDK-1056 SDK-1102
116,612
22.11.2021 15:21:26
-19,080
8ae6dd65f66467672e887cfe309568101bebed03
task(refactor): allow expanded remote view message to be multi line
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/image_only_big.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/image_only_big.xml", "diff": "android:background=\"@android:color/white\"\nandroid:orientation=\"vertical\">\n- <include layout=\"@layout/content_view_small\"\n- android:id=\"@+id/rel_lyt\"/>\n+ <RelativeLayout\n+ android:id=\"@+id/content_view_small\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:paddingLeft=\"@dimen/padding_horizontal\"\n+ android:paddingTop=\"@dimen/padding_vertical\"\n+ android:paddingRight=\"@dimen/padding_horizontal\"\n+ android:paddingBottom=\"@dimen/padding_vertical\" >\n+\n+\n+ <include\n+ android:id=\"@+id/metadata\"\n+ layout=\"@layout/metadata\" />\n+\n+ <RelativeLayout\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_below=\"@+id/metadata\"\n+ android:layout_alignStart=\"@+id/metadata\"\n+ android:id=\"@+id/rel_lyt\">\n+\n+ <TextView\n+ android:id=\"@+id/title\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_marginTop=\"@dimen/metadata_title_margin_vertical\"\n+ android:layout_marginEnd=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_alignParentStart=\"true\"\n+ android:layout_toStartOf=\"@+id/large_icon\"\n+ android:text=\"title\"\n+ android:textAppearance=\"@style/PushTitle\" />\n+\n+ <TextView\n+ android:id=\"@+id/msg\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_below=\"@+id/title\"\n+ android:layout_alignStart=\"@id/title\"\n+ android:layout_alignParentStart=\"true\"\n+ android:layout_toStartOf=\"@+id/large_icon\"\n+ android:text=\"message message\"\n+ android:textAppearance=\"@style/PushMessage\"\n+ />\n+\n+\n+ <ImageView\n+ android:id=\"@+id/large_icon\"\n+ android:layout_width=\"@dimen/large_icon\"\n+ android:layout_height=\"@dimen/large_icon\"\n+ android:layout_marginStart=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_alignParentEnd=\"true\"\n+ android:scaleType=\"centerCrop\" />\n+ </RelativeLayout>\n+\n+ </RelativeLayout>\n<ImageView\nandroid:id=\"@+id/big_image\"\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): allow expanded remote view message to be multi line SDK-1056 SDK-1102
116,612
22.11.2021 15:22:27
-19,080
ceec51afdd2edaba8a7f96092c3519b599e3004d
task(refactor): add mono colored notification icon to sample
[ { "change_type": "MODIFY", "old_path": "sample/src/main/AndroidManifest.xml", "new_path": "sample/src/main/AndroidManifest.xml", "diff": "android:value=\"0\" /> <!-- Add meta data for CleverTap Notification Icon -->\n<meta-data\nandroid:name=\"CLEVERTAP_NOTIFICATION_ICON\"\n- android:value=\"ic_launcher_round\" />\n+ android:value=\"ic_notification\" />\n<meta-data\nandroid:name=\"CLEVERTAP_BACKGROUND_SYNC\"\nandroid:value=\"1\" /> <!-- Add meta and set to 1 to raise Notification Viewed for Push Notifications -->\n" }, { "change_type": "ADD", "old_path": "sample/src/main/res/drawable/ic_notification.png", "new_path": "sample/src/main/res/drawable/ic_notification.png", "diff": "Binary files /dev/null and b/sample/src/main/res/drawable/ic_notification.png differ\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): add mono colored notification icon to sample SDK-1056 SDK-1102
116,612
23.11.2021 16:53:09
-19,080
4f335c132ad6fa3094b2b30d28f5073083c5a697
task(refactor): rename content_view_small and separate it from multi line message using new layout
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -19,7 +19,6 @@ import android.widget.RemoteViews;\nimport androidx.core.app.NotificationCompat;\nimport androidx.core.app.RemoteInput;\n-import com.clevertap.android.pushtemplates.content.PendingIntentFactory;\nimport com.clevertap.android.sdk.CleverTapInstanceConfig;\nimport com.clevertap.android.sdk.Constants;\n@@ -371,7 +370,7 @@ public class PushTemplateReceiver extends BroadcastReceiver {\ncontentViewRating = new RemoteViews(context.getPackageName(), R.layout.rating);\nsetCustomContentViewBasicKeys(contentViewRating, context);\n- contentViewSmall = new RemoteViews(context.getPackageName(), R.layout.content_view_small);\n+ contentViewSmall = new RemoteViews(context.getPackageName(), R.layout.content_view_small_single_line_msg);\nsetCustomContentViewBasicKeys(contentViewSmall, context);\n@@ -558,7 +557,7 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nboolean isLinear = false;\nif (pt_product_display_linear == null || pt_product_display_linear.isEmpty()) {\ncontentViewBig = new RemoteViews(context.getPackageName(), R.layout.product_display_template);\n- contentViewSmall = new RemoteViews(context.getPackageName(), R.layout.content_view_small);\n+ contentViewSmall = new RemoteViews(context.getPackageName(), R.layout.content_view_small_single_line_msg);\n} else {\nisLinear = true;\ncontentViewBig = new RemoteViews(context.getPackageName(), R.layout.product_display_linear_expanded);\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/ProductDisplayNonLinearSmallContentView.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/ProductDisplayNonLinearSmallContentView.kt", "diff": "@@ -5,7 +5,7 @@ import com.clevertap.android.pushtemplates.R\nimport com.clevertap.android.pushtemplates.TemplateRenderer\nclass ProductDisplayNonLinearSmallContentView(context: Context, renderer: TemplateRenderer):\n- SmallContentView(context, renderer, R.layout.content_view_small) {\n+ SmallContentView(context, renderer, R.layout.content_view_small_single_line_msg) {\ninit {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/SmallContentView.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/SmallContentView.kt", "diff": "@@ -5,7 +5,7 @@ import com.clevertap.android.pushtemplates.R\nimport com.clevertap.android.pushtemplates.TemplateRenderer\nopen class SmallContentView(context: Context,\n- renderer: TemplateRenderer,layoutId: Int = R.layout.content_view_small): ContentView(context,layoutId,renderer) {\n+ renderer: TemplateRenderer,layoutId: Int = R.layout.content_view_small_single_line_msg): ContentView(context,layoutId,renderer) {\ninit {\nsetCustomContentViewBasicKeys()\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/auto_carousel.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/auto_carousel.xml", "diff": "android:layout_height=\"wrap_content\"\nandroid:orientation=\"vertical\">\n- <include layout=\"@layout/content_view_small\"\n+ <include layout=\"@layout/content_view_small_multi_line_msg\"\nandroid:id=\"@+id/rel_lyt\"/>\n<ViewFlipper\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout/content_view_small_multi_line_msg.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_small\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:paddingLeft=\"@dimen/padding_horizontal\"\n+ android:paddingTop=\"@dimen/padding_vertical\"\n+ android:paddingRight=\"@dimen/padding_horizontal\"\n+ android:paddingBottom=\"@dimen/padding_vertical\" >\n+\n+\n+ <include\n+ android:id=\"@+id/metadata\"\n+ layout=\"@layout/metadata\" />\n+\n+ <RelativeLayout\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_below=\"@+id/metadata\"\n+ android:layout_alignStart=\"@+id/metadata\"\n+ android:id=\"@+id/rel_lyt\">\n+\n+ <TextView\n+ android:id=\"@+id/title\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_marginTop=\"@dimen/metadata_title_margin_vertical\"\n+ android:layout_marginEnd=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_alignParentStart=\"true\"\n+ android:layout_toStartOf=\"@+id/large_icon\"\n+ android:text=\"title\"\n+ android:textAppearance=\"@style/PushTitle\" />\n+\n+ <TextView\n+ android:id=\"@+id/msg\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_below=\"@+id/title\"\n+ android:layout_alignStart=\"@id/title\"\n+ android:layout_alignParentStart=\"true\"\n+ android:layout_toStartOf=\"@+id/large_icon\"\n+ android:text=\"message message\"\n+ android:textAppearance=\"@style/PushMessageMultiLine\"\n+ />\n+\n+\n+ <ImageView\n+ android:id=\"@+id/large_icon\"\n+ android:layout_width=\"@dimen/large_icon\"\n+ android:layout_height=\"@dimen/large_icon\"\n+ android:layout_marginStart=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_alignParentEnd=\"true\"\n+ android:scaleType=\"centerCrop\" />\n+ </RelativeLayout>\n+\n+</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "RENAME", "old_path": "clevertap-pushTemplate/src/main/res/layout/content_view_small.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/content_view_small_single_line_msg.xml", "diff": "" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/image_only_big.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/image_only_big.xml", "diff": "android:background=\"@android:color/white\"\nandroid:orientation=\"vertical\">\n- <RelativeLayout\n- android:id=\"@+id/content_view_small\"\n- android:layout_width=\"match_parent\"\n- android:layout_height=\"wrap_content\"\n- android:paddingLeft=\"@dimen/padding_horizontal\"\n- android:paddingTop=\"@dimen/padding_vertical\"\n- android:paddingRight=\"@dimen/padding_horizontal\"\n- android:paddingBottom=\"@dimen/padding_vertical\" >\n-\n-\n<include\n- android:id=\"@+id/metadata\"\n- layout=\"@layout/metadata\" />\n-\n- <RelativeLayout\n- android:layout_width=\"match_parent\"\n- android:layout_height=\"wrap_content\"\n- android:layout_below=\"@+id/metadata\"\n- android:layout_alignStart=\"@+id/metadata\"\n- android:id=\"@+id/rel_lyt\">\n-\n- <TextView\n- android:id=\"@+id/title\"\n- android:layout_width=\"wrap_content\"\n- android:layout_height=\"wrap_content\"\n- android:layout_marginTop=\"@dimen/metadata_title_margin_vertical\"\n- android:layout_marginEnd=\"@dimen/metadata_title_margin_horizontal\"\n- android:layout_alignParentStart=\"true\"\n- android:layout_toStartOf=\"@+id/large_icon\"\n- android:text=\"title\"\n- android:textAppearance=\"@style/PushTitle\" />\n-\n- <TextView\n- android:id=\"@+id/msg\"\n- android:layout_width=\"wrap_content\"\n- android:layout_height=\"wrap_content\"\n- android:layout_below=\"@+id/title\"\n- android:layout_alignStart=\"@id/title\"\n- android:layout_alignParentStart=\"true\"\n- android:layout_toStartOf=\"@+id/large_icon\"\n- android:text=\"message message\"\n- android:textAppearance=\"@style/PushMessage\"\n- />\n-\n-\n- <ImageView\n- android:id=\"@+id/large_icon\"\n- android:layout_width=\"@dimen/large_icon\"\n- android:layout_height=\"@dimen/large_icon\"\n- android:layout_marginStart=\"@dimen/metadata_title_margin_horizontal\"\n- android:layout_alignParentEnd=\"true\"\n- android:scaleType=\"centerCrop\" />\n- </RelativeLayout>\n-\n- </RelativeLayout>\n+ android:id=\"@+id/rel_lyt\"\n+ layout=\"@layout/content_view_small_multi_line_msg\" />\n<ImageView\nandroid:id=\"@+id/big_image\"\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/manual_carousel.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/manual_carousel.xml", "diff": "<include\nandroid:id=\"@+id/rel_lyt\"\n- layout=\"@layout/content_view_small\" />\n+ layout=\"@layout/content_view_small_multi_line_msg\" />\n<RelativeLayout\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/rating.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/rating.xml", "diff": "<include\nandroid:id=\"@+id/rel_lyt\"\n- layout=\"@layout/content_view_small\" />\n+ layout=\"@layout/content_view_small_single_line_msg\" />\n<LinearLayout\nandroid:layout_width=\"match_parent\"\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/values-sw400dp/styles.xml", "new_path": "clevertap-pushTemplate/src/main/res/values-sw400dp/styles.xml", "diff": "<item name=\"android:maxLines\">1</item>\n<item name=\"android:ellipsize\">end</item>\n</style>\n+ <style name=\"PushMessageMultiLine\" parent=\"android:Widget.TextView\">\n+ <item name=\"android:textColor\">@android:color/black</item>\n+ <item name=\"android:textSize\">14sp</item>\n+ </style>\n<style name=\"MetaData\" parent=\"android:Widget.TextView\">\n<item name=\"android:textColor\">@color/gray</item>\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/values/styles.xml", "new_path": "clevertap-pushTemplate/src/main/res/values/styles.xml", "diff": "<item name=\"android:ellipsize\">end</item>\n</style>\n+ <style name=\"PushMessageMultiLine\" parent=\"android:Widget.TextView\">\n+ <item name=\"android:textColor\">@android:color/black</item>\n+ <item name=\"android:textSize\">@dimen/msg_font_size</item>\n+ </style>\n+\n<style name=\"MetaData\" parent=\"android:Widget.TextView\">\n<item name=\"android:textColor\">@color/gray</item>\n<item name=\"android:textSize\">@dimen/metadata_font_size</item>\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): rename content_view_small and separate it from multi line message using new layout SDK-1056
116,616
24.11.2021 13:16:13
-19,080
d659f17b78a5d7a324e26df5ff79a87c517e453d
task(refactor) - Update pt_img check for FiveIcon, Update dl in PushTemplateReceiver.java for ProductIcon, Add timerRunner for TimerPT
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -600,7 +600,7 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nNotificationCompat.Builder notificationBuilder = setBuilderWithChannelIDCheck(requiresChannelId, PTConstants.PT_SILENT_CHANNEL_ID, context);\nif (deepLinkList != null && !deepLinkList.isEmpty()) {\n- pIntent = setPendingIntent(context, notificationId, extras, launchIntent, deepLinkList.get(0));\n+ pIntent = setPendingIntent(context, notificationId, extras, launchIntent, dl);\n} else {\npIntent = setPendingIntent(context, notificationId, extras, launchIntent, null);\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "diff": "@@ -150,6 +150,7 @@ class TemplateRenderer : INotificationRenderer {\nTemplateType.TIMER -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {\nif (ValidatorFactory.getValidator(TemplateType.TIMER, this)?.validate() == true) {\n+ timerRunner(context, extras, notificationId, getTimerEnd())\nreturn TimerStyle(this, extras).builderFromStyle(context, extras, notificationId, nb)\n}\n} else {\n@@ -184,6 +185,77 @@ class TemplateRenderer : INotificationRenderer {\n}\n}\n+ private fun getTimerEnd(): Int?{\n+ var timer_end: Int? = null\n+ if (pt_timer_threshold != -1 && pt_timer_threshold >= PTConstants.PT_TIMER_MIN_THRESHOLD) {\n+ timer_end = pt_timer_threshold * PTConstants.ONE_SECOND + PTConstants.ONE_SECOND\n+ }else if (pt_timer_end >= PTConstants.PT_TIMER_MIN_THRESHOLD) {\n+ timer_end = pt_timer_end * PTConstants.ONE_SECOND + PTConstants.ONE_SECOND\n+ }else {\n+ PTLog.debug(\"Not rendering notification Timer End value lesser than threshold (10 seconds) from current time: \" + PTConstants.PT_TIMER_END)\n+ }\n+ return timer_end\n+ }\n+\n+ @RequiresApi(Build.VERSION_CODES.M)\n+ private fun timerRunner(context: Context, extras: Bundle, notificationId: Int, delay: Int?) {\n+ val handler = Handler(Looper.getMainLooper())\n+ extras.remove(\"wzrk_rnv\")\n+ if (pt_title_alt != null && pt_title_alt!!.isNotEmpty()) {\n+ pt_title = pt_title_alt\n+ }\n+ if (pt_big_img_alt != null && pt_big_img_alt!!.isNotEmpty()) {\n+ pt_big_img = pt_big_img_alt\n+ }\n+ if (pt_msg_alt != null && pt_msg_alt!!.isNotEmpty()) {\n+ pt_msg = pt_msg_alt\n+ }\n+\n+ /*handler.postDelayed(new Runnable() {\n+ @RequiresApi(api = Build.VERSION_CODES.M)\n+ @Override\n+ public void run() {\n+ if (Utils.isNotificationInTray(context, notificationId)) {\n+ asyncHelper.postAsyncSafely(\"TemplateRenderer#timerRunner\", new Runnable() {\n+ @Override\n+ public void run() {\n+ if (hasAllBasicNotifKeys()) {\n+ renderBasicTemplateNotification(context, extras, _root_ide_package_.PTConstants.EMPTY_NOTIFICATION_ID);\n+ }\n+ }\n+ });\n+ }\n+ }\n+ }, delay - 100);*/\n+\n+ handler.postDelayed({\n+ if (Utils.isNotificationInTray(context, notificationId) && ValidatorFactory.\n+ getValidator(TemplateType.BASIC, this)?.validate() == true) {\n+ val applicationContext = context.applicationContext\n+ val basicTemplateBundle = extras.clone() as Bundle\n+ basicTemplateBundle.putString(Constants.WZRK_PUSH_ID, null) // skip dupe check\n+ basicTemplateBundle.putString(PTConstants.PT_ID, \"pt_basic\") // set to basic\n+ // force random id generation\n+ basicTemplateBundle.putString(PTConstants.PT_COLLAPSE_KEY, null)\n+ basicTemplateBundle.putString(Constants.WZRK_COLLAPSE, null)\n+ val templateRenderer: INotificationRenderer =\n+ TemplateRenderer(applicationContext, basicTemplateBundle)\n+ val cleverTapAPI = CleverTapAPI\n+ .getGlobalInstance(\n+ applicationContext,\n+ PushNotificationUtil.getAccountIdFromNotificationBundle(basicTemplateBundle)\n+ )\n+ cleverTapAPI?.renderPushNotification(\n+ templateRenderer,\n+ applicationContext,\n+ basicTemplateBundle\n+ )\n+ }\n+ }, (delay!! - 100).toLong())\n+ }\n+\n+\n+\n// private fun renderZeroBezelNotification(\n// context: Context, extras: Bundle, notificationId: Int,\n// nb: NotificationCompat.Builder\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/TimerStyle.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/TimerStyle.kt", "diff": "@@ -15,15 +15,17 @@ class TimerStyle(private var renderer: TemplateRenderer, private var extras: Bun\noverride fun makeSmallContentView(context: Context, renderer: TemplateRenderer): RemoteViews? {\nreturn if (getTimerEnd() == null)\nnull\n- else\n+ else {\nreturn TimerSmallContentView(context, getTimerEnd(), renderer).remoteView\n}\n+ }\noverride fun makeBigContentView(context: Context, renderer: TemplateRenderer): RemoteViews? {\nreturn if (getTimerEnd() == null)\nnull\n- else\n- TimerBigContentView(context,getTimerEnd(),renderer).remoteView\n+ else {\n+ return TimerBigContentView(context, getTimerEnd(), renderer).remoteView\n+ }\n}\noverride fun makePendingIntent(\n@@ -46,7 +48,7 @@ class TimerStyle(private var renderer: TemplateRenderer, private var extras: Bun\n@Suppress(\"LocalVariableName\")\n- private fun getTimerEnd(): Int?{//Boolean\n+ private fun getTimerEnd(): Int?{\nvar timer_end: Int? = null\nif (renderer.pt_timer_threshold != -1 && renderer.pt_timer_threshold >= PTConstants.PT_TIMER_MIN_THRESHOLD) {\ntimer_end = renderer.pt_timer_threshold * PTConstants.ONE_SECOND + PTConstants.ONE_SECOND\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/validators/ValidatorFactory.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/validators/ValidatorFactory.kt", "diff": "@@ -84,7 +84,7 @@ internal class ValidatorFactory {\nhashMap[PT_FIVE_DEEPLINK_LIST] =\nListSizeChecker(templateRenderer.deepLinkList, 5, \"Five required deeplinks not present\")\nhashMap[PT_FIVE_IMAGE_LIST] =\n- ListSizeChecker(templateRenderer.imageList, 5, \"Five required images not present\")\n+ ListSizeChecker(templateRenderer.imageList, 3, \"Five required images not present\")\n//----------PROD DISPLAY-------------\nhashMap[PT_THREE_DEEPLINK_LIST] =\nListSizeChecker(templateRenderer.deepLinkList, 3, \"Three required deeplinks not present\")\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor) - Update pt_img check for FiveIcon, Update dl in PushTemplateReceiver.java for ProductIcon, Add timerRunner for TimerPT
116,616
24.11.2021 17:25:23
-19,080
e5d1cfc5d5b23f1458b97ab47db20a697a587f68
chore(SDK-1163) - Update README.md and CHANGELOG.md for 4.3.1 release
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "## CHANGE LOG\n+### November 25, 2021\n+\n+*[CleverTap Android SDK v4.3.1](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md)\n+\n### November 2, 2021\n* [CleverTap Android SDK v4.3.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md)\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -24,7 +24,7 @@ We publish the SDK to `mavenCentral` as an `AAR` file. Just declare it as depend\n```groovy\ndependencies {\n- implementation \"com.clevertap.android:clevertap-android-sdk:4.3.0\"\n+ implementation \"com.clevertap.android:clevertap-android-sdk:4.3.1\"\n}\n```\n@@ -32,7 +32,7 @@ Alternatively, you can download and add the AAR file included in this repo in yo\n```groovy\ndependencies {\n- implementation (name: \"clevertap-android-sdk-4.3.0\", ext: 'aar')\n+ implementation (name: \"clevertap-android-sdk-4.3.1\", ext: 'aar')\n}\n```\n@@ -44,7 +44,7 @@ Add the Firebase Messaging library and Android Support Library v4 as dependencie\n```groovy\ndependencies {\n- implementation \"com.clevertap.android:clevertap-android-sdk:4.3.0\"\n+ implementation \"com.clevertap.android:clevertap-android-sdk:4.3.1\"\nimplementation \"androidx.core:core:1.3.0\"\nimplementation \"com.google.firebase:firebase-messaging:20.2.4\"\nimplementation \"com.google.android.gms:play-services-ads:19.4.0\" // Required only if you enable Google ADID collection in the SDK (turned off by default).\n" }, { "change_type": "MODIFY", "old_path": "docs/CTCORECHANGELOG.md", "new_path": "docs/CTCORECHANGELOG.md", "diff": "## CleverTap Android SDK CHANGE LOG\n+\n+### Version 4.3.1 (November 25, 2021)\n+* Fixes a Strict Mode Read violation that caused ANRs\n+\n### Version 4.3.0 (November 2, 2021)\n* Adds support for [apps targeting Android 12 (API 31)](https://developer.android.com/about/versions/12/behavior-changes-12)\nThis version is compatible with all new Android 12 changes like Notification Trampolines, Pending Intents Mutability and Safer Component Exporting.\n" }, { "change_type": "MODIFY", "old_path": "docs/CTGEOFENCE.md", "new_path": "docs/CTGEOFENCE.md", "diff": "@@ -17,7 +17,7 @@ Add the following dependencies to the `build.gradle`\n```Groovy\nimplementation \"com.clevertap.android:clevertap-geofence-sdk:1.1.0\"\n-implementation \"com.clevertap.android:clevertap-android-sdk:4.3.0\" // 3.9.0 and above\n+implementation \"com.clevertap.android:clevertap-android-sdk:4.3.1\" // 3.9.0 and above\nimplementation \"com.google.android.gms:play-services-location:18.0.0\"\nimplementation \"androidx.work:work-runtime:2.7.0\" // required for FETCH_LAST_LOCATION_PERIODIC\nimplementation \"androidx.concurrent:concurrent-futures:1.1.0\" // required for FETCH_LAST_LOCATION_PERIODIC\n" }, { "change_type": "MODIFY", "old_path": "templates/CTCORECHANGELOG.md", "new_path": "templates/CTCORECHANGELOG.md", "diff": "## CleverTap Android SDK CHANGE LOG\n+\n+### Version 4.3.1 (November 25, 2021)\n+* Fixes a Strict Mode Read violation that caused ANRs\n+\n### Version 4.3.0 (November 2, 2021)\n* Adds support for [apps targeting Android 12 (API 31)](https://developer.android.com/about/versions/12/behavior-changes-12)\nThis version is compatible with all new Android 12 changes like Notification Trampolines, Pending Intents Mutability and Safer Component Exporting.\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
chore(SDK-1163) - Update README.md and CHANGELOG.md for 4.3.1 release
116,616
25.11.2021 15:34:58
-19,080
f452a46b83ead7a0fdfea48bc2df026e2bb2ae0f
chore(SDK-1163) - Update README.md and CHANGELOG.md for 4.3.1 release, comment Strict mode in sample's application.
[ { "change_type": "MODIFY", "old_path": "docs/CTCORECHANGELOG.md", "new_path": "docs/CTCORECHANGELOG.md", "diff": "### Version 4.3.1 (November 25, 2021)\n-* Fixes a Strict Mode Read violation that caused ANRs\n+* Fixes a Strict Mode Read violation for low RAM devices\n### Version 4.3.0 (November 2, 2021)\n* Adds support for [apps targeting Android 12 (API 31)](https://developer.android.com/about/versions/12/behavior-changes-12)\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/AndroidManifest.xml", "new_path": "sample/src/main/AndroidManifest.xml", "diff": "<!-- Add Permissions needed for CleverTap -->\n<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\n- <uses-feature android:name=\"android.hardware.ram.low\" android:required=\"true\"/>\n+\n+ <!--Enable below line to test for Android GO devices-->\n+ <!--<uses-feature android:name=\"android.hardware.ram.low\" android:required=\"true\"/>-->\n<application\nandroid:name=\".MyApplication\"\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/MyApplication.kt", "new_path": "sample/src/main/java/com/clevertap/demo/MyApplication.kt", "diff": "@@ -21,7 +21,7 @@ class MyApplication : MultiDexApplication(), CTPushNotificationListener {\noverride fun onCreate() {\n- StrictMode.setThreadPolicy(\n+ /*StrictMode.setThreadPolicy(\nStrictMode.ThreadPolicy.Builder()\n.detectAll() // or .detectAll() for all detectable problems\n.penaltyLog()\n@@ -34,7 +34,7 @@ class MyApplication : MultiDexApplication(), CTPushNotificationListener {\n.penaltyLog()\n//.penaltyDeath()\n.build()\n- );\n+ )*/\nCleverTapAPI.setDebugLevel(VERBOSE)\nActivityLifecycleCallback.register(this)\n" }, { "change_type": "MODIFY", "old_path": "templates/CTCORECHANGELOG.md", "new_path": "templates/CTCORECHANGELOG.md", "diff": "### Version 4.3.1 (November 25, 2021)\n-* Fixes a Strict Mode Read violation that caused ANRs\n+* Fixes a Strict Mode Read violation for low RAM devices\n### Version 4.3.0 (November 2, 2021)\n* Adds support for [apps targeting Android 12 (API 31)](https://developer.android.com/about/versions/12/behavior-changes-12)\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
chore(SDK-1163) - Update README.md and CHANGELOG.md for 4.3.1 release, comment Strict mode in sample's application.
116,612
26.11.2021 13:18:51
-19,080
0c502feedbf246bca1aeddde7a75bcaae4957baf
task(refactor): fix timer issue of not showing big image, not dismissing timer pn, showing negative timer values
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "diff": "@@ -150,8 +150,11 @@ class TemplateRenderer : INotificationRenderer {\nTemplateType.TIMER -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {\nif (ValidatorFactory.getValidator(TemplateType.TIMER, this)?.validate() == true) {\n- timerRunner(context, extras, notificationId, getTimerEnd())\n- return TimerStyle(this, extras).builderFromStyle(context, extras, notificationId, nb)\n+ val timerEnd = getTimerEnd()\n+ timerRunner(context, extras, notificationId, timerEnd)\n+ return TimerStyle(this, extras).builderFromStyle(context, extras, notificationId, nb).setTimeoutAfter(\n+ timerEnd!!.toLong()\n+ )\n}\n} else {\nPTLog.debug(\"Push Templates SDK supports Timer Notifications only on or above Android Nougat, reverting to basic template\")\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/TimerBigContentView.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/TimerBigContentView.kt", "diff": "@@ -10,12 +10,12 @@ import com.clevertap.android.pushtemplates.TemplateRenderer\nimport com.clevertap.android.pushtemplates.Utils\nclass TimerBigContentView(context: Context,timer_end: Int?, renderer: TemplateRenderer):\n- TimerSmallContentView(context, R.layout.timer, renderer) {\n+ TimerSmallContentView(context,timer_end,renderer, R.layout.timer) {\ninit {\nsetCustomContentViewMessageSummary(renderer.pt_msg_summary)\n- remoteView.setChronometer(\n+ /*remoteView.setChronometer(\nR.id.chronometer,\nSystemClock.elapsedRealtime() + timer_end!!,\nnull,\n@@ -23,7 +23,7 @@ class TimerBigContentView(context: Context,timer_end: Int?, renderer: TemplateRe\n)\nif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {\nremoteView.setChronometerCountDown(R.id.chronometer, true)\n- }\n+ }*/\nsetCustomContentViewBigImage(renderer.pt_big_img)\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/TimerSmallContentView.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/TimerSmallContentView.kt", "diff": "@@ -8,8 +8,8 @@ import com.clevertap.android.pushtemplates.R\nimport com.clevertap.android.pushtemplates.TemplateRenderer\nimport com.clevertap.android.pushtemplates.Utils\n-open class TimerSmallContentView(context: Context, timer_end: Int?,renderer: TemplateRenderer):\n- ContentView(context, R.layout.timer_collapsed,renderer) {\n+open class TimerSmallContentView(context: Context, timer_end: Int?,renderer: TemplateRenderer,layoutId: Int = R.layout.timer_collapsed):\n+ ContentView(context, layoutId,renderer) {\ninit {\nsetCustomContentViewBasicKeys()\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): fix timer issue of not showing big image, not dismissing timer pn, showing negative timer values SDK-1056
116,616
26.11.2021 15:05:33
-19,080
7751503d08f1206ea413dc48951ba577030d42e7
task(refactor) - Update SCV and BCV for single line/multi line message
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/ProductDisplayNonLinearBigContentView.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/ProductDisplayNonLinearBigContentView.kt", "diff": "@@ -12,10 +12,10 @@ class ProductDisplayNonLinearBigContentView(context: Context, renderer: Template\ninit {\nif (renderer.smallTextList!!.isNotEmpty())\n- setCustomContentViewText(R.id.product_description, renderer.smallTextList!![0])\n+ setCustomContentViewText(R.id.msg, renderer.smallTextList!![0])\nsetCustomContentViewTitle(renderer.pt_title)\nsetCustomContentViewMessage(renderer.pt_msg)\n- setCustomContentViewElementColour(R.id.product_description, renderer.pt_msg_clr)\n+ setCustomContentViewElementColour(R.id.msg, renderer.pt_msg_clr)\nsetCustomContentViewElementColour(R.id.product_name, renderer.pt_title_clr)\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/product_display_template.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/product_display_template.xml", "diff": "android:padding=\"16dp\"\nandroid:id=\"@+id/content_view_big\">\n- <RelativeLayout\n- android:id=\"@+id/rel_lyt\"\n- android:layout_width=\"match_parent\"\n- android:layout_height=\"wrap_content\">\n-\n<include\n- android:id=\"@+id/metadata\"\n- layout=\"@layout/metadata\" />\n-\n- <TextView\n- android:id=\"@+id/product_name\"\n- android:layout_width=\"wrap_content\"\n- android:layout_height=\"wrap_content\"\n- android:layout_below=\"@+id/metadata\"\n- android:layout_alignStart=\"@id/metadata\"\n- android:layout_marginTop=\"8dp\"\n- android:layout_marginEnd=\"8dp\"\n- android:text=\"title\"\n- android:textAppearance=\"@style/PushTitle\"\n- tools:ignore=\"RtlCompat\" />\n-\n- <TextView\n- android:id=\"@+id/product_description\"\n- android:layout_width=\"wrap_content\"\n- android:layout_height=\"wrap_content\"\n- android:layout_below=\"@+id/product_name\"\n- android:layout_alignStart=\"@id/product_name\"\n- android:layout_marginEnd=\"8dp\"\n- android:text=\"message\"\n- android:textAppearance=\"@style/PushMessage\" />\n-\n- </RelativeLayout>\n-\n+ android:id=\"@+id/rel_lyt\"\n+ layout=\"@layout/content_view_small_multi_line_msg\" />\n<LinearLayout\nandroid:id=\"@+id/carousel_relative_layout\"\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/rating.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/rating.xml", "diff": "<include\nandroid:id=\"@+id/rel_lyt\"\n- layout=\"@layout/content_view_small_single_line_msg\" />\n+ layout=\"@layout/content_view_small_multi_line_msg\" />\n<LinearLayout\nandroid:layout_width=\"match_parent\"\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/timer.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/timer.xml", "diff": "android:layout_below=\"@+id/title\"\nandroid:layout_alignStart=\"@+id/title\"\nandroid:text=\"message\"\n- android:textAppearance=\"@style/PushMessage\" />\n+ android:textAppearance=\"@style/PushMessageMultiLine\" />\n</RelativeLayout>\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/timer_collapsed.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/timer_collapsed.xml", "diff": "android:paddingRight=\"@dimen/padding_horizontal\"\nandroid:paddingBottom=\"@dimen/padding_vertical\">\n-\n<include\n- android:id=\"@+id/metadata\"\n- layout=\"@layout/metadata\" />\n-\n- <RelativeLayout\n- android:layout_width=\"match_parent\"\n- android:layout_height=\"wrap_content\"\n- android:layout_below=\"@+id/metadata\"\n- android:layout_marginEnd=\"@dimen/padding_vertical\"\n- android:layout_toStartOf=\"@+id/chronometer\">\n-\n-\n- <TextView\n- android:id=\"@+id/title\"\n- android:layout_width=\"match_parent\"\n- android:layout_height=\"wrap_content\"\n- android:layout_marginTop=\"@dimen/metadata_title_margin_vertical\"\n- android:text=\"title\"\n- android:textAppearance=\"@style/PushTitle\" />\n-\n- <TextView\n- android:id=\"@+id/msg\"\n- android:layout_width=\"match_parent\"\n- android:layout_height=\"wrap_content\"\n- android:layout_below=\"@+id/title\"\n- android:layout_alignStart=\"@+id/title\"\n- android:text=\"message\"\n- android:textAppearance=\"@style/PushMessage\" />\n-\n- </RelativeLayout>\n+ android:id=\"@+id/rel_lyt\"\n+ layout=\"@layout/content_view_small_single_line_msg\" />\n<Chronometer\nandroid:id=\"@+id/chronometer\"\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/zero_bezel.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/zero_bezel.xml", "diff": "android:layout_below=\"@+id/title\"\nandroid:layout_alignStart=\"@id/title\"\nandroid:text=\"message\"\n- android:textAppearance=\"@style/PushMessage\"\n+ android:textAppearance=\"@style/PushMessageMultiLine\"\nandroid:textColor=\"@color/white\" />\n</RelativeLayout>\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor) - Update SCV and BCV for single line/multi line message
116,616
26.11.2021 15:45:26
-19,080
8b46e79165a597af63e70bcec92fbda48c19571e
chore(refactor) - Update SCV and BCV for single line/multi line message remaining commit
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -579,7 +579,7 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nString dl = deepLinkList.get(currentPosition);\ncontentViewBig.setTextViewText(R.id.product_name, bigTextList.get(currentPosition));\n- contentViewBig.setTextViewText(R.id.product_description, smallTextList.get(currentPosition));\n+ contentViewBig.setTextViewText(R.id.msg, smallTextList.get(currentPosition));\ncontentViewBig.setTextViewText(R.id.product_price, priceList.get(currentPosition));\nextras.remove(PTConstants.PT_CURRENT_POSITION);\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
chore(refactor) - Update SCV and BCV for single line/multi line message remaining commit
116,623
26.11.2021 16:12:17
-19,080
925c72224023d890d7195ab3fe1f4632971dc360
task(SDK-1196): Manually updated product_description to msg to avoid local build fail
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -580,7 +580,7 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nString dl = deepLinkList.get(currentPosition);\ncontentViewBig.setTextViewText(R.id.product_name, bigTextList.get(currentPosition));\n- contentViewBig.setTextViewText(R.id.product_description, smallTextList.get(currentPosition));\n+ contentViewBig.setTextViewText(R.id.msg, smallTextList.get(currentPosition));\ncontentViewBig.setTextViewText(R.id.product_price, priceList.get(currentPosition));\nextras.remove(PTConstants.PT_CURRENT_POSITION);\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1196): Manually updated product_description to msg to avoid local build fail
116,623
26.11.2021 16:19:03
-19,080
917920d22da66c00f3950c1e39b5bdebc8ca8729
task(SDK-1197): Always calculate absolute value of collapse key to generate notification id
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "diff": "@@ -995,6 +995,7 @@ public class PushProviders implements CTPushProviderListener {\n}\n}\n}\n+ notificationId = Math.abs(notificationId); //Notification Id always needs to be positive\n} catch (NumberFormatException e) {\n// no-op\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1197): Always calculate absolute value of collapse key to generate notification id
116,612
02.12.2021 18:08:28
-19,080
b7837e92a21930374e43bf6d0303d5f96f0127fd
task(Android 12): Add mutability flags
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -11,6 +11,8 @@ import android.content.pm.PackageManager;\nimport android.graphics.Bitmap;\nimport android.net.Uri;\nimport android.os.Build;\n+import android.os.Build.VERSION;\n+import android.os.Build.VERSION_CODES;\nimport android.os.Bundle;\nimport android.text.Html;\nimport android.view.View;\n@@ -587,13 +589,17 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nPendingIntent pIntent;\n+ int flagsActionLaunchPendingIntent = 0;\n+ if (VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsActionLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n+ }\nIntent notificationIntent4 = new Intent(context, PushTemplateReceiver.class);\nnotificationIntent4.putExtra(PTConstants.PT_IMAGE_1, true);\nnotificationIntent4.putExtra(PTConstants.PT_NOTIF_ID, notificationId);\nnotificationIntent4.putExtra(PTConstants.PT_BUY_NOW_DL, dl);\nnotificationIntent4.putExtra(PTConstants.PT_BUY_NOW, true);\nnotificationIntent4.putExtras(extras);\n- PendingIntent contentIntent4 = PendingIntent.getBroadcast(context, new Random().nextInt(), notificationIntent4, 0);\n+ PendingIntent contentIntent4 = PendingIntent.getBroadcast(context, new Random().nextInt(), notificationIntent4, flagsActionLaunchPendingIntent);\ncontentViewBig.setOnClickPendingIntent(R.id.product_action, contentIntent4);\nNotificationCompat.Builder notificationBuilder = setBuilderWithChannelIDCheck(requiresChannelId, PTConstants.PT_SILENT_CHANNEL_ID, context);\n@@ -682,7 +688,7 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nlaunchIntent.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM);\nlaunchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);\nint flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {\nflagsLaunchPendingIntent |= PendingIntent.FLAG_MUTABLE;\n}\nreturn PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n@@ -692,8 +698,14 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nprivate PendingIntent setDismissIntent(Context context, Bundle extras, Intent intent) {\nintent.putExtras(extras);\nintent.putExtra(PTConstants.PT_DISMISS_INTENT, true);\n+\n+ int flagsLaunchPendingIntent = PendingIntent.FLAG_CANCEL_CURRENT;\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.S) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent | PendingIntent.FLAG_MUTABLE;\n+ }\n+\nreturn PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n- intent, PendingIntent.FLAG_CANCEL_CURRENT);\n+ intent, flagsLaunchPendingIntent);\n}\nprivate void setNotificationBuilderBasics(NotificationCompat.Builder notificationBuilder, RemoteViews contentViewSmall, RemoteViews contentViewBig, String pt_title, PendingIntent pIntent, PendingIntent dIntent) {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "diff": "@@ -4,6 +4,7 @@ import android.app.PendingIntent\nimport android.content.Context\nimport android.content.Intent\nimport android.os.Build\n+import android.os.Build.VERSION\nimport android.os.Build.VERSION_CODES\nimport android.os.Bundle\nimport com.clevertap.android.pushtemplates.PTConstants\n@@ -66,7 +67,7 @@ internal object PendingIntentFactory {\nlaunchIntent.flags =\nIntent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK\nvar flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n- if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.S) {\nflagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n}\nreturn PendingIntent.getBroadcast(\n@@ -80,9 +81,14 @@ internal object PendingIntentFactory {\nfun setDismissIntent(context: Context, extras: Bundle, intent: Intent): PendingIntent {\nintent.putExtras(extras)\nintent.putExtra(PTConstants.PT_DISMISS_INTENT, true)\n+\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_CANCEL_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.S) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\nreturn PendingIntent.getBroadcast(\ncontext, System.currentTimeMillis().toInt(),\n- intent, PendingIntent.FLAG_CANCEL_CURRENT\n+ intent, flagsLaunchPendingIntent\n)\n}\n@@ -98,6 +104,10 @@ internal object PendingIntentFactory {\nlaunchIntent = Intent(context, PushTemplateReceiver::class.java)\n}\n+ var flagsLaunchPendingIntent = 0\n+ if (VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_IMMUTABLE\n+ }\nwhen (identifier) {\nBASIC_CONTENT_PENDING_INTENT, AUTO_CAROUSEL_CONTENT_PENDING_INTENT,\n@@ -162,7 +172,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer.config)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nRATING_CLICK2_PENDING_INTENT -> {\n@@ -170,7 +180,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer.config)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nRATING_CLICK3_PENDING_INTENT -> {\n@@ -178,7 +188,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer.config)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nRATING_CLICK4_PENDING_INTENT -> {\n@@ -186,7 +196,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer.config)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nRATING_CLICK5_PENDING_INTENT -> {\n@@ -194,7 +204,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer.config)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\n@@ -203,7 +213,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(\"cta1\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\nFIVE_ICON_CTA2_PENDING_INTENT -> {\n@@ -211,7 +221,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(\"cta2\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\nFIVE_ICON_CTA3_PENDING_INTENT -> {\n@@ -219,7 +229,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(\"cta3\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\nFIVE_ICON_CTA4_PENDING_INTENT -> {\n@@ -227,7 +237,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(\"cta4\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\nFIVE_ICON_CTA5_PENDING_INTENT -> {\n@@ -235,7 +245,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(\"cta5\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\nFIVE_ICON_CONTENT_PENDING_INTENT -> {\n@@ -247,7 +257,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(\"close\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_DL1_PENDING_INTENT -> {\n@@ -256,7 +266,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer.deepLinkList!![0])\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, requestCode, launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_DL2_PENDING_INTENT -> {\n@@ -265,7 +275,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer.deepLinkList!![1])\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, requestCode, launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_DL3_PENDING_INTENT -> {\n@@ -274,7 +284,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer.deepLinkList!![2])\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, requestCode, launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_CONTENT_SMALL1_PENDING_INTENT -> {\n@@ -319,7 +329,7 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_BUY_NOW, true)\nlaunchIntent.putExtra(\"config\", renderer.config)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, 0)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nINPUT_BOX_CONTENT_PENDING_INTENT -> {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/InputBoxStyle.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/InputBoxStyle.kt", "diff": "@@ -4,6 +4,8 @@ import android.app.PendingIntent\nimport android.content.Context\nimport android.content.Intent\nimport android.net.Uri\n+import android.os.Build\n+import android.os.Build.VERSION_CODES\nimport android.os.Bundle\nimport android.widget.RemoteViews\nimport androidx.core.app.NotificationCompat\n@@ -140,15 +142,21 @@ class InputBoxStyle(private var renderer: TemplateRenderer): Style(renderer) {\n}\nvar actionIntent: PendingIntent? = null\nval requestCode = System.currentTimeMillis().toInt() + i\n+\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.S) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+\nactionIntent = if (sendToPTIntentService) {\nPendingIntent.getService(\ncontext, requestCode,\n- actionLaunchIntent!!, PendingIntent.FLAG_UPDATE_CURRENT\n+ actionLaunchIntent!!, flagsLaunchPendingIntent\n)\n} else {\nPendingIntent.getActivity(\ncontext, requestCode,\n- actionLaunchIntent, PendingIntent.FLAG_UPDATE_CURRENT\n+ actionLaunchIntent,flagsLaunchPendingIntent\n)\n}\nnb.addAction(icon, label, actionIntent)\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Add mutability flags SDK-1056
116,616
03.12.2021 14:04:19
-19,080
a57843dcee087d08a0c3b85baa20339bb031c7e9
chore(refactor-Android12) - Update mutable flags in PendingIntentFactory.kt
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "diff": "@@ -80,9 +80,13 @@ internal object PendingIntentFactory {\nfun setDismissIntent(context: Context, extras: Bundle, intent: Intent): PendingIntent {\nintent.putExtras(extras)\nintent.putExtra(PTConstants.PT_DISMISS_INTENT, true)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\nreturn PendingIntent.getBroadcast(\ncontext, System.currentTimeMillis().toInt(),\n- intent, PendingIntent.FLAG_CANCEL_CURRENT\n+ intent, flagsLaunchPendingIntent\n)\n}\n@@ -162,7 +166,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer.config)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nRATING_CLICK2_PENDING_INTENT -> {\n@@ -170,7 +178,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer.config)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nRATING_CLICK3_PENDING_INTENT -> {\n@@ -178,7 +190,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer.config)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nRATING_CLICK4_PENDING_INTENT -> {\n@@ -186,7 +202,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer.config)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nRATING_CLICK5_PENDING_INTENT -> {\n@@ -194,7 +214,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer.config)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\n@@ -203,7 +227,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(\"cta1\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\nFIVE_ICON_CTA2_PENDING_INTENT -> {\n@@ -211,7 +239,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(\"cta2\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\nFIVE_ICON_CTA3_PENDING_INTENT -> {\n@@ -219,7 +251,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(\"cta3\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\nFIVE_ICON_CTA4_PENDING_INTENT -> {\n@@ -227,7 +263,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(\"cta4\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\nFIVE_ICON_CTA5_PENDING_INTENT -> {\n@@ -235,7 +275,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(\"cta5\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\nFIVE_ICON_CONTENT_PENDING_INTENT -> {\n@@ -247,7 +291,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(\"close\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_DL1_PENDING_INTENT -> {\n@@ -256,7 +304,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer.deepLinkList!![0])\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, requestCode, launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_DL2_PENDING_INTENT -> {\n@@ -265,7 +317,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer.deepLinkList!![1])\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, requestCode, launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_DL3_PENDING_INTENT -> {\n@@ -274,7 +330,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer.deepLinkList!![2])\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, requestCode, launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_CONTENT_SMALL1_PENDING_INTENT -> {\n@@ -319,7 +379,11 @@ internal object PendingIntentFactory {\nlaunchIntent.putExtra(PTConstants.PT_BUY_NOW, true)\nlaunchIntent.putExtra(\"config\", renderer.config)\nlaunchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, 0)\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n+ }\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nINPUT_BOX_CONTENT_PENDING_INTENT -> {\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
chore(refactor-Android12) - Update mutable flags in PendingIntentFactory.kt
116,612
05.12.2021 17:06:53
-19,080
42be1c09ad1bf46b0a85d7b3446ef457736af677
task(refactor): Replace AsyncHelper with CTExecutorFactory
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PTPushNotificationReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PTPushNotificationReceiver.java", "diff": "@@ -2,26 +2,53 @@ package com.clevertap.android.pushtemplates;\nimport android.content.Context;\nimport android.content.Intent;\n-\n+import android.os.Bundle;\n+import com.clevertap.android.sdk.CleverTapAPI;\n+import com.clevertap.android.sdk.CleverTapInstanceConfig;\n+import com.clevertap.android.sdk.Constants;\nimport com.clevertap.android.sdk.pushnotification.CTPushNotificationReceiver;\n+import com.clevertap.android.sdk.task.CTExecutorFactory;\n+import com.clevertap.android.sdk.task.Task;\n+import java.util.concurrent.Callable;\npublic class PTPushNotificationReceiver extends CTPushNotificationReceiver {\n- private final AsyncHelper asyncHelper = AsyncHelper.getInstance();\n@Override\npublic void onReceive(final Context context, final Intent intent) {\nsuper.onReceive(context, intent);\n- asyncHelper.postAsyncSafely(\"PTPushNotificationReceiver#cleanUpFiles\", new Runnable() {\n+ Bundle extras = intent.getExtras();\n+ if (extras == null) {\n+ return;\n+ }\n+ CleverTapAPI cleverTapAPI = CleverTapAPI\n+ .getGlobalInstance(context, extras.getString(Constants.WZRK_ACCT_ID_KEY));\n+\n+ if (cleverTapAPI != null) {\n+ try {\n+ CleverTapInstanceConfig config = cleverTapAPI.getCoreState().getConfig();\n+ Task<Void> task = CTExecutorFactory.executors(config).postAsyncSafelyTask();\n+ task.execute(\"PTPushNotificationReceiver#cleanUpFiles\", new Callable<Void>() {\n@Override\n- public void run() {\n+ public Void call() throws Exception {\ntry {\nUtils.deleteImageFromStorage(context, intent);\nUtils.deleteSilentNotificationChannel(context);\n} catch (Throwable t) {\n- PTLog.verbose(\"Couldn't clean up images and/or couldn't delete silent notification channel: \" + t.getLocalizedMessage());\n+ PTLog.verbose(\n+ \"Couldn't clean up images and/or couldn't delete silent notification channel: \"\n+ + t.getLocalizedMessage());\n}\n+ return null;\n}\n});\n+ } catch (Exception e) {\n+ PTLog.verbose(\"Couldn't clean up images and/or couldn't delete silent notification channel: \" + e\n+ .getLocalizedMessage());\n+ }\n+\n+ } else {\n+ PTLog.verbose(\"clevertap instance is null, not running PTPushNotificationReceiver#cleanUpFiles\");\n+ }\n}\n}\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Replace AsyncHelper with CTExecutorFactory SDK-1056
116,612
05.12.2021 19:31:28
-19,080
45d5a39840a557534b35e70cdeabe6f65221a40d
task(refactor): Make setPendingIntent independent of dl param
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "diff": "@@ -53,14 +53,14 @@ internal object PendingIntentFactory {\n@JvmStatic\nfun setPendingIntent(\n- context: Context, notificationId: Int, extras: Bundle, launchIntent: Intent,\n- dl: String?\n+ context: Context, notificationId: Int, extras: Bundle, launchIntent: Intent\n): PendingIntent {\n+ val dl = extras[Constants.DEEP_LINK_KEY]\nlaunchIntent.putExtras(extras)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nif (dl != null) {\nlaunchIntent.putExtra(PTConstants.DEFAULT_DL, true)\n- launchIntent.putExtra(Constants.DEEP_LINK_KEY, dl)\n+ //launchIntent.putExtra(Constants.DEEP_LINK_KEY, dl)\n}\nlaunchIntent.removeExtra(Constants.WZRK_ACTIONS)\nlaunchIntent.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM)\n@@ -114,19 +114,21 @@ internal object PendingIntentFactory {\nMANUAL_CAROUSEL_CONTENT_PENDING_INTENT, ZERO_BEZEL_CONTENT_PENDING_INTENT,\nTIMER_CONTENT_PENDING_INTENT,PRODUCT_DISPLAY_CONTENT_PENDING_INTENT -> {\nreturn if (renderer.deepLinkList != null && renderer.deepLinkList!!.size > 0) {\n+ extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])\nsetPendingIntent(\ncontext,\nnotificationId,\nextras,\n- launchIntent,\n- renderer.deepLinkList!![0]\n+ launchIntent\n)\n} else {\n- setPendingIntent(context, notificationId, extras, launchIntent, null)\n+ extras.putString(Constants.DEEP_LINK_KEY,null)\n+ setPendingIntent(context, notificationId, extras, launchIntent)\n}\n}\nMANUAL_CAROUSEL_RIGHT_ARROW_PENDING_INTENT -> {\n+ extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])\nlaunchIntent.putExtra(PTConstants.PT_RIGHT_SWIPE, true)\nlaunchIntent.putExtra(PTConstants.PT_MANUAL_CAROUSEL_FROM, 0)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n@@ -136,19 +138,19 @@ internal object PendingIntentFactory {\ncontext,\nnotificationId,\nextras,\n- launchIntent,\n- renderer.deepLinkList!![0]\n+ launchIntent\n)\n}\nMANUAL_CAROUSEL_LEFT_ARROW_PENDING_INTENT -> {\n+ extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])\nlaunchIntent.putExtra(PTConstants.PT_RIGHT_SWIPE, false)\nlaunchIntent.putExtra(PTConstants.PT_MANUAL_CAROUSEL_FROM, 0)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtras(extras)\nreturn setPendingIntent(\n- context, notificationId, extras, launchIntent, renderer.deepLinkList!![0]\n+ context, notificationId, extras, launchIntent\n)\n}\n@@ -158,12 +160,13 @@ internal object PendingIntentFactory {\n}\nRATING_CONTENT_PENDING_INTENT -> {\n+ extras.putString(Constants.DEEP_LINK_KEY,\n+ renderer.pt_rating_default_dl)\nreturn setPendingIntent(\ncontext,\nnotificationId,\nextras,\n- launchIntent,\n- renderer.pt_rating_default_dl\n+ launchIntent\n)\n}\n@@ -208,7 +211,7 @@ internal object PendingIntentFactory {\n}\n- FIVE_ICON_CTA1_PENDING_INTENT -> {\n+ FIVE_ICON_CTA1_PENDING_INTENT -> { // TODO : OK to handle same as LaunchPendingIntentFactory\nval reqCode = Random().nextInt()\nlaunchIntent.putExtra(\"cta1\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n@@ -216,7 +219,7 @@ internal object PendingIntentFactory {\nreturn PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\n- FIVE_ICON_CTA2_PENDING_INTENT -> {\n+ FIVE_ICON_CTA2_PENDING_INTENT -> {// TODO : OK to handle same as LaunchPendingIntentFactory\nval reqCode = Random().nextInt()\nlaunchIntent.putExtra(\"cta2\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n@@ -224,7 +227,7 @@ internal object PendingIntentFactory {\nreturn PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\n- FIVE_ICON_CTA3_PENDING_INTENT -> {\n+ FIVE_ICON_CTA3_PENDING_INTENT -> {// TODO : OK to handle same as LaunchPendingIntentFactory\nval reqCode = Random().nextInt()\nlaunchIntent.putExtra(\"cta3\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n@@ -232,7 +235,7 @@ internal object PendingIntentFactory {\nreturn PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\n- FIVE_ICON_CTA4_PENDING_INTENT -> {\n+ FIVE_ICON_CTA4_PENDING_INTENT -> {// TODO : OK to handle same as LaunchPendingIntentFactory\nval reqCode = Random().nextInt()\nlaunchIntent.putExtra(\"cta4\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n@@ -240,7 +243,7 @@ internal object PendingIntentFactory {\nreturn PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n}\n- FIVE_ICON_CTA5_PENDING_INTENT -> {\n+ FIVE_ICON_CTA5_PENDING_INTENT -> {// TODO : OK to handle same as LaunchPendingIntentFactory\nval reqCode = Random().nextInt()\nlaunchIntent.putExtra(\"cta5\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n@@ -249,10 +252,11 @@ internal object PendingIntentFactory {\n}\nFIVE_ICON_CONTENT_PENDING_INTENT -> {\n- return setPendingIntent(context, notificationId, extras, launchIntent, null)\n+ extras.putString(Constants.DEEP_LINK_KEY,null)\n+ return setPendingIntent(context, notificationId, extras, launchIntent)\n}\n- FIVE_ICON_CLOSE_PENDING_INTENT -> {\n+ FIVE_ICON_CLOSE_PENDING_INTENT -> {// TODO : pass to PushTemplateReceiver\nval reqCode = Random().nextInt()\nlaunchIntent.putExtra(\"close\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n@@ -288,32 +292,35 @@ internal object PendingIntentFactory {\n}\nPRODUCT_DISPLAY_CONTENT_SMALL1_PENDING_INTENT -> {\n+ extras.putString(Constants.DEEP_LINK_KEY,\n+ renderer.deepLinkList!![0])\nreturn setPendingIntent(\ncontext,\nnotificationId,\nextras,\n- launchIntent,\n- renderer.deepLinkList!![0]\n+ launchIntent\n)\n}\nPRODUCT_DISPLAY_CONTENT_SMALL2_PENDING_INTENT -> {\n+ extras.putString(Constants.DEEP_LINK_KEY,\n+ renderer.deepLinkList!![1])\nreturn setPendingIntent(\ncontext,\nnotificationId,\nextras,\n- launchIntent,\n- renderer.deepLinkList!![1]\n+ launchIntent\n)\n}\nPRODUCT_DISPLAY_CONTENT_SMALL3_PENDING_INTENT -> {\n+ extras.putString(Constants.DEEP_LINK_KEY,\n+ renderer.deepLinkList!![2])\nreturn setPendingIntent(\ncontext,\nnotificationId,\nextras,\n- launchIntent,\n- renderer.deepLinkList!![2]\n+ launchIntent\n)\n}\n@@ -333,21 +340,22 @@ internal object PendingIntentFactory {\n}\nINPUT_BOX_CONTENT_PENDING_INTENT -> {\n-\n+ extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])\nreturn if (renderer.deepLinkList != null && renderer.deepLinkList!!.size > 0) {\nsetPendingIntent(\ncontext,\nnotificationId,\nextras,\n- launchIntent,\n- renderer.deepLinkList!![0]\n+ launchIntent\n)\n} else {\n- setPendingIntent(context, notificationId, extras, launchIntent, null)\n+ extras.putString(Constants.DEEP_LINK_KEY,null)\n+ setPendingIntent(context, notificationId, extras, launchIntent)\n}\n}\nINPUT_BOX_REPLY_PENDING_INTENT -> {\n+ extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])\nlaunchIntent.putExtra(PTConstants.PT_INPUT_FEEDBACK, renderer.pt_input_feedback)\nlaunchIntent.putExtra(PTConstants.PT_INPUT_AUTO_OPEN, renderer.pt_input_auto_open)\nlaunchIntent.putExtra(\"config\", renderer.config)\n@@ -357,11 +365,11 @@ internal object PendingIntentFactory {\ncontext,\nnotificationId,\nextras,\n- launchIntent,\n- renderer.deepLinkList!![0]\n+ launchIntent\n)\n} else {\n- setPendingIntent(context, notificationId, extras, launchIntent, null)\n+ extras.putString(Constants.DEEP_LINK_KEY,null)\n+ setPendingIntent(context, notificationId, extras, launchIntent)\n}\n}\nelse -> throw IllegalArgumentException(\"invalid pendingIntentType\")\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Make setPendingIntent independent of dl param SDK-1056
116,616
07.12.2021 18:30:38
-19,080
8382f8bb810aacd9f6573470c70c3c62d41db8ff
chore(refactor-Android12) - Update layouts for v31
[ { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/auto_carousel.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_big\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:orientation=\"vertical\">\n+\n+ <include layout=\"@layout/content_view_small_multi_line_msg\"\n+ android:id=\"@+id/rel_lyt\"/>\n+\n+ <ViewFlipper\n+ android:id=\"@+id/view_flipper\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_below=\"@id/rel_lyt\"\n+ android:autoStart=\"true\"\n+ android:inAnimation=\"@anim/slide_in_right\"\n+ android:outAnimation=\"@anim/slide_out_left\">\n+ </ViewFlipper>\n+</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/content_view_small_multi_line_msg.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_small\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\" >\n+\n+ <RelativeLayout\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:id=\"@+id/rel_lyt\">\n+\n+ <TextView\n+ android:id=\"@+id/title\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_marginEnd=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_alignParentStart=\"true\"\n+ android:layout_toStartOf=\"@+id/large_icon\"\n+ android:text=\"title\"\n+ android:textAppearance=\"@style/PushTitle\" />\n+\n+ <TextView\n+ android:id=\"@+id/msg\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_below=\"@+id/title\"\n+ android:layout_alignStart=\"@id/title\"\n+ android:layout_alignParentStart=\"true\"\n+ android:layout_toStartOf=\"@+id/large_icon\"\n+ android:text=\"message message\"\n+ android:textAppearance=\"@style/PushMessageMultiLine\"\n+ />\n+\n+\n+ <ImageView\n+ android:id=\"@+id/large_icon\"\n+ android:layout_width=\"@dimen/large_icon\"\n+ android:layout_height=\"@dimen/large_icon\"\n+ android:layout_marginStart=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_alignParentEnd=\"true\"\n+ android:scaleType=\"centerCrop\" />\n+ </RelativeLayout>\n+\n+</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/content_view_small_single_line_msg.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_small\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\">\n+\n+ <RelativeLayout\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:id=\"@+id/rel_lyt\">\n+\n+ <TextView\n+ android:id=\"@+id/title\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_marginEnd=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_alignParentStart=\"true\"\n+ android:layout_toStartOf=\"@+id/large_icon\"\n+ android:text=\"title\"\n+ android:textAppearance=\"@style/PushTitle\" />\n+\n+ <TextView\n+ android:id=\"@+id/msg\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_below=\"@+id/title\"\n+ android:layout_alignStart=\"@id/title\"\n+ android:layout_alignParentStart=\"true\"\n+ android:layout_toStartOf=\"@+id/large_icon\"\n+ android:text=\"message message\"\n+ android:textAppearance=\"@style/PushMessage\"\n+ android:maxLines=\"1\"\n+ android:ellipsize=\"end\"\n+ />\n+\n+\n+ <ImageView\n+ android:id=\"@+id/large_icon\"\n+ android:layout_width=\"@dimen/large_icon\"\n+ android:layout_height=\"@dimen/large_icon\"\n+ android:layout_marginStart=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_alignParentEnd=\"true\"\n+ android:scaleType=\"centerCrop\" />\n+ </RelativeLayout>\n+\n+</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/cv_small_text_only.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_small\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:paddingLeft=\"@dimen/padding_horizontal\"\n+ android:paddingTop=\"@dimen/padding_vertical\"\n+ android:paddingRight=\"@dimen/padding_horizontal\"\n+ android:paddingBottom=\"@dimen/padding_vertical\">\n+\n+ <ImageView\n+ android:id=\"@+id/large_icon\"\n+ android:layout_width=\"@dimen/large_icon\"\n+ android:layout_height=\"@dimen/large_icon\"\n+ android:layout_alignParentStart=\"true\"\n+ android:scaleType=\"centerCrop\" />\n+\n+\n+ <RelativeLayout\n+ android:id=\"@+id/rel_lyt\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_toEndOf=\"@id/large_icon\">\n+\n+ <TextView\n+ android:id=\"@+id/title\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_marginStart=\"@dimen/metadata_title_margin_horizontal\"\n+ android:ellipsize=\"end\"\n+ android:maxLines=\"2\"\n+ android:layout_marginTop=\"4dp\"\n+ android:text=\"title\"\n+ android:textAppearance=\"@style/PushTitle\" />\n+ </RelativeLayout>\n+\n+</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/cv_small_zero_bezel.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_small\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\">\n+\n+ <ImageView\n+ android:id=\"@+id/big_image\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:scaleType=\"centerCrop\"/>\n+\n+ <ImageView\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_alignBottom=\"@+id/big_image\"\n+ android:background=\"@drawable/scrim\" />\n+\n+ <RelativeLayout\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_alignBottom=\"@+id/big_image\"\n+ android:paddingLeft=\"@dimen/padding_horizontal\"\n+ android:paddingStart=\"@dimen/padding_horizontal\"\n+ android:paddingRight=\"@dimen/padding_horizontal\"\n+ android:paddingEnd=\"@dimen/padding_horizontal\"\n+ android:paddingBottom=\"@dimen/padding_vertical\"\n+ android:paddingTop=\"@dimen/padding_vertical\">\n+\n+ <TextView\n+ android:id=\"@+id/title\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_marginTop=\"@dimen/metadata_title_margin_vertical\"\n+ android:ellipsize=\"end\"\n+ android:maxLines=\"1\"\n+ android:text=\"title\"\n+ android:textAppearance=\"@style/PushTitle\"\n+ android:textColor=\"@color/white\" />\n+\n+ <TextView\n+ android:id=\"@+id/msg\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_below=\"@+id/title\"\n+ android:layout_alignStart=\"@id/title\"\n+ android:ellipsize=\"end\"\n+ android:maxLines=\"2\"\n+ android:text=\"message message message\"\n+ android:textAppearance=\"@style/PushMessage\"\n+ android:textColor=\"@color/white\" />\n+\n+ </RelativeLayout>\n+</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/timer.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_big\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:background=\"@android:color/white\"\n+ android:orientation=\"vertical\">\n+\n+ <RelativeLayout\n+ android:id=\"@+id/rel_lyt\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\">\n+\n+ <RelativeLayout\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_marginEnd=\"@dimen/padding_vertical\"\n+ android:layout_toStartOf=\"@+id/chronometer\">\n+\n+\n+ <TextView\n+ android:id=\"@+id/title\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_marginTop=\"@dimen/metadata_title_margin_vertical\"\n+ android:text=\"title\"\n+ android:textAppearance=\"@style/PushTitle\" />\n+\n+ <TextView\n+ android:id=\"@+id/msg\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_below=\"@+id/title\"\n+ android:layout_alignStart=\"@+id/title\"\n+ android:text=\"message\"\n+ android:textAppearance=\"@style/PushMessageMultiLine\" />\n+\n+ </RelativeLayout>\n+\n+ <Chronometer\n+ android:id=\"@+id/chronometer\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_alignParentEnd=\"true\"\n+ android:layout_centerVertical=\"true\"\n+ android:textAlignment=\"center\"\n+ android:textSize=\"@dimen/chronometer_font_size\" />\n+\n+ </RelativeLayout>\n+\n+ <ImageView\n+ android:id=\"@+id/big_image\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_below=\"@id/rel_lyt\"\n+ android:layout_alignParentBottom=\"true\"\n+ android:scaleType=\"centerCrop\" />\n+\n+</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/zero_bezel.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_big\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:background=\"@android:color/white\"\n+ android:orientation=\"vertical\">\n+\n+ <ImageView\n+ android:id=\"@+id/big_image\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:scaleType=\"centerCrop\" />\n+\n+ <ImageView\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_alignBottom=\"@+id/big_image\"\n+ android:background=\"@drawable/scrim\" />\n+\n+ <RelativeLayout\n+ android:id=\"@+id/rel_lyt\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_alignBottom=\"@+id/big_image\"\n+ android:paddingStart=\"@dimen/padding_horizontal\"\n+ android:paddingLeft=\"@dimen/padding_horizontal\"\n+ android:paddingTop=\"@dimen/padding_vertical\"\n+ android:paddingEnd=\"@dimen/padding_horizontal\"\n+ android:paddingRight=\"@dimen/padding_horizontal\"\n+ android:paddingBottom=\"@dimen/padding_vertical\">\n+\n+ <TextView\n+ android:id=\"@+id/title\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_marginTop=\"@dimen/metadata_title_margin_vertical\"\n+ android:text=\"title\"\n+ android:textAppearance=\"@style/PushTitle\"\n+ android:textColor=\"@color/white\" />\n+\n+ <TextView\n+ android:id=\"@+id/msg\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_below=\"@+id/title\"\n+ android:layout_alignStart=\"@id/title\"\n+ android:text=\"message\"\n+ android:textAppearance=\"@style/PushMessageMultiLine\"\n+ android:textColor=\"@color/white\" />\n+\n+ </RelativeLayout>\n+\n+</RelativeLayout>\n\\ No newline at end of file\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
chore(refactor-Android12) - Update layouts for v31
116,612
07.12.2021 18:36:13
-19,080
4110b9b2d9ea8f780ddd53780cfdbedb547fce39
task(Android 12): Update manual carousel for Android 12
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java", "diff": "@@ -2716,7 +2716,13 @@ public class CleverTapAPI implements CTInboxActivity.InboxActivityListener {\npublic void renderPushNotification(@NonNull INotificationRenderer iNotificationRenderer, Context context,\nBundle extras) {\ncoreState.getPushProviders().setPushNotificationRenderer(iNotificationRenderer);\n+\n+ /*if (extras!=null && extras.containsKey(Constants.PT_NOTIF_ID))\n+ {\n+ coreState.getPushProviders()._createNotification(context, extras, extras.getInt(Constants.PT_NOTIF_ID));\n+ } else {*/\ncoreState.getPushProviders()._createNotification(context, extras, Constants.EMPTY_NOTIFICATION_ID);\n+ //}\n}\n/* public @NonNull INotificationRenderer getPushNotificationRenderer(){\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/Constants.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/Constants.java", "diff": "@@ -190,6 +190,7 @@ public interface Constants {\nString KEY_ALLOWED_PUSH_TYPES = \"allowedPushTypes\";\nString KEY_IDENTITY_TYPES = \"identityTypes\";\nString WZRK_PUSH_ID = \"wzrk_pid\";\n+ //String EXTRAS_FROM = \"extras_from\";\nString NOTIF_MSG = \"nm\";\nString NOTIF_TITLE = \"nt\";\nString NOTIF_ICON = \"ico\";\n@@ -287,6 +288,6 @@ public interface Constants {\nint MAX_DELAY_FREQUENCY = 1000 * 60 * 10;\nString[] NULL_STRING_ARRAY = new String[0];\n-\n+ //public static final String PT_NOTIF_ID = \"notificationId\";\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "diff": "@@ -153,6 +153,8 @@ public class PushProviders implements CTPushProviderListener {\n@Override\npublic Void call() {\ntry {\n+ /*String extrasFrom = extras.getString(Constants.EXTRAS_FROM);\n+ if (extrasFrom==null || !extrasFrom.equals(\"PTReceiver\")) {*/\nconfig.getLogger()\n.debug(config.getAccountId(), \"Handling notification: \" + extras.toString());\nif (extras.getString(Constants.WZRK_PUSH_ID) != null) {\n@@ -164,7 +166,8 @@ public class PushProviders implements CTPushProviderListener {\n}\n}// Common\nString notifMessage = iNotificationRenderer\n- .getMessage(extras);//extras.getString(Constants.NOTIF_MSG);// uncommon - getMessage()\n+ .getMessage(\n+ extras);//extras.getString(Constants.NOTIF_MSG);// uncommon - getMessage()\nnotifMessage = (notifMessage != null) ? notifMessage : \"\";// common\nif (notifMessage.isEmpty()) {\n//silent notification\n@@ -181,7 +184,9 @@ public class PushProviders implements CTPushProviderListener {\n}// Common\nString notifTitle = iNotificationRenderer.getTitle(extras,\ncontext);//extras.getString(Constants.NOTIF_TITLE, \"\");// uncommon - getTitle()\n- notifTitle = notifTitle.isEmpty() ? context.getApplicationInfo().name : notifTitle;//common\n+ notifTitle = notifTitle.isEmpty() ? context.getApplicationInfo().name\n+ : notifTitle;//common\n+ //}\ntriggerNotification(context, extras, notificationId);\n} catch (Throwable t) {\n// Occurs if the notification image was null\n@@ -1086,6 +1091,8 @@ public class PushProviders implements CTPushProviderListener {\nnotificationManager.notify(notificationId, n);\nconfig.getLogger().debug(config.getAccountId(), \"Rendered notification: \" + n.toString());//cb\n+ //String extrasFrom = extras.getString(Constants.EXTRAS_FROM);\n+ //if (extrasFrom==null || !extrasFrom.equals(\"PTReceiver\")) {\nString ttl = extras.getString(Constants.WZRK_TIME_TO_LIVE,\n(System.currentTimeMillis() + Constants.DEFAULT_PUSH_TTL) / 1000 + \"\");\nlong wzrk_ttl = Long.parseLong(ttl);\n@@ -1103,5 +1110,6 @@ public class PushProviders implements CTPushProviderListener {\nreturn;\n}\nanalyticsManager.pushNotificationViewedEvent(extras);\n+ //}\n}\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -19,17 +19,25 @@ import android.view.View;\nimport android.widget.RemoteViews;\nimport androidx.core.app.NotificationCompat;\n+import androidx.core.app.NotificationCompat.Builder;\nimport androidx.core.app.RemoteInput;\n+import com.clevertap.android.pushtemplates.content.PendingIntentFactory;\n+import com.clevertap.android.sdk.CleverTapAPI;\nimport com.clevertap.android.sdk.CleverTapInstanceConfig;\nimport com.clevertap.android.sdk.Constants;\n+import com.clevertap.android.sdk.interfaces.NotificationHandler;\nimport com.clevertap.android.sdk.pushnotification.CTNotificationIntentService;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Random;\nimport static android.content.Context.NOTIFICATION_SERVICE;\n+import static com.clevertap.android.pushtemplates.content.PendingIntentFactoryKt.MANUAL_CAROUSEL_CONTENT_PENDING_INTENT;\n+import static com.clevertap.android.pushtemplates.content.PendingIntentFactoryKt.MANUAL_CAROUSEL_DISMISS_PENDING_INTENT;\n+import static com.clevertap.android.pushtemplates.content.PendingIntentFactoryKt.MANUAL_CAROUSEL_LEFT_ARROW_PENDING_INTENT;\n+import static com.clevertap.android.pushtemplates.content.PendingIntentFactoryKt.MANUAL_CAROUSEL_RIGHT_ARROW_PENDING_INTENT;\nimport static com.clevertap.android.sdk.pushnotification.CTNotificationIntentService.TYPE_BUTTON_CLICK;\npublic class PushTemplateReceiver extends BroadcastReceiver {\n@@ -165,10 +173,30 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nprivate void handleManualCarouselNotification(Context context, Bundle extras) {\ntry {\n- contentViewManualCarousel = new RemoteViews(context.getPackageName(), R.layout.manual_carousel);\n- setCustomContentViewBasicKeys(contentViewManualCarousel, context);\n+ /*extras.putString(Constants.EXTRAS_FROM,\"PTReceiver\");\n+ NotificationHandler notificationHandler = CleverTapAPI.getNotificationHandler();\n+ if (notificationHandler!=null)\n+ {\n+ notificationHandler.onMessageReceived(context,extras,\"FCM\");\n+ }*/\nint notificationId = extras.getInt(PTConstants.PT_NOTIF_ID);\n+ Notification notification = null;\n+ if (VERSION.SDK_INT >= VERSION_CODES.S) {\n+ /**\n+ * Android 12 requires to recreate remote views to update notification\n+ * but recreating remote views creates performance issue and notification lag,\n+ * hence using below method to get remote views from existing notification\n+ */\n+ notification = Utils.getNotificationById(context, notificationId);\n+ if (notification!=null) {\n+ contentViewManualCarousel = notification.bigContentView;\n+ contentViewSmall = notification.contentView;\n+ }\n+ } else {\n+ contentViewManualCarousel = new RemoteViews(context.getPackageName(), R.layout.manual_carousel);\n+ }\n+ setCustomContentViewBasicKeys(contentViewManualCarousel, context);\nfinal boolean rightSwipe = extras.getBoolean(PTConstants.PT_RIGHT_SWIPE);\n@@ -211,37 +239,49 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nextras.putInt(PTConstants.PT_MANUAL_CAROUSEL_CURRENT, newPosition);\nextras.remove(PTConstants.PT_RIGHT_SWIPE);\nextras.putString(Constants.DEEP_LINK_KEY,dl);\n+ extras.putInt(PTConstants.PT_MANUAL_CAROUSEL_FROM, currPosition);\n- Intent rightArrowPos0Intent = new Intent(context, PushTemplateReceiver.class);\n- rightArrowPos0Intent.putExtra(PTConstants.PT_RIGHT_SWIPE, true);\n- rightArrowPos0Intent.putExtra(PTConstants.PT_MANUAL_CAROUSEL_FROM, currPosition);\n- rightArrowPos0Intent.putExtra(PTConstants.PT_NOTIF_ID, notificationId);\n- rightArrowPos0Intent.putExtras(extras);\n- PendingIntent contentRightPos0Intent = setPendingIntent(context, notificationId, extras, rightArrowPos0Intent, dl);\n- contentViewManualCarousel.setOnClickPendingIntent(R.id.rightArrowPos0, contentRightPos0Intent);\n+ contentViewManualCarousel.setOnClickPendingIntent(R.id.rightArrowPos0, PendingIntentFactory\n+ .getPendingIntent(context,notificationId, extras,false,\n+ MANUAL_CAROUSEL_RIGHT_ARROW_PENDING_INTENT,null));\n- Intent leftArrowPos0Intent = new Intent(context, PushTemplateReceiver.class);\n- leftArrowPos0Intent.putExtra(PTConstants.PT_RIGHT_SWIPE, false);\n- leftArrowPos0Intent.putExtra(PTConstants.PT_MANUAL_CAROUSEL_FROM, currPosition);\n- leftArrowPos0Intent.putExtra(PTConstants.PT_NOTIF_ID, notificationId);\n- leftArrowPos0Intent.putExtras(extras);\n- PendingIntent contentLeftPos0Intent = setPendingIntent(context, notificationId, extras, leftArrowPos0Intent, dl);\n- contentViewManualCarousel.setOnClickPendingIntent(R.id.leftArrowPos0, contentLeftPos0Intent);\n+ contentViewManualCarousel.setOnClickPendingIntent(R.id.leftArrowPos0, PendingIntentFactory\n+ .getPendingIntent(context,notificationId, extras,false,\n+ MANUAL_CAROUSEL_LEFT_ARROW_PENDING_INTENT,null));\n- Intent launchIntent = new Intent(context, PTPushNotificationReceiver.class);\n- PendingIntent pIntent = setPendingIntent(context, notificationId, extras, launchIntent, dl);\n+ PendingIntent pIntent = PendingIntentFactory.getPendingIntent(context,notificationId,extras,true,\n+ MANUAL_CAROUSEL_CONTENT_PENDING_INTENT,null\n+ );//setPendingIntent(context, notificationId, extras, launchIntent, dl);\n- NotificationCompat.Builder notificationBuilder = setBuilderWithChannelIDCheck(requiresChannelId, PTConstants.PT_SILENT_CHANNEL_ID, context);\n- Intent dismissIntent = new Intent(context, PushTemplateReceiver.class);\n+ NotificationCompat.Builder notificationBuilder;\n+ if (VERSION.SDK_INT >= VERSION_CODES.S) {\n+ if (notification!=null)\n+ {\n+ notificationBuilder = new Builder(context, notification);\n+ } else {\n+ notificationBuilder = setBuilderWithChannelIDCheck(requiresChannelId, PTConstants.PT_SILENT_CHANNEL_ID, context);\n+ }\n+ } else {\n+ notificationBuilder = setBuilderWithChannelIDCheck(requiresChannelId, PTConstants.PT_SILENT_CHANNEL_ID, context);\n+ }\n+\n+ //NotificationCompat.Builder notificationBuilder = setBuilderWithChannelIDCheck(requiresChannelId, PTConstants.PT_SILENT_CHANNEL_ID, context);\n+ /*Intent dismissIntent = new Intent(context, PushTemplateReceiver.class);\nPendingIntent dIntent;\n- dIntent = setDismissIntent(context, extras, dismissIntent);\n+ dIntent = setDismissIntent(context, extras, dismissIntent);*/\n+\n+ PendingIntent dIntent = PendingIntentFactory.getPendingIntent(context,notificationId,extras,false,\n+ MANUAL_CAROUSEL_DISMISS_PENDING_INTENT,null);\nsetSmallIcon(context);\n- setNotificationBuilderBasics(notificationBuilder, contentViewSmall, contentViewManualCarousel, pt_title, pIntent, dIntent);\n+ //if (VERSION.SDK_INT < VERSION_CODES.S) {\n+ setNotificationBuilderBasics(notificationBuilder, contentViewSmall, contentViewManualCarousel,\n+ pt_title, pIntent, dIntent);\n- Notification notification = notificationBuilder.build();\n+ notification = notificationBuilder.build();\n+ //}\nnotificationManager.notify(notificationId, notification);\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/Utils.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/Utils.java", "diff": "package com.clevertap.android.pushtemplates;\nimport android.annotation.SuppressLint;\n+import android.app.Notification;\nimport android.app.NotificationChannel;\nimport android.app.NotificationManager;\nimport android.content.ContentResolver;\n@@ -525,6 +526,18 @@ public class Utils {\nreturn false;\n}\n+ @RequiresApi(api = Build.VERSION_CODES.M)\n+ public static Notification getNotificationById(Context context, int notificationId) {\n+ NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);\n+ StatusBarNotification[] notifications = mNotificationManager.getActiveNotifications();\n+ for (StatusBarNotification notification : notifications) {\n+ if (notification.getId() == notificationId) {\n+ return notification.getNotification();\n+ }\n+ }\n+ return null;\n+ }\n+\npublic static ArrayList<Integer> getNotificationIds(Context context) {\nArrayList<Integer> ids = new ArrayList<Integer>();\nif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/ManualCarouselContentView.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/ManualCarouselContentView.kt", "diff": "@@ -7,6 +7,9 @@ import android.text.Html\nimport android.view.View\nimport android.widget.RemoteViews\nimport com.clevertap.android.pushtemplates.*\n+import com.clevertap.android.pushtemplates.R.id\n+import com.clevertap.android.pushtemplates.content.PendingIntentFactory.getPendingIntent\n+import com.clevertap.android.sdk.Constants\nimport java.util.ArrayList\nclass ManualCarouselContentView(context: Context, renderer: TemplateRenderer,extras: Bundle):\n@@ -56,6 +59,80 @@ class ManualCarouselContentView(context: Context, renderer: TemplateRenderer,ext\nremoteView.setViewVisibility(R.id.carousel_image_right, View.GONE)\nremoteView.setViewVisibility(R.id.carousel_image_left, View.GONE)\n}\n+\n+ /*if(extras.containsKey(PTConstants.PT_RIGHT_SWIPE)){\n+\n+ val rightSwipe = extras.getBoolean(PTConstants.PT_RIGHT_SWIPE)\n+ val currPosition = extras.getInt(PTConstants.PT_MANUAL_CAROUSEL_CURRENT)\n+ val nextPosition: Int\n+ val prevPosition: Int\n+ val newPosition: Int\n+\n+ if (currPosition == tempImageList.size - 1) {\n+ nextPosition = 0\n+ } else {\n+ nextPosition = currPosition + 1\n+ }\n+ if (currPosition == 0) {\n+ prevPosition = tempImageList.size - 1\n+ } else {\n+ prevPosition = currPosition - 1\n+ }\n+ remoteView.setDisplayedChild(R.id.carousel_image, currPosition)\n+ remoteView.setDisplayedChild(R.id.carousel_image_right, nextPosition)\n+ remoteView.setDisplayedChild(\n+ R.id.carousel_image_left,\n+ prevPosition\n+ )\n+\n+ if (rightSwipe) {\n+ newPosition = nextPosition\n+ remoteView.showNext(id.carousel_image)\n+ remoteView.showNext(id.carousel_image_right)\n+ remoteView.showNext(id.carousel_image_left)\n+ } else {\n+ newPosition = prevPosition\n+ remoteView.showPrevious(id.carousel_image)\n+ remoteView.showPrevious(id.carousel_image_right)\n+ remoteView.showPrevious(id.carousel_image_left)\n+\n+ }\n+ var dl = \"\"\n+ val deepLinkList = renderer.deepLinkList\n+ if (deepLinkList != null && deepLinkList.size == tempImageList.size) {\n+ dl = deepLinkList.get(newPosition)\n+ } else if (deepLinkList != null && deepLinkList.size == 1) {\n+ dl = deepLinkList.get(0)\n+ } else if (deepLinkList != null && deepLinkList.size > newPosition) {\n+ dl = deepLinkList.get(newPosition)\n+ } else if (deepLinkList != null && deepLinkList.size < newPosition) {\n+ dl = deepLinkList.get(0)\n+ }\n+\n+ extras.putInt(PTConstants.PT_MANUAL_CAROUSEL_CURRENT, newPosition)\n+ extras.remove(PTConstants.PT_RIGHT_SWIPE)\n+ extras.putString(Constants.DEEP_LINK_KEY, dl)\n+ extras.putInt(PTConstants.PT_MANUAL_CAROUSEL_FROM, currPosition)\n+\n+ remoteView.setOnClickPendingIntent(\n+ id.rightArrowPos0, getPendingIntent(\n+ context, renderer.notificationId, extras, false,\n+ MANUAL_CAROUSEL_RIGHT_ARROW_PENDING_INTENT, null\n+ )\n+ )\n+\n+ remoteView.setOnClickPendingIntent(\n+ id.leftArrowPos0, getPendingIntent(\n+ context, renderer.notificationId, extras, false,\n+ MANUAL_CAROUSEL_LEFT_ARROW_PENDING_INTENT, null\n+ )\n+ )\n+\n+ *//*val pIntent = getPendingIntent(\n+ context, notificationId, extras, true,\n+ MANUAL_CAROUSEL_CONTENT_PENDING_INTENT, null\n+ )*//*\n+ } else {*/\nremoteView.setDisplayedChild(R.id.carousel_image_right, 1)\nremoteView.setDisplayedChild(\nR.id.carousel_image_left,\n@@ -66,6 +143,8 @@ class ManualCarouselContentView(context: Context, renderer: TemplateRenderer,ext\nextras.putStringArrayList(PTConstants.PT_IMAGE_LIST, tempImageList)\nextras.putStringArrayList(PTConstants.PT_DEEPLINK_LIST, renderer.deepLinkList)\n+ extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])\n+ extras.putInt(PTConstants.PT_MANUAL_CAROUSEL_FROM, 0)\nremoteView.setOnClickPendingIntent(\nR.id.rightArrowPos0,\nPendingIntentFactory.getPendingIntent(context,renderer.notificationId, extras,false,\n@@ -82,6 +161,8 @@ class ManualCarouselContentView(context: Context, renderer: TemplateRenderer,ext\nif (imageCounter < 2) {\nPTLog.debug(\"Need at least 2 images to display Manual Carousel, found - $imageCounter, not displaying the notification.\")\n}\n+ //}\n+\n}\nprivate fun setCustomContentViewMessageSummary(pt_msg_summary: String?) {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "diff": "@@ -12,7 +12,7 @@ import com.clevertap.android.pushtemplates.PTPushNotificationReceiver\nimport com.clevertap.android.pushtemplates.PushTemplateReceiver\nimport com.clevertap.android.pushtemplates.TemplateRenderer\nimport com.clevertap.android.sdk.Constants\n-import java.util.*\n+import java.util.Random\nconst val BASIC_CONTENT_PENDING_INTENT = 1\nconst val AUTO_CAROUSEL_CONTENT_PENDING_INTENT = 2\n@@ -74,7 +74,6 @@ internal object PendingIntentFactory {\ncontext, System.currentTimeMillis().toInt(),\nlaunchIntent, flagsLaunchPendingIntent\n)\n-\n}\n@JvmStatic\n@@ -95,7 +94,7 @@ internal object PendingIntentFactory {\n@JvmStatic\nfun getPendingIntent(\ncontext: Context, notificationId: Int, extras: Bundle,\n- isLauncher: Boolean, identifier: Int, renderer: TemplateRenderer\n+ isLauncher: Boolean, identifier: Int, renderer: TemplateRenderer?\n): PendingIntent? {\nif (isLauncher) {\n@@ -113,7 +112,7 @@ internal object PendingIntentFactory {\nBASIC_CONTENT_PENDING_INTENT, AUTO_CAROUSEL_CONTENT_PENDING_INTENT,\nMANUAL_CAROUSEL_CONTENT_PENDING_INTENT, ZERO_BEZEL_CONTENT_PENDING_INTENT,\nTIMER_CONTENT_PENDING_INTENT, PRODUCT_DISPLAY_CONTENT_PENDING_INTENT -> {\n- return if (renderer.deepLinkList != null && renderer.deepLinkList!!.size > 0) {\n+ return if (renderer?.deepLinkList != null && renderer.deepLinkList!!.size > 0) {\nextras.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList!![0])\nsetPendingIntent(\ncontext,\n@@ -122,16 +121,18 @@ internal object PendingIntentFactory {\nlaunchIntent\n)\n} else {\n+ if (extras[Constants.DEEP_LINK_KEY] == null) {\nextras.putString(Constants.DEEP_LINK_KEY, null)\n+ }\nsetPendingIntent(context, notificationId, extras, launchIntent)\n}\n}\nMANUAL_CAROUSEL_RIGHT_ARROW_PENDING_INTENT -> {\n- extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])\n- launchIntent.putExtra(PTConstants.PT_RIGHT_SWIPE, true)\n- launchIntent.putExtra(PTConstants.PT_MANUAL_CAROUSEL_FROM, 0)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ //extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])// variable\n+ launchIntent.putExtra(PTConstants.PT_RIGHT_SWIPE, true)// fix\n+ //launchIntent.putExtra(PTConstants.PT_MANUAL_CAROUSEL_FROM, 0)// variable\n+ launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)// fix\nlaunchIntent.putExtras(extras)\nreturn setPendingIntent(\n@@ -143,10 +144,10 @@ internal object PendingIntentFactory {\n}\nMANUAL_CAROUSEL_LEFT_ARROW_PENDING_INTENT -> {\n- extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])\n- launchIntent.putExtra(PTConstants.PT_RIGHT_SWIPE, false)\n- launchIntent.putExtra(PTConstants.PT_MANUAL_CAROUSEL_FROM, 0)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ //extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])// variable\n+ launchIntent.putExtra(PTConstants.PT_RIGHT_SWIPE, false)// fix\n+ //launchIntent.putExtra(PTConstants.PT_MANUAL_CAROUSEL_FROM, 0)// variable\n+ launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)// fix\nlaunchIntent.putExtras(extras)\nreturn setPendingIntent(\n@@ -160,8 +161,10 @@ internal object PendingIntentFactory {\n}\nRATING_CONTENT_PENDING_INTENT -> {\n- extras.putString(Constants.DEEP_LINK_KEY,\n- renderer.pt_rating_default_dl)\n+ extras.putString(\n+ Constants.DEEP_LINK_KEY,\n+ renderer?.pt_rating_default_dl\n+ )\nreturn setPendingIntent(\ncontext,\nnotificationId,\n@@ -173,7 +176,7 @@ internal object PendingIntentFactory {\nRATING_CLICK1_PENDING_INTENT -> {\nlaunchIntent.putExtra(\"click1\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(\"config\", renderer.config)\n+ launchIntent.putExtra(\"config\", renderer?.config)\nlaunchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\n@@ -181,7 +184,7 @@ internal object PendingIntentFactory {\nRATING_CLICK2_PENDING_INTENT -> {\nlaunchIntent.putExtra(\"click2\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(\"config\", renderer.config)\n+ launchIntent.putExtra(\"config\", renderer?.config)\nlaunchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\n@@ -189,7 +192,7 @@ internal object PendingIntentFactory {\nRATING_CLICK3_PENDING_INTENT -> {\nlaunchIntent.putExtra(\"click3\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(\"config\", renderer.config)\n+ launchIntent.putExtra(\"config\", renderer?.config)\nlaunchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\n@@ -197,7 +200,7 @@ internal object PendingIntentFactory {\nRATING_CLICK4_PENDING_INTENT -> {\nlaunchIntent.putExtra(\"click4\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(\"config\", renderer.config)\n+ launchIntent.putExtra(\"config\", renderer?.config)\nlaunchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\n@@ -205,12 +208,11 @@ internal object PendingIntentFactory {\nRATING_CLICK5_PENDING_INTENT -> {\nlaunchIntent.putExtra(\"click5\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(\"config\", renderer.config)\n+ launchIntent.putExtra(\"config\", renderer?.config)\nlaunchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\n-\nFIVE_ICON_CTA1_PENDING_INTENT -> { // TODO : OK to handle same as LaunchPendingIntentFactory\nval reqCode = Random().nextInt()\nlaunchIntent.putExtra(\"cta1\", true)\n@@ -268,7 +270,7 @@ internal object PendingIntentFactory {\nval requestCode = Random().nextInt()\nlaunchIntent.putExtra(PTConstants.PT_CURRENT_POSITION, 0)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer.deepLinkList!![0])\n+ launchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![0])\nlaunchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n}\n@@ -277,7 +279,7 @@ internal object PendingIntentFactory {\nval requestCode = Random().nextInt()\nlaunchIntent.putExtra(PTConstants.PT_CURRENT_POSITION, 1)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer.deepLinkList!![1])\n+ launchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![1])\nlaunchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n}\n@@ -286,14 +288,16 @@ internal object PendingIntentFactory {\nval requestCode = Random().nextInt()\nlaunchIntent.putExtra(PTConstants.PT_CURRENT_POSITION, 2)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer.deepLinkList!![2])\n+ launchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![2])\nlaunchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_CONTENT_SMALL1_PENDING_INTENT -> {\n- extras.putString(Constants.DEEP_LINK_KEY,\n- renderer.deepLinkList!![0])\n+ extras.putString(\n+ Constants.DEEP_LINK_KEY,\n+ renderer?.deepLinkList!![0]\n+ )\nreturn setPendingIntent(\ncontext,\nnotificationId,\n@@ -303,8 +307,10 @@ internal object PendingIntentFactory {\n}\nPRODUCT_DISPLAY_CONTENT_SMALL2_PENDING_INTENT -> {\n- extras.putString(Constants.DEEP_LINK_KEY,\n- renderer.deepLinkList!![1])\n+ extras.putString(\n+ Constants.DEEP_LINK_KEY,\n+ renderer?.deepLinkList!![1]\n+ )\nreturn setPendingIntent(\ncontext,\nnotificationId,\n@@ -314,8 +320,10 @@ internal object PendingIntentFactory {\n}\nPRODUCT_DISPLAY_CONTENT_SMALL3_PENDING_INTENT -> {\n- extras.putString(Constants.DEEP_LINK_KEY,\n- renderer.deepLinkList!![2])\n+ extras.putString(\n+ Constants.DEEP_LINK_KEY,\n+ renderer?.deepLinkList!![2]\n+ )\nreturn setPendingIntent(\ncontext,\nnotificationId,\n@@ -332,16 +340,16 @@ internal object PendingIntentFactory {\nPRODUCT_DISPLAY_BUY_NOW_PENDING_INTENT -> {\nlaunchIntent.putExtra(PTConstants.PT_IMAGE_1, true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer.deepLinkList!![0])\n+ launchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![0])\nlaunchIntent.putExtra(PTConstants.PT_BUY_NOW, true)\n- launchIntent.putExtra(\"config\", renderer.config)\n+ launchIntent.putExtra(\"config\", renderer?.config)\nlaunchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nINPUT_BOX_CONTENT_PENDING_INTENT -> {\n- extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])\n- return if (renderer.deepLinkList != null && renderer.deepLinkList!!.size > 0) {\n+ extras.putString(Constants.DEEP_LINK_KEY, renderer?.deepLinkList!![0])\n+ return if (renderer.deepLinkList != null && renderer?.deepLinkList!!.size > 0) {\nsetPendingIntent(\ncontext,\nnotificationId,\n@@ -355,12 +363,12 @@ internal object PendingIntentFactory {\n}\nINPUT_BOX_REPLY_PENDING_INTENT -> {\n- extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])\n- launchIntent.putExtra(PTConstants.PT_INPUT_FEEDBACK, renderer.pt_input_feedback)\n- launchIntent.putExtra(PTConstants.PT_INPUT_AUTO_OPEN, renderer.pt_input_auto_open)\n- launchIntent.putExtra(\"config\", renderer.config)\n+ extras.putString(Constants.DEEP_LINK_KEY, renderer?.deepLinkList!![0])\n+ launchIntent.putExtra(PTConstants.PT_INPUT_FEEDBACK, renderer?.pt_input_feedback)\n+ launchIntent.putExtra(PTConstants.PT_INPUT_AUTO_OPEN, renderer?.pt_input_auto_open)\n+ launchIntent.putExtra(\"config\", renderer?.config)\n- return if (renderer.deepLinkList != null) {\n+ return if (renderer?.deepLinkList != null) {\nsetPendingIntent(\ncontext,\nnotificationId,\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/ManualCarouselStyle.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/ManualCarouselStyle.kt", "diff": "@@ -7,6 +7,7 @@ import android.widget.RemoteViews\nimport com.clevertap.android.pushtemplates.TemplateRenderer\nimport com.clevertap.android.pushtemplates.content.*\nimport com.clevertap.android.pushtemplates.content.PendingIntentFactory\n+import com.clevertap.android.sdk.Constants\nclass ManualCarouselStyle(private var renderer: TemplateRenderer,private var extras: Bundle): Style(renderer) {\n@@ -23,9 +24,16 @@ class ManualCarouselStyle(private var renderer: TemplateRenderer,private var ext\nextras: Bundle,\nnotificationId: Int\n): PendingIntent? {\n+ /*val extrasFrom = extras.getString(Constants.EXTRAS_FROM)\n+ if (extrasFrom == null || extrasFrom != \"PTReceiver\") {*/\nreturn PendingIntentFactory.getPendingIntent(context,notificationId,extras,true,\nMANUAL_CAROUSEL_CONTENT_PENDING_INTENT,renderer\n)\n+ /*}else{\n+ return PendingIntentFactory.getPendingIntent(context,notificationId,extras,true,\n+ MANUAL_CAROUSEL_CONTENT_PENDING_INTENT,null\n+ )\n+ }*/\n}\noverride fun makeDismissIntent(\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/Style.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/Style.kt", "diff": "@@ -35,6 +35,7 @@ abstract class Style(private var renderer: TemplateRenderer) {\n.setWhen(System.currentTimeMillis())\n.setColor(Color.parseColor(renderer.pt_small_icon_clr?:\"#FFFFFF\"))\n.setAutoCancel(true)\n+ .setOnlyAlertOnce(true)\n}\nprotected abstract fun makeSmallContentView(context: Context,renderer: TemplateRenderer): RemoteViews?\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Update manual carousel for Android 12 SDK-1056
116,612
08.12.2021 13:56:53
-19,080
1cfe7d4c701c827b8d41e33d89a1b91bf4d6ade6
task(Android 12): Update Five ICONS for Android 12
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/Constants.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/Constants.java", "diff": "@@ -289,5 +289,6 @@ public interface Constants {\nString[] NULL_STRING_ARRAY = new String[0];\n//public static final String PT_NOTIF_ID = \"notificationId\";\n+ public static final String CLOSE_SYSTEM_DIALOGS = \"close_system_dialogs\";\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CTPushNotificationReceiver.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CTPushNotificationReceiver.java", "diff": "@@ -4,6 +4,8 @@ import android.content.BroadcastReceiver;\nimport android.content.Context;\nimport android.content.Intent;\nimport android.net.Uri;\n+import android.os.Build.VERSION;\n+import android.os.Build.VERSION_CODES;\nimport android.os.Bundle;\nimport com.clevertap.android.sdk.CleverTapAPI;\nimport com.clevertap.android.sdk.Constants;\n@@ -59,6 +61,15 @@ public class CTPushNotificationReceiver extends BroadcastReceiver {\n//to prevent calling of pushNotificationClickedEvent(extras) in ActivityLifecycleCallback\nlaunchIntent.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM);\n+ if (/*VERSION.SDK_INT < VERSION_CODES.S && */extras.containsKey(Constants.CLOSE_SYSTEM_DIALOGS)) {\n+ boolean closeNotificationDrawer = extras.getBoolean(Constants.CLOSE_SYSTEM_DIALOGS);\n+ if (closeNotificationDrawer)\n+ {\n+ context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));\n+ }\n+\n+ }\n+\ncontext.startActivity(launchIntent);\nLogger.d(\"CTPushNotificationReceiver: handled notification: \" + extras.toString());\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/LaunchPendingIntentFactory.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/LaunchPendingIntentFactory.java", "diff": "@@ -8,12 +8,14 @@ import android.os.Build.VERSION;\nimport android.os.Build.VERSION_CODES;\nimport android.os.Bundle;\nimport androidx.annotation.NonNull;\n+import androidx.annotation.RestrictTo;\nimport com.clevertap.android.sdk.Constants;\nimport com.clevertap.android.sdk.Utils;\n-class LaunchPendingIntentFactory {\n+@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)\n+public class LaunchPendingIntentFactory {\n- static PendingIntent getLaunchPendingIntent(@NonNull Bundle extras, @NonNull Context context) {\n+ public static PendingIntent getLaunchPendingIntent(@NonNull Bundle extras, @NonNull Context context) {\nIntent launchIntent;\nPendingIntent pIntent;\nif (VERSION.SDK_INT >= VERSION_CODES.S) {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -671,50 +671,15 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nprivate void handleFiveCTANotification(Context context, Bundle extras) {\nString dl = null;\n-\n-\nint notificationId = extras.getInt(PTConstants.PT_NOTIF_ID);\n- if (cta1 == extras.getBoolean(\"cta1\")) {\n- dl = deepLinkList.get(0);\n- extras.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 1 + \"_\" + dl);\n- }\n- if (cta2 == extras.getBoolean(\"cta2\")) {\n- dl = deepLinkList.get(1);\n- extras.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 2 + \"_\" + dl);\n- }\n- if (cta3 == extras.getBoolean(\"cta3\")) {\n- dl = deepLinkList.get(2);\n- extras.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 3 + \"_\" + dl);\n- }\n- if (cta4 == extras.getBoolean(\"cta4\")) {\n- dl = deepLinkList.get(3);\n- extras.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 4 + \"_\" + dl);\n- }\n- if (cta5 == extras.getBoolean(\"cta5\")) {\n- dl = deepLinkList.get(4);\n- extras.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 5 + \"_\" + dl);\n- }\nextras.putString(Constants.DEEP_LINK_KEY, dl);\nif (close == extras.getBoolean(\"close\")) {\nextras.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + \"close\");\nnotificationManager.cancel(notificationId);\n- context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));\n+ //context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));\n}\n-\nUtils.raiseNotificationClicked(context, extras, config);\n-\n-\n- if (dl != null) {\n- Intent launchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(dl));\n- launchIntent.putExtras(extras);\n- launchIntent.putExtra(Constants.DEEP_LINK_KEY, dl);\n- launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n- launchIntent.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM);\n- launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);\n- context.startActivity(launchIntent);\n- context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));\n- }\n}\nprivate PendingIntent setPendingIntent(Context context, int notificationId, Bundle extras, Intent launchIntent, String dl) {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/FiveIconContentView.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/FiveIconContentView.kt", "diff": "@@ -3,10 +3,13 @@ package com.clevertap.android.pushtemplates.content\nimport android.content.Context\nimport android.os.Bundle\nimport android.view.View\n+import com.clevertap.android.pushtemplates.PTConstants\nimport com.clevertap.android.pushtemplates.PTLog\nimport com.clevertap.android.pushtemplates.R\nimport com.clevertap.android.pushtemplates.TemplateRenderer\nimport com.clevertap.android.pushtemplates.Utils\n+import com.clevertap.android.sdk.Constants\n+import com.clevertap.android.sdk.pushnotification.LaunchPendingIntentFactory\nclass FiveIconContentView constructor(context: Context,\nrenderer: TemplateRenderer,\n@@ -75,19 +78,42 @@ class FiveIconContentView constructor(context: Context,\n}\nUtils.loadImageRidIntoRemoteView(R.id.close, R.drawable.pt_close, remoteView)\n- remoteView.setOnClickPendingIntent(R.id.cta1, PendingIntentFactory.getPendingIntent(context,\n- renderer.notificationId, extras,false, FIVE_ICON_CTA1_PENDING_INTENT,renderer))\n- remoteView.setOnClickPendingIntent(R.id.cta2, PendingIntentFactory.getPendingIntent(context,\n- renderer.notificationId, extras,false, FIVE_ICON_CTA2_PENDING_INTENT,renderer))\n+ extras.putInt(PTConstants.PT_NOTIF_ID, renderer.notificationId)\n+ extras.putBoolean(Constants.CLOSE_SYSTEM_DIALOGS,true)\n- remoteView.setOnClickPendingIntent(R.id.cta3, PendingIntentFactory.getPendingIntent(context,\n- renderer.notificationId, extras,false, FIVE_ICON_CTA3_PENDING_INTENT,renderer))\n+ val bundleCTA1 = extras.clone() as Bundle\n+ bundleCTA1.putBoolean(\"cta1\", true)\n+ bundleCTA1.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(0))\n+ bundleCTA1.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 1 + \"_\" + renderer.deepLinkList?.get(0))\n- remoteView.setOnClickPendingIntent(R.id.cta4, PendingIntentFactory.getPendingIntent(context,\n- renderer.notificationId, extras,false, FIVE_ICON_CTA4_PENDING_INTENT,renderer))\n+ val bundleCTA2 = extras.clone() as Bundle\n+ bundleCTA2.putBoolean(\"cta2\", true)\n+ bundleCTA2.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(1))\n+ bundleCTA2.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 2 + \"_\" + renderer.deepLinkList?.get(1))\n- remoteView.setOnClickPendingIntent(R.id.cta5, PendingIntentFactory.getPendingIntent(context,\n- renderer.notificationId, extras,false, FIVE_ICON_CTA5_PENDING_INTENT,renderer))\n+ val bundleCTA3 = extras.clone() as Bundle\n+ bundleCTA3.putBoolean(\"cta3\", true)\n+ bundleCTA3.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(2))\n+ bundleCTA3.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 3 + \"_\" + renderer.deepLinkList?.get(2))\n+\n+ val bundleCTA4 = extras.clone() as Bundle\n+ bundleCTA4.putBoolean(\"cta4\", true)\n+ bundleCTA4.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(3))\n+ bundleCTA4.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 4 + \"_\" + renderer.deepLinkList?.get(3))\n+\n+ val bundleCTA5 = extras.clone() as Bundle\n+ bundleCTA5.putBoolean(\"cta5\", true)\n+ bundleCTA5.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(4))\n+ bundleCTA5.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 5 + \"_\" + renderer.deepLinkList?.get(4))\n+\n+ remoteView.setOnClickPendingIntent(R.id.cta1, LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA1,context))\n+ remoteView.setOnClickPendingIntent(R.id.cta2, LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA2,context))\n+\n+ remoteView.setOnClickPendingIntent(R.id.cta3, LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA3,context))\n+\n+ remoteView.setOnClickPendingIntent(R.id.cta4, LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA4,context))\n+\n+ remoteView.setOnClickPendingIntent(R.id.cta5, LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA5,context))\nremoteView.setOnClickPendingIntent(R.id.close, PendingIntentFactory.getPendingIntent(context,\nrenderer.notificationId, extras,false, FIVE_ICON_CLOSE_PENDING_INTENT,renderer))\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "diff": "@@ -213,52 +213,12 @@ internal object PendingIntentFactory {\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\n- FIVE_ICON_CTA1_PENDING_INTENT -> { // TODO : OK to handle same as LaunchPendingIntentFactory\n- val reqCode = Random().nextInt()\n- launchIntent.putExtra(\"cta1\", true)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n- }\n-\n- FIVE_ICON_CTA2_PENDING_INTENT -> {// TODO : OK to handle same as LaunchPendingIntentFactory\n- val reqCode = Random().nextInt()\n- launchIntent.putExtra(\"cta2\", true)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n- }\n-\n- FIVE_ICON_CTA3_PENDING_INTENT -> {// TODO : OK to handle same as LaunchPendingIntentFactory\n- val reqCode = Random().nextInt()\n- launchIntent.putExtra(\"cta3\", true)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n- }\n-\n- FIVE_ICON_CTA4_PENDING_INTENT -> {// TODO : OK to handle same as LaunchPendingIntentFactory\n- val reqCode = Random().nextInt()\n- launchIntent.putExtra(\"cta4\", true)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n- }\n-\n- FIVE_ICON_CTA5_PENDING_INTENT -> {// TODO : OK to handle same as LaunchPendingIntentFactory\n- val reqCode = Random().nextInt()\n- launchIntent.putExtra(\"cta5\", true)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n- }\n-\nFIVE_ICON_CONTENT_PENDING_INTENT -> {\nextras.putString(Constants.DEEP_LINK_KEY, null)\nreturn setPendingIntent(context, notificationId, extras, launchIntent)\n}\n- FIVE_ICON_CLOSE_PENDING_INTENT -> {// TODO : pass to PushTemplateReceiver\n+ FIVE_ICON_CLOSE_PENDING_INTENT -> {\nval reqCode = Random().nextInt()\nlaunchIntent.putExtra(\"close\", true)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Update Five ICONS for Android 12 SDK-1056
116,616
08.12.2021 16:53:12
-19,080
e14bc7e9eecd315a90ea337450358dfecb2bb298
task(refactor-Android12) - Update ManualCarouselStyle.kt redraw bug fix for devices greater than API19
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java", "diff": "@@ -2717,12 +2717,12 @@ public class CleverTapAPI implements CTInboxActivity.InboxActivityListener {\nBundle extras) {\ncoreState.getPushProviders().setPushNotificationRenderer(iNotificationRenderer);\n- /*if (extras!=null && extras.containsKey(Constants.PT_NOTIF_ID))\n+ if (extras!=null && extras.containsKey(Constants.PT_NOTIF_ID))\n{\ncoreState.getPushProviders()._createNotification(context, extras, extras.getInt(Constants.PT_NOTIF_ID));\n- } else {*/\n+ } else {\ncoreState.getPushProviders()._createNotification(context, extras, Constants.EMPTY_NOTIFICATION_ID);\n- //}\n+ }\n}\n/* public @NonNull INotificationRenderer getPushNotificationRenderer(){\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/Constants.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/Constants.java", "diff": "@@ -190,7 +190,7 @@ public interface Constants {\nString KEY_ALLOWED_PUSH_TYPES = \"allowedPushTypes\";\nString KEY_IDENTITY_TYPES = \"identityTypes\";\nString WZRK_PUSH_ID = \"wzrk_pid\";\n- //String EXTRAS_FROM = \"extras_from\";\n+ String EXTRAS_FROM = \"extras_from\";\nString NOTIF_MSG = \"nm\";\nString NOTIF_TITLE = \"nt\";\nString NOTIF_ICON = \"ico\";\n@@ -288,7 +288,7 @@ public interface Constants {\nint MAX_DELAY_FREQUENCY = 1000 * 60 * 10;\nString[] NULL_STRING_ARRAY = new String[0];\n- //public static final String PT_NOTIF_ID = \"notificationId\";\n+ public static final String PT_NOTIF_ID = \"notificationId\";\npublic static final String CLOSE_SYSTEM_DIALOGS = \"close_system_dialogs\";\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "diff": "@@ -153,8 +153,8 @@ public class PushProviders implements CTPushProviderListener {\n@Override\npublic Void call() {\ntry {\n- /*String extrasFrom = extras.getString(Constants.EXTRAS_FROM);\n- if (extrasFrom==null || !extrasFrom.equals(\"PTReceiver\")) {*/\n+ String extrasFrom = extras.getString(Constants.EXTRAS_FROM);\n+ if (extrasFrom==null || !extrasFrom.equals(\"PTReceiver\")) {\nconfig.getLogger()\n.debug(config.getAccountId(), \"Handling notification: \" + extras.toString());\nif (extras.getString(Constants.WZRK_PUSH_ID) != null) {\n@@ -186,7 +186,7 @@ public class PushProviders implements CTPushProviderListener {\ncontext);//extras.getString(Constants.NOTIF_TITLE, \"\");// uncommon - getTitle()\nnotifTitle = notifTitle.isEmpty() ? context.getApplicationInfo().name\n: notifTitle;//common\n- //}\n+ }\ntriggerNotification(context, extras, notificationId);\n} catch (Throwable t) {\n// Occurs if the notification image was null\n@@ -1091,8 +1091,8 @@ public class PushProviders implements CTPushProviderListener {\nnotificationManager.notify(notificationId, n);\nconfig.getLogger().debug(config.getAccountId(), \"Rendered notification: \" + n.toString());//cb\n- //String extrasFrom = extras.getString(Constants.EXTRAS_FROM);\n- //if (extrasFrom==null || !extrasFrom.equals(\"PTReceiver\")) {\n+ String extrasFrom = extras.getString(Constants.EXTRAS_FROM);\n+ if (extrasFrom==null || !extrasFrom.equals(\"PTReceiver\")) {\nString ttl = extras.getString(Constants.WZRK_TIME_TO_LIVE,\n(System.currentTimeMillis() + Constants.DEFAULT_PUSH_TTL) / 1000 + \"\");\nlong wzrk_ttl = Long.parseLong(ttl);\n@@ -1110,6 +1110,6 @@ public class PushProviders implements CTPushProviderListener {\nreturn;\n}\nanalyticsManager.pushNotificationViewedEvent(extras);\n- //}\n+ }\n}\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -173,29 +173,18 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nprivate void handleManualCarouselNotification(Context context, Bundle extras) {\ntry {\n- /*extras.putString(Constants.EXTRAS_FROM,\"PTReceiver\");\n- NotificationHandler notificationHandler = CleverTapAPI.getNotificationHandler();\n- if (notificationHandler!=null)\n- {\n- notificationHandler.onMessageReceived(context,extras,\"FCM\");\n- }*/\n-\n- int notificationId = extras.getInt(PTConstants.PT_NOTIF_ID);\n- Notification notification = null;\n- if (VERSION.SDK_INT >= VERSION_CODES.S) {\n/**\n* Android 12 requires to recreate remote views to update notification\n* but recreating remote views creates performance issue and notification lag,\n* hence using below method to get remote views from existing notification\n*/\n- notification = Utils.getNotificationById(context, notificationId);\n+ if (VERSION.SDK_INT >= VERSION_CODES.M){\n+ int notificationId = extras.getInt(PTConstants.PT_NOTIF_ID);\n+ Notification notification = Utils.getNotificationById(context, notificationId);\nif (notification!=null) {\ncontentViewManualCarousel = notification.bigContentView;\ncontentViewSmall = notification.contentView;\n}\n- } else {\n- contentViewManualCarousel = new RemoteViews(context.getPackageName(), R.layout.manual_carousel);\n- }\nsetCustomContentViewBasicKeys(contentViewManualCarousel, context);\nfinal boolean rightSwipe = extras.getBoolean(PTConstants.PT_RIGHT_SWIPE);\n@@ -255,16 +244,12 @@ public class PushTemplateReceiver extends BroadcastReceiver {\n);//setPendingIntent(context, notificationId, extras, launchIntent, dl);\nNotificationCompat.Builder notificationBuilder;\n- if (VERSION.SDK_INT >= VERSION_CODES.S) {\nif (notification!=null)\n{\nnotificationBuilder = new Builder(context, notification);\n} else {\nnotificationBuilder = setBuilderWithChannelIDCheck(requiresChannelId, PTConstants.PT_SILENT_CHANNEL_ID, context);\n}\n- } else {\n- notificationBuilder = setBuilderWithChannelIDCheck(requiresChannelId, PTConstants.PT_SILENT_CHANNEL_ID, context);\n- }\n//NotificationCompat.Builder notificationBuilder = setBuilderWithChannelIDCheck(requiresChannelId, PTConstants.PT_SILENT_CHANNEL_ID, context);\n/*Intent dismissIntent = new Intent(context, PushTemplateReceiver.class);\n@@ -284,7 +269,14 @@ public class PushTemplateReceiver extends BroadcastReceiver {\n//}\nnotificationManager.notify(notificationId, notification);\n-\n+ }else{\n+ extras.putString(Constants.EXTRAS_FROM,\"PTReceiver\");\n+ NotificationHandler notificationHandler = CleverTapAPI.getNotificationHandler();\n+ if (notificationHandler!=null)\n+ {\n+ notificationHandler.onMessageReceived(context,extras,\"FCM\");\n+ }\n+ }\n} catch (Throwable t) {\nPTLog.verbose(\"Error creating manual carousel notification \", t);\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/ManualCarouselContentView.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/ManualCarouselContentView.kt", "diff": "@@ -60,8 +60,7 @@ class ManualCarouselContentView(context: Context, renderer: TemplateRenderer,ext\nremoteView.setViewVisibility(R.id.carousel_image_left, View.GONE)\n}\n- /*if(extras.containsKey(PTConstants.PT_RIGHT_SWIPE)){\n-\n+ if(extras.containsKey(PTConstants.PT_RIGHT_SWIPE)){\nval rightSwipe = extras.getBoolean(PTConstants.PT_RIGHT_SWIPE)\nval currPosition = extras.getInt(PTConstants.PT_MANUAL_CAROUSEL_CURRENT)\nval nextPosition: Int\n@@ -128,11 +127,11 @@ class ManualCarouselContentView(context: Context, renderer: TemplateRenderer,ext\n)\n)\n- *//*val pIntent = getPendingIntent(\n- context, notificationId, extras, true,\n- MANUAL_CAROUSEL_CONTENT_PENDING_INTENT, null\n- )*//*\n- } else {*/\n+// val pIntent = getPendingIntent(\n+// context, notificationId, extras, true,\n+// MANUAL_CAROUSEL_CONTENT_PENDING_INTENT, null\n+// )\n+ } else {\nremoteView.setDisplayedChild(R.id.carousel_image_right, 1)\nremoteView.setDisplayedChild(\nR.id.carousel_image_left,\n@@ -161,7 +160,7 @@ class ManualCarouselContentView(context: Context, renderer: TemplateRenderer,ext\nif (imageCounter < 2) {\nPTLog.debug(\"Need at least 2 images to display Manual Carousel, found - $imageCounter, not displaying the notification.\")\n}\n- //}\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/ManualCarouselStyle.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/ManualCarouselStyle.kt", "diff": "@@ -24,16 +24,16 @@ class ManualCarouselStyle(private var renderer: TemplateRenderer,private var ext\nextras: Bundle,\nnotificationId: Int\n): PendingIntent? {\n- /*val extrasFrom = extras.getString(Constants.EXTRAS_FROM)\n- if (extrasFrom == null || extrasFrom != \"PTReceiver\") {*/\n- return PendingIntentFactory.getPendingIntent(context,notificationId,extras,true,\n+ val extrasFrom = extras.getString(Constants.EXTRAS_FROM)\n+ return if (extrasFrom == null || extrasFrom != \"PTReceiver\") {\n+ PendingIntentFactory.getPendingIntent(context,notificationId,extras,true,\nMANUAL_CAROUSEL_CONTENT_PENDING_INTENT,renderer\n)\n- /*}else{\n- return PendingIntentFactory.getPendingIntent(context,notificationId,extras,true,\n+ }else{\n+ PendingIntentFactory.getPendingIntent(context,notificationId,extras,true,\nMANUAL_CAROUSEL_CONTENT_PENDING_INTENT,null\n)\n- }*/\n+ }\n}\noverride fun makeDismissIntent(\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/manual_carousel.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_big\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\">\n+\n+ <include\n+ android:id=\"@+id/rel_lyt\"\n+ layout=\"@layout/content_view_small_multi_line_msg\" />\n+\n+ <RelativeLayout\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_below=\"@id/rel_lyt\">\n+\n+ <LinearLayout\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:orientation=\"horizontal\">\n+\n+ <ViewFlipper\n+ android:id=\"@+id/carousel_image_left\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_marginTop=\"10dp\"\n+ android:layout_marginBottom=\"10dp\"\n+ android:layout_marginRight=\"3dp\"\n+ android:layout_weight=\"6\"\n+ android:inAnimation=\"@anim/fade_in\"\n+ android:outAnimation=\"@anim/fade_out\" />\n+\n+ <ViewFlipper\n+ android:id=\"@+id/carousel_image\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"3\"\n+ android:layout_marginLeft=\"-4dp\"\n+ android:layout_marginRight=\"-4dp\"\n+ android:inAnimation=\"@anim/fade_in\"\n+ android:outAnimation=\"@anim/fade_out\" />\n+\n+ <ViewFlipper\n+ android:id=\"@+id/carousel_image_right\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_marginTop=\"10dp\"\n+ android:layout_marginBottom=\"10dp\"\n+ android:layout_marginLeft=\"3dp\"\n+ android:layout_weight=\"6\"\n+ android:inAnimation=\"@anim/fade_in\"\n+ android:outAnimation=\"@anim/fade_out\" />\n+ </LinearLayout>\n+\n+ <ImageView\n+ android:id=\"@+id/leftArrowPos0\"\n+ style=\"@style/ManualCarouselArrowRev\"\n+ android:background=\"@drawable/btn_ripple_background\" />\n+\n+ <ImageView\n+ android:id=\"@+id/rightArrowPos0\"\n+ style=\"@style/ManualCarouselArrowFwd\"\n+ android:background=\"@drawable/btn_ripple_background\" />\n+ </RelativeLayout>\n+\n+\n+</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/manual_carousel.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/manual_carousel.xml", "diff": "layout=\"@layout/content_view_small_multi_line_msg\" />\n<RelativeLayout\n-\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"match_parent\"\nandroid:layout_below=\"@id/rel_lyt\">\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor-Android12) - Update ManualCarouselStyle.kt redraw bug fix for devices greater than API19
116,616
08.12.2021 18:08:12
-19,080
fcc618c1824326acfcd137f9be008138118ca321
task(refactor-Android12) - Update layouts fro FiveIcon and ProductDisplay(Non-Linear)
[ { "change_type": "RENAME", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/FiveIconContentView.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/FiveIconBigContentView.kt", "diff": "@@ -11,11 +11,9 @@ import com.clevertap.android.pushtemplates.Utils\nimport com.clevertap.android.sdk.Constants\nimport com.clevertap.android.sdk.pushnotification.LaunchPendingIntentFactory\n-class FiveIconContentView constructor(context: Context,\n+class FiveIconBigContentView constructor(context: Context,\nrenderer: TemplateRenderer,\n- extras: Bundle\n-):\n- ContentView(context, R.layout.five_cta, renderer) {\n+ extras: Bundle):ContentView(context, R.layout.five_cta_expanded, renderer) {\ninit {\nif (renderer.pt_title == null || renderer.pt_title!!.isEmpty()) {\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/FiveIconSmallContentView.kt", "diff": "+package com.clevertap.android.pushtemplates.content\n+\n+import android.content.Context\n+import android.os.Bundle\n+import android.view.View\n+import com.clevertap.android.pushtemplates.*\n+import com.clevertap.android.sdk.Constants\n+import com.clevertap.android.sdk.pushnotification.LaunchPendingIntentFactory\n+\n+class FiveIconSmallContentView constructor(context: Context,\n+ renderer: TemplateRenderer,\n+ extras: Bundle):ContentView(context, R.layout.five_cta_collapsed, renderer) {\n+\n+ init {\n+ if (renderer.pt_title == null || renderer.pt_title!!.isEmpty()) {\n+ renderer.pt_title = Utils.getApplicationName(context)\n+ }\n+ setCustomContentViewExpandedBackgroundColour(renderer.pt_bg)\n+ var imageCounter = 0\n+ for (imageKey in renderer.imageList!!.indices) {\n+ if (imageKey == 0) {\n+ Utils.loadImageURLIntoRemoteView(\n+ R.id.cta1,\n+ renderer.imageList!![imageKey],\n+ remoteView\n+ )\n+ if (Utils.getFallback()) {\n+ remoteView.setViewVisibility(R.id.cta1, View.GONE)\n+ imageCounter++\n+ }\n+ } else if (imageKey == 1) {\n+ Utils.loadImageURLIntoRemoteView(\n+ R.id.cta2,\n+ renderer.imageList!![imageKey],\n+ remoteView\n+ )\n+ if (Utils.getFallback()) {\n+ imageCounter++\n+ remoteView.setViewVisibility(R.id.cta2, View.GONE)\n+ }\n+ } else if (imageKey == 2) {\n+ Utils.loadImageURLIntoRemoteView(\n+ R.id.cta3,\n+ renderer.imageList!![imageKey],\n+ remoteView\n+ )\n+ if (Utils.getFallback()) {\n+ imageCounter++\n+ remoteView.setViewVisibility(R.id.cta3, View.GONE)\n+ }\n+ } else if (imageKey == 3) {\n+ Utils.loadImageURLIntoRemoteView(\n+ R.id.cta4,\n+ renderer.imageList!![imageKey],\n+ remoteView\n+ )\n+ if (Utils.getFallback()) {\n+ imageCounter++\n+ remoteView.setViewVisibility(R.id.cta4, View.GONE)\n+ }\n+ } else if (imageKey == 4) {\n+ Utils.loadImageURLIntoRemoteView(\n+ R.id.cta5,\n+ renderer.imageList!![imageKey],\n+ remoteView\n+ )\n+ if (Utils.getFallback()) {\n+ imageCounter++\n+ remoteView.setViewVisibility(R.id.cta5, View.GONE)\n+ }\n+ }\n+ }\n+ Utils.loadImageRidIntoRemoteView(R.id.close, R.drawable.pt_close, remoteView)\n+\n+ extras.putInt(PTConstants.PT_NOTIF_ID, renderer.notificationId)\n+ extras.putBoolean(Constants.CLOSE_SYSTEM_DIALOGS,true)\n+\n+ val bundleCTA1 = extras.clone() as Bundle\n+ bundleCTA1.putBoolean(\"cta1\", true)\n+ bundleCTA1.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(0))\n+ bundleCTA1.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 1 + \"_\" + renderer.deepLinkList?.get(0))\n+\n+ val bundleCTA2 = extras.clone() as Bundle\n+ bundleCTA2.putBoolean(\"cta2\", true)\n+ bundleCTA2.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(1))\n+ bundleCTA2.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 2 + \"_\" + renderer.deepLinkList?.get(1))\n+\n+ val bundleCTA3 = extras.clone() as Bundle\n+ bundleCTA3.putBoolean(\"cta3\", true)\n+ bundleCTA3.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(2))\n+ bundleCTA3.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 3 + \"_\" + renderer.deepLinkList?.get(2))\n+\n+ val bundleCTA4 = extras.clone() as Bundle\n+ bundleCTA4.putBoolean(\"cta4\", true)\n+ bundleCTA4.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(3))\n+ bundleCTA4.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 4 + \"_\" + renderer.deepLinkList?.get(3))\n+\n+ val bundleCTA5 = extras.clone() as Bundle\n+ bundleCTA5.putBoolean(\"cta5\", true)\n+ bundleCTA5.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(4))\n+ bundleCTA5.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 5 + \"_\" + renderer.deepLinkList?.get(4))\n+\n+ remoteView.setOnClickPendingIntent(R.id.cta1, LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA1,context))\n+ remoteView.setOnClickPendingIntent(R.id.cta2, LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA2,context))\n+\n+ remoteView.setOnClickPendingIntent(R.id.cta3, LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA3,context))\n+\n+ remoteView.setOnClickPendingIntent(R.id.cta4, LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA4,context))\n+\n+ remoteView.setOnClickPendingIntent(R.id.cta5, LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA5,context))\n+\n+ remoteView.setOnClickPendingIntent(R.id.close, PendingIntentFactory.getPendingIntent(context,\n+ renderer.notificationId, extras,false, FIVE_ICON_CLOSE_PENDING_INTENT,renderer))\n+\n+\n+ if (imageCounter > 2) {\n+ PTLog.debug(\"More than 2 images were not retrieved in 5CTA Notification, not displaying Notification.\")\n+ }\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/FiveIconStyle.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/FiveIconStyle.kt", "diff": "@@ -6,17 +6,18 @@ import android.os.Bundle\nimport android.widget.RemoteViews\nimport com.clevertap.android.pushtemplates.TemplateRenderer\nimport com.clevertap.android.pushtemplates.content.FIVE_ICON_CONTENT_PENDING_INTENT\n-import com.clevertap.android.pushtemplates.content.FiveIconContentView\n+import com.clevertap.android.pushtemplates.content.FiveIconBigContentView\n+import com.clevertap.android.pushtemplates.content.FiveIconSmallContentView\nimport com.clevertap.android.pushtemplates.content.PendingIntentFactory\nclass FiveIconStyle(private var renderer: TemplateRenderer,private var extras: Bundle): Style(renderer) {\noverride fun makeSmallContentView(context: Context, renderer: TemplateRenderer): RemoteViews {\n- return FiveIconContentView(context, renderer,extras).remoteView\n+ return FiveIconSmallContentView(context, renderer,extras).remoteView\n}\noverride fun makeBigContentView(context: Context, renderer: TemplateRenderer): RemoteViews {\n- return FiveIconContentView(context, renderer,extras).remoteView\n+ return FiveIconBigContentView(context, renderer,extras).remoteView\n}\noverride fun makePendingIntent(\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout-v31/content_view_small_multi_line_msg.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/content_view_small_multi_line_msg.xml", "diff": "<RelativeLayout\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"wrap_content\"\n+ android:layout_margin=\"4dp\"\nandroid:id=\"@+id/rel_lyt\">\n<TextView\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout-v31/content_view_small_single_line_msg.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/content_view_small_single_line_msg.xml", "diff": "<RelativeLayout\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"wrap_content\"\n+ android:layout_margin=\"4dp\"\nandroid:id=\"@+id/rel_lyt\">\n<TextView\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/five_cta_collapsed.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_big\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:orientation=\"horizontal\">\n+\n+ <ImageView android:id=\"@+id/cta1\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\"/>\n+\n+ <ImageView\n+ android:id=\"@+id/cta2\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\" />\n+\n+ <ImageView\n+ android:id=\"@+id/cta3\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\" />\n+\n+ <ImageView\n+ android:id=\"@+id/cta4\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\" />\n+\n+ <ImageView\n+ android:id=\"@+id/cta5\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\" />\n+\n+ <ImageView\n+ android:id=\"@+id/close\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_close\" />\n+\n+</LinearLayout>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/five_cta_expanded.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_big\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"64dp\"\n+ android:orientation=\"horizontal\">\n+\n+ <ImageView android:id=\"@+id/cta1\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\"/>\n+\n+ <ImageView\n+ android:id=\"@+id/cta2\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\" />\n+\n+ <ImageView\n+ android:id=\"@+id/cta3\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\" />\n+\n+ <ImageView\n+ android:id=\"@+id/cta4\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\" />\n+\n+ <ImageView\n+ android:id=\"@+id/cta5\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\" />\n+\n+ <ImageView\n+ android:id=\"@+id/close\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_close\" />\n+\n+</LinearLayout>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/product_display_linear_expanded.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_big\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:background=\"@android:color/white\"\n+ android:orientation=\"vertical\"\n+ android:clipToPadding=\"false\"\n+ android:padding=\"4dp\">\n+\n+ <LinearLayout\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:orientation=\"vertical\">\n+ <ViewFlipper\n+ android:id=\"@+id/carousel_image\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"140dp\"\n+ android:layout_marginLeft=\"-8dp\"\n+ android:layout_marginRight=\"-8dp\"\n+ android:layout_weight=\"4.5\"\n+ android:inAnimation=\"@anim/fade_in\"\n+ android:outAnimation=\"@anim/fade_out\" />\n+\n+ <LinearLayout\n+ android:id=\"@+id/buy_price\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"30dp\"\n+ android:layout_marginTop=\"4dp\"\n+ android:layout_weight=\"3\"\n+ android:orientation=\"horizontal\">\n+\n+ <TextView\n+ android:id=\"@+id/product_name\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"2\"\n+ android:gravity=\"center\"\n+ android:text=\"1234567890123456\"\n+ android:textAppearance=\"@style/PushTitle\" />\n+\n+ <Button\n+ android:id=\"@+id/product_action\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:background=\"@android:color/holo_red_dark\"\n+ android:text=\"Buy Now\"\n+ android:textAppearance=\"@style/PushMessage\"\n+ android:textColor=\"@android:color/white\" />\n+\n+ </LinearLayout>\n+\n+ <LinearLayout\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_marginTop=\"4dp\"\n+ android:layout_weight=\"3\"\n+ android:orientation=\"horizontal\"\n+ android:paddingLeft=\"4dp\"\n+ android:paddingRight=\"4dp\">\n+\n+ <ImageView\n+ android:id=\"@+id/small_image1\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"50dp\"\n+ android:layout_marginStart=\"-5dp\"\n+ android:layout_marginEnd=\"2dp\"\n+ android:layout_weight=\"1\"\n+ android:visibility=\"gone\"/>\n+\n+ <ImageView\n+ android:id=\"@+id/small_image2\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"50dp\"\n+ android:layout_marginLeft=\"2dp\"\n+ android:layout_marginRight=\"2dp\"\n+ android:layout_weight=\"1\"\n+ android:visibility=\"gone\"/>\n+\n+ <ImageView\n+ android:id=\"@+id/small_image3\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"50dp\"\n+ android:layout_marginEnd=\"-4dp\"\n+ android:layout_weight=\"1\"\n+ android:visibility=\"gone\"/>\n+\n+ </LinearLayout>\n+\n+ </LinearLayout>\n+\n+</LinearLayout>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout-v31/product_display_template.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+\n+<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:orientation=\"vertical\"\n+ android:id=\"@+id/content_view_big\">\n+\n+ <include\n+ android:id=\"@+id/rel_lyt\"\n+ layout=\"@layout/content_view_small_multi_line_msg\" />\n+\n+ <LinearLayout\n+ android:id=\"@+id/carousel_relative_layout\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"200dp\"\n+ android:layout_marginTop=\"8dp\"\n+ android:weightSum=\"1\">\n+\n+ <ViewFlipper\n+ android:id=\"@+id/carousel_image\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"0.5\"\n+ android:inAnimation=\"@anim/fade_in\"\n+ android:outAnimation=\"@anim/fade_out\" />\n+\n+ <LinearLayout\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"0.5\"\n+ android:orientation=\"vertical\"\n+ android:weightSum=\"1\">\n+\n+ <LinearLayout\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"0.4\"\n+ android:orientation=\"vertical\"\n+ android:padding=\"8dp\"\n+ android:weightSum=\"3\"\n+ android:gravity=\"center\">\n+\n+\n+ <TextView\n+ android:id=\"@+id/product_price\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_marginTop=\"8dp\"\n+ android:text=\"Rs: 5,000,000\"\n+ android:textAppearance=\"@style/PushTitle\"\n+ android:textAlignment=\"center\"/>\n+\n+ <Button\n+ android:id=\"@+id/product_action\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_marginTop=\"16dp\"\n+ android:background=\"@android:color/holo_orange_light\"\n+ android:text=\"Buy Now\"\n+ android:textAppearance=\"@style/PushMessage\" />\n+\n+\n+ <LinearLayout\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_marginTop=\"16dp\"\n+ android:orientation=\"horizontal\">\n+\n+ <ImageView\n+ android:id=\"@+id/small_image1\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ />\n+\n+ <ImageView\n+ android:id=\"@+id/small_image2\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\" />\n+\n+ <ImageView\n+ android:id=\"@+id/small_image3\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\" />\n+ </LinearLayout>\n+ </LinearLayout>\n+\n+\n+ </LinearLayout>\n+\n+ </LinearLayout>\n+</LinearLayout>\n" }, { "change_type": "RENAME", "old_path": "clevertap-pushTemplate/src/main/res/layout/five_cta.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/five_cta_collapsed.xml", "diff": "" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushTemplate/src/main/res/layout/five_cta_expanded.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_big\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"64dp\"\n+ android:padding=\"6dp\"\n+ android:orientation=\"horizontal\">\n+\n+ <ImageView android:id=\"@+id/cta1\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\"/>\n+\n+ <ImageView\n+ android:id=\"@+id/cta2\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\" />\n+\n+ <ImageView\n+ android:id=\"@+id/cta3\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\" />\n+\n+ <ImageView\n+ android:id=\"@+id/cta4\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\" />\n+\n+ <ImageView\n+ android:id=\"@+id/cta5\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_image\" />\n+\n+ <ImageView\n+ android:id=\"@+id/close\"\n+ android:layout_width=\"0dp\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_weight=\"1\"\n+ android:layout_margin=\"4dip\"\n+ android:src=\"@drawable/pt_close\" />\n+\n+</LinearLayout>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/product_display_template.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/product_display_template.xml", "diff": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n- xmlns:tools=\"http://schemas.android.com/tools\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"wrap_content\"\nandroid:orientation=\"vertical\"\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor-Android12) - Update layouts fro FiveIcon and ProductDisplay(Non-Linear)
116,612
10.12.2021 01:20:03
-19,080
c8888fd4805ca453c20807aa1ce3e4901368d360
task(Android 12): Update Input box for Android 12 trampoline
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/Constants.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/Constants.java", "diff": "@@ -288,7 +288,9 @@ public interface Constants {\nint MAX_DELAY_FREQUENCY = 1000 * 60 * 10;\nString[] NULL_STRING_ARRAY = new String[0];\n- public static final String PT_NOTIF_ID = \"notificationId\";\n- public static final String CLOSE_SYSTEM_DIALOGS = \"close_system_dialogs\";\n+ String PT_NOTIF_ID = \"notificationId\";\n+ String CLOSE_SYSTEM_DIALOGS = \"close_system_dialogs\";\n+ String KEY_CT_TYPE = \"ct_type\";\n+ String PT_INPUT_KEY = \"pt_input_reply\";\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/interfaces/ActionButtonClickHandler.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/interfaces/ActionButtonClickHandler.java", "diff": "@@ -5,7 +5,5 @@ import android.os.Bundle;\npublic interface ActionButtonClickHandler extends NotificationHandler {\n- String getType(Bundle extras);\n-\nboolean onActionButtonClick(Context context, Bundle extras, int notificationId);\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CTNotificationIntentService.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CTNotificationIntentService.java", "diff": "@@ -6,8 +6,11 @@ import android.app.NotificationManager;\nimport android.content.Context;\nimport android.content.Intent;\nimport android.net.Uri;\n+import android.os.Build.VERSION;\n+import android.os.Build.VERSION_CODES;\nimport android.os.Bundle;\nimport com.clevertap.android.sdk.CleverTapAPI;\n+import com.clevertap.android.sdk.Constants;\nimport com.clevertap.android.sdk.Logger;\nimport com.clevertap.android.sdk.Utils;\nimport com.clevertap.android.sdk.interfaces.ActionButtonClickHandler;\n@@ -55,7 +58,7 @@ public class CTNotificationIntentService extends IntentService {\n.getPushNotificationHandler();\n}\n- String type = mActionButtonClickHandler.getType(extras);\n+ String type = extras.getString(Constants.KEY_CT_TYPE);//mActionButtonClickHandler.getType(extras);\nif (TYPE_BUTTON_CLICK.equals(type)) {\nLogger.v(\"CTNotificationIntentService handling \" + TYPE_BUTTON_CLICK);\nhandleActionButtonClick(extras);\n@@ -79,6 +82,14 @@ public class CTNotificationIntentService extends IntentService {\nreturn;\n}\n+ /**\n+ * For Android 12 Trampoline restrictions, do not process deeplink from here\n+ */\n+ if (VERSION.SDK_INT>= VERSION_CODES.S)\n+ {\n+ return;\n+ }\n+\nIntent launchIntent;\nif (dl != null) {\nlaunchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(dl));\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CoreNotificationRenderer.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/CoreNotificationRenderer.java", "diff": "@@ -125,105 +125,7 @@ public class CoreNotificationRenderer implements INotificationRenderer {\n}\n}\n- String intentServiceName = ManifestInfo.getInstance(context).getIntentServiceName();\n- Class clazz = null;\n- if (intentServiceName != null) {\n- try {\n- clazz = Class.forName(intentServiceName);\n- } catch (ClassNotFoundException e) {\n- try {\n- clazz = Class.forName(\"com.clevertap.android.sdk.pushnotification.CTNotificationIntentService\");\n- } catch (ClassNotFoundException ex) {\n- Logger.d(\"No Intent Service found\");\n- }\n- }\n- } else {\n- try {\n- clazz = Class.forName(\"com.clevertap.android.sdk.pushnotification.CTNotificationIntentService\");\n- } catch (ClassNotFoundException ex) {\n- Logger.d(\"No Intent Service found\");\n- }\n- }\n-\n- boolean isCTIntentServiceAvailable = Utils.isServiceAvailable(context, clazz);\n-\n- if (actions != null && actions.length() > 0) {\n- for (int i = 0; i < actions.length(); i++) {\n- try {\n- JSONObject action = actions.getJSONObject(i);\n- String label = action.optString(\"l\");\n- String dl = action.optString(\"dl\");\n- String ico = action.optString(Constants.NOTIF_ICON);\n- String id = action.optString(\"id\");\n- boolean autoCancel = action.optBoolean(\"ac\", true);\n- if (label.isEmpty() || id.isEmpty()) {\n- config.getLogger().debug(config.getAccountId(),\n- \"not adding push notification action: action label or id missing\");\n- continue;\n- }\n- int icon = 0;\n- if (!ico.isEmpty()) {\n- try {\n- icon = context.getResources().getIdentifier(ico, \"drawable\", context.getPackageName());\n- } catch (Throwable t) {\n- config.getLogger().debug(config.getAccountId(),\n- \"unable to add notification action icon: \" + t.getLocalizedMessage());\n- }\n- }\n-\n- boolean sendToCTIntentService = (VERSION.SDK_INT < VERSION_CODES.S && autoCancel\n- && isCTIntentServiceAvailable);\n-\n- Intent actionLaunchIntent;\n- if (sendToCTIntentService) {\n- actionLaunchIntent = new Intent(CTNotificationIntentService.MAIN_ACTION);\n- actionLaunchIntent.setPackage(context.getPackageName());\n- actionLaunchIntent.putExtra(\"ct_type\", CTNotificationIntentService.TYPE_BUTTON_CLICK);\n- if (!dl.isEmpty()) {\n- actionLaunchIntent.putExtra(\"dl\", dl);\n- }\n- } else {\n- if (!dl.isEmpty()) {\n- actionLaunchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(dl));\n- } else {\n- actionLaunchIntent = context.getPackageManager()\n- .getLaunchIntentForPackage(context.getPackageName());\n- }\n- }\n-\n- if (actionLaunchIntent != null) {\n- actionLaunchIntent.putExtras(extras);\n- actionLaunchIntent.removeExtra(Constants.WZRK_ACTIONS);\n- actionLaunchIntent.putExtra(\"actionId\", id);\n- actionLaunchIntent.putExtra(\"autoCancel\", autoCancel);\n- actionLaunchIntent.putExtra(\"wzrk_c2a\", id);\n- actionLaunchIntent.putExtra(\"notificationId\", notificationId);\n-\n- actionLaunchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);\n- }\n-\n- PendingIntent actionIntent;\n- int requestCode = ((int) System.currentTimeMillis()) + i;\n- int flagsActionLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n- if (VERSION.SDK_INT >= VERSION_CODES.M) {\n- flagsActionLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n- }\n- if (sendToCTIntentService) {\n- actionIntent = PendingIntent.getService(context, requestCode,\n- actionLaunchIntent, flagsActionLaunchPendingIntent);\n- } else {\n- actionIntent = PendingIntent.getActivity(context, requestCode,\n- actionLaunchIntent, flagsActionLaunchPendingIntent);\n- }\n- nb.addAction(icon, label, actionIntent);\n-\n- } catch (Throwable t) {\n- config.getLogger()\n- .debug(config.getAccountId(),\n- \"error adding notification action : \" + t.getLocalizedMessage());\n- }\n- }\n- }// Uncommon - END\n+ setActionButtons(context,extras,notificationId,nb,actions);\nreturn nb;\n@@ -234,4 +136,9 @@ public class CoreNotificationRenderer implements INotificationRenderer {\nthis.smallIcon = smallIcon;\n}\n+ @Override\n+ public String getActionButtonIconKey() {\n+ return Constants.NOTIF_ICON;\n+ }\n+\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/INotificationRenderer.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/INotificationRenderer.java", "diff": "package com.clevertap.android.sdk.pushnotification;\n+import android.app.PendingIntent;\nimport android.content.Context;\n+import android.content.Intent;\n+import android.net.Uri;\n+import android.os.Build.VERSION;\n+import android.os.Build.VERSION_CODES;\nimport android.os.Bundle;\nimport androidx.annotation.Nullable;\nimport androidx.core.app.NotificationCompat;\nimport androidx.core.app.NotificationCompat.Builder;\nimport com.clevertap.android.sdk.CleverTapInstanceConfig;\n+import com.clevertap.android.sdk.Constants;\n+import com.clevertap.android.sdk.Logger;\n+import com.clevertap.android.sdk.ManifestInfo;\n+import com.clevertap.android.sdk.Utils;\n+import org.json.JSONArray;\n+import org.json.JSONObject;\npublic interface INotificationRenderer {\n@@ -19,4 +30,133 @@ public interface INotificationRenderer {\nfinal Builder nb, final CleverTapInstanceConfig config, final int notificationId);\nvoid setSmallIcon(int smallIcon, final Context context);\n+\n+ String getActionButtonIconKey();\n+\n+ default NotificationCompat.Builder setActionButtons(\n+ Context context,\n+ Bundle extras,\n+ int notificationId,\n+ NotificationCompat.Builder nb, JSONArray actions\n+ ) {\n+\n+ String intentServiceName = ManifestInfo.getInstance(context).getIntentServiceName();\n+ Class clazz = null;\n+ if (intentServiceName != null) {\n+ try {\n+ clazz = Class.forName(intentServiceName);\n+ } catch (ClassNotFoundException e) {\n+ try {\n+ clazz = Class.forName(\"com.clevertap.android.sdk.pushnotification.CTNotificationIntentService\");\n+ } catch (ClassNotFoundException ex) {\n+ Logger.d(\"No Intent Service found\");\n+ }\n+ }\n+ } else {\n+ try {\n+ clazz = Class.forName(\"com.clevertap.android.sdk.pushnotification.CTNotificationIntentService\");\n+ } catch (ClassNotFoundException ex) {\n+ Logger.d(\"No Intent Service found\");\n+ }\n+ }\n+\n+ boolean isCTIntentServiceAvailable = Utils.isServiceAvailable(context, clazz);\n+\n+ if (actions != null && actions.length() > 0) {\n+ for (int i = 0; i < actions.length(); i++) {\n+ try {\n+ JSONObject action = actions.getJSONObject(i);\n+ String label = action.optString(\"l\");\n+ String dl = action.optString(\"dl\");\n+ String ico = action.optString(getActionButtonIconKey());\n+ String id = action.optString(\"id\");\n+ boolean autoCancel = action.optBoolean(\"ac\", true);\n+ if (label.isEmpty() || id.isEmpty()) {\n+ Logger.d(\"not adding push notification action: action label or id missing\");\n+ continue;\n+ }\n+ int icon = 0;\n+ if (!ico.isEmpty()) {\n+ try {\n+ icon = context.getResources().getIdentifier(ico, \"drawable\", context.getPackageName());\n+ } catch (Throwable t) {\n+ Logger.d(\"unable to add notification action icon: \" + t.getLocalizedMessage());\n+ }\n+ }\n+\n+ boolean sendToCTIntentService = (VERSION.SDK_INT < VERSION_CODES.S && autoCancel\n+ && isCTIntentServiceAvailable);\n+\n+ String dismissOnClick = extras.getString(\"pt_dismiss_on_click\");\n+ /**\n+ * Send to CTIntentService in case (OS >= S) and notif is for Push templates with remind action\n+ */\n+ if (!sendToCTIntentService && PushNotificationHandler.isForPushTemplates(extras)\n+ && id.contains(\"remind\") && dismissOnClick!=null &&\n+ dismissOnClick.equalsIgnoreCase(\"true\") && autoCancel &&\n+ isCTIntentServiceAvailable) {\n+ sendToCTIntentService = true;\n+ }\n+\n+ /**\n+ * Send to CTIntentService in case (OS >= S) and notif is for Push templates with pt_dismiss_on_click\n+ * true\n+ */\n+ if (!sendToCTIntentService && PushNotificationHandler.isForPushTemplates(extras)\n+ && dismissOnClick!=null && dismissOnClick.equalsIgnoreCase(\"true\")\n+ && autoCancel && isCTIntentServiceAvailable) {\n+ sendToCTIntentService = true;\n+ }\n+\n+ Intent actionLaunchIntent;\n+ if (sendToCTIntentService) {\n+ actionLaunchIntent = new Intent(CTNotificationIntentService.MAIN_ACTION);\n+ actionLaunchIntent.setPackage(context.getPackageName());\n+ actionLaunchIntent.putExtra(Constants.KEY_CT_TYPE, CTNotificationIntentService.TYPE_BUTTON_CLICK);\n+ if (!dl.isEmpty()) {\n+ actionLaunchIntent.putExtra(\"dl\", dl);\n+ }\n+ } else {\n+ if (!dl.isEmpty()) {\n+ actionLaunchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(dl));\n+ } else {\n+ actionLaunchIntent = context.getPackageManager()\n+ .getLaunchIntentForPackage(context.getPackageName());\n+ }\n+ }\n+\n+ if (actionLaunchIntent != null) {\n+ actionLaunchIntent.putExtras(extras);\n+ actionLaunchIntent.removeExtra(Constants.WZRK_ACTIONS);\n+ actionLaunchIntent.putExtra(\"actionId\", id);\n+ actionLaunchIntent.putExtra(\"autoCancel\", autoCancel);\n+ actionLaunchIntent.putExtra(\"wzrk_c2a\", id);\n+ actionLaunchIntent.putExtra(\"notificationId\", notificationId);\n+\n+ actionLaunchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);\n+ }\n+\n+ PendingIntent actionIntent;\n+ int requestCode = ((int) System.currentTimeMillis()) + i;\n+ int flagsActionLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n+ if (VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsActionLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n+ }\n+ if (sendToCTIntentService) {\n+ actionIntent = PendingIntent.getService(context, requestCode,\n+ actionLaunchIntent, flagsActionLaunchPendingIntent);\n+ } else {\n+ actionIntent = PendingIntent.getActivity(context, requestCode,\n+ actionLaunchIntent, flagsActionLaunchPendingIntent);\n+ }\n+ nb.addAction(icon, label, actionIntent);\n+\n+ } catch (Throwable t) {\n+ Logger.d(\"error adding notification action : \" + t.getLocalizedMessage());\n+ }\n+ }\n+ }// Uncommon - END\n+\n+ return nb;\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushNotificationHandler.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushNotificationHandler.java", "diff": "@@ -36,11 +36,6 @@ public class PushNotificationHandler implements ActionButtonClickHandler {\n// NO-OP\n}\n- @Override\n- public String getType(final Bundle extras) {\n- return extras.getString(\"ct_type\");\n- }\n-\n@Override\npublic boolean onActionButtonClick(final Context context, final Bundle extras, final int notificationId) {\nreturn false;\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateNotificationHandler.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateNotificationHandler.java", "diff": "@@ -11,11 +11,6 @@ import java.util.Objects;\npublic class PushTemplateNotificationHandler implements ActionButtonClickHandler {\n- @Override\n- public String getType(final Bundle extras) {\n- return extras.getString(PTConstants.PT_TYPE);\n- }\n-\n@Override\npublic boolean onActionButtonClick(final Context context, final Bundle extras, final int notificationId) {\nString actionID = extras.getString(PTConstants.PT_ACTION_ID);\n@@ -23,6 +18,9 @@ public class PushTemplateNotificationHandler implements ActionButtonClickHandler\nCleverTapInstanceConfig config = extras.getParcelable(\"config\");\nif (dismissOnClick != null && dismissOnClick.equalsIgnoreCase(\"true\")) {\n+ /**\n+ * For input box remind CTA,pt_dismiss_on_click must be true to raise event\n+ */\nif (actionID != null && actionID.contains(\"remind\")) {\nUtils.raiseCleverTapEvent(context, config, extras);\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -327,7 +327,8 @@ public class PushTemplateReceiver extends BroadcastReceiver {\n/* Check if Auto Open key is present and not empty, if not present then show feedback and\nauto kill in 3 secs. If present, then launch the App with Dl or Launcher activity.\nThe launcher activity will get the reply in extras under the key \"pt_reply\" */\n- if (extras.getString(PTConstants.PT_INPUT_AUTO_OPEN) != null || extras.getBoolean(PTConstants.PT_INPUT_AUTO_OPEN)) {\n+ if (VERSION.SDK_INT < VERSION_CODES.S && (extras.getString(PTConstants.PT_INPUT_AUTO_OPEN) != null\n+ || extras.getBoolean(PTConstants.PT_INPUT_AUTO_OPEN))) {\n//adding delay for launcher\ntry {\nThread.sleep(PTConstants.PT_INPUT_TIMEOUT);\n@@ -337,7 +338,7 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nIntent launchIntent;\n- if (extras.containsKey(Constants.DEEP_LINK_KEY)) {\n+ if (extras.containsKey(Constants.DEEP_LINK_KEY) && extras.getString(Constants.DEEP_LINK_KEY)!=null) {\nlaunchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(intent.getStringExtra(Constants.DEEP_LINK_KEY)));\nUtils.setPackageNameFromResolveInfoList(context, launchIntent);\n} else {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "diff": "@@ -236,6 +236,10 @@ class TemplateRenderer : INotificationRenderer {\n}\n}\n+ override fun getActionButtonIconKey(): String {\n+ return PTConstants.PT_NOTIF_ICON\n+ }\n+\noverride fun getCollapseKey(extras: Bundle): Any? {\nreturn pt_collapse_key // TODO: Check if set properly before caller calls this\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "diff": "@@ -308,8 +308,8 @@ internal object PendingIntentFactory {\n}\nINPUT_BOX_CONTENT_PENDING_INTENT -> {\n- extras.putString(Constants.DEEP_LINK_KEY, renderer?.deepLinkList!![0])\n- return if (renderer.deepLinkList != null && renderer?.deepLinkList!!.size > 0) {\n+ return if (renderer?.deepLinkList != null && renderer?.deepLinkList!!.size > 0) {\n+ extras.putString(Constants.DEEP_LINK_KEY, renderer?.deepLinkList?.get(0))\nsetPendingIntent(\ncontext,\nnotificationId,\n@@ -323,7 +323,10 @@ internal object PendingIntentFactory {\n}\nINPUT_BOX_REPLY_PENDING_INTENT -> {\n+ if (renderer?.deepLinkList!!.size>0)\n+ {\nextras.putString(Constants.DEEP_LINK_KEY, renderer?.deepLinkList!![0])\n+ }\nlaunchIntent.putExtra(PTConstants.PT_INPUT_FEEDBACK, renderer?.pt_input_feedback)\nlaunchIntent.putExtra(PTConstants.PT_INPUT_AUTO_OPEN, renderer?.pt_input_auto_open)\nlaunchIntent.putExtra(\"config\", renderer?.config)\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/InputBoxStyle.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/styles/InputBoxStyle.kt", "diff": "@@ -5,6 +5,7 @@ import android.content.Context\nimport android.content.Intent\nimport android.net.Uri\nimport android.os.Build\n+import android.os.Build.VERSION\nimport android.os.Build.VERSION_CODES\nimport android.os.Bundle\nimport android.widget.RemoteViews\n@@ -54,11 +55,44 @@ class InputBoxStyle(private var renderer: TemplateRenderer): Style(renderer) {\n.setLabel(renderer.pt_input_label)\n.build()\n+ val replyIntent : PendingIntent\n+ /*if (VERSION.SDK_INT < VERSION_CODES.S || (extras.getString(PTConstants.PT_INPUT_AUTO_OPEN) == null && !extras.getBoolean(PTConstants.PT_INPUT_AUTO_OPEN)))\n+ {*/\n+ replyIntent = PendingIntentFactory.getPendingIntent(context,notificationId,extras,false,\n+ INPUT_BOX_REPLY_PENDING_INTENT,renderer)!!\n+ /*} else {\n+ var launchIntent : Intent?\n+ if (extras.containsKey(Constants.DEEP_LINK_KEY) && extras.getString(Constants.DEEP_LINK_KEY)!=null) {\n+ launchIntent = Intent(\n+ Intent.ACTION_VIEW,\n+ Uri.parse(extras.getString(Constants.DEEP_LINK_KEY))\n+ )\n+ com.clevertap.android.sdk.Utils.setPackageNameFromResolveInfoList(context, launchIntent)\n+ } else {\n+ launchIntent = context.packageManager.getLaunchIntentForPackage(context.packageName)\n+ }\n+\n+ launchIntent?.flags = (Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP\n+ or Intent.FLAG_ACTIVITY_SINGLE_TOP)\n+\n+ extras.putInt(PTConstants.PT_NOTIF_ID,notificationId)\n+ // Take all the properties from the notif and add it to the intent\n+ launchIntent?.putExtras(extras)\n+ launchIntent?.removeExtra(Constants.WZRK_ACTIONS)\n+\n+ val flagsLaunchPendingIntent = (PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE)\n+\n+ replyIntent = PendingIntent.getActivity(\n+ context,\n+ System.currentTimeMillis().toInt(),\n+ launchIntent,\n+ flagsLaunchPendingIntent\n+ )\n+ }*/\n//Notification Action with RemoteInput instance added.\nval replyAction = NotificationCompat.Action.Builder(\n- android.R.drawable.sym_action_chat, renderer.pt_input_label, PendingIntentFactory.\n- getPendingIntent(context,notificationId,extras,false,\n- INPUT_BOX_REPLY_PENDING_INTENT,renderer))\n+ android.R.drawable.sym_action_chat, renderer.pt_input_label,replyIntent\n+ )\n.addRemoteInput(remoteInput)\n.setAllowGeneratedReplies(true)\n.build()\n@@ -69,104 +103,10 @@ class InputBoxStyle(private var renderer: TemplateRenderer): Style(renderer) {\nif (renderer.pt_dismiss_on_click != null && renderer.pt_dismiss_on_click!!.isNotEmpty()){\nextras.putString(PTConstants.PT_DISMISS_ON_CLICK, renderer.pt_dismiss_on_click)\n}\n- setActionButtons(context, extras, notificationId, inputBoxNotificationBuilder)\n+ renderer.setActionButtons(context,extras,notificationId,inputBoxNotificationBuilder,renderer.actions)\nreturn inputBoxNotificationBuilder\n}\n- private fun setActionButtons(\n- context: Context,\n- extras: Bundle,\n- notificationId: Int,\n- nb: NotificationCompat.Builder\n- ) {\n- var clazz: Class<*>? = null\n- try {\n- clazz = Class.forName(\"com.clevertap.android.sdk.pushnotification.CTNotificationIntentService\")\n- } catch (ex: ClassNotFoundException) {\n- PTLog.debug(\"No Intent Service found\")\n- }\n- val isPTIntentServiceAvailable = com.clevertap.android.sdk.Utils.isServiceAvailable(context, clazz)\n- if (renderer.actions != null && renderer.actions!!.length() > 0) {\n- for (i in 0 until renderer.actions!!.length()) {\n- try {\n- val action = renderer.actions!!.getJSONObject(i)\n- val label = action.optString(\"l\")\n- val dl = action.optString(\"dl\")\n- val ico = action.optString(PTConstants.PT_NOTIF_ICON)\n- val id = action.optString(\"id\")\n- val autoCancel = action.optBoolean(\"ac\", true)\n- if (label.isEmpty() || id.isEmpty()) {\n- PTLog.debug(\"not adding push notification action: action label or id missing\")\n- continue\n- }\n- var icon = 0\n- if (ico.isNotEmpty()) {\n- try {\n- icon = context.resources.getIdentifier(\n- ico,\n- \"drawable\",\n- context.packageName\n- )\n- } catch (t: Throwable) {\n- PTLog.debug(\"unable to add notification action icon: \" + t.localizedMessage)\n- }\n- }\n- val sendToPTIntentService = autoCancel && isPTIntentServiceAvailable\n- var actionLaunchIntent: Intent?\n- if (sendToPTIntentService) {\n- actionLaunchIntent = Intent(CTNotificationIntentService.MAIN_ACTION)\n- actionLaunchIntent.setPackage(context.packageName)\n- actionLaunchIntent.putExtra(\n- PTConstants.PT_TYPE,\n- CTNotificationIntentService.TYPE_BUTTON_CLICK\n- )\n- if (dl.isNotEmpty()) {\n- actionLaunchIntent.putExtra(\"dl\", dl)\n- }\n- } else {\n- actionLaunchIntent = if (dl.isNotEmpty()) {\n- Intent(Intent.ACTION_VIEW, Uri.parse(dl))\n- } else {\n- context.packageManager.getLaunchIntentForPackage(context.packageName)\n- }\n- }\n- if (actionLaunchIntent != null) {\n- actionLaunchIntent.putExtras(extras)\n- actionLaunchIntent.removeExtra(Constants.WZRK_ACTIONS)\n- actionLaunchIntent.putExtra(PTConstants.PT_ACTION_ID, id)\n- actionLaunchIntent.putExtra(\"autoCancel\", autoCancel)\n- actionLaunchIntent.putExtra(\"wzrk_c2a\", id)\n- actionLaunchIntent.putExtra(\"notificationId\", notificationId)\n- actionLaunchIntent.flags =\n- Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP\n- }\n- var actionIntent: PendingIntent? = null\n- val requestCode = System.currentTimeMillis().toInt() + i\n-\n- var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n- if (Build.VERSION.SDK_INT >= VERSION_CODES.S) {\n- flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_MUTABLE\n- }\n-\n- actionIntent = if (sendToPTIntentService) {\n- PendingIntent.getService(\n- context, requestCode,\n- actionLaunchIntent!!, flagsLaunchPendingIntent\n- )\n- } else {\n- PendingIntent.getActivity(\n- context, requestCode,\n- actionLaunchIntent,flagsLaunchPendingIntent\n- )\n- }\n- nb.addAction(icon, label, actionIntent)\n- } catch (t: Throwable) {\n- PTLog.debug(\"error adding notification action : \" + t.localizedMessage)\n- }\n- }\n- }\n- }\n-\nprivate fun setStandardViewBigImageStyle(\npt_big_img: String?,\nextras: Bundle,\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Update Input box for Android 12 trampoline SDK-1056
116,612
11.12.2021 16:58:35
-19,080
0c4ac89c6480f40c4741b3b10033254d872685ff
task(Android 12): Update Product display for Android 12 trampoline and proper rendering below api 30
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/LaunchPendingIntentFactory.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/LaunchPendingIntentFactory.java", "diff": "@@ -19,6 +19,25 @@ public class LaunchPendingIntentFactory {\nIntent launchIntent;\nPendingIntent pIntent;\nif (VERSION.SDK_INT >= VERSION_CODES.S) {\n+ pIntent = getActivityIntent(extras, context);\n+ } else {\n+ launchIntent = new Intent(context, CTPushNotificationReceiver.class);\n+ // Take all the properties from the notif and add it to the intent\n+ launchIntent.putExtras(extras);\n+ launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n+\n+ int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\n+ if (VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n+ }\n+ pIntent = PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n+ launchIntent, flagsLaunchPendingIntent);\n+ }\n+ return pIntent;\n+ }\n+\n+ public static PendingIntent getActivityIntent(@NonNull Bundle extras, @NonNull Context context){\n+ Intent launchIntent;\nif (extras.containsKey(Constants.DEEP_LINK_KEY)) {\nlaunchIntent = new Intent(Intent.ACTION_VIEW,\nUri.parse(extras.getString(Constants.DEEP_LINK_KEY)));\n@@ -38,24 +57,14 @@ public class LaunchPendingIntentFactory {\nlaunchIntent.putExtras(extras);\nlaunchIntent.removeExtra(Constants.WZRK_ACTIONS);\n- int flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n- | PendingIntent.FLAG_IMMUTABLE;\n-\n- pIntent = PendingIntent.getActivity(context, (int) System.currentTimeMillis(), launchIntent,\n- flagsLaunchPendingIntent);\n- } else {\n- launchIntent = new Intent(context, CTPushNotificationReceiver.class);\n- // Take all the properties from the notif and add it to the intent\n- launchIntent.putExtras(extras);\n- launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n-\nint flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT;\nif (VERSION.SDK_INT >= VERSION_CODES.M) {\nflagsLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n}\n- pIntent = PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n- launchIntent, flagsLaunchPendingIntent);\n- }\n- return pIntent;\n+\n+ return PendingIntent.getActivity(context, (int) System.currentTimeMillis(), launchIntent,\n+ flagsLaunchPendingIntent);\n+\n+\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -552,8 +552,7 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nprivate void handleProductDisplayNotification(Context context, Bundle extras) {\ntry {\n- int notificationId = extras.getInt(PTConstants.PT_NOTIF_ID);\n- if (buynow == extras.getBoolean(PTConstants.PT_BUY_NOW, false)) {\n+ /*if (buynow == extras.getBoolean(PTConstants.PT_BUY_NOW, false)) {\nnotificationManager.cancel(notificationId);\nString dl = extras.getString(PTConstants.PT_BUY_NOW_DL, deepLinkList.get(0));\nconfig = extras.getParcelable(\"config\");\n@@ -586,16 +585,22 @@ public class PushTemplateReceiver extends BroadcastReceiver {\ncontext.startActivity(launchIntent);\n}\nreturn;\n+ }*/\n+ if (VERSION.SDK_INT >= VERSION_CODES.M) {\n+ int notificationId = extras.getInt(PTConstants.PT_NOTIF_ID);\n+ Notification notification = Utils.getNotificationById(context, notificationId);\n+ if (notification != null) {\n+ contentViewBig = notification.bigContentView;\n+ contentViewSmall = notification.contentView;\n}\n-\nboolean isLinear = false;\nif (pt_product_display_linear == null || pt_product_display_linear.isEmpty()) {\n- contentViewBig = new RemoteViews(context.getPackageName(), R.layout.product_display_template);\n- contentViewSmall = new RemoteViews(context.getPackageName(), R.layout.content_view_small_single_line_msg);\n+ //contentViewBig = new RemoteViews(context.getPackageName(), R.layout.product_display_template);\n+ //contentViewSmall = new RemoteViews(context.getPackageName(), R.layout.content_view_small_single_line_msg);\n} else {\nisLinear = true;\n- contentViewBig = new RemoteViews(context.getPackageName(), R.layout.product_display_linear_expanded);\n- contentViewSmall = new RemoteViews(context.getPackageName(), R.layout.product_display_linear_collapsed);\n+ //contentViewBig = new RemoteViews(context.getPackageName(), R.layout.product_display_linear_expanded);\n+ //contentViewSmall = new RemoteViews(context.getPackageName(), R.layout.product_display_linear_collapsed);\n}\nsetCustomContentViewBasicKeys(contentViewBig, context);\n@@ -613,30 +618,37 @@ public class PushTemplateReceiver extends BroadcastReceiver {\npriceList = extras.getStringArrayList(PTConstants.PT_PRICE_LIST);\nString dl = deepLinkList.get(currentPosition);\n+ if (!isLinear)\n+ {\n+ contentViewBig.setTextViewText(R.id.title, bigTextList.get(currentPosition));\n+ } else {\ncontentViewBig.setTextViewText(R.id.product_name, bigTextList.get(currentPosition));\n+ }\ncontentViewBig.setTextViewText(R.id.msg, smallTextList.get(currentPosition));\ncontentViewBig.setTextViewText(R.id.product_price, priceList.get(currentPosition));\nextras.remove(PTConstants.PT_CURRENT_POSITION);\n- Intent launchIntent = new Intent(context, PTPushNotificationReceiver.class);\n+ Bundle bundleBuyNow = (Bundle) extras.clone();\n+ bundleBuyNow.putBoolean(PTConstants.PT_IMAGE_1, true);\n+ bundleBuyNow.putInt(PTConstants.PT_NOTIF_ID, notificationId);\n+ bundleBuyNow.putString(PTConstants.PT_BUY_NOW_DL, dl);\n+ bundleBuyNow.putBoolean(PTConstants.PT_BUY_NOW, true);\n- PendingIntent pIntent;\n+ contentViewBig.setOnClickPendingIntent(R.id.product_action,\n+ PendingIntentFactory.getCtaLaunchPendingIntent(context,\n+ bundleBuyNow, dl, notificationId));\n- int flagsActionLaunchPendingIntent = 0;\n- if (VERSION.SDK_INT >= VERSION_CODES.M) {\n- flagsActionLaunchPendingIntent |= PendingIntent.FLAG_IMMUTABLE;\n+ NotificationCompat.Builder notificationBuilder;\n+ if (notification!=null)\n+ {\n+ notificationBuilder = new Builder(context, notification);\n+ } else {\n+ notificationBuilder = setBuilderWithChannelIDCheck(requiresChannelId,\n+ PTConstants.PT_SILENT_CHANNEL_ID, context);\n}\n- Intent notificationIntent4 = new Intent(context, PushTemplateReceiver.class);\n- notificationIntent4.putExtra(PTConstants.PT_IMAGE_1, true);\n- notificationIntent4.putExtra(PTConstants.PT_NOTIF_ID, notificationId);\n- notificationIntent4.putExtra(PTConstants.PT_BUY_NOW_DL, dl);\n- notificationIntent4.putExtra(PTConstants.PT_BUY_NOW, true);\n- notificationIntent4.putExtras(extras);\n- PendingIntent contentIntent4 = PendingIntent.getBroadcast(context, new Random().nextInt(), notificationIntent4, flagsActionLaunchPendingIntent);\n- contentViewBig.setOnClickPendingIntent(R.id.product_action, contentIntent4);\n-\n- NotificationCompat.Builder notificationBuilder = setBuilderWithChannelIDCheck(requiresChannelId, PTConstants.PT_SILENT_CHANNEL_ID, context);\n+ Intent launchIntent = new Intent(context, PTPushNotificationReceiver.class);\n+ PendingIntent pIntent;\nif (deepLinkList != null && !deepLinkList.isEmpty()) {\npIntent = setPendingIntent(context, notificationId, extras, launchIntent, dl);\n} else {\n@@ -650,12 +662,21 @@ public class PushTemplateReceiver extends BroadcastReceiver {\ndIntent = setDismissIntent(context, extras, dismissIntent);\nsetSmallIcon(context);\n- setNotificationBuilderBasics(notificationBuilder, contentViewSmall, contentViewBig, pt_title, pIntent, dIntent);\n+ setNotificationBuilderBasics(notificationBuilder, contentViewSmall, contentViewBig, pt_title, pIntent,\n+ dIntent);\n- Notification notification = notificationBuilder.build();\n+ notification = notificationBuilder.build();\nnotificationManager.notify(notificationId, notification);\n}\n+ } else{\n+ extras.putString(Constants.EXTRAS_FROM,\"PTReceiver\");\n+ NotificationHandler notificationHandler = CleverTapAPI.getNotificationHandler();\n+ if (notificationHandler!=null)\n+ {\n+ notificationHandler.onMessageReceived(context,extras,\"FCM\");\n+ }\n+ }\n} catch (Throwable t) {\nPTLog.verbose(\"Error creating product display notification \", t);\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/Utils.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/Utils.java", "diff": "@@ -264,7 +264,7 @@ public class Utils {\nstatic ArrayList<String> getPriceFromExtras(Bundle extras) {\nArrayList<String> stList = new ArrayList<>();\nfor (String key : extras.keySet()) {\n- if (key.contains(\"pt_price\")) {\n+ if (key.contains(\"pt_price\") && !key.contains(\"pt_price_list\")) {\nstList.add(extras.getString(key));\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "diff": "@@ -8,10 +8,14 @@ import android.os.Build.VERSION\nimport android.os.Build.VERSION_CODES\nimport android.os.Bundle\nimport com.clevertap.android.pushtemplates.PTConstants\n+import com.clevertap.android.pushtemplates.PTLog\nimport com.clevertap.android.pushtemplates.PTPushNotificationReceiver\nimport com.clevertap.android.pushtemplates.PushTemplateReceiver\nimport com.clevertap.android.pushtemplates.TemplateRenderer\nimport com.clevertap.android.sdk.Constants\n+import com.clevertap.android.sdk.Utils\n+import com.clevertap.android.sdk.pushnotification.CTNotificationIntentService\n+import com.clevertap.android.sdk.pushnotification.LaunchPendingIntentFactory\nimport java.util.Random\nconst val BASIC_CONTENT_PENDING_INTENT = 1\n@@ -228,28 +232,28 @@ internal object PendingIntentFactory {\nPRODUCT_DISPLAY_DL1_PENDING_INTENT -> {\nval requestCode = Random().nextInt()\n+ launchIntent.putExtras(extras)\nlaunchIntent.putExtra(PTConstants.PT_CURRENT_POSITION, 0)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![0])\n- launchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_DL2_PENDING_INTENT -> {\nval requestCode = Random().nextInt()\n+ launchIntent.putExtras(extras)\nlaunchIntent.putExtra(PTConstants.PT_CURRENT_POSITION, 1)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![1])\n- launchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_DL3_PENDING_INTENT -> {\nval requestCode = Random().nextInt()\n+ launchIntent.putExtras(extras)\nlaunchIntent.putExtra(PTConstants.PT_CURRENT_POSITION, 2)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![2])\n- launchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n}\n@@ -346,4 +350,40 @@ internal object PendingIntentFactory {\nelse -> throw IllegalArgumentException(\"invalid pendingIntentType\")\n}\n}\n+\n+ @JvmStatic\n+ fun getCtaLaunchPendingIntent(context: Context, extras: Bundle, dl: String, notificationId: Int): PendingIntent {\n+ var clazz: Class<*>? = null\n+ try {\n+ clazz = Class.forName(\"com.clevertap.android.sdk.pushnotification.CTNotificationIntentService\")\n+ } catch (ex: ClassNotFoundException) {\n+ PTLog.debug(\"No Intent Service found\")\n+ }\n+\n+ val isCTIntentServiceAvailable = Utils.isServiceAvailable(context, clazz)\n+\n+ return if (VERSION.SDK_INT < VERSION_CODES.S && isCTIntentServiceAvailable) {\n+ extras.putBoolean(\"autoCancel\", true)\n+ extras.putInt(Constants.PT_NOTIF_ID, notificationId)\n+ launchIntent = Intent(CTNotificationIntentService.MAIN_ACTION)\n+ launchIntent.putExtras(extras)\n+ launchIntent.putExtra(\"dl\", dl)\n+ launchIntent.setPackage(context.packageName)\n+ launchIntent.putExtra(Constants.KEY_CT_TYPE, CTNotificationIntentService.TYPE_BUTTON_CLICK)\n+\n+ var flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\n+ if (VERSION.SDK_INT >= VERSION_CODES.M) {\n+ flagsLaunchPendingIntent = flagsLaunchPendingIntent or PendingIntent.FLAG_IMMUTABLE\n+ }\n+ PendingIntent.getService(\n+ context,\n+ System.currentTimeMillis().toInt(),\n+ launchIntent,\n+ flagsLaunchPendingIntent\n+ )\n+ } else {\n+ extras.putString(Constants.DEEP_LINK_KEY, dl)\n+ LaunchPendingIntentFactory.getActivityIntent(extras, context)\n+ }\n+ }\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/ProductDisplayLinearBigContentView.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/ProductDisplayLinearBigContentView.kt", "diff": "@@ -7,21 +7,37 @@ import android.text.Html\nimport android.view.View\nimport android.widget.RemoteViews\nimport com.clevertap.android.pushtemplates.*\n+import com.clevertap.android.sdk.Constants\nimport java.util.ArrayList\nopen class ProductDisplayLinearBigContentView(context: Context,\nrenderer: TemplateRenderer,extras: Bundle,layoutId: Int=R.layout.product_display_linear_expanded):\nContentView(context,layoutId ,renderer) {\n+ protected var productName: String = renderer.bigTextList!![0]\n+ protected var productPrice: String = renderer.priceList!![0]\n+ protected var productMessage: String = renderer.smallTextList!![0]\n+ protected var productDL: String = renderer.deepLinkList!![0]\n+\ninit {\n+ var currentPosition = 0\n+ val extrasFrom = extras.getString(Constants.EXTRAS_FROM,\"\")\n+ if (extrasFrom == \"PTReceiver\") {\n+ currentPosition = extras.getInt(PTConstants.PT_CURRENT_POSITION, 0)\n+ productName = renderer.bigTextList!![currentPosition]\n+ productPrice = renderer.priceList!![currentPosition]\n+ productMessage = renderer.smallTextList!![currentPosition]\n+ productDL = renderer.deepLinkList!![currentPosition]\n+ }\nsetCustomContentViewBasicKeys()\n- if (renderer.bigTextList!!.isNotEmpty()) setCustomContentViewText(R.id.product_name,renderer.bigTextList!![0])\n- if (renderer.priceList!!.isNotEmpty()) setCustomContentViewText(R.id.product_price, renderer.priceList!![0])\n+ if (renderer.bigTextList!!.isNotEmpty()) setCustomContentViewText(R.id.product_name,productName)\n+ if (renderer.priceList!!.isNotEmpty()) setCustomContentViewText(R.id.product_price, productPrice)\nsetCustomContentViewExpandedBackgroundColour(renderer.pt_bg)\nsetCustomContentViewButtonLabel(R.id.product_action,renderer.pt_product_display_action)\nsetCustomContentViewButtonColour(R.id.product_action,renderer.pt_product_display_action_clr)\nsetCustomContentViewButtonText(R.id.product_action,renderer.pt_product_display_action_text_clr)\nsetImageList(extras)\n+ remoteView.setDisplayedChild(R.id.carousel_image, currentPosition)\nsetCustomContentViewDotSep()\nsetCustomContentViewSmallIcon()\n@@ -40,8 +56,13 @@ open class ProductDisplayLinearBigContentView(context: Context,\nrenderer.notificationId, extras,false, PRODUCT_DISPLAY_DL3_PENDING_INTENT,renderer))\n}\n- remoteView.setOnClickPendingIntent(R.id.product_action, PendingIntentFactory.getPendingIntent(context,\n- renderer.notificationId, extras,false, PRODUCT_DISPLAY_BUY_NOW_PENDING_INTENT,renderer))\n+ val bundleBuyNow = extras.clone() as Bundle\n+ bundleBuyNow.putBoolean(PTConstants.PT_IMAGE_1, true)\n+ bundleBuyNow.putInt(PTConstants.PT_NOTIF_ID, renderer.notificationId)\n+ bundleBuyNow.putString(PTConstants.PT_BUY_NOW_DL, productDL)\n+ bundleBuyNow.putBoolean(PTConstants.PT_BUY_NOW, true)\n+ remoteView.setOnClickPendingIntent(R.id.product_action, PendingIntentFactory.getCtaLaunchPendingIntent(context,\n+ bundleBuyNow,productDL,renderer.notificationId))\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/ProductDisplayNonLinearBigContentView.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/ProductDisplayNonLinearBigContentView.kt", "diff": "@@ -11,12 +11,10 @@ class ProductDisplayNonLinearBigContentView(context: Context, renderer: Template\nProductDisplayLinearBigContentView(context, renderer,extras, R.layout.product_display_template) {\ninit {\n- if (renderer.smallTextList!!.isNotEmpty())\n- setCustomContentViewText(R.id.msg, renderer.smallTextList!![0])\n- setCustomContentViewTitle(renderer.pt_title)\n- setCustomContentViewMessage(renderer.pt_msg)\n+ setCustomContentViewTitle(productName)\n+ setCustomContentViewMessage(productMessage)\nsetCustomContentViewElementColour(R.id.msg, renderer.pt_msg_clr)\n- setCustomContentViewElementColour(R.id.product_name, renderer.pt_title_clr)\n+ setCustomContentViewElementColour(R.id.title, renderer.pt_title_clr)\n}\nprivate fun setCustomContentViewElementColour(rId: Int, colour: String?) {\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Update Product display for Android 12 trampoline and proper rendering below api 30 SDK-1056
116,616
13.12.2021 14:20:24
-19,080
e3c315b38531efe2ff849acdd469a09d38db06a2
task(refactor) - Updated ProductDisplay(L/NL) layouts
[ { "change_type": "MODIFY", "old_path": "clevertap-pushtemplate/src/main/java/com/clevertap/android/pushtemplates/styles/ProductDisplayStyle.kt", "new_path": "clevertap-pushtemplate/src/main/java/com/clevertap/android/pushtemplates/styles/ProductDisplayStyle.kt", "diff": "@@ -10,11 +10,12 @@ import com.clevertap.android.pushtemplates.content.PendingIntentFactory\nclass ProductDisplayStyle(private var renderer: TemplateRenderer, private var extras: Bundle): Style(renderer) {\noverride fun makeSmallContentView(context: Context, renderer: TemplateRenderer): RemoteViews {\n- return if (renderer.pt_product_display_linear == null || renderer.pt_product_display_linear!!.isEmpty()) {\n+ return ProductDisplayNonLinearSmallContentView(context, renderer).remoteView\n+ /*if (renderer.pt_product_display_linear == null || renderer.pt_product_display_linear!!.isEmpty()) {\nProductDisplayNonLinearSmallContentView(context, renderer).remoteView\n}else{\n- ProductDisplayLinearSmallContentView(context, renderer,extras).remoteView\n- }\n+ ProductDisplayNonLinearSmallContentView(context, renderer).remoteView\n+ }*/ //For both linear and non-linear collapsed view layout will be the same\n}\noverride fun makeBigContentView(context: Context, renderer: TemplateRenderer): RemoteViews {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplate/src/main/res/layout-v31/content_view_small_multi_line_msg.xml", "new_path": "clevertap-pushtemplate/src/main/res/layout-v31/content_view_small_multi_line_msg.xml", "diff": "<RelativeLayout\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"wrap_content\"\n- android:layout_margin=\"4dp\"\nandroid:id=\"@+id/rel_lyt\">\n<TextView\nandroid:layout_alignStart=\"@id/title\"\nandroid:layout_alignParentStart=\"true\"\nandroid:layout_toStartOf=\"@+id/large_icon\"\n+ android:maxLines=\"3\"\n+ android:ellipsize=\"end\"\nandroid:text=\"message message\"\nandroid:textAppearance=\"@style/PushMessageMultiLine\"\n/>\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplate/src/main/res/layout-v31/product_display_linear_expanded.xml", "new_path": "clevertap-pushtemplate/src/main/res/layout-v31/product_display_linear_expanded.xml", "diff": "android:layout_height=\"wrap_content\"\nandroid:background=\"@android:color/white\"\nandroid:orientation=\"vertical\"\n- android:clipToPadding=\"false\"\n- android:padding=\"4dp\">\n+ android:clipToPadding=\"false\">\n<LinearLayout\nandroid:layout_width=\"match_parent\"\nandroid:id=\"@+id/carousel_image\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"140dp\"\n- android:layout_marginLeft=\"-8dp\"\n- android:layout_marginRight=\"-8dp\"\nandroid:layout_weight=\"4.5\"\nandroid:inAnimation=\"@anim/fade_in\"\nandroid:outAnimation=\"@anim/fade_out\" />\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplate/src/main/res/layout-v31/product_display_template.xml", "new_path": "clevertap-pushtemplate/src/main/res/layout-v31/product_display_template.xml", "diff": "android:id=\"@+id/carousel_relative_layout\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"200dp\"\n- android:layout_marginTop=\"8dp\"\n+ android:layout_marginTop=\"4dp\"\nandroid:weightSum=\"1\">\n<ViewFlipper\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplate/src/main/res/layout/content_view_small_multi_line_msg.xml", "new_path": "clevertap-pushtemplate/src/main/res/layout/content_view_small_multi_line_msg.xml", "diff": "android:layout_alignStart=\"@id/title\"\nandroid:layout_alignParentStart=\"true\"\nandroid:layout_toStartOf=\"@+id/large_icon\"\n+ android:maxLines=\"3\"\n+ android:ellipsize=\"end\"\nandroid:text=\"message message\"\nandroid:textAppearance=\"@style/PushMessageMultiLine\"\n/>\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplate/src/main/res/layout/product_display_template.xml", "new_path": "clevertap-pushtemplate/src/main/res/layout/product_display_template.xml", "diff": "android:layout_width=\"match_parent\"\nandroid:layout_height=\"wrap_content\"\nandroid:orientation=\"vertical\"\n- android:padding=\"16dp\"\nandroid:id=\"@+id/content_view_big\">\n<include\nandroid:id=\"@+id/carousel_relative_layout\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"200dp\"\n- android:layout_marginTop=\"8dp\"\n+ android:layout_marginLeft=\"16dp\"\n+ android:layout_marginRight=\"16dp\"\nandroid:weightSum=\"1\">\n<ViewFlipper\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplate/src/main/res/values/dimens.xml", "new_path": "clevertap-pushtemplate/src/main/res/values/dimens.xml", "diff": "<dimen name=\"padding_horizontal\">16dp</dimen>\n<dimen name=\"padding_vertical\">4dp</dimen>\n- <dimen name=\"title_font_size\">11sp</dimen>\n- <dimen name=\"msg_font_size\">11sp</dimen>\n+ <dimen name=\"title_font_size\">12sp</dimen>\n+ <dimen name=\"msg_font_size\">12sp</dimen>\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor) - Updated ProductDisplay(L/NL) layouts
116,612
14.12.2021 10:34:44
-19,080
38b8313b7626d43f581cf335145912174ea9af22
task(Android 12): Update Rating for Android 12 trampoline and proper rendering below api 30
[ { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PTConstants.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PTConstants.java", "diff": "@@ -93,4 +93,5 @@ public class PTConstants {\npublic static final String PT_PRODUCT_DISPLAY_ACTION_TEXT_CLR_DEFAULT = PT_COLOUR_WHITE;\npublic static final int PT_CONNECTION_TIMEOUT = 10 * ONE_SECOND;\npublic static final int PT_FLIP_INTERVAL_TIME = 4 * ONE_SECOND;\n+ public static final String KEY_CLICKED_STAR = \"clickedStar\";\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -29,9 +29,8 @@ import com.clevertap.android.sdk.Constants;\nimport com.clevertap.android.sdk.interfaces.NotificationHandler;\nimport com.clevertap.android.sdk.pushnotification.CTNotificationIntentService;\n+import com.clevertap.android.sdk.pushnotification.LaunchPendingIntentFactory;\nimport java.util.ArrayList;\n-import java.util.HashMap;\n-import java.util.Random;\nimport static android.content.Context.NOTIFICATION_SERVICE;\nimport static com.clevertap.android.pushtemplates.content.PendingIntentFactoryKt.MANUAL_CAROUSEL_CONTENT_PENDING_INTENT;\n@@ -369,22 +368,25 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nprivate void handleRatingNotification(Context context, Bundle extras) {\ntry {\nint notificationId = extras.getInt(PTConstants.PT_NOTIF_ID);\n+\nif (extras.getBoolean(PTConstants.DEFAULT_DL, false)) {\nconfig = extras.getParcelable(\"config\");\nnotificationManager.cancel(notificationId);\nIntent launchIntent;\nClass clazz = null;\ntry {\n- clazz = Class.forName(\"com.clevertap.android.sdk.pushnotification.CTNotificationIntentService\");\n+ clazz = Class\n+ .forName(\"com.clevertap.android.sdk.pushnotification.CTNotificationIntentService\");\n} catch (ClassNotFoundException ex) {\nPTLog.debug(\"No Intent Service found\");\n}\n- boolean isPTIntentServiceAvailable = com.clevertap.android.sdk.Utils.isServiceAvailable(context, clazz);\n+ boolean isPTIntentServiceAvailable = com.clevertap.android.sdk.Utils\n+ .isServiceAvailable(context, clazz);\nif (isPTIntentServiceAvailable) {\nlaunchIntent = new Intent(CTNotificationIntentService.MAIN_ACTION);\nlaunchIntent.setPackage(context.getPackageName());\n- launchIntent.putExtra(\"pt_type\", TYPE_BUTTON_CLICK);\n+ launchIntent.putExtra(Constants.KEY_CT_TYPE, TYPE_BUTTON_CLICK);\nlaunchIntent.putExtras(extras);\nlaunchIntent.putExtra(\"dl\", pt_rating_default_dl);\ncontext.startService(launchIntent);\n@@ -392,7 +394,8 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nlaunchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(pt_rating_default_dl));\nlaunchIntent.removeExtra(Constants.WZRK_ACTIONS);\nlaunchIntent.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM);\n- launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);\n+ launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP\n+ | Intent.FLAG_ACTIVITY_NEW_TASK);\nUtils.raiseNotificationClicked(context, extras, config);\nlaunchIntent.putExtras(extras);\nlaunchIntent.putExtra(Constants.DEEP_LINK_KEY, pt_rating_default_dl);\n@@ -401,11 +404,60 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nreturn;\n}\n+\n+ String pt_dl_clicked = deepLinkList.get(0);\n+\n+ if (1 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\n+ extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 1);\n+ if (deepLinkList.size() > 0) {\n+ pt_dl_clicked = deepLinkList.get(0);\n+ }\n+ }\n+ if (2 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\n+ extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 2);\n+ if (deepLinkList.size() > 1) {\n+ pt_dl_clicked = deepLinkList.get(1);\n+ } else {\n+ pt_dl_clicked = deepLinkList.get(0);\n+ }\n+ }\n+ if (3 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\n+ extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 3);\n+ if (deepLinkList.size() > 2) {\n+ pt_dl_clicked = deepLinkList.get(2);\n+ } else {\n+ pt_dl_clicked = deepLinkList.get(0);\n+ }\n+ }\n+ if (4 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\n+ extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 4);\n+ if (deepLinkList.size() > 3) {\n+ pt_dl_clicked = deepLinkList.get(3);\n+ } else {\n+ pt_dl_clicked = deepLinkList.get(0);\n+ }\n+ }\n+ if (5 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\n+ extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 5);\n+ if (deepLinkList.size() > 4) {\n+ pt_dl_clicked = deepLinkList.get(4);\n+ } else {\n+ pt_dl_clicked = deepLinkList.get(0);\n+ }\n+ }\n+\n+ if (VERSION.SDK_INT >= VERSION_CODES.M) {\n+ Notification notification = Utils.getNotificationById(context, notificationId);\n+ if (notification != null) {\n+ contentViewRating = notification.bigContentView;\n+ contentViewSmall = notification.contentView;\n+ }\n//Set RemoteViews again\n- contentViewRating = new RemoteViews(context.getPackageName(), R.layout.rating);\n+ /*contentViewRating = new RemoteViews(context.getPackageName(), R.layout.rating);\nsetCustomContentViewBasicKeys(contentViewRating, context);\n- contentViewSmall = new RemoteViews(context.getPackageName(), R.layout.content_view_small_single_line_msg);\n+ contentViewSmall = new RemoteViews(context.getPackageName(),\n+ R.layout.content_view_small_single_line_msg);\nsetCustomContentViewBasicKeys(contentViewSmall, context);\n@@ -424,92 +476,151 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nsetCustomContentViewMessageColour(contentViewSmall, pt_msg_clr);\nsetCustomContentViewExpandedBackgroundColour(contentViewRating, pt_bg);\n- setCustomContentViewCollapsedBackgroundColour(contentViewSmall, pt_bg);\n+ setCustomContentViewCollapsedBackgroundColour(contentViewSmall, pt_bg);*/\n- String pt_dl_clicked = deepLinkList.get(0);\n+ //String pt_dl_clicked = deepLinkList.get(0);\n- if (clicked1 == extras.getBoolean(\"click1\", false)) {\n+ if (1 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\ncontentViewRating.setImageViewResource(R.id.star1, R.drawable.pt_star_filled);\n- extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 1);\n- Utils.raiseNotificationClicked(context, extras, config);\n+ /*contentViewRating.setImageViewResource(R.id.star2, R.drawable.pt_star_outline);\n+ contentViewRating.setImageViewResource(R.id.star3, R.drawable.pt_star_outline);\n+ contentViewRating.setImageViewResource(R.id.star4, R.drawable.pt_star_outline);\n+ contentViewRating.setImageViewResource(R.id.star5, R.drawable.pt_star_outline);*/\n+ //extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 1);\n+ //Utils.raiseNotificationClicked(context, extras, config);\nclicked1 = false;\n- if (deepLinkList.size() > 0) {\n+ /*if (deepLinkList.size() > 0) {\npt_dl_clicked = deepLinkList.get(0);\n- }\n+ }*/\n} else {\ncontentViewRating.setImageViewResource(R.id.star1, R.drawable.pt_star_outline);\n}\n- if (clicked2 == extras.getBoolean(\"click2\", false)) {\n+ if (2 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\ncontentViewRating.setImageViewResource(R.id.star1, R.drawable.pt_star_filled);\ncontentViewRating.setImageViewResource(R.id.star2, R.drawable.pt_star_filled);\n- extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 2);\n- Utils.raiseNotificationClicked(context, extras, config);\n+ /*contentViewRating.setImageViewResource(R.id.star3, R.drawable.pt_star_outline);\n+ contentViewRating.setImageViewResource(R.id.star4, R.drawable.pt_star_outline);\n+ contentViewRating.setImageViewResource(R.id.star5, R.drawable.pt_star_outline);*/\n+ //extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 2);\n+ //Utils.raiseNotificationClicked(context, extras, config);\nclicked2 = false;\n- if (deepLinkList.size() > 1) {\n+ /*if (deepLinkList.size() > 1) {\npt_dl_clicked = deepLinkList.get(1);\n} else {\npt_dl_clicked = deepLinkList.get(0);\n- }\n+ }*/\n} else {\ncontentViewRating.setImageViewResource(R.id.star2, R.drawable.pt_star_outline);\n}\n- if (clicked3 == extras.getBoolean(\"click3\", false)) {\n+ if (3 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\ncontentViewRating.setImageViewResource(R.id.star1, R.drawable.pt_star_filled);\ncontentViewRating.setImageViewResource(R.id.star2, R.drawable.pt_star_filled);\ncontentViewRating.setImageViewResource(R.id.star3, R.drawable.pt_star_filled);\n- extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 3);\n- Utils.raiseNotificationClicked(context, extras, config);\n+ /*contentViewRating.setImageViewResource(R.id.star4, R.drawable.pt_star_outline);\n+ contentViewRating.setImageViewResource(R.id.star5, R.drawable.pt_star_outline);*/\n+ //extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 3);\n+ //Utils.raiseNotificationClicked(context, extras, config);\nclicked3 = false;\n- if (deepLinkList.size() > 2) {\n+ /*if (deepLinkList.size() > 2) {\npt_dl_clicked = deepLinkList.get(2);\n} else {\npt_dl_clicked = deepLinkList.get(0);\n- }\n+ }*/\n} else {\ncontentViewRating.setImageViewResource(R.id.star3, R.drawable.pt_star_outline);\n}\n- if (clicked4 == extras.getBoolean(\"click4\", false)) {\n+ if (4 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\ncontentViewRating.setImageViewResource(R.id.star1, R.drawable.pt_star_filled);\ncontentViewRating.setImageViewResource(R.id.star2, R.drawable.pt_star_filled);\ncontentViewRating.setImageViewResource(R.id.star3, R.drawable.pt_star_filled);\ncontentViewRating.setImageViewResource(R.id.star4, R.drawable.pt_star_filled);\n- extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 4);\n- Utils.raiseNotificationClicked(context, extras, config);\n+ //contentViewRating.setImageViewResource(R.id.star5, R.drawable.pt_star_outline);\n+ //extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 4);\n+ //Utils.raiseNotificationClicked(context, extras, config);\nclicked4 = false;\n- if (deepLinkList.size() > 3) {\n+ /*if (deepLinkList.size() > 3) {\npt_dl_clicked = deepLinkList.get(3);\n} else {\npt_dl_clicked = deepLinkList.get(0);\n- }\n+ }*/\n} else {\ncontentViewRating.setImageViewResource(R.id.star4, R.drawable.pt_star_outline);\n}\n- if (clicked5 == extras.getBoolean(\"click5\", false)) {\n+ if (5 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\ncontentViewRating.setImageViewResource(R.id.star1, R.drawable.pt_star_filled);\ncontentViewRating.setImageViewResource(R.id.star2, R.drawable.pt_star_filled);\ncontentViewRating.setImageViewResource(R.id.star3, R.drawable.pt_star_filled);\ncontentViewRating.setImageViewResource(R.id.star4, R.drawable.pt_star_filled);\ncontentViewRating.setImageViewResource(R.id.star5, R.drawable.pt_star_filled);\n- extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 5);\n- Utils.raiseNotificationClicked(context, extras, config);\n+ //extras.putString(Constants.KEY_C2A, PTConstants.PT_RATING_C2A_KEY + 5);\n+ //Utils.raiseNotificationClicked(context, extras, config);\nclicked5 = false;\n- if (deepLinkList.size() > 4) {\n+ /*if (deepLinkList.size() > 4) {\npt_dl_clicked = deepLinkList.get(4);\n} else {\npt_dl_clicked = deepLinkList.get(0);\n- }\n+ }*/\n} else {\ncontentViewRating.setImageViewResource(R.id.star5, R.drawable.pt_star_outline);\n}\n+ /*if (6 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\n+ //Thread.sleep(1000);\n+ notificationManager.cancel(notificationId);\n+ Utils.raiseNotificationClicked(context, extras, config);\n+\n+ setToast(context, pt_rating_toast);\n+\n+ if (VERSION.SDK_INT < VERSION_CODES.S)\n+ {\n+ Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);\n+ context.sendBroadcast(it);\n+ }\n+\n+ Intent launchIntent;\n+ if (extras.containsKey(Constants.DEEP_LINK_KEY)) {\n+ launchIntent = new Intent(Intent.ACTION_VIEW,\n+ Uri.parse(extras.getString(Constants.DEEP_LINK_KEY)));\n+ com.clevertap.android.sdk.Utils.setPackageNameFromResolveInfoList(context, launchIntent);\n+ } else {\n+ launchIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());\n+ if (launchIntent == null) {\n+ return;\n+ }\n+ }\n+\n+ launchIntent.putExtras(extras);\n+ launchIntent.removeExtra(Constants.WZRK_ACTIONS);\n+ launchIntent.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM);\n+ launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);\n+ context.startActivity(launchIntent);\n+ } else {*/ // rating is clicked\n+ extras.putString(Constants.DEEP_LINK_KEY, pt_dl_clicked);\n+ contentViewRating.setOnClickPendingIntent(R.id.tVRatingConfirmation,\n+ LaunchPendingIntentFactory.getActivityIntent(extras,context));\n+\n+\n+ /*contentViewRating.setOnClickPendingIntent(R.id.star1, PendingIntentFactory.getPendingIntent(context,\n+ notificationId, extras, false, RATING_CLICK1_PENDING_INTENT, null));\n+ contentViewRating.setOnClickPendingIntent(R.id.star2, PendingIntentFactory.getPendingIntent(context,\n+ notificationId, extras, false, RATING_CLICK2_PENDING_INTENT, null));\n+ contentViewRating.setOnClickPendingIntent(R.id.star3, PendingIntentFactory.getPendingIntent(context,\n+ notificationId, extras, false, RATING_CLICK3_PENDING_INTENT, null));\n+ contentViewRating.setOnClickPendingIntent(R.id.star4, PendingIntentFactory.getPendingIntent(context,\n+ notificationId, extras, false, RATING_CLICK4_PENDING_INTENT, null));\n+ contentViewRating.setOnClickPendingIntent(R.id.star5, PendingIntentFactory.getPendingIntent(context,\n+ notificationId, extras, false, RATING_CLICK5_PENDING_INTENT, null));*/\n+\nsetSmallIcon(context);\nNotificationCompat.Builder notificationBuilder;\n- if (requiresChannelId) {\n- notificationBuilder = new NotificationCompat.Builder(context, PTConstants.PT_SILENT_CHANNEL_ID);\n+ if (notification!=null)\n+ {\n+ notificationBuilder = new Builder(context, notification);\n} else {\n- notificationBuilder = new NotificationCompat.Builder(context);\n+ notificationBuilder = setBuilderWithChannelIDCheck(requiresChannelId,\n+ PTConstants.PT_SILENT_CHANNEL_ID, context);\n}\nIntent dismissIntent = new Intent(context, PushTemplateReceiver.class);\nPendingIntent dIntent;\n@@ -524,10 +635,36 @@ public class PushTemplateReceiver extends BroadcastReceiver {\n.setDeleteIntent(dIntent)\n.setAutoCancel(true);\n- Notification notification = notificationBuilder.build();\n+ notification = notificationBuilder.build();\nnotificationManager.notify(notificationId, notification);\n+ }\n+\n+ if (VERSION.SDK_INT < VERSION_CODES.S)\n+ {\n+ Utils.raiseNotificationClicked(context, extras, config);\n+ handleRatingDeepLink(context, extras, notificationId, pt_dl_clicked);\n+ }\n+ } else{\n+ extras.putString(Constants.EXTRAS_FROM,\"PTReceiver\");\n+ Bundle clonedExtras = (Bundle) extras.clone();\n+ NotificationHandler notificationHandler = CleverTapAPI.getNotificationHandler();\n+ if (notificationHandler!=null)\n+ {\n+ notificationHandler.onMessageReceived(context,extras,\"FCM\");\n+ clonedExtras.putString(Constants.DEEP_LINK_KEY, pt_dl_clicked);\n+ Utils.raiseNotificationClicked(context, clonedExtras, config);\n+ handleRatingDeepLink(context, clonedExtras, notificationId, pt_dl_clicked);\n+ }\n+ }\n+ //}\n+ } catch (Throwable t) {\n+ PTLog.verbose(\"Error creating rating notification \", t);\n+ }\n+ }\n+ private void handleRatingDeepLink(final Context context, final Bundle extras, final int notificationId,\n+ final String pt_dl_clicked) throws InterruptedException {\nThread.sleep(1000);\nnotificationManager.cancel(notificationId);\n@@ -536,20 +673,26 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nIntent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);\ncontext.sendBroadcast(it);\n- Intent launchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(pt_dl_clicked));\n+ Intent launchIntent;\n+ if (extras.containsKey(Constants.DEEP_LINK_KEY)) {\n+ launchIntent = new Intent(Intent.ACTION_VIEW,\n+ Uri.parse(extras.getString(Constants.DEEP_LINK_KEY)));\n+ com.clevertap.android.sdk.Utils.setPackageNameFromResolveInfoList(context, launchIntent);\n+ } else {\n+ launchIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());\n+ if (launchIntent == null) {\n+ return;\n+ }\n+ }\nlaunchIntent.putExtras(extras);\nlaunchIntent.putExtra(Constants.DEEP_LINK_KEY, pt_dl_clicked);\nlaunchIntent.removeExtra(Constants.WZRK_ACTIONS);\nlaunchIntent.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM);\n- launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);\n+ launchIntent.setFlags(\n+ Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);\ncontext.startActivity(launchIntent);\n}\n- } catch (Throwable t) {\n- PTLog.verbose(\"Error creating rating notification \", t);\n- }\n- }\n-\nprivate void handleProductDisplayNotification(Context context, Bundle extras) {\ntry {\n/*if (buynow == extras.getBoolean(PTConstants.PT_BUY_NOW, false)) {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "diff": "@@ -30,6 +30,7 @@ const val RATING_CLICK2_PENDING_INTENT = 9\nconst val RATING_CLICK3_PENDING_INTENT = 10\nconst val RATING_CLICK4_PENDING_INTENT = 11\nconst val RATING_CLICK5_PENDING_INTENT = 12\n+//const val RATING_CLICK_CONFIRM_PENDING_INTENT = 120\nconst val FIVE_ICON_CONTENT_PENDING_INTENT = 13\nconst val FIVE_ICON_CTA1_PENDING_INTENT = 14\nconst val FIVE_ICON_CTA2_PENDING_INTENT = 15\n@@ -50,6 +51,7 @@ const val ZERO_BEZEL_CONTENT_PENDING_INTENT = 29\nconst val TIMER_CONTENT_PENDING_INTENT = 30\nconst val INPUT_BOX_CONTENT_PENDING_INTENT = 31\nconst val INPUT_BOX_REPLY_PENDING_INTENT = 32\n+const val RATING_CONFIRM_PENDING_INTENT = 33\ninternal object PendingIntentFactory {\n@@ -178,45 +180,58 @@ internal object PendingIntentFactory {\n}\nRATING_CLICK1_PENDING_INTENT -> {\n+ launchIntent.putExtras(extras)\nlaunchIntent.putExtra(\"click1\", true)\n+ launchIntent.putExtra(\"clickedStar\", 1)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer?.config)\n- launchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nRATING_CLICK2_PENDING_INTENT -> {\n+ launchIntent.putExtras(extras)\nlaunchIntent.putExtra(\"click2\", true)\n+ launchIntent.putExtra(\"clickedStar\", 2)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer?.config)\n- launchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nRATING_CLICK3_PENDING_INTENT -> {\n+ launchIntent.putExtras(extras)\nlaunchIntent.putExtra(\"click3\", true)\n+ launchIntent.putExtra(\"clickedStar\", 3)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer?.config)\n- launchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nRATING_CLICK4_PENDING_INTENT -> {\n+ launchIntent.putExtras(extras)\nlaunchIntent.putExtra(\"click4\", true)\n+ launchIntent.putExtra(\"clickedStar\", 4)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer?.config)\n- launchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\nRATING_CLICK5_PENDING_INTENT -> {\n+ launchIntent.putExtras(extras)\nlaunchIntent.putExtra(\"click5\", true)\n+ launchIntent.putExtra(\"clickedStar\", 5)\nlaunchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\nlaunchIntent.putExtra(\"config\", renderer?.config)\n- launchIntent.putExtras(extras)\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}\n+ /* RATING_CLICK_CONFIRM_PENDING_INTENT -> {\n+ launchIntent.putExtras(extras)\n+ launchIntent.putExtra(\"clickedStar\", 6)\n+ launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ //launchIntent.putExtra(\"config\", renderer?.config)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n+ }*/\n+\nFIVE_ICON_CONTENT_PENDING_INTENT -> {\nextras.putString(Constants.DEEP_LINK_KEY, null)\nreturn setPendingIntent(context, notificationId, extras, launchIntent)\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/RatingContentView.kt", "new_path": "clevertap-pushTemplate/src/main/java/com/clevertap/android/pushtemplates/content/RatingContentView.kt", "diff": "package com.clevertap.android.pushtemplates.content\nimport android.content.Context\n+import android.os.Build.VERSION\n+import android.os.Build.VERSION_CODES\nimport android.os.Bundle\n+import android.view.View\n+import com.clevertap.android.pushtemplates.PTConstants\nimport com.clevertap.android.pushtemplates.R\n+import com.clevertap.android.pushtemplates.R.drawable\n+import com.clevertap.android.pushtemplates.R.id\nimport com.clevertap.android.pushtemplates.TemplateRenderer\n+import com.clevertap.android.sdk.Constants\n+import com.clevertap.android.sdk.pushnotification.LaunchPendingIntentFactory\nclass RatingContentView(context: Context, renderer: TemplateRenderer, extras: Bundle):\nBigImageContentView(context,renderer,R.layout.rating) {\n@@ -26,6 +34,55 @@ class RatingContentView(context: Context, renderer: TemplateRenderer, extras: Bu\nrenderer.notificationId, extras,false,RATING_CLICK4_PENDING_INTENT,renderer))\nremoteView.setOnClickPendingIntent(R.id.star5, PendingIntentFactory.getPendingIntent(context,\nrenderer.notificationId, extras,false,RATING_CLICK5_PENDING_INTENT,renderer))\n+\n+ if(VERSION.SDK_INT >= VERSION_CODES.S){\n+ remoteView.setViewVisibility(R.id.tVRatingConfirmation, View.VISIBLE)\n+ extras.putInt(PTConstants.PT_NOTIF_ID,renderer.notificationId)\n+ remoteView.setOnClickPendingIntent(R.id.tVRatingConfirmation,\n+ LaunchPendingIntentFactory.getActivityIntent(extras,context))\n+ } else{\n+ remoteView.setViewVisibility(R.id.tVRatingConfirmation, View.GONE)\n+ }\n+ val extrasFrom = extras.getString(Constants.EXTRAS_FROM,\"\")\n+ if (extrasFrom == \"PTReceiver\") {\n+ if (1 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\n+ remoteView.setImageViewResource(id.star1, drawable.pt_star_filled)\n+ } else {\n+ remoteView.setImageViewResource(id.star1, drawable.pt_star_outline)\n+ }\n+ if (2 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\n+ remoteView.setImageViewResource(id.star1, drawable.pt_star_filled)\n+ remoteView.setImageViewResource(id.star2, drawable.pt_star_filled)\n+ } else {\n+ remoteView.setImageViewResource(id.star2, drawable.pt_star_outline)\n+ }\n+ if (3 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\n+ remoteView.setImageViewResource(id.star1, drawable.pt_star_filled)\n+ remoteView.setImageViewResource(id.star2, drawable.pt_star_filled)\n+ remoteView.setImageViewResource(id.star3, drawable.pt_star_filled)\n+ } else {\n+ remoteView.setImageViewResource(id.star3, drawable.pt_star_outline)\n+ }\n+ if (4 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\n+ remoteView.setImageViewResource(id.star1, drawable.pt_star_filled)\n+ remoteView.setImageViewResource(id.star2, drawable.pt_star_filled)\n+ remoteView.setImageViewResource(id.star3, drawable.pt_star_filled)\n+ remoteView.setImageViewResource(id.star4, drawable.pt_star_filled)\n+ } else {\n+ remoteView.setImageViewResource(id.star4, drawable.pt_star_outline)\n+ }\n+ if (5 == extras.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {\n+ remoteView.setImageViewResource(id.star1, drawable.pt_star_filled)\n+ remoteView.setImageViewResource(id.star2, drawable.pt_star_filled)\n+ remoteView.setImageViewResource(id.star3, drawable.pt_star_filled)\n+ remoteView.setImageViewResource(id.star4, drawable.pt_star_filled)\n+ remoteView.setImageViewResource(id.star5, drawable.pt_star_filled)\n+ } else {\n+ remoteView.setImageViewResource(id.star5, drawable.pt_star_outline)\n+ }\n+\n+ }\n+\n}\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushTemplate/src/main/res/layout/rating.xml", "new_path": "clevertap-pushTemplate/src/main/res/layout/rating.xml", "diff": "android:src=\"@drawable/pt_star_outline\" />\n</LinearLayout>\n-\n+ <TextView\n+ android:id=\"@+id/tVRatingConfirmation\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:paddingTop=\"10dp\"\n+ android:paddingBottom=\"10dp\"\n+ android:text=\"Confirm\"\n+ android:background=\"#FFFFFF\"\n+ android:gravity=\"center\"\n+ android:textAppearance=\"@style/PushTitle\"\n+ android:visibility=\"gone\"/>\n</LinearLayout>\n</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/MyApplication.kt", "new_path": "sample/src/main/java/com/clevertap/demo/MyApplication.kt", "diff": "package com.clevertap.demo\n+import android.app.Activity\n+import android.app.Application.ActivityLifecycleCallbacks\nimport android.app.NotificationManager\nimport android.content.Context\nimport android.content.Intent\n+import android.os.Bundle\nimport android.util.Log\nimport androidx.multidex.MultiDex\nimport androidx.multidex.MultiDexApplication\n@@ -19,7 +22,7 @@ import com.google.android.gms.security.ProviderInstaller.ProviderInstallListener\nimport org.json.JSONObject\nimport java.util.HashMap\n-class MyApplication : MultiDexApplication(), CTPushNotificationListener {\n+class MyApplication : MultiDexApplication(), CTPushNotificationListener, ActivityLifecycleCallbacks {\noverride fun onCreate() {\n@@ -27,6 +30,7 @@ class MyApplication : MultiDexApplication(), CTPushNotificationListener {\nTemplateRenderer.debugLevel = 3;\nCleverTapAPI.setNotificationHandler(PushTemplateNotificationHandler() as NotificationHandler);\nActivityLifecycleCallback.register(this)\n+ registerActivityLifecycleCallbacks(this)\nsuper.onCreate()\nProviderInstaller.installIfNeededAsync(this, object : ProviderInstallListener {\n@@ -67,11 +71,44 @@ class MyApplication : MultiDexApplication(), CTPushNotificationListener {\n}\noverride fun onNotificationClickedPayloadReceived(payload: HashMap<String, Any>?) {\n+\nLog.i(\"MyApplication\", \"onNotificationClickedPayloadReceived = $payload\")\n+ if (payload?.containsKey(\"pt_id\") == true && payload[\"pt_id\"] ==\"pt_rating\")\n+ {\n+ val nm = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager\n+ nm.cancel(payload[\"notificationId\"] as Int)\n+ }\n}\noverride fun attachBaseContext(base: Context?) {\nsuper.attachBaseContext(base)\nMultiDex.install(this)\n}\n+\n+ override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {\n+ }\n+\n+ override fun onActivityStarted(activity: Activity) {\n+ }\n+\n+ override fun onActivityResumed(activity: Activity) {\n+ val payload = activity.intent?.extras\n+ if (payload?.containsKey(\"pt_id\") == true && payload[\"pt_id\"] ==\"pt_rating\")\n+ {\n+ val nm = activity.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager\n+ nm.cancel(payload[\"notificationId\"] as Int)\n+ }\n+ }\n+\n+ override fun onActivityPaused(activity: Activity) {\n+ }\n+\n+ override fun onActivityStopped(activity: Activity) {\n+ }\n+\n+ override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {\n+ }\n+\n+ override fun onActivityDestroyed(activity: Activity) {\n+ }\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/WebViewActivity.kt", "new_path": "sample/src/main/java/com/clevertap/demo/WebViewActivity.kt", "diff": "package com.clevertap.demo\nimport android.annotation.SuppressLint\n+import android.app.NotificationManager\n+import android.content.Context\n+import android.content.Intent\nimport android.os.Build\nimport android.os.Bundle\nimport android.webkit.WebView\n@@ -25,4 +28,14 @@ class WebViewActivity : AppCompatActivity() {\naddJavascriptInterface(CTWebInterface(CleverTapAPI.getDefaultInstance(this@WebViewActivity)), \"CleverTap\")\n}\n}\n+\n+ override fun onNewIntent(intent: Intent?) {\n+ super.onNewIntent(intent)\n+ val payload = intent?.extras\n+ if (payload?.containsKey(\"pt_id\") == true && payload[\"pt_id\"] ==\"pt_rating\")\n+ {\n+ val nm = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager\n+ nm.cancel(payload[\"notificationId\"] as Int)\n+ }\n+ }\n}\n\\ No newline at end of file\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Update Rating for Android 12 trampoline and proper rendering below api 30 SDK-1056
116,612
14.12.2021 16:48:42
-19,080
be3d7a4b36543410594a76b48a3cc31834666cea
task(Android 12): Update notification body click for Android 12 trampoline
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/LaunchPendingIntentFactory.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/LaunchPendingIntentFactory.java", "diff": "@@ -38,7 +38,7 @@ public class LaunchPendingIntentFactory {\npublic static PendingIntent getActivityIntent(@NonNull Bundle extras, @NonNull Context context){\nIntent launchIntent;\n- if (extras.containsKey(Constants.DEEP_LINK_KEY)) {\n+ if (extras.containsKey(Constants.DEEP_LINK_KEY) && extras.getString(Constants.DEEP_LINK_KEY)!=null) {\nlaunchIntent = new Intent(Intent.ACTION_VIEW,\nUri.parse(extras.getString(Constants.DEEP_LINK_KEY)));\nUtils.setPackageNameFromResolveInfoList(context, launchIntent);\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "diff": "@@ -999,8 +999,8 @@ public class PushProviders implements CTPushProviderListener {\n+ notificationId);\n}\n}\n- }\nnotificationId = Math.abs(notificationId); //Notification Id always needs to be positive\n+ }\n} catch (NumberFormatException e) {\n// no-op\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -37,6 +37,7 @@ import static com.clevertap.android.pushtemplates.content.PendingIntentFactoryKt\nimport static com.clevertap.android.pushtemplates.content.PendingIntentFactoryKt.MANUAL_CAROUSEL_DISMISS_PENDING_INTENT;\nimport static com.clevertap.android.pushtemplates.content.PendingIntentFactoryKt.MANUAL_CAROUSEL_LEFT_ARROW_PENDING_INTENT;\nimport static com.clevertap.android.pushtemplates.content.PendingIntentFactoryKt.MANUAL_CAROUSEL_RIGHT_ARROW_PENDING_INTENT;\n+import static com.clevertap.android.pushtemplates.content.PendingIntentFactoryKt.PRODUCT_DISPLAY_CONTENT_PENDING_INTENT;\nimport static com.clevertap.android.sdk.pushnotification.CTNotificationIntentService.TYPE_BUTTON_CLICK;\npublic class PushTemplateReceiver extends BroadcastReceiver {\n@@ -287,7 +288,7 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nBundle remoteInput = RemoteInput.getResultsFromIntent(intent);\nIntent dismissIntent = new Intent(context, PushTemplateReceiver.class);\nPendingIntent dIntent;\n- dIntent = setDismissIntent(context, extras, dismissIntent);\n+ dIntent = PendingIntentFactory.setDismissIntent(context, extras, dismissIntent);\nconfig = extras.getParcelable(\"config\");\nif (remoteInput != null) {\n@@ -624,7 +625,7 @@ public class PushTemplateReceiver extends BroadcastReceiver {\n}\nIntent dismissIntent = new Intent(context, PushTemplateReceiver.class);\nPendingIntent dIntent;\n- dIntent = setDismissIntent(context, extras, dismissIntent);\n+ dIntent = PendingIntentFactory.setDismissIntent(context, extras, dismissIntent);\nif (notificationManager != null) {\n//Use the Builder to build notification\n@@ -790,19 +791,18 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nPTConstants.PT_SILENT_CHANNEL_ID, context);\n}\n- Intent launchIntent = new Intent(context, PTPushNotificationReceiver.class);\nPendingIntent pIntent;\n- if (deepLinkList != null && !deepLinkList.isEmpty()) {\n- pIntent = setPendingIntent(context, notificationId, extras, launchIntent, dl);\n- } else {\n- pIntent = setPendingIntent(context, notificationId, extras, launchIntent, null);\n- }\n+ Bundle bundleLaunchIntent = (Bundle) extras.clone();\n+ bundleLaunchIntent.putString(Constants.DEEP_LINK_KEY,dl);\n+ pIntent = PendingIntentFactory.getPendingIntent(context,notificationId,bundleLaunchIntent,true,\n+ PRODUCT_DISPLAY_CONTENT_PENDING_INTENT,null\n+ );\nif (notificationManager != null) {\n//Use the Builder to build notification\nIntent dismissIntent = new Intent(context, PushTemplateReceiver.class);\nPendingIntent dIntent;\n- dIntent = setDismissIntent(context, extras, dismissIntent);\n+ dIntent = PendingIntentFactory.setDismissIntent(context, extras, dismissIntent);\nsetSmallIcon(context);\nsetNotificationBuilderBasics(notificationBuilder, contentViewSmall, contentViewBig, pt_title, pIntent,\n@@ -857,19 +857,6 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nlaunchIntent, flagsLaunchPendingIntent);\n}\n- private PendingIntent setDismissIntent(Context context, Bundle extras, Intent intent) {\n- intent.putExtras(extras);\n- intent.putExtra(PTConstants.PT_DISMISS_INTENT, true);\n-\n- int flagsLaunchPendingIntent = PendingIntent.FLAG_CANCEL_CURRENT;\n- if (Build.VERSION.SDK_INT >= VERSION_CODES.S) {\n- flagsLaunchPendingIntent = flagsLaunchPendingIntent | PendingIntent.FLAG_MUTABLE;\n- }\n-\n- return PendingIntent.getBroadcast(context, (int) System.currentTimeMillis(),\n- intent, flagsLaunchPendingIntent);\n- }\n-\nprivate void setNotificationBuilderBasics(NotificationCompat.Builder notificationBuilder, RemoteViews contentViewSmall, RemoteViews contentViewBig, String pt_title, PendingIntent pIntent, PendingIntent dIntent) {\nnotificationBuilder.setSmallIcon(smallIcon)\n.setCustomContentView(contentViewSmall)\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/content/PendingIntentFactory.kt", "diff": "@@ -55,19 +55,26 @@ const val RATING_CONFIRM_PENDING_INTENT = 33\ninternal object PendingIntentFactory {\n- lateinit var launchIntent: Intent\n+ var launchIntent: Intent? = null\n@JvmStatic\nfun setPendingIntent(\n- context: Context, notificationId: Int, extras: Bundle, launchIntent: Intent\n+ context: Context, notificationId: Int, extras: Bundle, launchIntent: Intent?\n): PendingIntent {\nval dl = extras[Constants.DEEP_LINK_KEY]\n- launchIntent.putExtras(extras)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ extras.putInt(PTConstants.PT_NOTIF_ID, notificationId)\nif (dl != null) {\n- launchIntent.putExtra(PTConstants.DEFAULT_DL, true)\n- //launchIntent.putExtra(Constants.DEEP_LINK_KEY, dl)\n+ extras.putBoolean(PTConstants.DEFAULT_DL, true)\n}\n+\n+ if (launchIntent==null)\n+ {\n+ /**\n+ * To support Android 12 trampoline restriction return activity pending intent\n+ */\n+ return LaunchPendingIntentFactory.getActivityIntent(extras,context)\n+ } else {\n+ launchIntent.putExtras(extras)\nlaunchIntent.removeExtra(Constants.WZRK_ACTIONS)\nlaunchIntent.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM)\nlaunchIntent.flags =\n@@ -81,6 +88,7 @@ internal object PendingIntentFactory {\nlaunchIntent, flagsLaunchPendingIntent\n)\n}\n+ }\n@JvmStatic\nfun setDismissIntent(context: Context, extras: Bundle, intent: Intent): PendingIntent {\n@@ -103,7 +111,8 @@ internal object PendingIntentFactory {\nisLauncher: Boolean, identifier: Int, renderer: TemplateRenderer?\n): PendingIntent? {\n- if (isLauncher) {\n+ launchIntent = null // reset to null or else last value will get retain\n+ if (isLauncher && VERSION.SDK_INT < VERSION_CODES.S) {\nlaunchIntent = Intent(context, PTPushNotificationReceiver::class.java)\n} else if (!isLauncher) {\nlaunchIntent = Intent(context, PushTemplateReceiver::class.java)\n@@ -117,7 +126,8 @@ internal object PendingIntentFactory {\nwhen (identifier) {\nBASIC_CONTENT_PENDING_INTENT, AUTO_CAROUSEL_CONTENT_PENDING_INTENT,\nMANUAL_CAROUSEL_CONTENT_PENDING_INTENT, ZERO_BEZEL_CONTENT_PENDING_INTENT,\n- TIMER_CONTENT_PENDING_INTENT, PRODUCT_DISPLAY_CONTENT_PENDING_INTENT -> {\n+ TIMER_CONTENT_PENDING_INTENT, PRODUCT_DISPLAY_CONTENT_PENDING_INTENT,\n+ INPUT_BOX_CONTENT_PENDING_INTENT-> {\nreturn if (renderer?.deepLinkList != null && renderer.deepLinkList!!.size > 0) {\nextras.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList!![0])\nsetPendingIntent(\n@@ -136,10 +146,10 @@ internal object PendingIntentFactory {\nMANUAL_CAROUSEL_RIGHT_ARROW_PENDING_INTENT -> {\n//extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])// variable\n- launchIntent.putExtra(PTConstants.PT_RIGHT_SWIPE, true)// fix\n- //launchIntent.putExtra(PTConstants.PT_MANUAL_CAROUSEL_FROM, 0)// variable\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)// fix\n- launchIntent.putExtras(extras)\n+ launchIntent!!.putExtra(PTConstants.PT_RIGHT_SWIPE, true)// fix\n+ //launchIntent!!.putExtra(PTConstants.PT_MANUAL_CAROUSEL_FROM, 0)// variable\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)// fix\n+ launchIntent!!.putExtras(extras)\nreturn setPendingIntent(\ncontext,\n@@ -151,10 +161,10 @@ internal object PendingIntentFactory {\nMANUAL_CAROUSEL_LEFT_ARROW_PENDING_INTENT -> {\n//extras.putString(Constants.DEEP_LINK_KEY,renderer.deepLinkList!![0])// variable\n- launchIntent.putExtra(PTConstants.PT_RIGHT_SWIPE, false)// fix\n- //launchIntent.putExtra(PTConstants.PT_MANUAL_CAROUSEL_FROM, 0)// variable\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)// fix\n- launchIntent.putExtras(extras)\n+ launchIntent!!.putExtra(PTConstants.PT_RIGHT_SWIPE, false)// fix\n+ //launchIntent!!.putExtra(PTConstants.PT_MANUAL_CAROUSEL_FROM, 0)// variable\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)// fix\n+ launchIntent!!.putExtras(extras)\nreturn setPendingIntent(\ncontext, notificationId, extras, launchIntent\n@@ -171,64 +181,66 @@ internal object PendingIntentFactory {\nConstants.DEEP_LINK_KEY,\nrenderer?.pt_rating_default_dl\n)\n- return setPendingIntent(\n+ return if(VERSION.SDK_INT < VERSION_CODES.S) { setPendingIntent(\ncontext,\nnotificationId,\nextras,\nlaunchIntent\n- )\n+ ) } else {\n+ LaunchPendingIntentFactory.getActivityIntent(extras, context)\n+ }\n}\nRATING_CLICK1_PENDING_INTENT -> {\n- launchIntent.putExtras(extras)\n- launchIntent.putExtra(\"click1\", true)\n- launchIntent.putExtra(\"clickedStar\", 1)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(\"config\", renderer?.config)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n+ launchIntent!!.putExtras(extras)\n+ launchIntent!!.putExtra(\"click1\", true)\n+ launchIntent!!.putExtra(\"clickedStar\", 1)\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ launchIntent!!.putExtra(\"config\", renderer?.config)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent!!, flagsLaunchPendingIntent)\n}\nRATING_CLICK2_PENDING_INTENT -> {\n- launchIntent.putExtras(extras)\n- launchIntent.putExtra(\"click2\", true)\n- launchIntent.putExtra(\"clickedStar\", 2)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(\"config\", renderer?.config)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n+ launchIntent!!.putExtras(extras)\n+ launchIntent!!.putExtra(\"click2\", true)\n+ launchIntent!!.putExtra(\"clickedStar\", 2)\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ launchIntent!!.putExtra(\"config\", renderer?.config)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent!!, flagsLaunchPendingIntent)\n}\nRATING_CLICK3_PENDING_INTENT -> {\n- launchIntent.putExtras(extras)\n- launchIntent.putExtra(\"click3\", true)\n- launchIntent.putExtra(\"clickedStar\", 3)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(\"config\", renderer?.config)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n+ launchIntent!!.putExtras(extras)\n+ launchIntent!!.putExtra(\"click3\", true)\n+ launchIntent!!.putExtra(\"clickedStar\", 3)\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ launchIntent!!.putExtra(\"config\", renderer?.config)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent!!, flagsLaunchPendingIntent)\n}\nRATING_CLICK4_PENDING_INTENT -> {\n- launchIntent.putExtras(extras)\n- launchIntent.putExtra(\"click4\", true)\n- launchIntent.putExtra(\"clickedStar\", 4)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(\"config\", renderer?.config)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n+ launchIntent!!.putExtras(extras)\n+ launchIntent!!.putExtra(\"click4\", true)\n+ launchIntent!!.putExtra(\"clickedStar\", 4)\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ launchIntent!!.putExtra(\"config\", renderer?.config)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent!!, flagsLaunchPendingIntent)\n}\nRATING_CLICK5_PENDING_INTENT -> {\n- launchIntent.putExtras(extras)\n- launchIntent.putExtra(\"click5\", true)\n- launchIntent.putExtra(\"clickedStar\", 5)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(\"config\", renderer?.config)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n+ launchIntent!!.putExtras(extras)\n+ launchIntent!!.putExtra(\"click5\", true)\n+ launchIntent!!.putExtra(\"clickedStar\", 5)\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ launchIntent!!.putExtra(\"config\", renderer?.config)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent!!, flagsLaunchPendingIntent)\n}\n/* RATING_CLICK_CONFIRM_PENDING_INTENT -> {\n- launchIntent.putExtras(extras)\n- launchIntent.putExtra(\"clickedStar\", 6)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- //launchIntent.putExtra(\"config\", renderer?.config)\n+ launchIntent!!.putExtras(extras)\n+ launchIntent!!.putExtra(\"clickedStar\", 6)\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ //launchIntent!!.putExtra(\"config\", renderer?.config)\nreturn PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n}*/\n@@ -239,37 +251,37 @@ internal object PendingIntentFactory {\nFIVE_ICON_CLOSE_PENDING_INTENT -> {\nval reqCode = Random().nextInt()\n- launchIntent.putExtra(\"close\", true)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, reqCode, launchIntent, flagsLaunchPendingIntent)\n+ launchIntent!!.putExtra(\"close\", true)\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ launchIntent!!.putExtras(extras)\n+ return PendingIntent.getBroadcast(context, reqCode, launchIntent!!, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_DL1_PENDING_INTENT -> {\nval requestCode = Random().nextInt()\n- launchIntent.putExtras(extras)\n- launchIntent.putExtra(PTConstants.PT_CURRENT_POSITION, 0)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![0])\n- return PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n+ launchIntent!!.putExtras(extras)\n+ launchIntent!!.putExtra(PTConstants.PT_CURRENT_POSITION, 0)\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ launchIntent!!.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![0])\n+ return PendingIntent.getBroadcast(context, requestCode, launchIntent!!, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_DL2_PENDING_INTENT -> {\nval requestCode = Random().nextInt()\n- launchIntent.putExtras(extras)\n- launchIntent.putExtra(PTConstants.PT_CURRENT_POSITION, 1)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![1])\n- return PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n+ launchIntent!!.putExtras(extras)\n+ launchIntent!!.putExtra(PTConstants.PT_CURRENT_POSITION, 1)\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ launchIntent!!.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![1])\n+ return PendingIntent.getBroadcast(context, requestCode, launchIntent!!, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_DL3_PENDING_INTENT -> {\nval requestCode = Random().nextInt()\n- launchIntent.putExtras(extras)\n- launchIntent.putExtra(PTConstants.PT_CURRENT_POSITION, 2)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![2])\n- return PendingIntent.getBroadcast(context, requestCode, launchIntent, flagsLaunchPendingIntent)\n+ launchIntent!!.putExtras(extras)\n+ launchIntent!!.putExtra(PTConstants.PT_CURRENT_POSITION, 2)\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ launchIntent!!.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![2])\n+ return PendingIntent.getBroadcast(context, requestCode, launchIntent!!, flagsLaunchPendingIntent)\n}\nPRODUCT_DISPLAY_CONTENT_SMALL1_PENDING_INTENT -> {\n@@ -317,16 +329,16 @@ internal object PendingIntentFactory {\n}\nPRODUCT_DISPLAY_BUY_NOW_PENDING_INTENT -> {\n- launchIntent.putExtra(PTConstants.PT_IMAGE_1, true)\n- launchIntent.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n- launchIntent.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![0])\n- launchIntent.putExtra(PTConstants.PT_BUY_NOW, true)\n- launchIntent.putExtra(\"config\", renderer?.config)\n- launchIntent.putExtras(extras)\n- return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent, flagsLaunchPendingIntent)\n+ launchIntent!!.putExtra(PTConstants.PT_IMAGE_1, true)\n+ launchIntent!!.putExtra(PTConstants.PT_NOTIF_ID, notificationId)\n+ launchIntent!!.putExtra(PTConstants.PT_BUY_NOW_DL, renderer?.deepLinkList!![0])\n+ launchIntent!!.putExtra(PTConstants.PT_BUY_NOW, true)\n+ launchIntent!!.putExtra(\"config\", renderer?.config)\n+ launchIntent!!.putExtras(extras)\n+ return PendingIntent.getBroadcast(context, Random().nextInt(), launchIntent!!, flagsLaunchPendingIntent)\n}\n- INPUT_BOX_CONTENT_PENDING_INTENT -> {\n+ /*INPUT_BOX_CONTENT_PENDING_INTENT -> {\nreturn if (renderer?.deepLinkList != null && renderer?.deepLinkList!!.size > 0) {\nextras.putString(Constants.DEEP_LINK_KEY, renderer?.deepLinkList?.get(0))\nsetPendingIntent(\n@@ -339,16 +351,16 @@ internal object PendingIntentFactory {\nextras.putString(Constants.DEEP_LINK_KEY, null)\nsetPendingIntent(context, notificationId, extras, launchIntent)\n}\n- }\n+ }*/\nINPUT_BOX_REPLY_PENDING_INTENT -> {\nif (renderer?.deepLinkList!!.size>0)\n{\nextras.putString(Constants.DEEP_LINK_KEY, renderer?.deepLinkList!![0])\n}\n- launchIntent.putExtra(PTConstants.PT_INPUT_FEEDBACK, renderer?.pt_input_feedback)\n- launchIntent.putExtra(PTConstants.PT_INPUT_AUTO_OPEN, renderer?.pt_input_auto_open)\n- launchIntent.putExtra(\"config\", renderer?.config)\n+ launchIntent!!.putExtra(PTConstants.PT_INPUT_FEEDBACK, renderer?.pt_input_feedback)\n+ launchIntent!!.putExtra(PTConstants.PT_INPUT_AUTO_OPEN, renderer?.pt_input_auto_open)\n+ launchIntent!!.putExtra(\"config\", renderer?.config)\nreturn if (renderer?.deepLinkList != null) {\nsetPendingIntent(\n@@ -381,10 +393,10 @@ internal object PendingIntentFactory {\nextras.putBoolean(\"autoCancel\", true)\nextras.putInt(Constants.PT_NOTIF_ID, notificationId)\nlaunchIntent = Intent(CTNotificationIntentService.MAIN_ACTION)\n- launchIntent.putExtras(extras)\n- launchIntent.putExtra(\"dl\", dl)\n- launchIntent.setPackage(context.packageName)\n- launchIntent.putExtra(Constants.KEY_CT_TYPE, CTNotificationIntentService.TYPE_BUTTON_CLICK)\n+ launchIntent!!.putExtras(extras)\n+ launchIntent!!.putExtra(\"dl\", dl)\n+ launchIntent!!.setPackage(context.packageName)\n+ launchIntent!!.putExtra(Constants.KEY_CT_TYPE, CTNotificationIntentService.TYPE_BUTTON_CLICK)\nvar flagsLaunchPendingIntent = PendingIntent.FLAG_UPDATE_CURRENT\nif (VERSION.SDK_INT >= VERSION_CODES.M) {\n@@ -393,7 +405,7 @@ internal object PendingIntentFactory {\nPendingIntent.getService(\ncontext,\nSystem.currentTimeMillis().toInt(),\n- launchIntent,\n+ launchIntent!!,\nflagsLaunchPendingIntent\n)\n} else {\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Update notification body click for Android 12 trampoline SDK-1056
116,612
14.12.2021 17:07:03
-19,080
ffcec32737a42feaee06a4f5efdbce3c8f636622
task(Android 12): Add PTPushNotificationReceiver and PushTemplateReceiver to sdk manifest
[ { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/AndroidManifest.xml", "new_path": "clevertap-pushtemplates/src/main/AndroidManifest.xml", "diff": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n-<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n- package=\"com.clevertap.android.pushtemplates\">\n+<manifest package=\"com.clevertap.android.pushtemplates\"\n+ xmlns:android=\"http://schemas.android.com/apk/res/android\">\n+ <application>\n+ <receiver\n+ android:name=\"com.clevertap.android.pushtemplates.PTPushNotificationReceiver\"\n+ android:enabled=\"true\"\n+ android:exported=\"false\" />\n+\n+ <receiver\n+ android:name=\"com.clevertap.android.pushtemplates.PushTemplateReceiver\"\n+ android:enabled=\"true\"\n+ android:exported=\"false\" />\n+ </application>\n</manifest>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/AndroidManifest.xml", "new_path": "sample/src/main/AndroidManifest.xml", "diff": "<action android:name=\"com.clevertap.PUSH_EVENT\" />\n</intent-filter>\n</service>\n- <receiver\n- android:name=\"com.clevertap.android.pushtemplates.PTPushNotificationReceiver\"\n- android:exported=\"false\"\n- android:enabled=\"true\">\n- </receiver>\n-\n- <receiver\n- android:name=\"com.clevertap.android.pushtemplates.PushTemplateReceiver\"\n- android:exported=\"false\"\n- android:enabled=\"true\">\n- </receiver>\n-\n<activity\nandroid:name=\".WebViewActivity\"\nandroid:exported=\"true\"\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Add PTPushNotificationReceiver and PushTemplateReceiver to sdk manifest SDK-1056
116,616
14.12.2021 17:15:19
-19,080
c146a590fb3f590cb219b7cbec1dd01945b7a244
task(SDK-1197): Add debug and verbose logs when converting collapse_key
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/PushProviders.java", "diff": "@@ -989,17 +989,20 @@ public class PushProviders implements CTPushProviderListener {\n} else if (collapse_key instanceof String) {\ntry {\nnotificationId = Integer.parseInt(collapse_key.toString());\n- config.getLogger().debug(config.getAccountId(),\n+ config.getLogger().verbose(config.getAccountId(),\n\"Converting collapse_key: \" + collapse_key + \" to notificationId int: \"\n+ notificationId);\n} catch (NumberFormatException e) {\nnotificationId = (collapse_key.toString().hashCode());\n- config.getLogger().debug(config.getAccountId(),\n+ config.getLogger().verbose(config.getAccountId(),\n\"Converting collapse_key: \" + collapse_key + \" to notificationId int: \"\n+ notificationId);\n}\n}\nnotificationId = Math.abs(notificationId); //Notification Id always needs to be positive\n+ config.getLogger().debug(config.getAccountId(),\n+ \"Creating the notification id: \" + notificationId + \" from collapse_key: \"\n+ + collapse_key);\n}\n} catch (NumberFormatException e) {\n// no-op\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1197): Add debug and verbose logs when converting collapse_key
116,616
14.12.2021 17:15:57
-19,080
6ca975bd1b4bb4bfaeeb0aa6c7a62b8a99f53796
task(SDK-1196): Upgrade FCM to v22.0.0 in sample app
[ { "change_type": "MODIFY", "old_path": "sample/build.gradle", "new_path": "sample/build.gradle", "diff": "@@ -68,7 +68,7 @@ dependencies {\nimplementation 'androidx.work:work-runtime:2.7.0'// Needed for geofence\nimplementation 'androidx.concurrent:concurrent-futures:1.1.0'// Needed for geofence\n- implementation 'com.google.firebase:firebase-messaging:20.2.4' //Needed for FCM\n+ implementation 'com.google.firebase:firebase-messaging:22.0.0' //Needed for FCM\nimplementation 'com.google.android.gms:play-services-ads:20.4.0' //Needed to use Google Ad Ids\n//ExoPlayer Libraries for Audio/Video InApp Notifications\nimplementation 'com.google.android.exoplayer:exoplayer:2.15.1'\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(SDK-1196): Upgrade FCM to v22.0.0 in sample app
116,616
15.12.2021 15:57:58
-19,080
0bdb0b0ee8be04fba8ba6d646e81641ba279aba6
task(refactor): Update rating eventName
[ { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -640,24 +640,21 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nnotificationManager.notify(notificationId, notification);\n}\n-\n- if (VERSION.SDK_INT < VERSION_CODES.S)\n- {\n- Utils.raiseNotificationClicked(context, extras, config);\n+ if (VERSION.SDK_INT < VERSION_CODES.S){\nhandleRatingDeepLink(context, extras, notificationId, pt_dl_clicked);\n}\n- } else{\n+ }\n+ else{\nextras.putString(Constants.EXTRAS_FROM,\"PTReceiver\");\nBundle clonedExtras = (Bundle) extras.clone();\nNotificationHandler notificationHandler = CleverTapAPI.getNotificationHandler();\n- if (notificationHandler!=null)\n- {\n+ if (notificationHandler!=null){\nnotificationHandler.onMessageReceived(context,extras,\"FCM\");\nclonedExtras.putString(Constants.DEEP_LINK_KEY, pt_dl_clicked);\n- Utils.raiseNotificationClicked(context, clonedExtras, config);\nhandleRatingDeepLink(context, clonedExtras, notificationId, pt_dl_clicked);\n}\n}\n+ Utils.raiseCleverTapEvent(context,config,\"Rating Submitted\", Utils.convertRatingBundleObjectToHashMap(extras));\n//}\n} catch (Throwable t) {\nPTLog.verbose(\"Error creating rating notification \", t);\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/Utils.java", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/Utils.java", "diff": "@@ -9,17 +9,13 @@ import android.content.Context;\nimport android.content.ContextWrapper;\nimport android.content.Intent;\nimport android.content.pm.ApplicationInfo;\n-import android.content.pm.PackageInfo;\n-import android.content.pm.PackageManager;\nimport android.content.pm.ResolveInfo;\n-import android.content.pm.ServiceInfo;\nimport android.graphics.Bitmap;\nimport android.graphics.BitmapFactory;\nimport android.graphics.Canvas;\nimport android.graphics.Color;\nimport android.graphics.PorterDuff;\nimport android.graphics.PorterDuffColorFilter;\n-import android.graphics.drawable.BitmapDrawable;\nimport android.graphics.drawable.Drawable;\nimport android.media.AudioAttributes;\nimport android.net.Uri;\n@@ -475,6 +471,22 @@ public class Utils {\n}\n+ static HashMap<String, Object> convertRatingBundleObjectToHashMap(Bundle b) {\n+ b.remove(\"config\");\n+ final HashMap<String, Object> map = new HashMap<>();\n+ for (String s : b.keySet()) {\n+ if (s.contains(\"wzrk_\")||s.equals(PTConstants.PT_ID)) {\n+ final Object o = b.get(s);\n+ if (o instanceof Bundle) {\n+ map.putAll(convertRatingBundleObjectToHashMap((Bundle) o));\n+ } else {\n+ map.put(s, b.get(s));\n+ }\n+ }\n+ }\n+ return map;\n+ }\n+\nstatic String getEventNameFromExtras(Bundle extras) {\nString eName = null;\nfor (String key : extras.keySet()) {\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Update rating eventName
116,616
15.12.2021 16:04:32
-19,080
1c730c28ef66d3135338e74a70e2cf18de9e0e80
task(refactor): Update layouts to support RTl symmetry
[ { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout-v31/content_view_small_multi_line_msg.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout-v31/content_view_small_multi_line_msg.xml", "diff": "android:maxLines=\"3\"\nandroid:ellipsize=\"end\"\nandroid:text=\"message message\"\n- android:textAppearance=\"@style/PushMessageMultiLine\"\n- />\n+ android:textAppearance=\"@style/PushMessageMultiLine\"/>\n<ImageView\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout-v31/product_display_template.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout-v31/product_display_template.xml", "diff": "</LinearLayout>\n</LinearLayout>\n-\n</LinearLayout>\n</LinearLayout>\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/content_view_small_multi_line_msg.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/content_view_small_multi_line_msg.xml", "diff": "android:paddingRight=\"@dimen/padding_horizontal\"\nandroid:paddingBottom=\"@dimen/padding_vertical\" >\n-\n<include\nandroid:id=\"@+id/metadata\"\nlayout=\"@layout/metadata\" />\nandroid:layout_height=\"wrap_content\"\nandroid:layout_below=\"@+id/metadata\"\nandroid:layout_alignStart=\"@+id/metadata\"\n+ android:layout_alignLeft=\"@id/metadata\"\nandroid:id=\"@+id/rel_lyt\">\n<TextView\nandroid:layout_height=\"wrap_content\"\nandroid:layout_marginTop=\"@dimen/metadata_title_margin_vertical\"\nandroid:layout_marginEnd=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_marginRight=\"@dimen/metadata_title_margin_vertical\"\nandroid:layout_alignParentStart=\"true\"\n+ android:layout_alignParentLeft=\"true\"\nandroid:layout_toStartOf=\"@+id/large_icon\"\n+ android:layout_toLeftOf=\"@id/large_icon\"\nandroid:text=\"title\"\nandroid:textAppearance=\"@style/PushTitle\" />\nandroid:layout_height=\"wrap_content\"\nandroid:layout_below=\"@+id/title\"\nandroid:layout_alignStart=\"@id/title\"\n+ android:layout_alignLeft=\"@id/title\"\nandroid:layout_alignParentStart=\"true\"\n+ android:layout_alignParentLeft=\"true\"\nandroid:layout_toStartOf=\"@+id/large_icon\"\n+ android:layout_toLeftOf=\"@id/large_icon\"\nandroid:maxLines=\"3\"\nandroid:ellipsize=\"end\"\nandroid:text=\"message message\"\nandroid:layout_width=\"@dimen/large_icon\"\nandroid:layout_height=\"@dimen/large_icon\"\nandroid:layout_marginStart=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_marginLeft=\"@dimen/metadata_title_margin_horizontal\"\nandroid:layout_alignParentEnd=\"true\"\n+ android:layout_alignParentRight=\"true\"\nandroid:scaleType=\"centerCrop\" />\n</RelativeLayout>\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/content_view_small_single_line_msg.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/content_view_small_single_line_msg.xml", "diff": "android:id=\"@+id/metadata\"\nlayout=\"@layout/metadata\"/>\n+\n<RelativeLayout\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"wrap_content\"\nandroid:layout_below=\"@+id/metadata\"\nandroid:layout_alignStart=\"@+id/metadata\"\n+ android:layout_alignLeft=\"@id/metadata\"\nandroid:id=\"@+id/rel_lyt\">\n<TextView\nandroid:layout_height=\"wrap_content\"\nandroid:layout_marginTop=\"@dimen/metadata_title_margin_vertical\"\nandroid:layout_marginEnd=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_marginRight=\"@dimen/metadata_title_margin_horizontal\"\nandroid:layout_alignParentStart=\"true\"\n+ android:layout_alignParentLeft=\"true\"\nandroid:layout_toStartOf=\"@+id/large_icon\"\n+ android:layout_toLeftOf=\"@id/large_icon\"\nandroid:text=\"title\"\nandroid:textAppearance=\"@style/PushTitle\"/>\nandroid:layout_height=\"wrap_content\"\nandroid:layout_below=\"@+id/title\"\nandroid:layout_alignStart=\"@id/title\"\n+ android:layout_alignLeft=\"@id/title\"\nandroid:layout_alignParentStart=\"true\"\n+ android:layout_alignParentLeft=\"true\"\nandroid:layout_toStartOf=\"@+id/large_icon\"\n+ android:layout_toLeftOf=\"@id/large_icon\"\nandroid:text=\"message message\"\nandroid:textAppearance=\"@style/PushMessage\"\nandroid:maxLines=\"1\"\n- android:ellipsize=\"end\"\n- />\n+ android:ellipsize=\"end\"/>\n+\n<ImageView\nandroid:layout_width=\"@dimen/large_icon\"\nandroid:layout_height=\"@dimen/large_icon\"\nandroid:layout_marginStart=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_marginLeft=\"@dimen/metadata_title_margin_horizontal\"\nandroid:layout_alignParentEnd=\"true\"\n+ android:layout_alignParentRight=\"true\"\nandroid:scaleType=\"centerCrop\"/>\n</RelativeLayout>\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/cv_small_text_only.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/cv_small_text_only.xml", "diff": "android:layout_width=\"@dimen/large_icon\"\nandroid:layout_height=\"@dimen/large_icon\"\nandroid:layout_alignParentStart=\"true\"\n+ android:layout_alignParentLeft=\"true\"\nandroid:scaleType=\"centerCrop\"/>\nandroid:id=\"@+id/rel_lyt\"\nandroid:layout_width=\"wrap_content\"\nandroid:layout_height=\"wrap_content\"\n- android:layout_toEndOf=\"@id/large_icon\">\n+ android:layout_toEndOf=\"@id/large_icon\"\n+ android:layout_toRightOf=\"@id/large_icon\">\n<include\nandroid:id=\"@+id/metadata\"\nandroid:layout_height=\"wrap_content\"\nandroid:layout_below=\"@+id/metadata\"\nandroid:layout_marginStart=\"@dimen/metadata_title_margin_horizontal\"\n+ android:layout_marginLeft=\"@dimen/metadata_title_margin_horizontal\"\nandroid:ellipsize=\"end\"\nandroid:maxLines=\"2\"\nandroid:layout_marginTop=\"4dp\"\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/cv_small_zero_bezel.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/cv_small_zero_bezel.xml", "diff": "android:layout_height=\"wrap_content\"\nandroid:layout_below=\"@+id/metadata\"\nandroid:layout_alignStart=\"@+id/metadata\"\n+ android:layout_alignLeft=\"@id/metadata\"\nandroid:layout_marginTop=\"@dimen/metadata_title_margin_vertical\"\nandroid:ellipsize=\"end\"\nandroid:maxLines=\"1\"\nandroid:layout_height=\"wrap_content\"\nandroid:layout_below=\"@+id/title\"\nandroid:layout_alignStart=\"@id/title\"\n+ android:layout_alignLeft=\"@id/title\"\nandroid:ellipsize=\"end\"\nandroid:maxLines=\"2\"\nandroid:text=\"message message message\"\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/input_box_collapsed.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/input_box_collapsed.xml", "diff": "android:layout_height=\"18.2dp\"\nandroid:layout_alignBottom=\"@id/large_icon\"\nandroid:layout_alignEnd=\"@id/large_icon\"\n+ android:layout_alignRight=\"@id/large_icon\"\nandroid:src=\"@android:drawable/ic_dialog_info\"/>\n</RelativeLayout>\nandroid:layout_alignParentBottom=\"false\"\nandroid:layout_marginTop=\"3dp\"\nandroid:layout_toEndOf=\"@+id/icon_container\"\n+ android:layout_toRightOf=\"@id/icon_container\"\nandroid:gravity=\"center_vertical\"\nandroid:orientation=\"vertical\"\nandroid:paddingStart=\"6dp\"\nandroid:id=\"@+id/title\"\nandroid:layout_width=\"wrap_content\"\nandroid:layout_height=\"wrap_content\"\n- android:text=\"Notification Sample App\"\n- />\n+ android:text=\"Notification Sample App\"/>\n+\n<TextView\nandroid:id=\"@+id/msg_summary\"\nandroid:layout_width=\"wrap_content\"\nandroid:layout_height=\"wrap_content\"\n- android:text=\"Expand me to see a detailed message!\"\n- />\n+ android:text=\"Expand me to see a detailed message!\"/>\n+\n</LinearLayout>\n<TextView\nandroid:layout_width=\"wrap_content\"\nandroid:layout_height=\"wrap_content\"\nandroid:layout_alignParentEnd=\"true\"\n+ android:layout_alignParentRight=\"true\"\nandroid:layout_alignParentTop=\"true\"\nandroid:paddingEnd=\"3.5dp\"\nandroid:paddingStart=\"3.5dp\"\n- android:paddingTop=\"8dp\"\n- />\n+ android:paddingTop=\"8dp\" />\n</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/input_box_expanded.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/input_box_expanded.xml", "diff": "android:layout_height=\"18.2dp\"\nandroid:layout_alignBottom=\"@id/large_icon\"\nandroid:layout_alignEnd=\"@id/large_icon\"\n+ android:layout_alignRight=\"@id/large_icon\"\nandroid:src=\"@android:drawable/ic_dialog_info\"/>\n</RelativeLayout>\nandroid:layout_alignParentBottom=\"false\"\nandroid:layout_marginTop=\"3dp\"\nandroid:layout_toEndOf=\"@+id/icon_container\"\n+ android:layout_toRightOf=\"@id/icon_container\"\nandroid:gravity=\"center_vertical\"\nandroid:orientation=\"vertical\"\n- android:paddingStart=\"6dp\">\n+ android:paddingStart=\"6dp\"\n+ android:paddingLeft=\"6dp\">\n<TextView\nandroid:id=\"@+id/title\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"wrap_content\"\nandroid:ellipsize=\"end\"\n- android:maxLines=\"8\"\n- />\n- </LinearLayout>\n+ android:maxLines=\"8\"/>\n+ </LinearLayout>\n<TextView\nandroid:layout_width=\"wrap_content\"\nandroid:layout_height=\"wrap_content\"\nandroid:layout_alignParentEnd=\"true\"\n+ android:layout_alignParentRight=\"true\"\nandroid:layout_alignParentTop=\"true\"\nandroid:paddingEnd=\"3.5dp\"\nandroid:paddingStart=\"3.5dp\"\n- android:paddingTop=\"8dp\"\n- />\n+ android:paddingTop=\"8dp\"/>\n</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/metadata.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/metadata.xml", "diff": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n- xmlns:app=\"http://schemas.android.com/apk/res-auto\"\nandroid:layout_width=\"wrap_content\"\nandroid:layout_height=\"20dp\"\nandroid:gravity=\"center\">\nandroid:layout_width=\"@dimen/metadata_small_icon_x\"\nandroid:layout_height=\"@dimen/metadata_small_icon_y\"\nandroid:layout_alignParentStart=\"true\"\n+ android:layout_alignParentLeft=\"true\"\nandroid:layout_marginEnd=\"@dimen/metadata_margin_x\"\n+ android:layout_marginRight=\"@dimen/metadata_margin_x\"\nandroid:layout_centerVertical=\"true\"/>\n<TextView\nandroid:layout_width=\"wrap_content\"\nandroid:layout_height=\"match_parent\"\nandroid:layout_toEndOf=\"@id/small_icon\"\n+ android:layout_toRightOf=\"@id/small_icon\"\nandroid:text=\"app name\"\nandroid:textAppearance=\"@style/MetaData\" />\nandroid:layout_marginEnd=\"2dp\"\nandroid:layout_marginBottom=\"0dp\"\nandroid:layout_toEndOf=\"@id/app_name\"\n+ android:layout_toRightOf=\"@id/app_name\"\nandroid:padding=\"1dp\"\nandroid:scaleType=\"centerInside\"\nandroid:src=\"@drawable/pt_dot_sep\" />\nandroid:layout_width=\"wrap_content\"\nandroid:layout_height=\"match_parent\"\nandroid:layout_toEndOf=\"@id/sep_subtitle\"\n+ android:layout_toRightOf=\"@id/sep_subtitle\"\nandroid:ellipsize=\"end\"\nandroid:maxWidth=\"120dp\"\nandroid:maxLines=\"1\"\nandroid:layout_marginStart=\"2dp\"\nandroid:layout_marginEnd=\"2dp\"\nandroid:layout_toEndOf=\"@id/subtitle\"\n+ android:layout_toRightOf=\"@id/subtitle\"\nandroid:padding=\"1dp\"\nandroid:src=\"@drawable/pt_dot_sep\" />\nandroid:layout_width=\"wrap_content\"\nandroid:layout_height=\"match_parent\"\nandroid:layout_toEndOf=\"@id/sep\"\n+ android:layout_toRightOf=\"@id/sep\"\nandroid:ellipsize=\"end\"\nandroid:maxLines=\"1\"\nandroid:text=\"timestamp\"\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/product_display_linear_collapsed.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/product_display_linear_collapsed.xml", "diff": "android:layout_width=\"wrap_content\"\nandroid:layout_height=\"wrap_content\"\nandroid:layout_marginStart=\"-85dp\"\n+ android:layout_marginLeft=\"-85dp\"\nandroid:layout_toEndOf=\"@+id/large_icon\"\n+ android:layout_toRightOf=\"@id/large_icon\"\nandroid:text=\"message message \"\nandroid:textAppearance=\"@style/PushMessage\" />\nandroid:layout_height=\"match_parent\"\nandroid:layout_below=\"@id/msg\"\nandroid:layout_marginStart=\"-85dp\"\n+ android:layout_marginLeft=\"-85dp\"\nandroid:layout_marginTop=\"8dp\"\nandroid:layout_toEndOf=\"@id/large_icon\"\n+ android:layout_toRightOf=\"@id/large_icon\"\nandroid:orientation=\"horizontal\"\nandroid:paddingLeft=\"4dp\"\nandroid:paddingRight=\"4dp\">\nandroid:layout_width=\"0dp\"\nandroid:layout_height=\"match_parent\"\nandroid:layout_marginStart=\"-5dp\"\n+ android:layout_marginLeft=\"-5dp\"\nandroid:layout_marginEnd=\"2dp\"\n+ android:layout_marginRight=\"2dp\"\nandroid:layout_weight=\"1\"\nandroid:visibility=\"gone\"/>\nandroid:layout_width=\"0dp\"\nandroid:layout_height=\"match_parent\"\nandroid:layout_marginEnd=\"-4dp\"\n+ android:layout_marginRight=\"-4dp\"\nandroid:layout_weight=\"1\"\nandroid:visibility=\"gone\"/>\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/product_display_linear_expanded.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/product_display_linear_expanded.xml", "diff": "android:layout_width=\"0dp\"\nandroid:layout_height=\"50dp\"\nandroid:layout_marginStart=\"-5dp\"\n+ android:layout_marginLeft=\"-5dp\"\n+ android:layout_marginRight=\"2dp\"\nandroid:layout_marginEnd=\"2dp\"\nandroid:layout_weight=\"1\"\nandroid:visibility=\"gone\"/>\nandroid:layout_width=\"0dp\"\nandroid:layout_height=\"50dp\"\nandroid:layout_marginEnd=\"-4dp\"\n+ android:layout_marginRight=\"-4dp\"\nandroid:layout_weight=\"1\"\nandroid:visibility=\"gone\"/>\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/product_display_template.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/product_display_template.xml", "diff": "android:layout_marginTop=\"8dp\"\nandroid:text=\"Rs: 5,000,000\"\nandroid:textAppearance=\"@style/PushTitle\"\n- android:textAlignment=\"center\"/>\n+ android:textAlignment=\"center\"\n+ android:layout_gravity=\"center_horizontal\"/>\n<Button\nandroid:id=\"@+id/product_action\"\nandroid:id=\"@+id/small_image1\"\nandroid:layout_width=\"0dp\"\nandroid:layout_height=\"match_parent\"\n- android:layout_weight=\"1\"\n- />\n+ android:layout_weight=\"1\"/>\n+\n<ImageView\nandroid:id=\"@+id/small_image2\"\n" }, { "change_type": "DELETE", "old_path": "clevertap-pushtemplates/src/main/res/layout/pt_custom_cta.xml", "new_path": null, "diff": "-<?xml version=\"1.0\" encoding=\"utf-8\"?>\n-<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n- xmlns:tools=\"http://schemas.android.com/tools\"\n- android:orientation=\"horizontal\"\n- android:layout_width=\"match_parent\"\n- android:layout_height=\"wrap_content\">\n- <Button\n- android:id=\"@+id/pt_custom_cta1\"\n- android:layout_height=\"40dp\"\n- android:layout_width=\"wrap_content\"\n- android:textAlignment=\"center\"\n- android:text=\"test\"\n- android:layout_weight=\"1\"\n- android:background=\"@drawable/btn_ripple_background\"\n- tools:ignore=\"RtlCompat\" />\n- <Button\n- android:id=\"@+id/pt_custom_cta2\"\n- android:layout_height=\"40dp\"\n- android:layout_width=\"wrap_content\"\n- android:textAlignment=\"center\"\n- android:text=\"test\"\n- android:layout_weight=\"1\"\n- android:background=\"@drawable/btn_ripple_background\"/>\n- <Button\n- android:id=\"@+id/pt_custom_cta3\"\n- android:layout_height=\"40dp\"\n- android:layout_width=\"wrap_content\"\n- android:textAlignment=\"center\"\n- android:text=\"test\"\n- android:layout_weight=\"1\"\n- android:background=\"@drawable/btn_ripple_background\"/>\n-</LinearLayout>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/timer.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/timer.xml", "diff": "android:layout_height=\"wrap_content\"\nandroid:layout_below=\"@+id/metadata\"\nandroid:layout_marginEnd=\"@dimen/padding_vertical\"\n- android:layout_toStartOf=\"@+id/chronometer\">\n+ android:layout_marginRight=\"@dimen/padding_vertical\"\n+ android:layout_toStartOf=\"@+id/chronometer\"\n+ android:layout_toLeftOf=\"@id/chronometer\">\n<TextView\nandroid:layout_height=\"wrap_content\"\nandroid:layout_below=\"@+id/title\"\nandroid:layout_alignStart=\"@+id/title\"\n+ android:layout_alignLeft=\"@id/title\"\nandroid:text=\"message\"\nandroid:textAppearance=\"@style/PushMessageMultiLine\" />\nandroid:layout_width=\"wrap_content\"\nandroid:layout_height=\"wrap_content\"\nandroid:layout_alignParentEnd=\"true\"\n+ android:layout_alignParentRight=\"true\"\nandroid:layout_centerVertical=\"true\"\nandroid:textAlignment=\"center\"\n- android:textSize=\"@dimen/chronometer_font_size\" />\n+ android:textSize=\"@dimen/chronometer_font_size\"\n+ android:layout_gravity=\"center_horizontal\" />\n</RelativeLayout>\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/timer_collapsed.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/timer_collapsed.xml", "diff": "android:layout_width=\"wrap_content\"\nandroid:layout_height=\"wrap_content\"\nandroid:layout_alignParentEnd=\"true\"\n+ android:layout_alignParentRight=\"true\"\nandroid:layout_centerVertical=\"true\"\nandroid:textAlignment=\"center\"\n+ android:layout_gravity=\"center_horizontal\"\nandroid:textSize=\"@dimen/chronometer_font_size\"/>\n-\n</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/zero_bezel.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/zero_bezel.xml", "diff": "android:layout_height=\"wrap_content\"\nandroid:layout_below=\"@+id/metadata\"\nandroid:layout_alignStart=\"@id/metadata\"\n+ android:layout_alignLeft=\"@id/metadata\"\nandroid:layout_marginTop=\"@dimen/metadata_title_margin_vertical\"\nandroid:text=\"title\"\nandroid:textAppearance=\"@style/PushTitle\"\nandroid:layout_height=\"wrap_content\"\nandroid:layout_below=\"@+id/title\"\nandroid:layout_alignStart=\"@id/title\"\n+ android:layout_alignLeft=\"@id/title\"\nandroid:text=\"message\"\nandroid:textAppearance=\"@style/PushMessageMultiLine\"\nandroid:textColor=\"@color/white\"/>\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Update layouts to support RTl symmetry
116,612
15.12.2021 16:36:03
-19,080
b47a24c49697070e661be851374c9aaeba8caec2
task(Android 12): Remove AsyncHelper.kt and replace it by CTExecutor framework
[ { "change_type": "DELETE", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/AsyncHelper.kt", "new_path": null, "diff": "-package com.clevertap.android.pushtemplates\n-\n-import android.os.Handler\n-import android.os.Looper\n-import java.util.concurrent.ExecutorService\n-import java.util.concurrent.Executors\n-\n-internal class AsyncHelper private constructor() {\n- private var EXECUTOR_THREAD_ID: Long = 0\n- private val es: ExecutorService\n- fun postAsyncSafely(name: String, runnable: Runnable) {\n- try {\n- val executeSync = Thread.currentThread().id == EXECUTOR_THREAD_ID\n- if (executeSync) {\n- runnable.run()\n- } else {\n- es.submit {\n- EXECUTOR_THREAD_ID = Thread.currentThread().id\n- try {\n- runnable.run()\n- } catch (t: Throwable) {\n- PTLog.verbose(\"Executor service: Failed to complete the scheduled task$name\")\n- }\n- }\n- }\n- } catch (t: Throwable) {\n- PTLog.verbose(\"Failed to submit task to the executor service\")\n- }\n- }\n-\n- companion object {\n- private var asyncHelperInstance: AsyncHelper? = null\n- @JvmStatic\n- val instance: AsyncHelper?\n- get() {\n- if (asyncHelperInstance == null) {\n- asyncHelperInstance = AsyncHelper()\n- }\n- return asyncHelperInstance\n- }\n- @JvmStatic\n- val mainThreadHandler: Handler\n- get() {\n- val mainThreadHandler: Handler\n- mainThreadHandler = Handler(Looper.getMainLooper())\n- return mainThreadHandler\n- }\n- }\n-\n- init {\n- es = Executors.newFixedThreadPool(1)\n- }\n-}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -30,7 +30,10 @@ import com.clevertap.android.sdk.Constants;\nimport com.clevertap.android.sdk.interfaces.NotificationHandler;\nimport com.clevertap.android.sdk.pushnotification.CTNotificationIntentService;\nimport com.clevertap.android.sdk.pushnotification.LaunchPendingIntentFactory;\n+import com.clevertap.android.sdk.task.CTExecutorFactory;\n+import com.clevertap.android.sdk.task.Task;\nimport java.util.ArrayList;\n+import java.util.concurrent.Callable;\nimport static android.content.Context.NOTIFICATION_SERVICE;\nimport static com.clevertap.android.pushtemplates.content.PendingIntentFactoryKt.MANUAL_CAROUSEL_CONTENT_PENDING_INTENT;\n@@ -42,6 +45,9 @@ import static com.clevertap.android.sdk.pushnotification.CTNotificationIntentSer\npublic class PushTemplateReceiver extends BroadcastReceiver {\nboolean clicked1 = true, clicked2 = true, clicked3 = true, clicked4 = true, clicked5 = true, img1 = false, img2 = false, img3 = false, buynow = true, bigimage = true, cta1 = true, cta2 = true, cta3 = true, cta4 = true, cta5 = true, close = true;\n+\n+ private CleverTapAPI cleverTapAPI;\n+\nprivate RemoteViews contentViewBig, contentViewSmall, contentViewRating, contentViewManualCarousel;\nprivate String pt_id;\nprivate TemplateType templateType;\n@@ -73,7 +79,6 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nprivate String pt_product_display_action_text_clr;\nprivate String pt_big_img;\nprivate String pt_meta_clr;\n- private AsyncHelper asyncHelper;\nprivate boolean pt_dismiss_intent;\nprivate String pt_rating_toast;\nprivate String pt_subtitle;\n@@ -87,6 +92,8 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nif (intent.getExtras() != null) {\nfinal Bundle extras = intent.getExtras();\n+ cleverTapAPI = CleverTapAPI\n+ .getGlobalInstance(context, extras.getString(Constants.WZRK_ACCT_ID_KEY));\npt_id = intent.getStringExtra(PTConstants.PT_ID);\npID = extras.getString(Constants.WZRK_PUSH_ID);\npt_msg = extras.getString(PTConstants.PT_MSG);\n@@ -112,7 +119,6 @@ public class PushTemplateReceiver extends BroadcastReceiver {\npt_small_icon_clr = extras.getString(PTConstants.PT_SMALL_ICON_COLOUR);\npt_product_display_action_text_clr = extras.getString(PTConstants.PT_PRODUCT_DISPLAY_ACTION_TEXT_COLOUR);\nrequiresChannelId = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;\n- asyncHelper = AsyncHelper.getInstance();\npt_dismiss_intent = extras.getBoolean(PTConstants.PT_DISMISS_INTENT, false);\npt_rating_toast = extras.getString(PTConstants.PT_RATING_TOAST);\npt_subtitle = extras.getString(PTConstants.PT_SUBTITLE);\n@@ -134,14 +140,19 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nif (pt_id != null) {\ntemplateType = TemplateType.fromString(pt_id);\n}\n- asyncHelper.postAsyncSafely(\"PushTemplateReceiver#renderTemplate\", new Runnable() {\n+\n+ if (cleverTapAPI != null) {\n+ try {\n+ this.config = cleverTapAPI.getCoreState().getConfig();\n+ Task<Void> task = CTExecutorFactory.executors(config).postAsyncSafelyTask();\n+ task.execute(\"PushTemplateReceiver#renderNotification\", new Callable<Void>() {\n@Override\n- public void run() {\n+ public Void call() throws Exception {\ntry {\nif (pt_dismiss_intent) {\nUtils.deleteSilentNotificationChannel(context);\nUtils.deleteImageFromStorage(context, intent);\n- return;\n+ return null;\n}\nif (templateType != null) {\nswitch (templateType) {\n@@ -165,9 +176,16 @@ public class PushTemplateReceiver extends BroadcastReceiver {\n} catch (Throwable t) {\nPTLog.verbose(\"Couldn't render notification: \" + t.getLocalizedMessage());\n}\n+ return null;\n}\n});\n+ } catch (Exception e) {\n+ PTLog.verbose(\"Couldn't render notification: \" + e.getLocalizedMessage());\n+ }\n+ } else {\n+ PTLog.verbose(\"clevertap instance is null, not running PushTemplateReceiver#renderNotification\");\n+ }\n}\n}\n@@ -371,7 +389,7 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nint notificationId = extras.getInt(PTConstants.PT_NOTIF_ID);\nif (extras.getBoolean(PTConstants.DEFAULT_DL, false)) {\n- config = extras.getParcelable(\"config\");\n+ this.config = extras.getParcelable(\"config\");\nnotificationManager.cancel(notificationId);\nIntent launchIntent;\nClass clazz = null;\n@@ -397,7 +415,7 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nlaunchIntent.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM);\nlaunchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP\n| Intent.FLAG_ACTIVITY_NEW_TASK);\n- Utils.raiseNotificationClicked(context, extras, config);\n+ Utils.raiseNotificationClicked(context, extras, this.config);\nlaunchIntent.putExtras(extras);\nlaunchIntent.putExtra(Constants.DEEP_LINK_KEY, pt_rating_default_dl);\ncontext.startActivity(launchIntent);\n@@ -643,8 +661,8 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nif (VERSION.SDK_INT < VERSION_CODES.S)\n{\n- Utils.raiseNotificationClicked(context, extras, config);\n- handleRatingDeepLink(context, extras, notificationId, pt_dl_clicked);\n+ Utils.raiseNotificationClicked(context, extras, this.config);\n+ handleRatingDeepLink(context, extras, notificationId, pt_dl_clicked,this.config);\n}\n} else{\nextras.putString(Constants.EXTRAS_FROM,\"PTReceiver\");\n@@ -654,8 +672,8 @@ public class PushTemplateReceiver extends BroadcastReceiver {\n{\nnotificationHandler.onMessageReceived(context,extras,\"FCM\");\nclonedExtras.putString(Constants.DEEP_LINK_KEY, pt_dl_clicked);\n- Utils.raiseNotificationClicked(context, clonedExtras, config);\n- handleRatingDeepLink(context, clonedExtras, notificationId, pt_dl_clicked);\n+ Utils.raiseNotificationClicked(context, clonedExtras, this.config);\n+ handleRatingDeepLink(context, clonedExtras, notificationId, pt_dl_clicked,this.config);\n}\n}\n//}\n@@ -665,11 +683,11 @@ public class PushTemplateReceiver extends BroadcastReceiver {\n}\nprivate void handleRatingDeepLink(final Context context, final Bundle extras, final int notificationId,\n- final String pt_dl_clicked) throws InterruptedException {\n+ final String pt_dl_clicked, final CleverTapInstanceConfig config) throws InterruptedException {\nThread.sleep(1000);\nnotificationManager.cancel(notificationId);\n- setToast(context, pt_rating_toast);\n+ setToast(context, pt_rating_toast,config);\nIntent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);\ncontext.sendBroadcast(it);\n@@ -1031,9 +1049,10 @@ public class PushTemplateReceiver extends BroadcastReceiver {\n}\n}\n- private void setToast(Context context, String message) {\n+ private void setToast(Context context, String message,\n+ final CleverTapInstanceConfig config) {\nif (message != null && !message.isEmpty()) {\n- Utils.showToast(context, message);\n+ Utils.showToast(context, message,config);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "diff": "@@ -54,9 +54,6 @@ class TemplateRenderer : INotificationRenderer {\ninternal var pt_dot = 0\nprivate var requiresChannelId = false\nprivate var notificationManager: NotificationManager? = null\n- private var asyncHelper: AsyncHelper? = null\n-\n- // private DBHelper dbHelper;\nvar pt_timer_threshold = 0\ninternal var pt_input_label: String? = null\nvar pt_input_feedback: String? = null\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/Utils.java", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/Utils.java", "diff": "@@ -38,6 +38,9 @@ import com.clevertap.android.sdk.CleverTapAPI;\nimport com.clevertap.android.sdk.CleverTapInstanceConfig;\nimport com.clevertap.android.sdk.Constants;\n+import com.clevertap.android.sdk.task.CTExecutorFactory;\n+import com.clevertap.android.sdk.task.Task;\n+import java.util.concurrent.Callable;\nimport org.json.JSONArray;\nimport org.json.JSONException;\nimport org.json.JSONObject;\n@@ -630,25 +633,22 @@ public class Utils {\nreturn actions;\n}\n- static void showToast(final Context context, final String message) {\n- AsyncHelper.getMainThreadHandler().post(new Runnable() {\n- Toast toast;\n-\n- @SuppressLint(\"ShowToast\")\n+ static void showToast(final Context context, final String message,\n+ final CleverTapInstanceConfig config) {\n+ if (config!=null)\n+ {\n+ Task<Void> task = CTExecutorFactory.executors(config).mainTask();\n+ task.execute(\"PushTemplatesUtils#showToast\", new Callable<Void>() {\n@Override\n- public void run() {\n+ public Void call() {\nif (!TextUtils.isEmpty(message)) {\n- if (toast != null) {\n- toast.cancel(); //dismiss current toast if visible\n- toast.setText(message);\n- } else {\n- toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);\n- }\n- toast.show();\n+ Toast.makeText(context, message, Toast.LENGTH_SHORT).show();\n}\n+ return null;\n}\n});\n}\n+ }\nstatic void createSilentNotificationChannel(Context context) {\nNotificationManager notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Remove AsyncHelper.kt and replace it by CTExecutor framework SDK-1056
116,612
15.12.2021 16:41:43
-19,080
58285db7d46170ecbbe07d05199fb69fe8629443
task(Android 12): Rename FcmMessageHandlerImpl to CTFcmMessageHandler
[ { "change_type": "RENAME", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/fcm/FcmMessageHandlerImpl.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/fcm/CTFcmMessageHandler.java", "diff": "@@ -17,15 +17,15 @@ import com.google.firebase.messaging.RemoteMessage;\n/**\n* implementation of {@link IFcmMessageHandler}\n*/\n-public class FcmMessageHandlerImpl implements IFcmMessageHandler, IPushAmpHandler<RemoteMessage> {\n+public class CTFcmMessageHandler implements IFcmMessageHandler, IPushAmpHandler<RemoteMessage> {\nprivate final INotificationParser<RemoteMessage> mParser;\n- public FcmMessageHandlerImpl() {\n+ public CTFcmMessageHandler() {\nthis(new FcmNotificationParser());\n}\n- FcmMessageHandlerImpl(final INotificationParser<RemoteMessage> parser) {\n+ CTFcmMessageHandler(final INotificationParser<RemoteMessage> parser) {\nmParser = parser;\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/fcm/FcmMessageListenerService.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/fcm/FcmMessageListenerService.java", "diff": "@@ -9,7 +9,7 @@ import com.google.firebase.messaging.RemoteMessage;\n*/\npublic class FcmMessageListenerService extends FirebaseMessagingService {\n- private IFcmMessageHandler mHandler = new FcmMessageHandlerImpl();\n+ private IFcmMessageHandler mHandler = new CTFcmMessageHandler();\n@Override\npublic void onMessageReceived(@NonNull RemoteMessage message) {\n" }, { "change_type": "RENAME", "old_path": "clevertap-core/src/test/java/com/clevertap/android/sdk/pushnotification/fcm/FcmMessageHandlerImplTest.kt", "new_path": "clevertap-core/src/test/java/com/clevertap/android/sdk/pushnotification/fcm/CTFcmMessageHandlerTest.kt", "diff": "@@ -19,27 +19,27 @@ import org.robolectric.annotation.Config\n@Ignore\n@RunWith(RobolectricTestRunner::class)\n@Config(sdk = [28], application = TestApplication::class)\n-class FcmMessageHandlerImplTest : BaseTestCase() {\n+class CTFcmMessageHandlerTest : BaseTestCase() {\n- private lateinit var handler: FcmMessageHandlerImpl\n+ private lateinit var mHandlerCT: CTFcmMessageHandler\n@Before\n@Throws(Exception::class)\noverride fun setUp() {\nsuper.setUp()\n- handler = FcmMessageHandlerImpl()\n+ mHandlerCT = CTFcmMessageHandler()\n}\n@Test\nfun testCreateNotification_Null_Message() {\n- Assert.assertFalse(handler.onMessageReceived(application, null))\n+ Assert.assertFalse(mHandlerCT.onMessageReceived(application, null))\n}\n@Test\nfun testCreateNotification_Invalid_Message() {\n//empty bundle\n- Assert.assertFalse(handler.onMessageReceived(application, RemoteMessage(Bundle())))\n+ Assert.assertFalse(mHandlerCT.onMessageReceived(application, RemoteMessage(Bundle())))\n}\n@Test\n@@ -47,7 +47,7 @@ class FcmMessageHandlerImplTest : BaseTestCase() {\nval bundle = Bundle()\nbundle.putString(\"title\", \"Test Title\")\nbundle.putString(\"messagee\", \"Test Message\")\n- Assert.assertFalse(handler.onMessageReceived(application, RemoteMessage(bundle)))\n+ Assert.assertFalse(mHandlerCT.onMessageReceived(application, RemoteMessage(bundle)))\n}\n@Test\n@@ -56,13 +56,13 @@ class FcmMessageHandlerImplTest : BaseTestCase() {\nbundle.putString(\"title\", \"Test Title\")\nbundle.putString(\"messagee\", \"Test Message\")\nbundle.putString(Constants.NOTIFICATION_TAG, \"Some Data\")\n- val isSuccess = handler.onMessageReceived(application, RemoteMessage(bundle))\n+ val isSuccess = mHandlerCT.onMessageReceived(application, RemoteMessage(bundle))\nAssert.assertTrue(isSuccess)\n}\n@Test\nfun testOnNewToken_Success() {\n- Assert.assertTrue(handler.onNewToken(application, FCM_TOKEN))\n+ Assert.assertTrue(mHandlerCT.onNewToken(application, FCM_TOKEN))\n}\n@Test\n@@ -70,7 +70,7 @@ class FcmMessageHandlerImplTest : BaseTestCase() {\nMockito.mockStatic(CleverTapAPI::class.java).use {\nMockito.`when`(CleverTapAPI.tokenRefresh(any(Context::class.java), eq(FCM_TOKEN), FCM))\n.thenThrow(RuntimeException(\"Something Went Wrong\"))\n- Assert.assertFalse(handler.onNewToken(application, FCM_TOKEN))\n+ Assert.assertFalse(mHandlerCT.onNewToken(application, FCM_TOKEN))\n}\n}\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/test/java/com/clevertap/android/sdk/pushnotification/fcm/FcmMessageListenerServiceTest.kt", "new_path": "clevertap-core/src/test/java/com/clevertap/android/sdk/pushnotification/fcm/FcmMessageListenerServiceTest.kt", "diff": "@@ -20,7 +20,7 @@ import org.robolectric.annotation.Config\nclass FcmMessageListenerServiceTest : BaseTestCase() {\nprivate lateinit var service: FcmMessageListenerService\n- private lateinit var mockedMessageHandler: FcmMessageHandlerImpl\n+ private lateinit var mMockedMessageHandlerCT: CTFcmMessageHandler\n@Before\noverride fun setUp() {\n@@ -28,7 +28,7 @@ class FcmMessageListenerServiceTest : BaseTestCase() {\nval serviceController = Robolectric.buildService(FcmMessageListenerService::class.java, Intent())\nserviceController.create().startCommand(0, 1)\nservice = serviceController.get()\n- mockedMessageHandler = Mockito.mock(FcmMessageHandlerImpl::class.java)\n+ mMockedMessageHandlerCT = Mockito.mock(CTFcmMessageHandler::class.java)\n}\n@Test\n@@ -36,7 +36,7 @@ class FcmMessageListenerServiceTest : BaseTestCase() {\ntry {\nservice.onNewToken(FCM_TOKEN)\nMockito.verify(\n- mockedMessageHandler.onNewToken(\n+ mMockedMessageHandlerCT.onNewToken(\nMockito.any(Context::class.java),\nMockito.eq(FCM_TOKEN)\n), Mockito.times(1)\n@@ -51,7 +51,7 @@ class FcmMessageListenerServiceTest : BaseTestCase() {\ntry {\nservice.onMessageReceived(RemoteMessage(Bundle()))\nMockito.verify(\n- mockedMessageHandler.onMessageReceived(\n+ mMockedMessageHandlerCT.onMessageReceived(\nMockito.any(Context::class.java),\nMockito.any(RemoteMessage::class.java)\n), Mockito.times(1)\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/MyFcmMessageListenerService.kt", "new_path": "sample/src/main/java/com/clevertap/demo/MyFcmMessageListenerService.kt", "diff": "package com.clevertap.demo\n-import com.clevertap.android.sdk.pushnotification.fcm.FcmMessageHandlerImpl\n+import com.clevertap.android.sdk.pushnotification.fcm.CTFcmMessageHandler\nimport com.google.firebase.messaging.FirebaseMessagingService\nimport com.google.firebase.messaging.RemoteMessage\n@@ -10,8 +10,9 @@ class MyFcmMessageListenerService : FirebaseMessagingService() {\nsuper.onMessageReceived(message)\nvar pushType = \"fcm\"\nif (pushType.equals(\"fcm\")) {\n- FcmMessageHandlerImpl().onMessageReceived(applicationContext, message)\n- //FcmMessageHandlerImpl().processPushAmp(applicationContext, message)\n+ CTFcmMessageHandler()\n+ .onMessageReceived(applicationContext, message)\n+ //CTFcmMessageHandler().processPushAmp(applicationContext, message)\n} else if (pushType.equals(\"hps\")) {\n//HmsMessageHandlerImpl().createNotification(applicationContext,message)\n//HmsMessageHandlerImpl().processPushAmp(applicationContext,message)\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Rename FcmMessageHandlerImpl to CTFcmMessageHandler SDK-1056
116,616
15.12.2021 17:09:20
-19,080
49f3bb137648b5720eecf19e0f4fddc99b55cf1b
task(refactor): PTReceiver merge conflict resolve
[ { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/PushTemplateReceiver.java", "diff": "@@ -658,18 +658,22 @@ public class PushTemplateReceiver extends BroadcastReceiver {\nnotificationManager.notify(notificationId, notification);\n}\n- if (VERSION.SDK_INT < VERSION_CODES.S){\n- handleRatingDeepLink(context, extras, notificationId, pt_dl_clicked);\n+ if (VERSION.SDK_INT < VERSION_CODES.S)\n+ {\n+ Utils.raiseNotificationClicked(context, extras, this.config);\n+ handleRatingDeepLink(context, extras, notificationId, pt_dl_clicked,this.config);\n}\n}\nelse{\nextras.putString(Constants.EXTRAS_FROM,\"PTReceiver\");\nBundle clonedExtras = (Bundle) extras.clone();\nNotificationHandler notificationHandler = CleverTapAPI.getNotificationHandler();\n- if (notificationHandler!=null){\n+ if (notificationHandler!=null)\n+ {\nnotificationHandler.onMessageReceived(context,extras,\"FCM\");\nclonedExtras.putString(Constants.DEEP_LINK_KEY, pt_dl_clicked);\n- handleRatingDeepLink(context, clonedExtras, notificationId, pt_dl_clicked);\n+ Utils.raiseNotificationClicked(context, clonedExtras, this.config);\n+ handleRatingDeepLink(context, clonedExtras, notificationId, pt_dl_clicked,this.config);\n}\n}\nUtils.raiseCleverTapEvent(context,config,\"Rating Submitted\", Utils.convertRatingBundleObjectToHashMap(extras));\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): PTReceiver merge conflict resolve
116,612
15.12.2021 17:11:00
-19,080
a69c34493e4013b79c74bda634ef2ea32e1c3002
task(Android 12): Rename onMessageReceived of IFcmMessageHandler to createNotification
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/fcm/CTFcmMessageHandler.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/fcm/CTFcmMessageHandler.java", "diff": "@@ -30,7 +30,7 @@ public class CTFcmMessageHandler implements IFcmMessageHandler, IPushAmpHandler<\n}\n@Override\n- public boolean onMessageReceived(final Context context, final RemoteMessage message) {\n+ public boolean createNotification(final Context context, final RemoteMessage message) {\nboolean isSuccess = false;\nBundle messageBundle = mParser.toBundle(message);\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/fcm/FcmMessageListenerService.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/fcm/FcmMessageListenerService.java", "diff": "@@ -13,7 +13,7 @@ public class FcmMessageListenerService extends FirebaseMessagingService {\n@Override\npublic void onMessageReceived(@NonNull RemoteMessage message) {\n- mHandler.onMessageReceived(getApplicationContext(), message);\n+ mHandler.createNotification(getApplicationContext(), message);\n}\n@Override\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/fcm/IFcmMessageHandler.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/pushnotification/fcm/IFcmMessageHandler.java", "diff": "@@ -15,7 +15,7 @@ public interface IFcmMessageHandler {\n* @param message - Firebase Remote message\n* @return true if everything is fine & notification is rendered successfully\n*/\n- boolean onMessageReceived(final Context applicationContext, RemoteMessage message);\n+ boolean createNotification(final Context applicationContext, RemoteMessage message);\n/**\n* @param applicationContext - application context\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/test/java/com/clevertap/android/sdk/pushnotification/fcm/CTFcmMessageHandlerTest.kt", "new_path": "clevertap-core/src/test/java/com/clevertap/android/sdk/pushnotification/fcm/CTFcmMessageHandlerTest.kt", "diff": "@@ -33,13 +33,13 @@ class CTFcmMessageHandlerTest : BaseTestCase() {\n@Test\nfun testCreateNotification_Null_Message() {\n- Assert.assertFalse(mHandlerCT.onMessageReceived(application, null))\n+ Assert.assertFalse(mHandlerCT.createNotification(application, null))\n}\n@Test\nfun testCreateNotification_Invalid_Message() {\n//empty bundle\n- Assert.assertFalse(mHandlerCT.onMessageReceived(application, RemoteMessage(Bundle())))\n+ Assert.assertFalse(mHandlerCT.createNotification(application, RemoteMessage(Bundle())))\n}\n@Test\n@@ -47,7 +47,7 @@ class CTFcmMessageHandlerTest : BaseTestCase() {\nval bundle = Bundle()\nbundle.putString(\"title\", \"Test Title\")\nbundle.putString(\"messagee\", \"Test Message\")\n- Assert.assertFalse(mHandlerCT.onMessageReceived(application, RemoteMessage(bundle)))\n+ Assert.assertFalse(mHandlerCT.createNotification(application, RemoteMessage(bundle)))\n}\n@Test\n@@ -56,7 +56,7 @@ class CTFcmMessageHandlerTest : BaseTestCase() {\nbundle.putString(\"title\", \"Test Title\")\nbundle.putString(\"messagee\", \"Test Message\")\nbundle.putString(Constants.NOTIFICATION_TAG, \"Some Data\")\n- val isSuccess = mHandlerCT.onMessageReceived(application, RemoteMessage(bundle))\n+ val isSuccess = mHandlerCT.createNotification(application, RemoteMessage(bundle))\nAssert.assertTrue(isSuccess)\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-core/src/test/java/com/clevertap/android/sdk/pushnotification/fcm/FcmMessageListenerServiceTest.kt", "new_path": "clevertap-core/src/test/java/com/clevertap/android/sdk/pushnotification/fcm/FcmMessageListenerServiceTest.kt", "diff": "@@ -51,7 +51,7 @@ class FcmMessageListenerServiceTest : BaseTestCase() {\ntry {\nservice.onMessageReceived(RemoteMessage(Bundle()))\nMockito.verify(\n- mMockedMessageHandlerCT.onMessageReceived(\n+ mMockedMessageHandlerCT.createNotification(\nMockito.any(Context::class.java),\nMockito.any(RemoteMessage::class.java)\n), Mockito.times(1)\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/MyFcmMessageListenerService.kt", "new_path": "sample/src/main/java/com/clevertap/demo/MyFcmMessageListenerService.kt", "diff": "@@ -11,7 +11,7 @@ class MyFcmMessageListenerService : FirebaseMessagingService() {\nvar pushType = \"fcm\"\nif (pushType.equals(\"fcm\")) {\nCTFcmMessageHandler()\n- .onMessageReceived(applicationContext, message)\n+ .createNotification(applicationContext, message)\n//CTFcmMessageHandler().processPushAmp(applicationContext, message)\n} else if (pushType.equals(\"hps\")) {\n//HmsMessageHandlerImpl().createNotification(applicationContext,message)\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Rename onMessageReceived of IFcmMessageHandler to createNotification SDK-1056
116,616
15.12.2021 17:12:45
-19,080
9e68bf7426599b3fb8b3a6a7f98678a65e1b72fc
task(refactor): Manual carousel image rotation bug fix
[ { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/content/ManualCarouselContentView.kt", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/content/ManualCarouselContentView.kt", "diff": "@@ -133,6 +133,7 @@ class ManualCarouselContentView(context: Context, renderer: TemplateRenderer,ext\n// )\n} else {\nremoteView.setDisplayedChild(R.id.carousel_image_right, 1)\n+ remoteView.setDisplayedChild(R.id.carousel_image,0)\nremoteView.setDisplayedChild(\nR.id.carousel_image_left,\ntempImageList.size - 1\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Manual carousel image rotation bug fix
116,612
15.12.2021 17:18:02
-19,080
3d945a30dd36edb4962d8dde97491b7cd13bf612
task(Android 12): Rename HmsMessageHandlerImpl to CTHmsMessageHandler
[ { "change_type": "RENAME", "old_path": "clevertap-hms/src/main/java/com/clevertap/android/hms/HmsMessageHandlerImpl.java", "new_path": "clevertap-hms/src/main/java/com/clevertap/android/hms/CTHmsMessageHandler.java", "diff": "@@ -18,15 +18,15 @@ import com.huawei.hms.push.RemoteMessage;\n/**\n* Implementation of {@link IHmsMessageHandler}\n*/\n-public class HmsMessageHandlerImpl implements IHmsMessageHandler, IPushAmpHandler<RemoteMessage> {\n+public class CTHmsMessageHandler implements IHmsMessageHandler, IPushAmpHandler<RemoteMessage> {\nprivate final INotificationParser<RemoteMessage> mParser;\n- public HmsMessageHandlerImpl() {\n+ public CTHmsMessageHandler() {\nthis(new HmsNotificationParser());\n}\n- HmsMessageHandlerImpl(final INotificationParser<RemoteMessage> parser) {\n+ CTHmsMessageHandler(final INotificationParser<RemoteMessage> parser) {\nmParser = parser;\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-hms/src/main/java/com/clevertap/android/hms/CTHmsMessageService.java", "new_path": "clevertap-hms/src/main/java/com/clevertap/android/hms/CTHmsMessageService.java", "diff": "@@ -12,7 +12,7 @@ import com.huawei.hms.push.RemoteMessage;\n*/\npublic class CTHmsMessageService extends HmsMessageService {\n- private IHmsMessageHandler mHandler = new HmsMessageHandlerImpl(new HmsNotificationParser());\n+ private IHmsMessageHandler mHandler = new CTHmsMessageHandler(new HmsNotificationParser());\n@Override\npublic void onMessageReceived(RemoteMessage remoteMessage) {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-hms/src/test/java/com/clevertap/android/hms/HmsMessageHandlerTest.kt", "new_path": "clevertap-hms/src/test/java/com/clevertap/android/hms/HmsMessageHandlerTest.kt", "diff": "@@ -5,6 +5,7 @@ import android.os.Bundle\nimport com.clevertap.android.hms.HmsTestConstants.Companion.HMS_TOKEN\nimport com.clevertap.android.sdk.CleverTapAPI\nimport com.clevertap.android.sdk.Constants\n+import com.clevertap.android.sdk.interfaces.INotificationParser\nimport com.clevertap.android.sdk.pushnotification.PushConstants.PushType.HPS\nimport com.clevertap.android.shared.test.BaseTestCase\nimport com.clevertap.android.shared.test.TestApplication\n@@ -19,20 +20,20 @@ import org.robolectric.annotation.Config\n@Config(sdk = [28], application = TestApplication::class)\nclass HmsMessageHandlerTest : BaseTestCase() {\n- private lateinit var handler: HmsMessageHandlerImpl\n- private lateinit var parser: IHmsNotificationParser\n+ private lateinit var mHandlerCT: CTHmsMessageHandler\n+ private lateinit var parser: INotificationParser<RemoteMessage>\n@Before\n@Throws(Exception::class)\noverride fun setUp() {\nsuper.setUp()\nparser = mock(HmsNotificationParser::class.java)\n- handler = HmsMessageHandlerImpl(parser)\n+ mHandlerCT = CTHmsMessageHandler(parser)\n}\n@Test\nfun testCreateNotification_Null_Message() {\n- val isSuccess = handler.createNotification(application, null)\n+ val isSuccess = mHandlerCT.createNotification(application, null)\nAssert.assertFalse(isSuccess)\n}\n@@ -44,7 +45,7 @@ class HmsMessageHandlerTest : BaseTestCase() {\n`when`(CleverTapAPI.createNotification(application, bundle)).thenThrow(\nRuntimeException(\"Something went wrong\")\n)\n- val isSuccess = handler.createNotification(application, RemoteMessage(bundle))\n+ val isSuccess = mHandlerCT.createNotification(application, RemoteMessage(bundle))\nAssert.assertFalse(isSuccess)\n}\n}\n@@ -52,7 +53,7 @@ class HmsMessageHandlerTest : BaseTestCase() {\n@Test\nfun testCreateNotification_Valid_Message() {\n`when`(parser.toBundle(any(RemoteMessage::class.java))).thenReturn(Bundle())\n- val isSuccess = handler.createNotification(application, RemoteMessage(Bundle()))\n+ val isSuccess = mHandlerCT.createNotification(application, RemoteMessage(Bundle()))\nAssert.assertTrue(isSuccess)\n}\n@@ -61,13 +62,13 @@ class HmsMessageHandlerTest : BaseTestCase() {\nval bundle = Bundle()\nbundle.putString(Constants.WZRK_ACCT_ID_KEY, \"Some Value\")\n`when`(parser.toBundle(any(RemoteMessage::class.java))).thenReturn(bundle)\n- val isSuccess = handler.createNotification(application, RemoteMessage(Bundle()))\n+ val isSuccess = mHandlerCT.createNotification(application, RemoteMessage(Bundle()))\nAssert.assertTrue(isSuccess)\n}\n@Test\nfun testOnNewToken_Success() {\n- Assert.assertTrue(handler.onNewToken(application, HMS_TOKEN))\n+ Assert.assertTrue(mHandlerCT.onNewToken(application, HMS_TOKEN))\n}\n@Test\n@@ -75,7 +76,7 @@ class HmsMessageHandlerTest : BaseTestCase() {\nmockStatic(CleverTapAPI::class.java).use {\n`when`(CleverTapAPI.tokenRefresh(any(Context::class.java), eq(HMS_TOKEN), eq(HPS)))\n.thenThrow(RuntimeException(\"Something Went Wrong\"))\n- Assert.assertFalse(handler.onNewToken(application, HMS_TOKEN))\n+ Assert.assertFalse(mHandlerCT.onNewToken(application, HMS_TOKEN))\n}\n}\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-hms/src/test/java/com/clevertap/android/hms/HmsMessageServiceTest.kt", "new_path": "clevertap-hms/src/test/java/com/clevertap/android/hms/HmsMessageServiceTest.kt", "diff": "@@ -17,7 +17,7 @@ import org.robolectric.annotation.Config\nclass HmsMessageServiceTest : BaseTestCase() {\nprivate lateinit var service: CTHmsMessageService\n- private lateinit var mockedMessageHandler: HmsMessageHandlerImpl\n+ private lateinit var mMockedMessageHandlerCT: CTHmsMessageHandler\n@Before\noverride fun setUp() {\n@@ -26,7 +26,7 @@ class HmsMessageServiceTest : BaseTestCase() {\nCTHmsMessageService\n::class.java\n)\n- mockedMessageHandler = mock(HmsMessageHandlerImpl::class.java)\n+ mMockedMessageHandlerCT = mock(CTHmsMessageHandler::class.java)\ndoReturn(application).`when`(service).applicationContext\n}\n@@ -35,7 +35,7 @@ class HmsMessageServiceTest : BaseTestCase() {\ntry {\nservice.onNewToken(HMS_TOKEN)\nverify(\n- mockedMessageHandler.onNewToken(\n+ mMockedMessageHandlerCT.onNewToken(\nany(Context::class.java),\neq(HMS_TOKEN)\n), times(1)\n@@ -50,7 +50,7 @@ class HmsMessageServiceTest : BaseTestCase() {\ntry {\nservice.onMessageReceived(RemoteMessage(Bundle()))\nverify(\n- mockedMessageHandler.createNotification(\n+ mMockedMessageHandlerCT.createNotification(\nany(Context::class.java),\nany(RemoteMessage::class.java)\n), times(1)\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/MyFcmMessageListenerService.kt", "new_path": "sample/src/main/java/com/clevertap/demo/MyFcmMessageListenerService.kt", "diff": "@@ -14,8 +14,8 @@ class MyFcmMessageListenerService : FirebaseMessagingService() {\n.createNotification(applicationContext, message)\n//CTFcmMessageHandler().processPushAmp(applicationContext, message)\n} else if (pushType.equals(\"hps\")) {\n- //HmsMessageHandlerImpl().createNotification(applicationContext,message)\n- //HmsMessageHandlerImpl().processPushAmp(applicationContext,message)\n+ //CTHmsMessageHandler().createNotification(applicationContext,message)\n+ //CTHmsMessageHandler().processPushAmp(applicationContext,message)\n} else if (pushType.equals(\"xps\")) {\n//XiaomiMessageHandlerImpl().createNotification(applicationContext,message)\n//XiaomiMessageHandlerImpl().processPushAmp(applicationContext,message)\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Rename HmsMessageHandlerImpl to CTHmsMessageHandler SDK-1056
116,612
15.12.2021 17:22:03
-19,080
64c6e22aa299aaae7309242b8f6176788a6890d8
task(Android 12): Rename XiaomiMessageHandlerImpl to CTXiaomiMessageHandler
[ { "change_type": "RENAME", "old_path": "clevertap-xps/src/main/java/com/clevertap/android/xps/XiaomiMessageHandlerImpl.java", "new_path": "clevertap-xps/src/main/java/com/clevertap/android/xps/CTXiaomiMessageHandler.java", "diff": "@@ -27,17 +27,17 @@ import java.util.List;\n/**\n* Implementation of {@link IMiMessageHandler}\n*/\n-public class XiaomiMessageHandlerImpl implements IMiMessageHandler, IPushAmpHandler<MiPushMessage> {\n+public class CTXiaomiMessageHandler implements IMiMessageHandler, IPushAmpHandler<MiPushMessage> {\nprivate @NonNull\nfinal\nINotificationParser<MiPushMessage> mParser;\n- public XiaomiMessageHandlerImpl() {\n+ public CTXiaomiMessageHandler() {\nthis(new XiaomiNotificationParser());\n}\n- XiaomiMessageHandlerImpl(@NonNull final INotificationParser<MiPushMessage> parser) {\n+ CTXiaomiMessageHandler(@NonNull final INotificationParser<MiPushMessage> parser) {\nmParser = parser;\n}\n" }, { "change_type": "MODIFY", "old_path": "clevertap-xps/src/main/java/com/clevertap/android/xps/XiaomiMessageReceiver.java", "new_path": "clevertap-xps/src/main/java/com/clevertap/android/xps/XiaomiMessageReceiver.java", "diff": "@@ -14,7 +14,7 @@ import com.xiaomi.mipush.sdk.PushMessageReceiver;\n*/\npublic class XiaomiMessageReceiver extends PushMessageReceiver {\n- private IMiMessageHandler handler = new XiaomiMessageHandlerImpl(new XiaomiNotificationParser());\n+ private IMiMessageHandler handler = new CTXiaomiMessageHandler(new XiaomiNotificationParser());\n@Override\npublic void onNotificationMessageArrived(Context context, MiPushMessage miPushMessage) {\n" }, { "change_type": "MODIFY", "old_path": "clevertap-xps/src/test/java/com/clevertap/android/xps/XiaomiMessageHandlerTest.kt", "new_path": "clevertap-xps/src/test/java/com/clevertap/android/xps/XiaomiMessageHandlerTest.kt", "diff": "@@ -3,6 +3,7 @@ package com.clevertap.android.xps\nimport android.os.Bundle\nimport com.clevertap.android.sdk.CleverTapAPI\nimport com.clevertap.android.sdk.Constants\n+import com.clevertap.android.sdk.interfaces.INotificationParser\nimport com.clevertap.android.shared.test.BaseTestCase\nimport com.clevertap.android.shared.test.TestApplication\nimport com.clevertap.android.xps.XpsConstants.FAILED_WITH_EXCEPTION\n@@ -25,20 +26,20 @@ import org.robolectric.annotation.Config\n@Config(sdk = [28], application = TestApplication::class)\nclass XiaomiMessageHandlerTest : BaseTestCase() {\n- private lateinit var handler: XiaomiMessageHandlerImpl\n- private lateinit var parser: IXiaomiNotificationParser\n+ private lateinit var mHandlerCT: CTXiaomiMessageHandler\n+ private lateinit var parser: INotificationParser<MiPushMessage>\n@Before\n@Throws(Exception::class)\noverride fun setUp() {\nsuper.setUp()\nparser = mock(XiaomiNotificationParser::class.java)\n- handler = XiaomiMessageHandlerImpl(parser)\n+ mHandlerCT = CTXiaomiMessageHandler(parser)\n}\n@Test\nfun testCreateNotification_Null_Message() {\n- val isSuccess = handler.createNotification(application, null)\n+ val isSuccess = mHandlerCT.createNotification(application, null)\nAssert.assertFalse(isSuccess)\n}\n@@ -50,7 +51,7 @@ class XiaomiMessageHandlerTest : BaseTestCase() {\n`when`(CleverTapAPI.createNotification(application, bundle)).thenThrow(\nRuntimeException(\"Something went wrong\")\n)\n- val isSuccess = handler.createNotification(application, MiPushMessage())\n+ val isSuccess = mHandlerCT.createNotification(application, MiPushMessage())\nAssert.assertFalse(isSuccess)\n}\n}\n@@ -58,7 +59,7 @@ class XiaomiMessageHandlerTest : BaseTestCase() {\n@Test\nfun testCreateNotification_Valid_Message() {\n`when`(parser.toBundle(any(MiPushMessage::class.java))).thenReturn(Bundle())\n- val isSuccess = handler.createNotification(application, MiPushMessage())\n+ val isSuccess = mHandlerCT.createNotification(application, MiPushMessage())\nAssert.assertTrue(isSuccess)\n}\n@@ -67,7 +68,7 @@ class XiaomiMessageHandlerTest : BaseTestCase() {\nval bundle = Bundle()\nbundle.putString(Constants.WZRK_ACCT_ID_KEY, \"Some Value\")\n`when`(parser.toBundle(any(MiPushMessage::class.java))).thenReturn(bundle)\n- val isSuccess = handler.createNotification(application, MiPushMessage())\n+ val isSuccess = mHandlerCT.createNotification(application, MiPushMessage())\nAssert.assertTrue(isSuccess)\n}\n@@ -75,7 +76,7 @@ class XiaomiMessageHandlerTest : BaseTestCase() {\nfun testOnReceivePassThroughMessage_Other_Command() {\nval message = mock(MiPushCommandMessage::class.java)\n`when`(message.command).thenReturn(COMMAND_UNSET_ACCOUNT)\n- val result = handler.onReceiveRegisterResult(application, message)\n+ val result = mHandlerCT.onReceiveRegisterResult(application, message)\nAssert.assertEquals(result, OTHER_COMMAND)\n}\n@@ -85,7 +86,7 @@ class XiaomiMessageHandlerTest : BaseTestCase() {\n`when`(message.command).thenReturn(COMMAND_REGISTER)\n`when`(message.resultCode).thenReturn(SUCCESS.toLong())\n`when`(message.commandArguments).thenReturn(listOf(MI_TOKEN))\n- val result = handler.onReceiveRegisterResult(application, message)\n+ val result = mHandlerCT.onReceiveRegisterResult(application, message)\nAssert.assertEquals(result, TOKEN_SUCCESS)\n}\n@@ -95,7 +96,7 @@ class XiaomiMessageHandlerTest : BaseTestCase() {\n`when`(message.command).thenReturn(COMMAND_REGISTER)\n`when`(message.resultCode).thenReturn(SUCCESS.toLong())\n`when`(message.commandArguments).thenReturn(emptyList())\n- val result = handler.onReceiveRegisterResult(application, message)\n+ val result = mHandlerCT.onReceiveRegisterResult(application, message)\nAssert.assertEquals(result, XpsConstants.INVALID_TOKEN)\n}\n@@ -105,7 +106,7 @@ class XiaomiMessageHandlerTest : BaseTestCase() {\n`when`(message.command).thenReturn(COMMAND_REGISTER)\n`when`(message.resultCode).thenReturn(ERROR_SERVICE_UNAVAILABLE.toLong())\n`when`(message.commandArguments).thenReturn(emptyList())\n- val result = handler.onReceiveRegisterResult(application, message)\n+ val result = mHandlerCT.onReceiveRegisterResult(application, message)\nAssert.assertEquals(result, XpsConstants.TOKEN_FAILURE)\n}\n@@ -115,7 +116,7 @@ class XiaomiMessageHandlerTest : BaseTestCase() {\n`when`(message.command).thenReturn(COMMAND_REGISTER)\n`when`(message.resultCode).thenReturn(SUCCESS.toLong())\n`when`(message.commandArguments).thenThrow(RuntimeException(\"Something went wrong\"))\n- val result = handler.onReceiveRegisterResult(application, message)\n+ val result = mHandlerCT.onReceiveRegisterResult(application, message)\nAssert.assertEquals(result, FAILED_WITH_EXCEPTION)\n}\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-xps/src/test/java/com/clevertap/android/xps/XiaomiMessageReceiverTest.kt", "new_path": "clevertap-xps/src/test/java/com/clevertap/android/xps/XiaomiMessageReceiverTest.kt", "diff": "@@ -16,32 +16,32 @@ import org.robolectric.annotation.Config\nclass XiaomiMessageReceiverTest : BaseTestCase() {\nprivate lateinit var receiver: XiaomiMessageReceiver\n- private lateinit var handler: XiaomiMessageHandlerImpl\n+ private lateinit var mHandlerCT: CTXiaomiMessageHandler\n@Before\noverride fun setUp() {\nsuper.setUp()\nreceiver = XiaomiMessageReceiver()\n- handler = mock(XiaomiMessageHandlerImpl::class.java)\n- receiver.setHandler(handler)\n+ mHandlerCT = mock(CTXiaomiMessageHandler::class.java)\n+ receiver.setHandler(mHandlerCT)\n}\n@Test\nfun testOnReceivePassThroughMessage() {\nreceiver.onReceivePassThroughMessage(application, MiPushMessage())\n- verify(handler).createNotification(any(Context::class.java), any(MiPushMessage::class.java))\n+ verify(mHandlerCT).createNotification(any(Context::class.java), any(MiPushMessage::class.java))\n}\n@Test\nfun testOnReceiveRegisterResult() {\nreceiver.onReceiveRegisterResult(application, MiPushCommandMessage())\n- verify(handler)\n+ verify(mHandlerCT)\n.onReceiveRegisterResult(any(Context::class.java), any(MiPushCommandMessage::class.java))\n}\n@Test\nfun testOnNotificationMessageArrived() {\nreceiver.onNotificationMessageArrived(application, MiPushMessage())\n- verify(handler).createNotification(any(Context::class.java), any(MiPushMessage::class.java))\n+ verify(mHandlerCT).createNotification(any(Context::class.java), any(MiPushMessage::class.java))\n}\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/MyFcmMessageListenerService.kt", "new_path": "sample/src/main/java/com/clevertap/demo/MyFcmMessageListenerService.kt", "diff": "@@ -17,8 +17,8 @@ class MyFcmMessageListenerService : FirebaseMessagingService() {\n//CTHmsMessageHandler().createNotification(applicationContext,message)\n//CTHmsMessageHandler().processPushAmp(applicationContext,message)\n} else if (pushType.equals(\"xps\")) {\n- //XiaomiMessageHandlerImpl().createNotification(applicationContext,message)\n- //XiaomiMessageHandlerImpl().processPushAmp(applicationContext,message)\n+ //CTXiaomiMessageHandler().createNotification(applicationContext,message)\n+ //CTXiaomiMessageHandler().processPushAmp(applicationContext,message)\n}\n}\n}\n\\ No newline at end of file\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Rename XiaomiMessageHandlerImpl to CTXiaomiMessageHandler SDK-1056
116,616
15.12.2021 19:19:12
-19,080
783cdff023d046fcfaef04ce818f162b2b69074c
task(refactor): Basic render in Timer after threshold value bug fix
[ { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt", "diff": "@@ -238,6 +238,7 @@ class TemplateRenderer : INotificationRenderer {\n// force random id generation\nbasicTemplateBundle.putString(PTConstants.PT_COLLAPSE_KEY, null)\nbasicTemplateBundle.putString(Constants.WZRK_COLLAPSE, null)\n+ basicTemplateBundle.remove(Constants.PT_NOTIF_ID)\nval templateRenderer: INotificationRenderer =\nTemplateRenderer(applicationContext, basicTemplateBundle)\nval cleverTapAPI = CleverTapAPI\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Basic render in Timer after threshold value bug fix
116,612
15.12.2021 20:16:22
-19,080
1ee7e89c57048cde1ffe4ed9f6ebd0691b03a3df
task(Android 12): Add pushamp response handling for push templates
[ { "change_type": "MODIFY", "old_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/response/PushAmpResponse.java", "new_path": "clevertap-core/src/main/java/com/clevertap/android/sdk/response/PushAmpResponse.java", "diff": "@@ -10,6 +10,8 @@ import com.clevertap.android.sdk.Constants;\nimport com.clevertap.android.sdk.ControllerManager;\nimport com.clevertap.android.sdk.Logger;\nimport com.clevertap.android.sdk.db.BaseDatabaseManager;\n+import com.clevertap.android.sdk.pushnotification.PushConstants.PushType;\n+import com.clevertap.android.sdk.pushnotification.PushNotificationHandler;\nimport java.util.Iterator;\nimport org.json.JSONArray;\nimport org.json.JSONException;\n@@ -124,8 +126,8 @@ public class PushAmpResponse extends CleverTapResponseDecorator {\nif (callbackManager.getPushAmpListener() != null) {\ncallbackManager.getPushAmpListener().onPushAmpPayloadReceived(pushBundle);\n} else {\n- controllerManager.getPushProviders()\n- ._createNotification(context, pushBundle, Constants.EMPTY_NOTIFICATION_ID);\n+ PushNotificationHandler.getPushNotificationHandler()\n+ .onMessageReceived(context, pushBundle, PushType.FCM.toString());\n}\n} else {\nlogger.verbose(config.getAccountId(),\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/AndroidManifest.xml", "new_path": "sample/src/main/AndroidManifest.xml", "diff": "<!-- Add meta data for CleverTap Account Id and Account Token -->\n<meta-data\nandroid:name=\"CLEVERTAP_ACCOUNT_ID\"\n- android:value=\"ZWW-WWW-WWRZ\" />\n+ android:value=\"TEST-46W-WWR-R85Z\" />\n<meta-data\nandroid:name=\"CLEVERTAP_TOKEN\"\n- android:value=\"000-001\" />\n+ android:value=\"TEST-200-064\" />\n<!-- Xiaomi Push -->\n<meta-data\n</intent-filter>\n</activity>\n- <meta-data\n- android:name=\"CLEVERTAP_BACKGROUND_SYNC\"\n- android:value=\"1\" />\n</application>\n</manifest>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenViewModel.kt", "new_path": "sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenViewModel.kt", "diff": "@@ -20,7 +20,9 @@ class HomeScreenViewModel(private val cleverTapAPI: CleverTapAPI?) : ViewModel()\nval commandPosition = \"$groupPosition$childPosition\"\nclickCommand.value = commandPosition\nwhen (commandPosition) {\n- \"00\" -> cleverTapAPI?.pushEvent(\"testEvent\")\n+ \"00\" -> {\n+ cleverTapAPI?.pushEvent(\"testEventPushAmp\")\n+ }\n\"01\" -> {\n//Record an event with properties\nval prodViewedAction = mapOf(\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(Android 12): Add pushamp response handling for push templates SDK-1056
116,616
15.12.2021 20:34:40
-19,080
36e03653f75707e14e049c76b7704bb0a32f3d8a
task(refactor): Single line for title(collapsed), 3 lines for msg(collapsed) for for all device API's, timer layout fix for API 31, add image_only_big.xml for API 31
[ { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout-v31/content_view_small_multi_line_msg.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout-v31/content_view_small_multi_line_msg.xml", "diff": "android:layout_alignParentStart=\"true\"\nandroid:layout_toStartOf=\"@+id/large_icon\"\nandroid:text=\"title\"\n+ android:maxLines=\"1\"\n+ android:ellipsize=\"end\"\nandroid:textAppearance=\"@style/PushTitle\" />\n<TextView\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout-v31/content_view_small_single_line_msg.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout-v31/content_view_small_single_line_msg.xml", "diff": "android:layout_marginEnd=\"@dimen/metadata_title_margin_horizontal\"\nandroid:layout_alignParentStart=\"true\"\nandroid:layout_toStartOf=\"@+id/large_icon\"\n+ android:maxLines=\"1\"\n+ android:ellipsize=\"end\"\nandroid:text=\"title\"\nandroid:textAppearance=\"@style/PushTitle\" />\nandroid:text=\"message message\"\nandroid:textAppearance=\"@style/PushMessage\"\nandroid:maxLines=\"1\"\n- android:ellipsize=\"end\"\n- />\n-\n+ android:ellipsize=\"end\"/>\n<ImageView\nandroid:id=\"@+id/large_icon\"\nandroid:layout_marginStart=\"@dimen/metadata_title_margin_horizontal\"\nandroid:layout_alignParentEnd=\"true\"\nandroid:scaleType=\"centerCrop\" />\n+\n</RelativeLayout>\n</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushtemplates/src/main/res/layout-v31/image_only_big.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_big\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:background=\"@android:color/white\"\n+ android:orientation=\"vertical\">\n+\n+ <include\n+ android:id=\"@+id/rel_lyt\"\n+ layout=\"@layout/content_view_small_multi_line_msg\" />\n+\n+ <ImageView\n+ android:id=\"@+id/big_image\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:layout_marginTop=\"4dp\"\n+ android:scaleType=\"centerCrop\" />\n+</LinearLayout>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clevertap-pushtemplates/src/main/res/layout-v31/timer_collapsed.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:id=\"@+id/content_view_small\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"wrap_content\"\n+ android:background=\"@android:color/white\"\n+ android:orientation=\"vertical\">\n+\n+ <include\n+ android:id=\"@+id/rel_lyt\"\n+ layout=\"@layout/content_view_small_single_line_msg\" />\n+\n+ <Chronometer\n+ android:id=\"@+id/chronometer\"\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_alignParentEnd=\"true\"\n+ android:layout_centerVertical=\"true\"\n+ android:textAlignment=\"center\"\n+ android:layout_gravity=\"center_horizontal\"\n+ android:textSize=\"@dimen/chronometer_font_size\"/>\n+\n+</RelativeLayout>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/content_view_small_multi_line_msg.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/content_view_small_multi_line_msg.xml", "diff": "android:layout_toStartOf=\"@+id/large_icon\"\nandroid:layout_toLeftOf=\"@id/large_icon\"\nandroid:text=\"title\"\n+ android:maxLines=\"1\"\n+ android:ellipsize=\"end\"\nandroid:textAppearance=\"@style/PushTitle\" />\n<TextView\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/content_view_small_single_line_msg.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/content_view_small_single_line_msg.xml", "diff": "android:layout_toStartOf=\"@+id/large_icon\"\nandroid:layout_toLeftOf=\"@id/large_icon\"\nandroid:text=\"title\"\n+ android:maxLines=\"1\"\n+ android:ellipsize=\"end\"\nandroid:textAppearance=\"@style/PushTitle\"/>\n<TextView\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Single line for title(collapsed), 3 lines for msg(collapsed) for for all device API's, timer layout fix for API 31, add image_only_big.xml for API 31
116,616
16.12.2021 12:18:29
-19,080
8f57422c5d3617db060154b1b43f32679fa75847
task(refactor): Update FiveIcon to support 3 or more images/dls
[ { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/content/FiveIconBigContentView.kt", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/content/FiveIconBigContentView.kt", "diff": "@@ -25,6 +25,7 @@ class FiveIconBigContentView constructor(\nvar imageCounter = 0\nfor (imageKey in renderer.imageList!!.indices) {\nif (imageKey == 0) {\n+ remoteView.setViewVisibility(R.id.cta1, View.VISIBLE)\nUtils.loadImageURLIntoRemoteView(\nR.id.cta1,\nrenderer.imageList!![imageKey],\n@@ -35,6 +36,7 @@ class FiveIconBigContentView constructor(\nimageCounter++\n}\n} else if (imageKey == 1) {\n+ remoteView.setViewVisibility(R.id.cta2, View.VISIBLE)\nUtils.loadImageURLIntoRemoteView(\nR.id.cta2,\nrenderer.imageList!![imageKey],\n@@ -45,6 +47,7 @@ class FiveIconBigContentView constructor(\nremoteView.setViewVisibility(R.id.cta2, View.GONE)\n}\n} else if (imageKey == 2) {\n+ remoteView.setViewVisibility(R.id.cta3, View.VISIBLE)\nUtils.loadImageURLIntoRemoteView(\nR.id.cta3,\nrenderer.imageList!![imageKey],\n@@ -55,6 +58,7 @@ class FiveIconBigContentView constructor(\nremoteView.setViewVisibility(R.id.cta3, View.GONE)\n}\n} else if (imageKey == 3) {\n+ remoteView.setViewVisibility(R.id.cta4, View.VISIBLE)\nUtils.loadImageURLIntoRemoteView(\nR.id.cta4,\nrenderer.imageList!![imageKey],\n@@ -65,6 +69,7 @@ class FiveIconBigContentView constructor(\nremoteView.setViewVisibility(R.id.cta4, View.GONE)\n}\n} else if (imageKey == 4) {\n+ remoteView.setViewVisibility(R.id.cta5, View.VISIBLE)\nUtils.loadImageURLIntoRemoteView(\nR.id.cta5,\nrenderer.imageList!![imageKey],\n@@ -85,50 +90,56 @@ class FiveIconBigContentView constructor(\nbundleCTA1.putBoolean(\"cta1\", true)\nbundleCTA1.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(0))\nbundleCTA1.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 1 + \"_\" + renderer.deepLinkList?.get(0))\n+ remoteView.setOnClickPendingIntent(\n+ R.id.cta1,\n+ LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA1, context)\n+ )\nval bundleCTA2 = extras.clone() as Bundle\nbundleCTA2.putBoolean(\"cta2\", true)\nbundleCTA2.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(1))\nbundleCTA2.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 2 + \"_\" + renderer.deepLinkList?.get(1))\n-\n- val bundleCTA3 = extras.clone() as Bundle\n- bundleCTA3.putBoolean(\"cta3\", true)\n- bundleCTA3.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(2))\n- bundleCTA3.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 3 + \"_\" + renderer.deepLinkList?.get(2))\n-\n- val bundleCTA4 = extras.clone() as Bundle\n- bundleCTA4.putBoolean(\"cta4\", true)\n- bundleCTA4.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(3))\n- bundleCTA4.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 4 + \"_\" + renderer.deepLinkList?.get(3))\n-\n- val bundleCTA5 = extras.clone() as Bundle\n- bundleCTA5.putBoolean(\"cta5\", true)\n- bundleCTA5.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(4))\n- bundleCTA5.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 5 + \"_\" + renderer.deepLinkList?.get(4))\n-\n- remoteView.setOnClickPendingIntent(\n- R.id.cta1,\n- LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA1, context)\n- )\nremoteView.setOnClickPendingIntent(\nR.id.cta2,\nLaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA2, context)\n)\n+ val bundleCTA3 = extras.clone() as Bundle\n+ bundleCTA3.putBoolean(\"cta3\", true)\n+ bundleCTA3.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(2))\n+ bundleCTA3.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 3 + \"_\" + renderer.deepLinkList?.get(2))\nremoteView.setOnClickPendingIntent(\nR.id.cta3,\nLaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA3, context)\n)\n+ if(renderer.deepLinkList != null && renderer.deepLinkList!!.size > 3) {\n+ val bundleCTA4 = extras.clone() as Bundle\n+ bundleCTA4.putBoolean(\"cta4\", true)\n+ bundleCTA4.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(3))\n+ bundleCTA4.putString(\n+ Constants.KEY_C2A,\n+ PTConstants.PT_5CTA_C2A_KEY + 4 + \"_\" + renderer.deepLinkList?.get(3)\n+ )\nremoteView.setOnClickPendingIntent(\nR.id.cta4,\nLaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA4, context)\n)\n+ }\n+ if(renderer.deepLinkList != null && renderer.deepLinkList!!.size > 4) {\n+ val bundleCTA5 = extras.clone() as Bundle\n+ bundleCTA5.putBoolean(\"cta5\", true)\n+ bundleCTA5.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(4))\n+ bundleCTA5.putString(\n+ Constants.KEY_C2A,\n+ PTConstants.PT_5CTA_C2A_KEY + 5 + \"_\" + renderer.deepLinkList?.get(4)\n+ )\nremoteView.setOnClickPendingIntent(\nR.id.cta5,\nLaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA5, context)\n)\n+ }\nremoteView.setOnClickPendingIntent(\nR.id.close, PendingIntentFactory.getPendingIntent(\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/content/FiveIconSmallContentView.kt", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/content/FiveIconSmallContentView.kt", "diff": "@@ -25,6 +25,7 @@ class FiveIconSmallContentView constructor(\nvar imageCounter = 0\nfor (imageKey in renderer.imageList!!.indices) {\nif (imageKey == 0) {\n+ remoteView.setViewVisibility(R.id.cta1, View.VISIBLE)\nUtils.loadImageURLIntoRemoteView(\nR.id.cta1,\nrenderer.imageList!![imageKey],\n@@ -35,6 +36,7 @@ class FiveIconSmallContentView constructor(\nimageCounter++\n}\n} else if (imageKey == 1) {\n+ remoteView.setViewVisibility(R.id.cta2, View.VISIBLE)\nUtils.loadImageURLIntoRemoteView(\nR.id.cta2,\nrenderer.imageList!![imageKey],\n@@ -45,6 +47,7 @@ class FiveIconSmallContentView constructor(\nremoteView.setViewVisibility(R.id.cta2, View.GONE)\n}\n} else if (imageKey == 2) {\n+ remoteView.setViewVisibility(R.id.cta3, View.VISIBLE)\nUtils.loadImageURLIntoRemoteView(\nR.id.cta3,\nrenderer.imageList!![imageKey],\n@@ -55,6 +58,7 @@ class FiveIconSmallContentView constructor(\nremoteView.setViewVisibility(R.id.cta3, View.GONE)\n}\n} else if (imageKey == 3) {\n+ remoteView.setViewVisibility(R.id.cta4, View.VISIBLE)\nUtils.loadImageURLIntoRemoteView(\nR.id.cta4,\nrenderer.imageList!![imageKey],\n@@ -65,6 +69,7 @@ class FiveIconSmallContentView constructor(\nremoteView.setViewVisibility(R.id.cta4, View.GONE)\n}\n} else if (imageKey == 4) {\n+ remoteView.setViewVisibility(R.id.cta5, View.VISIBLE)\nUtils.loadImageURLIntoRemoteView(\nR.id.cta5,\nrenderer.imageList!![imageKey],\n@@ -85,50 +90,56 @@ class FiveIconSmallContentView constructor(\nbundleCTA1.putBoolean(\"cta1\", true)\nbundleCTA1.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(0))\nbundleCTA1.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 1 + \"_\" + renderer.deepLinkList?.get(0))\n+ remoteView.setOnClickPendingIntent(\n+ R.id.cta1,\n+ LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA1, context)\n+ )\nval bundleCTA2 = extras.clone() as Bundle\nbundleCTA2.putBoolean(\"cta2\", true)\nbundleCTA2.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(1))\nbundleCTA2.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 2 + \"_\" + renderer.deepLinkList?.get(1))\n-\n- val bundleCTA3 = extras.clone() as Bundle\n- bundleCTA3.putBoolean(\"cta3\", true)\n- bundleCTA3.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(2))\n- bundleCTA3.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 3 + \"_\" + renderer.deepLinkList?.get(2))\n-\n- val bundleCTA4 = extras.clone() as Bundle\n- bundleCTA4.putBoolean(\"cta4\", true)\n- bundleCTA4.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(3))\n- bundleCTA4.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 4 + \"_\" + renderer.deepLinkList?.get(3))\n-\n- val bundleCTA5 = extras.clone() as Bundle\n- bundleCTA5.putBoolean(\"cta5\", true)\n- bundleCTA5.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(4))\n- bundleCTA5.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 5 + \"_\" + renderer.deepLinkList?.get(4))\n-\n- remoteView.setOnClickPendingIntent(\n- R.id.cta1,\n- LaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA1, context)\n- )\nremoteView.setOnClickPendingIntent(\nR.id.cta2,\nLaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA2, context)\n)\n+ val bundleCTA3 = extras.clone() as Bundle\n+ bundleCTA3.putBoolean(\"cta3\", true)\n+ bundleCTA3.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(2))\n+ bundleCTA3.putString(Constants.KEY_C2A, PTConstants.PT_5CTA_C2A_KEY + 3 + \"_\" + renderer.deepLinkList?.get(2))\nremoteView.setOnClickPendingIntent(\nR.id.cta3,\nLaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA3, context)\n)\n+ if(renderer.deepLinkList != null && renderer.deepLinkList!!.size > 3) {\n+ val bundleCTA4 = extras.clone() as Bundle\n+ bundleCTA4.putBoolean(\"cta4\", true)\n+ bundleCTA4.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(3))\n+ bundleCTA4.putString(\n+ Constants.KEY_C2A,\n+ PTConstants.PT_5CTA_C2A_KEY + 4 + \"_\" + renderer.deepLinkList?.get(3)\n+ )\nremoteView.setOnClickPendingIntent(\nR.id.cta4,\nLaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA4, context)\n)\n+ }\n+ if(renderer.deepLinkList != null && renderer.deepLinkList!!.size > 4) {\n+ val bundleCTA5 = extras.clone() as Bundle\n+ bundleCTA5.putBoolean(\"cta5\", true)\n+ bundleCTA5.putString(Constants.DEEP_LINK_KEY, renderer.deepLinkList?.get(4))\n+ bundleCTA5.putString(\n+ Constants.KEY_C2A,\n+ PTConstants.PT_5CTA_C2A_KEY + 5 + \"_\" + renderer.deepLinkList?.get(4)\n+ )\nremoteView.setOnClickPendingIntent(\nR.id.cta5,\nLaunchPendingIntentFactory.getLaunchPendingIntent(bundleCTA5, context)\n)\n+ }\nremoteView.setOnClickPendingIntent(\nR.id.close, PendingIntentFactory.getPendingIntent(\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/validators/ValidatorFactory.kt", "new_path": "clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/validators/ValidatorFactory.kt", "diff": "@@ -88,9 +88,9 @@ internal class ValidatorFactory {\nStringSizeChecker(templateRenderer.pt_rating_default_dl, 0, \"Default deeplink is missing or empty\")\n//----------FIVE ICON-------------\nhashMap[PT_FIVE_DEEPLINK_LIST] =\n- ListSizeChecker(templateRenderer.deepLinkList, 5, \"Five required deeplinks not present\")\n+ ListSizeChecker(templateRenderer.deepLinkList, 2, \"Three required deeplinks not present\")\nhashMap[PT_FIVE_IMAGE_LIST] =\n- ListSizeChecker(templateRenderer.imageList, 3, \"Five required images not present\")\n+ ListSizeChecker(templateRenderer.imageList, 2, \"Three required images not present\")\n//----------PROD DISPLAY-------------\nhashMap[PT_THREE_DEEPLINK_LIST] =\nListSizeChecker(templateRenderer.deepLinkList, 3, \"Three required deeplinks not present\")\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout-v31/five_cta_collapsed.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout-v31/five_cta_collapsed.xml", "diff": "android:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\"/>\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout-v31/five_cta_expanded.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout-v31/five_cta_expanded.xml", "diff": "android:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\"/>\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/five_cta_collapsed.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/five_cta_collapsed.xml", "diff": "android:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\"/>\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\n" }, { "change_type": "MODIFY", "old_path": "clevertap-pushtemplates/src/main/res/layout/five_cta_expanded.xml", "new_path": "clevertap-pushtemplates/src/main/res/layout/five_cta_expanded.xml", "diff": "android:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\"/>\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\nandroid:layout_height=\"match_parent\"\nandroid:layout_weight=\"1\"\nandroid:layout_margin=\"4dip\"\n+ android:visibility=\"gone\"\nandroid:src=\"@drawable/pt_image\" />\n<ImageView\n" } ]
Java
MIT License
clevertap/clevertap-android-sdk
task(refactor): Update FiveIcon to support 3 or more images/dls