Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ object Config {
"sentry-android-ndk",
"sentry-android-fragment",
"sentry-android-navigation",
"sentry-android-navigation3",
"sentry-android-timber",
"sentry-compose-android",
"sentry-android-sqlite",
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ androidx-activity-compose = { module = "androidx.activity:activity-compose", ver
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "androidxCompose" }
androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout", version.ref = "androidxCompose" }
androidx-compose-material3 = { module = "androidx.compose.material3:material3", version = "1.4.0" }
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "androidxCompose" }
androidx-compose-material-icons-core = { module = "androidx.compose.material:material-icons-core", version="1.7.8" }
androidx-compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version="1.7.8" }
androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "androidxCompose" }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public final class io/sentry/compose/navigation3/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 VERSION_NAME Ljava/lang/String;
public fun <init> ()V
}

82 changes: 82 additions & 0 deletions sentry-android-navigation3/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

plugins {
id("com.android.library")
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.gradle.versions)
alias(libs.plugins.detekt)
}

android {
compileSdk = libs.versions.compileSdk.get().toInt()
namespace = "io.sentry.compose.navigation3"

defaultConfig {
minSdk = 23 // Nav3 requires minSdk 23

// for AGP 4.1
buildConfigField("String", "VERSION_NAME", "\"${project.version}\"")
}

buildTypes {
getByName("debug") { consumerProguardFiles("proguard-rules.pro") }
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. The debug variant is
// disabled, so unit tests must target release to run at all.
testBuildType = "release"

kotlin {
compilerOptions.jvmTarget = JVM_1_8
compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9
compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9
}

testOptions {
unitTests.isReturnDefaultValues = true
}

lint {
warningsAsErrors = true
checkDependencies = true

// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
checkReleaseBuilds = false
}

buildFeatures {
buildConfig = true
compose = true
}

androidComponents.beforeVariants {
it.enable = !Config.Android.shouldSkipDebugVariant(it.buildType)
}
}

kotlin { explicitApi() }

dependencies {
implementation(projects.sentry)

compileOnly(libs.androidx.compose.runtime)

testImplementation(libs.androidx.compose.runtime)
testImplementation(libs.androidx.compose.ui.test.junit4)
testImplementation(libs.androidx.test.core)
testImplementation(libs.androidx.test.ext.junit)
testImplementation(libs.google.truth)
testImplementation(libs.kotlin.test.junit)
testImplementation(libs.mockito.inline)
testImplementation(libs.mockito.kotlin)
testImplementation(libs.roboelectric)
}

tasks.withType<Detekt>().configureEach {
// Target version of the generated JVM bytecode. It is used for type resolution.
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
7 changes: 7 additions & 0 deletions sentry-android-navigation3/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
##---------------Begin: proguard configuration for Compose ----------

# To ensure that stack traces is unambiguous
# https://developer.android.com/studio/build/shrink-code#decode-stack-trace
-keepattributes LineNumberTable,SourceFile

##---------------End: proguard configuration for Compose ----------
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.sentry.compose.navigation3

/**
* A key for distinguishing back stacks over time.
*
* Lets `*Effect`s restart when either the identity of a stack entry changes or the stack's entries
* are reordered.
*/
internal class BackStackKey<T : Any>(private val backStack: List<T>) {

override fun equals(other: Any?): Boolean {
// Use of identity rather than structural equality frees us from entries' equals() and
// hashCode() implementations, which are provided by the host app and may be incomplete,
// expensive, or incorrect for our purposes.
if (this === other) {
return true
}
if (other !is BackStackKey<*>) {
return false
}
if (backStack.size != other.backStack.size) {
return false
}

return backStack.indices.all { index -> backStack[index] === other.backStack[index] }
}

override fun hashCode(): Int {
var result = backStack.size
for (entry in backStack) {
result = 31 * result + System.identityHashCode(entry)
}
return result
}
}
Loading
Loading