ja acabei a app acho?
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
#Tue Mar 03 16:47:40 WET 2026
|
||||
#Wed Mar 04 11:26:11 WET 2026
|
||||
base.0=/Users/230405/Desktop/papcuida/app/build/intermediates/dex/debug/mergeExtDexDebug/classes.dex
|
||||
base.1=/Users/230405/Desktop/papcuida/app/build/intermediates/dex/debug/mergeProjectDexDebug/0/classes.dex
|
||||
base.10=/Users/230405/Desktop/papcuida/app/build/intermediates/dex/debug/mergeExtDexDebug/classes2.dex
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -12,16 +12,18 @@ public class Appointment {
|
||||
public String time; // HH:mm
|
||||
public String reason;
|
||||
public boolean isPast;
|
||||
public String userId;
|
||||
|
||||
// Required empty constructor for Firestore deserialization
|
||||
public Appointment() {
|
||||
}
|
||||
|
||||
public Appointment(String type, String date, String time, String reason, boolean isPast) {
|
||||
public Appointment(String type, String date, String time, String reason, boolean isPast, String userId) {
|
||||
this.type = type;
|
||||
this.date = date;
|
||||
this.time = time;
|
||||
this.reason = reason;
|
||||
this.isPast = isPast;
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,16 +12,18 @@ public class Medication {
|
||||
public String dosage; // e.g. "1 compprimido"
|
||||
public String notes;
|
||||
public boolean isTaken;
|
||||
public String userId;
|
||||
|
||||
// Required empty constructor for Firestore deserialization
|
||||
public Medication() {
|
||||
}
|
||||
|
||||
public Medication(String name, String time, String dosage, String notes) {
|
||||
public Medication(String name, String time, String dosage, String notes, String userId) {
|
||||
this.name = name;
|
||||
this.time = time;
|
||||
this.dosage = dosage;
|
||||
this.notes = notes;
|
||||
this.isTaken = false;
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ public class AppointmentsViewModel extends AndroidViewModel {
|
||||
String userId = auth.getCurrentUser().getUid();
|
||||
|
||||
// 1. Fetch Future Appointments
|
||||
db.collection("users").document(userId).collection("appointments")
|
||||
db.collection("consultas")
|
||||
.whereEqualTo("userId", userId)
|
||||
.whereEqualTo("isPast", false)
|
||||
.addSnapshotListener((value, error) -> {
|
||||
if (error != null) {
|
||||
@@ -68,7 +69,8 @@ public class AppointmentsViewModel extends AndroidViewModel {
|
||||
});
|
||||
|
||||
// 2. Fetch Past Appointments
|
||||
db.collection("users").document(userId).collection("appointments")
|
||||
db.collection("consultas")
|
||||
.whereEqualTo("userId", userId)
|
||||
.whereEqualTo("isPast", true)
|
||||
.addSnapshotListener((value, error) -> {
|
||||
if (error != null) {
|
||||
@@ -113,7 +115,9 @@ public class AppointmentsViewModel extends AndroidViewModel {
|
||||
return;
|
||||
String userId = auth.getCurrentUser().getUid();
|
||||
|
||||
db.collection("users").document(userId).collection("appointments")
|
||||
appointment.userId = userId;
|
||||
|
||||
db.collection("consultas")
|
||||
.add(appointment)
|
||||
.addOnSuccessListener(documentReference -> Log.d("AppointmentsVM", "Appointment added"))
|
||||
.addOnFailureListener(e -> Log.w("AppointmentsVM", "Error adding appointment", e));
|
||||
|
||||
@@ -61,7 +61,7 @@ public class RegisterActivity extends AppCompatActivity {
|
||||
userMap.put("numero_utente", utenteStr);
|
||||
userMap.put("profilePictureUri", ""); // Init empty
|
||||
|
||||
db.collection("usuarios").document(userId)
|
||||
db.collection("utilizadores").document(userId)
|
||||
.set(userMap)
|
||||
.addOnSuccessListener(aVoid -> {
|
||||
Toast.makeText(RegisterActivity.this, "Conta criada com sucesso!",
|
||||
|
||||
@@ -104,7 +104,7 @@ public class MedicationDialog extends DialogFragment {
|
||||
if (listener != null)
|
||||
listener.onSave(medicationToEdit);
|
||||
} else {
|
||||
Medication newMed = new Medication(name, time, dosage, notes);
|
||||
Medication newMed = new Medication(name, time, dosage, notes, null);
|
||||
if (listener != null)
|
||||
listener.onSave(newMed);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ public class MedicationViewModel extends AndroidViewModel {
|
||||
return;
|
||||
String userId = auth.getCurrentUser().getUid();
|
||||
|
||||
db.collection("users").document(userId).collection("medications")
|
||||
db.collection("medicamentos")
|
||||
.whereEqualTo("userId", userId)
|
||||
.orderBy("time", Query.Direction.ASCENDING)
|
||||
.addSnapshotListener((value, error) -> {
|
||||
if (error != null) {
|
||||
@@ -73,7 +74,9 @@ public class MedicationViewModel extends AndroidViewModel {
|
||||
return;
|
||||
String userId = auth.getCurrentUser().getUid();
|
||||
|
||||
db.collection("users").document(userId).collection("medications")
|
||||
medication.userId = userId;
|
||||
|
||||
db.collection("medicamentos")
|
||||
.add(medication)
|
||||
.addOnSuccessListener(documentReference -> Log.d("MedicationViewModel", "Medication added"))
|
||||
.addOnFailureListener(e -> Log.w("MedicationViewModel", "Error adding medication", e));
|
||||
@@ -84,7 +87,9 @@ public class MedicationViewModel extends AndroidViewModel {
|
||||
return;
|
||||
String userId = auth.getCurrentUser().getUid();
|
||||
|
||||
db.collection("users").document(userId).collection("medications")
|
||||
medication.userId = userId;
|
||||
|
||||
db.collection("medicamentos")
|
||||
.document(medication.id)
|
||||
.set(medication)
|
||||
.addOnSuccessListener(aVoid -> Log.d("MedicationViewModel", "Medication updated"))
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ProfileFragment extends Fragment {
|
||||
return;
|
||||
String userId = auth.getCurrentUser().getUid();
|
||||
|
||||
db.collection("users").document(userId).get()
|
||||
db.collection("utilizadores").document(userId).get()
|
||||
.addOnSuccessListener(documentSnapshot -> {
|
||||
if (documentSnapshot.exists()) {
|
||||
currentUser = documentSnapshot.toObject(User.class);
|
||||
@@ -175,7 +175,7 @@ public class ProfileFragment extends Fragment {
|
||||
currentUser.email = newEmail;
|
||||
|
||||
String userId = auth.getCurrentUser().getUid();
|
||||
db.collection("users").document(userId)
|
||||
db.collection("utilizadores").document(userId)
|
||||
.set(currentUser)
|
||||
.addOnSuccessListener(aVoid -> {
|
||||
if (emailChanged) {
|
||||
|
||||
@@ -75,7 +75,8 @@ public class ScheduleViewModel extends AndroidViewModel {
|
||||
return;
|
||||
String userId = auth.getCurrentUser().getUid();
|
||||
|
||||
db.collection("users").document(userId).collection("appointments")
|
||||
db.collection("consultas")
|
||||
.whereEqualTo("userId", userId)
|
||||
.whereEqualTo("date", date)
|
||||
.get()
|
||||
.addOnCompleteListener(task -> {
|
||||
@@ -122,9 +123,9 @@ public class ScheduleViewModel extends AndroidViewModel {
|
||||
String userId = auth.getCurrentUser().getUid();
|
||||
|
||||
if (date != null && time != null) {
|
||||
Appointment appointment = new Appointment("Consulta Geral", date, time, reason, false);
|
||||
Appointment appointment = new Appointment("Consulta Geral", date, time, reason, false, userId);
|
||||
|
||||
db.collection("users").document(userId).collection("appointments")
|
||||
db.collection("consultas")
|
||||
.add(appointment)
|
||||
.addOnSuccessListener(documentReference -> {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user