This commit is contained in:
Lucas Lima 2020-09-16 08:43:43 -03:00
parent 874c9a7d47
commit 3f2844d730
No known key found for this signature in database
GPG key ID: 049CCC5A365B00D2
3 changed files with 7 additions and 11 deletions

View file

@ -104,7 +104,7 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
findViewById<FrameLayout>(R.id.levelContainer).doOnLayout {
if (!isFinishing) {
if (!preferencesRepository.isTutorialCompleted() && hasTranslatedTutorial()) {
if (!preferencesRepository.isTutorialCompleted()) {
loadGameTutorial()
} else {
loadGameFragment()
@ -338,7 +338,7 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
)
if (preferencesRepository.isFirstUse() &&
(preferencesRepository.isTutorialCompleted() || !hasTranslatedTutorial())
(preferencesRepository.isTutorialCompleted())
) {
openDrawer(GravityCompat.START)
preferencesRepository.completeFirstUse()
@ -795,11 +795,6 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
}
}
private fun hasTranslatedTutorial(): Boolean {
// Check if we have a translated Tutorial to the current language on a naive way. :/
return arrayOf("en", "es", "pt", "zh").contains(Locale.getDefault().language)
}
companion object {
const val GOOGLE_PLAY_REQUEST_CODE = 6

View file

@ -83,11 +83,12 @@
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/new_game"
android:padding="14dp"
android:visibility="gone"
android:alpha="0.0"
android:clickable="false"
ads:layout_constraintRight_toRightOf="parent"
ads:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/retry"
tools:visibility="visible"/>
tools:alpha="1.0"/>
<FrameLayout
android:id="@+id/levelContainer"

View file

@ -74,7 +74,7 @@ class PreferencesRepository(
preferencesManager.getBoolean(PREFERENCE_FIRST_USE, true)
override fun completeFirstUse() {
preferencesManager.putBoolean(PREFERENCE_TUTORIAL_COMPLETED, false)
preferencesManager.putBoolean(PREFERENCE_FIRST_USE, false)
}
override fun isTutorialCompleted(): Boolean {
@ -164,7 +164,7 @@ class PreferencesRepository(
preferencesManager.putInt(PREFERENCE_LONG_PRESS_TIMEOUT, defaultLongPressTimeout)
}
if (!isFirstUse()) {
if (preferencesManager.contains(PREFERENCE_FIRST_USE)) {
preferencesManager.putBoolean(PREFERENCE_TUTORIAL_COMPLETED, true)
}
}