Browse Source

fix(nextcloud): fix appid sorting

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/974/head
Nikolas Rimikis 1 year ago
parent
commit
20528bb013
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 19
      packages/nextcloud/bin/generate_exports.dart
  2. 72
      packages/nextcloud/lib/ids.dart

19
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; import 'package:path/path.dart' as p;
void main() { void main() {
final files = final files = Directory('lib/src/api')
Directory('lib/src/api').listSync().cast<File>().where((final file) => file.path.endsWith('.openapi.dart')); .listSync()
.cast<File>()
.where((final file) => file.path.endsWith('.openapi.dart'))
.toList()
..sort((final a, final b) => a.path.compareTo(b.path));
final idStatements = <String>[]; final idStatements = StringBuffer();
for (final file in files) { for (final file in files) {
final basename = p.basename(file.path); final basename = p.basename(file.path);
@ -16,7 +20,9 @@ void main() {
final variablePrefix = toDartName(id); final variablePrefix = toDartName(id);
final classPrefix = toDartName(id, uppercaseFirstCharacter: true); 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';"]; final exports = ["export 'src/api/$id.openapi.dart';"];
if (File('lib/src/helpers/$id.dart').existsSync()) { if (File('lib/src/helpers/$id.dart').existsSync()) {
@ -41,10 +47,9 @@ extension ${classPrefix}Extension on NextcloudClient {
} }
File('lib/ids.dart').writeAsStringSync(''' File('lib/ids.dart').writeAsStringSync('''
// ignore_for_file: public_member_api_docs /// IDs of the apps.
final class AppIDs { final class AppIDs {
${idStatements.join('\n')} $idStatements
} }
'''); ''');
} }

72
packages/nextcloud/lib/ids.dart

@ -1,25 +1,65 @@
// ignore_for_file: public_member_api_docs /// IDs of the apps.
final class AppIDs { final class AppIDs {
static const filesSharing = 'files_sharing'; /// ID for the comments app.
static const filesVersions = 'files_versions'; static const comments = 'comments';
static const files = 'files';
static const updatenotification = 'updatenotification'; /// ID for the core app.
static const core = 'core';
/// ID for the dashboard app.
static const dashboard = 'dashboard'; static const dashboard = 'dashboard';
static const uppush = 'uppush';
static const settings = 'settings'; /// ID for the dav app.
static const dav = 'dav'; static const dav = 'dav';
static const userStatus = 'user_status';
static const notifications = 'notifications'; /// ID for the files app.
static const notes = 'notes'; static const files = 'files';
static const news = 'news';
static const core = 'core'; /// ID for the files_external app.
static const filesTrashbin = 'files_trashbin';
static const comments = 'comments';
static const sharebymail = 'sharebymail';
static const filesExternal = 'files_external'; static const filesExternal = 'files_external';
/// ID for the files_reminders app.
static const filesReminders = 'files_reminders'; 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'; 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'; 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'; static const weatherStatus = 'weather_status';
} }

Loading…
Cancel
Save