Add additional verifications and logging around My Story db entry.
This commit is contained in:
parent
e0e3f7dfec
commit
029a76f8a2
3 changed files with 29 additions and 5 deletions
|
@ -342,6 +342,24 @@ class DistributionListDatabase constructor(context: Context?, databaseHelper: Si
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the raw string value of distribution ID of the desired row. Added for additional logging around the UUID issues we've seen.
|
||||
*/
|
||||
fun getRawDistributionId(listId: DistributionListId): String? {
|
||||
return readableDatabase
|
||||
.select(ListTable.DISTRIBUTION_ID)
|
||||
.from(ListTable.TABLE_NAME)
|
||||
.where("${ListTable.ID} = ?", listId)
|
||||
.run()
|
||||
.use { cursor ->
|
||||
if (cursor.moveToFirst()) {
|
||||
cursor.requireString(ListTable.DISTRIBUTION_ID)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getListForStorageSync(listId: DistributionListId): DistributionListRecord? {
|
||||
readableDatabase.query(ListTable.TABLE_NAME, null, "${ListTable.ID} = ?", SqlUtil.buildArgs(listId), null, null, null).use { cursor ->
|
||||
return if (cursor.moveToFirst()) {
|
||||
|
|
|
@ -208,8 +208,9 @@ object SignalDatabaseMigrations {
|
|||
private const val URGENT_FLAG = 150
|
||||
private const val MY_STORY_MIGRATION = 151
|
||||
private const val STORY_GROUP_TYPES = 152
|
||||
private const val MY_STORY_MIGRATION_2 = 153
|
||||
|
||||
const val DATABASE_VERSION = 152
|
||||
const val DATABASE_VERSION = 153
|
||||
|
||||
@JvmStatic
|
||||
fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
|
@ -2686,6 +2687,10 @@ object SignalDatabaseMigrations {
|
|||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
if (oldVersion < MY_STORY_MIGRATION_2) {
|
||||
MyStoryMigration.migrate(context, db, oldVersion, newVersion)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
|
|
@ -23,10 +23,11 @@ class LogSectionStories : LogSection {
|
|||
val myStoryRecipientId = SignalDatabase.distributionLists.getRecipientId(DistributionListId.MY_STORY)
|
||||
|
||||
if (myStoryRecord != null) {
|
||||
output.append("Database ID : ${myStoryRecord.id}\n")
|
||||
output.append("Distribution ID: ${myStoryRecord.distributionId} (Matches expected value? ${myStoryRecord.distributionId == DistributionId.MY_STORY})\n")
|
||||
output.append("Recipient ID : ${presentRecipientId(myStoryRecipientId)}\n")
|
||||
output.append("toString() Test: ${DistributionId.MY_STORY} | ${DistributionId.MY_STORY.asUuid()}")
|
||||
output.append("Database ID : ${myStoryRecord.id}\n")
|
||||
output.append("Distribution ID : ${myStoryRecord.distributionId} (Matches expected value? ${myStoryRecord.distributionId == DistributionId.MY_STORY})\n")
|
||||
output.append("Raw Distribution ID: ${SignalDatabase.distributionLists.getRawDistributionId(myStoryRecord.id)}\n")
|
||||
output.append("Recipient ID : ${presentRecipientId(myStoryRecipientId)}\n")
|
||||
output.append("toString() Test : ${DistributionId.MY_STORY} | ${DistributionId.MY_STORY.asUuid()}")
|
||||
} else {
|
||||
output.append("< My story does not exist >\n")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue