mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Lint the code with a line length of 100
This makes it easier to understand the diffs
This commit is contained in:
@@ -43,9 +43,8 @@ class Icon {
|
||||
_fileExtension = path.split('.').last;
|
||||
}
|
||||
|
||||
String getFilename(String appId) => (type == _symbolicType)
|
||||
? '$appId-symbolic.$_fileExtension'
|
||||
: '$appId.$_fileExtension';
|
||||
String getFilename(String appId) =>
|
||||
(type == _symbolicType) ? '$appId-symbolic.$_fileExtension' : '$appId.$_fileExtension';
|
||||
}
|
||||
|
||||
class GithubReleases {
|
||||
@@ -74,8 +73,7 @@ class GithubReleases {
|
||||
final releaseJsonContent = (await http.get(Uri(
|
||||
scheme: 'https',
|
||||
host: 'api.github.com',
|
||||
path:
|
||||
'/repos/$githubReleaseOrganization/$githubReleaseProject/releases')))
|
||||
path: '/repos/$githubReleaseOrganization/$githubReleaseProject/releases')))
|
||||
.body;
|
||||
final decodedJson = jsonDecode(releaseJsonContent) as List;
|
||||
|
||||
@@ -86,10 +84,8 @@ class GithubReleases {
|
||||
await Future.forEach<dynamic>(decodedJson, (dynamic releaseDynamic) async {
|
||||
final releaseMap = releaseDynamic as Map;
|
||||
|
||||
final releaseDateAndTime =
|
||||
DateTime.parse(releaseMap['published_at'] as String);
|
||||
final releaseDateString =
|
||||
releaseDateAndTime.toIso8601String().split('T').first;
|
||||
final releaseDateAndTime = DateTime.parse(releaseMap['published_at'] as String);
|
||||
final releaseDateString = releaseDateAndTime.toIso8601String().split('T').first;
|
||||
|
||||
if (latestReleaseAssetDate == null ||
|
||||
(latestReleaseAssetDate?.compareTo(releaseDateAndTime) == -1)) {
|
||||
@@ -100,8 +96,7 @@ class GithubReleases {
|
||||
}
|
||||
}
|
||||
|
||||
releases.add(Release(
|
||||
version: releaseMap['name'] as String, date: releaseDateString));
|
||||
releases.add(Release(version: releaseMap['name'] as String, date: releaseDateString));
|
||||
});
|
||||
|
||||
if (releases.isNotEmpty) {
|
||||
@@ -120,8 +115,7 @@ class GithubReleases {
|
||||
final downloadUrl = amMap['browser_download_url'] as String;
|
||||
final filename = amMap['name'] as String;
|
||||
final fileExtension = filename.substring(filename.indexOf('.') + 1);
|
||||
final filenameWithoutExtension =
|
||||
filename.substring(0, filename.indexOf('.'));
|
||||
final filenameWithoutExtension = filename.substring(0, filename.indexOf('.'));
|
||||
|
||||
final arch = filenameWithoutExtension.endsWith('aarch64')
|
||||
? CPUArchitecture.aarch64
|
||||
@@ -218,8 +212,7 @@ class FlatpakMeta {
|
||||
: _localReleases = localReleases,
|
||||
_localReleaseAssets = localReleaseAssets {
|
||||
if (githubReleaseOrganization != null && githubReleaseProject != null) {
|
||||
_githubReleases =
|
||||
GithubReleases(githubReleaseOrganization!, githubReleaseProject!);
|
||||
_githubReleases = GithubReleases(githubReleaseOrganization!, githubReleaseProject!);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,15 +225,13 @@ class FlatpakMeta {
|
||||
return await _githubReleases!.getReleases();
|
||||
} else {
|
||||
if (_localReleases == null) {
|
||||
throw Exception(
|
||||
'Metadata must include releases if not fetching releases from Github.');
|
||||
throw Exception('Metadata must include releases if not fetching releases from Github.');
|
||||
}
|
||||
return _localReleases!;
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<ReleaseAsset>?> getReleaseAssets(
|
||||
bool fetchReleasesFromGithub) async {
|
||||
Future<List<ReleaseAsset>?> getReleaseAssets(bool fetchReleasesFromGithub) async {
|
||||
if (fetchReleasesFromGithub) {
|
||||
if (_githubReleases == null) {
|
||||
throw Exception(
|
||||
@@ -249,8 +240,7 @@ class FlatpakMeta {
|
||||
return _githubReleases!.getLatestReleaseAssets();
|
||||
} else {
|
||||
if (_localReleases == null) {
|
||||
throw Exception(
|
||||
'Metadata must include releases if not fetching releases from Github.');
|
||||
throw Exception('Metadata must include releases if not fetching releases from Github.');
|
||||
}
|
||||
return _localReleaseAssets;
|
||||
}
|
||||
@@ -262,17 +252,13 @@ class FlatpakMeta {
|
||||
return FlatpakMeta(
|
||||
appId: json['appId'] as String,
|
||||
lowercaseAppName: json['lowercaseAppName'] as String,
|
||||
githubReleaseOrganization:
|
||||
json['githubReleaseOrganization'] as String?,
|
||||
githubReleaseOrganization: json['githubReleaseOrganization'] as String?,
|
||||
githubReleaseProject: json['githubReleaseProject'] as String?,
|
||||
localReleases: (json['localReleases'] as List?)?.map((dynamic r) {
|
||||
final rMap = r as Map;
|
||||
return Release(
|
||||
version: rMap['version'] as String,
|
||||
date: rMap['date'] as String);
|
||||
return Release(version: rMap['version'] as String, date: rMap['date'] as String);
|
||||
}).toList(),
|
||||
localReleaseAssets:
|
||||
(json['localReleaseAssets'] as List?)?.map((dynamic ra) {
|
||||
localReleaseAssets: (json['localReleaseAssets'] as List?)?.map((dynamic ra) {
|
||||
final raMap = ra as Map;
|
||||
final archString = raMap['arch'] as String;
|
||||
final arch = (archString == CPUArchitecture.x86_64.flatpakArchCode)
|
||||
@@ -284,10 +270,8 @@ class FlatpakMeta {
|
||||
throw Exception(
|
||||
'Architecture must be either "${CPUArchitecture.x86_64.flatpakArchCode}" or "${CPUArchitecture.aarch64.flatpakArchCode}"');
|
||||
}
|
||||
final tarballPath =
|
||||
'${jsonFile.parent.path}/${raMap['tarballPath'] as String}';
|
||||
final preShasum =
|
||||
Process.runSync('shasum', ['-a', '256', tarballPath]);
|
||||
final tarballPath = '${jsonFile.parent.path}/${raMap['tarballPath'] as String}';
|
||||
final preShasum = Process.runSync('shasum', ['-a', '256', tarballPath]);
|
||||
final shasum = preShasum.stdout.toString().split(' ').first;
|
||||
if (preShasum.exitCode != 0) {
|
||||
throw Exception(preShasum.stderr);
|
||||
@@ -302,17 +286,14 @@ class FlatpakMeta {
|
||||
appDataPath: json['appDataPath'] as String,
|
||||
desktopPath: json['desktopPath'] as String,
|
||||
icons: (json['icons'] as Map).entries.map((mapEntry) {
|
||||
return Icon(
|
||||
type: mapEntry.key as String, path: mapEntry.value as String);
|
||||
return Icon(type: mapEntry.key as String, path: mapEntry.value as String);
|
||||
}).toList(),
|
||||
freedesktopRuntime: json['freedesktopRuntime'] as String,
|
||||
buildCommandsAfterUnpack: (json['buildCommandsAfterUnpack'] as List?)
|
||||
?.map((dynamic bc) => bc as String)
|
||||
.toList(),
|
||||
extraModules: json['extraModules'] as List?,
|
||||
finishArgs: (json['finishArgs'] as List)
|
||||
.map((dynamic fa) => fa as String)
|
||||
.toList());
|
||||
finishArgs: (json['finishArgs'] as List).map((dynamic fa) => fa as String).toList());
|
||||
} catch (e) {
|
||||
throw Exception('Could not parse JSON file, due to this error:\n$e');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user