Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f70e082104 | |||
| cbcc2c0dbc | |||
| 383da18391 | |||
| 8eb3ea5c88 | |||
| cb458429e4 | |||
| 6eb41643be | |||
| 6bcc8c2f05 | |||
| c0e3d8af39 | |||
| be70a3d3de | |||
| fa4e651ada |
@@ -38,3 +38,4 @@ local.properties
|
|||||||
.idea/
|
.idea/
|
||||||
*.jks
|
*.jks
|
||||||
*.keystore
|
*.keystore
|
||||||
|
.gradle/
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +0,0 @@
|
|||||||
#Fri May 15 09:36:35 AST 2026
|
|
||||||
gradle.version=9.4.1
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
849b586a-06f6-407a-ab31-fb040f1195f²
|
|
||||||
Binary file not shown.
@@ -10,6 +10,25 @@ Every Phase 10 score tracker app on the Play Store falls into one of a few categ
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
<p float="left">
|
||||||
|
<img src="assets/screenshots/home.png" width="200" />
|
||||||
|
<img src="assets/screenshots/setup.png" width="200" />
|
||||||
|
<img src="assets/screenshots/game.png" width="200" />
|
||||||
|
<img src="assets/screenshots/game-detail.png" width="200" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p float="left">
|
||||||
|
<img src="assets/screenshots/entry.png" width="200" />
|
||||||
|
<img src="assets/screenshots/result.png" width="200" />
|
||||||
|
<img src="assets/screenshots/leaderboard.png" width="200" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Foldable / Tablet — Dual Pane
|
||||||
|
|
||||||
|
<img src="assets/screenshots/game-unfolded.png" width="600" />
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
### Game Management
|
### Game Management
|
||||||
@@ -78,6 +97,16 @@ Every Phase 10 score tracker app on the Play Store falls into one of a few categ
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
[<img src="https://raw.githubusercontent.com/ImranR98/Obtainium/main/assets/graphics/badge_obtainium.png" alt="Get it on Obtainium" height="80">](http://apps.obtainium.imranr.dev/redirect.html?r=obtainium://add/https://github.com/CrsMthw/Phase10-Tracker)
|
||||||
|
|
||||||
|
Tapping this button on your Android device will open Obtainium and automatically add the repo — it'll notify you and install new releases automatically from then on.
|
||||||
|
|
||||||
|
Or go to the Releases page and download the latest APK manually.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
Requirements: Android Studio (latest stable), JDK 17+, Android SDK 37.
|
Requirements: Android Studio (latest stable), JDK 17+, Android SDK 37.
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ android {
|
|||||||
applicationId = "com.crsmthw.phase10tracker"
|
applicationId = "com.crsmthw.phase10tracker"
|
||||||
minSdk = 35
|
minSdk = 35
|
||||||
targetSdk = 37
|
targetSdk = 37
|
||||||
versionCode = 1
|
versionCode = 5
|
||||||
versionName = "1.0"
|
versionName = "3.0.1"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
|
|||||||
-96
@@ -1,96 +0,0 @@
|
|||||||
package com.crsmthw.phase10tracker.`data`.db
|
|
||||||
|
|
||||||
import androidx.room.EntityDeleteOrUpdateAdapter
|
|
||||||
import androidx.room.EntityInsertAdapter
|
|
||||||
import androidx.room.RoomDatabase
|
|
||||||
import androidx.room.coroutines.createFlow
|
|
||||||
import androidx.room.util.getColumnIndexOrThrow
|
|
||||||
import androidx.room.util.performSuspending
|
|
||||||
import androidx.sqlite.SQLiteStatement
|
|
||||||
import com.crsmthw.phase10tracker.`data`.model.CustomRuleSetEntity
|
|
||||||
import javax.`annotation`.processing.Generated
|
|
||||||
import kotlin.Int
|
|
||||||
import kotlin.Long
|
|
||||||
import kotlin.String
|
|
||||||
import kotlin.Suppress
|
|
||||||
import kotlin.Unit
|
|
||||||
import kotlin.collections.List
|
|
||||||
import kotlin.collections.MutableList
|
|
||||||
import kotlin.collections.mutableListOf
|
|
||||||
import kotlin.reflect.KClass
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
|
||||||
|
|
||||||
@Generated(value = ["androidx.room.RoomProcessor"])
|
|
||||||
@Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
|
|
||||||
public class CustomRuleSetDao_Impl(
|
|
||||||
__db: RoomDatabase,
|
|
||||||
) : CustomRuleSetDao {
|
|
||||||
private val __db: RoomDatabase
|
|
||||||
|
|
||||||
private val __insertAdapterOfCustomRuleSetEntity: EntityInsertAdapter<CustomRuleSetEntity>
|
|
||||||
|
|
||||||
private val __deleteAdapterOfCustomRuleSetEntity: EntityDeleteOrUpdateAdapter<CustomRuleSetEntity>
|
|
||||||
init {
|
|
||||||
this.__db = __db
|
|
||||||
this.__insertAdapterOfCustomRuleSetEntity = object : EntityInsertAdapter<CustomRuleSetEntity>() {
|
|
||||||
protected override fun createQuery(): String = "INSERT OR REPLACE INTO `custom_rule_sets` (`id`,`name`,`rulesJson`,`createdAt`) VALUES (nullif(?, 0),?,?,?)"
|
|
||||||
|
|
||||||
protected override fun bind(statement: SQLiteStatement, entity: CustomRuleSetEntity) {
|
|
||||||
statement.bindLong(1, entity.id)
|
|
||||||
statement.bindText(2, entity.name)
|
|
||||||
statement.bindText(3, entity.rulesJson)
|
|
||||||
statement.bindLong(4, entity.createdAt)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.__deleteAdapterOfCustomRuleSetEntity = object : EntityDeleteOrUpdateAdapter<CustomRuleSetEntity>() {
|
|
||||||
protected override fun createQuery(): String = "DELETE FROM `custom_rule_sets` WHERE `id` = ?"
|
|
||||||
|
|
||||||
protected override fun bind(statement: SQLiteStatement, entity: CustomRuleSetEntity) {
|
|
||||||
statement.bindLong(1, entity.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun insertRuleSet(ruleSet: CustomRuleSetEntity): Long = performSuspending(__db, false, true) { _connection ->
|
|
||||||
val _result: Long = __insertAdapterOfCustomRuleSetEntity.insertAndReturnId(_connection, ruleSet)
|
|
||||||
_result
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun deleteRuleSet(ruleSet: CustomRuleSetEntity): Unit = performSuspending(__db, false, true) { _connection ->
|
|
||||||
__deleteAdapterOfCustomRuleSetEntity.handle(_connection, ruleSet)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun getAllRuleSets(): Flow<List<CustomRuleSetEntity>> {
|
|
||||||
val _sql: String = "SELECT * FROM custom_rule_sets ORDER BY createdAt DESC"
|
|
||||||
return createFlow(__db, false, arrayOf("custom_rule_sets")) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
|
|
||||||
val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "name")
|
|
||||||
val _columnIndexOfRulesJson: Int = getColumnIndexOrThrow(_stmt, "rulesJson")
|
|
||||||
val _columnIndexOfCreatedAt: Int = getColumnIndexOrThrow(_stmt, "createdAt")
|
|
||||||
val _result: MutableList<CustomRuleSetEntity> = mutableListOf()
|
|
||||||
while (_stmt.step()) {
|
|
||||||
val _item: CustomRuleSetEntity
|
|
||||||
val _tmpId: Long
|
|
||||||
_tmpId = _stmt.getLong(_columnIndexOfId)
|
|
||||||
val _tmpName: String
|
|
||||||
_tmpName = _stmt.getText(_columnIndexOfName)
|
|
||||||
val _tmpRulesJson: String
|
|
||||||
_tmpRulesJson = _stmt.getText(_columnIndexOfRulesJson)
|
|
||||||
val _tmpCreatedAt: Long
|
|
||||||
_tmpCreatedAt = _stmt.getLong(_columnIndexOfCreatedAt)
|
|
||||||
_item = CustomRuleSetEntity(_tmpId,_tmpName,_tmpRulesJson,_tmpCreatedAt)
|
|
||||||
_result.add(_item)
|
|
||||||
}
|
|
||||||
_result
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public companion object {
|
|
||||||
public fun getRequiredConverters(): List<KClass<*>> = emptyList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-310
@@ -1,310 +0,0 @@
|
|||||||
package com.crsmthw.phase10tracker.`data`.db
|
|
||||||
|
|
||||||
import androidx.room.EntityDeleteOrUpdateAdapter
|
|
||||||
import androidx.room.EntityInsertAdapter
|
|
||||||
import androidx.room.RoomDatabase
|
|
||||||
import androidx.room.coroutines.createFlow
|
|
||||||
import androidx.room.util.getColumnIndexOrThrow
|
|
||||||
import androidx.room.util.performSuspending
|
|
||||||
import androidx.sqlite.SQLiteStatement
|
|
||||||
import com.crsmthw.phase10tracker.`data`.model.GameEntity
|
|
||||||
import javax.`annotation`.processing.Generated
|
|
||||||
import kotlin.Boolean
|
|
||||||
import kotlin.Int
|
|
||||||
import kotlin.Long
|
|
||||||
import kotlin.String
|
|
||||||
import kotlin.Suppress
|
|
||||||
import kotlin.Unit
|
|
||||||
import kotlin.collections.List
|
|
||||||
import kotlin.reflect.KClass
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
|
||||||
|
|
||||||
@Generated(value = ["androidx.room.RoomProcessor"])
|
|
||||||
@Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
|
|
||||||
public class GameDao_Impl(
|
|
||||||
__db: RoomDatabase,
|
|
||||||
) : GameDao {
|
|
||||||
private val __db: RoomDatabase
|
|
||||||
|
|
||||||
private val __insertAdapterOfGameEntity: EntityInsertAdapter<GameEntity>
|
|
||||||
|
|
||||||
private val __updateAdapterOfGameEntity: EntityDeleteOrUpdateAdapter<GameEntity>
|
|
||||||
init {
|
|
||||||
this.__db = __db
|
|
||||||
this.__insertAdapterOfGameEntity = object : EntityInsertAdapter<GameEntity>() {
|
|
||||||
protected override fun createQuery(): String = "INSERT OR REPLACE INTO `games` (`id`,`startedAt`,`finishedAt`,`isComplete`,`winnerId`,`currentRound`,`currentDealerIndex`) VALUES (nullif(?, 0),?,?,?,?,?,?)"
|
|
||||||
|
|
||||||
protected override fun bind(statement: SQLiteStatement, entity: GameEntity) {
|
|
||||||
statement.bindLong(1, entity.id)
|
|
||||||
statement.bindLong(2, entity.startedAt)
|
|
||||||
val _tmpFinishedAt: Long? = entity.finishedAt
|
|
||||||
if (_tmpFinishedAt == null) {
|
|
||||||
statement.bindNull(3)
|
|
||||||
} else {
|
|
||||||
statement.bindLong(3, _tmpFinishedAt)
|
|
||||||
}
|
|
||||||
val _tmp: Int = if (entity.isComplete) 1 else 0
|
|
||||||
statement.bindLong(4, _tmp.toLong())
|
|
||||||
val _tmpWinnerId: Long? = entity.winnerId
|
|
||||||
if (_tmpWinnerId == null) {
|
|
||||||
statement.bindNull(5)
|
|
||||||
} else {
|
|
||||||
statement.bindLong(5, _tmpWinnerId)
|
|
||||||
}
|
|
||||||
statement.bindLong(6, entity.currentRound.toLong())
|
|
||||||
statement.bindLong(7, entity.currentDealerIndex.toLong())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.__updateAdapterOfGameEntity = object : EntityDeleteOrUpdateAdapter<GameEntity>() {
|
|
||||||
protected override fun createQuery(): String = "UPDATE OR ABORT `games` SET `id` = ?,`startedAt` = ?,`finishedAt` = ?,`isComplete` = ?,`winnerId` = ?,`currentRound` = ?,`currentDealerIndex` = ? WHERE `id` = ?"
|
|
||||||
|
|
||||||
protected override fun bind(statement: SQLiteStatement, entity: GameEntity) {
|
|
||||||
statement.bindLong(1, entity.id)
|
|
||||||
statement.bindLong(2, entity.startedAt)
|
|
||||||
val _tmpFinishedAt: Long? = entity.finishedAt
|
|
||||||
if (_tmpFinishedAt == null) {
|
|
||||||
statement.bindNull(3)
|
|
||||||
} else {
|
|
||||||
statement.bindLong(3, _tmpFinishedAt)
|
|
||||||
}
|
|
||||||
val _tmp: Int = if (entity.isComplete) 1 else 0
|
|
||||||
statement.bindLong(4, _tmp.toLong())
|
|
||||||
val _tmpWinnerId: Long? = entity.winnerId
|
|
||||||
if (_tmpWinnerId == null) {
|
|
||||||
statement.bindNull(5)
|
|
||||||
} else {
|
|
||||||
statement.bindLong(5, _tmpWinnerId)
|
|
||||||
}
|
|
||||||
statement.bindLong(6, entity.currentRound.toLong())
|
|
||||||
statement.bindLong(7, entity.currentDealerIndex.toLong())
|
|
||||||
statement.bindLong(8, entity.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun insertGame(game: GameEntity): Long = performSuspending(__db, false, true) { _connection ->
|
|
||||||
val _result: Long = __insertAdapterOfGameEntity.insertAndReturnId(_connection, game)
|
|
||||||
_result
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun updateGame(game: GameEntity): Unit = performSuspending(__db, false, true) { _connection ->
|
|
||||||
__updateAdapterOfGameEntity.handle(_connection, game)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun getActiveGame(): GameEntity? {
|
|
||||||
val _sql: String = "SELECT * FROM games WHERE isComplete = 0 ORDER BY startedAt DESC LIMIT 1"
|
|
||||||
return performSuspending(__db, true, false) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
|
|
||||||
val _columnIndexOfStartedAt: Int = getColumnIndexOrThrow(_stmt, "startedAt")
|
|
||||||
val _columnIndexOfFinishedAt: Int = getColumnIndexOrThrow(_stmt, "finishedAt")
|
|
||||||
val _columnIndexOfIsComplete: Int = getColumnIndexOrThrow(_stmt, "isComplete")
|
|
||||||
val _columnIndexOfWinnerId: Int = getColumnIndexOrThrow(_stmt, "winnerId")
|
|
||||||
val _columnIndexOfCurrentRound: Int = getColumnIndexOrThrow(_stmt, "currentRound")
|
|
||||||
val _columnIndexOfCurrentDealerIndex: Int = getColumnIndexOrThrow(_stmt, "currentDealerIndex")
|
|
||||||
val _result: GameEntity?
|
|
||||||
if (_stmt.step()) {
|
|
||||||
val _tmpId: Long
|
|
||||||
_tmpId = _stmt.getLong(_columnIndexOfId)
|
|
||||||
val _tmpStartedAt: Long
|
|
||||||
_tmpStartedAt = _stmt.getLong(_columnIndexOfStartedAt)
|
|
||||||
val _tmpFinishedAt: Long?
|
|
||||||
if (_stmt.isNull(_columnIndexOfFinishedAt)) {
|
|
||||||
_tmpFinishedAt = null
|
|
||||||
} else {
|
|
||||||
_tmpFinishedAt = _stmt.getLong(_columnIndexOfFinishedAt)
|
|
||||||
}
|
|
||||||
val _tmpIsComplete: Boolean
|
|
||||||
val _tmp: Int
|
|
||||||
_tmp = _stmt.getLong(_columnIndexOfIsComplete).toInt()
|
|
||||||
_tmpIsComplete = _tmp != 0
|
|
||||||
val _tmpWinnerId: Long?
|
|
||||||
if (_stmt.isNull(_columnIndexOfWinnerId)) {
|
|
||||||
_tmpWinnerId = null
|
|
||||||
} else {
|
|
||||||
_tmpWinnerId = _stmt.getLong(_columnIndexOfWinnerId)
|
|
||||||
}
|
|
||||||
val _tmpCurrentRound: Int
|
|
||||||
_tmpCurrentRound = _stmt.getLong(_columnIndexOfCurrentRound).toInt()
|
|
||||||
val _tmpCurrentDealerIndex: Int
|
|
||||||
_tmpCurrentDealerIndex = _stmt.getLong(_columnIndexOfCurrentDealerIndex).toInt()
|
|
||||||
_result = GameEntity(_tmpId,_tmpStartedAt,_tmpFinishedAt,_tmpIsComplete,_tmpWinnerId,_tmpCurrentRound,_tmpCurrentDealerIndex)
|
|
||||||
} else {
|
|
||||||
_result = null
|
|
||||||
}
|
|
||||||
_result
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun observeActiveGame(): Flow<GameEntity?> {
|
|
||||||
val _sql: String = "SELECT * FROM games WHERE isComplete = 0 ORDER BY startedAt DESC LIMIT 1"
|
|
||||||
return createFlow(__db, false, arrayOf("games")) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
|
|
||||||
val _columnIndexOfStartedAt: Int = getColumnIndexOrThrow(_stmt, "startedAt")
|
|
||||||
val _columnIndexOfFinishedAt: Int = getColumnIndexOrThrow(_stmt, "finishedAt")
|
|
||||||
val _columnIndexOfIsComplete: Int = getColumnIndexOrThrow(_stmt, "isComplete")
|
|
||||||
val _columnIndexOfWinnerId: Int = getColumnIndexOrThrow(_stmt, "winnerId")
|
|
||||||
val _columnIndexOfCurrentRound: Int = getColumnIndexOrThrow(_stmt, "currentRound")
|
|
||||||
val _columnIndexOfCurrentDealerIndex: Int = getColumnIndexOrThrow(_stmt, "currentDealerIndex")
|
|
||||||
val _result: GameEntity?
|
|
||||||
if (_stmt.step()) {
|
|
||||||
val _tmpId: Long
|
|
||||||
_tmpId = _stmt.getLong(_columnIndexOfId)
|
|
||||||
val _tmpStartedAt: Long
|
|
||||||
_tmpStartedAt = _stmt.getLong(_columnIndexOfStartedAt)
|
|
||||||
val _tmpFinishedAt: Long?
|
|
||||||
if (_stmt.isNull(_columnIndexOfFinishedAt)) {
|
|
||||||
_tmpFinishedAt = null
|
|
||||||
} else {
|
|
||||||
_tmpFinishedAt = _stmt.getLong(_columnIndexOfFinishedAt)
|
|
||||||
}
|
|
||||||
val _tmpIsComplete: Boolean
|
|
||||||
val _tmp: Int
|
|
||||||
_tmp = _stmt.getLong(_columnIndexOfIsComplete).toInt()
|
|
||||||
_tmpIsComplete = _tmp != 0
|
|
||||||
val _tmpWinnerId: Long?
|
|
||||||
if (_stmt.isNull(_columnIndexOfWinnerId)) {
|
|
||||||
_tmpWinnerId = null
|
|
||||||
} else {
|
|
||||||
_tmpWinnerId = _stmt.getLong(_columnIndexOfWinnerId)
|
|
||||||
}
|
|
||||||
val _tmpCurrentRound: Int
|
|
||||||
_tmpCurrentRound = _stmt.getLong(_columnIndexOfCurrentRound).toInt()
|
|
||||||
val _tmpCurrentDealerIndex: Int
|
|
||||||
_tmpCurrentDealerIndex = _stmt.getLong(_columnIndexOfCurrentDealerIndex).toInt()
|
|
||||||
_result = GameEntity(_tmpId,_tmpStartedAt,_tmpFinishedAt,_tmpIsComplete,_tmpWinnerId,_tmpCurrentRound,_tmpCurrentDealerIndex)
|
|
||||||
} else {
|
|
||||||
_result = null
|
|
||||||
}
|
|
||||||
_result
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun getGameById(id: Long): Flow<GameEntity?> {
|
|
||||||
val _sql: String = "SELECT * FROM games WHERE id = ?"
|
|
||||||
return createFlow(__db, false, arrayOf("games")) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
var _argIndex: Int = 1
|
|
||||||
_stmt.bindLong(_argIndex, id)
|
|
||||||
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
|
|
||||||
val _columnIndexOfStartedAt: Int = getColumnIndexOrThrow(_stmt, "startedAt")
|
|
||||||
val _columnIndexOfFinishedAt: Int = getColumnIndexOrThrow(_stmt, "finishedAt")
|
|
||||||
val _columnIndexOfIsComplete: Int = getColumnIndexOrThrow(_stmt, "isComplete")
|
|
||||||
val _columnIndexOfWinnerId: Int = getColumnIndexOrThrow(_stmt, "winnerId")
|
|
||||||
val _columnIndexOfCurrentRound: Int = getColumnIndexOrThrow(_stmt, "currentRound")
|
|
||||||
val _columnIndexOfCurrentDealerIndex: Int = getColumnIndexOrThrow(_stmt, "currentDealerIndex")
|
|
||||||
val _result: GameEntity?
|
|
||||||
if (_stmt.step()) {
|
|
||||||
val _tmpId: Long
|
|
||||||
_tmpId = _stmt.getLong(_columnIndexOfId)
|
|
||||||
val _tmpStartedAt: Long
|
|
||||||
_tmpStartedAt = _stmt.getLong(_columnIndexOfStartedAt)
|
|
||||||
val _tmpFinishedAt: Long?
|
|
||||||
if (_stmt.isNull(_columnIndexOfFinishedAt)) {
|
|
||||||
_tmpFinishedAt = null
|
|
||||||
} else {
|
|
||||||
_tmpFinishedAt = _stmt.getLong(_columnIndexOfFinishedAt)
|
|
||||||
}
|
|
||||||
val _tmpIsComplete: Boolean
|
|
||||||
val _tmp: Int
|
|
||||||
_tmp = _stmt.getLong(_columnIndexOfIsComplete).toInt()
|
|
||||||
_tmpIsComplete = _tmp != 0
|
|
||||||
val _tmpWinnerId: Long?
|
|
||||||
if (_stmt.isNull(_columnIndexOfWinnerId)) {
|
|
||||||
_tmpWinnerId = null
|
|
||||||
} else {
|
|
||||||
_tmpWinnerId = _stmt.getLong(_columnIndexOfWinnerId)
|
|
||||||
}
|
|
||||||
val _tmpCurrentRound: Int
|
|
||||||
_tmpCurrentRound = _stmt.getLong(_columnIndexOfCurrentRound).toInt()
|
|
||||||
val _tmpCurrentDealerIndex: Int
|
|
||||||
_tmpCurrentDealerIndex = _stmt.getLong(_columnIndexOfCurrentDealerIndex).toInt()
|
|
||||||
_result = GameEntity(_tmpId,_tmpStartedAt,_tmpFinishedAt,_tmpIsComplete,_tmpWinnerId,_tmpCurrentRound,_tmpCurrentDealerIndex)
|
|
||||||
} else {
|
|
||||||
_result = null
|
|
||||||
}
|
|
||||||
_result
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun cancelAllIncompleteGames(now: Long) {
|
|
||||||
val _sql: String = "UPDATE games SET isComplete = 1, finishedAt = ? WHERE isComplete = 0"
|
|
||||||
return performSuspending(__db, false, true) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
var _argIndex: Int = 1
|
|
||||||
_stmt.bindLong(_argIndex, now)
|
|
||||||
_stmt.step()
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun advanceRound(
|
|
||||||
id: Long,
|
|
||||||
round: Int,
|
|
||||||
dealerIndex: Int,
|
|
||||||
) {
|
|
||||||
val _sql: String = "UPDATE games SET currentRound = ?, currentDealerIndex = ? WHERE id = ?"
|
|
||||||
return performSuspending(__db, false, true) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
var _argIndex: Int = 1
|
|
||||||
_stmt.bindLong(_argIndex, round.toLong())
|
|
||||||
_argIndex = 2
|
|
||||||
_stmt.bindLong(_argIndex, dealerIndex.toLong())
|
|
||||||
_argIndex = 3
|
|
||||||
_stmt.bindLong(_argIndex, id)
|
|
||||||
_stmt.step()
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun finishGame(
|
|
||||||
id: Long,
|
|
||||||
winnerId: Long,
|
|
||||||
finishedAt: Long,
|
|
||||||
) {
|
|
||||||
val _sql: String = """
|
|
||||||
|
|
|
||||||
| UPDATE games
|
|
||||||
| SET isComplete = 1, finishedAt = ?, winnerId = ?
|
|
||||||
| WHERE id = ?
|
|
||||||
|
|
|
||||||
""".trimMargin()
|
|
||||||
return performSuspending(__db, false, true) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
var _argIndex: Int = 1
|
|
||||||
_stmt.bindLong(_argIndex, finishedAt)
|
|
||||||
_argIndex = 2
|
|
||||||
_stmt.bindLong(_argIndex, winnerId)
|
|
||||||
_argIndex = 3
|
|
||||||
_stmt.bindLong(_argIndex, id)
|
|
||||||
_stmt.step()
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public companion object {
|
|
||||||
public fun getRequiredConverters(): List<KClass<*>> = emptyList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-222
@@ -1,222 +0,0 @@
|
|||||||
package com.crsmthw.phase10tracker.`data`.db
|
|
||||||
|
|
||||||
import androidx.room.EntityDeleteOrUpdateAdapter
|
|
||||||
import androidx.room.EntityInsertAdapter
|
|
||||||
import androidx.room.RoomDatabase
|
|
||||||
import androidx.room.coroutines.createFlow
|
|
||||||
import androidx.room.util.getColumnIndexOrThrow
|
|
||||||
import androidx.room.util.performSuspending
|
|
||||||
import androidx.sqlite.SQLiteStatement
|
|
||||||
import com.crsmthw.phase10tracker.`data`.model.GamePlayerEntity
|
|
||||||
import javax.`annotation`.processing.Generated
|
|
||||||
import kotlin.Boolean
|
|
||||||
import kotlin.Int
|
|
||||||
import kotlin.Long
|
|
||||||
import kotlin.String
|
|
||||||
import kotlin.Suppress
|
|
||||||
import kotlin.Unit
|
|
||||||
import kotlin.collections.List
|
|
||||||
import kotlin.collections.MutableList
|
|
||||||
import kotlin.collections.mutableListOf
|
|
||||||
import kotlin.reflect.KClass
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
|
||||||
|
|
||||||
@Generated(value = ["androidx.room.RoomProcessor"])
|
|
||||||
@Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
|
|
||||||
public class GamePlayerDao_Impl(
|
|
||||||
__db: RoomDatabase,
|
|
||||||
) : GamePlayerDao {
|
|
||||||
private val __db: RoomDatabase
|
|
||||||
|
|
||||||
private val __insertAdapterOfGamePlayerEntity: EntityInsertAdapter<GamePlayerEntity>
|
|
||||||
|
|
||||||
private val __updateAdapterOfGamePlayerEntity: EntityDeleteOrUpdateAdapter<GamePlayerEntity>
|
|
||||||
init {
|
|
||||||
this.__db = __db
|
|
||||||
this.__insertAdapterOfGamePlayerEntity = object : EntityInsertAdapter<GamePlayerEntity>() {
|
|
||||||
protected override fun createQuery(): String = "INSERT OR REPLACE INTO `game_players` (`id`,`gameId`,`playerId`,`playerName`,`turnOrder`,`currentPhase`,`totalScore`,`isEliminated`) VALUES (nullif(?, 0),?,?,?,?,?,?,?)"
|
|
||||||
|
|
||||||
protected override fun bind(statement: SQLiteStatement, entity: GamePlayerEntity) {
|
|
||||||
statement.bindLong(1, entity.id)
|
|
||||||
statement.bindLong(2, entity.gameId)
|
|
||||||
statement.bindLong(3, entity.playerId)
|
|
||||||
statement.bindText(4, entity.playerName)
|
|
||||||
statement.bindLong(5, entity.turnOrder.toLong())
|
|
||||||
statement.bindLong(6, entity.currentPhase.toLong())
|
|
||||||
statement.bindLong(7, entity.totalScore.toLong())
|
|
||||||
val _tmp: Int = if (entity.isEliminated) 1 else 0
|
|
||||||
statement.bindLong(8, _tmp.toLong())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.__updateAdapterOfGamePlayerEntity = object : EntityDeleteOrUpdateAdapter<GamePlayerEntity>() {
|
|
||||||
protected override fun createQuery(): String = "UPDATE OR ABORT `game_players` SET `id` = ?,`gameId` = ?,`playerId` = ?,`playerName` = ?,`turnOrder` = ?,`currentPhase` = ?,`totalScore` = ?,`isEliminated` = ? WHERE `id` = ?"
|
|
||||||
|
|
||||||
protected override fun bind(statement: SQLiteStatement, entity: GamePlayerEntity) {
|
|
||||||
statement.bindLong(1, entity.id)
|
|
||||||
statement.bindLong(2, entity.gameId)
|
|
||||||
statement.bindLong(3, entity.playerId)
|
|
||||||
statement.bindText(4, entity.playerName)
|
|
||||||
statement.bindLong(5, entity.turnOrder.toLong())
|
|
||||||
statement.bindLong(6, entity.currentPhase.toLong())
|
|
||||||
statement.bindLong(7, entity.totalScore.toLong())
|
|
||||||
val _tmp: Int = if (entity.isEliminated) 1 else 0
|
|
||||||
statement.bindLong(8, _tmp.toLong())
|
|
||||||
statement.bindLong(9, entity.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun insertGamePlayers(players: List<GamePlayerEntity>): Unit = performSuspending(__db, false, true) { _connection ->
|
|
||||||
__insertAdapterOfGamePlayerEntity.insert(_connection, players)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun updateGamePlayer(player: GamePlayerEntity): Unit = performSuspending(__db, false, true) { _connection ->
|
|
||||||
__updateAdapterOfGamePlayerEntity.handle(_connection, player)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun updateGamePlayers(players: List<GamePlayerEntity>): Unit = performSuspending(__db, false, true) { _connection ->
|
|
||||||
__updateAdapterOfGamePlayerEntity.handleMultiple(_connection, players)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun getGamePlayers(gameId: Long): Flow<List<GamePlayerEntity>> {
|
|
||||||
val _sql: String = "SELECT * FROM game_players WHERE gameId = ? ORDER BY turnOrder ASC"
|
|
||||||
return createFlow(__db, false, arrayOf("game_players")) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
var _argIndex: Int = 1
|
|
||||||
_stmt.bindLong(_argIndex, gameId)
|
|
||||||
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
|
|
||||||
val _columnIndexOfGameId: Int = getColumnIndexOrThrow(_stmt, "gameId")
|
|
||||||
val _columnIndexOfPlayerId: Int = getColumnIndexOrThrow(_stmt, "playerId")
|
|
||||||
val _columnIndexOfPlayerName: Int = getColumnIndexOrThrow(_stmt, "playerName")
|
|
||||||
val _columnIndexOfTurnOrder: Int = getColumnIndexOrThrow(_stmt, "turnOrder")
|
|
||||||
val _columnIndexOfCurrentPhase: Int = getColumnIndexOrThrow(_stmt, "currentPhase")
|
|
||||||
val _columnIndexOfTotalScore: Int = getColumnIndexOrThrow(_stmt, "totalScore")
|
|
||||||
val _columnIndexOfIsEliminated: Int = getColumnIndexOrThrow(_stmt, "isEliminated")
|
|
||||||
val _result: MutableList<GamePlayerEntity> = mutableListOf()
|
|
||||||
while (_stmt.step()) {
|
|
||||||
val _item: GamePlayerEntity
|
|
||||||
val _tmpId: Long
|
|
||||||
_tmpId = _stmt.getLong(_columnIndexOfId)
|
|
||||||
val _tmpGameId: Long
|
|
||||||
_tmpGameId = _stmt.getLong(_columnIndexOfGameId)
|
|
||||||
val _tmpPlayerId: Long
|
|
||||||
_tmpPlayerId = _stmt.getLong(_columnIndexOfPlayerId)
|
|
||||||
val _tmpPlayerName: String
|
|
||||||
_tmpPlayerName = _stmt.getText(_columnIndexOfPlayerName)
|
|
||||||
val _tmpTurnOrder: Int
|
|
||||||
_tmpTurnOrder = _stmt.getLong(_columnIndexOfTurnOrder).toInt()
|
|
||||||
val _tmpCurrentPhase: Int
|
|
||||||
_tmpCurrentPhase = _stmt.getLong(_columnIndexOfCurrentPhase).toInt()
|
|
||||||
val _tmpTotalScore: Int
|
|
||||||
_tmpTotalScore = _stmt.getLong(_columnIndexOfTotalScore).toInt()
|
|
||||||
val _tmpIsEliminated: Boolean
|
|
||||||
val _tmp: Int
|
|
||||||
_tmp = _stmt.getLong(_columnIndexOfIsEliminated).toInt()
|
|
||||||
_tmpIsEliminated = _tmp != 0
|
|
||||||
_item = GamePlayerEntity(_tmpId,_tmpGameId,_tmpPlayerId,_tmpPlayerName,_tmpTurnOrder,_tmpCurrentPhase,_tmpTotalScore,_tmpIsEliminated)
|
|
||||||
_result.add(_item)
|
|
||||||
}
|
|
||||||
_result
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun getGamePlayersList(gameId: Long): List<GamePlayerEntity> {
|
|
||||||
val _sql: String = "SELECT * FROM game_players WHERE gameId = ? ORDER BY turnOrder ASC"
|
|
||||||
return performSuspending(__db, true, false) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
var _argIndex: Int = 1
|
|
||||||
_stmt.bindLong(_argIndex, gameId)
|
|
||||||
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
|
|
||||||
val _columnIndexOfGameId: Int = getColumnIndexOrThrow(_stmt, "gameId")
|
|
||||||
val _columnIndexOfPlayerId: Int = getColumnIndexOrThrow(_stmt, "playerId")
|
|
||||||
val _columnIndexOfPlayerName: Int = getColumnIndexOrThrow(_stmt, "playerName")
|
|
||||||
val _columnIndexOfTurnOrder: Int = getColumnIndexOrThrow(_stmt, "turnOrder")
|
|
||||||
val _columnIndexOfCurrentPhase: Int = getColumnIndexOrThrow(_stmt, "currentPhase")
|
|
||||||
val _columnIndexOfTotalScore: Int = getColumnIndexOrThrow(_stmt, "totalScore")
|
|
||||||
val _columnIndexOfIsEliminated: Int = getColumnIndexOrThrow(_stmt, "isEliminated")
|
|
||||||
val _result: MutableList<GamePlayerEntity> = mutableListOf()
|
|
||||||
while (_stmt.step()) {
|
|
||||||
val _item: GamePlayerEntity
|
|
||||||
val _tmpId: Long
|
|
||||||
_tmpId = _stmt.getLong(_columnIndexOfId)
|
|
||||||
val _tmpGameId: Long
|
|
||||||
_tmpGameId = _stmt.getLong(_columnIndexOfGameId)
|
|
||||||
val _tmpPlayerId: Long
|
|
||||||
_tmpPlayerId = _stmt.getLong(_columnIndexOfPlayerId)
|
|
||||||
val _tmpPlayerName: String
|
|
||||||
_tmpPlayerName = _stmt.getText(_columnIndexOfPlayerName)
|
|
||||||
val _tmpTurnOrder: Int
|
|
||||||
_tmpTurnOrder = _stmt.getLong(_columnIndexOfTurnOrder).toInt()
|
|
||||||
val _tmpCurrentPhase: Int
|
|
||||||
_tmpCurrentPhase = _stmt.getLong(_columnIndexOfCurrentPhase).toInt()
|
|
||||||
val _tmpTotalScore: Int
|
|
||||||
_tmpTotalScore = _stmt.getLong(_columnIndexOfTotalScore).toInt()
|
|
||||||
val _tmpIsEliminated: Boolean
|
|
||||||
val _tmp: Int
|
|
||||||
_tmp = _stmt.getLong(_columnIndexOfIsEliminated).toInt()
|
|
||||||
_tmpIsEliminated = _tmp != 0
|
|
||||||
_item = GamePlayerEntity(_tmpId,_tmpGameId,_tmpPlayerId,_tmpPlayerName,_tmpTurnOrder,_tmpCurrentPhase,_tmpTotalScore,_tmpIsEliminated)
|
|
||||||
_result.add(_item)
|
|
||||||
}
|
|
||||||
_result
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun getGamePlayerById(id: Long): GamePlayerEntity? {
|
|
||||||
val _sql: String = "SELECT * FROM game_players WHERE id = ?"
|
|
||||||
return performSuspending(__db, true, false) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
var _argIndex: Int = 1
|
|
||||||
_stmt.bindLong(_argIndex, id)
|
|
||||||
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
|
|
||||||
val _columnIndexOfGameId: Int = getColumnIndexOrThrow(_stmt, "gameId")
|
|
||||||
val _columnIndexOfPlayerId: Int = getColumnIndexOrThrow(_stmt, "playerId")
|
|
||||||
val _columnIndexOfPlayerName: Int = getColumnIndexOrThrow(_stmt, "playerName")
|
|
||||||
val _columnIndexOfTurnOrder: Int = getColumnIndexOrThrow(_stmt, "turnOrder")
|
|
||||||
val _columnIndexOfCurrentPhase: Int = getColumnIndexOrThrow(_stmt, "currentPhase")
|
|
||||||
val _columnIndexOfTotalScore: Int = getColumnIndexOrThrow(_stmt, "totalScore")
|
|
||||||
val _columnIndexOfIsEliminated: Int = getColumnIndexOrThrow(_stmt, "isEliminated")
|
|
||||||
val _result: GamePlayerEntity?
|
|
||||||
if (_stmt.step()) {
|
|
||||||
val _tmpId: Long
|
|
||||||
_tmpId = _stmt.getLong(_columnIndexOfId)
|
|
||||||
val _tmpGameId: Long
|
|
||||||
_tmpGameId = _stmt.getLong(_columnIndexOfGameId)
|
|
||||||
val _tmpPlayerId: Long
|
|
||||||
_tmpPlayerId = _stmt.getLong(_columnIndexOfPlayerId)
|
|
||||||
val _tmpPlayerName: String
|
|
||||||
_tmpPlayerName = _stmt.getText(_columnIndexOfPlayerName)
|
|
||||||
val _tmpTurnOrder: Int
|
|
||||||
_tmpTurnOrder = _stmt.getLong(_columnIndexOfTurnOrder).toInt()
|
|
||||||
val _tmpCurrentPhase: Int
|
|
||||||
_tmpCurrentPhase = _stmt.getLong(_columnIndexOfCurrentPhase).toInt()
|
|
||||||
val _tmpTotalScore: Int
|
|
||||||
_tmpTotalScore = _stmt.getLong(_columnIndexOfTotalScore).toInt()
|
|
||||||
val _tmpIsEliminated: Boolean
|
|
||||||
val _tmp: Int
|
|
||||||
_tmp = _stmt.getLong(_columnIndexOfIsEliminated).toInt()
|
|
||||||
_tmpIsEliminated = _tmp != 0
|
|
||||||
_result = GamePlayerEntity(_tmpId,_tmpGameId,_tmpPlayerId,_tmpPlayerName,_tmpTurnOrder,_tmpCurrentPhase,_tmpTotalScore,_tmpIsEliminated)
|
|
||||||
} else {
|
|
||||||
_result = null
|
|
||||||
}
|
|
||||||
_result
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public companion object {
|
|
||||||
public fun getRequiredConverters(): List<KClass<*>> = emptyList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-244
@@ -1,244 +0,0 @@
|
|||||||
package com.crsmthw.phase10tracker.`data`.db
|
|
||||||
|
|
||||||
import androidx.room.InvalidationTracker
|
|
||||||
import androidx.room.RoomOpenDelegate
|
|
||||||
import androidx.room.migration.AutoMigrationSpec
|
|
||||||
import androidx.room.migration.Migration
|
|
||||||
import androidx.room.util.TableInfo
|
|
||||||
import androidx.room.util.TableInfo.Companion.read
|
|
||||||
import androidx.room.util.dropFtsSyncTriggers
|
|
||||||
import androidx.sqlite.SQLiteConnection
|
|
||||||
import androidx.sqlite.execSQL
|
|
||||||
import javax.`annotation`.processing.Generated
|
|
||||||
import kotlin.Lazy
|
|
||||||
import kotlin.String
|
|
||||||
import kotlin.Suppress
|
|
||||||
import kotlin.collections.List
|
|
||||||
import kotlin.collections.Map
|
|
||||||
import kotlin.collections.MutableList
|
|
||||||
import kotlin.collections.MutableMap
|
|
||||||
import kotlin.collections.MutableSet
|
|
||||||
import kotlin.collections.Set
|
|
||||||
import kotlin.collections.mutableListOf
|
|
||||||
import kotlin.collections.mutableMapOf
|
|
||||||
import kotlin.collections.mutableSetOf
|
|
||||||
import kotlin.reflect.KClass
|
|
||||||
|
|
||||||
@Generated(value = ["androidx.room.RoomProcessor"])
|
|
||||||
@Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
|
|
||||||
public class Phase10Database_Impl : Phase10Database() {
|
|
||||||
private val _playerDao: Lazy<PlayerDao> = lazy {
|
|
||||||
PlayerDao_Impl(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
private val _gameDao: Lazy<GameDao> = lazy {
|
|
||||||
GameDao_Impl(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
private val _gamePlayerDao: Lazy<GamePlayerDao> = lazy {
|
|
||||||
GamePlayerDao_Impl(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
private val _roundDao: Lazy<RoundDao> = lazy {
|
|
||||||
RoundDao_Impl(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
private val _customRuleSetDao: Lazy<CustomRuleSetDao> = lazy {
|
|
||||||
CustomRuleSetDao_Impl(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override fun createOpenDelegate(): RoomOpenDelegate {
|
|
||||||
val _openDelegate: RoomOpenDelegate = object : RoomOpenDelegate(2, "be786709a45966a71ad994200bfac1b8", "51f981e3a9729a09288d6faabd6b815f") {
|
|
||||||
public override fun createAllTables(connection: SQLiteConnection) {
|
|
||||||
connection.execSQL("CREATE TABLE IF NOT EXISTS `players` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `gamesPlayed` INTEGER NOT NULL, `gamesWon` INTEGER NOT NULL, `createdAt` INTEGER NOT NULL)")
|
|
||||||
connection.execSQL("CREATE TABLE IF NOT EXISTS `games` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `startedAt` INTEGER NOT NULL, `finishedAt` INTEGER, `isComplete` INTEGER NOT NULL, `winnerId` INTEGER, `currentRound` INTEGER NOT NULL, `currentDealerIndex` INTEGER NOT NULL)")
|
|
||||||
connection.execSQL("CREATE TABLE IF NOT EXISTS `game_players` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `gameId` INTEGER NOT NULL, `playerId` INTEGER NOT NULL, `playerName` TEXT NOT NULL, `turnOrder` INTEGER NOT NULL, `currentPhase` INTEGER NOT NULL, `totalScore` INTEGER NOT NULL, `isEliminated` INTEGER NOT NULL, FOREIGN KEY(`gameId`) REFERENCES `games`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`playerId`) REFERENCES `players`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )")
|
|
||||||
connection.execSQL("CREATE INDEX IF NOT EXISTS `index_game_players_gameId` ON `game_players` (`gameId`)")
|
|
||||||
connection.execSQL("CREATE INDEX IF NOT EXISTS `index_game_players_playerId` ON `game_players` (`playerId`)")
|
|
||||||
connection.execSQL("CREATE TABLE IF NOT EXISTS `rounds` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `gameId` INTEGER NOT NULL, `gamePlayerId` INTEGER NOT NULL, `roundNumber` INTEGER NOT NULL, `score` INTEGER NOT NULL, `phaseCompleted` INTEGER NOT NULL, `phaseAtRoundStart` INTEGER NOT NULL, FOREIGN KEY(`gameId`) REFERENCES `games`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`gamePlayerId`) REFERENCES `game_players`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )")
|
|
||||||
connection.execSQL("CREATE INDEX IF NOT EXISTS `index_rounds_gameId` ON `rounds` (`gameId`)")
|
|
||||||
connection.execSQL("CREATE INDEX IF NOT EXISTS `index_rounds_gamePlayerId` ON `rounds` (`gamePlayerId`)")
|
|
||||||
connection.execSQL("CREATE TABLE IF NOT EXISTS `custom_rule_sets` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `rulesJson` TEXT NOT NULL, `createdAt` INTEGER NOT NULL)")
|
|
||||||
connection.execSQL("CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)")
|
|
||||||
connection.execSQL("INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'be786709a45966a71ad994200bfac1b8')")
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun dropAllTables(connection: SQLiteConnection) {
|
|
||||||
connection.execSQL("DROP TABLE IF EXISTS `players`")
|
|
||||||
connection.execSQL("DROP TABLE IF EXISTS `games`")
|
|
||||||
connection.execSQL("DROP TABLE IF EXISTS `game_players`")
|
|
||||||
connection.execSQL("DROP TABLE IF EXISTS `rounds`")
|
|
||||||
connection.execSQL("DROP TABLE IF EXISTS `custom_rule_sets`")
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun onCreate(connection: SQLiteConnection) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun onOpen(connection: SQLiteConnection) {
|
|
||||||
connection.execSQL("PRAGMA foreign_keys = ON")
|
|
||||||
internalInitInvalidationTracker(connection)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun onPreMigrate(connection: SQLiteConnection) {
|
|
||||||
dropFtsSyncTriggers(connection)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun onPostMigrate(connection: SQLiteConnection) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun onValidateSchema(connection: SQLiteConnection): RoomOpenDelegate.ValidationResult {
|
|
||||||
val _columnsPlayers: MutableMap<String, TableInfo.Column> = mutableMapOf()
|
|
||||||
_columnsPlayers.put("id", TableInfo.Column("id", "INTEGER", true, 1, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsPlayers.put("name", TableInfo.Column("name", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsPlayers.put("gamesPlayed", TableInfo.Column("gamesPlayed", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsPlayers.put("gamesWon", TableInfo.Column("gamesWon", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsPlayers.put("createdAt", TableInfo.Column("createdAt", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
val _foreignKeysPlayers: MutableSet<TableInfo.ForeignKey> = mutableSetOf()
|
|
||||||
val _indicesPlayers: MutableSet<TableInfo.Index> = mutableSetOf()
|
|
||||||
val _infoPlayers: TableInfo = TableInfo("players", _columnsPlayers, _foreignKeysPlayers, _indicesPlayers)
|
|
||||||
val _existingPlayers: TableInfo = read(connection, "players")
|
|
||||||
if (!_infoPlayers.equals(_existingPlayers)) {
|
|
||||||
return RoomOpenDelegate.ValidationResult(false, """
|
|
||||||
|players(com.crsmthw.phase10tracker.data.model.PlayerEntity).
|
|
||||||
| Expected:
|
|
||||||
|""".trimMargin() + _infoPlayers + """
|
|
||||||
|
|
|
||||||
| Found:
|
|
||||||
|""".trimMargin() + _existingPlayers)
|
|
||||||
}
|
|
||||||
val _columnsGames: MutableMap<String, TableInfo.Column> = mutableMapOf()
|
|
||||||
_columnsGames.put("id", TableInfo.Column("id", "INTEGER", true, 1, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGames.put("startedAt", TableInfo.Column("startedAt", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGames.put("finishedAt", TableInfo.Column("finishedAt", "INTEGER", false, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGames.put("isComplete", TableInfo.Column("isComplete", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGames.put("winnerId", TableInfo.Column("winnerId", "INTEGER", false, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGames.put("currentRound", TableInfo.Column("currentRound", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGames.put("currentDealerIndex", TableInfo.Column("currentDealerIndex", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
val _foreignKeysGames: MutableSet<TableInfo.ForeignKey> = mutableSetOf()
|
|
||||||
val _indicesGames: MutableSet<TableInfo.Index> = mutableSetOf()
|
|
||||||
val _infoGames: TableInfo = TableInfo("games", _columnsGames, _foreignKeysGames, _indicesGames)
|
|
||||||
val _existingGames: TableInfo = read(connection, "games")
|
|
||||||
if (!_infoGames.equals(_existingGames)) {
|
|
||||||
return RoomOpenDelegate.ValidationResult(false, """
|
|
||||||
|games(com.crsmthw.phase10tracker.data.model.GameEntity).
|
|
||||||
| Expected:
|
|
||||||
|""".trimMargin() + _infoGames + """
|
|
||||||
|
|
|
||||||
| Found:
|
|
||||||
|""".trimMargin() + _existingGames)
|
|
||||||
}
|
|
||||||
val _columnsGamePlayers: MutableMap<String, TableInfo.Column> = mutableMapOf()
|
|
||||||
_columnsGamePlayers.put("id", TableInfo.Column("id", "INTEGER", true, 1, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGamePlayers.put("gameId", TableInfo.Column("gameId", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGamePlayers.put("playerId", TableInfo.Column("playerId", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGamePlayers.put("playerName", TableInfo.Column("playerName", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGamePlayers.put("turnOrder", TableInfo.Column("turnOrder", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGamePlayers.put("currentPhase", TableInfo.Column("currentPhase", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGamePlayers.put("totalScore", TableInfo.Column("totalScore", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsGamePlayers.put("isEliminated", TableInfo.Column("isEliminated", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
val _foreignKeysGamePlayers: MutableSet<TableInfo.ForeignKey> = mutableSetOf()
|
|
||||||
_foreignKeysGamePlayers.add(TableInfo.ForeignKey("games", "CASCADE", "NO ACTION", listOf("gameId"), listOf("id")))
|
|
||||||
_foreignKeysGamePlayers.add(TableInfo.ForeignKey("players", "CASCADE", "NO ACTION", listOf("playerId"), listOf("id")))
|
|
||||||
val _indicesGamePlayers: MutableSet<TableInfo.Index> = mutableSetOf()
|
|
||||||
_indicesGamePlayers.add(TableInfo.Index("index_game_players_gameId", false, listOf("gameId"), listOf("ASC")))
|
|
||||||
_indicesGamePlayers.add(TableInfo.Index("index_game_players_playerId", false, listOf("playerId"), listOf("ASC")))
|
|
||||||
val _infoGamePlayers: TableInfo = TableInfo("game_players", _columnsGamePlayers, _foreignKeysGamePlayers, _indicesGamePlayers)
|
|
||||||
val _existingGamePlayers: TableInfo = read(connection, "game_players")
|
|
||||||
if (!_infoGamePlayers.equals(_existingGamePlayers)) {
|
|
||||||
return RoomOpenDelegate.ValidationResult(false, """
|
|
||||||
|game_players(com.crsmthw.phase10tracker.data.model.GamePlayerEntity).
|
|
||||||
| Expected:
|
|
||||||
|""".trimMargin() + _infoGamePlayers + """
|
|
||||||
|
|
|
||||||
| Found:
|
|
||||||
|""".trimMargin() + _existingGamePlayers)
|
|
||||||
}
|
|
||||||
val _columnsRounds: MutableMap<String, TableInfo.Column> = mutableMapOf()
|
|
||||||
_columnsRounds.put("id", TableInfo.Column("id", "INTEGER", true, 1, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsRounds.put("gameId", TableInfo.Column("gameId", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsRounds.put("gamePlayerId", TableInfo.Column("gamePlayerId", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsRounds.put("roundNumber", TableInfo.Column("roundNumber", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsRounds.put("score", TableInfo.Column("score", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsRounds.put("phaseCompleted", TableInfo.Column("phaseCompleted", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsRounds.put("phaseAtRoundStart", TableInfo.Column("phaseAtRoundStart", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
val _foreignKeysRounds: MutableSet<TableInfo.ForeignKey> = mutableSetOf()
|
|
||||||
_foreignKeysRounds.add(TableInfo.ForeignKey("games", "CASCADE", "NO ACTION", listOf("gameId"), listOf("id")))
|
|
||||||
_foreignKeysRounds.add(TableInfo.ForeignKey("game_players", "CASCADE", "NO ACTION", listOf("gamePlayerId"), listOf("id")))
|
|
||||||
val _indicesRounds: MutableSet<TableInfo.Index> = mutableSetOf()
|
|
||||||
_indicesRounds.add(TableInfo.Index("index_rounds_gameId", false, listOf("gameId"), listOf("ASC")))
|
|
||||||
_indicesRounds.add(TableInfo.Index("index_rounds_gamePlayerId", false, listOf("gamePlayerId"), listOf("ASC")))
|
|
||||||
val _infoRounds: TableInfo = TableInfo("rounds", _columnsRounds, _foreignKeysRounds, _indicesRounds)
|
|
||||||
val _existingRounds: TableInfo = read(connection, "rounds")
|
|
||||||
if (!_infoRounds.equals(_existingRounds)) {
|
|
||||||
return RoomOpenDelegate.ValidationResult(false, """
|
|
||||||
|rounds(com.crsmthw.phase10tracker.data.model.RoundEntity).
|
|
||||||
| Expected:
|
|
||||||
|""".trimMargin() + _infoRounds + """
|
|
||||||
|
|
|
||||||
| Found:
|
|
||||||
|""".trimMargin() + _existingRounds)
|
|
||||||
}
|
|
||||||
val _columnsCustomRuleSets: MutableMap<String, TableInfo.Column> = mutableMapOf()
|
|
||||||
_columnsCustomRuleSets.put("id", TableInfo.Column("id", "INTEGER", true, 1, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsCustomRuleSets.put("name", TableInfo.Column("name", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsCustomRuleSets.put("rulesJson", TableInfo.Column("rulesJson", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
_columnsCustomRuleSets.put("createdAt", TableInfo.Column("createdAt", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY))
|
|
||||||
val _foreignKeysCustomRuleSets: MutableSet<TableInfo.ForeignKey> = mutableSetOf()
|
|
||||||
val _indicesCustomRuleSets: MutableSet<TableInfo.Index> = mutableSetOf()
|
|
||||||
val _infoCustomRuleSets: TableInfo = TableInfo("custom_rule_sets", _columnsCustomRuleSets, _foreignKeysCustomRuleSets, _indicesCustomRuleSets)
|
|
||||||
val _existingCustomRuleSets: TableInfo = read(connection, "custom_rule_sets")
|
|
||||||
if (!_infoCustomRuleSets.equals(_existingCustomRuleSets)) {
|
|
||||||
return RoomOpenDelegate.ValidationResult(false, """
|
|
||||||
|custom_rule_sets(com.crsmthw.phase10tracker.data.model.CustomRuleSetEntity).
|
|
||||||
| Expected:
|
|
||||||
|""".trimMargin() + _infoCustomRuleSets + """
|
|
||||||
|
|
|
||||||
| Found:
|
|
||||||
|""".trimMargin() + _existingCustomRuleSets)
|
|
||||||
}
|
|
||||||
return RoomOpenDelegate.ValidationResult(true, null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _openDelegate
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override fun createInvalidationTracker(): InvalidationTracker {
|
|
||||||
val _shadowTablesMap: MutableMap<String, String> = mutableMapOf()
|
|
||||||
val _viewTables: MutableMap<String, Set<String>> = mutableMapOf()
|
|
||||||
return InvalidationTracker(this, _shadowTablesMap, _viewTables, "players", "games", "game_players", "rounds", "custom_rule_sets")
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun clearAllTables() {
|
|
||||||
super.performClear(true, "players", "games", "game_players", "rounds", "custom_rule_sets")
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override fun getRequiredTypeConverterClasses(): Map<KClass<*>, List<KClass<*>>> {
|
|
||||||
val _typeConvertersMap: MutableMap<KClass<*>, List<KClass<*>>> = mutableMapOf()
|
|
||||||
_typeConvertersMap.put(PlayerDao::class, PlayerDao_Impl.getRequiredConverters())
|
|
||||||
_typeConvertersMap.put(GameDao::class, GameDao_Impl.getRequiredConverters())
|
|
||||||
_typeConvertersMap.put(GamePlayerDao::class, GamePlayerDao_Impl.getRequiredConverters())
|
|
||||||
_typeConvertersMap.put(RoundDao::class, RoundDao_Impl.getRequiredConverters())
|
|
||||||
_typeConvertersMap.put(CustomRuleSetDao::class, CustomRuleSetDao_Impl.getRequiredConverters())
|
|
||||||
return _typeConvertersMap
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun getRequiredAutoMigrationSpecClasses(): Set<KClass<out AutoMigrationSpec>> {
|
|
||||||
val _autoMigrationSpecsSet: MutableSet<KClass<out AutoMigrationSpec>> = mutableSetOf()
|
|
||||||
return _autoMigrationSpecsSet
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun createAutoMigrations(autoMigrationSpecs: Map<KClass<out AutoMigrationSpec>, AutoMigrationSpec>): List<Migration> {
|
|
||||||
val _autoMigrations: MutableList<Migration> = mutableListOf()
|
|
||||||
return _autoMigrations
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun playerDao(): PlayerDao = _playerDao.value
|
|
||||||
|
|
||||||
public override fun gameDao(): GameDao = _gameDao.value
|
|
||||||
|
|
||||||
public override fun gamePlayerDao(): GamePlayerDao = _gamePlayerDao.value
|
|
||||||
|
|
||||||
public override fun roundDao(): RoundDao = _roundDao.value
|
|
||||||
|
|
||||||
public override fun customRuleSetDao(): CustomRuleSetDao = _customRuleSetDao.value
|
|
||||||
}
|
|
||||||
-191
@@ -1,191 +0,0 @@
|
|||||||
package com.crsmthw.phase10tracker.`data`.db
|
|
||||||
|
|
||||||
import androidx.room.EntityDeleteOrUpdateAdapter
|
|
||||||
import androidx.room.EntityInsertAdapter
|
|
||||||
import androidx.room.RoomDatabase
|
|
||||||
import androidx.room.coroutines.createFlow
|
|
||||||
import androidx.room.util.appendPlaceholders
|
|
||||||
import androidx.room.util.getColumnIndexOrThrow
|
|
||||||
import androidx.room.util.performSuspending
|
|
||||||
import androidx.sqlite.SQLiteStatement
|
|
||||||
import com.crsmthw.phase10tracker.`data`.model.PlayerEntity
|
|
||||||
import javax.`annotation`.processing.Generated
|
|
||||||
import kotlin.Int
|
|
||||||
import kotlin.Long
|
|
||||||
import kotlin.String
|
|
||||||
import kotlin.Suppress
|
|
||||||
import kotlin.Unit
|
|
||||||
import kotlin.collections.List
|
|
||||||
import kotlin.collections.MutableList
|
|
||||||
import kotlin.collections.mutableListOf
|
|
||||||
import kotlin.reflect.KClass
|
|
||||||
import kotlin.text.StringBuilder
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
|
||||||
|
|
||||||
@Generated(value = ["androidx.room.RoomProcessor"])
|
|
||||||
@Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
|
|
||||||
public class PlayerDao_Impl(
|
|
||||||
__db: RoomDatabase,
|
|
||||||
) : PlayerDao {
|
|
||||||
private val __db: RoomDatabase
|
|
||||||
|
|
||||||
private val __insertAdapterOfPlayerEntity: EntityInsertAdapter<PlayerEntity>
|
|
||||||
|
|
||||||
private val __deleteAdapterOfPlayerEntity: EntityDeleteOrUpdateAdapter<PlayerEntity>
|
|
||||||
|
|
||||||
private val __updateAdapterOfPlayerEntity: EntityDeleteOrUpdateAdapter<PlayerEntity>
|
|
||||||
init {
|
|
||||||
this.__db = __db
|
|
||||||
this.__insertAdapterOfPlayerEntity = object : EntityInsertAdapter<PlayerEntity>() {
|
|
||||||
protected override fun createQuery(): String = "INSERT OR REPLACE INTO `players` (`id`,`name`,`gamesPlayed`,`gamesWon`,`createdAt`) VALUES (nullif(?, 0),?,?,?,?)"
|
|
||||||
|
|
||||||
protected override fun bind(statement: SQLiteStatement, entity: PlayerEntity) {
|
|
||||||
statement.bindLong(1, entity.id)
|
|
||||||
statement.bindText(2, entity.name)
|
|
||||||
statement.bindLong(3, entity.gamesPlayed.toLong())
|
|
||||||
statement.bindLong(4, entity.gamesWon.toLong())
|
|
||||||
statement.bindLong(5, entity.createdAt)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.__deleteAdapterOfPlayerEntity = object : EntityDeleteOrUpdateAdapter<PlayerEntity>() {
|
|
||||||
protected override fun createQuery(): String = "DELETE FROM `players` WHERE `id` = ?"
|
|
||||||
|
|
||||||
protected override fun bind(statement: SQLiteStatement, entity: PlayerEntity) {
|
|
||||||
statement.bindLong(1, entity.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.__updateAdapterOfPlayerEntity = object : EntityDeleteOrUpdateAdapter<PlayerEntity>() {
|
|
||||||
protected override fun createQuery(): String = "UPDATE OR ABORT `players` SET `id` = ?,`name` = ?,`gamesPlayed` = ?,`gamesWon` = ?,`createdAt` = ? WHERE `id` = ?"
|
|
||||||
|
|
||||||
protected override fun bind(statement: SQLiteStatement, entity: PlayerEntity) {
|
|
||||||
statement.bindLong(1, entity.id)
|
|
||||||
statement.bindText(2, entity.name)
|
|
||||||
statement.bindLong(3, entity.gamesPlayed.toLong())
|
|
||||||
statement.bindLong(4, entity.gamesWon.toLong())
|
|
||||||
statement.bindLong(5, entity.createdAt)
|
|
||||||
statement.bindLong(6, entity.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun insertPlayer(player: PlayerEntity): Long = performSuspending(__db, false, true) { _connection ->
|
|
||||||
val _result: Long = __insertAdapterOfPlayerEntity.insertAndReturnId(_connection, player)
|
|
||||||
_result
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun deletePlayer(player: PlayerEntity): Unit = performSuspending(__db, false, true) { _connection ->
|
|
||||||
__deleteAdapterOfPlayerEntity.handle(_connection, player)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun updatePlayer(player: PlayerEntity): Unit = performSuspending(__db, false, true) { _connection ->
|
|
||||||
__updateAdapterOfPlayerEntity.handle(_connection, player)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun getAllPlayers(): Flow<List<PlayerEntity>> {
|
|
||||||
val _sql: String = "SELECT * FROM players ORDER BY name ASC"
|
|
||||||
return createFlow(__db, false, arrayOf("players")) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
|
|
||||||
val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "name")
|
|
||||||
val _columnIndexOfGamesPlayed: Int = getColumnIndexOrThrow(_stmt, "gamesPlayed")
|
|
||||||
val _columnIndexOfGamesWon: Int = getColumnIndexOrThrow(_stmt, "gamesWon")
|
|
||||||
val _columnIndexOfCreatedAt: Int = getColumnIndexOrThrow(_stmt, "createdAt")
|
|
||||||
val _result: MutableList<PlayerEntity> = mutableListOf()
|
|
||||||
while (_stmt.step()) {
|
|
||||||
val _item: PlayerEntity
|
|
||||||
val _tmpId: Long
|
|
||||||
_tmpId = _stmt.getLong(_columnIndexOfId)
|
|
||||||
val _tmpName: String
|
|
||||||
_tmpName = _stmt.getText(_columnIndexOfName)
|
|
||||||
val _tmpGamesPlayed: Int
|
|
||||||
_tmpGamesPlayed = _stmt.getLong(_columnIndexOfGamesPlayed).toInt()
|
|
||||||
val _tmpGamesWon: Int
|
|
||||||
_tmpGamesWon = _stmt.getLong(_columnIndexOfGamesWon).toInt()
|
|
||||||
val _tmpCreatedAt: Long
|
|
||||||
_tmpCreatedAt = _stmt.getLong(_columnIndexOfCreatedAt)
|
|
||||||
_item = PlayerEntity(_tmpId,_tmpName,_tmpGamesPlayed,_tmpGamesWon,_tmpCreatedAt)
|
|
||||||
_result.add(_item)
|
|
||||||
}
|
|
||||||
_result
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun getPlayerById(id: Long): PlayerEntity? {
|
|
||||||
val _sql: String = "SELECT * FROM players WHERE id = ?"
|
|
||||||
return performSuspending(__db, true, false) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
var _argIndex: Int = 1
|
|
||||||
_stmt.bindLong(_argIndex, id)
|
|
||||||
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
|
|
||||||
val _columnIndexOfName: Int = getColumnIndexOrThrow(_stmt, "name")
|
|
||||||
val _columnIndexOfGamesPlayed: Int = getColumnIndexOrThrow(_stmt, "gamesPlayed")
|
|
||||||
val _columnIndexOfGamesWon: Int = getColumnIndexOrThrow(_stmt, "gamesWon")
|
|
||||||
val _columnIndexOfCreatedAt: Int = getColumnIndexOrThrow(_stmt, "createdAt")
|
|
||||||
val _result: PlayerEntity?
|
|
||||||
if (_stmt.step()) {
|
|
||||||
val _tmpId: Long
|
|
||||||
_tmpId = _stmt.getLong(_columnIndexOfId)
|
|
||||||
val _tmpName: String
|
|
||||||
_tmpName = _stmt.getText(_columnIndexOfName)
|
|
||||||
val _tmpGamesPlayed: Int
|
|
||||||
_tmpGamesPlayed = _stmt.getLong(_columnIndexOfGamesPlayed).toInt()
|
|
||||||
val _tmpGamesWon: Int
|
|
||||||
_tmpGamesWon = _stmt.getLong(_columnIndexOfGamesWon).toInt()
|
|
||||||
val _tmpCreatedAt: Long
|
|
||||||
_tmpCreatedAt = _stmt.getLong(_columnIndexOfCreatedAt)
|
|
||||||
_result = PlayerEntity(_tmpId,_tmpName,_tmpGamesPlayed,_tmpGamesWon,_tmpCreatedAt)
|
|
||||||
} else {
|
|
||||||
_result = null
|
|
||||||
}
|
|
||||||
_result
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun incrementGamesPlayed(ids: List<Long>) {
|
|
||||||
val _stringBuilder: StringBuilder = StringBuilder()
|
|
||||||
_stringBuilder.append("UPDATE players SET gamesPlayed = gamesPlayed + 1 WHERE id IN (")
|
|
||||||
val _inputSize: Int = ids.size
|
|
||||||
appendPlaceholders(_stringBuilder, _inputSize)
|
|
||||||
_stringBuilder.append(")")
|
|
||||||
val _sql: String = _stringBuilder.toString()
|
|
||||||
return performSuspending(__db, false, true) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
var _argIndex: Int = 1
|
|
||||||
for (_item: Long in ids) {
|
|
||||||
_stmt.bindLong(_argIndex, _item)
|
|
||||||
_argIndex++
|
|
||||||
}
|
|
||||||
_stmt.step()
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun incrementGamesWon(id: Long) {
|
|
||||||
val _sql: String = "UPDATE players SET gamesWon = gamesWon + 1 WHERE id = ?"
|
|
||||||
return performSuspending(__db, false, true) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
var _argIndex: Int = 1
|
|
||||||
_stmt.bindLong(_argIndex, id)
|
|
||||||
_stmt.step()
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public companion object {
|
|
||||||
public fun getRequiredConverters(): List<KClass<*>> = emptyList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-142
@@ -1,142 +0,0 @@
|
|||||||
package com.crsmthw.phase10tracker.`data`.db
|
|
||||||
|
|
||||||
import androidx.room.EntityInsertAdapter
|
|
||||||
import androidx.room.RoomDatabase
|
|
||||||
import androidx.room.coroutines.createFlow
|
|
||||||
import androidx.room.util.getColumnIndexOrThrow
|
|
||||||
import androidx.room.util.performSuspending
|
|
||||||
import androidx.sqlite.SQLiteStatement
|
|
||||||
import com.crsmthw.phase10tracker.`data`.model.RoundEntity
|
|
||||||
import javax.`annotation`.processing.Generated
|
|
||||||
import kotlin.Boolean
|
|
||||||
import kotlin.Int
|
|
||||||
import kotlin.Long
|
|
||||||
import kotlin.String
|
|
||||||
import kotlin.Suppress
|
|
||||||
import kotlin.Unit
|
|
||||||
import kotlin.collections.List
|
|
||||||
import kotlin.collections.MutableList
|
|
||||||
import kotlin.collections.mutableListOf
|
|
||||||
import kotlin.reflect.KClass
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
|
||||||
|
|
||||||
@Generated(value = ["androidx.room.RoomProcessor"])
|
|
||||||
@Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
|
|
||||||
public class RoundDao_Impl(
|
|
||||||
__db: RoomDatabase,
|
|
||||||
) : RoundDao {
|
|
||||||
private val __db: RoomDatabase
|
|
||||||
|
|
||||||
private val __insertAdapterOfRoundEntity: EntityInsertAdapter<RoundEntity>
|
|
||||||
init {
|
|
||||||
this.__db = __db
|
|
||||||
this.__insertAdapterOfRoundEntity = object : EntityInsertAdapter<RoundEntity>() {
|
|
||||||
protected override fun createQuery(): String = "INSERT OR REPLACE INTO `rounds` (`id`,`gameId`,`gamePlayerId`,`roundNumber`,`score`,`phaseCompleted`,`phaseAtRoundStart`) VALUES (nullif(?, 0),?,?,?,?,?,?)"
|
|
||||||
|
|
||||||
protected override fun bind(statement: SQLiteStatement, entity: RoundEntity) {
|
|
||||||
statement.bindLong(1, entity.id)
|
|
||||||
statement.bindLong(2, entity.gameId)
|
|
||||||
statement.bindLong(3, entity.gamePlayerId)
|
|
||||||
statement.bindLong(4, entity.roundNumber.toLong())
|
|
||||||
statement.bindLong(5, entity.score.toLong())
|
|
||||||
val _tmp: Int = if (entity.phaseCompleted) 1 else 0
|
|
||||||
statement.bindLong(6, _tmp.toLong())
|
|
||||||
statement.bindLong(7, entity.phaseAtRoundStart.toLong())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun insertRounds(rounds: List<RoundEntity>): Unit = performSuspending(__db, false, true) { _connection ->
|
|
||||||
__insertAdapterOfRoundEntity.insert(_connection, rounds)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun getRoundsForGame(gameId: Long): Flow<List<RoundEntity>> {
|
|
||||||
val _sql: String = "SELECT * FROM rounds WHERE gameId = ? ORDER BY roundNumber ASC"
|
|
||||||
return createFlow(__db, false, arrayOf("rounds")) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
var _argIndex: Int = 1
|
|
||||||
_stmt.bindLong(_argIndex, gameId)
|
|
||||||
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
|
|
||||||
val _columnIndexOfGameId: Int = getColumnIndexOrThrow(_stmt, "gameId")
|
|
||||||
val _columnIndexOfGamePlayerId: Int = getColumnIndexOrThrow(_stmt, "gamePlayerId")
|
|
||||||
val _columnIndexOfRoundNumber: Int = getColumnIndexOrThrow(_stmt, "roundNumber")
|
|
||||||
val _columnIndexOfScore: Int = getColumnIndexOrThrow(_stmt, "score")
|
|
||||||
val _columnIndexOfPhaseCompleted: Int = getColumnIndexOrThrow(_stmt, "phaseCompleted")
|
|
||||||
val _columnIndexOfPhaseAtRoundStart: Int = getColumnIndexOrThrow(_stmt, "phaseAtRoundStart")
|
|
||||||
val _result: MutableList<RoundEntity> = mutableListOf()
|
|
||||||
while (_stmt.step()) {
|
|
||||||
val _item: RoundEntity
|
|
||||||
val _tmpId: Long
|
|
||||||
_tmpId = _stmt.getLong(_columnIndexOfId)
|
|
||||||
val _tmpGameId: Long
|
|
||||||
_tmpGameId = _stmt.getLong(_columnIndexOfGameId)
|
|
||||||
val _tmpGamePlayerId: Long
|
|
||||||
_tmpGamePlayerId = _stmt.getLong(_columnIndexOfGamePlayerId)
|
|
||||||
val _tmpRoundNumber: Int
|
|
||||||
_tmpRoundNumber = _stmt.getLong(_columnIndexOfRoundNumber).toInt()
|
|
||||||
val _tmpScore: Int
|
|
||||||
_tmpScore = _stmt.getLong(_columnIndexOfScore).toInt()
|
|
||||||
val _tmpPhaseCompleted: Boolean
|
|
||||||
val _tmp: Int
|
|
||||||
_tmp = _stmt.getLong(_columnIndexOfPhaseCompleted).toInt()
|
|
||||||
_tmpPhaseCompleted = _tmp != 0
|
|
||||||
val _tmpPhaseAtRoundStart: Int
|
|
||||||
_tmpPhaseAtRoundStart = _stmt.getLong(_columnIndexOfPhaseAtRoundStart).toInt()
|
|
||||||
_item = RoundEntity(_tmpId,_tmpGameId,_tmpGamePlayerId,_tmpRoundNumber,_tmpScore,_tmpPhaseCompleted,_tmpPhaseAtRoundStart)
|
|
||||||
_result.add(_item)
|
|
||||||
}
|
|
||||||
_result
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override suspend fun getRoundsForPlayer(gamePlayerId: Long): List<RoundEntity> {
|
|
||||||
val _sql: String = "SELECT * FROM rounds WHERE gamePlayerId = ? ORDER BY roundNumber ASC"
|
|
||||||
return performSuspending(__db, true, false) { _connection ->
|
|
||||||
val _stmt: SQLiteStatement = _connection.prepare(_sql)
|
|
||||||
try {
|
|
||||||
var _argIndex: Int = 1
|
|
||||||
_stmt.bindLong(_argIndex, gamePlayerId)
|
|
||||||
val _columnIndexOfId: Int = getColumnIndexOrThrow(_stmt, "id")
|
|
||||||
val _columnIndexOfGameId: Int = getColumnIndexOrThrow(_stmt, "gameId")
|
|
||||||
val _columnIndexOfGamePlayerId: Int = getColumnIndexOrThrow(_stmt, "gamePlayerId")
|
|
||||||
val _columnIndexOfRoundNumber: Int = getColumnIndexOrThrow(_stmt, "roundNumber")
|
|
||||||
val _columnIndexOfScore: Int = getColumnIndexOrThrow(_stmt, "score")
|
|
||||||
val _columnIndexOfPhaseCompleted: Int = getColumnIndexOrThrow(_stmt, "phaseCompleted")
|
|
||||||
val _columnIndexOfPhaseAtRoundStart: Int = getColumnIndexOrThrow(_stmt, "phaseAtRoundStart")
|
|
||||||
val _result: MutableList<RoundEntity> = mutableListOf()
|
|
||||||
while (_stmt.step()) {
|
|
||||||
val _item: RoundEntity
|
|
||||||
val _tmpId: Long
|
|
||||||
_tmpId = _stmt.getLong(_columnIndexOfId)
|
|
||||||
val _tmpGameId: Long
|
|
||||||
_tmpGameId = _stmt.getLong(_columnIndexOfGameId)
|
|
||||||
val _tmpGamePlayerId: Long
|
|
||||||
_tmpGamePlayerId = _stmt.getLong(_columnIndexOfGamePlayerId)
|
|
||||||
val _tmpRoundNumber: Int
|
|
||||||
_tmpRoundNumber = _stmt.getLong(_columnIndexOfRoundNumber).toInt()
|
|
||||||
val _tmpScore: Int
|
|
||||||
_tmpScore = _stmt.getLong(_columnIndexOfScore).toInt()
|
|
||||||
val _tmpPhaseCompleted: Boolean
|
|
||||||
val _tmp: Int
|
|
||||||
_tmp = _stmt.getLong(_columnIndexOfPhaseCompleted).toInt()
|
|
||||||
_tmpPhaseCompleted = _tmp != 0
|
|
||||||
val _tmpPhaseAtRoundStart: Int
|
|
||||||
_tmpPhaseAtRoundStart = _stmt.getLong(_columnIndexOfPhaseAtRoundStart).toInt()
|
|
||||||
_item = RoundEntity(_tmpId,_tmpGameId,_tmpGamePlayerId,_tmpRoundNumber,_tmpScore,_tmpPhaseCompleted,_tmpPhaseAtRoundStart)
|
|
||||||
_result.add(_item)
|
|
||||||
}
|
|
||||||
_result
|
|
||||||
} finally {
|
|
||||||
_stmt.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public companion object {
|
|
||||||
public fun getRequiredConverters(): List<KClass<*>> = emptyList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
com.crsmthw.phase10tracker.app-updated_navigation_xml-0 /home/cris/Documents/Phase10Tracker/app/build/generated/updated_navigation_xml/debug
|
|
||||||
com.crsmthw.phase10tracker.app-packageDebugResources-1 /home/cris/Documents/Phase10Tracker/app/build/intermediates/incremental/debug/packageDebugResources/merged.dir
|
|
||||||
com.crsmthw.phase10tracker.app-packageDebugResources-2 /home/cris/Documents/Phase10Tracker/app/build/intermediates/incremental/debug/packageDebugResources/stripped.dir
|
|
||||||
com.crsmthw.phase10tracker.app-debug-3 /home/cris/Documents/Phase10Tracker/app/build/intermediates/merged_res/debug/mergeDebugResources
|
|
||||||
com.crsmthw.phase10tracker.app-debug-4 /home/cris/Documents/Phase10Tracker/app/src/debug/res
|
|
||||||
com.crsmthw.phase10tracker.app-main-5 /home/cris/Documents/Phase10Tracker/app/src/main/res
|
|
||||||
gradleHome-0 /home/cris/.gradle
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"room-compiler-2.8.4.jar (androidx.room:room-compiler:2.8.4)":"KSP_PROCESSOR"}
|
|
||||||
Binary file not shown.
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"artifactType": {
|
|
||||||
"type": "APK",
|
|
||||||
"kind": "Directory"
|
|
||||||
},
|
|
||||||
"applicationId": "com.crsmthw.phase10tracker",
|
|
||||||
"variantName": "debug",
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "SINGLE",
|
|
||||||
"filters": [],
|
|
||||||
"attributes": [],
|
|
||||||
"versionCode": 1,
|
|
||||||
"versionName": "1.0",
|
|
||||||
"outputFile": "app-debug.apk"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"elementType": "File",
|
|
||||||
"minSdkVersionForDexing": 35
|
|
||||||
}
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
#- File Locator -
|
|
||||||
listingFile=../../../apk/debug/output-metadata.json
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
appMetadataVersion=1.1
|
|
||||||
androidGradlePluginVersion=9.2.1
|
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user