feat: Add support for isFederate option for rooms
This commit is contained in:
parent
c464032855
commit
b962e8288b
|
|
@ -790,6 +790,7 @@ class Client extends MatrixApi {
|
||||||
HistoryVisibility? historyVisibility,
|
HistoryVisibility? historyVisibility,
|
||||||
bool waitForSync = true,
|
bool waitForSync = true,
|
||||||
bool groupCall = false,
|
bool groupCall = false,
|
||||||
|
bool federated = true,
|
||||||
Map<String, dynamic>? powerLevelContentOverride,
|
Map<String, dynamic>? powerLevelContentOverride,
|
||||||
}) async {
|
}) async {
|
||||||
enableEncryption ??=
|
enableEncryption ??=
|
||||||
|
|
@ -824,6 +825,7 @@ class Client extends MatrixApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
final roomId = await createRoom(
|
final roomId = await createRoom(
|
||||||
|
creationContent: federated ? null : {'m.federate': false},
|
||||||
invite: invite,
|
invite: invite,
|
||||||
preset: preset,
|
preset: preset,
|
||||||
name: groupName,
|
name: groupName,
|
||||||
|
|
|
||||||
|
|
@ -1347,6 +1347,10 @@ class Room {
|
||||||
@Deprecated('Use fullyRead marker')
|
@Deprecated('Use fullyRead marker')
|
||||||
String? get userFullyReadMarker => fullyRead;
|
String? get userFullyReadMarker => fullyRead;
|
||||||
|
|
||||||
|
bool get isFederated =>
|
||||||
|
getState(EventTypes.RoomCreate)?.content.tryGet<bool>('m.federate') ??
|
||||||
|
true;
|
||||||
|
|
||||||
/// Sets the position of the read marker for a given room, and optionally the
|
/// Sets the position of the read marker for a given room, and optionally the
|
||||||
/// read receipt's location.
|
/// read receipt's location.
|
||||||
/// If you set `public` to false, only a private receipt will be sent. A private receipt is always sent if `mRead` is set. If no value is provided, the default from the `client` is used.
|
/// If you set `public` to false, only a private receipt will be sent. A private receipt is always sent if `mRead` is set. If no value is provided, the default from the `client` is used.
|
||||||
|
|
|
||||||
|
|
@ -778,6 +778,19 @@ void main() {
|
||||||
expect(timeline.events.length, 17);
|
expect(timeline.events.length, 17);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('isFederated', () {
|
||||||
|
expect(room.isFederated, true);
|
||||||
|
room.setState(
|
||||||
|
StrippedStateEvent(
|
||||||
|
type: EventTypes.RoomCreate,
|
||||||
|
content: {'m.federate': false},
|
||||||
|
senderId: room.client.userID!,
|
||||||
|
stateKey: '',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
expect(room.isFederated, false);
|
||||||
|
});
|
||||||
|
|
||||||
test('getUserByMXID', () async {
|
test('getUserByMXID', () async {
|
||||||
final List<String> called = [];
|
final List<String> called = [];
|
||||||
final List<String> called2 = [];
|
final List<String> called2 = [];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue