- Implement EmergencyService for handling emergency contacts per trip. - Create GuestFlagService to manage guest mode flags for trips. - Introduce NotificationService with local notification capabilities. - Add OfflineFlagService for managing offline caching flags. - Develop PackingService for shared packing lists per trip. - Implement ReminderService for managing reminders/to-dos per trip. - Create SosService for dispatching SOS events to a backend. - Add StorageService with album image upload functionality. - Implement TransportService for managing transport segments per trip. - Create TripChecklistService for storing and retrieving trip checklists. - Add TripDocumentService for persisting trip documents metadata. test: Add unit tests for new services - Implement tests for AlbumService, BudgetService, EmergencyService, GuestFlagService, PackingService, ReminderService, SosService, TransportService, TripChecklistService, and TripDocumentService. - Ensure tests cover adding, loading, deleting, and handling corrupted payloads for each service.
40 lines
1.1 KiB
Dart
40 lines
1.1 KiB
Dart
import 'dart:math';
|
|
|
|
/// Provides lightweight, offline activity suggestions using heuristics.
|
|
class ActivitySuggestionService {
|
|
/// Returns a list of suggestion strings based on [city] and [weatherCode].
|
|
///
|
|
/// [weatherCode] is a simple tag: `sunny`, `rain`, `cold`, `default`.
|
|
List<String> suggestions({
|
|
required String city,
|
|
String weatherCode = 'default',
|
|
}) {
|
|
final base = <String>[
|
|
'Free walking tour de $city',
|
|
'Spot photo au coucher du soleil',
|
|
'Café local pour travailler/charger',
|
|
'Parc ou rooftop tranquille',
|
|
];
|
|
|
|
if (weatherCode == 'rain') {
|
|
base.addAll([
|
|
'Musée immanquable de $city',
|
|
'Escape game ou activité indoor',
|
|
'Food court couvert pour goûter local',
|
|
]);
|
|
} else if (weatherCode == 'cold') {
|
|
base.addAll(['Spa / bains chauds', 'Visite guidée en intérieur']);
|
|
} else {
|
|
base.addAll([
|
|
'Balade vélo ou trottinette',
|
|
'Pique-nique au parc central',
|
|
'Vue panoramique / rooftop',
|
|
]);
|
|
}
|
|
|
|
// Shuffle slightly for variation.
|
|
base.shuffle(Random(city.hashCode));
|
|
return base.take(6).toList();
|
|
}
|
|
}
|