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:
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:real_estate_mobile/core/storage/secure_storage.dart';
|
||||
import 'package:real_estate_mobile/features/messaging/data/socket_service.dart';
|
||||
import 'package:real_estate_mobile/features/notifications/data/models/notification_model.dart';
|
||||
import 'package:real_estate_mobile/features/notifications/data/notification_repository.dart';
|
||||
|
||||
@@ -14,10 +15,16 @@ final unreadCountProvider =
|
||||
class UnreadCountNotifier extends StateNotifier<int> {
|
||||
final NotificationRepository _repo;
|
||||
Timer? _timer;
|
||||
final List<StreamSubscription> _subs = [];
|
||||
|
||||
UnreadCountNotifier(this._repo) : super(0) {
|
||||
refresh();
|
||||
_timer = Timer.periodic(const Duration(seconds: 30), (_) => refresh());
|
||||
// Refresh count immediately when socket events arrive
|
||||
final socket = SocketService();
|
||||
_subs.add(socket.onNewMessage.listen((_) => refresh()));
|
||||
_subs.add(socket.onConnectionRequest.listen((_) => refresh()));
|
||||
_subs.add(socket.onConnectionResponse.listen((_) => refresh()));
|
||||
}
|
||||
|
||||
Future<void> refresh() async {
|
||||
@@ -52,6 +59,9 @@ class UnreadCountNotifier extends StateNotifier<int> {
|
||||
@override
|
||||
void dispose() {
|
||||
_timer?.cancel();
|
||||
for (final sub in _subs) {
|
||||
sub.cancel();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user