Fixed contact's initials display as avatar when containing more than one emoji (or an emoji + another character)
This commit is contained in:
parent
d313b31e12
commit
29ee69fc7b
3 changed files with 14 additions and 8 deletions
|
@ -26,6 +26,7 @@ Group changes to describe their impact on the project, as follows:
|
|||
|
||||
### Fixed
|
||||
- Plain copy of encrypted files (when VFS is enabled) not cleaned
|
||||
- Avatar display issue if contact's "initials" contains more than 1 emoji or an emoji + a character
|
||||
|
||||
## [5.0.9] - 2023-03-30
|
||||
|
||||
|
|
|
@ -359,7 +359,7 @@ class CoreContext(
|
|||
|
||||
if (corePreferences.vfsEnabled) {
|
||||
val notClearedCount = FileUtils.countFilesInDirectory(corePreferences.vfsCachePath)
|
||||
if (notClearedCount != 0) {
|
||||
if (notClearedCount > 0) {
|
||||
Log.w("[Context] [VFS] There are [$notClearedCount] plain files not cleared from previous app lifetime, removing them now")
|
||||
}
|
||||
FileUtils.clearExistingPlainFiles()
|
||||
|
@ -918,7 +918,7 @@ class CoreContext(
|
|||
return
|
||||
}
|
||||
if (corePreferences.vfsEnabled) {
|
||||
Log.w("[Context] Do not make received file(s) public when VFS is enabled")
|
||||
Log.w("[Context] [VFS] Do not make received file(s) public when VFS is enabled")
|
||||
return
|
||||
}
|
||||
if (!corePreferences.makePublicMediaFilesDownloaded) {
|
||||
|
@ -940,7 +940,7 @@ class CoreContext(
|
|||
|
||||
fun addContentToMediaStore(content: Content) {
|
||||
if (corePreferences.vfsEnabled) {
|
||||
Log.w("[Context] Do not make received file(s) public when VFS is enabled")
|
||||
Log.w("[Context] [VFS] Do not make received file(s) public when VFS is enabled")
|
||||
return
|
||||
}
|
||||
if (!corePreferences.makePublicMediaFilesDownloaded) {
|
||||
|
@ -1132,10 +1132,10 @@ class CoreContext(
|
|||
|
||||
fun activateVFS() {
|
||||
try {
|
||||
Log.i("[Context] Activating VFS")
|
||||
Log.i("[Context] [VFS] Activating VFS")
|
||||
val preferences = corePreferences.encryptedSharedPreferences
|
||||
if (preferences == null) {
|
||||
Log.e("[Context] Can't get encrypted SharedPreferences, can't init VFS")
|
||||
Log.e("[Context] [VFS] Can't get encrypted SharedPreferences, can't init VFS")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1155,9 +1155,9 @@ class CoreContext(
|
|||
32
|
||||
)
|
||||
|
||||
Log.i("[Context] VFS activated")
|
||||
Log.i("[Context] [VFS] VFS activated")
|
||||
} catch (e: Exception) {
|
||||
Log.f("[Context] Unable to activate VFS encryption: $e")
|
||||
Log.f("[Context] [VFS] Unable to activate VFS encryption: $e")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,12 @@ class AppUtils {
|
|||
if (split[i].isNotEmpty()) {
|
||||
try {
|
||||
if (emoji?.hasEmojiGlyph(split[i]) == true) {
|
||||
initials += emoji.process(split[i])
|
||||
val glyph = emoji.process(split[i])
|
||||
if (characters > 0) { // Limit initial to 1 emoji only
|
||||
initials = ""
|
||||
}
|
||||
initials += glyph
|
||||
break // Limit initial to 1 emoji only
|
||||
} else {
|
||||
initials += split[i][0]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue