merge with conflict
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ class NotificationViewModel with ChangeNotifier {
|
||||
/// Fetch notifications
|
||||
Future<void> getNotifications({int page = 1, bool isMobile = false}) async {
|
||||
if (isMobile && page > 1) {
|
||||
_isMoreLoading = true; // 👈 لودینگ فقط برای پیج بعدی
|
||||
_isMoreLoading = true;
|
||||
} else {
|
||||
_isLoading = true; // 👈 لودینگ عادی (اولین بار یا رفرش)
|
||||
_isLoading = true;
|
||||
}
|
||||
notifyListeners();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user