mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Ensure the group shortstring in the action bar is up-to-date.
There were situations where adding/removing members from a group would update the group member list, but the short string (the little text listing the first couple members of the group) wouldn't be updated until you left the screen and came back.
This commit is contained in:
parent
3b6429c163
commit
d42c9b5dbc
@ -248,6 +248,10 @@ public class GroupDatabase extends Database {
|
|||||||
|
|
||||||
databaseHelper.getWritableDatabase().update(TABLE_NAME, contents, GROUP_ID + " = ?",
|
databaseHelper.getWritableDatabase().update(TABLE_NAME, contents, GROUP_ID + " = ?",
|
||||||
new String[] {groupId});
|
new String[] {groupId});
|
||||||
|
|
||||||
|
Recipient.applyCached(Address.fromSerialized(groupId), recipient -> {
|
||||||
|
recipient.setParticipants(Stream.of(members).map(a -> Recipient.from(context, a, false)).toList());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(String groupId, Address source) {
|
public void remove(String groupId, Address source) {
|
||||||
@ -259,6 +263,14 @@ public class GroupDatabase extends Database {
|
|||||||
|
|
||||||
databaseHelper.getWritableDatabase().update(TABLE_NAME, contents, GROUP_ID + " = ?",
|
databaseHelper.getWritableDatabase().update(TABLE_NAME, contents, GROUP_ID + " = ?",
|
||||||
new String[] {groupId});
|
new String[] {groupId});
|
||||||
|
|
||||||
|
Recipient.applyCached(Address.fromSerialized(groupId), recipient -> {
|
||||||
|
List<Recipient> current = recipient.getParticipants();
|
||||||
|
Recipient removal = Recipient.from(context, source, false);
|
||||||
|
|
||||||
|
current.remove(removal);
|
||||||
|
recipient.setParticipants(current);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Address> getCurrentMembers(String groupId) {
|
private List<Address> getCurrentMembers(String groupId) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user