Ensure default chat folder exists.

This commit is contained in:
Michelle Tang
2025-05-21 11:33:13 -04:00
committed by GitHub
parent 4f6bedf323
commit 7dc4cb4ce7
5 changed files with 77 additions and 4 deletions

View File

@@ -0,0 +1,28 @@
package org.thoughtcrime.securesms.logsubmit
import android.content.Context
import org.thoughtcrime.securesms.components.settings.app.chats.folders.ChatFolderRecord
import org.thoughtcrime.securesms.database.SignalDatabase
import org.thoughtcrime.securesms.recipients.Recipient
/**
* Prints out chat folders settings
*/
class LogSectionChatFolders : LogSection {
override fun getTitle(): String = "CHAT FOLDERS"
override fun getContent(context: Context): CharSequence {
val output = StringBuilder()
if (Recipient.isSelfSet) {
val count = SignalDatabase.chatFolders.getFolderCount()
val hasDefault = SignalDatabase.chatFolders.getCurrentChatFolders().any { folder -> folder.folderType == ChatFolderRecord.FolderType.ALL }
output.append("Has default all chats : ${hasDefault}\n")
output.append("Number of folders (undeleted) : ${count}\n")
} else {
output.append("< Self is not set yet >\n")
}
return output
}
}

View File

@@ -88,6 +88,7 @@ public class SubmitDebugLogRepository {
add(new LogSectionKeyPreferences());
add(new LogSectionStories());
add(new LogSectionBadges());
add(new LogSectionChatFolders());
add(new LogSectionRemoteBackups());
add(new LogSectionPermissions());
add(new LogSectionTrace());