Implement the majority of the new nicknames and notes feature.

This commit is contained in:
Alex Hart
2024-03-22 16:03:04 -03:00
committed by Nicholas Tinsley
parent 7a24554b68
commit 303929090b
20 changed files with 1504 additions and 23 deletions

View File

@@ -1739,6 +1739,20 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
}
}
fun setNicknameAndNote(id: RecipientId, nickname: ProfileName, note: String) {
val contentValues = contentValuesOf(
NICKNAME_GIVEN_NAME to nickname.givenName.nullIfBlank(),
NICKNAME_FAMILY_NAME to nickname.familyName.nullIfBlank(),
NICKNAME_JOINED_NAME to nickname.toString().nullIfBlank(),
NOTE to note.nullIfBlank()
)
if (update(id, contentValues)) {
rotateStorageId(id)
ApplicationDependencies.getDatabaseObserver().notifyRecipientChanged(id)
StorageSyncHelper.scheduleSyncForDataChange()
}
}
fun setProfileName(id: RecipientId, profileName: ProfileName) {
val contentValues = ContentValues(1).apply {
put(PROFILE_GIVEN_NAME, profileName.givenName.nullIfBlank())