feat: migrate prosappco from Firebase to NestJS REST API (Fase 2)
- Replace all Firebase* repositories with Api* repositories using HTTP + SharedPreferences JWT - Remove Firebase.initializeApp() and firebase_messaging background handler from main.dart - Update DI (app_di.dart) to inject Api* repositories instead of Firebase* ones - Replace all Timestamp/cloud_firestore usage with ISO 8601 String dates - Stub PhoneVerificationService (Firebase phone OTP → backend OTP when implemented) - Add ApiService singleton with JWT management in lib/services/ - Legacy firebase_*_repository.dart files preserved for Fase 4 cleanup Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
726cf12fd2
commit
733384091c
@@ -1,5 +1,4 @@
|
||||
import 'package:chat_repository/chat_repository.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
@@ -111,7 +110,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
),
|
||||
),
|
||||
subtitle: widget.service.userId ==
|
||||
FirebaseAuth.instance.currentUser!.uid
|
||||
ApiUserRepository.currentUserId ?? ''
|
||||
? GeneralReputation(
|
||||
userId: widget.service.professionalId,
|
||||
builder: (context, reputation) {
|
||||
@@ -229,7 +228,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
|
||||
MessageEntity message = MessageEntity(
|
||||
ownerId:
|
||||
FirebaseAuth.instance.currentUser!.uid,
|
||||
ApiUserRepository.currentUserId ?? '',
|
||||
content: _messageController.text.trim(),
|
||||
createdAt: DateTime.now(),
|
||||
);
|
||||
@@ -272,7 +271,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
}
|
||||
|
||||
MessageEntity message = MessageEntity(
|
||||
ownerId: FirebaseAuth.instance.currentUser!.uid,
|
||||
ownerId: ApiUserRepository.currentUserId ?? '',
|
||||
content: _messageController.text.trim(),
|
||||
createdAt: DateTime.now(),
|
||||
);
|
||||
@@ -340,7 +339,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
List<Widget> _messagesList(List<MessageEntity> messages) {
|
||||
return messages
|
||||
.map(
|
||||
(e) => e.ownerId != FirebaseAuth.instance.currentUser!.uid
|
||||
(e) => e.ownerId != ApiUserRepository.currentUserId ?? ''
|
||||
? ListTile(
|
||||
title: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@@ -437,12 +436,12 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
|
||||
Future<List<dynamic>> _getUserAndProfessionalInfo(
|
||||
ServiceEntity service) async {
|
||||
final userRepo = FirebaseUserRepository(FirebaseAuth.instance);
|
||||
final userRepo = Injector.appInstance.get<UserRepository>();
|
||||
|
||||
final MyUser? userInfo;
|
||||
final MyUser? myInfo;
|
||||
|
||||
if (FirebaseAuth.instance.currentUser!.uid == service.userId) {
|
||||
if ((ApiUserRepository.currentUserId ?? '') == service.userId) {
|
||||
userInfo = await userRepo.getMyUser(service.professionalId);
|
||||
myInfo = await userRepo.getMyUser(service.userId);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user