-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/jaino/#160
- Loading branch information
Showing
54 changed files
with
495 additions
and
170 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
plugins { | ||
id("com.wap.wapp.library") | ||
id("com.wap.wapp.hilt") | ||
id("com.wap.wapp.compose") | ||
} | ||
|
||
android { | ||
namespace = "com.wap.wapp.core.analytics" | ||
|
||
defaultConfig { | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles("consumer-rules.pro") | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro", | ||
) | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(platform(libs.firebase.bom)) | ||
implementation(libs.firebase.analytics) | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
16 changes: 16 additions & 0 deletions
16
core/analytics/src/main/java/com/wap/wapp/core/analytics/AnalyticsEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.wap.wapp.core.analytics | ||
|
||
data class AnalyticsEvent( | ||
val type: String, | ||
val extras: List<Param> = emptyList(), | ||
) { | ||
data class Param( | ||
val key: String, | ||
val value: String, | ||
) | ||
|
||
companion object { | ||
const val SCREEN_VIEW = "screen_view" // TYPE | ||
const val SCREEN_NAME = "screen_name" // EXTRA_KEY | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
core/analytics/src/main/java/com/wap/wapp/core/analytics/AnalyticsHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.wap.wapp.core.analytics | ||
|
||
interface AnalyticsHelper { | ||
fun logEvent(event: AnalyticsEvent) | ||
} |
21 changes: 21 additions & 0 deletions
21
core/analytics/src/main/java/com/wap/wapp/core/analytics/AnalyticsHelperImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.wap.wapp.core.analytics | ||
|
||
import com.google.firebase.analytics.FirebaseAnalytics | ||
import com.google.firebase.analytics.ktx.logEvent | ||
import javax.inject.Inject | ||
|
||
class AnalyticsHelperImpl @Inject constructor( | ||
private val firebaseAnalytics: FirebaseAnalytics, | ||
) : AnalyticsHelper { | ||
override fun logEvent(event: AnalyticsEvent) { | ||
firebaseAnalytics.logEvent(event.type) { | ||
for (extra in event.extras) { | ||
// Key, Value Max Length에 따른 slicing | ||
param( | ||
key = extra.key.take(40), | ||
value = extra.value.take(100), | ||
) | ||
} | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
core/analytics/src/main/java/com/wap/wapp/core/analytics/LocalAnalyticsHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.wap.wapp.core.analytics | ||
|
||
import androidx.compose.runtime.staticCompositionLocalOf | ||
|
||
val LocalAnalyticsHelper = staticCompositionLocalOf<AnalyticsHelper> { | ||
error("Any AnalyticsHelper Did Not Provided") | ||
} |
29 changes: 29 additions & 0 deletions
29
core/analytics/src/main/java/com/wap/wapp/core/analytics/di/AnalyticsModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.wap.wapp.core.analytics.di | ||
|
||
import com.google.firebase.analytics.FirebaseAnalytics | ||
import com.google.firebase.analytics.ktx.analytics | ||
import com.google.firebase.ktx.Firebase | ||
import com.wap.wapp.core.analytics.AnalyticsHelper | ||
import com.wap.wapp.core.analytics.AnalyticsHelperImpl | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
abstract class AnalyticsModule { | ||
@Binds | ||
@Singleton | ||
abstract fun bindsAnalyticsHelper(analyticsHelperImpl: AnalyticsHelperImpl): AnalyticsHelper | ||
|
||
companion object { | ||
@Provides | ||
@Singleton | ||
fun provideFirebaseAnalytics(): FirebaseAnalytics { | ||
return Firebase.analytics | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
core/common/src/main/java/com/wap/wapp/core/commmon/extensions/AnalyticsExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.wap.wapp.core.commmon.extensions | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import com.wap.wapp.core.analytics.AnalyticsEvent | ||
import com.wap.wapp.core.analytics.AnalyticsEvent.Param | ||
import com.wap.wapp.core.analytics.AnalyticsHelper | ||
import com.wap.wapp.core.analytics.LocalAnalyticsHelper | ||
|
||
fun AnalyticsHelper.logScreenView(screenName: String) { | ||
logEvent( | ||
AnalyticsEvent( | ||
type = AnalyticsEvent.SCREEN_VIEW, | ||
extras = listOf( | ||
Param(AnalyticsEvent.SCREEN_NAME, screenName), | ||
), | ||
), | ||
) | ||
} | ||
|
||
fun AnalyticsHelper.logUserSignedIn(userId: String, userName: String) { | ||
logEvent( | ||
AnalyticsEvent( | ||
type = "signed_in", | ||
extras = listOf( | ||
Param("user_id", userId), | ||
Param("user_name", userName), | ||
), | ||
), | ||
) | ||
} | ||
|
||
@Composable | ||
fun TrackScreenViewEvent( | ||
screenName: String, | ||
analyticsHelper: AnalyticsHelper = LocalAnalyticsHelper.current, | ||
) = LaunchedEffect(Unit) { | ||
analyticsHelper.logScreenView(screenName) | ||
} |
12 changes: 0 additions & 12 deletions
12
core/common/src/main/java/com/wap/wapp/core/commmon/extensions/ContextExtensions.kt
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
core/common/src/main/java/com/wap/wapp/core/commmon/extensions/CoroutinesExtension.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.