Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Room now upgrades with real schema migrations instead of dropping the
database. `StackDatabase` exports its schema (`app/schemas/`) and the
builder runs `MIGRATION_4_5` (adds `game_round`) plus
`fallbackToDestructiveMigrationOnDowngrade`, so the offline cache (news,
wallet, notifications) survives app updates instead of being wiped on a
version bump. Covered by the instrumented `StackDatabaseMigrationTest`
(verifies the news cache survives 4 -> 5).
- `ProvablyFairCore.cpp` no longer depends on OpenSSL. The HMAC-SHA256 helper
delegates to the self-contained implementation in `Sha256.h`.
- JNI export symbols renamed from `com.casino.tpo.engine` to
Expand Down
14 changes: 14 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ android {
compose = true
buildConfig = true
}

// Expose the exported Room schemas to the migration tests so
// MigrationTestHelper can build the old database versions.
sourceSets {
getByName("androidTest").assets.srcDir(files("$projectDir/schemas"))
}
}

// Room exports a JSON schema per version into this directory (see
// exportSchema = true on StackDatabase); the migrations and their tests
// are validated against it.
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}

ktlint {
Expand Down Expand Up @@ -162,6 +175,7 @@ dependencies {
testImplementation(libs.mockk)
testImplementation(libs.turbine)
testImplementation(libs.androidx.room.testing)
androidTestImplementation(libs.androidx.room.testing)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
{
"formatVersion": 1,
"database": {
"version": 4,
"identityHash": "00000000000000000000000000000004",
"entities": [
{
"tableName": "app_settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `pushEnabled` INTEGER NOT NULL, `depositsEnabled` INTEGER NOT NULL, `withdrawalsEnabled` INTEGER NOT NULL, `securityEnabled` INTEGER NOT NULL, `hideBalanceOnLaunch` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "pushEnabled",
"columnName": "pushEnabled",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "depositsEnabled",
"columnName": "depositsEnabled",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "withdrawalsEnabled",
"columnName": "withdrawalsEnabled",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "securityEnabled",
"columnName": "securityEnabled",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hideBalanceOnLaunch",
"columnName": "hideBalanceOnLaunch",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "notification",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `category` TEXT NOT NULL, `title` TEXT NOT NULL, `body` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "category",
"columnName": "category",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "body",
"columnName": "body",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "createdAt",
"columnName": "createdAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isRead",
"columnName": "isRead",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "news_article",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `title` TEXT NOT NULL, `source` TEXT NOT NULL, `description` TEXT, `url` TEXT NOT NULL, `imageUrl` TEXT, `publishedAt` TEXT NOT NULL, `cachedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT"
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT"
},
{
"fieldPath": "publishedAt",
"columnName": "publishedAt",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "cachedAt",
"columnName": "cachedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "wallet",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `availableBalance` REAL NOT NULL, `lockedBalance` REAL NOT NULL, `polygonAddress` TEXT NOT NULL, `currencyCode` TEXT NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "availableBalance",
"columnName": "availableBalance",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "lockedBalance",
"columnName": "lockedBalance",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "polygonAddress",
"columnName": "polygonAddress",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "currencyCode",
"columnName": "currencyCode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatedAt",
"columnName": "updatedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
},
{
"tableName": "wallet_transaction",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `type` TEXT NOT NULL, `status` TEXT NOT NULL, `amount` REAL NOT NULL, `currency` TEXT NOT NULL, `externalReference` TEXT, `destinationAddress` TEXT, `timestamp` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "amount",
"columnName": "amount",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "currency",
"columnName": "currency",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "externalReference",
"columnName": "externalReference",
"affinity": "TEXT"
},
{
"fieldPath": "destinationAddress",
"columnName": "destinationAddress",
"affinity": "TEXT"
},
{
"fieldPath": "timestamp",
"columnName": "timestamp",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
}
}
],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '00000000000000000000000000000004')"
]
}
}
Loading
Loading