Fix retry and avoid remove old victory games

This commit is contained in:
Lucas Lima 2020-06-12 08:36:25 -03:00
parent 19b91aa432
commit 1c73756797
No known key found for this signature in database
GPG key ID: 0259A3F43EC1027A
2 changed files with 3 additions and 13 deletions

View file

@ -51,20 +51,10 @@ class HistoryAdapter(
if (status != SaveStatus.VICTORY) {
holder.replay.setImageResource(R.drawable.replay)
holder.replay.setOnClickListener {
val intent = Intent(Intent.ACTION_VIEW).apply {
flags = Intent.FLAG_ACTIVITY_CLEAR_TASK
data = Uri.Builder()
.scheme(DeepLink.SCHEME)
.authority(DeepLink.RETRY_HOST_AUTHORITY)
.appendPath(uid.toString())
.build()
}
it.context.startActivity(intent)
}
holder.replay.setOnClickListener { replayGame(it, uid) }
} else {
holder.replay.setImageResource(R.drawable.play)
holder.replay.setOnClickListener { replayGame(it, uid) }
holder.replay.setOnClickListener { loadGame(it, uid) }
}
holder.itemView.setOnClickListener { loadGame(it, uid) }

View file

@ -30,6 +30,6 @@ interface SaveDao {
@Delete
suspend fun delete(save: Save)
@Query("DELETE FROM save WHERE uid NOT IN (SELECT uid FROM save LIMIT :maxStorage)")
@Query("DELETE FROM save WHERE uid NOT IN (SELECT uid FROM save WHERE status != 1 LIMIT :maxStorage)")
suspend fun deleteOldSaves(maxStorage: Int)
}