-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from andannn/airing_schedule
airing schedule query graphql
- Loading branch information
Showing
99 changed files
with
2,389 additions
and
503 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
enum AnimeCategory { | ||
/// current season releasing anime. | ||
currentSeason, | ||
|
||
/// next season not yet released anime. | ||
nextSeason, | ||
|
||
/// now trending anime. | ||
trending, | ||
|
||
/// popular movie. | ||
movie, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/// Anime format | ||
enum AnimeFormat { | ||
tv(['TV', 'TV_SHORT']), | ||
movie(['MOVIE']), | ||
ova(['OVA', 'SPECIAL', 'ONA']); | ||
|
||
final List<String> sqlTypeString; | ||
|
||
const AnimeFormat(this.sqlTypeString); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
import 'package:equatable/equatable.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
/// Bangumi releasing season. | ||
@JsonEnum() | ||
enum AnimeSeason { | ||
@JsonValue('WINTER') | ||
winter('WINTER'), | ||
@JsonValue('SPRING') | ||
spring('SPRING'), | ||
@JsonValue('SUMMER') | ||
summer('SUMMER'), | ||
@JsonValue('FALL') | ||
fall('FALL'); | ||
|
||
final String sqlTypeString; | ||
|
||
const AnimeSeason(this.sqlTypeString); | ||
} | ||
|
||
/// parameter present to anime season. | ||
class AnimeSeasonParam extends Equatable { | ||
final int seasonYear; | ||
final AnimeSeason season; | ||
|
||
const AnimeSeasonParam({required this.seasonYear, required this.season}); | ||
|
||
@override | ||
List<Object?> get props => [seasonYear, season]; | ||
} | ||
|
||
/// get next bangumi season. | ||
AnimeSeasonParam getNextSeasonParam(AnimeSeasonParam current) { | ||
int nextSeasonYear; | ||
AnimeSeason nextSeason; | ||
switch (current.season) { | ||
case AnimeSeason.winter: | ||
nextSeasonYear = current.seasonYear; | ||
nextSeason = AnimeSeason.spring; | ||
case AnimeSeason.spring: | ||
nextSeasonYear = current.seasonYear; | ||
nextSeason = AnimeSeason.summer; | ||
case AnimeSeason.summer: | ||
nextSeasonYear = current.seasonYear; | ||
nextSeason = AnimeSeason.fall; | ||
case AnimeSeason.fall: | ||
nextSeasonYear = current.seasonYear + 1; | ||
nextSeason = AnimeSeason.winter; | ||
} | ||
return AnimeSeasonParam( | ||
seasonYear: nextSeasonYear, | ||
season: nextSeason, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/// Bangumi sort. | ||
enum AnimeSort { | ||
trending('TRENDING_DESC'), | ||
latestUpdate('UPDATED_AT_DESC'); | ||
|
||
final String sqlTypeString; | ||
|
||
const AnimeSort(this.sqlTypeString); | ||
} |
File renamed without changes.
3 changes: 2 additions & 1 deletion
3
lib/core/data/model/anime_status.dart → lib/core/common/model/anime_status.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/core/data/model/character_role.dart → lib/core/common/model/character_role.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/util/anime_season_util.dart → lib/core/common/util/anime_season_util.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
extension MapEx on Map { | ||
Map<K, V> toMutableMap<K, V>() { | ||
return {...this}; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
mixin TimeUtil { | ||
/// Calculate minus from [seconds] | ||
static Duration durationFromSeconds(int seconds) { | ||
return DateTime.fromMillisecondsSinceEpoch(seconds * 1000) | ||
.difference(DateTime.fromMillisecondsSinceEpoch(0)); | ||
} | ||
|
||
static DateTime timeAfterMilliseconds(int milliseconds) { | ||
return DateTime.fromMillisecondsSinceEpoch( | ||
DateTime.now().millisecondsSinceEpoch + milliseconds, | ||
); | ||
} | ||
|
||
static String? getFormattedDuration(Duration duration) { | ||
final result = <String>[]; | ||
final days = duration.inDays; | ||
final hours = duration.inHours % 60; | ||
final minutes = duration.inMinutes % 60; | ||
|
||
if (days != 0) { | ||
result.add('$days days'); | ||
} | ||
if (hours != 0) { | ||
result.add('$hours hours'); | ||
} | ||
if (minutes != 0) { | ||
result.add('$minutes minutes'); | ||
} | ||
return result.firstOrNull; | ||
} | ||
|
||
/// Get range of millisecondsSinceEpoch, which is [daysAgo] from today and [daysAfter] after today. | ||
/// For example: | ||
/// current time is: 2023-10-11 15:10:26.818764 | ||
/// return rage is: (2023-10-05 00:00:00.000, 2023-10-17 23:59:59.999) | ||
static (int, int) getTimeRange(DateTime time, | ||
{required int daysAgo, required int daysAfter}) { | ||
final timeAgo = time.subtract(Duration(days: daysAgo)); | ||
final timeAfter = time.add(Duration(days: daysAfter)); | ||
|
||
final rangeStart = DateTime(timeAgo.year, timeAgo.month, timeAgo.day) | ||
.millisecondsSinceEpoch; | ||
final rangeEnd = | ||
DateTime(timeAfter.year, timeAfter.month, timeAfter.day + 1) | ||
.millisecondsSinceEpoch - 1; | ||
|
||
return (rangeStart, rangeEnd); | ||
} | ||
|
||
static (int, int) getTimeRangeOfTheTargetDay(DateTime time) { | ||
return getTimeRange(time, daysAgo: 0, daysAfter: 0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 0 additions & 2 deletions
2
lib/core/data/repository/load_result.dart → lib/core/data/load_result.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
part of 'ani_list_repository.dart'; | ||
|
||
enum LoadType { refresh, append } | ||
|
||
sealed class LoadResult<T> {} | ||
|
Oops, something went wrong.