fix fall back issues

This commit is contained in:
Phillip Thelen 2024-06-10 14:34:31 +02:00
parent 2505bcfbb0
commit 18c106fc7e
4 changed files with 13 additions and 6 deletions

View file

@ -247,7 +247,7 @@ abstract class HabiticaBaseApplication : Application(), Application.ActivityLife
val remoteConfig = FirebaseRemoteConfig.getInstance()
val configSettings =
FirebaseRemoteConfigSettings.Builder()
.setMinimumFetchIntervalInSeconds(if (BuildConfig.DEBUG) 0 else 3600)
.setMinimumFetchIntervalInSeconds(if (BuildConfig.DEBUG) 0 else 1800)
.build()
remoteConfig.setConfigSettingsAsync(configSettings)
remoteConfig.setDefaultsAsync(R.xml.remote_config_defaults)

View file

@ -190,7 +190,6 @@ class AppConfigManager(contentRepository: ContentRepository) :
}
fun enableCustomizationShop(): Boolean {
if (BuildConfig.DEBUG) return true
return remoteConfig.getBoolean("enableCustomizationShop")
}
}

View file

@ -23,6 +23,7 @@ import com.habitrpg.android.habitica.extensions.addCancelButton
import com.habitrpg.android.habitica.extensions.addCloseButton
import com.habitrpg.android.habitica.extensions.getShortRemainingString
import com.habitrpg.android.habitica.helpers.Analytics
import com.habitrpg.android.habitica.helpers.AppConfigManager
import com.habitrpg.android.habitica.helpers.EventCategory
import com.habitrpg.android.habitica.helpers.HapticFeedbackManager
import com.habitrpg.android.habitica.helpers.HitType
@ -74,6 +75,7 @@ class PurchaseDialog(
private val inventoryRepository: InventoryRepository
private val userRepository: UserRepository
private val soundManager: SoundManager
private val configManager: AppConfigManager
private val customHeader: View by lazy {
DialogPurchaseShopitemHeaderBinding.inflate(context.layoutInflater).root
@ -176,21 +178,23 @@ class PurchaseDialog(
@EntryPoint
@InstallIn(SingletonComponent::class)
interface InsufficientGemsDialogEntryPoint {
interface PurchaseDialogEntryPoint {
fun inventoryRepository(): InventoryRepository
fun userRepository(): UserRepository
fun soundManager(): SoundManager
fun configManager(): AppConfigManager
}
init {
val hiltEntryPoint =
EntryPointAccessors.fromApplication(
context,
InsufficientGemsDialogEntryPoint::class.java,
PurchaseDialogEntryPoint::class.java,
)
inventoryRepository = hiltEntryPoint.inventoryRepository()
userRepository = hiltEntryPoint.userRepository()
soundManager = hiltEntryPoint.soundManager()
configManager = hiltEntryPoint.configManager()
findSnackBarActivity(context)?.let {
(it as? Activity)?.let { activity -> setOwnerActivity(activity) }
@ -455,7 +459,11 @@ class PurchaseDialog(
} else if (shopItem.purchaseType == "background" || shopItem.purchaseType == "backgrounds") {
observable = { userRepository.unlockPath(item.unlockPath ?: "${item.pinType}.${item.key}", item.value) }
} else if (shopItem.purchaseType == "customization" || shopItem.purchaseType == "customizationSet") {
observable = { userRepository.unlockPath(item.path ?: item.unlockPath ?: "${item.pinType}.${item.key}", item.value) }
if (configManager.enableCustomizationShop()) {
observable = { userRepository.unlockPath(item.path ?: item.unlockPath ?: "${item.pinType}.${item.key}", item.value) }
} else {
observable = { userRepository.unlockPath(item.unlockPath ?: "${item.pinType}.${item.key}", item.value) }
}
} else if (shopItem.purchaseType == "debuffPotion") {
observable = { userRepository.useSkill(shopItem.key, null) }
} else if (shopItem.purchaseType == "card") {

View file

@ -1,2 +1,2 @@
NAME=4.4
CODE=7931
CODE=7920