diff --git a/Habitica/build.gradle b/Habitica/build.gradle
index ea8cbc658..e508b2f4b 100644
--- a/Habitica/build.gradle
+++ b/Habitica/build.gradle
@@ -162,7 +162,7 @@ android {
multiDexEnabled true
resConfigs "en", "bg", "de", "en-rGB", "es", "fr", "hr-rHR", "in", "it", "iw", "ja", "ko", "lt", "nl", "pl", "pt-rBR", "pt-rPT", "ru", "tr", "zh", "zh-rTW"
- versionCode 2441
+ versionCode 2444
versionName "2.7"
}
diff --git a/Habitica/res/layout/form_stepper_value.xml b/Habitica/res/layout/form_stepper_value.xml
index 17387eadc..7070970e4 100644
--- a/Habitica/res/layout/form_stepper_value.xml
+++ b/Habitica/res/layout/form_stepper_value.xml
@@ -15,21 +15,21 @@
android:background="@color/gray_500"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"/>
-
+
diff --git a/Habitica/res/values/strings.xml b/Habitica/res/values/strings.xml
index e3054d6c9..26f08fd76 100644
--- a/Habitica/res/values/strings.xml
+++ b/Habitica/res/values/strings.xml
@@ -1055,6 +1055,6 @@
Excess Items
You only need %d %s to hatch all possible pets. Are you sure you want to purchase %d?
Purchase %d
- You\'ve already hatched all possible %s pets. Are you sure you want to purchase %d %s?
+ You already have everything you need for all %s pets. Are you sure you want to purchase %d %ss?
Equip
diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/shops/PurchaseDialog.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/shops/PurchaseDialog.kt
index d087d95c5..d99591fd6 100644
--- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/shops/PurchaseDialog.kt
+++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/shops/PurchaseDialog.kt
@@ -43,6 +43,7 @@ import io.reactivex.functions.Consumer
import org.greenrobot.eventbus.EventBus
import java.util.*
import javax.inject.Inject
+import kotlin.math.max
class PurchaseDialog(context: Context, component: UserComponent?, val item: ShopItem) : HabiticaAlertDialog(context) {
@@ -403,13 +404,13 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
ownedCount += egg.numberOwned
}
}
- }.firstElement().subscribe {
- val remaining = 20 - ownedCount
- onResult(remaining)
- }
+ }.firstElement().doOnComplete {
+ val remaining = 18 - ownedCount
+ onResult(max(0, remaining))
+ }.subscribe(Consumer {}, RxErrorHandler.handleEmptyError())
} else if (item.purchaseType == "hatchingPotions") {
var ownedCount = 0
- inventoryRepository.getPets("Wolf", "quest", item.key).filter {
+ inventoryRepository.getPets("Wolf", "premium", item.key).filter {
return@filter it.size > 0
}.flatMap { inventoryRepository.getOwnedPets() }.doOnNext { for (pet in it) {
if (pet.key?.contains(item.key) == true) {
@@ -428,10 +429,10 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
ownedCount += potion.numberOwned
}
}
- }.firstElement().subscribe {
+ }.firstElement().doOnComplete {
val remaining = 18 - ownedCount
- onResult(remaining)
- }
+ onResult(max(0, remaining))
+ }.subscribe(Consumer {}, RxErrorHandler.handleEmptyError())
} else {
onResult(-1)
}