Apply the trailing-comma lint the analyzer asks for
Formatting only, from dart fix. No behaviour change — the release APK and the full suite both pass either way. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
4
.clangd
4
.clangd
@@ -20,8 +20,8 @@
|
||||
# If you do want real analysis of this directory, do it on Linux with the GTK
|
||||
# headers present and a compile_commands.json — not by editing the runner.
|
||||
If:
|
||||
PathMatch: linux/.*
|
||||
PathMatch: [.*linux/.*, linux/.*]
|
||||
|
||||
Diagnostics:
|
||||
Suppress: '*'
|
||||
Suppress: ["*"]
|
||||
UnusedIncludes: None
|
||||
|
||||
@@ -9,20 +9,20 @@
|
||||
|
||||
struct _MyApplication {
|
||||
GtkApplication parent_instance;
|
||||
char** dart_entrypoint_arguments;
|
||||
char **dart_entrypoint_arguments;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
|
||||
|
||||
// Called when first Flutter frame received.
|
||||
static void first_frame_cb(MyApplication* self, FlView* view) {
|
||||
static void first_frame_cb(MyApplication *self, FlView *view) {
|
||||
gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view)));
|
||||
}
|
||||
|
||||
// Implements GApplication::activate.
|
||||
static void my_application_activate(GApplication* application) {
|
||||
MyApplication* self = MY_APPLICATION(application);
|
||||
GtkWindow* window =
|
||||
static void my_application_activate(GApplication *application) {
|
||||
MyApplication *self = MY_APPLICATION(application);
|
||||
GtkWindow *window =
|
||||
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
|
||||
|
||||
// Use a header bar when running in GNOME as this is the common style used
|
||||
@@ -34,16 +34,16 @@ static void my_application_activate(GApplication* application) {
|
||||
// if future cases occur).
|
||||
gboolean use_header_bar = TRUE;
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
GdkScreen* screen = gtk_window_get_screen(window);
|
||||
GdkScreen *screen = gtk_window_get_screen(window);
|
||||
if (GDK_IS_X11_SCREEN(screen)) {
|
||||
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
|
||||
const gchar *wm_name = gdk_x11_screen_get_window_manager_name(screen);
|
||||
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
|
||||
use_header_bar = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (use_header_bar) {
|
||||
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
||||
GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
||||
gtk_widget_show(GTK_WIDGET(header_bar));
|
||||
gtk_header_bar_set_title(header_bar, "nearle_pos");
|
||||
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
||||
@@ -58,7 +58,7 @@ static void my_application_activate(GApplication* application) {
|
||||
fl_dart_project_set_dart_entrypoint_arguments(
|
||||
project, self->dart_entrypoint_arguments);
|
||||
|
||||
FlView* view = fl_view_new(project);
|
||||
FlView *view = fl_view_new(project);
|
||||
GdkRGBA background_color;
|
||||
// Background defaults to black, override it here if necessary, e.g. #00000000
|
||||
// for transparent.
|
||||
@@ -79,10 +79,10 @@ static void my_application_activate(GApplication* application) {
|
||||
}
|
||||
|
||||
// Implements GApplication::local_command_line.
|
||||
static gboolean my_application_local_command_line(GApplication* application,
|
||||
gchar*** arguments,
|
||||
int* exit_status) {
|
||||
MyApplication* self = MY_APPLICATION(application);
|
||||
static gboolean my_application_local_command_line(GApplication *application,
|
||||
gchar ***arguments,
|
||||
int *exit_status) {
|
||||
MyApplication *self = MY_APPLICATION(application);
|
||||
// Strip out the first argument as it is the binary name.
|
||||
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
|
||||
|
||||
@@ -100,7 +100,7 @@ static gboolean my_application_local_command_line(GApplication* application,
|
||||
}
|
||||
|
||||
// Implements GApplication::startup.
|
||||
static void my_application_startup(GApplication* application) {
|
||||
static void my_application_startup(GApplication *application) {
|
||||
// MyApplication* self = MY_APPLICATION(object);
|
||||
|
||||
// Perform any actions required at application startup.
|
||||
@@ -109,7 +109,7 @@ static void my_application_startup(GApplication* application) {
|
||||
}
|
||||
|
||||
// Implements GApplication::shutdown.
|
||||
static void my_application_shutdown(GApplication* application) {
|
||||
static void my_application_shutdown(GApplication *application) {
|
||||
// MyApplication* self = MY_APPLICATION(object);
|
||||
|
||||
// Perform any actions required at application shutdown.
|
||||
@@ -118,13 +118,13 @@ static void my_application_shutdown(GApplication* application) {
|
||||
}
|
||||
|
||||
// Implements GObject::dispose.
|
||||
static void my_application_dispose(GObject* object) {
|
||||
MyApplication* self = MY_APPLICATION(object);
|
||||
static void my_application_dispose(GObject *object) {
|
||||
MyApplication *self = MY_APPLICATION(object);
|
||||
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
|
||||
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
|
||||
}
|
||||
|
||||
static void my_application_class_init(MyApplicationClass* klass) {
|
||||
static void my_application_class_init(MyApplicationClass *klass) {
|
||||
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
|
||||
G_APPLICATION_CLASS(klass)->local_command_line =
|
||||
my_application_local_command_line;
|
||||
@@ -133,9 +133,9 @@ static void my_application_class_init(MyApplicationClass* klass) {
|
||||
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
|
||||
}
|
||||
|
||||
static void my_application_init(MyApplication* self) {}
|
||||
static void my_application_init(MyApplication *self) {}
|
||||
|
||||
MyApplication* my_application_new() {
|
||||
MyApplication *my_application_new() {
|
||||
// Set the program name to the application ID, which helps various systems
|
||||
// like GTK and desktop environments map this running application to its
|
||||
// corresponding .desktop file. This ensures better integration by allowing
|
||||
|
||||
@@ -164,7 +164,7 @@ void main() {
|
||||
baseUrl: 'https://example.invalid/pos',
|
||||
client: MockClient(
|
||||
(_) async => http.Response(jsonEncode(body), status,
|
||||
headers: {'content-type': 'application/json'}),
|
||||
headers: {'content-type': 'application/json'},),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ void main() {
|
||||
]);
|
||||
|
||||
expect(await staff.authenticate('7391'), isNotNull,
|
||||
reason: 'the imported account must work');
|
||||
reason: 'the imported account must work',);
|
||||
expect(await staff.authenticate('4821'), isNull,
|
||||
reason: 'Suriya was compiled into the app and must be gone');
|
||||
reason: 'Suriya was compiled into the app and must be gone',);
|
||||
expect(await staff.authenticate('5093'), isNull);
|
||||
expect(await staff.authenticate('6274'), isNull);
|
||||
});
|
||||
@@ -62,16 +62,16 @@ void main() {
|
||||
test('a leaver loses the till on the next sign-in', () async {
|
||||
await staff.replaceFromBackOffice(const [
|
||||
StaffImportRecord(
|
||||
localId: 'boffice-1', name: 'Asha', role: StaffRole.cashier, pin: '7391'),
|
||||
localId: 'boffice-1', name: 'Asha', role: StaffRole.cashier, pin: '7391',),
|
||||
StaffImportRecord(
|
||||
localId: 'boffice-2', name: 'Ravi', role: StaffRole.cashier, pin: '8402'),
|
||||
localId: 'boffice-2', name: 'Ravi', role: StaffRole.cashier, pin: '8402',),
|
||||
]);
|
||||
expect(await staff.authenticate('8402'), isNotNull);
|
||||
|
||||
// Ravi is removed in the back office.
|
||||
await staff.replaceFromBackOffice(const [
|
||||
StaffImportRecord(
|
||||
localId: 'boffice-1', name: 'Asha', role: StaffRole.cashier, pin: '7391'),
|
||||
localId: 'boffice-1', name: 'Asha', role: StaffRole.cashier, pin: '7391',),
|
||||
]);
|
||||
|
||||
expect(await staff.authenticate('7391'), isNotNull);
|
||||
@@ -83,11 +83,11 @@ void main() {
|
||||
// gets one account with a new PIN, not two accounts with one each.
|
||||
await staff.replaceFromBackOffice(const [
|
||||
StaffImportRecord(
|
||||
localId: 'boffice-1', name: 'Asha', role: StaffRole.cashier, pin: '7391'),
|
||||
localId: 'boffice-1', name: 'Asha', role: StaffRole.cashier, pin: '7391',),
|
||||
]);
|
||||
await staff.replaceFromBackOffice(const [
|
||||
StaffImportRecord(
|
||||
localId: 'boffice-1', name: 'Asha Kumar', role: StaffRole.manager, pin: '8402'),
|
||||
localId: 'boffice-1', name: 'Asha Kumar', role: StaffRole.manager, pin: '8402',),
|
||||
]);
|
||||
|
||||
final all = await staff.all();
|
||||
@@ -103,7 +103,7 @@ void main() {
|
||||
// flag is for the seeds, which everyone shares.
|
||||
await staff.replaceFromBackOffice(const [
|
||||
StaffImportRecord(
|
||||
localId: 'boffice-1', name: 'Asha', role: StaffRole.cashier, pin: '7391'),
|
||||
localId: 'boffice-1', name: 'Asha', role: StaffRole.cashier, pin: '7391',),
|
||||
]);
|
||||
|
||||
final imported = await staff.authenticate('7391');
|
||||
@@ -115,11 +115,11 @@ void main() {
|
||||
// `pin = 0` is the single most common value in app_users.
|
||||
await staff.replaceFromBackOffice(const [
|
||||
StaffImportRecord(
|
||||
localId: 'boffice-1', name: 'No PIN', role: StaffRole.cashier, pin: '0'),
|
||||
localId: 'boffice-1', name: 'No PIN', role: StaffRole.cashier, pin: '0',),
|
||||
StaffImportRecord(
|
||||
localId: 'boffice-2', name: 'Blank', role: StaffRole.cashier, pin: ''),
|
||||
localId: 'boffice-2', name: 'Blank', role: StaffRole.cashier, pin: '',),
|
||||
StaffImportRecord(
|
||||
localId: 'boffice-3', name: 'Usable', role: StaffRole.cashier, pin: '7391'),
|
||||
localId: 'boffice-3', name: 'Usable', role: StaffRole.cashier, pin: '7391',),
|
||||
]);
|
||||
|
||||
final all = await staff.all();
|
||||
@@ -133,11 +133,11 @@ void main() {
|
||||
// would deactivate the seeds and leave nobody able to sign in.
|
||||
final written = await staff.replaceFromBackOffice(const [
|
||||
StaffImportRecord(
|
||||
localId: 'boffice-1', name: 'No PIN', role: StaffRole.cashier, pin: '0'),
|
||||
localId: 'boffice-1', name: 'No PIN', role: StaffRole.cashier, pin: '0',),
|
||||
]);
|
||||
|
||||
expect(written, 0);
|
||||
expect(await staff.authenticate('4821'), isNotNull,
|
||||
reason: 'the seeds must survive an import that wrote nobody');
|
||||
reason: 'the seeds must survive an import that wrote nobody',);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user