Skip to content

Commit

Permalink
[#1009] LocalTracker 관련 코드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
l2hyunwoo committed Dec 31, 2024
1 parent 48a9d83 commit 5639544
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/analytics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

plugins {
sopt("feature")
sopt("compose")
}

android {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.sopt.official.analytics.compose

import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import org.sopt.official.analytics.Tracker

@Composable
fun ProvideTracker(
tracker: Tracker,
content: @Composable () -> Unit
) {
CompositionLocalProvider(
LocalTracker provides tracker
) {
content()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.sopt.official.analytics.compose

import androidx.compose.runtime.staticCompositionLocalOf
import org.sopt.official.analytics.Tracker

val LocalTracker = staticCompositionLocalOf<Tracker> {
error("No Tracker provided")
}

0 comments on commit 5639544

Please sign in to comment.