-
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.
Merge pull request #335 from kosenda/refacotr/analytics-logging
Analyticsで何を送るかのログを出力する
- Loading branch information
Showing
14 changed files
with
142 additions
and
141 deletions.
There are no files selected for viewing
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
109 changes: 109 additions & 0 deletions
109
core/analytics/src/main/java/ksnd/hiraganaconverter/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,109 @@ | ||
package ksnd.hiraganaconverter.core.analytics | ||
|
||
|
||
sealed class AnalyticsEvent { | ||
abstract val event: Event | ||
open val params: List<AnalyticsParam> = emptyList() | ||
} | ||
|
||
data class AnalyticsParam( | ||
val param: Param, | ||
val value: String, | ||
) | ||
|
||
class Convert(hiraKanaType: String, inputTextLength: Int) : AnalyticsEvent() { | ||
override val event = Event.CONVERT | ||
override val params = listOf( | ||
AnalyticsParam(Param.CONVERT_TYPE, hiraKanaType), | ||
AnalyticsParam(Param.INPUT_TEXT_LENGTH, inputTextLength.toString()), | ||
) | ||
} | ||
|
||
class ConvertError(error: String) : AnalyticsEvent() { | ||
override val event = Event.CONVERT_ERROR | ||
override val params = listOf( | ||
AnalyticsParam(Param.CONVERT_ERROR, error), | ||
) | ||
} | ||
|
||
class ChangeHiraKanaType(hiraKanaType: String) : AnalyticsEvent() { | ||
override val event = Event.CHANGE_HIRA_KANA_TYPE | ||
override val params = listOf( | ||
AnalyticsParam(Param.CONVERT_TYPE, hiraKanaType), | ||
) | ||
} | ||
|
||
class ClearAllText : AnalyticsEvent() { | ||
override val event = Event.CLEAR_ALL_TEXT | ||
} | ||
|
||
class UpdateTheme(theme: String) : AnalyticsEvent() { | ||
override val event = Event.UPDATE_THEME | ||
override val params = listOf( | ||
AnalyticsParam(Param.THEME, theme), | ||
) | ||
} | ||
|
||
class UpdateLanguage(language: String) : AnalyticsEvent() { | ||
override val event = Event.UPDATE_LANGUAGE | ||
override val params = listOf( | ||
AnalyticsParam(Param.LANGUAGE, language), | ||
) | ||
} | ||
|
||
class UpdateFont(font: String) : AnalyticsEvent() { | ||
override val event = Event.UPDATE_FONT | ||
override val params = listOf( | ||
AnalyticsParam(Param.FONT, font), | ||
) | ||
} | ||
|
||
class SwitchEnableInAppUpdate(isEnable: Boolean) : AnalyticsEvent() { | ||
override val event = Event.SWITCH_ENABLE_IN_APP_UPDATE | ||
override val params = listOf( | ||
AnalyticsParam(Param.IS_ENABLE_IN_APP_UPDATE, isEnable.toString()), | ||
) | ||
} | ||
|
||
class TotalConvertCount(count: Int) : AnalyticsEvent() { | ||
override val event = Event.COUNT_UP_TOTAL_CONVERT_COUNT | ||
override val params = listOf( | ||
AnalyticsParam(Param.COUNT, count.toString()), | ||
) | ||
} | ||
|
||
class RequestReview() : AnalyticsEvent() { | ||
override val event = Event.REQUEST_REVIEW | ||
} | ||
|
||
enum class Screen { | ||
CONVERTER, | ||
HISTORY, | ||
SETTING, | ||
INFO, | ||
PRIVACY_POLICY, | ||
} | ||
|
||
enum class Event { | ||
CONVERT, | ||
CONVERT_ERROR, | ||
CHANGE_HIRA_KANA_TYPE, | ||
CLEAR_ALL_TEXT, | ||
UPDATE_THEME, | ||
UPDATE_LANGUAGE, | ||
UPDATE_FONT, | ||
SWITCH_ENABLE_IN_APP_UPDATE, | ||
COUNT_UP_TOTAL_CONVERT_COUNT, | ||
REQUEST_REVIEW, | ||
} | ||
|
||
enum class Param { | ||
CONVERT_TYPE, | ||
CONVERT_ERROR, | ||
INPUT_TEXT_LENGTH, | ||
THEME, | ||
LANGUAGE, | ||
FONT, | ||
IS_ENABLE_IN_APP_UPDATE, | ||
COUNT, | ||
} |
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
33 changes: 0 additions & 33 deletions
33
core/analytics/src/main/java/ksnd/hiraganaconverter/core/analytics/Params.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.