-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] change_language 이벤트 설계 (앱 내 언어 설정이 바뀐 경우) #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ package com.eatssu.android.analytics | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.eatssu.common.analytics.AnalyticsIdentity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.eatssu.common.analytics.AppAnalyticsEvent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.eatssu.common.analytics.ChangeLanguageEvent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.eatssu.common.analytics.PopupEvent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.eatssu.common.analytics.WidgetAnalyticsEvent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.eatssu.common.enums.LaunchPath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -26,6 +27,23 @@ class PostHogAnalyticsTrackerTest { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fun `change language payload keeps previous and next locale codes`() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val payload = ChangeLanguageEvent( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| lang_from = "ko", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| lang_to = "en", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toPayload() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertEquals("change_language", payload.eventName) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertEquals( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mapOf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "lang_from" to "ko", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "lang_to" to "en", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| payload.properties, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+45
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updating the test case to reflect the suggested naming improvements in
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fun `popup event payload keeps popup name and action`() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val payload = PopupEvent( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -251,7 +251,16 @@ data class PopupEvent( | |||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| data class ChangeLanguageEvent( | ||||||||||||||||||||||||||||||||||||||||||
| val lang_from: String, | ||||||||||||||||||||||||||||||||||||||||||
| val lang_to: String, | ||||||||||||||||||||||||||||||||||||||||||
| ) : AppAnalyticsEvent { | ||||||||||||||||||||||||||||||||||||||||||
| override val eventName = "change_language" | ||||||||||||||||||||||||||||||||||||||||||
| override val properties = buildMap { | ||||||||||||||||||||||||||||||||||||||||||
| put("lang_from", lang_from) | ||||||||||||||||||||||||||||||||||||||||||
| put("lang_to", lang_to) | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+254
to
+263
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kotlin property names should follow the
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| private fun String.toWeekdayCode() = when (this) { | ||||||||||||||||||||||||||||||||||||||||||
| "SUNDAY" -> "sun" | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid redundant network calls and unnecessary Activity recreations (triggered by
AppCompatDelegate.setApplicationLocales), the call toviewModel.selectLanguage(language)should be moved inside theif (selectedLanguage != language)block. This ensures that processing only occurs when a different language is actually selected.