fix minor bugs

This commit is contained in:
Phillip Thelen 2024-06-25 15:19:58 +02:00
parent f94f359d18
commit 199c929222
6 changed files with 18 additions and 5 deletions

View file

@ -111,7 +111,6 @@ class MainNotificationsManager : NotificationsManager {
Notification.Type.ACHIEVEMENT_GENERIC.type -> true Notification.Type.ACHIEVEMENT_GENERIC.type -> true
Notification.Type.ACHIEVEMENT_ONBOARDING_COMPLETE.type -> true Notification.Type.ACHIEVEMENT_ONBOARDING_COMPLETE.type -> true
Notification.Type.LOGIN_INCENTIVE.type -> true Notification.Type.LOGIN_INCENTIVE.type -> true
Notification.Type.NEW_MYSTERY_ITEMS.type -> true
Notification.Type.FIRST_DROP.type -> true Notification.Type.FIRST_DROP.type -> true
else -> false else -> false
} }

View file

@ -74,6 +74,12 @@ open class ShopItem : RealmObject(), BaseObject {
val isTypeItem: Boolean val isTypeItem: Boolean
get() = "eggs" == purchaseType || "hatchingPotions" == purchaseType || "food" == purchaseType || "armoire" == purchaseType || "potion" == purchaseType || "debuffPotion" == purchaseType || "fortify" == purchaseType get() = "eggs" == purchaseType || "hatchingPotions" == purchaseType || "food" == purchaseType || "armoire" == purchaseType || "potion" == purchaseType || "debuffPotion" == purchaseType || "fortify" == purchaseType
val isTypeSpecial: Boolean
get() = "special" == purchaseType
val isTypeBundle: Boolean
get() = "bundles" == purchaseType
val isTypeQuest: Boolean val isTypeQuest: Boolean
get() = "quests" == purchaseType get() = "quests" == purchaseType

View file

@ -137,7 +137,7 @@ class ComposeAvatarEquipmentFragment :
inventoryRepository.equip( inventoryRepository.equip(
if (userViewModel.user.value?.preferences?.costume == true) "costume" else "equipped", if (userViewModel.user.value?.preferences?.costume == true) "costume" else "equipped",
activeEquipment ?: "") activeEquipment ?: "")
} else { } else if (equipment.key?.contains("base_0") == false) {
inventoryRepository.equip( inventoryRepository.equip(
if (userViewModel.user.value?.preferences?.costume == true) "costume" else "equipped", if (userViewModel.user.value?.preferences?.costume == true) "costume" else "equipped",
equipment.key ?: "", equipment.key ?: "",

View file

@ -112,7 +112,7 @@ class PurchaseDialog(
val contentView: PurchaseDialogContent val contentView: PurchaseDialogContent
when { when {
shopItem.isTypeItem -> contentView = PurchaseDialogItemContent(context) shopItem.isTypeItem || shopItem.isTypeSpecial || shopItem.isTypeBundle -> contentView = PurchaseDialogItemContent(context)
shopItem.isTypeQuest -> { shopItem.isTypeQuest -> {
contentView = PurchaseDialogQuestContent(context) contentView = PurchaseDialogQuestContent(context)
MainScope().launch(ExceptionHandler.coroutine()) { MainScope().launch(ExceptionHandler.coroutine()) {

View file

@ -125,6 +125,7 @@ object MarkdownParser {
private fun processMarkdown(input: String): String { private fun processMarkdown(input: String): String {
var processedInput = preprocessMarkdownLinks(input) var processedInput = preprocessMarkdownLinks(input)
processedInput = preprocessImageMarkdown(processedInput) processedInput = preprocessImageMarkdown(processedInput)
processedInput = preprocessHtmlTags(processedInput)
return processedInput return processedInput
} }
@ -154,7 +155,7 @@ object MarkdownParser {
while (matcher.find()) { while (matcher.find()) {
val linkText = matcher.group(1) val linkText = matcher.group(1)
val url = matcher.group(2) val url = matcher.group(2)
val sanitizedUrl = url.replace(Regex("\\s"), "") val sanitizedUrl = url?.replace(Regex("\\s"), "")
val correctedLink = "[$linkText]($sanitizedUrl)" val correctedLink = "[$linkText]($sanitizedUrl)"
matcher.appendReplacement(sb, Matcher.quoteReplacement(correctedLink)) matcher.appendReplacement(sb, Matcher.quoteReplacement(correctedLink))
} }
@ -163,6 +164,13 @@ object MarkdownParser {
return sb.toString() return sb.toString()
} }
val brRegex = Regex("<br>")
private fun preprocessHtmlTags(markdown: String): String {
return markdown.replace(brRegex) {
"\n"
}
}
fun parseMarkdownAsync( fun parseMarkdownAsync(
input: String?, input: String?,
onSuccess: (Spanned) -> Unit, onSuccess: (Spanned) -> Unit,

View file

@ -1,2 +1,2 @@
NAME=4.4 NAME=4.4
CODE=7961 CODE=7981