fix: compiles with removal of iterator erase
This commit is contained in:
parent
e16520ff76
commit
258a334de3
|
@ -32,10 +32,10 @@ class ProfilePictureView @JvmOverloads constructor(
|
||||||
var isLarge = false
|
var isLarge = false
|
||||||
|
|
||||||
private val profilePicturesCache = mutableMapOf<String, String?>()
|
private val profilePicturesCache = mutableMapOf<String, String?>()
|
||||||
private val unknownRecipientDrawable = ResourceContactPhoto(R.drawable.ic_profile_default)
|
private val unknownRecipientDrawable by lazy { ResourceContactPhoto(R.drawable.ic_profile_default)
|
||||||
.asDrawable(context, ContactColors.UNKNOWN_COLOR.toConversationColor(context), false)
|
.asDrawable(context, ContactColors.UNKNOWN_COLOR.toConversationColor(context), false) }
|
||||||
private val unknownOpenGroupDrawable = ResourceContactPhoto(R.drawable.ic_notification)
|
private val unknownOpenGroupDrawable by lazy { ResourceContactPhoto(R.drawable.ic_notification)
|
||||||
.asDrawable(context, ContactColors.UNKNOWN_COLOR.toConversationColor(context), false)
|
.asDrawable(context, ContactColors.UNKNOWN_COLOR.toConversationColor(context), false) }
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ class ProfilePictureView @JvmOverloads constructor(
|
||||||
if (signalProfilePicture != null && avatar != "0" && avatar != "") {
|
if (signalProfilePicture != null && avatar != "0" && avatar != "") {
|
||||||
glide.clear(imageView)
|
glide.clear(imageView)
|
||||||
glide.load(signalProfilePicture)
|
glide.load(signalProfilePicture)
|
||||||
.placeholder(R.drawable.ic_profile_default)
|
.placeholder(unknownRecipientDrawable)
|
||||||
.centerCrop()
|
.centerCrop()
|
||||||
.error(glide.load(placeholder))
|
.error(glide.load(placeholder))
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
|
@ -128,20 +128,20 @@ class ProfilePictureView @JvmOverloads constructor(
|
||||||
.into(imageView)
|
.into(imageView)
|
||||||
} else if (recipient.isOpenGroupRecipient && recipient.groupAvatarId == null) {
|
} else if (recipient.isOpenGroupRecipient && recipient.groupAvatarId == null) {
|
||||||
glide.clear(imageView)
|
glide.clear(imageView)
|
||||||
glide.load(R.drawable.ic_notification)
|
glide.load(unknownOpenGroupDrawable)
|
||||||
.centerCrop()
|
.circleCrop()
|
||||||
.into(imageView)
|
.into(imageView)
|
||||||
} else {
|
} else {
|
||||||
glide.clear(imageView)
|
glide.clear(imageView)
|
||||||
glide.load(placeholder)
|
glide.load(placeholder)
|
||||||
.placeholder(R.drawable.ic_profile_default)
|
.placeholder(unknownRecipientDrawable)
|
||||||
.centerCrop()
|
.circleCrop()
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE).circleCrop().into(imageView)
|
.diskCacheStrategy(DiskCacheStrategy.NONE).circleCrop().into(imageView)
|
||||||
}
|
}
|
||||||
profilePicturesCache[publicKey] = recipient.profileAvatar
|
profilePicturesCache[publicKey] = recipient.profileAvatar
|
||||||
} else {
|
} else {
|
||||||
glide.load(R.drawable.ic_profile_default)
|
glide.load(unknownRecipientDrawable)
|
||||||
.centerInside()
|
.circleCrop()
|
||||||
.into(imageView)
|
.into(imageView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,15 +58,19 @@ Java_network_loki_messenger_libsession_1util_ConversationVolatileConfig_eraseAll
|
||||||
jmethodID bool_get = env->GetMethodID(bool_class, "booleanValue", "()Z");
|
jmethodID bool_get = env->GetMethodID(bool_class, "booleanValue", "()Z");
|
||||||
|
|
||||||
int removed = 0;
|
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));
|
auto result = env->CallObjectMethod(predicate, predicate_call, serialize_any(env, *it));
|
||||||
bool bool_result = env->CallBooleanMethod(result, bool_get);
|
bool bool_result = env->CallBooleanMethod(result, bool_get);
|
||||||
if (bool_result) {
|
if (bool_result) {
|
||||||
it = conversations->erase(it);
|
to_erase.push_back(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto & entry : to_erase) {
|
||||||
|
if (conversations->erase(entry)) {
|
||||||
removed++;
|
removed++;
|
||||||
} else {
|
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue