mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 11:22:21 +00:00
Removed custom profile avatar url table since signal already has an existing one.
Clean
This commit is contained in:
@@ -25,9 +25,6 @@ class LokiUserDatabase(context: Context, helper: SQLCipherOpenHelper) : Database
|
||||
private val serverDisplayNameTable = "loki_user_server_display_name_database"
|
||||
private val serverID = "server_id"
|
||||
@JvmStatic val createServerDisplayNameTableCommand = "CREATE TABLE $serverDisplayNameTable ($hexEncodedPublicKey TEXT, $serverID TEXT, $displayName TEXT, PRIMARY KEY ($hexEncodedPublicKey, $serverID));"
|
||||
// Profile Avatar URL cache
|
||||
private val profileAvatarUrlTable = "loki_user_profile_avatar_url_database"
|
||||
@JvmStatic val createProfileAvatarUrlTableCommand = "CREATE TABLE $profileAvatarUrlTable ($hexEncodedPublicKey TEXT PRIMARY KEY, $profileAvatarUrl TEXT);"
|
||||
}
|
||||
|
||||
override fun getDisplayName(hexEncodedPublicKey: String): String? {
|
||||
@@ -72,25 +69,10 @@ class LokiUserDatabase(context: Context, helper: SQLCipherOpenHelper) : Database
|
||||
}
|
||||
|
||||
override fun getProfileAvatarUrl(hexEncodedPublicKey: String): String? {
|
||||
if (hexEncodedPublicKey == TextSecurePreferences.getLocalNumber(context)) {
|
||||
return TextSecurePreferences.getProfileAvatarUrl(context)
|
||||
return if (hexEncodedPublicKey == TextSecurePreferences.getLocalNumber(context)) {
|
||||
TextSecurePreferences.getProfileAvatarUrl(context)
|
||||
} else {
|
||||
val database = databaseHelper.readableDatabase
|
||||
return database.get(profileAvatarUrlTable, "${Companion.hexEncodedPublicKey} = ?", arrayOf( hexEncodedPublicKey )) { cursor ->
|
||||
cursor.getString(cursor.getColumnIndexOrThrow(profileAvatarUrl))
|
||||
}
|
||||
Recipient.from(context, Address.fromSerialized(hexEncodedPublicKey), false).resolve().profileAvatar
|
||||
}
|
||||
}
|
||||
|
||||
//TODO figure out what to do with Recipient
|
||||
/*
|
||||
fun setProfileAvatarUrl(hexEncodedPublicKey: String, profileAvatarUrl: String) {
|
||||
val database = databaseHelper.writableDatabase
|
||||
val row = ContentValues(2)
|
||||
row.put(Companion.hexEncodedPublicKey, hexEncodedPublicKey)
|
||||
row.put(Companion.profileAvatarUrl, profileAvatarUrl)
|
||||
database.insertOrUpdate(profileAvatarUrlTable, row, "${Companion.hexEncodedPublicKey} = ?", arrayOf( hexEncodedPublicKey ))
|
||||
Recipient.from(context, Address.fromSerialized(hexEncodedPublicKey), false).notifyListeners()
|
||||
}
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user