-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bugs related to invalid locale used for time formatting (#246)
- Loading branch information
Showing
5 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
common-testing/src/main/java/com/paulrybitskyi/gamedge/common/testing/FakeLocaleProvider.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,13 @@ | ||
package com.paulrybitskyi.gamedge.common.testing | ||
|
||
import com.paulrybitskyi.gamedge.core.providers.LocaleProvider | ||
import java.util.Locale | ||
|
||
class FakeLocaleProvider( | ||
private val locale: Locale = Locale.ENGLISH, | ||
) : LocaleProvider { | ||
|
||
override fun getLocale(): Locale { | ||
return locale | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
core/src/main/java/com/paulrybitskyi/gamedge/core/providers/LocaleProvider.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,18 @@ | ||
package com.paulrybitskyi.gamedge.core.providers | ||
|
||
import com.paulrybitskyi.hiltbinder.BindType | ||
import java.util.Locale | ||
import javax.inject.Inject | ||
|
||
interface LocaleProvider { | ||
fun getLocale(): Locale | ||
} | ||
|
||
@BindType | ||
internal class LocaleProviderImpl @Inject constructor() : LocaleProvider { | ||
|
||
override fun getLocale(): Locale { | ||
// App only supports the English language | ||
return Locale.ENGLISH | ||
} | ||
} |
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