Added native os notifications

This commit is contained in:
2026-07-02 00:33:28 +10:00
parent 84379baf6a
commit 027437dc9b
13 changed files with 451 additions and 117 deletions
+54 -8
View File
@@ -12,6 +12,7 @@ class SettingsRegistry
'FlightsGoneBy Settings' => 'Settings for Site Behaviour',
'AI Generated Content' => 'Airline tail logos and liveries are AI generated with human cleanup. If you would rather not see any AI, then our blank aircraft templates are human created.',
'Account & Privacy' => 'Everything to do with your account.',
'Notifications' => 'What you want to hear about (or not!)',
];
}
@@ -22,7 +23,7 @@ class SettingsRegistry
'key' => 'distance_unit',
'type' => 'select',
'label' => 'Distance Units',
'category' => 'Units of Measurement',
'category' => 'FlightsGoneBy Settings',
'default' => 'km',
'options' => [
['value' => 'km', 'label' => 'Kilometres (km)'],
@@ -107,7 +108,7 @@ class SettingsRegistry
'category' => 'FlightsGoneBy Settings',
'type' => 'multiselect',
'label' => 'Which columns to show on the Departure Board',
'default' => ['airline', 'flight_number', 'from', 'to', 'departure_date', 'departure_time', 'arrival_time', 'duration', 'distance', 'aircraft', 'registration', 'class_seat_combined'],
'default' => ['airline', 'flight_number', 'departure_airport', 'arrival_airport', 'departure_date', 'departure_time', 'arrival_time', 'duration', 'distance', 'aircraft', 'registration', 'class_seat_combined'],
'options' => [
['value' => 'airline', 'label' => 'Airline'],
['value' => 'flight_number', 'label' => 'Flight Number'],
@@ -123,6 +124,48 @@ class SettingsRegistry
['value' => 'class_seat_combined', 'label' => 'Class/Seat Type/Seat Number Combined'],
],
],
[
'category' => 'Notifications',
'key' => 'notify_on_new_follower',
'type' => 'checkbox',
'label' => 'Notify Me When I Receive a New Follower',
'default' => true,
],
[
'category' => 'Notifications',
'key' => 'notify_on_historic_flight_added',
'type' => 'checkbox',
'label' => 'Notify Me When Someone I Follow Logs a Historic Flight',
'default' => true,
],
[
'category' => 'Notifications',
'key' => 'notify_on_upcoming_flight_added',
'type' => 'checkbox',
'label' => 'Notify Me When Someone I Follow Logs an Upcoming Flight',
'default' => true,
],
[
'category' => 'Notifications',
'key' => 'notify_on_flight_departure',
'type' => 'checkbox',
'label' => 'Notify Me When Someone I Follow Departs',
'default' => true,
],
/* [
'category' => 'Notifications',
'key' => 'notify_on_flight_arrival',
'type' => 'checkbox',
'label' => 'Notify Me When Someone I Follow Arrives',
'default' => true,
],*/
[
'category' => 'Notifications',
'key' => 'notify_on_flight_cancellation',
'type' => 'checkbox',
'label' => 'Notify Me When Someone I Follow Cancels an Upcoming Flight',
'default' => false,
],
];
}
@@ -139,13 +182,16 @@ class SettingsRegistry
foreach (static::schema() as $field) {
$key = "settings.{$field['key']}";
$rules[$key] = match ($field['type']) {
'select' => ['required', 'string', 'in:' . implode(',', array_column($field['options'], 'value'))],
'checkbox' => ['boolean'],
'text' => ['nullable', 'string', 'max:255'],
'multiselect' => ['nullable', 'array'],
"settings.{$field['key']}.*" => ['string'],
default => ['nullable'],
'select' => ['sometimes', 'required', 'string', 'in:' . implode(',', array_column($field['options'], 'value'))],
'checkbox' => ['sometimes', 'boolean'],
'text' => ['sometimes', 'nullable', 'string', 'max:255'],
'multiselect' => ['sometimes', 'nullable', 'array'],
default => ['sometimes', 'nullable'],
};
if ($field['type'] === 'multiselect') {
$rules["{$key}.*"] = ['string'];
}
}
return $rules;
}