parent
5ee3449f02
commit
c8e1aef74b
2 changed files with 115 additions and 4 deletions
|
|
@ -371,6 +371,12 @@ class ClientController extends AsyncNotifier<int> {
|
|||
Future<void> exchangeToken(OAuthExchangeTokenRequest request) async =>
|
||||
await _sendCommand("oauth_exchange_token", request.toJson());
|
||||
|
||||
Future<IList<String>> getMutualRooms(String userId) async => IList(
|
||||
((await _sendCommand("get_mutual_rooms", {"user_id": userId}))["joined"]
|
||||
as List?)
|
||||
?.cast<String>(),
|
||||
);
|
||||
|
||||
Future<SpecVersionsResponse> getSpecVersions() async =>
|
||||
.fromJson(await _sendCommand("get_versions"));
|
||||
|
||||
|
|
|
|||
15
lib/controllers/mutual_rooms.dart
Normal file
15
lib/controllers/mutual_rooms.dart
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
||||
import "package:nexus/controllers/client.dart";
|
||||
|
||||
class MutualRoomsController(final String userId)
|
||||
extends AsyncNotifier<IList<String>> {
|
||||
@override
|
||||
Future<IList<String>> build() =>
|
||||
ref.read(ClientController.provider.notifier).getMutualRooms(userId);
|
||||
|
||||
static final provider = AsyncNotifierProvider.family
|
||||
.autoDispose<MutualRoomsController, IList<String>, String>(
|
||||
MutualRoomsController.new,
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue