Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
quantz-dev committed Sep 21, 2021
2 parents 7117e94 + 0961b8c commit 69f0c48
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- Fixed a critical error.
- Don't immediately delete finished airing entry.
6 changes: 3 additions & 3 deletions lib/src/components/animelist/animelist.controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,14 @@ class AnimelistController extends MomentumController<AnimelistModel> {

final orderBy = filter.orderBy;
if (orderBy == OrderBy.episodeRelease) {
var withTimestamp = result.where((x) => x.hasEpisodeSchedule && x.status == 'Ongoing').toList();
var withoutTimestamp = result.where((x) => !x.hasEpisodeSchedule && x.status == 'Ongoing').toList();
var withTimestamp = result.where((x) => x.hasEpisodeSchedule && x.isOngoing).toList();
var withoutTimestamp = result.where((x) => !x.hasEpisodeSchedule && x.isOngoing).toList();
var upcoming = result.where((x) => x.status == 'Upcoming').toList();
result = withTimestamp..addAll(withoutTimestamp)..addAll(upcoming);
}

if (!filter.showOngoing) {
result.removeWhere((x) => x.status == 'Ongoing');
result.removeWhere((x) => x.isOngoing);
}
if (!filter.showUpcoming) {
result.removeWhere((x) => x.status == 'Upcoming');
Expand Down
12 changes: 6 additions & 6 deletions lib/src/core/services.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ var fcmService = FcmService();
List<MomentumService> services() {
return [
fcmService,
// ApiService(),
// GoogleApiService(),
// MalService(),
ApiMockService(),
GoogleApiMockService(),
MalMockService(),
ApiService(),
GoogleApiService(),
MalService(),
// ApiMockService(),
// GoogleApiMockService(),
// MalMockService(),
];
}
7 changes: 7 additions & 0 deletions lib/src/data/response.all_anime.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class AnimeEntry {
this.malFavorites = 0,
this.season = '',
this.livechartId = -1,
this.markedForDeletion = false,
this.displayTitle = '',
this.orderLabel = '',
this.following = false,
Expand All @@ -78,6 +79,7 @@ class AnimeEntry {
final int malFavorites;
final String season;
final int livechartId;
final bool markedForDeletion;

/* These props here are not part of JSON response. They're for UI */
final String displayTitle;
Expand All @@ -97,6 +99,8 @@ class AnimeEntry {
/// Use this for sorting only.
int get episodeTimestamp => latestEpisodeTimestamp == 0 ? -1 : latestEpisodeTimestamp;

bool get isOngoing => status == 'Ongoing' || markedForDeletion;

AnimeEntry copyWith({
String? slug,
String? title,
Expand All @@ -115,6 +119,7 @@ class AnimeEntry {
int? malFavorites,
String? season,
int? livechartId,
bool? markedForDeletion,
String? displayTitle,
String? orderLabel,
bool? following,
Expand Down Expand Up @@ -168,6 +173,7 @@ class AnimeEntry {
malFavorites: json["mal_favorites"] == null ? 0 : json["mal_favorites"],
season: json["season"] == null ? '' : json["season"],
livechartId: json["livechart_id"] == null ? -1 : json["livechart_id"],
markedForDeletion: json["marked_for_deletion"] == null ? false : json["marked_for_deletion"],
);

Map<String, dynamic> toJson() => {
Expand All @@ -188,5 +194,6 @@ class AnimeEntry {
"mal_favorites": malFavorites,
"season": season,
"livechart_id": livechartId,
"marked_for_deletion": markedForDeletion,
};
}

0 comments on commit 69f0c48

Please sign in to comment.