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
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
## [Unreleased]

TBA
### Added
- Migrated from Gradle Nexus publishing library to Gradle Maven Publish Plugin([#86](https://github.com/addhen/kanalytics/pull/86)).

### Dependencies
- Bumped gradle to `v8.14.3` ([#85](https://github.com/addhen/kanalytics/pull/85))cc1
- Bumped kotlinx-serialization-json to `v1.9.0` ([#84](https://github.com/addhen/kanalytics/pull/84))
- Bumped atomicfu to `v0.29.0` ([#83](https://github.com/addhen/kanalytics/pull/83))
- Bumped AGP to `v8.11.0` ([#81](https://github.com/addhen/kanalytics/pull/81))
- Bumped dev.mokkery to `v2.9.0` ([#80](https://github.com/addhen/kanalytics/pull/80))
- Bumped kotlin to `v2.2.0` ([#79](https://github.com/addhen/kanalytics/pull/79))
- Bumped lifecycle-viewmodel-compose to `v2.9.1` ([#78](https://github.com/addhen/kanalytics/pull/78))
- Bumped compose-gradle-plugin to `v1.8.2` ([#77](https://github.com/addhen/kanalytics/pull/77))
- Bumped kermit to `v2.0.6` ([#75](https://github.com/addhen/kanalytics/pull/75))
- Bumped appcompat to `v1.7.1` ([#72](https://github.com/addhen/kanalytics/pull/72))
- Bumped data-table-material3 to `v0.11.4` ([#70](https://github.com/addhen/kanalytics/pull/70))
- Bumped lifecycle-viewmodel-compose to `v2.9.0` ([#66](https://github.com/addhen/kanalytics/pull/66))

## [1.3.0] - 2025-05-21

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fun Project.configureKotlin() {
// Turning this off due to:
//https://youtrack.jetbrains.com/issue/KT-66568/w-KLIB-resolver-The-same-uniquename...-found-in-more-than-one-library
allWarningsAsErrors.set(false)
optIn.add("kotlin.time.ExperimentalTime")
freeCompilerArgs.add(
// expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) in Beta
// https://youtrack.jetbrains.com/issue/KT-61573
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ kotlinx-serializer = "1.9.0"
lifecycle-viewmodel-compose = "2.9.1"
kermit = "2.0.6"
kotlinx-collections-immutable = "0.4.0"
kotlinx-datetime = "0.7.0-0.6.x-compat"
kotlinx-datetime = "0.7.1"
sqldelight = "2.1.0"
startup-runtime = "1.2.0"
composeDataTable = "0.11.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package com.addhen.kanalytics.viewer

import com.addhen.kanalytics.KAnalyticsEvent
import com.addhen.kanalytics.KTrackerName
import kotlinx.datetime.Instant
import kotlin.time.Instant

public class KAnalyticsCollector(
private val showNotification: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import com.addhen.kanalytics.viewer.app.shared.AppCoroutineDispatchers
import com.addhen.kanalytics.viewer.app.shared.data.model.EventData
import com.addhen.kanalytics.viewer.app.shared.data.repository.EventDataRepository
import com.addhen.kanalytics.viewer.app.shared.data.repository.EventRepository
import kotlin.time.Instant
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlinx.datetime.Instant

public class KAnalyticsCollector(
showShortcut: Boolean = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package com.addhen.kanalytics.viewer

import com.addhen.kanalytics.Interceptor
import com.addhen.kanalytics.KAnalyticsEvent
import kotlinx.datetime.Clock
import kotlin.time.Clock

public class KAnalyticsInterceptor(
private val collector: KAnalyticsCollector = KAnalyticsCollector(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package com.addhen.kanalytics.viewer

import com.addhen.kanalytics.viewer.app.shared.data.repository.EventRepository
import kotlin.jvm.JvmInline
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant
import kotlin.time.Clock
import kotlin.time.Instant

public class RetentionPolicyManager(
private val clock: Clock = Clock.System,
Expand All @@ -18,7 +18,11 @@ public class RetentionPolicyManager(
val daysInMillis = dayDuration.numberOfDays * 24 * 60 * 60 * 1000L
val currentTimeInMillis = clock.now().toEpochMilliseconds()
val retentionDeadlineInMillis = currentTimeInMillis - daysInMillis
repository.deleteAllOlderThan(Instant.fromEpochMilliseconds(retentionDeadlineInMillis))
repository.deleteAllOlderThan(
Instant.fromEpochMilliseconds(
retentionDeadlineInMillis,
),
)
}

@JvmInline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import com.addhen.kanalytics.viewer.app.shared.AppCoroutineDispatchers
import com.addhen.kanalytics.viewer.app.shared.data.database.entities.EventDataEntity
import com.addhen.kanalytics.viewer.app.shared.data.database.sqlidelight.EventViewerDatabase
import com.addhen.kanalytics.viewer.app.shared.data.database.sqlidelight.createDatabase
import kotlin.time.Instant
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.withContext
import kotlinx.datetime.Instant

public class EventDataDao(
private val database: EventViewerDatabase,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

package com.addhen.kanalytics.viewer.app.shared.data.database.entities

import kotlinx.datetime.Instant

internal class EventDataEntity(
val id: Long?,
val name: String,
val trackerName: String,
val description: String?,
val createdAt: Instant,
val createdAt: kotlin.time.Instant,
val properties: Map<String, Any>,
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
package com.addhen.kanalytics.viewer.app.shared.data.database.sqlidelight.adapters

import app.cash.sqldelight.ColumnAdapter
import kotlinx.datetime.Instant
import kotlin.time.Instant

internal val instantAdapter = object : ColumnAdapter<Instant, String> {

override fun decode(databaseValue: String): Instant = Instant.parse(databaseValue)
override fun decode(databaseValue: String): Instant = kotlin.time.Instant.parse(databaseValue)

override fun encode(value: Instant): String = value.toString()
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package com.addhen.kanalytics.viewer.app.shared.data.model

import kotlinx.datetime.Instant
import kotlin.time.Instant

public class EventData(
public val id: Long?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package com.addhen.kanalytics.viewer.app.shared.data.repository
import com.addhen.kanalytics.viewer.app.shared.data.database.EventDataDao
import com.addhen.kanalytics.viewer.app.shared.data.database.entities.EventDataEntity
import com.addhen.kanalytics.viewer.app.shared.data.model.EventData
import kotlin.time.Instant
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import kotlinx.datetime.Instant

public class EventDataRepository(private val eventDataDao: EventDataDao) : EventRepository {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package com.addhen.kanalytics.viewer.app.shared.data.repository

import com.addhen.kanalytics.viewer.app.shared.data.model.EventData
import kotlin.time.Instant
import kotlinx.coroutines.flow.Flow
import kotlinx.datetime.Instant

public interface EventRepository {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2025, Addhen Ltd and the kanalytics project contributors
// SPDX-License-Identifier: Apache-2.0

import kotlinx.datetime.Instant
import kotlin.time.Instant
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import kotlin.String;
import kotlin.Any;
import kotlin.collections.Map;
import kotlinx.datetime.Instant;
import kotlin.time.Instant;

PRAGMA user_version = 3;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlin.time.Clock
import kotlin.time.Instant
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
Expand All @@ -24,8 +26,6 @@ import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.resetMain
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.test.setMain
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant

@OptIn(ExperimentalCoroutinesApi::class)
class KAnalyticsCollectorTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import dev.mokkery.verifySuspend
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertFailsWith
import kotlin.time.Clock
import kotlin.time.Instant
import kotlinx.coroutines.test.runTest
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant

class RetentionPolicyManagerTest {
private lateinit var clock: TestClock
Expand Down Expand Up @@ -43,7 +43,11 @@ class RetentionPolicyManagerTest {
manager.processDataRetention()

verifySuspend {
repository.deleteAllOlderThan(Instant.fromEpochMilliseconds(expectedRetentionDeadline))
repository.deleteAllOlderThan(
kotlin.time.Instant.fromEpochMilliseconds(
expectedRetentionDeadline,
),
)
}
}

Expand Down