Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try fetch English announcements if the app language's are not available #1369

Merged
merged 3 commits into from
Jul 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ abstract class _AnnouncementStoreBase with Store {
fromJson: Announcement.fromJson,
);

communityAnnouncementsResponse.fold((l) {
await communityAnnouncementsResponse.fold((l) {
error = l.error.toString();
Log.e('announcement_view', '${l.error}');

// fallback to English if the app language's one is not available
if (l.statusCode == 404) return getCommunityAnnouncements(cid, devMode: devMode, langCode: 'en');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we fetching data again?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there is no json page in our encointer-feed repo for announcements de, fr, ru. That's why it was giving 404 error. Now if there is no json file for any language, it will bring the English one.

fetchStatus = FetchStatus.error;
}, (r) {
announcementsCommunnity = r;
Expand All @@ -75,9 +78,11 @@ abstract class _AnnouncementStoreBase with Store {
fromJson: Announcement.fromJson,
);

globalAnnouncementsResponse.fold((l) {
await globalAnnouncementsResponse.fold((l) {
error = l.error.toString();
Log.e('announcement_view', '${l.error}');
// fallback to English if the app language's one is not available
if (l.statusCode == 404) return getGlobalAnnouncements(devMode: devMode, langCode: 'en');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there is no json page in our encointer-feed repo for announcements de, fr, ru. That's why it was giving 404 error. Now if there is no json file for any language, it will bring the English one.

fetchStatus = FetchStatus.error;
}, (r) {
announcementsGlobal = r;
Expand Down
Loading