Merge pull request 'Fixed showing notification circular alert' (#184) from notification_curcilar_alert into main
Reviewed-on: https://repo.ravanertebat.com/TM/tm_app/pulls/184
This commit is contained in:
@@ -213,21 +213,29 @@ class HomeViewModel with ChangeNotifier {
|
|||||||
|
|
||||||
Future<void> checkUnreadNotifications() async {
|
Future<void> checkUnreadNotifications() async {
|
||||||
final result = await _homeRepository.checkUnreadNotifications();
|
final result = await _homeRepository.checkUnreadNotifications();
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case Ok<Map<String, dynamic>>():
|
case Ok<Map<String, dynamic>>():
|
||||||
final response = result.value;
|
final response = result.value;
|
||||||
_hasUnreadNotification = response['success'] == true;
|
|
||||||
|
final data = response['data'];
|
||||||
|
if (data is List && data.isNotEmpty) {
|
||||||
|
_hasUnreadNotification = true;
|
||||||
|
} else {
|
||||||
|
_hasUnreadNotification = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Error<Map<String, dynamic>>():
|
case Error<Map<String, dynamic>>():
|
||||||
_hasUnreadNotification = false;
|
_hasUnreadNotification = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void serUnreadNotificationFalse(){
|
void serUnreadNotificationFalse() {
|
||||||
_hasUnreadNotification = false;
|
_hasUnreadNotification = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user