chore: أرشفة تطبيقات ولوحات تريبز التي سيحلّ محلها كود سيرو
استكمال قرار 2026-07-27 (كوميت fff76c9 أرشف الباك إند):
apps/rider → apps/rider-archive-cubit
apps/driver → apps/driver-archive-cubit
dashboards/admin-web → dashboards/admin-web-archive
dashboards/service-web → dashboards/service-web-archive
إعادة تسمية بلا تعديل محتوى. rider/driver كانا إعادة بناء Cubit مبنية على
عقد NestJS المؤرشف. admin-web و service-web نموذجان بملف HTML واحد (164 و
128 سطراً) — يحلّ محلهما siro_admin و siro_service المكتملان.
يُحمل من المؤرشف ولا يُعاد اكتشافه: عقد map-saas المثبَّت بالتجربة في
apps/rider-archive-cubit/lib/core/api/ (x-api-key ترويسة، reverse مصفوفة،
route في points) ودرس مسار FCM.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
fff76c949f
commit
9909d9b4c1
@@ -0,0 +1,79 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../core/storage/saved_places_store.dart';
|
||||
|
||||
class SavedPlacesState {
|
||||
final List<SavedPlace> places;
|
||||
final bool loading;
|
||||
final String? error;
|
||||
|
||||
const SavedPlacesState({
|
||||
this.places = const [],
|
||||
this.loading = false,
|
||||
this.error,
|
||||
});
|
||||
|
||||
SavedPlacesState copyWith({
|
||||
List<SavedPlace>? places,
|
||||
bool? loading,
|
||||
String? error,
|
||||
}) {
|
||||
return SavedPlacesState(
|
||||
places: places ?? this.places,
|
||||
loading: loading ?? this.loading,
|
||||
error: error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SavedPlacesCubit extends Cubit<SavedPlacesState> {
|
||||
final SavedPlacesStore _store;
|
||||
|
||||
SavedPlacesCubit(this._store) : super(const SavedPlacesState());
|
||||
|
||||
Future<void> load() async {
|
||||
emit(state.copyWith(loading: true, error: null));
|
||||
try {
|
||||
final places = await _store.getAll();
|
||||
emit(SavedPlacesState(places: places));
|
||||
} catch (e) {
|
||||
emit(state.copyWith(loading: false, error: e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> addPlace(SavedPlace place) async {
|
||||
try {
|
||||
await _store.add(place);
|
||||
await load();
|
||||
} catch (e) {
|
||||
emit(state.copyWith(error: e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> removePlace(String id) async {
|
||||
try {
|
||||
await _store.remove(id);
|
||||
await load();
|
||||
} catch (e) {
|
||||
emit(state.copyWith(error: e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setFavorite(String id, FavoriteType type) async {
|
||||
try {
|
||||
await _store.setFavorite(id, type);
|
||||
await load();
|
||||
} catch (e) {
|
||||
emit(state.copyWith(error: e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> clearFavorite(FavoriteType type) async {
|
||||
try {
|
||||
await _store.clearFavorite(type);
|
||||
await load();
|
||||
} catch (e) {
|
||||
emit(state.copyWith(error: e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user