fix: compiles with removal of iterator erase

This commit is contained in:
0x330a 2023-07-12 11:59:16 +10:00
parent e16520ff76
commit 258a334de3
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C
2 changed files with 19 additions and 15 deletions

View File

@ -32,10 +32,10 @@ class ProfilePictureView @JvmOverloads constructor(
var isLarge = false
private val profilePicturesCache = mutableMapOf<String, String?>()
private val unknownRecipientDrawable = ResourceContactPhoto(R.drawable.ic_profile_default)
.asDrawable(context, ContactColors.UNKNOWN_COLOR.toConversationColor(context), false)
private val unknownOpenGroupDrawable = ResourceContactPhoto(R.drawable.ic_notification)
.asDrawable(context, ContactColors.UNKNOWN_COLOR.toConversationColor(context), false)
private val unknownRecipientDrawable by lazy { ResourceContactPhoto(R.drawable.ic_profile_default)
.asDrawable(context, ContactColors.UNKNOWN_COLOR.toConversationColor(context), false) }
private val unknownOpenGroupDrawable by lazy { ResourceContactPhoto(R.drawable.ic_notification)
.asDrawable(context, ContactColors.UNKNOWN_COLOR.toConversationColor(context), false) }
// endregion
@ -120,7 +120,7 @@ class ProfilePictureView @JvmOverloads constructor(
if (signalProfilePicture != null && avatar != "0" && avatar != "") {
glide.clear(imageView)
glide.load(signalProfilePicture)
.placeholder(R.drawable.ic_profile_default)
.placeholder(unknownRecipientDrawable)
.centerCrop()
.error(glide.load(placeholder))
.diskCacheStrategy(DiskCacheStrategy.NONE)
@ -128,20 +128,20 @@ class ProfilePictureView @JvmOverloads constructor(
.into(imageView)
} else if (recipient.isOpenGroupRecipient && recipient.groupAvatarId == null) {
glide.clear(imageView)
glide.load(R.drawable.ic_notification)
.centerCrop()
glide.load(unknownOpenGroupDrawable)
.circleCrop()
.into(imageView)
} else {
glide.clear(imageView)
glide.load(placeholder)
.placeholder(R.drawable.ic_profile_default)
.centerCrop()
.placeholder(unknownRecipientDrawable)
.circleCrop()
.diskCacheStrategy(DiskCacheStrategy.NONE).circleCrop().into(imageView)
}
profilePicturesCache[publicKey] = recipient.profileAvatar
} else {
glide.load(R.drawable.ic_profile_default)
.centerInside()
glide.load(unknownRecipientDrawable)
.circleCrop()
.into(imageView)
}
}

View File

@ -58,15 +58,19 @@ Java_network_loki_messenger_libsession_1util_ConversationVolatileConfig_eraseAll
jmethodID bool_get = env->GetMethodID(bool_class, "booleanValue", "()Z");
int removed = 0;
auto to_erase = std::vector<session::config::convo::any>();
for (auto it = conversations->begin(); it != conversations->end(); ) {
for (auto it = conversations->begin(); it != conversations->end(); ++it) {
auto result = env->CallObjectMethod(predicate, predicate_call, serialize_any(env, *it));
bool bool_result = env->CallBooleanMethod(result, bool_get);
if (bool_result) {
it = conversations->erase(it);
to_erase.push_back(*it);
}
}
for (auto & entry : to_erase) {
if (conversations->erase(entry)) {
removed++;
} else {
++it;
}
}