fix npc banner handling

This commit is contained in:
Phillip Thelen 2023-11-29 14:12:38 +01:00
parent cf9ab0a833
commit 5110cc2766
4 changed files with 7 additions and 7 deletions

View file

@ -60,7 +60,7 @@ interface UserRepository : BaseRepository {
suspend fun updateLanguage(languageCode: String): User?
suspend fun resetAccount(): User?
suspend fun resetAccount(password: String): User?
suspend fun deleteAccount(password: String): Void?
suspend fun sendPasswordResetEmail(email: String): Void?

View file

@ -35,8 +35,8 @@ class AppConfigManager(contentRepository: ContentRepository?) : com.habitrpg.com
private val remoteConfig = FirebaseRemoteConfig.getInstance()
fun shopSpriteSuffix(): String {
return worldState?.npcImageSuffix ?: remoteConfig.getString("shopSpriteSuffix")
fun shopSpriteSuffix(): String? {
return worldState?.npcImageSuffix
}
fun maxChatLength(): Long {

View file

@ -42,7 +42,7 @@ class ShopRecyclerAdapter : androidx.recyclerview.widget.RecyclerView.Adapter<Vi
var changeClassEvents: ((String) -> Unit)? = null
var shopSpriteSuffix: String = ""
var shopSpriteSuffix: String? = null
set(value) {
field = value
if (items.size > 0) {
@ -274,7 +274,7 @@ class ShopRecyclerAdapter : androidx.recyclerview.widget.RecyclerView.Adapter<Vi
binding.descriptionView.movementMethod = LinkMovementMethod.getInstance()
}
fun bind(shop: Shop, shopSpriteSuffix: String) {
fun bind(shop: Shop, shopSpriteSuffix: String?) {
binding.npcBannerView.shopSpriteSuffix = shopSpriteSuffix
binding.npcBannerView.identifier = shop.identifier

View file

@ -19,9 +19,9 @@ import kotlin.math.roundToInt
class NPCBannerView(context: Context, attrs: AttributeSet?) : FrameLayout(context, attrs) {
private val binding = NpcBannerBinding.inflate(context.layoutInflater, this)
var shopSpriteSuffix: String = ""
var shopSpriteSuffix: String? = null
set(value) {
field = if (value.isEmpty() || value.startsWith("_")) {
field = if (value == null || value.isEmpty() || value.startsWith("_")) {
value
} else {
"_$value"