diff --git a/app/src/main/kotlin/dev/teogor/ceres/feature/home/HomeScreen.kt b/app/src/main/kotlin/dev/teogor/ceres/feature/home/HomeScreen.kt index d081a1d1..627b46d4 100644 --- a/app/src/main/kotlin/dev/teogor/ceres/feature/home/HomeScreen.kt +++ b/app/src/main/kotlin/dev/teogor/ceres/feature/home/HomeScreen.kt @@ -34,7 +34,6 @@ import dev.teogor.ceres.framework.core.screen.showSettingsButton import dev.teogor.ceres.framework.core.screen.toolbarTitle import dev.teogor.ceres.framework.core.screen.toolbarTokens import dev.teogor.ceres.monetisation.admob.formats.nativead.NativeAd -import dev.teogor.ceres.monetisation.ads.ExperimentalAdsControlApi import dev.teogor.ceres.monetisation.messaging.ConsentManager import dev.teogor.ceres.navigation.core.LocalNavigationParameters import dev.teogor.ceres.navigation.core.utilities.toScreenName @@ -113,7 +112,6 @@ fun handleOnboardingReset(): () -> Unit { return resetOnboarding } -@OptIn(ExperimentalAdsControlApi::class) @Composable private fun HomeScreen( homeVM: HomeViewModel, diff --git a/core/analytics/.gitignore b/core/analytics/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/core/analytics/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/core/analytics/api/analytics.api b/core/analytics/api/analytics.api new file mode 100644 index 00000000..5397a906 --- /dev/null +++ b/core/analytics/api/analytics.api @@ -0,0 +1,97 @@ +public abstract class dev/teogor/ceres/core/analytics/AnalyticsEvent { + public static final field $stable I + public abstract fun getParams ()Ljava/util/List; + public abstract fun getType ()Ldev/teogor/ceres/core/analytics/Types; +} + +public final class dev/teogor/ceres/core/analytics/AnalyticsEvent$ScreenView : dev/teogor/ceres/core/analytics/AnalyticsEvent { + public static final field $stable I + public fun (Ljava/lang/String;Ljava/lang/String;)V + public final fun component1 ()Ljava/lang/String; + public final fun component2 ()Ljava/lang/String; + public final fun copy (Ljava/lang/String;Ljava/lang/String;)Ldev/teogor/ceres/core/analytics/AnalyticsEvent$ScreenView; + public static synthetic fun copy$default (Ldev/teogor/ceres/core/analytics/AnalyticsEvent$ScreenView;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ldev/teogor/ceres/core/analytics/AnalyticsEvent$ScreenView; + public fun equals (Ljava/lang/Object;)Z + public fun getParams ()Ljava/util/List; + public final fun getScreenClass ()Ljava/lang/String; + public final fun getScreenName ()Ljava/lang/String; + public fun getType ()Ldev/teogor/ceres/core/analytics/Types; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class dev/teogor/ceres/core/analytics/AnalyticsEventKt { + public static final fun toLowercaseString (Ldev/teogor/ceres/core/analytics/ParamKeys;)Ljava/lang/String; + public static final fun toLowercaseString (Ldev/teogor/ceres/core/analytics/Types;)Ljava/lang/String; +} + +public abstract interface class dev/teogor/ceres/core/analytics/AnalyticsHelper { + public abstract fun logEvent (Ldev/teogor/ceres/core/analytics/AnalyticsEvent;)V +} + +public final class dev/teogor/ceres/core/analytics/AnalyticsHelperKt { + public static final fun getAnalyticsProvider ()Ldev/teogor/ceres/core/analytics/AnalyticsProvider; + public static final fun getLocalAnalyticsHelper ()Landroidx/compose/runtime/ProvidableCompositionLocal; +} + +public class dev/teogor/ceres/core/analytics/AnalyticsProvider { + public static final field $stable I + public fun ()V + public final fun addAnalyticsHelper (Ldev/teogor/ceres/core/analytics/AnalyticsHelper;)Ldev/teogor/ceres/core/analytics/AnalyticsHelper; + public final fun getAnalyticsHelper (Ljava/lang/Class;)Ldev/teogor/ceres/core/analytics/AnalyticsHelper; + public final fun getAnalyticsHelpers ()Ljava/util/List; +} + +public final class dev/teogor/ceres/core/analytics/AnalyticsProviderKt { + public static final fun get (Ldev/teogor/ceres/core/analytics/AnalyticsProvider;Lkotlin/reflect/KClass;)Ldev/teogor/ceres/core/analytics/AnalyticsHelper; + public static final fun plusAssign (Ldev/teogor/ceres/core/analytics/AnalyticsProvider;Ldev/teogor/ceres/core/analytics/AnalyticsHelper;)V +} + +public final class dev/teogor/ceres/core/analytics/DefaultAnalyticsHelper : dev/teogor/ceres/core/analytics/AnalyticsHelper { + public static final field $stable I + public fun ()V + public fun logEvent (Ldev/teogor/ceres/core/analytics/AnalyticsEvent;)V +} + +public abstract interface annotation class dev/teogor/ceres/core/analytics/ExperimentalAnalyticsApi : java/lang/annotation/Annotation { +} + +public final class dev/teogor/ceres/core/analytics/Param { + public static final field $stable I + public fun (Ldev/teogor/ceres/core/analytics/ParamKeys;Ljava/lang/String;)V + public final fun component1 ()Ldev/teogor/ceres/core/analytics/ParamKeys; + public final fun component2 ()Ljava/lang/String; + public final fun copy (Ldev/teogor/ceres/core/analytics/ParamKeys;Ljava/lang/String;)Ldev/teogor/ceres/core/analytics/Param; + public static synthetic fun copy$default (Ldev/teogor/ceres/core/analytics/Param;Ldev/teogor/ceres/core/analytics/ParamKeys;Ljava/lang/String;ILjava/lang/Object;)Ldev/teogor/ceres/core/analytics/Param; + public fun equals (Ljava/lang/Object;)Z + public final fun getKey ()Ldev/teogor/ceres/core/analytics/ParamKeys; + public final fun getValue ()Ljava/lang/String; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class dev/teogor/ceres/core/analytics/ParamKeys : java/lang/Enum { + public static final field SCREEN_CLASS Ldev/teogor/ceres/core/analytics/ParamKeys; + public static final field SCREEN_NAME Ldev/teogor/ceres/core/analytics/ParamKeys; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Ldev/teogor/ceres/core/analytics/ParamKeys; + public static fun values ()[Ldev/teogor/ceres/core/analytics/ParamKeys; +} + +public final class dev/teogor/ceres/core/analytics/StubAnalyticsHelper : dev/teogor/ceres/core/analytics/AnalyticsHelper { + public static final field $stable I + public fun ()V + public fun logEvent (Ldev/teogor/ceres/core/analytics/AnalyticsEvent;)V +} + +public final class dev/teogor/ceres/core/analytics/Types : java/lang/Enum { + public static final field SCREEN_VIEW Ldev/teogor/ceres/core/analytics/Types; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Ldev/teogor/ceres/core/analytics/Types; + public static fun values ()[Ldev/teogor/ceres/core/analytics/Types; +} + +public final class dev/teogor/ceres/core/analytics/composables/UiEventsKt { + public static final fun TrackScreenViewEvent (Ljava/lang/String;Ljava/lang/String;Ldev/teogor/ceres/core/analytics/AnalyticsHelper;Landroidx/compose/runtime/Composer;II)V +} + diff --git a/core/analytics/build.gradle.kts b/core/analytics/build.gradle.kts new file mode 100644 index 00000000..2de30d34 --- /dev/null +++ b/core/analytics/build.gradle.kts @@ -0,0 +1,37 @@ +/* + * Copyright 2023 teogor (Teodor Grigor) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +plugins { + id("dev.teogor.ceres.android.library") + id("dev.teogor.ceres.android.library.compose") + id("dev.teogor.ceres.android.library.jacoco") +} + +android { + namespace = "dev.teogor.ceres.core.analytics" + defaultConfig { + consumerProguardFiles("consumer-proguard-rules.pro") + } +} + +dependencies { + api(libs.androidx.annotation) + api(libs.androidx.compose.runtime) + api(libs.androidx.compose.ui.tooling) +} + +ceresLibrary { + name = "Ceres Core Analytics" +} diff --git a/core/analytics/consumer-rules.pro b/core/analytics/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/core/analytics/proguard-rules.pro b/core/analytics/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/core/analytics/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/core/analytics/src/main/AndroidManifest.xml b/core/analytics/src/main/AndroidManifest.xml new file mode 100644 index 00000000..afc23636 --- /dev/null +++ b/core/analytics/src/main/AndroidManifest.xml @@ -0,0 +1,17 @@ + + + diff --git a/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/AnalyticsEvent.kt b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/AnalyticsEvent.kt new file mode 100644 index 00000000..58fd4687 --- /dev/null +++ b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/AnalyticsEvent.kt @@ -0,0 +1,65 @@ +/* + * Copyright 2023 teogor (Teodor Grigor) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.teogor.ceres.core.analytics + +enum class Types { + SCREEN_VIEW, // (extras: SCREEN_NAME, SCREEN_CLASS) +} + +fun Types.toLowercaseString(): String { + return this.name.lowercase() +} + +enum class ParamKeys { + SCREEN_NAME, + SCREEN_CLASS, +} + +fun ParamKeys.toLowercaseString(): String { + return this.name.lowercase() +} + +sealed class AnalyticsEvent { + abstract val type: Types + abstract val params: List + + data class ScreenView( + val screenName: String, + val screenClass: String, + ) : AnalyticsEvent() { + override val type: Types + get() = Types.SCREEN_VIEW + + override val params: List + get() = listOf( + Param(ParamKeys.SCREEN_NAME, screenName), + Param(ParamKeys.SCREEN_CLASS, screenClass), + ) + } +} + +/** + * A key-value pair used to supply extra context to an analytics event. + * + * @param key - the parameter key. Wherever possible use one of the standard `ParamKeys`, + * however, if no suitable key is available you can define your own as long as it is configured + * in your backend analytics system (for example, by creating a Firebase Analytics custom + * parameter). + * + * @param value - the parameter value. + */ +data class Param(val key: ParamKeys, val value: String) diff --git a/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/AnalyticsHelper.kt b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/AnalyticsHelper.kt new file mode 100644 index 00000000..203ac11b --- /dev/null +++ b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/AnalyticsHelper.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2023 teogor (Teodor Grigor) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.teogor.ceres.core.analytics + +import androidx.compose.runtime.compositionLocalOf + +@OptIn(ExperimentalAnalyticsApi::class) +val analyticsProvider = AnalyticsProvider() + +interface AnalyticsHelper { + fun logEvent(analyticsEvent: AnalyticsEvent) +} + +val LocalAnalyticsHelper = compositionLocalOf { + DefaultAnalyticsHelper() +} diff --git a/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/AnalyticsProvider.kt b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/AnalyticsProvider.kt new file mode 100644 index 00000000..165a827d --- /dev/null +++ b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/AnalyticsProvider.kt @@ -0,0 +1,56 @@ +/* + * Copyright 2023 teogor (Teodor Grigor) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.teogor.ceres.core.analytics + +import androidx.annotation.RestrictTo +import kotlin.reflect.KClass + +@ExperimentalAnalyticsApi +open class AnalyticsProvider { + private val _analyticsHelpers: MutableList = mutableListOf() + + @get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) + val analyticsHelpers: List + get() = _analyticsHelpers.toList() + + fun getAnalyticsHelper(helperClass: Class): T { + return _analyticsHelpers + .filterIsInstance(helperClass) + .firstOrNull() + ?: throw RuntimeException("AnalyticsHelper of type $helperClass not found.") + } + + fun addAnalyticsHelper(helper: AnalyticsHelper): AnalyticsHelper { + val existingHelper = _analyticsHelpers.filterIsInstance(helper::class.java).firstOrNull() + if (existingHelper == null) { + _analyticsHelpers.add(helper) + } + return existingHelper ?: helper + } +} + +@ExperimentalAnalyticsApi +@Suppress("NOTHING_TO_INLINE") +inline operator fun AnalyticsProvider.get( + clazz: KClass, +): T = getAnalyticsHelper(clazz.java) + +@ExperimentalAnalyticsApi +@Suppress("NOTHING_TO_INLINE") +inline operator fun AnalyticsProvider.plusAssign(helper: AnalyticsHelper) { + addAnalyticsHelper(helper) +} diff --git a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsHelper.kt b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/DefaultAnalyticsHelper.kt similarity index 68% rename from firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsHelper.kt rename to core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/DefaultAnalyticsHelper.kt index 0528465f..1a351848 100644 --- a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsHelper.kt +++ b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/DefaultAnalyticsHelper.kt @@ -14,12 +14,16 @@ * limitations under the License. */ -package dev.teogor.ceres.firebase.analytics +package dev.teogor.ceres.core.analytics -/** - * Interface for logging analytics events. See `FirebaseAnalyticsHelper` and - * `StubAnalyticsHelper` for implementations. - */ -interface AnalyticsHelper { - fun logEvent(event: AnalyticsEvent) +class DefaultAnalyticsHelper : AnalyticsHelper { + + @ExperimentalAnalyticsApi + override fun logEvent( + analyticsEvent: AnalyticsEvent, + ) { + analyticsProvider.analyticsHelpers.forEach { + it.logEvent(analyticsEvent) + } + } } diff --git a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/NoOpAnalyticsHelper.kt b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/ExperimentalAnalyticsApi.kt similarity index 71% rename from firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/NoOpAnalyticsHelper.kt rename to core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/ExperimentalAnalyticsApi.kt index 9cb3a69f..ee76ea6b 100644 --- a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/NoOpAnalyticsHelper.kt +++ b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/ExperimentalAnalyticsApi.kt @@ -14,11 +14,8 @@ * limitations under the License. */ -package dev.teogor.ceres.firebase.analytics +package dev.teogor.ceres.core.analytics -/** - * Implementation of AnalyticsHelper which does nothing. Useful for tests and previews. - */ -class NoOpAnalyticsHelper : AnalyticsHelper { - override fun logEvent(event: AnalyticsEvent) = Unit -} +@RequiresOptIn(message = "Analytics is experimental. The API may be changed in the future.") +@Retention(AnnotationRetention.BINARY) +annotation class ExperimentalAnalyticsApi diff --git a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/StubAnalyticsHelper.kt b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/StubAnalyticsHelper.kt similarity index 67% rename from firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/StubAnalyticsHelper.kt rename to core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/StubAnalyticsHelper.kt index 33ae8141..c129bbc4 100644 --- a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/StubAnalyticsHelper.kt +++ b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/StubAnalyticsHelper.kt @@ -14,21 +14,18 @@ * limitations under the License. */ -package dev.teogor.ceres.firebase.analytics +package dev.teogor.ceres.core.analytics import android.util.Log -import javax.inject.Inject -import javax.inject.Singleton private const val TAG = "StubAnalyticsHelper" /** - * An implementation of AnalyticsHelper just writes the events to logcat. Used in builds where no - * analytics events should be sent to a backend. + * An implementation of AnalyticsHelper just writes the events to logcat. + * Used in builds where no analytics events should be sent to a backend. */ -@Singleton -class StubAnalyticsHelper @Inject constructor() : AnalyticsHelper { - override fun logEvent(event: AnalyticsEvent) { - Log.d(TAG, "Received analytics event: $event") +class StubAnalyticsHelper : AnalyticsHelper { + override fun logEvent(analyticsEvent: AnalyticsEvent) { + Log.d(TAG, "Received analytics event: $analyticsEvent") } } diff --git a/navigation/events/src/main/kotlin/dev/teogor/ceres/navigation/events/AnalyticsExtensions.kt b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/composables/UiEvents.kt similarity index 53% rename from navigation/events/src/main/kotlin/dev/teogor/ceres/navigation/events/AnalyticsExtensions.kt rename to core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/composables/UiEvents.kt index 71ce7157..adc0b368 100644 --- a/navigation/events/src/main/kotlin/dev/teogor/ceres/navigation/events/AnalyticsExtensions.kt +++ b/core/analytics/src/main/kotlin/dev/teogor/ceres/core/analytics/composables/UiEvents.kt @@ -14,32 +14,13 @@ * limitations under the License. */ -package dev.teogor.ceres.navigation.events +package dev.teogor.ceres.core.analytics.composables import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect -import dev.teogor.ceres.firebase.analytics.AnalyticsEvent -import dev.teogor.ceres.firebase.analytics.AnalyticsEvent.Param -import dev.teogor.ceres.firebase.analytics.AnalyticsEvent.ParamKeys -import dev.teogor.ceres.firebase.analytics.AnalyticsEvent.Types -import dev.teogor.ceres.firebase.analytics.AnalyticsHelper -import dev.teogor.ceres.firebase.analytics.LocalAnalyticsHelper - -// todo moved to ui named analytics extensions - -/** - * Classes and functions associated with analytics events for the UI. - */ -fun AnalyticsHelper.logScreenView(screenName: String) { - logEvent( - AnalyticsEvent( - type = Types.SCREEN_VIEW, - extras = listOf( - Param(ParamKeys.SCREEN_NAME, screenName), - ), - ), - ) -} +import dev.teogor.ceres.core.analytics.AnalyticsEvent +import dev.teogor.ceres.core.analytics.AnalyticsHelper +import dev.teogor.ceres.core.analytics.LocalAnalyticsHelper /** * A side-effect which records a screen view event. @@ -47,8 +28,9 @@ fun AnalyticsHelper.logScreenView(screenName: String) { @Composable fun TrackScreenViewEvent( screenName: String, + screenClass: String = "", analyticsHelper: AnalyticsHelper = LocalAnalyticsHelper.current, ) = DisposableEffect(Unit) { - analyticsHelper.logScreenView(screenName) + analyticsHelper.logEvent(AnalyticsEvent.ScreenView(screenName, screenClass)) onDispose {} } diff --git a/core/network/build.gradle.kts b/core/network/build.gradle.kts index 63b19cde..b16ac9cd 100644 --- a/core/network/build.gradle.kts +++ b/core/network/build.gradle.kts @@ -33,4 +33,5 @@ dependencies { ceresLibrary { name = "Ceres Core Network" + deprecated = true } diff --git a/firebase/analytics/api/analytics.api b/firebase/analytics/api/analytics.api index 46c9632a..9e6b7d79 100644 --- a/firebase/analytics/api/analytics.api +++ b/firebase/analytics/api/analytics.api @@ -1,56 +1,3 @@ -public final class dev/teogor/ceres/firebase/analytics/AnalyticsEvent { - public static final field $stable I - public fun (Ljava/lang/String;Ljava/util/List;)V - public synthetic fun (Ljava/lang/String;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()Ljava/util/List; - public final fun copy (Ljava/lang/String;Ljava/util/List;)Ldev/teogor/ceres/firebase/analytics/AnalyticsEvent; - public static synthetic fun copy$default (Ldev/teogor/ceres/firebase/analytics/AnalyticsEvent;Ljava/lang/String;Ljava/util/List;ILjava/lang/Object;)Ldev/teogor/ceres/firebase/analytics/AnalyticsEvent; - public fun equals (Ljava/lang/Object;)Z - public final fun getExtras ()Ljava/util/List; - public final fun getType ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class dev/teogor/ceres/firebase/analytics/AnalyticsEvent$Param { - public static final field $stable I - public fun (Ljava/lang/String;Ljava/lang/String;)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;Ljava/lang/String;)Ldev/teogor/ceres/firebase/analytics/AnalyticsEvent$Param; - public static synthetic fun copy$default (Ldev/teogor/ceres/firebase/analytics/AnalyticsEvent$Param;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ldev/teogor/ceres/firebase/analytics/AnalyticsEvent$Param; - public fun equals (Ljava/lang/Object;)Z - public final fun getKey ()Ljava/lang/String; - public final fun getValue ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class dev/teogor/ceres/firebase/analytics/AnalyticsEvent$ParamKeys { - public static final field $stable I - public static final field Companion Ldev/teogor/ceres/firebase/analytics/AnalyticsEvent$ParamKeys$Companion; - public static final field SCREEN_NAME Ljava/lang/String; - public fun ()V -} - -public final class dev/teogor/ceres/firebase/analytics/AnalyticsEvent$ParamKeys$Companion { -} - -public final class dev/teogor/ceres/firebase/analytics/AnalyticsEvent$Types { - public static final field $stable I - public static final field Companion Ldev/teogor/ceres/firebase/analytics/AnalyticsEvent$Types$Companion; - public static final field SCREEN_VIEW Ljava/lang/String; - public fun ()V -} - -public final class dev/teogor/ceres/firebase/analytics/AnalyticsEvent$Types$Companion { -} - -public abstract interface class dev/teogor/ceres/firebase/analytics/AnalyticsHelper { - public abstract fun logEvent (Ldev/teogor/ceres/firebase/analytics/AnalyticsEvent;)V -} - public final class dev/teogor/ceres/firebase/analytics/AnalyticsManagerInitializer : androidx/startup/Initializer { public static final field $stable I public fun ()V @@ -59,11 +6,14 @@ public final class dev/teogor/ceres/firebase/analytics/AnalyticsManagerInitializ public fun dependencies ()Ljava/util/List; } +public final class dev/teogor/ceres/firebase/analytics/AnalyticsManagerInitializerKt { + public static final fun text ()V +} + public abstract class dev/teogor/ceres/firebase/analytics/AnalyticsModule { public static final field $stable I public static final field Companion Ldev/teogor/ceres/firebase/analytics/AnalyticsModule$Companion; public fun ()V - public abstract fun bindsAnalyticsHelper (Ldev/teogor/ceres/firebase/analytics/FirebaseAnalyticsHelper;)Ldev/teogor/ceres/firebase/analytics/AnalyticsHelper; } public final class dev/teogor/ceres/firebase/analytics/AnalyticsModule$Companion { @@ -78,42 +28,25 @@ public final class dev/teogor/ceres/firebase/analytics/AnalyticsModule_Companion public static fun provideFirebaseAnalytics ()Lcom/google/firebase/analytics/FirebaseAnalytics; } -public final class dev/teogor/ceres/firebase/analytics/FirebaseAnalyticsHelper : dev/teogor/ceres/firebase/analytics/AnalyticsHelper { +public final class dev/teogor/ceres/firebase/analytics/FirebaseAnalyticsHelper : dev/teogor/ceres/core/analytics/AnalyticsHelper { public static final field $stable I public fun (Lcom/google/firebase/analytics/FirebaseAnalytics;)V - public fun logEvent (Ldev/teogor/ceres/firebase/analytics/AnalyticsEvent;)V -} - -public final class dev/teogor/ceres/firebase/analytics/FirebaseAnalyticsHelper_Factory : dagger/internal/Factory { - public fun (Ljavax/inject/Provider;)V - public static fun create (Ljavax/inject/Provider;)Ldev/teogor/ceres/firebase/analytics/FirebaseAnalyticsHelper_Factory; - public fun get ()Ldev/teogor/ceres/firebase/analytics/FirebaseAnalyticsHelper; - public synthetic fun get ()Ljava/lang/Object; - public static fun newInstance (Lcom/google/firebase/analytics/FirebaseAnalytics;)Ldev/teogor/ceres/firebase/analytics/FirebaseAnalyticsHelper; + public fun logEvent (Ldev/teogor/ceres/core/analytics/AnalyticsEvent;)V } -public final class dev/teogor/ceres/firebase/analytics/NoOpAnalyticsHelper : dev/teogor/ceres/firebase/analytics/AnalyticsHelper { - public static final field $stable I - public fun ()V - public fun logEvent (Ldev/teogor/ceres/firebase/analytics/AnalyticsEvent;)V +public final class dev/teogor/ceres/firebase/analytics/FirebaseAnalyticsHelperKt { + public static final fun logEvent (Lcom/google/firebase/analytics/FirebaseAnalytics;Ldev/teogor/ceres/core/analytics/Types;Lkotlin/jvm/functions/Function1;)V } -public final class dev/teogor/ceres/firebase/analytics/StubAnalyticsHelper : dev/teogor/ceres/firebase/analytics/AnalyticsHelper { +public final class dev/teogor/ceres/firebase/analytics/ParametersBuilder { public static final field $stable I public fun ()V - public fun logEvent (Ldev/teogor/ceres/firebase/analytics/AnalyticsEvent;)V -} - -public final class dev/teogor/ceres/firebase/analytics/StubAnalyticsHelper_Factory : dagger/internal/Factory { - public fun ()V - public static fun create ()Ldev/teogor/ceres/firebase/analytics/StubAnalyticsHelper_Factory; - public fun get ()Ldev/teogor/ceres/firebase/analytics/StubAnalyticsHelper; - public synthetic fun get ()Ljava/lang/Object; - public static fun newInstance ()Ldev/teogor/ceres/firebase/analytics/StubAnalyticsHelper; -} - -public final class dev/teogor/ceres/firebase/analytics/UiHelpersKt { - public static final fun getLocalAnalyticsHelper ()Landroidx/compose/runtime/ProvidableCompositionLocal; + public final fun build ()Landroid/os/Bundle; + public final fun param (Ljava/lang/String;D)V + public final fun param (Ljava/lang/String;J)V + public final fun param (Ljava/lang/String;Landroid/os/Bundle;)V + public final fun param (Ljava/lang/String;Ljava/lang/String;)V + public final fun param (Ljava/lang/String;[Landroid/os/Bundle;)V } public class hilt_aggregated_deps/_dev_teogor_ceres_firebase_analytics_AnalyticsModule { diff --git a/firebase/analytics/build.gradle.kts b/firebase/analytics/build.gradle.kts index 4b6f7e55..62d00a32 100644 --- a/firebase/analytics/build.gradle.kts +++ b/firebase/analytics/build.gradle.kts @@ -28,6 +28,9 @@ android { } dependencies { + api(project(mapOf("path" to ":core:analytics"))) + api(project(mapOf("path" to ":data:datastore"))) + implementation(platform(libs.firebase.bom)) implementation(libs.firebase.analytics) diff --git a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsEvent.kt b/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsEvent.kt deleted file mode 100644 index 7ac982d5..00000000 --- a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsEvent.kt +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2023 teogor (Teodor Grigor) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dev.teogor.ceres.firebase.analytics - -/** - * Represents an analytics event. - * - * @param type - the event type. Wherever possible use one of the standard - * event `Types`, however, if there is no suitable event type already defined, a custom event can be - * defined as long as it is configured in your backend analytics system (for example, by creating a - * Firebase Analytics custom event). - * - * @param extras - list of parameters which supply additional context to the event. See `Param`. - */ -data class AnalyticsEvent( - val type: String, - val extras: List = emptyList(), -) { - // Standard analytics types. - class Types { - companion object { - const val SCREEN_VIEW = "screen_view" // (extras: SCREEN_NAME) - } - } - - /** - * A key-value pair used to supply extra context to an analytics event. - * - * @param key - the parameter key. Wherever possible use one of the standard `ParamKeys`, - * however, if no suitable key is available you can define your own as long as it is configured - * in your backend analytics system (for example, by creating a Firebase Analytics custom - * parameter). - * - * @param value - the parameter value. - */ - data class Param(val key: String, val value: String) - - // Standard parameter keys. - class ParamKeys { - companion object { - const val SCREEN_NAME = "screen_name" - } - } -} diff --git a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsManagerInitializer.kt b/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsManagerInitializer.kt index a82b6a8e..957d5d47 100644 --- a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsManagerInitializer.kt +++ b/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsManagerInitializer.kt @@ -19,23 +19,35 @@ package dev.teogor.ceres.firebase.analytics import android.content.Context import androidx.startup.Initializer import com.google.firebase.analytics.FirebaseAnalytics +import dev.teogor.ceres.core.analytics.ExperimentalAnalyticsApi +import dev.teogor.ceres.core.analytics.analyticsProvider +import dev.teogor.ceres.core.analytics.plusAssign +import dev.teogor.ceres.data.datastore.common.launch +import dev.teogor.ceres.data.datastore.defaults.ceresPreferences /** * Initializes [FirebaseAnalytics] using `androidx.startup`. */ class AnalyticsManagerInitializer : Initializer { + @OptIn(ExperimentalAnalyticsApi::class) override fun create(context: Context) { val firebaseAnalytics = FirebaseAnalytics.getInstance(context) - // todo handle this into base activity - // val ceresPreferences = ceresPreferences(context) - // // Get the user ID value - // ceresPreferences.launch { - // val userId = ceresPreferences.userId - // firebaseAnalytics.setUserId(userId.value) - // } + analyticsProvider += FirebaseAnalyticsHelper(firebaseAnalytics) + // todo handle this into base activity or via a provider + // because this way we can not provide a custom userId + val ceresPreferences = ceresPreferences(context) + // Get the user ID value + ceresPreferences.launch { + val userId = ceresPreferences.userId + firebaseAnalytics.setUserId(userId.value) + } } override fun dependencies(): List?>> { return emptyList() } } + +fun text() { + FirebaseAnalytics.Param.SCREEN_CLASS +} diff --git a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsModule.kt b/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsModule.kt index 94dc17c2..c7855732 100644 --- a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsModule.kt +++ b/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/AnalyticsModule.kt @@ -19,7 +19,6 @@ package dev.teogor.ceres.firebase.analytics import com.google.firebase.analytics.FirebaseAnalytics import com.google.firebase.analytics.ktx.analytics import com.google.firebase.ktx.Firebase -import dagger.Binds import dagger.Module import dagger.Provides import dagger.hilt.InstallIn @@ -29,9 +28,6 @@ import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) abstract class AnalyticsModule { - @Binds - abstract fun bindsAnalyticsHelper(analyticsHelperImpl: FirebaseAnalyticsHelper): AnalyticsHelper - companion object { @Provides @Singleton diff --git a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/FirebaseAnalyticsHelper.kt b/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/FirebaseAnalyticsHelper.kt index 06031070..031e1c30 100644 --- a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/FirebaseAnalyticsHelper.kt +++ b/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/FirebaseAnalyticsHelper.kt @@ -16,26 +16,68 @@ package dev.teogor.ceres.firebase.analytics +import android.os.Bundle import com.google.firebase.analytics.FirebaseAnalytics -import com.google.firebase.analytics.ktx.logEvent -import javax.inject.Inject +import dev.teogor.ceres.core.analytics.AnalyticsEvent +import dev.teogor.ceres.core.analytics.AnalyticsHelper +import dev.teogor.ceres.core.analytics.ExperimentalAnalyticsApi +import dev.teogor.ceres.core.analytics.Types +import dev.teogor.ceres.core.analytics.toLowercaseString -/** - * Implementation of `AnalyticsHelper` which logs events to a Firebase backend. - */ -class FirebaseAnalyticsHelper @Inject constructor( +@ExperimentalAnalyticsApi +class FirebaseAnalyticsHelper( private val firebaseAnalytics: FirebaseAnalytics, ) : AnalyticsHelper { - override fun logEvent(event: AnalyticsEvent) { - firebaseAnalytics.logEvent(event.type) { - for (extra in event.extras) { - // Truncate parameter keys and values according to firebase maximum length values. + @ExperimentalAnalyticsApi + override fun logEvent(analyticsEvent: AnalyticsEvent) { + firebaseAnalytics.logEvent( + analyticsEvent.type, + ) { + analyticsEvent.params.forEach { extra -> param( - key = extra.key.take(40), + key = extra.key.toLowercaseString().take(40), value = extra.value.take(100), ) } } } } + +inline fun FirebaseAnalytics.logEvent( + type: Types, + crossinline block: ParametersBuilder.() -> Unit, +) { + logEvent( + type.toLowercaseString(), + ParametersBuilder().apply(block).build(), + ) +} + +class ParametersBuilder { + private val bundle = Bundle() + + fun param(key: String, value: String) { + bundle.putString(key, value) + } + + fun param(key: String, value: Double) { + bundle.putDouble(key, value) + } + + fun param(key: String, value: Long) { + bundle.putLong(key, value) + } + + fun param(key: String, value: Bundle) { + bundle.putBundle(key, value) + } + + fun param(key: String, value: Array) { + bundle.putParcelableArray(key, value) + } + + fun build(): Bundle { + return bundle + } +} diff --git a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/UiHelpers.kt b/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/UiHelpers.kt deleted file mode 100644 index a2872be6..00000000 --- a/firebase/analytics/src/main/kotlin/dev/teogor/ceres/firebase/analytics/UiHelpers.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2023 teogor (Teodor Grigor) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dev.teogor.ceres.firebase.analytics - -import androidx.compose.runtime.staticCompositionLocalOf - -// todo move this somewhere in base -// like module firebase-base-helpers -// ... ceres modules include that -// analytics/crashlytics depends on that -/** - * Global key used to obtain access to the AnalyticsHelper through a CompositionLocal. - */ -val LocalAnalyticsHelper = staticCompositionLocalOf { - // Provide a default AnalyticsHelper which does nothing. This is so that tests and previews - // do not have to provide one. For real app builds provide a different implementation. - NoOpAnalyticsHelper() -} diff --git a/framework/core/api/core.api b/framework/core/api/core.api index 789f2e63..1a20c4d1 100644 --- a/framework/core/api/core.api +++ b/framework/core/api/core.api @@ -1,6 +1,5 @@ public class dev/teogor/ceres/framework/core/Activity : androidx/activity/ComponentActivity { public static final field $stable I - public field analyticsHelper Ldev/teogor/ceres/firebase/analytics/AnalyticsHelper; public field crashlyticsHelper Ldev/teogor/ceres/firebase/crashlytics/CrashlyticsHelper; public field lazyStats Ldagger/Lazy; public field networkMonitor Ldev/teogor/ceres/core/foundation/NetworkMonitorUtility; @@ -8,7 +7,6 @@ public class dev/teogor/ceres/framework/core/Activity : androidx/activity/Compon public fun BuildNavGraph (Ldev/teogor/ceres/framework/core/model/NavGraphOptions;Landroidx/compose/runtime/Composer;I)V public fun buildMenu (Ldev/teogor/ceres/framework/core/model/MenuConfig;Landroidx/compose/runtime/Composer;I)Ldev/teogor/ceres/framework/core/model/MenuConfig; public fun compositionProviders (Landroidx/compose/runtime/Composer;I)Ljava/util/List; - public final fun getAnalyticsHelper ()Ldev/teogor/ceres/firebase/analytics/AnalyticsHelper; public final fun getCrashlyticsHelper ()Ldev/teogor/ceres/firebase/crashlytics/CrashlyticsHelper; public final fun getLazyStats ()Ldagger/Lazy; public fun getNavigationItems ()Ljava/util/List; @@ -19,7 +17,6 @@ public class dev/teogor/ceres/framework/core/Activity : androidx/activity/Compon protected fun onNewIntent (Landroid/content/Intent;)V protected fun onPause ()V protected fun onResume ()V - public final fun setAnalyticsHelper (Ldev/teogor/ceres/firebase/analytics/AnalyticsHelper;)V public final fun setCrashlyticsHelper (Ldev/teogor/ceres/firebase/crashlytics/CrashlyticsHelper;)V public fun setKeepOnScreenCondition ()Z public final fun setLazyStats (Ldagger/Lazy;)V @@ -28,9 +25,8 @@ public class dev/teogor/ceres/framework/core/Activity : androidx/activity/Compon } public final class dev/teogor/ceres/framework/core/Activity_MembersInjector : dagger/MembersInjector { - public fun (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)V - public static fun create (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)Ldagger/MembersInjector; - public static fun injectAnalyticsHelper (Ldev/teogor/ceres/framework/core/Activity;Ldev/teogor/ceres/firebase/analytics/AnalyticsHelper;)V + public fun (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)V + public static fun create (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)Ldagger/MembersInjector; public static fun injectCrashlyticsHelper (Ldev/teogor/ceres/framework/core/Activity;Ldev/teogor/ceres/firebase/crashlytics/CrashlyticsHelper;)V public static fun injectLazyStats (Ldev/teogor/ceres/framework/core/Activity;Ldagger/Lazy;)V public fun injectMembers (Ldev/teogor/ceres/framework/core/Activity;)V diff --git a/framework/core/src/main/kotlin/dev/teogor/ceres/framework/core/Activity.kt b/framework/core/src/main/kotlin/dev/teogor/ceres/framework/core/Activity.kt index 25be98e6..3980d3cb 100644 --- a/framework/core/src/main/kotlin/dev/teogor/ceres/framework/core/Activity.kt +++ b/framework/core/src/main/kotlin/dev/teogor/ceres/framework/core/Activity.kt @@ -49,8 +49,6 @@ import dev.teogor.ceres.core.foundation.mediaPlayerUtils import dev.teogor.ceres.data.compose.rememberPreference import dev.teogor.ceres.data.datastore.defaults.AppTheme import dev.teogor.ceres.data.datastore.defaults.ceresPreferences -import dev.teogor.ceres.firebase.analytics.AnalyticsHelper -import dev.teogor.ceres.firebase.analytics.LocalAnalyticsHelper import dev.teogor.ceres.firebase.crashlytics.CrashlyticsHelper import dev.teogor.ceres.firebase.crashlytics.LocalCrashlyticsHelper import dev.teogor.ceres.framework.core.app.CeresApp @@ -83,9 +81,6 @@ open class Activity : ComponentActivity() { @Inject lateinit var lazyStats: dagger.Lazy - @Inject - lateinit var analyticsHelper: AnalyticsHelper - @Inject lateinit var crashlyticsHelper: CrashlyticsHelper @@ -210,7 +205,7 @@ open class Activity : ComponentActivity() { ) { CompositionLocalProvider( LocalNavigationParameters provides navigationParameters, - LocalAnalyticsHelper provides analyticsHelper, + // LocalAnalyticsHelper provides analyticsHelper, LocalCrashlyticsHelper provides crashlyticsHelper, // Ceres Core Foundation - Composition Provider @@ -218,7 +213,7 @@ open class Activity : ComponentActivity() { LocalMediaPlayer provides mediaPlayerUtils, LocalResources provides resources, - // Ceres Monetisation + // Ceres Monetization LocalAdsControl provides adsControl, *compositionProviders().toTypedArray(), diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ea2fffbf..60281353 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -129,13 +129,13 @@ coil-kt = { group = "io.coil-kt", name = "coil", version.ref = "coil" } compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" } core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } -firebase-analytics = { group = "com.google.firebase", name = "firebase-analytics-ktx" } +firebase-analytics = { group = "com.google.firebase", name = "firebase-analytics" } firebase-bom = { group = "com.google.firebase", name = "firebase-bom", version.ref = "firebaseBom" } -firebase-cloud-messaging = { group = "com.google.firebase", name = "firebase-messaging-ktx" } +firebase-cloud-messaging = { group = "com.google.firebase", name = "firebase-messaging" } firebase-crashlytics-gradle = { group = "com.google.firebase", name = "firebase-crashlytics-gradle", version.ref = "firebaseCrashlyticsPlugin" } -firebase-crashlytics = { group = "com.google.firebase", name = "firebase-crashlytics-ktx" } +firebase-crashlytics = { group = "com.google.firebase", name = "firebase-crashlytics" } firebase-performance-gradle = { group = "com.google.firebase", name = "perf-plugin", version.ref = "firebasePerfPlugin" } -firebase-performance = { group = "com.google.firebase", name = "firebase-perf-ktx" } +firebase-performance = { group = "com.google.firebase", name = "firebase-perf" } google-material = { group = "com.google.android.material", name = "material", version.ref = "googleMaterial" } gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } hilt-android-testing = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" } diff --git a/navigation/events/api/events.api b/navigation/events/api/events.api index 4024b495..e69de29b 100644 --- a/navigation/events/api/events.api +++ b/navigation/events/api/events.api @@ -1,5 +0,0 @@ -public final class dev/teogor/ceres/navigation/events/AnalyticsExtensionsKt { - public static final fun TrackScreenViewEvent (Ljava/lang/String;Ldev/teogor/ceres/firebase/analytics/AnalyticsHelper;Landroidx/compose/runtime/Composer;II)V - public static final fun logScreenView (Ldev/teogor/ceres/firebase/analytics/AnalyticsHelper;Ljava/lang/String;)V -} - diff --git a/navigation/events/build.gradle.kts b/navigation/events/build.gradle.kts index c390c0cc..c0d9c6e6 100644 --- a/navigation/events/build.gradle.kts +++ b/navigation/events/build.gradle.kts @@ -28,10 +28,9 @@ android { } dependencies { - api(project(":navigation:core")) - api(project(":firebase:analytics")) } ceresLibrary { name = "Ceres Navigation Events" + deprecated = true } diff --git a/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/ColumnLayoutBase.kt b/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/ColumnLayoutBase.kt index e09022a1..45d70b5a 100644 --- a/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/ColumnLayoutBase.kt +++ b/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/ColumnLayoutBase.kt @@ -26,7 +26,7 @@ import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import dev.teogor.ceres.navigation.events.TrackScreenViewEvent +import dev.teogor.ceres.core.analytics.composables.TrackScreenViewEvent import dev.teogor.ceres.screen.core.attachScrollState import dev.teogor.ceres.screen.core.scope.ScreenColumnScope import dev.teogor.ceres.ui.designsystem.scrollbar.ColumnScrollbar diff --git a/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/FullScreenLayoutBase.kt b/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/FullScreenLayoutBase.kt index d9526f50..77f87686 100644 --- a/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/FullScreenLayoutBase.kt +++ b/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/FullScreenLayoutBase.kt @@ -24,7 +24,7 @@ import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import dev.teogor.ceres.navigation.events.TrackScreenViewEvent +import dev.teogor.ceres.core.analytics.composables.TrackScreenViewEvent import dev.teogor.ceres.ui.foundation.applyIf @Composable diff --git a/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/LayoutWithBottomHeader.kt b/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/LayoutWithBottomHeader.kt index e9e2634b..91a27c19 100644 --- a/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/LayoutWithBottomHeader.kt +++ b/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/LayoutWithBottomHeader.kt @@ -27,7 +27,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp -import dev.teogor.ceres.navigation.events.TrackScreenViewEvent +import dev.teogor.ceres.core.analytics.composables.TrackScreenViewEvent import dev.teogor.ceres.screen.core.attachScrollState import dev.teogor.ceres.screen.core.scope.ScreenListScope import dev.teogor.ceres.ui.designsystem.CeresBackground diff --git a/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/LazyColumnLayoutBase.kt b/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/LazyColumnLayoutBase.kt index 750dfda9..5614f056 100644 --- a/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/LazyColumnLayoutBase.kt +++ b/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/LazyColumnLayoutBase.kt @@ -26,7 +26,7 @@ import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import dev.teogor.ceres.navigation.events.TrackScreenViewEvent +import dev.teogor.ceres.core.analytics.composables.TrackScreenViewEvent import dev.teogor.ceres.screen.core.attachScrollState import dev.teogor.ceres.screen.core.scope.ScreenListScope import dev.teogor.ceres.ui.designsystem.scrollbar.LazyColumnScrollbar diff --git a/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/LazyGridLayoutBase.kt b/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/LazyGridLayoutBase.kt index 9cc4ad12..61980fb4 100644 --- a/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/LazyGridLayoutBase.kt +++ b/screen/core/src/main/kotlin/dev/teogor/ceres/screen/core/layout/LazyGridLayoutBase.kt @@ -23,7 +23,7 @@ import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.rememberLazyGridState import androidx.compose.runtime.Composable import androidx.compose.ui.unit.dp -import dev.teogor.ceres.navigation.events.TrackScreenViewEvent +import dev.teogor.ceres.core.analytics.composables.TrackScreenViewEvent import dev.teogor.ceres.screen.core.attachScrollState import dev.teogor.ceres.screen.core.scope.ScreenGridScope import dev.teogor.ceres.ui.designsystem.scrollbar.LazyGridScrollbar diff --git a/settings.gradle.kts b/settings.gradle.kts index b3a0f96a..6be38f4d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -28,6 +28,7 @@ include(":backup:core") include(":backup:ui") // Core +include(":core:analytics") include(":core:common") include(":core:foundation") include(":core:network")