update formation timestamp when group is rejoined after being left

This commit is contained in:
Brice-W
2021-06-10 17:34:48 +10:00
parent 411a0dee6f
commit b8efe73a3b
4 changed files with 23 additions and 9 deletions

View File

@@ -308,6 +308,13 @@ public class GroupDatabase extends Database implements LokiOpenGroupDatabaseProt
databaseHelper.getWritableDatabase().update(TABLE_NAME, contents, GROUP_ID + " = ?", new String[] {groupId});
}
public void updateFormationTimestamp(String groupId, Long formationTimestamp) {
ContentValues contents = new ContentValues();
contents.put(TIMESTAMP, formationTimestamp);
databaseHelper.getWritableDatabase().update(TABLE_NAME, contents, GROUP_ID + " = ?", new String[] {groupId});
}
public void removeMember(String groupId, Address source) {
List<Address> currentMembers = getCurrentMembers(groupId, false);
currentMembers.remove(source);

View File

@@ -428,6 +428,10 @@ class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context,
DatabaseFactory.getLokiAPIDatabase(context).removeAllClosedGroupEncryptionKeyPairs(groupPublicKey)
}
override fun updateFormationTimestamp(groupID: String, formationTimestamp: Long) {
DatabaseFactory.getGroupDatabase(context).updateFormationTimestamp(groupID, formationTimestamp)
}
override fun getAllV2OpenGroups(): Map<Long, OpenGroupV2> {
return DatabaseFactory.getLokiThreadDatabase(context).getAllV2OpenGroups()
}