Skip to content

Commit

Permalink
[opt-out] Add opt out support (#2)
Browse files Browse the repository at this point in the history
* [opt-out] Add opt out support

* [opt-out] bump gradle plugin

* [opt-out] Update build tools

* [opt-out] QA Changes

* [opt-out] fix

---------

Co-authored-by: OliverMcBurney <oliver.mcburney@myunidays.com>
  • Loading branch information
OliverMcB and OliverMcBurney authored Mar 3, 2023
1 parent 360ec6f commit 713dcdc
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
classpath("com.android.tools.build:gradle:7.0.4")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
classpath("com.android.tools.build:gradle:7.1.3")
classpath("org.jlleitschuh.gradle.ktlint:org.jlleitschuh.gradle.ktlint.gradle.plugin:11.0.0")
classpath("io.gitlab.arturbosch.detekt:io.gitlab.arturbosch.detekt.gradle.plugin:1.22.0")
}
Expand Down
2 changes: 1 addition & 1 deletion library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ android {
buildToolsVersion = "30.0.3"
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 23
minSdk = 24
targetSdk = 31
}
compileOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ actual class Analytics internal constructor(val android: com.segment.analytics.A
}
)

actual fun optOut(status: Boolean) =
android.optOut(
status
)

actual fun reset() {
android.reset()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ expect class Analytics {
fun alias(userId: String, options: Map<Any?, *>? = null)
fun screen(screenTitle: String, properties: Map<Any?, *>? = null, options: Map<Any?, *>? = null)
fun group(groupId: String, traits: Map<Any?, *>? = null, options: Map<Any?, *>? = null)
fun optOut(status: Boolean)

fun reset()
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ actual class Analytics internal constructor(val ios: cocoapods.Analytics.SEGAnal

actual fun group(groupId: String, traits: Map<Any?, *>?, options: Map<Any?, *>?) = ios.group(groupId, traits, options?.let { mapOf("context" to it) })

actual fun optOut(status: Boolean) = if (status) {
ios.enable()
} else {
ios.disable()
}
actual fun reset() {
ios.reset()
}
Expand Down
2 changes: 2 additions & 0 deletions library/src/jsMain/kotlin/com/myunidays/segmenkt/Analytics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ actual class Analytics {
actual fun group(groupId: String, traits: Map<Any?, *>?, options: Map<Any?, *>?) {
}

actual fun optOut(status: Boolean) {
}
actual fun reset() {
}
}

0 comments on commit 713dcdc

Please sign in to comment.