Skip to content

Commit 8f34f41

Browse files
committed
feat: Propagate contact name to all deleted messages within a chat and reformat Xposed hook definitions for readability.
1 parent 581a7d7 commit 8f34f41

3 files changed

Lines changed: 264 additions & 249 deletions

File tree

app/src/main/java/com/wmods/wppenhacer/provider/DeletedMessagesProvider.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,20 @@ public String getType(@NonNull Uri uri) {
5050
@Nullable
5151
@Override
5252
public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {
53-
if (uriMatcher.match(uri) == DELETED_MESSAGES) {
53+
if (uriMatcher.match(uri) == DELETED_MESSAGES && values != null) {
5454
SQLiteDatabase db = dbHelper.getWritableDatabase();
55+
56+
// --- NEW: Propagate Contact Name to all messages in this chat ---
57+
String chatJid = values.getAsString("chat_jid");
58+
String contactName = values.getAsString("contact_name");
59+
60+
if (chatJid != null && contactName != null && !contactName.isEmpty()) {
61+
ContentValues updateValues = new ContentValues();
62+
updateValues.put("contact_name", contactName);
63+
db.update(DelMessageStore.TABLE_DELETED_FOR_ME, updateValues, "chat_jid = ?", new String[]{chatJid});
64+
}
65+
// ----------------------------------------------------------------
66+
5567
long id = db.insertWithOnConflict(DelMessageStore.TABLE_DELETED_FOR_ME, null, values, SQLiteDatabase.CONFLICT_REPLACE);
5668
if (id > 0) {
5769
return Uri.withAppendedPath(CONTENT_URI, String.valueOf(id));

0 commit comments

Comments
 (0)