You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have integrated this library in the Application class as mentioned in the docs but I am facing an issue that always I am getting language as English inside getPhilologyRepository function.
In my app, we set the language based on the user profile after login. For Arabic users, it changes to LTR, and for English users, it changes to RTL layout with respective languages. So user can change language in respective settings and I am setting the default language as per the user. As long as the user is logged in the default language will be the one he has set. Once he logs out it will be English.
I am not sure if this causes since I am setting up the logic in the application class and need your advice.
class SampleApp : Application(), HasAndroidInjector {
@Inject
lateinit var androidInjector: DispatchingAndroidInjector<Any>
override fun onCreate() {
super.onCreate()
Cyanea.init(this, resources)
val calligraphyConfig = CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/poppins_regular.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
Philology.init(MyPhilologyRepositoryFactory)
ViewPump.init(
ViewPump.builder()
.addInterceptor(CalligraphyInterceptor(calligraphyConfig))
.addInterceptor(PhilologyInterceptor)
.build()
)
if (BuildConfig.DEBUG) {
Timber.plant(DebugTree())
}
`}`
override fun attachBaseContext(base: Context) {
super.attachBaseContext(base)
if (null == appComponent) {
appComponent = DaggerAppComponent.builder()
.appModule(AppModule(this))
.build()
appComponent?.inject(this)
}
}
companion object {
var appComponent: AppComponent? = null
private set
}
override fun androidInjector(): AndroidInjector<Any> {
return androidInjector
}
}
object MyPhilologyRepositoryFactory : PhilologyRepositoryFactory {
override fun getPhilologyRepository(locale: Locale): PhilologyRepository {
Timber.tag("Philology").d("getPhilologyRepository -> locale - %s", locale.language)
return when (locale.language) {
ENGLISH -> EnglishPhilologyRepository
ARABIC -> ArabicPhilologyRepository
else -> EnglishPhilologyRepository
}
}
}
The text was updated successfully, but these errors were encountered:
Describe the bug
I have integrated this library in the Application class as mentioned in the docs but I am facing an issue that always I am getting language as English inside getPhilologyRepository function.
In my app, we set the language based on the user profile after login. For Arabic users, it changes to LTR, and for English users, it changes to RTL layout with respective languages. So user can change language in respective settings and I am setting the default language as per the user. As long as the user is logged in the default language will be the one he has set. Once he logs out it will be English.
I am not sure if this causes since I am setting up the logic in the application class and need your advice.
The text was updated successfully, but these errors were encountered: