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/cupertino.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:yumi/app_localizations.dart';
|
import 'package:yumi/app_localizations.dart';
|
||||||
@ -172,20 +170,19 @@ class SocialChatUserProfileManager extends ChangeNotifier {
|
|||||||
final loadedProfile = await SCAccountRepository().loadUserInfo(
|
final loadedProfile = await SCAccountRepository().loadUserInfo(
|
||||||
normalizedUserId,
|
normalizedUserId,
|
||||||
);
|
);
|
||||||
|
var mergedProfile = await _withCurrentVipLevel(
|
||||||
|
loadedProfile,
|
||||||
|
normalizedUserId,
|
||||||
|
);
|
||||||
|
mergedProfile = await _withCpCabinProfiles(
|
||||||
|
mergedProfile,
|
||||||
|
normalizedUserId,
|
||||||
|
);
|
||||||
if (requestSerial != _userInfoRequestSerial) {
|
if (requestSerial != _userInfoRequestSerial) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
userProfile = loadedProfile;
|
userProfile = mergedProfile;
|
||||||
userProfileLoadError = null;
|
userProfileLoadError = null;
|
||||||
isUserProfileLoading = false;
|
|
||||||
notifyListeners();
|
|
||||||
unawaited(
|
|
||||||
_hydrateUserInfoById(
|
|
||||||
profile: loadedProfile,
|
|
||||||
userId: normalizedUserId,
|
|
||||||
requestSerial: requestSerial,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} catch (error, stackTrace) {
|
} catch (error, stackTrace) {
|
||||||
if (requestSerial != _userInfoRequestSerial) {
|
if (requestSerial != _userInfoRequestSerial) {
|
||||||
return;
|
return;
|
||||||
@ -199,7 +196,7 @@ class SocialChatUserProfileManager extends ChangeNotifier {
|
|||||||
stackTrace: stackTrace,
|
stackTrace: stackTrace,
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
if (requestSerial == _userInfoRequestSerial && isUserProfileLoading) {
|
if (requestSerial == _userInfoRequestSerial) {
|
||||||
isUserProfileLoading = false;
|
isUserProfileLoading = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
@ -237,20 +234,12 @@ class SocialChatUserProfileManager extends ChangeNotifier {
|
|||||||
normalizedRoomId,
|
normalizedRoomId,
|
||||||
normalizedUserId,
|
normalizedUserId,
|
||||||
);
|
);
|
||||||
|
card = await _withCurrentVipLevelForCard(card, normalizedUserId);
|
||||||
if (requestSerial != _userCardRequestSerial) {
|
if (requestSerial != _userCardRequestSerial) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
userCardInfo = card;
|
userCardInfo = card;
|
||||||
userCardLoadError = null;
|
userCardLoadError = null;
|
||||||
isUserCardLoading = false;
|
|
||||||
notifyListeners();
|
|
||||||
unawaited(
|
|
||||||
_hydrateRoomUserCard(
|
|
||||||
card: card,
|
|
||||||
userId: normalizedUserId,
|
|
||||||
requestSerial: requestSerial,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} catch (error, stackTrace) {
|
} catch (error, stackTrace) {
|
||||||
if (requestSerial != _userCardRequestSerial) {
|
if (requestSerial != _userCardRequestSerial) {
|
||||||
return;
|
return;
|
||||||
@ -264,60 +253,13 @@ class SocialChatUserProfileManager extends ChangeNotifier {
|
|||||||
stackTrace: stackTrace,
|
stackTrace: stackTrace,
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
if (requestSerial == _userCardRequestSerial && isUserCardLoading) {
|
if (requestSerial == _userCardRequestSerial) {
|
||||||
isUserCardLoading = false;
|
isUserCardLoading = false;
|
||||||
notifyListeners();
|
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() {
|
void clearRoomUserCard() {
|
||||||
_userCardRequestSerial++;
|
_userCardRequestSerial++;
|
||||||
userCardInfo = null;
|
userCardInfo = null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user