Line data Source code
1 : /* 2 : * Famedly Matrix SDK 3 : * Copyright (C) 2021 Famedly GmbH 4 : * 5 : * This program is free software: you can redistribute it and/or modify 6 : * it under the terms of the GNU Affero General Public License as 7 : * published by the Free Software Foundation, either version 3 of the 8 : * License, or (at your option) any later version. 9 : * 10 : * This program is distributed in the hope that it will be useful, 11 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 : * GNU Affero General Public License for more details. 14 : * 15 : * You should have received a copy of the GNU Affero General Public License 16 : * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 : */ 18 : 19 : class StoredInboundGroupSession { 20 : final String roomId; 21 : final String sessionId; 22 : final String pickle; 23 : final String content; 24 : final String indexes; 25 : final String allowedAtIndex; 26 : @Deprecated('Only in use in legacy databases!') 27 : final bool? uploaded; 28 : final String senderKey; 29 : final String senderClaimedKeys; 30 : 31 24 : StoredInboundGroupSession({ 32 : required this.roomId, 33 : required this.sessionId, 34 : required this.pickle, 35 : required this.content, 36 : required this.indexes, 37 : required this.allowedAtIndex, 38 : @Deprecated('Only in use in legacy databases!') this.uploaded, 39 : required this.senderKey, 40 : required this.senderClaimedKeys, 41 : }); 42 : 43 9 : factory StoredInboundGroupSession.fromJson(Map<String, dynamic> json) => 44 9 : StoredInboundGroupSession( 45 9 : roomId: json['room_id'], 46 9 : sessionId: json['session_id'], 47 9 : pickle: json['pickle'], 48 9 : content: json['content'], 49 9 : indexes: json['indexes'], 50 9 : allowedAtIndex: json['allowed_at_index'], 51 : // ignore: deprecated_member_use_from_same_package 52 9 : uploaded: json['uploaded'], 53 9 : senderKey: json['sender_key'], 54 9 : senderClaimedKeys: json['sender_claimed_keys'], 55 : ); 56 : 57 48 : Map<String, dynamic> toJson() => { 58 48 : 'room_id': roomId, 59 48 : 'session_id': sessionId, 60 48 : 'pickle': pickle, 61 48 : 'content': content, 62 48 : 'indexes': indexes, 63 48 : 'allowed_at_index': allowedAtIndex, 64 : // ignore: deprecated_member_use_from_same_package 65 26 : if (uploaded != null) 'uploaded': uploaded, 66 48 : 'sender_key': senderKey, 67 48 : 'sender_claimed_keys': senderClaimedKeys, 68 : }; 69 : }