mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-24 14:45:46 +00:00
Fix crashes
This commit is contained in:
parent
354a73f6f1
commit
703f51d28d
3 changed files with 7 additions and 2 deletions
|
|
@ -88,7 +88,9 @@ class SocialRepositoryImpl(localRepository: SocialLocalRepository, apiClient: Ap
|
|||
return Flowable.empty()
|
||||
}
|
||||
val liked = chatMessage.userLikesMessage(userID)
|
||||
localRepository.likeMessage(chatMessage, userID, !liked)
|
||||
if (chatMessage.isManaged) {
|
||||
localRepository.likeMessage(chatMessage, userID, !liked)
|
||||
}
|
||||
return apiClient.likeMessage(chatMessage.groupId ?: "", chatMessage.id)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -249,7 +249,8 @@ open class GroupViewModel(initializeComponent: Boolean) : BaseViewModel(initiali
|
|||
}
|
||||
|
||||
fun likeMessage(message: ChatMessage) {
|
||||
val index = _chatMessages.value?.indexOf(message) ?: return
|
||||
val index = _chatMessages.value?.indexOf(message)
|
||||
if (index == null || index < 0) return
|
||||
disposable.add(socialRepository.likeMessage(message).subscribe(
|
||||
{
|
||||
val list = _chatMessages.value?.toMutableList()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.graphics.drawable.toBitmap
|
||||
import com.habitrpg.android.habitica.HabiticaBaseApplication
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.databinding.DialogPetSuggestHatchBinding
|
||||
import com.habitrpg.android.habitica.extensions.subscribeWithErrorHandler
|
||||
|
|
@ -36,6 +37,7 @@ class PetSuggestHatchDialog(context: Context) : HabiticaAlertDialog(context) {
|
|||
val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as? LayoutInflater
|
||||
inflater?.let { binding = DialogPetSuggestHatchBinding.inflate(it) }
|
||||
setAdditionalContentView(binding.root)
|
||||
HabiticaBaseApplication.userComponent?.inject(this)
|
||||
}
|
||||
|
||||
fun configure(pet: Animal, egg: Egg?, potion: HatchingPotion?, eggCount: Int, potionCount: Int, hasUnlockedEgg: Boolean, hasUnlockedPotion: Boolean, hasMount: Boolean) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue