From 91d1fe57d64a301aaf68ba4d718cd085b726f30b Mon Sep 17 00:00:00 2001 From: DeKaN Date: Tue, 16 Apr 2024 13:48:23 +0400 Subject: [PATCH] Migrate to PIano Consents library --- .github/workflows/build.yml | 2 + CHANGELOG.md | 9 +- app/src/main/AndroidManifest.xml | 2 +- .../java/com/example/pianoanalytics/App.kt | 8 +- .../example/pianoanalytics/MainActivity.kt | 40 ++ app/src/main/res/menu/main_menu.xml | 18 + build.gradle.kts | 1 + gradle/libs.versions.toml | 8 +- piano-analytics/api/piano-analytics.api | 674 ++++++++++++++++++ piano-analytics/build.gradle.kts | 2 + piano-analytics/gradle.properties | 2 +- .../piano/android/analytics/Configuration.kt | 6 + .../android/analytics/DependenciesProvider.kt | 21 +- .../analytics/EventPropertiesJsonAdapter.kt | 2 +- .../piano/android/analytics/PianoAnalytics.kt | 10 +- .../android/analytics/PrivacyModesStorage.kt | 22 +- .../android/analytics/model/PrivacyMode.kt | 17 + .../piano/android/analytics/model/Property.kt | 2 +- settings.gradle.kts | 9 +- 19 files changed, 840 insertions(+), 15 deletions(-) create mode 100644 app/src/main/res/menu/main_menu.xml create mode 100644 piano-analytics/api/piano-analytics.api diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6943c7b..b347b6c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,8 @@ jobs: run: chmod +x gradlew - name: Check code style run: ./gradlew ktlintCheck --continue + - name: Check API binary compatibility + run: ./gradlew apiCheck - name: Run tests run: ./gradlew testDebug - name: Build project diff --git a/CHANGELOG.md b/CHANGELOG.md index 24da932..464c651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,15 @@ # Piano Analytics SDK for Android -## v3.3.6-SNAPSHOT +## v3.4.0-SNAPSHOT +* Updated to Kotlin 1.9 +* Added support for `PianoConsents` +* Added `PrivacyMode.CUSTOM`, that will be used if set `ConsentMode.CUSTOM` +* Deprecated `PrivacyModesStorage`, use `PianoConsents` instead * Removed requirement for `READ_PHONE_STATE` permission for Android 6-9 * Updated dependencies: + - Kotlin [1.8.22 -> 1.9.23] + - com.squareup.moshi:moshi [1.15.0 -> 1.15.1] + https://github.com/square/moshi/ - androidx.lifecycle:lifecycle-process [2.6.2 -> 2.7.0] https://developer.android.com/jetpack/androidx/releases/lifecycle#2.7.0 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 10f6562..a0ccacd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -16,7 +16,7 @@ + android:theme="@style/Theme.Pianoanlayticsandroid"> diff --git a/app/src/main/java/com/example/pianoanalytics/App.kt b/app/src/main/java/com/example/pianoanalytics/App.kt index cf14254..afa2083 100644 --- a/app/src/main/java/com/example/pianoanalytics/App.kt +++ b/app/src/main/java/com/example/pianoanalytics/App.kt @@ -4,6 +4,8 @@ import android.app.Application import io.piano.android.analytics.Configuration import io.piano.android.analytics.PianoAnalytics import io.piano.android.analytics.model.VisitorIDType +import io.piano.android.consents.PianoConsents +import io.piano.android.consents.models.ConsentConfiguration import timber.log.Timber class App: Application() { @@ -15,7 +17,11 @@ class App: Application() { site = 552987, visitorIDType = VisitorIDType.ADVERTISING_ID ).ignoreLimitedAdTracking(true).build() - PianoAnalytics.init(applicationContext, configuration).apply { + val pianoConsents = PianoConsents.init( + applicationContext, + ConsentConfiguration(requireConsent = true) + ) + PianoAnalytics.init(applicationContext, configuration, pianoConsents).apply { // just an example of callback eventProcessorCallback = PianoAnalytics.EventProcessorCallback { events -> events.forEach { event -> diff --git a/app/src/main/java/com/example/pianoanalytics/MainActivity.kt b/app/src/main/java/com/example/pianoanalytics/MainActivity.kt index 9b11e0b..28f278c 100644 --- a/app/src/main/java/com/example/pianoanalytics/MainActivity.kt +++ b/app/src/main/java/com/example/pianoanalytics/MainActivity.kt @@ -2,6 +2,8 @@ package com.example.pianoanalytics import android.content.Intent import android.os.Bundle +import android.view.Menu +import android.view.MenuItem import androidx.appcompat.app.AppCompatActivity import androidx.recyclerview.widget.LinearLayoutManager import by.kirich1409.viewbindingdelegate.viewBinding @@ -10,9 +12,13 @@ import io.piano.android.analytics.PianoAnalytics import io.piano.android.analytics.model.Event import io.piano.android.analytics.model.Property import io.piano.android.analytics.model.PropertyName +import io.piano.android.consents.PianoConsents +import io.piano.android.consents.models.ConsentMode +import io.piano.android.consents.models.Purpose class MainActivity : AppCompatActivity(R.layout.activity_main) { private val binding: ActivityMainBinding by viewBinding(R.id.recyclerview) + private val pianoConsents by lazy { PianoConsents.getInstance() } private val animals = listOf( "___media___", @@ -43,6 +49,40 @@ class MainActivity : AppCompatActivity(R.layout.activity_main) { ) } + override fun onCreateOptionsMenu(menu: Menu): Boolean { + menuInflater.inflate(R.menu.main_menu, menu) + return true + } + + override fun onPrepareOptionsMenu(menu: Menu): Boolean { + val currentPaConsent = requireNotNull(pianoConsents.consents[Purpose.AUDIENCE_MEASUREMENT]).mode + val chosenItem = when (currentPaConsent) { + ConsentMode.OPT_IN -> R.id.consent_opt_in + ConsentMode.ESSENTIAL -> R.id.consent_essential + ConsentMode.OPT_OUT -> R.id.consent_opt_out + ConsentMode.CUSTOM -> R.id.consent_custom + ConsentMode.NOT_ACQUIRED -> null + } + if (chosenItem != null) { + menu.findItem(chosenItem).isChecked = true + } + return super.onPrepareOptionsMenu(menu) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + val newMode = when (item.itemId) { + R.id.consent_opt_in -> ConsentMode.OPT_IN + R.id.consent_essential -> ConsentMode.ESSENTIAL + R.id.consent_opt_out -> ConsentMode.OPT_OUT + R.id.consent_custom -> ConsentMode.CUSTOM + else -> null + } + return if (newMode != null) { + pianoConsents.set(Purpose.AUDIENCE_MEASUREMENT, newMode) + true + } else super.onOptionsItemSelected(item) + } + private fun onItemClick(item: String) { PianoAnalytics.getInstance().sendEvents( Event.Builder(Event.CLICK_NAVIGATION) diff --git a/app/src/main/res/menu/main_menu.xml b/app/src/main/res/menu/main_menu.xml new file mode 100644 index 0000000..6174f54 --- /dev/null +++ b/app/src/main/res/menu/main_menu.xml @@ -0,0 +1,18 @@ + + + + + + + + + + diff --git a/build.gradle.kts b/build.gradle.kts index 7d66eac..9eec0af 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,6 +7,7 @@ plugins { alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.ksp) apply false alias(libs.plugins.ktlint) apply false + alias(libs.plugins.binaryCompatibility) apply false alias(libs.plugins.mavenRelease) apply false alias(libs.plugins.moshiIR) apply false alias(libs.plugins.versionUpdater) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bc8b104..72d7883 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,6 +2,7 @@ # Plugins kotlin = "1.9.23" android = "8.3.2" +binaryCompatibility = "0.14.0" versionUpdater = "0.51.0" ktlint = "12.1.0" mavenRelease = "0.28.0" @@ -16,8 +17,9 @@ materialLibrary = "1.11.0" # Third party Libraries googleAdsId = "18.0.1" huaweiAdsId = "3.4.26.303" -okhttp = "4.12.0" moshi = "1.15.1" +okhttp = "4.12.0" +pianoConsents = "1.0.0" timber = "5.0.1" viewBindingProperty = "1.5.9" @@ -30,6 +32,7 @@ mockitoCore = "5.11.0" [plugins] android-library = { id = "com.android.library", version.ref = "android" } android-app = { id = "com.android.application", version.ref = "android" } +binaryCompatibility = {id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binaryCompatibility" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" } @@ -43,10 +46,11 @@ lifecycleProcess = { module = "androidx.lifecycle:lifecycle-process", version.re material = { module = "com.google.android.material:material", version.ref = "materialLibrary" } googleAdsId = { module = "com.google.android.gms:play-services-ads-identifier", version.ref = "googleAdsId" } huaweiAdsId = { module = "com.huawei.hms:hms-ads-identifier", version.ref = "huaweiAdsId" } +moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" } okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } okhttpLogging = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" } +pianoConsents = { module = "io.piano.android:consents", version.ref = "pianoConsents" } timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } -moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" } viewBindingProperty = { module = "com.github.kirich1409:viewbindingpropertydelegate", version.ref = "viewBindingProperty" } kotlinJunit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } diff --git a/piano-analytics/api/piano-analytics.api b/piano-analytics/api/piano-analytics.api new file mode 100644 index 0000000..45d0a2e --- /dev/null +++ b/piano-analytics/api/piano-analytics.api @@ -0,0 +1,674 @@ +public final class io/piano/android/analytics/BuildConfig { + public static final field BUILD_TYPE Ljava/lang/String; + public static final field DEBUG Z + public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String; + public static final field SDK_VERSION Ljava/lang/String; + public fun ()V +} + +public final class io/piano/android/analytics/Configuration : io/piano/android/analytics/ReportUrlProvider { + public static final field Companion Lio/piano/android/analytics/Configuration$Companion; + public static final field DEFAULT_EVENTS_OFFLINE_STORAGE_LIFETIME I + public static final field DEFAULT_PATH Ljava/lang/String; + public static final field DEFAULT_PRIVACY_STORAGE_LIFETIME I + public static final field DEFAULT_SESSION_BACKGROUND_DURATION I + public static final field DEFAULT_USER_STORAGE_LIFETIME I + public static final field DEFAULT_VISITOR_STORAGE_LIFETIME I + public static final field MIN_SESSION_BACKGROUND_DURATION I + public synthetic fun (Lio/piano/android/analytics/ReportUrlProvider;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;Lio/piano/android/analytics/model/VisitorStorageMode;IIIIIZZZLkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun getCollectDomain ()Ljava/lang/String; + public final fun getDefaultPrivacyMode ()Lio/piano/android/analytics/model/PrivacyMode; + public final fun getDetectCrashes ()Z + public final fun getEventsOfflineStorageLifetime ()I + public final fun getIgnoreLimitedAdTracking ()Z + public final fun getOfflineStorageMode ()Lio/piano/android/analytics/model/OfflineStorageMode; + public fun getPath ()Ljava/lang/String; + public final fun getPrivacyStorageLifetime ()I + public final fun getReportUrlProvider ()Lio/piano/android/analytics/ReportUrlProvider; + public final fun getSendEventWhenOptOut ()Z + public final fun getSessionBackgroundDuration ()I + public fun getSite ()I + public final fun getUserStorageLifetime ()I + public final fun getVisitorIDType ()Lio/piano/android/analytics/model/VisitorIDType; + public final fun getVisitorStorageLifetime ()I + public final fun getVisitorStorageMode ()Lio/piano/android/analytics/model/VisitorStorageMode; +} + +public final class io/piano/android/analytics/Configuration$Builder { + public fun ()V + public fun (Ljava/lang/String;)V + public fun (Ljava/lang/String;I)V + public fun (Ljava/lang/String;ILjava/lang/String;)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;Lio/piano/android/analytics/model/VisitorStorageMode;)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;Lio/piano/android/analytics/model/VisitorStorageMode;I)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;Lio/piano/android/analytics/model/VisitorStorageMode;II)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;Lio/piano/android/analytics/model/VisitorStorageMode;III)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;Lio/piano/android/analytics/model/VisitorStorageMode;IIII)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;Lio/piano/android/analytics/model/VisitorStorageMode;IIIII)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;Lio/piano/android/analytics/model/VisitorStorageMode;IIIIIZ)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;Lio/piano/android/analytics/model/VisitorStorageMode;IIIIIZZ)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;Lio/piano/android/analytics/model/VisitorStorageMode;IIIIIZZZ)V + public fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;Lio/piano/android/analytics/model/VisitorStorageMode;IIIIIZZZLio/piano/android/analytics/ReportUrlProvider;)V + public synthetic fun (Ljava/lang/String;ILjava/lang/String;Lio/piano/android/analytics/model/PrivacyMode;Lio/piano/android/analytics/model/VisitorIDType;Lio/piano/android/analytics/model/OfflineStorageMode;Lio/piano/android/analytics/model/VisitorStorageMode;IIIIIZZZLio/piano/android/analytics/ReportUrlProvider;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun build ()Lio/piano/android/analytics/Configuration; + public final fun collectDomain (Ljava/lang/String;)Lio/piano/android/analytics/Configuration$Builder; + public final fun defaultPrivacyMode (Lio/piano/android/analytics/model/PrivacyMode;)Lio/piano/android/analytics/Configuration$Builder; + public final fun detectCrashes (Z)Lio/piano/android/analytics/Configuration$Builder; + public final fun eventsOfflineStorageLifetime (I)Lio/piano/android/analytics/Configuration$Builder; + public final fun getCollectDomain ()Ljava/lang/String; + public final fun getDefaultPrivacyMode ()Lio/piano/android/analytics/model/PrivacyMode; + public final fun getDetectCrashes ()Z + public final fun getEventsOfflineStorageLifetime ()I + public final fun getIgnoreLimitedAdTracking ()Z + public final fun getOfflineStorageMode ()Lio/piano/android/analytics/model/OfflineStorageMode; + public final fun getPath ()Ljava/lang/String; + public final fun getPrivacyStorageLifetime ()I + public final fun getReportUrlProvider ()Lio/piano/android/analytics/ReportUrlProvider; + public final fun getSendEventWhenOptOut ()Z + public final fun getSessionBackgroundDuration ()I + public final fun getSite ()I + public final fun getUserStorageLifetime ()I + public final fun getVisitorIDType ()Lio/piano/android/analytics/model/VisitorIDType; + public final fun getVisitorStorageLifetime ()I + public final fun getVisitorStorageMode ()Lio/piano/android/analytics/model/VisitorStorageMode; + public final fun ignoreLimitedAdTracking (Z)Lio/piano/android/analytics/Configuration$Builder; + public final fun offlineStorageMode (Lio/piano/android/analytics/model/OfflineStorageMode;)Lio/piano/android/analytics/Configuration$Builder; + public final fun path (Ljava/lang/String;)Lio/piano/android/analytics/Configuration$Builder; + public final fun privacyStorageLifetime (I)Lio/piano/android/analytics/Configuration$Builder; + public final fun reportUrlProvider (Lio/piano/android/analytics/ReportUrlProvider;)Lio/piano/android/analytics/Configuration$Builder; + public final fun sendEventWhenOptOut (Z)Lio/piano/android/analytics/Configuration$Builder; + public final fun sessionBackgroundDuration (I)Lio/piano/android/analytics/Configuration$Builder; + public final fun setCollectDomain (Ljava/lang/String;)V + public final fun setDefaultPrivacyMode (Lio/piano/android/analytics/model/PrivacyMode;)V + public final fun setDetectCrashes (Z)V + public final fun setEventsOfflineStorageLifetime (I)V + public final fun setIgnoreLimitedAdTracking (Z)V + public final fun setOfflineStorageMode (Lio/piano/android/analytics/model/OfflineStorageMode;)V + public final fun setPath (Ljava/lang/String;)V + public final fun setPrivacyStorageLifetime (I)V + public final fun setReportUrlProvider (Lio/piano/android/analytics/ReportUrlProvider;)V + public final fun setSendEventWhenOptOut (Z)V + public final fun setSessionBackgroundDuration (I)V + public final fun setSite (I)V + public final fun setUserStorageLifetime (I)V + public final fun setVisitorIDType (Lio/piano/android/analytics/model/VisitorIDType;)V + public final fun setVisitorStorageLifetime (I)V + public final fun setVisitorStorageMode (Lio/piano/android/analytics/model/VisitorStorageMode;)V + public final fun site (I)Lio/piano/android/analytics/Configuration$Builder; + public final fun userStorageLifetime (I)Lio/piano/android/analytics/Configuration$Builder; + public final fun visitorIDType (Lio/piano/android/analytics/model/VisitorIDType;)Lio/piano/android/analytics/Configuration$Builder; + public final fun visitorStorageLifetime (I)Lio/piano/android/analytics/Configuration$Builder; + public final fun visitorStorageMode (Lio/piano/android/analytics/model/VisitorStorageMode;)Lio/piano/android/analytics/Configuration$Builder; +} + +public final class io/piano/android/analytics/Configuration$Companion { +} + +public final class io/piano/android/analytics/ContextPropertiesStorage { + public fun ()V + public final fun add (Lio/piano/android/analytics/model/ContextProperty;)V + public final fun clear ()V + public final fun deleteByKey-z4gBv5U (Ljava/lang/String;)V +} + +public abstract interface class io/piano/android/analytics/DataEncoder { + public abstract fun decode (Ljava/lang/String;)Ljava/lang/String; + public abstract fun encode (Ljava/lang/String;)Ljava/lang/String; +} + +public final class io/piano/android/analytics/MediaHelper { + public final fun adClick ([Lio/piano/android/analytics/model/Property;)V + public final fun adSkip ([Lio/piano/android/analytics/model/Property;)V + public final fun bufferHeartbeat ([Lio/piano/android/analytics/model/Property;)V + public final fun bufferStart (I[Lio/piano/android/analytics/model/Property;)V + public final fun close ([Lio/piano/android/analytics/model/Property;)V + public final fun display ([Lio/piano/android/analytics/model/Property;)V + public final fun error (Ljava/lang/String;[Lio/piano/android/analytics/model/Property;)V + public final fun fullscreenOff ([Lio/piano/android/analytics/model/Property;)V + public final fun fullscreenOn ([Lio/piano/android/analytics/model/Property;)V + public final fun getPlaybackSpeed ()D + public final fun getSessionId ()Ljava/lang/String; + public final fun heartbeat (I[Lio/piano/android/analytics/model/Property;)V + public final fun play (I[Lio/piano/android/analytics/model/Property;)V + public final fun playbackPaused (I[Lio/piano/android/analytics/model/Property;)V + public final fun playbackResumed (I[Lio/piano/android/analytics/model/Property;)V + public final fun playbackStart (I[Lio/piano/android/analytics/model/Property;)V + public final fun playbackStopped (I[Lio/piano/android/analytics/model/Property;)V + public final fun quality ([Lio/piano/android/analytics/model/Property;)V + public final fun rebufferHeartbeat ([Lio/piano/android/analytics/model/Property;)V + public final fun seek (II[Lio/piano/android/analytics/model/Property;)V + public final fun seekBackward (II[Lio/piano/android/analytics/model/Property;)V + public final fun seekForward (II[Lio/piano/android/analytics/model/Property;)V + public final fun seekStart (I[Lio/piano/android/analytics/model/Property;)V + public final fun setBufferHeartbeat (Landroid/util/SparseLongArray;)Lio/piano/android/analytics/MediaHelper; + public final fun setExtraProps ([Lio/piano/android/analytics/model/Property;)Lio/piano/android/analytics/MediaHelper; + public final fun setHeartbeat (Landroid/util/SparseLongArray;)Lio/piano/android/analytics/MediaHelper; + public final fun setPlaybackSpeed (D)V + public final fun share ([Lio/piano/android/analytics/model/Property;)V + public final fun speed ([Lio/piano/android/analytics/model/Property;)V + public final fun subtitleOff ([Lio/piano/android/analytics/model/Property;)V + public final fun subtitleOn ([Lio/piano/android/analytics/model/Property;)V + public final fun track (Ljava/lang/String;[Lio/piano/android/analytics/model/Property;)V + public final fun volume ([Lio/piano/android/analytics/model/Property;)V +} + +public final class io/piano/android/analytics/PianoAnalytics { + public static final field Companion Lio/piano/android/analytics/PianoAnalytics$Companion; + public final fun deleteOfflineStorage (I)V + public static synthetic fun deleteOfflineStorage$default (Lio/piano/android/analytics/PianoAnalytics;IILjava/lang/Object;)V + public final fun getContextPropertiesStorage ()Lio/piano/android/analytics/ContextPropertiesStorage; + public final fun getCustomEventProcessors ()Ljava/util/List; + public final fun getCustomVisitorId ()Ljava/lang/String; + public final fun getEventProcessorCallback ()Lio/piano/android/analytics/PianoAnalytics$EventProcessorCallback; + public static final fun getInstance ()Lio/piano/android/analytics/PianoAnalytics; + public final fun getPianoConsents ()Lio/piano/android/consents/PianoConsents; + public final fun getPrivacyModesStorage ()Lio/piano/android/analytics/PrivacyModesStorage; + public final fun getUserStorage ()Lio/piano/android/analytics/UserStorage; + public final fun getVisitorId ()Ljava/lang/String; + public static final fun init (Landroid/content/Context;Lio/piano/android/analytics/Configuration;)Lio/piano/android/analytics/PianoAnalytics; + public static final fun init (Landroid/content/Context;Lio/piano/android/analytics/Configuration;Lio/piano/android/consents/PianoConsents;)Lio/piano/android/analytics/PianoAnalytics; + public static final fun init (Landroid/content/Context;Lio/piano/android/analytics/Configuration;Lio/piano/android/consents/PianoConsents;Lio/piano/android/analytics/DataEncoder;)Lio/piano/android/analytics/PianoAnalytics; + public final fun mediaHelper (Ljava/lang/String;)Lio/piano/android/analytics/MediaHelper; + public final fun mediaHelper (Ljava/lang/String;Ljava/lang/String;)Lio/piano/android/analytics/MediaHelper; + public static synthetic fun mediaHelper$default (Lio/piano/android/analytics/PianoAnalytics;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/piano/android/analytics/MediaHelper; + public final fun screenName (Ljava/lang/String;)V + public final fun sendEvents ([Lio/piano/android/analytics/model/Event;)V + public final fun sendOfflineData ()V + public final fun setCustomVisitorId (Ljava/lang/String;)V + public final fun setEventProcessorCallback (Lio/piano/android/analytics/PianoAnalytics$EventProcessorCallback;)V +} + +public final class io/piano/android/analytics/PianoAnalytics$Companion { + public final fun getInstance ()Lio/piano/android/analytics/PianoAnalytics; + public final fun init (Landroid/content/Context;Lio/piano/android/analytics/Configuration;)Lio/piano/android/analytics/PianoAnalytics; + public final fun init (Landroid/content/Context;Lio/piano/android/analytics/Configuration;Lio/piano/android/consents/PianoConsents;)Lio/piano/android/analytics/PianoAnalytics; + public final fun init (Landroid/content/Context;Lio/piano/android/analytics/Configuration;Lio/piano/android/consents/PianoConsents;Lio/piano/android/analytics/DataEncoder;)Lio/piano/android/analytics/PianoAnalytics; + public static synthetic fun init$default (Lio/piano/android/analytics/PianoAnalytics$Companion;Landroid/content/Context;Lio/piano/android/analytics/Configuration;Lio/piano/android/consents/PianoConsents;Lio/piano/android/analytics/DataEncoder;ILjava/lang/Object;)Lio/piano/android/analytics/PianoAnalytics; +} + +public abstract interface class io/piano/android/analytics/PianoAnalytics$EventProcessorCallback { + public abstract fun onProcess (Ljava/util/List;)V +} + +public final class io/piano/android/analytics/PlainDataEncoder : io/piano/android/analytics/DataEncoder { + public static final field INSTANCE Lio/piano/android/analytics/PlainDataEncoder; + public fun decode (Ljava/lang/String;)Ljava/lang/String; + public fun encode (Ljava/lang/String;)Ljava/lang/String; +} + +public final class io/piano/android/analytics/PrivacyModesStorage { + public final fun getAllModes ()Ljava/util/Set; + public final fun getCurrentMode ()Lio/piano/android/analytics/model/PrivacyMode; + public final fun setCurrentMode (Lio/piano/android/analytics/model/PrivacyMode;)V +} + +public abstract interface class io/piano/android/analytics/ReportUrlProvider { + public abstract fun getCollectDomain ()Ljava/lang/String; + public abstract fun getPath ()Ljava/lang/String; + public abstract fun getSite ()I +} + +public final class io/piano/android/analytics/ReportUrlProvider$DefaultImpls { + public static fun getPath (Lio/piano/android/analytics/ReportUrlProvider;)Ljava/lang/String; +} + +public final class io/piano/android/analytics/StaticReportUrlProvider : io/piano/android/analytics/ReportUrlProvider { + public fun (Ljava/lang/String;ILjava/lang/String;)V + public synthetic fun (Ljava/lang/String;ILjava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun getCollectDomain ()Ljava/lang/String; + public fun getPath ()Ljava/lang/String; + public fun getSite ()I +} + +public final class io/piano/android/analytics/UserStorage { + public final fun getCurrentUser ()Lio/piano/android/analytics/model/User; + public final fun getUserRecognized ()Z + public final fun setCurrentUser (Lio/piano/android/analytics/model/User;)V +} + +public abstract interface class io/piano/android/analytics/eventprocessors/EventProcessor { + public abstract fun process (Ljava/util/List;)Ljava/util/List; +} + +public final class io/piano/android/analytics/model/ContextProperty { + public fun (Ljava/util/Set;)V + public fun (Ljava/util/Set;Z)V + public fun (Ljava/util/Set;ZLjava/util/Collection;)V + public synthetic fun (Ljava/util/Set;ZLjava/util/Collection;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Ljava/util/Set; + public final fun component2 ()Z + public final fun component3 ()Ljava/util/Collection; + public final fun copy (Ljava/util/Set;ZLjava/util/Collection;)Lio/piano/android/analytics/model/ContextProperty; + public static synthetic fun copy$default (Lio/piano/android/analytics/model/ContextProperty;Ljava/util/Set;ZLjava/util/Collection;ILjava/lang/Object;)Lio/piano/android/analytics/model/ContextProperty; + public fun equals (Ljava/lang/Object;)Z + public final fun getEventNames ()Ljava/util/Collection; + public final fun getPersistent ()Z + public final fun getProperties ()Ljava/util/Set; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class io/piano/android/analytics/model/Event { + public static final field ANY Ljava/lang/String; + public static final field CLICK_ACTION Ljava/lang/String; + public static final field CLICK_DOWNLOAD Ljava/lang/String; + public static final field CLICK_EXIT Ljava/lang/String; + public static final field CLICK_NAVIGATION Ljava/lang/String; + public static final field Companion Lio/piano/android/analytics/model/Event$Companion; + public static final field INTERNAL_SEARCH_RESULT_CLICK Ljava/lang/String; + public static final field INTERNAL_SEARCH_RESULT_DISPLAY Ljava/lang/String; + public static final field MV_TEST_DISPLAY Ljava/lang/String; + public static final field PAGE_DISPLAY Ljava/lang/String; + public static final field PUBLISHER_CLICK Ljava/lang/String; + public static final field PUBLISHER_IMPRESSION Ljava/lang/String; + public static final field SELF_PROMOTION_CLICK Ljava/lang/String; + public static final field SELF_PROMOTION_IMPRESSION Ljava/lang/String; + public synthetic fun (Ljava/lang/String;Ljava/util/Set;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun getName ()Ljava/lang/String; + public final fun getProperties ()Ljava/util/Set; + public final fun newBuilder ()Lio/piano/android/analytics/model/Event$Builder; +} + +public final class io/piano/android/analytics/model/Event$Builder { + public fun (Ljava/lang/String;Ljava/util/Set;)V + public synthetic fun (Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun build ()Lio/piano/android/analytics/model/Event; + public final fun component1 ()Ljava/lang/String; + public final fun component2 ()Ljava/util/Set; + public final fun copy (Ljava/lang/String;Ljava/util/Set;)Lio/piano/android/analytics/model/Event$Builder; + public static synthetic fun copy$default (Lio/piano/android/analytics/model/Event$Builder;Ljava/lang/String;Ljava/util/Set;ILjava/lang/Object;)Lio/piano/android/analytics/model/Event$Builder; + public fun equals (Ljava/lang/Object;)Z + public final fun getName ()Ljava/lang/String; + public final fun getProperties ()Ljava/util/Set; + public fun hashCode ()I + public final fun name (Ljava/lang/String;)Lio/piano/android/analytics/model/Event$Builder; + public final fun properties (Ljava/util/Collection;)Lio/piano/android/analytics/model/Event$Builder; + public final fun properties ([Lio/piano/android/analytics/model/Property;)Lio/piano/android/analytics/model/Event$Builder; + public final fun setName (Ljava/lang/String;)V + public fun toString ()Ljava/lang/String; +} + +public final class io/piano/android/analytics/model/Event$Companion { +} + +public final class io/piano/android/analytics/model/EventsRequestJsonAdapter : com/squareup/moshi/JsonAdapter { + public fun (Lcom/squareup/moshi/Moshi;)V + public fun fromJson (Lcom/squareup/moshi/JsonReader;)Ljava/lang/Object; + public fun toJson (Lcom/squareup/moshi/JsonWriter;Ljava/lang/Object;)V + public fun toString ()Ljava/lang/String; +} + +public final class io/piano/android/analytics/model/OfflineStorageMode : java/lang/Enum { + public static final field ALWAYS Lio/piano/android/analytics/model/OfflineStorageMode; + public static final field REQUIRED Lio/piano/android/analytics/model/OfflineStorageMode; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lio/piano/android/analytics/model/OfflineStorageMode; + public static fun values ()[Lio/piano/android/analytics/model/OfflineStorageMode; +} + +public final class io/piano/android/analytics/model/PrivacyMode { + public static final field Companion Lio/piano/android/analytics/model/PrivacyMode$Companion; + public fun (Ljava/lang/String;ZLjava/util/Set;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;Ljava/util/Map;Ljava/util/Map;)V + public synthetic fun (Ljava/lang/String;ZLjava/util/Set;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;Ljava/util/Map;Ljava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getAllowedEventNames ()Ljava/util/Set; + public final fun getAllowedPropertyKeys ()Ljava/util/Map; + public final fun getAllowedStorageFeatures ()Ljava/util/Set; + public static final fun getCUSTOM ()Lio/piano/android/analytics/model/PrivacyMode; + public static final fun getDEFAULT_EVENT_NAMES$piano_analytics_release ()Ljava/util/Set; + public static final fun getDEFAULT_STORAGE_FEATURES$piano_analytics_release ()Ljava/util/Set; + public static final fun getEXEMPT ()Lio/piano/android/analytics/model/PrivacyMode; + public static final fun getEXEMPT_DEFAULT_PROPERTY_KEYS$piano_analytics_release ()Ljava/util/Set; + public final fun getForbiddenEventNames ()Ljava/util/Set; + public final fun getForbiddenPropertyKeys ()Ljava/util/Map; + public final fun getForbiddenStorageFeatures ()Ljava/util/Set; + public static final fun getMINIMUM_DEFAULT_PROPERTY_KEYS$piano_analytics_release ()Ljava/util/Set; + public static final fun getNO_CONSENT ()Lio/piano/android/analytics/model/PrivacyMode; + public static final fun getNO_STORAGE ()Lio/piano/android/analytics/model/PrivacyMode; + public static final fun getOPTIN ()Lio/piano/android/analytics/model/PrivacyMode; + public static final fun getOPTOUT ()Lio/piano/android/analytics/model/PrivacyMode; + public final fun getVisitorConsent ()Z + public final fun getVisitorMode ()Ljava/lang/String; + public fun hashCode ()I + public static final fun toPrivacyMode$piano_analytics_release (Lio/piano/android/consents/models/ConsentMode;)Lio/piano/android/analytics/model/PrivacyMode; + public fun toString ()Ljava/lang/String; +} + +public final class io/piano/android/analytics/model/PrivacyMode$Companion { + public final fun getCUSTOM ()Lio/piano/android/analytics/model/PrivacyMode; + public final fun getEXEMPT ()Lio/piano/android/analytics/model/PrivacyMode; + public final fun getNO_CONSENT ()Lio/piano/android/analytics/model/PrivacyMode; + public final fun getNO_STORAGE ()Lio/piano/android/analytics/model/PrivacyMode; + public final fun getOPTIN ()Lio/piano/android/analytics/model/PrivacyMode; + public final fun getOPTOUT ()Lio/piano/android/analytics/model/PrivacyMode; +} + +public final class io/piano/android/analytics/model/PrivacyStorageFeature : java/lang/Enum { + public static final field ALL Lio/piano/android/analytics/model/PrivacyStorageFeature; + public static final field CRASH Lio/piano/android/analytics/model/PrivacyStorageFeature; + public static final field LIFECYCLE Lio/piano/android/analytics/model/PrivacyStorageFeature; + public static final field PRIVACY Lio/piano/android/analytics/model/PrivacyStorageFeature; + public static final field USER Lio/piano/android/analytics/model/PrivacyStorageFeature; + public static final field VISITOR Lio/piano/android/analytics/model/PrivacyStorageFeature; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lio/piano/android/analytics/model/PrivacyStorageFeature; + public static fun values ()[Lio/piano/android/analytics/model/PrivacyStorageFeature; +} + +public final class io/piano/android/analytics/model/Property { + public synthetic fun (Ljava/lang/String;DLio/piano/android/analytics/model/Property$Type;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;DLio/piano/android/analytics/model/Property$Type;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;ILio/piano/android/analytics/model/Property$Type;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;ILio/piano/android/analytics/model/Property$Type;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;JLio/piano/android/analytics/model/Property$Type;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;JLio/piano/android/analytics/model/Property$Type;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lio/piano/android/analytics/model/Property$Type;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lio/piano/android/analytics/model/Property$Type;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Ljava/util/Date;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;ZLio/piano/android/analytics/model/Property$Type;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;ZLio/piano/android/analytics/model/Property$Type;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;[Ljava/lang/Double;Lio/piano/android/analytics/model/Property$Type;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;[Ljava/lang/Double;Lio/piano/android/analytics/model/Property$Type;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;[Ljava/lang/Integer;Lio/piano/android/analytics/model/Property$Type;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;[Ljava/lang/Integer;Lio/piano/android/analytics/model/Property$Type;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;[Ljava/lang/String;Lio/piano/android/analytics/model/Property$Type;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;[Ljava/lang/String;Lio/piano/android/analytics/model/Property$Type;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getForceType ()Lio/piano/android/analytics/model/Property$Type; + public final fun getName-t5hdzdk ()Ljava/lang/String; + public final fun getValue ()Ljava/lang/Object; + public fun hashCode ()I +} + +public final class io/piano/android/analytics/model/Property$Type : java/lang/Enum { + public static final field BOOLEAN Lio/piano/android/analytics/model/Property$Type; + public static final field DATE Lio/piano/android/analytics/model/Property$Type; + public static final field FLOAT Lio/piano/android/analytics/model/Property$Type; + public static final field FLOAT_ARRAY Lio/piano/android/analytics/model/Property$Type; + public static final field INTEGER Lio/piano/android/analytics/model/Property$Type; + public static final field INTEGER_ARRAY Lio/piano/android/analytics/model/Property$Type; + public static final field STRING Lio/piano/android/analytics/model/Property$Type; + public static final field STRING_ARRAY Lio/piano/android/analytics/model/Property$Type; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public final fun getPrefix ()Ljava/lang/String; + public static fun valueOf (Ljava/lang/String;)Lio/piano/android/analytics/model/Property$Type; + public static fun values ()[Lio/piano/android/analytics/model/Property$Type; +} + +public final class io/piano/android/analytics/model/PropertyName { + public static final field Companion Lio/piano/android/analytics/model/PropertyName$Companion; + public static final synthetic fun box-impl (Ljava/lang/String;)Lio/piano/android/analytics/model/PropertyName; + public static fun constructor-impl (Ljava/lang/String;)Ljava/lang/String; + public fun equals (Ljava/lang/Object;)Z + public static fun equals-impl (Ljava/lang/String;Ljava/lang/Object;)Z + public static final fun equals-impl0 (Ljava/lang/String;Ljava/lang/String;)Z + public static final fun getANY_PROPERTY-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_CRASH-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_CRASH_CLASS-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_CRASH_SCREEN-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_DAYS_SINCE_FIRST_SESSION-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_DAYS_SINCE_LAST_SESSION-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_DAYS_SINCE_UPDATE-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_FIRST_SESSION-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_FIRST_SESSION_AFTER_UPDATE-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_FIRST_SESSION_DATE-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_FIRST_SESSION_DATE_AFTER_UPDATE-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_ID-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_SESSION_COUNT-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_SESSION_COUNT_SINCE_UPDATE-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_SESSION_ID-t5hdzdk ()Ljava/lang/String; + public static final fun getAPP_VERSION-t5hdzdk ()Ljava/lang/String; + public static final fun getBROWSER-t5hdzdk ()Ljava/lang/String; + public static final fun getBROWSER_COOKIE_ACCEPTANCE-t5hdzdk ()Ljava/lang/String; + public static final fun getBROWSER_GROUP-t5hdzdk ()Ljava/lang/String; + public static final fun getBROWSER_LANGUAGE-t5hdzdk ()Ljava/lang/String; + public static final fun getBROWSER_LANGUAGE_LOCAL-t5hdzdk ()Ljava/lang/String; + public static final fun getBROWSER_VERSION-t5hdzdk ()Ljava/lang/String; + public static final fun getCLICK-t5hdzdk ()Ljava/lang/String; + public static final fun getCLICK_CHAPTER1-t5hdzdk ()Ljava/lang/String; + public static final fun getCLICK_CHAPTER2-t5hdzdk ()Ljava/lang/String; + public static final fun getCLICK_CHAPTER3-t5hdzdk ()Ljava/lang/String; + public static final fun getCLICK_FULL_NAME-t5hdzdk ()Ljava/lang/String; + public static final fun getCONNECTION_MONITOR-t5hdzdk ()Ljava/lang/String; + public static final fun getCONNECTION_ORGANISATION-t5hdzdk ()Ljava/lang/String; + public static final fun getCONNECTION_TYPE-t5hdzdk ()Ljava/lang/String; + public static final fun getDATE-t5hdzdk ()Ljava/lang/String; + public static final fun getDATE_DAY-t5hdzdk ()Ljava/lang/String; + public static final fun getDATE_DAYNUMBER-t5hdzdk ()Ljava/lang/String; + public static final fun getDATE_MONTH-t5hdzdk ()Ljava/lang/String; + public static final fun getDATE_MONTHNUMBER-t5hdzdk ()Ljava/lang/String; + public static final fun getDATE_WEEK-t5hdzdk ()Ljava/lang/String; + public static final fun getDATE_YEAR-t5hdzdk ()Ljava/lang/String; + public static final fun getDATE_YEAROFWEEK-t5hdzdk ()Ljava/lang/String; + public static final fun getDEVICE_BRAND-t5hdzdk ()Ljava/lang/String; + public static final fun getDEVICE_DISPLAY_HEIGHT-t5hdzdk ()Ljava/lang/String; + public static final fun getDEVICE_DISPLAY_WIDTH-t5hdzdk ()Ljava/lang/String; + public static final fun getDEVICE_MANUFACTURER-t5hdzdk ()Ljava/lang/String; + public static final fun getDEVICE_MODEL-t5hdzdk ()Ljava/lang/String; + public static final fun getDEVICE_NAME-t5hdzdk ()Ljava/lang/String; + public static final fun getDEVICE_NAME_TECH-t5hdzdk ()Ljava/lang/String; + public static final fun getDEVICE_SCREEN_DIAGONAL-t5hdzdk ()Ljava/lang/String; + public static final fun getDEVICE_SCREEN_HEIGHT-t5hdzdk ()Ljava/lang/String; + public static final fun getDEVICE_SCREEN_WIDTH-t5hdzdk ()Ljava/lang/String; + public static final fun getDEVICE_TIMESTAMP_UTC-t5hdzdk ()Ljava/lang/String; + public static final fun getDEVICE_TYPE-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_COLLECTION_PLATFORM-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_COLLECTION_VERSION-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_HOUR-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_ID-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_MINUTE-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_NAME-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_POSITION-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_SECOND-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_TIME-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_TIME_UTC-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_URL-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_URL_DOMAIN-t5hdzdk ()Ljava/lang/String; + public static final fun getEVENT_URL_FULL-t5hdzdk ()Ljava/lang/String; + public static final fun getEXCLUSION_CAUSE-t5hdzdk ()Ljava/lang/String; + public static final fun getEXCLUSION_TYPE-t5hdzdk ()Ljava/lang/String; + public static final fun getGEO_CITY-t5hdzdk ()Ljava/lang/String; + public static final fun getGEO_CONTINENT-t5hdzdk ()Ljava/lang/String; + public static final fun getGEO_COUNTRY-t5hdzdk ()Ljava/lang/String; + public static final fun getGEO_METRO-t5hdzdk ()Ljava/lang/String; + public static final fun getGEO_REGION-t5hdzdk ()Ljava/lang/String; + public static final fun getHIT_TIME_UTC-t5hdzdk ()Ljava/lang/String; + public final fun getKey ()Ljava/lang/String; + public static final fun getOS-t5hdzdk ()Ljava/lang/String; + public static final fun getOS_GROUP-t5hdzdk ()Ljava/lang/String; + public static final fun getOS_VERSION-t5hdzdk ()Ljava/lang/String; + public static final fun getOS_VERSION_NAME-t5hdzdk ()Ljava/lang/String; + public static final fun getPAGE-t5hdzdk ()Ljava/lang/String; + public static final fun getPAGE_CHAPTER1-t5hdzdk ()Ljava/lang/String; + public static final fun getPAGE_CHAPTER2-t5hdzdk ()Ljava/lang/String; + public static final fun getPAGE_CHAPTER3-t5hdzdk ()Ljava/lang/String; + public static final fun getPAGE_DURATION-t5hdzdk ()Ljava/lang/String; + public static final fun getPAGE_FULL_NAME-t5hdzdk ()Ljava/lang/String; + public static final fun getPAGE_POSITION-t5hdzdk ()Ljava/lang/String; + public static final fun getPRIVACY_STATUS-t5hdzdk ()Ljava/lang/String; + public static final fun getSITE-t5hdzdk ()Ljava/lang/String; + public static final fun getSITE_ENV-t5hdzdk ()Ljava/lang/String; + public static final fun getSITE_ID-t5hdzdk ()Ljava/lang/String; + public static final fun getSITE_PLATFORM-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_DETAIL-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_DIRECT_ACCESS-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_ORGANIC-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_ORGANIC_DETAIL-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_PORTAL_DOMAIN-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_PORTAL_SITE-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_PORTAL_SITE_ID-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_PORTAL_URL-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_REFERRER_SITE_DOMAIN-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_REFERRER_SITE_URL-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_REFERRER_URL-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_SE-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_SE_CATEGORY-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_SE_COUNTRY-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_TYPE-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_URL-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_URL_DOMAIN-t5hdzdk ()Ljava/lang/String; + public static final fun getSRC_WEBMAIL-t5hdzdk ()Ljava/lang/String; + public static final fun getUSER_CATEGORY-t5hdzdk ()Ljava/lang/String; + public static final fun getUSER_ID-t5hdzdk ()Ljava/lang/String; + public static final fun getUSER_RECOGNITION-t5hdzdk ()Ljava/lang/String; + public static final fun getVISITOR_PRIVACY_CONSENT-t5hdzdk ()Ljava/lang/String; + public static final fun getVISITOR_PRIVACY_MODE-t5hdzdk ()Ljava/lang/String; + public fun hashCode ()I + public static fun hashCode-impl (Ljava/lang/String;)I + public fun toString ()Ljava/lang/String; + public static fun toString-impl (Ljava/lang/String;)Ljava/lang/String; + public final synthetic fun unbox-impl ()Ljava/lang/String; +} + +public final class io/piano/android/analytics/model/PropertyName$Companion { + public final fun getANY_PROPERTY-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_CRASH-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_CRASH_CLASS-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_CRASH_SCREEN-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_DAYS_SINCE_FIRST_SESSION-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_DAYS_SINCE_LAST_SESSION-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_DAYS_SINCE_UPDATE-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_FIRST_SESSION-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_FIRST_SESSION_AFTER_UPDATE-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_FIRST_SESSION_DATE-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_FIRST_SESSION_DATE_AFTER_UPDATE-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_ID-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_SESSION_COUNT-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_SESSION_COUNT_SINCE_UPDATE-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_SESSION_ID-t5hdzdk ()Ljava/lang/String; + public final fun getAPP_VERSION-t5hdzdk ()Ljava/lang/String; + public final fun getBROWSER-t5hdzdk ()Ljava/lang/String; + public final fun getBROWSER_COOKIE_ACCEPTANCE-t5hdzdk ()Ljava/lang/String; + public final fun getBROWSER_GROUP-t5hdzdk ()Ljava/lang/String; + public final fun getBROWSER_LANGUAGE-t5hdzdk ()Ljava/lang/String; + public final fun getBROWSER_LANGUAGE_LOCAL-t5hdzdk ()Ljava/lang/String; + public final fun getBROWSER_VERSION-t5hdzdk ()Ljava/lang/String; + public final fun getCLICK-t5hdzdk ()Ljava/lang/String; + public final fun getCLICK_CHAPTER1-t5hdzdk ()Ljava/lang/String; + public final fun getCLICK_CHAPTER2-t5hdzdk ()Ljava/lang/String; + public final fun getCLICK_CHAPTER3-t5hdzdk ()Ljava/lang/String; + public final fun getCLICK_FULL_NAME-t5hdzdk ()Ljava/lang/String; + public final fun getCONNECTION_MONITOR-t5hdzdk ()Ljava/lang/String; + public final fun getCONNECTION_ORGANISATION-t5hdzdk ()Ljava/lang/String; + public final fun getCONNECTION_TYPE-t5hdzdk ()Ljava/lang/String; + public final fun getDATE-t5hdzdk ()Ljava/lang/String; + public final fun getDATE_DAY-t5hdzdk ()Ljava/lang/String; + public final fun getDATE_DAYNUMBER-t5hdzdk ()Ljava/lang/String; + public final fun getDATE_MONTH-t5hdzdk ()Ljava/lang/String; + public final fun getDATE_MONTHNUMBER-t5hdzdk ()Ljava/lang/String; + public final fun getDATE_WEEK-t5hdzdk ()Ljava/lang/String; + public final fun getDATE_YEAR-t5hdzdk ()Ljava/lang/String; + public final fun getDATE_YEAROFWEEK-t5hdzdk ()Ljava/lang/String; + public final fun getDEVICE_BRAND-t5hdzdk ()Ljava/lang/String; + public final fun getDEVICE_DISPLAY_HEIGHT-t5hdzdk ()Ljava/lang/String; + public final fun getDEVICE_DISPLAY_WIDTH-t5hdzdk ()Ljava/lang/String; + public final fun getDEVICE_MANUFACTURER-t5hdzdk ()Ljava/lang/String; + public final fun getDEVICE_MODEL-t5hdzdk ()Ljava/lang/String; + public final fun getDEVICE_NAME-t5hdzdk ()Ljava/lang/String; + public final fun getDEVICE_NAME_TECH-t5hdzdk ()Ljava/lang/String; + public final fun getDEVICE_SCREEN_DIAGONAL-t5hdzdk ()Ljava/lang/String; + public final fun getDEVICE_SCREEN_HEIGHT-t5hdzdk ()Ljava/lang/String; + public final fun getDEVICE_SCREEN_WIDTH-t5hdzdk ()Ljava/lang/String; + public final fun getDEVICE_TIMESTAMP_UTC-t5hdzdk ()Ljava/lang/String; + public final fun getDEVICE_TYPE-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_COLLECTION_PLATFORM-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_COLLECTION_VERSION-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_HOUR-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_ID-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_MINUTE-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_NAME-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_POSITION-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_SECOND-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_TIME-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_TIME_UTC-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_URL-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_URL_DOMAIN-t5hdzdk ()Ljava/lang/String; + public final fun getEVENT_URL_FULL-t5hdzdk ()Ljava/lang/String; + public final fun getEXCLUSION_CAUSE-t5hdzdk ()Ljava/lang/String; + public final fun getEXCLUSION_TYPE-t5hdzdk ()Ljava/lang/String; + public final fun getGEO_CITY-t5hdzdk ()Ljava/lang/String; + public final fun getGEO_CONTINENT-t5hdzdk ()Ljava/lang/String; + public final fun getGEO_COUNTRY-t5hdzdk ()Ljava/lang/String; + public final fun getGEO_METRO-t5hdzdk ()Ljava/lang/String; + public final fun getGEO_REGION-t5hdzdk ()Ljava/lang/String; + public final fun getHIT_TIME_UTC-t5hdzdk ()Ljava/lang/String; + public final fun getOS-t5hdzdk ()Ljava/lang/String; + public final fun getOS_GROUP-t5hdzdk ()Ljava/lang/String; + public final fun getOS_VERSION-t5hdzdk ()Ljava/lang/String; + public final fun getOS_VERSION_NAME-t5hdzdk ()Ljava/lang/String; + public final fun getPAGE-t5hdzdk ()Ljava/lang/String; + public final fun getPAGE_CHAPTER1-t5hdzdk ()Ljava/lang/String; + public final fun getPAGE_CHAPTER2-t5hdzdk ()Ljava/lang/String; + public final fun getPAGE_CHAPTER3-t5hdzdk ()Ljava/lang/String; + public final fun getPAGE_DURATION-t5hdzdk ()Ljava/lang/String; + public final fun getPAGE_FULL_NAME-t5hdzdk ()Ljava/lang/String; + public final fun getPAGE_POSITION-t5hdzdk ()Ljava/lang/String; + public final fun getPRIVACY_STATUS-t5hdzdk ()Ljava/lang/String; + public final fun getSITE-t5hdzdk ()Ljava/lang/String; + public final fun getSITE_ENV-t5hdzdk ()Ljava/lang/String; + public final fun getSITE_ID-t5hdzdk ()Ljava/lang/String; + public final fun getSITE_PLATFORM-t5hdzdk ()Ljava/lang/String; + public final fun getSRC-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_DETAIL-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_DIRECT_ACCESS-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_ORGANIC-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_ORGANIC_DETAIL-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_PORTAL_DOMAIN-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_PORTAL_SITE-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_PORTAL_SITE_ID-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_PORTAL_URL-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_REFERRER_SITE_DOMAIN-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_REFERRER_SITE_URL-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_REFERRER_URL-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_SE-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_SE_CATEGORY-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_SE_COUNTRY-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_TYPE-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_URL-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_URL_DOMAIN-t5hdzdk ()Ljava/lang/String; + public final fun getSRC_WEBMAIL-t5hdzdk ()Ljava/lang/String; + public final fun getUSER_CATEGORY-t5hdzdk ()Ljava/lang/String; + public final fun getUSER_ID-t5hdzdk ()Ljava/lang/String; + public final fun getUSER_RECOGNITION-t5hdzdk ()Ljava/lang/String; + public final fun getVISITOR_PRIVACY_CONSENT-t5hdzdk ()Ljava/lang/String; + public final fun getVISITOR_PRIVACY_MODE-t5hdzdk ()Ljava/lang/String; +} + +public final class io/piano/android/analytics/model/User { + public fun (Ljava/lang/String;Ljava/lang/String;Z)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun getCategory ()Ljava/lang/String; + public final fun getId ()Ljava/lang/String; + public final fun getShouldBeStored ()Z +} + +public final class io/piano/android/analytics/model/UserJsonAdapter : com/squareup/moshi/JsonAdapter { + public fun (Lcom/squareup/moshi/Moshi;)V + public fun fromJson (Lcom/squareup/moshi/JsonReader;)Ljava/lang/Object; + public fun toJson (Lcom/squareup/moshi/JsonWriter;Ljava/lang/Object;)V + public fun toString ()Ljava/lang/String; +} + +public final class io/piano/android/analytics/model/VisitorIDType : java/lang/Enum { + public static final field ADVERTISING_ID Lio/piano/android/analytics/model/VisitorIDType; + public static final field CUSTOM Lio/piano/android/analytics/model/VisitorIDType; + public static final field GOOGLE_ADVERTISING_ID Lio/piano/android/analytics/model/VisitorIDType; + public static final field HUAWEI_OPEN_ADVERTISING_ID Lio/piano/android/analytics/model/VisitorIDType; + public static final field UUID Lio/piano/android/analytics/model/VisitorIDType; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lio/piano/android/analytics/model/VisitorIDType; + public static fun values ()[Lio/piano/android/analytics/model/VisitorIDType; +} + +public final class io/piano/android/analytics/model/VisitorStorageMode : java/lang/Enum { + public static final field FIXED Lio/piano/android/analytics/model/VisitorStorageMode; + public static final field RELATIVE Lio/piano/android/analytics/model/VisitorStorageMode; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lio/piano/android/analytics/model/VisitorStorageMode; + public static fun values ()[Lio/piano/android/analytics/model/VisitorStorageMode; +} + diff --git a/piano-analytics/build.gradle.kts b/piano-analytics/build.gradle.kts index 9e4dfd5..f7eb250 100644 --- a/piano-analytics/build.gradle.kts +++ b/piano-analytics/build.gradle.kts @@ -3,6 +3,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.ksp) alias(libs.plugins.moshiIR) + alias(libs.plugins.binaryCompatibility) alias(libs.plugins.ktlint) alias(libs.plugins.mavenRelease) } @@ -58,6 +59,7 @@ ktlint { dependencies { compileOnly(libs.googleAdsId) compileOnly(libs.huaweiAdsId) + api(libs.pianoConsents) implementation(libs.lifecycleProcess) implementation(libs.timber) implementation(libs.okhttp) diff --git a/piano-analytics/gradle.properties b/piano-analytics/gradle.properties index 8d9ecff..b36dbb4 100644 --- a/piano-analytics/gradle.properties +++ b/piano-analytics/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=3.3.6-SNAPSHOT +VERSION_NAME=3.4.0-SNAPSHOT GROUP=io.piano.android POM_NAME=Analytics POM_ARTIFACT_ID=analytics diff --git a/piano-analytics/src/main/java/io/piano/android/analytics/Configuration.kt b/piano-analytics/src/main/java/io/piano/android/analytics/Configuration.kt index f080036..e39e50c 100644 --- a/piano-analytics/src/main/java/io/piano/android/analytics/Configuration.kt +++ b/piano-analytics/src/main/java/io/piano/android/analytics/Configuration.kt @@ -10,11 +10,13 @@ import io.piano.android.analytics.model.VisitorStorageMode */ public class Configuration private constructor( public val reportUrlProvider: ReportUrlProvider, + @Deprecated("Use `PianoConsents` for managing consents instead") public val defaultPrivacyMode: PrivacyMode, public val visitorIDType: VisitorIDType, public val offlineStorageMode: OfflineStorageMode, public val visitorStorageMode: VisitorStorageMode, public val eventsOfflineStorageLifetime: Int, + @Deprecated("Use `PianoConsents` for managing consents instead") public val privacyStorageLifetime: Int, public val visitorStorageLifetime: Int, public val userStorageLifetime: Int, @@ -27,11 +29,13 @@ public class Configuration private constructor( public var collectDomain: String = "", public var site: Int = 0, public var path: String = DEFAULT_PATH, + @Deprecated("Use `PianoConsents` for managing consents instead") public var defaultPrivacyMode: PrivacyMode = PrivacyMode.OPTIN, public var visitorIDType: VisitorIDType = VisitorIDType.UUID, public var offlineStorageMode: OfflineStorageMode = OfflineStorageMode.REQUIRED, public var visitorStorageMode: VisitorStorageMode = VisitorStorageMode.FIXED, public var eventsOfflineStorageLifetime: Int = DEFAULT_EVENTS_OFFLINE_STORAGE_LIFETIME, + @Deprecated("Use `PianoConsents` for managing consents instead") public var privacyStorageLifetime: Int = DEFAULT_PRIVACY_STORAGE_LIFETIME, public var visitorStorageLifetime: Int = DEFAULT_VISITOR_STORAGE_LIFETIME, public var userStorageLifetime: Int = DEFAULT_USER_STORAGE_LIFETIME, @@ -72,6 +76,7 @@ public class Configuration private constructor( * @return updated Builder instance */ @Suppress("unused") // Public API. + @Deprecated("Use `PianoConsents` for managing consents instead") public fun defaultPrivacyMode(defaultPrivacyMode: PrivacyMode): Builder = apply { this.defaultPrivacyMode = defaultPrivacyMode } @@ -120,6 +125,7 @@ public class Configuration private constructor( * @return updated Builder instance */ @Suppress("unused") // Public API. + @Deprecated("Use `PianoConsents` for managing consents instead") public fun privacyStorageLifetime(privacyStorageLifetime: Int): Builder = apply { this.privacyStorageLifetime = privacyStorageLifetime } diff --git a/piano-analytics/src/main/java/io/piano/android/analytics/DependenciesProvider.kt b/piano-analytics/src/main/java/io/piano/android/analytics/DependenciesProvider.kt index ea676a3..74774bc 100644 --- a/piano-analytics/src/main/java/io/piano/android/analytics/DependenciesProvider.kt +++ b/piano-analytics/src/main/java/io/piano/android/analytics/DependenciesProvider.kt @@ -19,6 +19,7 @@ import io.piano.android.analytics.model.Event import io.piano.android.analytics.model.EventsRequest import io.piano.android.analytics.model.User import io.piano.android.analytics.model.VisitorIDType +import io.piano.android.consents.PianoConsents import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import java.util.concurrent.Executors @@ -29,12 +30,13 @@ import java.util.concurrent.TimeUnit internal class DependenciesProvider private constructor( context: Context, configuration: Configuration, + pianoConsents: PianoConsents? = null, dataEncoder: DataEncoder, ) { private val userAgent = "Piano Analytics SDK ${BuildConfig.SDK_VERSION}" private val executorProvider: () -> ScheduledExecutorService = { Executors.newSingleThreadScheduledExecutor() } private val prefsStorage = PrefsStorage(context) - private val privacyModesStorage = PrivacyModesStorage(configuration, prefsStorage) + private val privacyModesStorage = PrivacyModesStorage(configuration, prefsStorage, pianoConsents) private val screenNameProvider = ScreenNameProvider() private val contextPropertiesStorage = ContextPropertiesStorage() @@ -146,7 +148,8 @@ internal class DependenciesProvider private constructor( customEventProcessors, privacyModesStorage, contextPropertiesStorage, - userStorage + userStorage, + pianoConsents ) companion object { @@ -155,11 +158,21 @@ internal class DependenciesProvider private constructor( private var instance: DependenciesProvider? = null @JvmStatic - internal fun init(context: Context, configuration: Configuration, dataEncoder: DataEncoder) { + internal fun init( + context: Context, + configuration: Configuration, + pianoConsents: PianoConsents?, + dataEncoder: DataEncoder, + ) { if (instance == null) { synchronized(this) { if (instance == null) { - instance = DependenciesProvider(context.applicationContext, configuration, dataEncoder).also { + instance = DependenciesProvider( + context.applicationContext, + configuration, + pianoConsents, + dataEncoder + ).also { Thread.setDefaultUncaughtExceptionHandler(it.crashHandler) } } diff --git a/piano-analytics/src/main/java/io/piano/android/analytics/EventPropertiesJsonAdapter.kt b/piano-analytics/src/main/java/io/piano/android/analytics/EventPropertiesJsonAdapter.kt index 3806c91..9ff7624 100644 --- a/piano-analytics/src/main/java/io/piano/android/analytics/EventPropertiesJsonAdapter.kt +++ b/piano-analytics/src/main/java/io/piano/android/analytics/EventPropertiesJsonAdapter.kt @@ -25,7 +25,7 @@ internal class EventPropertiesJsonAdapter( val key = entry.key.substring(delimiterIndex + 1) val type = if (delimiterIndex != -1) { val prefix = entry.key.substring(0, delimiterIndex) - Property.Type.values().firstOrNull { it.prefix == prefix } + Property.Type.entries.firstOrNull { it.prefix == prefix } } else { null } diff --git a/piano-analytics/src/main/java/io/piano/android/analytics/PianoAnalytics.kt b/piano-analytics/src/main/java/io/piano/android/analytics/PianoAnalytics.kt index 367f12c..e86b254 100644 --- a/piano-analytics/src/main/java/io/piano/android/analytics/PianoAnalytics.kt +++ b/piano-analytics/src/main/java/io/piano/android/analytics/PianoAnalytics.kt @@ -10,6 +10,7 @@ import io.piano.android.analytics.model.Event import io.piano.android.analytics.model.OfflineStorageMode import io.piano.android.analytics.model.Property import io.piano.android.analytics.model.PropertyName +import io.piano.android.consents.PianoConsents import java.util.UUID import java.util.concurrent.ScheduledExecutorService import java.util.concurrent.TimeUnit @@ -20,6 +21,7 @@ import java.util.concurrent.TimeUnit * @property privacyModesStorage Storage for privacy modes * @property contextPropertiesStorage Storage for context properties * @property userStorage Storage for user data + * @property pianoConsents [PianoConsents] instance for managing user consent. */ public class PianoAnalytics internal constructor( private val executorProvider: () -> ScheduledExecutorService, @@ -33,6 +35,7 @@ public class PianoAnalytics internal constructor( customEventProcessorsGroup: GroupEventProcessor, // Public API. @Suppress("unused", "MemberVisibilityCanBePrivate") + @Deprecated("Use `pianoConsents` for managing consents instead") public val privacyModesStorage: PrivacyModesStorage, // Public API. @Suppress("unused", "MemberVisibilityCanBePrivate") @@ -40,6 +43,9 @@ public class PianoAnalytics internal constructor( // Public API. @Suppress("unused", "MemberVisibilityCanBePrivate") public val userStorage: UserStorage, + // Public API. + @Suppress("unused", "MemberVisibilityCanBePrivate") + public val pianoConsents: PianoConsents?, ) { private val executor: ScheduledExecutorService = executorProvider() @@ -165,6 +171,7 @@ public class PianoAnalytics internal constructor( * * @param context Activity or Application context * @param configuration [Configuration] object + * @param pianoConsents [PianoConsents] instance for managing user consent. Default is null. * @param dataEncoder custom [DataEncoder] for encrypting/decrypting events' data, default is [PlainDataEncoder] */ @Suppress("unused") // Public API. @@ -173,9 +180,10 @@ public class PianoAnalytics internal constructor( public fun init( context: Context, configuration: Configuration, + pianoConsents: PianoConsents? = null, dataEncoder: DataEncoder = PlainDataEncoder, ): PianoAnalytics { - DependenciesProvider.init(context, configuration, dataEncoder) + DependenciesProvider.init(context, configuration, pianoConsents, dataEncoder) return getInstance() } diff --git a/piano-analytics/src/main/java/io/piano/android/analytics/PrivacyModesStorage.kt b/piano-analytics/src/main/java/io/piano/android/analytics/PrivacyModesStorage.kt index 4715862..91a10aa 100644 --- a/piano-analytics/src/main/java/io/piano/android/analytics/PrivacyModesStorage.kt +++ b/piano-analytics/src/main/java/io/piano/android/analytics/PrivacyModesStorage.kt @@ -1,16 +1,24 @@ package io.piano.android.analytics import io.piano.android.analytics.model.PrivacyMode +import io.piano.android.analytics.model.PrivacyMode.Companion.NO_CONSENT +import io.piano.android.analytics.model.PrivacyMode.Companion.toPrivacyMode import io.piano.android.analytics.model.PrivacyStorageFeature +import io.piano.android.consents.PianoConsents +import io.piano.android.consents.models.Product +import timber.log.Timber import java.util.concurrent.TimeUnit /** * Stores information about privacy modes */ +@Deprecated("Use `PianoConsents` for managing consents instead") public class PrivacyModesStorage internal constructor( private val configuration: Configuration, private val prefsStorage: PrefsStorage, + private val pianoConsents: PianoConsents?, ) { + private val consentsEnabled = pianoConsents?.consentConfiguration?.requireConsent == true init { prefsStorage.privacyStorageFilter = ::isFeatureAllowed } @@ -31,7 +39,8 @@ public class PrivacyModesStorage internal constructor( PrivacyMode.NO_STORAGE, PrivacyMode.OPTIN, PrivacyMode.OPTOUT, - PrivacyMode.EXEMPT + PrivacyMode.EXEMPT, + PrivacyMode.CUSTOM ) /** @@ -40,6 +49,11 @@ public class PrivacyModesStorage internal constructor( @Suppress("unused", "MemberVisibilityCanBePrivate") // Public API. public var currentMode: PrivacyMode = configuration.defaultPrivacyMode get() { + if (consentsEnabled) { + return pianoConsents?.let { + it.consents[it.productsToPurposesMapping[Product.PA]]?.mode + }?.toPrivacyMode() ?: NO_CONSENT + } if (field != PrivacyMode.NO_CONSENT && field != PrivacyMode.NO_STORAGE) { if (prefsStorage.privacyExpirationTimestamp in 1..System.currentTimeMillis()) { currentMode = configuration.defaultPrivacyMode @@ -53,6 +67,9 @@ public class PrivacyModesStorage internal constructor( return field } set(value) { + if (consentsEnabled) { + Timber.w("Calling deprecated privacy mode setter while consents enabled") + } require(value in allModes) { "Privacy mode ${value.visitorMode} is not registered." } @@ -69,6 +86,9 @@ public class PrivacyModesStorage internal constructor( System.currentTimeMillis() + TimeUnit.DAYS.toMillis(configuration.privacyStorageLifetime.toLong()) internal fun updatePrefs(mode: PrivacyMode) { + if (consentsEnabled) { + return + } prefsStorage.apply { privacyMode = mode.visitorMode privacyExpirationTimestamp = getNewExpirationTimestamp() diff --git a/piano-analytics/src/main/java/io/piano/android/analytics/model/PrivacyMode.kt b/piano-analytics/src/main/java/io/piano/android/analytics/model/PrivacyMode.kt index 397be53..e176072 100644 --- a/piano-analytics/src/main/java/io/piano/android/analytics/model/PrivacyMode.kt +++ b/piano-analytics/src/main/java/io/piano/android/analytics/model/PrivacyMode.kt @@ -1,5 +1,7 @@ package io.piano.android.analytics.model +import io.piano.android.consents.models.ConsentMode + /** * A privacy visitor mode * @@ -183,6 +185,12 @@ public class PrivacyMode( @JvmStatic public val EXEMPT: PrivacyMode = PrivacyMode(visitorMode = "exempt") + /** + * Custom privacy mode + */ + @JvmStatic + public val CUSTOM: PrivacyMode = PrivacyMode(visitorMode = "custom") + /** * No consent privacy mode */ @@ -206,5 +214,14 @@ public class PrivacyMode( forbiddenStorageFeatures = mutableSetOf(PrivacyStorageFeature.ALL), allowedPropertyKeys = mutableMapOf(Event.ANY to mutableSetOf(PropertyName.ANY_PROPERTY)) ) + + @JvmStatic + internal fun ConsentMode.toPrivacyMode(): PrivacyMode = when (this) { + ConsentMode.OPT_IN -> OPTIN + ConsentMode.ESSENTIAL -> EXEMPT + ConsentMode.OPT_OUT -> OPTOUT + ConsentMode.NOT_ACQUIRED -> NO_CONSENT + ConsentMode.CUSTOM -> CUSTOM + } } } diff --git a/piano-analytics/src/main/java/io/piano/android/analytics/model/Property.kt b/piano-analytics/src/main/java/io/piano/android/analytics/model/Property.kt index 9972837..d62eb77 100644 --- a/piano-analytics/src/main/java/io/piano/android/analytics/model/Property.kt +++ b/piano-analytics/src/main/java/io/piano/android/analytics/model/Property.kt @@ -18,7 +18,7 @@ public class Property { override fun hashCode(): Int = name.key.lowercase().hashCode() - internal constructor(name: PropertyName, value: Any, forceType: Type? = null) { + internal constructor(name: PropertyName, value: Any, forceType: Type?) { require(name != PropertyName.ANY_PROPERTY) this.name = name this.value = value diff --git a/settings.gradle.kts b/settings.gradle.kts index 1be30fd..1b59195 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -16,8 +16,15 @@ dependencyResolutionManagement { } plugins { - id("com.gradle.develocity") version "3.17" + id("com.gradle.develocity") version "3.17.1" } + +develocity { + buildScan { + publishing.onlyIf { false } + } +} + include( ":app", ":piano-analytics"