friend database test

This commit is contained in:
rhunk 2023-08-08 14:47:05 +02:00
parent 3153c68516
commit 122a48e047
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,48 @@
package me.rhunk.snapenhance.friends
import android.database.sqlite.SQLiteDatabase
import me.rhunk.snapenhance.RemoteSideContext
import me.rhunk.snapenhance.util.SQLiteDatabaseHelper
class FriendDatabase(
private val context: RemoteSideContext,
) {
private lateinit var database: SQLiteDatabase
fun init() {
database = context.androidContext.openOrCreateDatabase("friends.db", 0, null)
SQLiteDatabaseHelper.createTablesFromSchema(database, mapOf(
"friends" to listOf(
"userId VARCHAR PRIMARY KEY",
"displayName VARCHAR",
"mutable_username VARCHAR",
"bitmojiId VARCHAR",
"selfieId VARCHAR"
),
"rules" to listOf(
"userId VARCHAR PRIMARY KEY",
"enabled BOOLEAN",
"mode VARCHAR",
"type VARCHAR"
),
"streaks" to listOf(
"userId VARCHAR PRIMARY KEY",
"notify BOOLEAN",
"expirationTimestamp BIGINT",
"count INTEGER"
),
"analytics_config" to listOf(
"userId VARCHAR PRIMARY KEY",
"modes VARCHAR"
),
"analytics" to listOf(
"hash VARCHAR PRIMARY KEY",
"userId VARCHAR",
"conversationId VARCHAR",
"timestamp BIGINT",
"eventName VARCHAR",
"eventData VARCHAR"
)
))
}
}

View File

@ -0,0 +1,9 @@
package me.rhunk.snapenhance.core.friends
enum class FriendFeature(
val value: String,
) {
DOWNLOAD("download"),
STEALTH("stealth"),
AUTO_SAVE("auto_save");
}