mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-31 03:46:16 +00:00
fix: crash in contact photo and auto download flags
This commit is contained in:
@@ -306,6 +306,20 @@ public class RecipientDatabase extends Database {
|
||||
notifyRecipientListeners();
|
||||
}
|
||||
|
||||
public void setAutoDownloadAttachments(@NonNull Recipient recipient, boolean shouldAutoDownloadAttachments) {
|
||||
SQLiteDatabase db = getWritableDatabase();
|
||||
db.beginTransaction();
|
||||
try {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(AUTO_DOWNLOAD, shouldAutoDownloadAttachments ? 1 : 0);
|
||||
db.update(TABLE_NAME, values, ADDRESS+ " = ?", new String[]{recipient.getAddress().serialize()});
|
||||
recipient.resolve().setAutoDownloadAttachments(true);
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
notifyRecipientListeners();
|
||||
}
|
||||
|
||||
public void setMuted(@NonNull Recipient recipient, long until) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(MUTE_UNTIL, until);
|
||||
|
||||
@@ -686,14 +686,15 @@ class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context,
|
||||
}
|
||||
|
||||
override fun shouldAutoDownloadAttachments(recipient: Recipient): Boolean {
|
||||
TODO("Not yet implemented")
|
||||
return recipient.autoDownloadAttachments
|
||||
}
|
||||
|
||||
override fun setAutoDownloadAttachments(
|
||||
recipient: Recipient,
|
||||
shouldAutoDownloadAttachments: Boolean
|
||||
) {
|
||||
TODO("Not yet implemented")
|
||||
val recipientDb = DatabaseComponent.get(context).recipientDatabase()
|
||||
recipientDb.setAutoDownloadAttachments(recipient, shouldAutoDownloadAttachments)
|
||||
}
|
||||
|
||||
override fun getLastUpdated(threadID: Long): Long {
|
||||
|
||||
@@ -40,10 +40,7 @@ public class ResourceContactPhoto implements FallbackContactPhoto {
|
||||
foreground.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
|
||||
}
|
||||
|
||||
Drawable gradient = context.getResources().getDrawable(ThemeUtil.isDarkTheme(context) ? R.drawable.avatar_gradient_dark
|
||||
: R.drawable.avatar_gradient_light);
|
||||
|
||||
return new ExpandingLayerDrawable(new Drawable[] {background, foreground, gradient});
|
||||
return new ExpandingLayerDrawable(new Drawable[] {background, foreground});
|
||||
}
|
||||
|
||||
private static class ExpandingLayerDrawable extends LayerDrawable {
|
||||
|
||||
Reference in New Issue
Block a user