Update chat folder settings display.

This commit is contained in:
Michelle Tang
2024-10-22 12:36:28 -07:00
committed by Greyson Parrelli
parent c291d84738
commit 9e955e94d9
7 changed files with 116 additions and 23 deletions

View File

@@ -4,6 +4,7 @@ import android.content.ContentValues
import android.content.Context
import androidx.core.content.contentValuesOf
import org.signal.core.util.SqlUtil
import org.signal.core.util.count
import org.signal.core.util.delete
import org.signal.core.util.groupBy
import org.signal.core.util.insertInto
@@ -232,6 +233,18 @@ class ChatFolderTables(context: Context?, databaseHelper: SignalDatabase?) : Dat
}
}
/**
* Returns the number of user-made folders
*/
fun getFolderCount(): Int {
return readableDatabase
.count()
.from(ChatFolderTable.TABLE_NAME)
.where("${ChatFolderTable.FOLDER_TYPE} != ${ChatFolderRecord.FolderType.ALL.value}")
.run()
.readToSingleInt()
}
/**
* Adds a chat folder and its corresponding included/excluded chats
*/