refactor: Update Twitter OAuth 2.0 PKCE flow for dynamic redirect URI and public client authentication, replace SVG back button with a native icon, and enhance Twitter login error reporting.
This commit is contained in:
@@ -75,6 +75,7 @@ class MessagingNotifier extends StateNotifier<MessagingState> {
|
||||
MessagingNotifier(this._repository, this._ref)
|
||||
: super(const MessagingState()) {
|
||||
_initSocketListeners();
|
||||
loadUnreadCount();
|
||||
}
|
||||
|
||||
String? get _currentUserId => _ref.read(authProvider).user?.id;
|
||||
@@ -132,9 +133,15 @@ class MessagingNotifier extends StateNotifier<MessagingState> {
|
||||
return c;
|
||||
}).toList();
|
||||
|
||||
// Recalculate total unread count
|
||||
final totalUnread = updatedConversations.fold<int>(
|
||||
0, (sum, c) => sum + c.unreadCount,
|
||||
);
|
||||
|
||||
state = state.copyWith(
|
||||
messages: updatedMessages,
|
||||
conversations: updatedConversations,
|
||||
unreadCount: totalUnread,
|
||||
);
|
||||
}));
|
||||
|
||||
@@ -575,9 +582,13 @@ class MessagingNotifier extends StateNotifier<MessagingState> {
|
||||
..remove(conversationId);
|
||||
final updatedConversations =
|
||||
state.conversations.where((c) => c.id != conversationId).toList();
|
||||
final totalUnread = updatedConversations.fold<int>(
|
||||
0, (sum, c) => sum + c.unreadCount,
|
||||
);
|
||||
state = state.copyWith(
|
||||
messages: updatedMessages,
|
||||
conversations: updatedConversations,
|
||||
unreadCount: totalUnread,
|
||||
clearActiveConversation: true,
|
||||
);
|
||||
} catch (_) {
|
||||
|
||||
Reference in New Issue
Block a user