mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-22 05:45:04 +00:00
Fixes 1369
This commit is contained in:
parent
c2b3a3bd90
commit
f46ce3d2f0
4 changed files with 10 additions and 4 deletions
|
|
@ -46,7 +46,7 @@ interface UserRepository : BaseRepository {
|
|||
|
||||
fun changeClass(selectedClass: String): Flowable<User>
|
||||
|
||||
fun unlockPath(user: User, customization: Customization): Flowable<UnlockResponse>
|
||||
fun unlockPath(user: User?, customization: Customization): Flowable<UnlockResponse>
|
||||
fun unlockPath(user: User, set: CustomizationSet): Flowable<UnlockResponse>
|
||||
|
||||
fun runCron(tasks: MutableList<Task>)
|
||||
|
|
|
|||
|
|
@ -135,9 +135,10 @@ class UserRepositoryImpl(localRepository: UserLocalRepository, apiClient: ApiCli
|
|||
|
||||
override fun changeClass(selectedClass: String): Flowable<User> = apiClient.changeClass(selectedClass).flatMap { retrieveUser(false) }
|
||||
|
||||
override fun unlockPath(user: User, customization: Customization): Flowable<UnlockResponse> {
|
||||
override fun unlockPath(user: User?, customization: Customization): Flowable<UnlockResponse> {
|
||||
return apiClient.unlockPath(customization.path)
|
||||
.doOnNext { unlockResponse ->
|
||||
if (user == null) return@doOnNext
|
||||
val copiedUser = localRepository.getUnmanagedCopy(user)
|
||||
copiedUser.preferences = unlockResponse.preferences
|
||||
copiedUser.purchased = unlockResponse.purchased
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ class CustomizationRecyclerViewAdapter : androidx.recyclerview.widget.RecyclerVi
|
|||
return
|
||||
}
|
||||
|
||||
if (customization?.identifier == activeCustomization) {
|
||||
if (customization?.type != "background" && customization?.identifier == activeCustomization) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,12 @@ class AvatarCustomizationFragment : BaseMainFragment<FragmentRecyclerviewBinding
|
|||
|
||||
compositeSubscription.add(adapter.getSelectCustomizationEvents()
|
||||
.flatMap { customization ->
|
||||
userRepository.useCustomization(user, customization.type ?: "", customization.category, customization.identifier ?: "")
|
||||
if (customization.type == "background") {
|
||||
userRepository.unlockPath(user, customization)
|
||||
.flatMap { userRepository.retrieveUser(false) }
|
||||
} else {
|
||||
userRepository.useCustomization(user, customization.type ?: "", customization.category, customization.identifier ?: "")
|
||||
}
|
||||
}
|
||||
.subscribe({ }, RxErrorHandler.handleEmptyError()))
|
||||
compositeSubscription.add(adapter.getUnlockCustomizationEvents()
|
||||
|
|
|
|||
Loading…
Reference in a new issue