-
Notifications
You must be signed in to change notification settings - Fork 15
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'); | ||
fetchStatus = FetchStatus.error; | ||
}, (r) { | ||
announcementsCommunnity = r; | ||
|
@@ -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'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question here There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
fetchStatus = FetchStatus.error; | ||
}, (r) { | ||
announcementsGlobal = r; | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.