merge with conflict

This commit is contained in:
amirrezaghabeli
2025-09-25 12:48:32 +03:30
parent 9d22bccef0
commit e49c12b6cc
8 changed files with 130 additions and 39 deletions
+18
View File
@@ -44,6 +44,9 @@ class HomeViewModel with ChangeNotifier {
bool get hasMore => _hasMore;
bool get isRecommendedMode => _isRecommendedMode;
bool _hasUnreadNotification = false;
bool get hasUnreadNotification => _hasUnreadNotification;
void init() async {
_isLoading = true;
notifyListeners();
@@ -51,6 +54,7 @@ class HomeViewModel with ChangeNotifier {
await getApprovedStates();
await getYourTenders(reset: true);
await getFeedbackStats();
await checkUnreadNotifications();
if (_errorMessage != null) {
_isLoading = false;
@@ -206,4 +210,18 @@ class HomeViewModel with ChangeNotifier {
double get selfApplyPercent {
return totalCount > 0 ? (selfApplyCount / totalCount) * 100 : 0;
}
Future<void> checkUnreadNotifications() async {
final result = await _homeRepository.checkUnreadNotifications();
switch (result) {
case Ok<Map<String, dynamic>>():
final response = result.value;
_hasUnreadNotification = response['success'] == true;
break;
case Error<Map<String, dynamic>>():
_hasUnreadNotification = false;
break;
}
notifyListeners();
}
}