feat: integrate invite API and improve notification handling
- Add invite code display and binding functionality via API - Fix notification unread count sync on auth state change - Improve notification mark read with server state validation - Add auth state listener to trigger notification refresh - Add YaoCoinConverter for coin-to-yao type conversion - Remove YaoLegend from divination screens (UI cleanup) - Abbreviate relation labels in yao detail view - Add re-register notice to account delete screen - Update 'coins' terminology to 'points' in localization - Fix backend points consumption to only run in CHAT mode - Add HttpxAuthNoiseFilter to suppress auth endpoint logging - Fix notification static_schema import path - Add test coverage for notification bloc error handling - Update AGENTS.md page header rules and image handling - Delete deprecated run-dev.sh script
This commit is contained in:
+16
-1
@@ -53,6 +53,7 @@ class _EryaoAppState extends State<EryaoApp> {
|
||||
List<DivinationResultData> _historyRecords = const <DivinationResultData>[];
|
||||
bool _loadingProfile = false;
|
||||
String? _loadedProfileUserEmail;
|
||||
String? _lastUnreadRefreshedUserId;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -77,9 +78,23 @@ class _EryaoAppState extends State<EryaoApp> {
|
||||
sessionStore: _sessionStore,
|
||||
);
|
||||
_authBloc = AuthBloc(repository: authRepository);
|
||||
_authBloc.addListener(_onAuthStateChanged);
|
||||
_bootstrap();
|
||||
}
|
||||
|
||||
void _onAuthStateChanged() {
|
||||
final state = _authBloc.state;
|
||||
if (state.status == AuthStatus.authenticated && state.user != null) {
|
||||
final userId = state.user!.id;
|
||||
if (_lastUnreadRefreshedUserId != userId) {
|
||||
_lastUnreadRefreshedUserId = userId;
|
||||
_notificationBloc.handleEvent(RefreshUnreadCount());
|
||||
}
|
||||
return;
|
||||
}
|
||||
_lastUnreadRefreshedUserId = null;
|
||||
}
|
||||
|
||||
void _ensureCreditsLoaded(String userEmail) {
|
||||
if (_loadingCredits) {
|
||||
return;
|
||||
@@ -357,6 +372,7 @@ class _EryaoAppState extends State<EryaoApp> {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_authBloc.removeListener(_onAuthStateChanged);
|
||||
_authBloc.dispose();
|
||||
_notificationBloc.dispose();
|
||||
super.dispose();
|
||||
@@ -427,7 +443,6 @@ class _EryaoAppState extends State<EryaoApp> {
|
||||
_ensureCreditsLoaded(state.user!.email);
|
||||
_ensureHistoryLoaded(state.user!.email);
|
||||
_refreshProfile(userEmail: state.user!.email);
|
||||
_notificationBloc.handleEvent(RefreshUnreadCount());
|
||||
return HomeScreen(
|
||||
account: state.user!.email,
|
||||
sessionStore: _sessionStore,
|
||||
|
||||
Reference in New Issue
Block a user