mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Deal with legacy display names
This commit is contained in:
parent
2d29ef9dc8
commit
d84373fa19
@ -33,8 +33,14 @@ class LokiUserDatabase(context: Context, helper: SQLCipherOpenHelper) : Database
|
||||
return TextSecurePreferences.getProfileName(context)
|
||||
} else {
|
||||
val database = databaseHelper.readableDatabase
|
||||
return database.get(displayNameTable, "${Companion.publicKey} = ?", arrayOf( publicKey )) { cursor ->
|
||||
val result = database.get(displayNameTable, "${Companion.publicKey} = ?", arrayOf( publicKey )) { cursor ->
|
||||
cursor.getString(cursor.getColumnIndexOrThrow(displayName))
|
||||
} ?: return null
|
||||
val suffix = " (...${publicKey.substring(publicKey.count() - 8)})"
|
||||
if (result.endsWith(suffix)) {
|
||||
return result.substring(0..(result.count() - suffix.count()))
|
||||
} else {
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user