Add default chat folders in backups.
This commit is contained in:
parent
1ff6169795
commit
9a0ebb5028
2 changed files with 12 additions and 0 deletions
|
@ -487,6 +487,9 @@ object BackupRepository {
|
|||
SignalDatabase.recipients.setProfileKey(selfId, selfData.profileKey)
|
||||
SignalDatabase.recipients.setProfileSharing(selfId, true)
|
||||
|
||||
// Add back default All Chats chat folder after clearing data
|
||||
SignalDatabase.chatFolders.insertAllChatFolder()
|
||||
|
||||
val importState = ImportState(backupKey)
|
||||
val chatItemInserter: ChatItemArchiveImporter = ChatItemArchiveProcessor.beginImport(importState)
|
||||
|
||||
|
|
|
@ -395,6 +395,15 @@ class ChatFolderTables(context: Context?, databaseHelper: SignalDatabase?) : Dat
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the default 'All chats' folder in cases where it could get deleted (eg backups)
|
||||
*/
|
||||
fun insertAllChatFolder() {
|
||||
writableDatabase.withinTransaction { db ->
|
||||
db.insert(ChatFolderTable.TABLE_NAME, null, getAllChatsFolderContentValues())
|
||||
}
|
||||
}
|
||||
|
||||
private fun Collection<Long>.toContentValues(chatFolderId: Long, membershipType: MembershipType): List<ContentValues> {
|
||||
return map {
|
||||
contentValuesOf(
|
||||
|
|
Loading…
Add table
Reference in a new issue