Skip to content

Commit

Permalink
3.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DeKaN committed Aug 6, 2024
2 parents bffb050 + cf20ff0 commit 267fbd4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Piano Analytics SDK for Android

## v3.4.1
* Fixed bug with prefs for new `PianoConsents` mode

## v3.4.0
* Updated to Kotlin 1.9
* Added support for `PianoConsents`
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
# Plugins
kotlin = "1.9.23"
android = "8.3.2"
android = "8.4.2"
binaryCompatibility = "0.14.0"
versionUpdater = "0.51.0"
ktlint = "12.1.0"
Expand Down
2 changes: 1 addition & 1 deletion piano-analytics/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=3.4.0
VERSION_NAME=3.4.1
GROUP=io.piano.android
POM_NAME=Analytics
POM_ARTIFACT_ID=analytics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ public class PrivacyModesStorage internal constructor(
prefsStorage.privacyStorageFilter = ::isFeatureAllowed
}
private fun isFeatureAllowed(privacyStorageFeature: PrivacyStorageFeature): Boolean {
val isNotForbidden = PrivacyStorageFeature.ALL !in cachedMode.forbiddenStorageFeatures ||
privacyStorageFeature !in cachedMode.forbiddenStorageFeatures
val isAllowed = PrivacyStorageFeature.ALL in cachedMode.allowedStorageFeatures ||
privacyStorageFeature in cachedMode.allowedStorageFeatures
val privacyMode = if (consentsEnabled) consentsCurrentMode else cachedMode
val isNotForbidden = PrivacyStorageFeature.ALL !in privacyMode.forbiddenStorageFeatures ||
privacyStorageFeature !in privacyMode.forbiddenStorageFeatures
val isAllowed = PrivacyStorageFeature.ALL in privacyMode.allowedStorageFeatures ||
privacyStorageFeature in privacyMode.allowedStorageFeatures
return isNotForbidden && isAllowed
}

private val consentsCurrentMode
get() = pianoConsents?.let {
it.consents[it.productsToPurposesMapping[Product.PA]]?.mode
}?.toPrivacyMode() ?: PrivacyMode.NO_CONSENT

/**
* All registered privacy modes. Add a [PrivacyMode] instance into [allModes] for registering it
*/
Expand All @@ -49,9 +55,7 @@ public class PrivacyModesStorage internal constructor(
public var currentMode: PrivacyMode = configuration.defaultPrivacyMode
get() {
if (consentsEnabled) {
return pianoConsents?.let {
it.consents[it.productsToPurposesMapping[Product.PA]]?.mode
}?.toPrivacyMode() ?: PrivacyMode.NO_CONSENT
return consentsCurrentMode
}
if (field != PrivacyMode.NO_CONSENT && field != PrivacyMode.NO_STORAGE) {
if (prefsStorage.privacyExpirationTimestamp in 1..System.currentTimeMillis()) {
Expand Down

0 comments on commit 267fbd4

Please sign in to comment.