forked from Nexus/nexus
bump gomuks, fix profile issues caused by this
This commit is contained in:
parent
1621e917c0
commit
ae5b6e2b40
8 changed files with 50 additions and 30 deletions
|
|
@ -24,7 +24,7 @@ import "package:nexus/models/requests/get_event.dart";
|
|||
import "package:nexus/models/requests/get_related_events.dart";
|
||||
import "package:nexus/models/requests/get_room_state.dart";
|
||||
import "package:nexus/models/requests/join_room.dart";
|
||||
import "package:nexus/models/profile.dart";
|
||||
import "package:nexus/models/profile_response.dart";
|
||||
import "package:nexus/models/requests/oauth/exchange_token.dart";
|
||||
import "package:nexus/models/requests/oauth/get_auth_url.dart";
|
||||
import "package:nexus/models/requests/oauth/register_client.dart";
|
||||
|
|
@ -259,10 +259,8 @@ class ClientController extends AsyncNotifier<int> {
|
|||
Future<Paginate> paginate(PaginateRequest request) async =>
|
||||
.fromJson(await _sendCommand("paginate", request.toJson()));
|
||||
|
||||
Future<Profile> getProfile(String userId) async {
|
||||
final json = await _sendCommand("get_profile", {"user_id": userId});
|
||||
return .fromJsonWithCatch({...json, "id": userId});
|
||||
}
|
||||
Future<ProfileResponse> getProfile(String userId) async =>
|
||||
.fromJson(await _sendCommand("get_profile", {"user_id": userId}));
|
||||
|
||||
Future<void> reportEvent(ReportRequest request) =>
|
||||
_sendCommand("report_event", request.toJson());
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:nexus/controllers/client.dart";
|
||||
import "package:nexus/models/profile.dart";
|
||||
import "package:nexus/models/profile_response.dart";
|
||||
|
||||
class ProfileController extends AsyncNotifier<Profile> {
|
||||
class ProfileController extends AsyncNotifier<ProfileResponse> {
|
||||
final String userId;
|
||||
ProfileController(this.userId);
|
||||
|
||||
@override
|
||||
Future<Profile> build() {
|
||||
Future<ProfileResponse> build() {
|
||||
final client = ref.watch(ClientController.provider.notifier);
|
||||
return client.getProfile(userId);
|
||||
}
|
||||
|
||||
static final provider = AsyncNotifierProvider.family
|
||||
.autoDispose<ProfileController, Profile, String>(ProfileController.new);
|
||||
.autoDispose<ProfileController, ProfileResponse, String>(
|
||||
ProfileController.new,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,14 +27,15 @@ class UserController extends AsyncNotifier<MembershipContent> {
|
|||
return content;
|
||||
}
|
||||
|
||||
final profile = await ref.watch(
|
||||
final profileResponse = await ref.watch(
|
||||
ProfileController.provider(config.userId).future,
|
||||
);
|
||||
|
||||
return .new(
|
||||
status: .leave,
|
||||
avatarUrl: profile.avatarUrl,
|
||||
displayName: profile.displayName ?? config.userId.localpart,
|
||||
avatarUrl: profileResponse.profile.avatarUrl,
|
||||
displayName:
|
||||
profileResponse.profile.displayName ?? config.userId.localpart,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue