From 20528bb013f6af4db73eef232e58e7c475c4587a Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Sat, 14 Oct 2023 11:12:48 +0200 Subject: [PATCH] fix(nextcloud): fix appid sorting Signed-off-by: Nikolas Rimikis --- packages/nextcloud/bin/generate_exports.dart | 19 ++++-- packages/nextcloud/lib/ids.dart | 72 +++++++++++++++----- 2 files changed, 68 insertions(+), 23 deletions(-) diff --git a/packages/nextcloud/bin/generate_exports.dart b/packages/nextcloud/bin/generate_exports.dart index 2652b939..41f2bfe1 100644 --- a/packages/nextcloud/bin/generate_exports.dart +++ b/packages/nextcloud/bin/generate_exports.dart @@ -5,10 +5,14 @@ import 'package:dynamite/src/helpers/dart_helpers.dart'; import 'package:path/path.dart' as p; void main() { - final files = - Directory('lib/src/api').listSync().cast().where((final file) => file.path.endsWith('.openapi.dart')); + final files = Directory('lib/src/api') + .listSync() + .cast() + .where((final file) => file.path.endsWith('.openapi.dart')) + .toList() + ..sort((final a, final b) => a.path.compareTo(b.path)); - final idStatements = []; + final idStatements = StringBuffer(); for (final file in files) { final basename = p.basename(file.path); @@ -16,7 +20,9 @@ void main() { final variablePrefix = toDartName(id); final classPrefix = toDartName(id, uppercaseFirstCharacter: true); - idStatements.add(" static const $variablePrefix = '$id';"); + idStatements + ..writeln(' /// ID for the $id app.') + ..writeln(" static const $variablePrefix = '$id';"); final exports = ["export 'src/api/$id.openapi.dart';"]; if (File('lib/src/helpers/$id.dart').existsSync()) { @@ -41,10 +47,9 @@ extension ${classPrefix}Extension on NextcloudClient { } File('lib/ids.dart').writeAsStringSync(''' -// ignore_for_file: public_member_api_docs - +/// IDs of the apps. final class AppIDs { -${idStatements.join('\n')} +$idStatements } '''); } diff --git a/packages/nextcloud/lib/ids.dart b/packages/nextcloud/lib/ids.dart index 1b44fe20..aa8ec337 100644 --- a/packages/nextcloud/lib/ids.dart +++ b/packages/nextcloud/lib/ids.dart @@ -1,25 +1,65 @@ -// ignore_for_file: public_member_api_docs - +/// IDs of the apps. final class AppIDs { - static const filesSharing = 'files_sharing'; - static const filesVersions = 'files_versions'; - static const files = 'files'; - static const updatenotification = 'updatenotification'; + /// ID for the comments app. + static const comments = 'comments'; + + /// ID for the core app. + static const core = 'core'; + + /// ID for the dashboard app. static const dashboard = 'dashboard'; - static const uppush = 'uppush'; - static const settings = 'settings'; + + /// ID for the dav app. static const dav = 'dav'; - static const userStatus = 'user_status'; - static const notifications = 'notifications'; - static const notes = 'notes'; - static const news = 'news'; - static const core = 'core'; - static const filesTrashbin = 'files_trashbin'; - static const comments = 'comments'; - static const sharebymail = 'sharebymail'; + + /// ID for the files app. + static const files = 'files'; + + /// ID for the files_external app. static const filesExternal = 'files_external'; + + /// ID for the files_reminders app. static const filesReminders = 'files_reminders'; + + /// ID for the files_sharing app. + static const filesSharing = 'files_sharing'; + + /// ID for the files_trashbin app. + static const filesTrashbin = 'files_trashbin'; + + /// ID for the files_versions app. + static const filesVersions = 'files_versions'; + + /// ID for the news app. + static const news = 'news'; + + /// ID for the notes app. + static const notes = 'notes'; + + /// ID for the notifications app. + static const notifications = 'notifications'; + + /// ID for the provisioning_api app. static const provisioningApi = 'provisioning_api'; + + /// ID for the settings app. + static const settings = 'settings'; + + /// ID for the sharebymail app. + static const sharebymail = 'sharebymail'; + + /// ID for the theming app. static const theming = 'theming'; + + /// ID for the updatenotification app. + static const updatenotification = 'updatenotification'; + + /// ID for the uppush app. + static const uppush = 'uppush'; + + /// ID for the user_status app. + static const userStatus = 'user_status'; + + /// ID for the weather_status app. static const weatherStatus = 'weather_status'; }