Skip to content

Commit

Permalink
Fix like button state reset when pressing home button (mars885#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Rybitskyi authored Apr 10, 2021
1 parent a4abae0 commit bfa4316
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,18 @@ internal class GameHeaderController(
fun bindModel(model: GameInfoHeaderModel) {
coverImageUrl = model.coverImageUrl

if(isLiked != model.isLiked) isLiked = model.isLiked
if(isLiked != model.isLiked) {
isLiked = model.isLiked
} else {
// See onAttachedToWindow method's comment. This crutch is exactly like that,
// with the only difference is that icon resets its state when pressing home
// button and then coming back.
if(isLiked) {
isLiked = false
isLiked = true
}
}

if(backgroundImageModels != model.backgroundImageModels) backgroundImageModels = model.backgroundImageModels
if(title != model.title) title = model.title
if(releaseDate != model.releaseDate) releaseDate = model.releaseDate
Expand Down

0 comments on commit bfa4316

Please sign in to comment.