Compare commits
No commits in common. "2e1a3037b6c967605b84ec308f52dc75dfc1e37f" and "c3ad3be8176477fe184c1de11d830e2158e96f9c" have entirely different histories.
2e1a3037b6
...
c3ad3be817
@ -1,5 +1,3 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:yumi/app_localizations.dart';
|
||||
@ -172,20 +170,19 @@ class SocialChatUserProfileManager extends ChangeNotifier {
|
||||
final loadedProfile = await SCAccountRepository().loadUserInfo(
|
||||
normalizedUserId,
|
||||
);
|
||||
var mergedProfile = await _withCurrentVipLevel(
|
||||
loadedProfile,
|
||||
normalizedUserId,
|
||||
);
|
||||
mergedProfile = await _withCpCabinProfiles(
|
||||
mergedProfile,
|
||||
normalizedUserId,
|
||||
);
|
||||
if (requestSerial != _userInfoRequestSerial) {
|
||||
return;
|
||||
}
|
||||
userProfile = loadedProfile;
|
||||
userProfile = mergedProfile;
|
||||
userProfileLoadError = null;
|
||||
isUserProfileLoading = false;
|
||||
notifyListeners();
|
||||
unawaited(
|
||||
_hydrateUserInfoById(
|
||||
profile: loadedProfile,
|
||||
userId: normalizedUserId,
|
||||
requestSerial: requestSerial,
|
||||
),
|
||||
);
|
||||
} catch (error, stackTrace) {
|
||||
if (requestSerial != _userInfoRequestSerial) {
|
||||
return;
|
||||
@ -199,7 +196,7 @@ class SocialChatUserProfileManager extends ChangeNotifier {
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
} finally {
|
||||
if (requestSerial == _userInfoRequestSerial && isUserProfileLoading) {
|
||||
if (requestSerial == _userInfoRequestSerial) {
|
||||
isUserProfileLoading = false;
|
||||
notifyListeners();
|
||||
}
|
||||
@ -237,20 +234,12 @@ class SocialChatUserProfileManager extends ChangeNotifier {
|
||||
normalizedRoomId,
|
||||
normalizedUserId,
|
||||
);
|
||||
card = await _withCurrentVipLevelForCard(card, normalizedUserId);
|
||||
if (requestSerial != _userCardRequestSerial) {
|
||||
return;
|
||||
}
|
||||
userCardInfo = card;
|
||||
userCardLoadError = null;
|
||||
isUserCardLoading = false;
|
||||
notifyListeners();
|
||||
unawaited(
|
||||
_hydrateRoomUserCard(
|
||||
card: card,
|
||||
userId: normalizedUserId,
|
||||
requestSerial: requestSerial,
|
||||
),
|
||||
);
|
||||
} catch (error, stackTrace) {
|
||||
if (requestSerial != _userCardRequestSerial) {
|
||||
return;
|
||||
@ -264,60 +253,13 @@ class SocialChatUserProfileManager extends ChangeNotifier {
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
} finally {
|
||||
if (requestSerial == _userCardRequestSerial && isUserCardLoading) {
|
||||
if (requestSerial == _userCardRequestSerial) {
|
||||
isUserCardLoading = false;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _hydrateUserInfoById({
|
||||
required SocialChatUserProfile profile,
|
||||
required String userId,
|
||||
required int requestSerial,
|
||||
}) async {
|
||||
try {
|
||||
var mergedProfile = await _withCurrentVipLevel(profile, userId);
|
||||
mergedProfile = await _withCpCabinProfiles(mergedProfile, userId);
|
||||
if (requestSerial != _userInfoRequestSerial) {
|
||||
return;
|
||||
}
|
||||
userProfile = mergedProfile;
|
||||
userProfileLoadError = null;
|
||||
notifyListeners();
|
||||
} catch (error, stackTrace) {
|
||||
_debugProfileLoadFailure(
|
||||
scope: 'detailHydrate',
|
||||
userId: userId,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _hydrateRoomUserCard({
|
||||
required RoomUserCardRes? card,
|
||||
required String userId,
|
||||
required int requestSerial,
|
||||
}) async {
|
||||
try {
|
||||
final hydratedCard = await _withCurrentVipLevelForCard(card, userId);
|
||||
if (requestSerial != _userCardRequestSerial || hydratedCard == null) {
|
||||
return;
|
||||
}
|
||||
userCardInfo = hydratedCard;
|
||||
userCardLoadError = null;
|
||||
notifyListeners();
|
||||
} catch (error, stackTrace) {
|
||||
_debugProfileLoadFailure(
|
||||
scope: 'roomCardHydrate',
|
||||
userId: userId,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void clearRoomUserCard() {
|
||||
_userCardRequestSerial++;
|
||||
userCardInfo = null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user