feat: add i18n

This commit is contained in:
Alberto Ponces
2022-08-07 00:37:12 +01:00
parent ab9b91b975
commit 89b642772c
15 changed files with 259 additions and 123 deletions

View File

@ -6,8 +6,9 @@ class GithubAPI {
var github = GitHub();
Future<String?> latestRelease(String org, repoName) async {
var latestRelease = await github.repositories
.getLatestRelease(RepositorySlug(org, repoName));
var latestRelease = await github.repositories.getLatestRelease(
RepositorySlug(org, repoName),
);
var dlurl = latestRelease.assets
?.firstWhere((asset) =>
asset.name != null &&
@ -18,32 +19,10 @@ class GithubAPI {
return dlurl;
}
Future latestCommitTime(String org, repoName) async {
var repo =
await github.repositories.getRepository(RepositorySlug(org, repoName));
var commitTime = repo.pushedAt?.difference(
DateTime.now().toLocal(),
Future<DateTime?> latestCommitTime(String org, repoName) async {
var repo = await github.repositories.getRepository(
RepositorySlug(org, repoName),
);
final hours = commitTime!.inHours.abs();
if (hours > 24) {
var days = (commitTime.inDays).abs().toString();
return "$days days";
} else if (hours > 1 && hours < 24) {
var hours = (commitTime.inHours).abs().toString();
return "$hours hours";
} else {
var minutes = (commitTime.inMinutes).abs().toString();
return "$minutes mins";
}
}
Future contributors(String org, repoName) async {
var contributors =
github.repositories.listContributors(RepositorySlug(org, repoName));
contributors.forEach((contributor) {});
return contributors;
return repo.pushedAt;
}
}