Replace all Firebase SDK (Auth, Firestore, Storage) with HTTP calls to backend.prosapp.co/api/v1: - New ApiService singleton (JWT token, GET/POST/PATCH/DELETE/upload) - auth_provider: Firebase Auth → /auth/login, /auth/register, /auth/phone/* - services_provider + calendar_services_provider → /services endpoints - professional_provider + professionals_provider → /professional-info, /users/professionals - profile_form_provider + professional_form_provider → /users/me, /storage/upload - cities/professions/settings providers → /cities, /professions, /settings - firebase_chat_repository → polling via /chats endpoints (3s interval) - firebase_score_repository → polling via /comments endpoints (10s interval) - professional_detail_provider → /users/:id + /professional-info/:id - dashboard_view: Firestore.add → POST /services - chat_view + rating_view: FirebaseAuth.uid → AuthProvider.user.id - Models: Timestamp → String for createdAt fields - google_fonts upgraded to ^8.1.0 (Dart 3.12 compat) - Remove firebase_core, firebase_auth, cloud_firestore, firebase_storage from pubspec Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
61 lines
1.7 KiB
Dart
61 lines
1.7 KiB
Dart
import 'package:flutter/widgets.dart';
|
|
import 'package:prosapp_web_app/models/location_preferences.dart';
|
|
import 'package:prosapp_web_app/models/payment_method_entity.dart';
|
|
import 'package:prosapp_web_app/models/profesional.dart';
|
|
import 'package:prosapp_web_app/models/schedules.dart';
|
|
import 'package:prosapp_web_app/services/api_service.dart';
|
|
|
|
class ProfessionalProvider extends ChangeNotifier {
|
|
Profesional? profesional;
|
|
bool _isProModeActive = false;
|
|
final _api = ApiService.instance;
|
|
|
|
bool get isProModeActive => _isProModeActive;
|
|
|
|
Future<Profesional> getProfessional(String uid) async {
|
|
try {
|
|
final data = await _api.get('/professional-info/$uid');
|
|
profesional = Profesional.fromDocument(data as Map<String, dynamic>);
|
|
} catch (e) {
|
|
profesional = Profesional(
|
|
id: uid,
|
|
identification: '',
|
|
address: '',
|
|
aditionalAddress: '',
|
|
profession: '',
|
|
ratePreferences: false,
|
|
rate: '',
|
|
locationPreferences: LocationPreferences.office,
|
|
bannerPicture: '',
|
|
identificationPicture: '',
|
|
certificatePicture: '',
|
|
latitude: 0,
|
|
longitude: 0,
|
|
specializations: [],
|
|
specializationsPictures: [],
|
|
schedules: Schedules.empty,
|
|
paymentMethods: PaymentMethodEntity.empty,
|
|
);
|
|
}
|
|
notifyListeners();
|
|
return profesional!;
|
|
}
|
|
|
|
void logout() {
|
|
_isProModeActive = false;
|
|
notifyListeners();
|
|
}
|
|
|
|
void toggleProMode() {
|
|
_isProModeActive = !_isProModeActive;
|
|
notifyListeners();
|
|
}
|
|
|
|
void setIsProModeActive(bool value) {
|
|
_isProModeActive = value;
|
|
notifyListeners();
|
|
}
|
|
|
|
sendProfessionalToReview() {}
|
|
}
|