Skip to content

Commit bb6eac3

Browse files
authored
Исправил некоторые ошибки из Crashlytics (#623)
1 parent c9e7879 commit bb6eac3

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

lib/core/viewmodels/main_page/chat/chat_inside_view_model.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,17 @@ class ChatInsideViewModel extends BaseViewModel {
137137
}
138138

139139
void fetchDialogFromRoot(int? chatId) {
140-
_dialog = _dialogsViewModel!.dialogs.cast<BaseDialogInfo>().firstWhere(
140+
final viewModel = _dialogsViewModel;
141+
final storedInfo = viewModel?.storedDialogInfo;
142+
143+
if (viewModel == null || storedInfo == null) {
144+
_dialog = null;
145+
return;
146+
}
147+
148+
_dialog = viewModel.dialogs.cast<BaseDialogInfo>().firstWhere(
141149
(d) => d is Dialog && d.chatId == chatId,
142-
orElse: () => _dialogsViewModel!.storedDialogInfo!,
150+
orElse: () => storedInfo,
143151
);
144152
}
145153

lib/core/viewmodels/main_page/feed/feed_screen_view_model.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class FeedScreenViewModel extends BaseViewModel
9595
}
9696

9797
Future<void> loadMorePosts() async => await changeState(() async {
98-
if (loadingMore) {
98+
if (loadingMore || _currentPage <= 0) {
9999
return;
100100
}
101101
loadingMore = true;
@@ -121,6 +121,12 @@ class FeedScreenViewModel extends BaseViewModel
121121
return;
122122
}
123123
_addPostsToList(_totalPosts, freshPosts[BlogPostType.regular]);
124+
_addPostsToList(
125+
announcements,
126+
freshPosts[BlogPostType.important],
127+
isRegularPost: false,
128+
);
129+
124130
failedToLoad = false;
125131
_currentPage++;
126132
loadingMore = false;

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: unn_mobile
22
description: A mobile application for UNN Portal website
33
publish_to: 'none'
44

5-
version: 0.5.8+388
5+
version: 0.5.8+389
66

77
environment:
88
sdk: '>=3.1.2 <4.0.0'

0 commit comments

Comments
 (0)