ja acabei a app acho?

This commit is contained in:
2026-03-04 11:32:02 +00:00
parent 9105fc5a32
commit 5f3b5478a7
40 changed files with 31 additions and 17 deletions

Binary file not shown.

View File

@@ -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

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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));

View File

@@ -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!",

View File

@@ -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);
}

View File

@@ -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"))

View File

@@ -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) {

View File

@@ -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 {

View File

@@ -646,7 +646,7 @@ code + .copy-button {
<script type="text/javascript">
function configurationCacheProblems() { return (
// begin-report-data
{"diagnostics":[{"locations":[{"path":"/Users/230405/Desktop/papcuida/app/build.gradle","line":7}],"problem":[{"text":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10."}],"contextualLabel":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/9.2.1/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"properties-should-be-assigned-using-the-propname-value-syntax-setting-a-property-via-the-gradle-generated-propname-value-or-propname-value-syntax-in-groovy-dsl","displayName":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('namespace = <value>') instead."}]]},{"locations":[{"path":"/Users/230405/Desktop/papcuida/app/build.gradle","line":34}],"problem":[{"text":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10."}],"contextualLabel":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/9.2.1/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"properties-should-be-assigned-using-the-propname-value-syntax-setting-a-property-via-the-gradle-generated-propname-value-or-propname-value-syntax-in-groovy-dsl","displayName":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('viewBinding = <value>') instead."}]]}],"problemsReport":{"totalProblemCount":2,"buildName":"Cuida","requestedTasks":"","documentationLink":"https://docs.gradle.org/9.2.1/userguide/reporting_problems.html","documentationLinkCaption":"Problem report","summaries":[]}}
{"diagnostics":[{"locations":[{"path":"/Users/230405/Desktop/papcuida/app/build.gradle","line":7}],"problem":[{"text":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10."}],"contextualLabel":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/9.2.1/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"properties-should-be-assigned-using-the-propname-value-syntax-setting-a-property-via-the-gradle-generated-propname-value-or-propname-value-syntax-in-groovy-dsl","displayName":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('namespace = <value>') instead."}]]},{"locations":[{"path":"/Users/230405/Desktop/papcuida/app/build.gradle","line":34}],"problem":[{"text":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10."}],"contextualLabel":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/9.2.1/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"properties-should-be-assigned-using-the-propname-value-syntax-setting-a-property-via-the-gradle-generated-propname-value-or-propname-value-syntax-in-groovy-dsl","displayName":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('viewBinding = <value>') instead."}]]},{"locations":[{"taskPath":":app:compileDebugJavaWithJavac"}],"problem":[{"text":"source value 8 is obsolete and will be removed in a future release"}],"severity":"WARNING","problemDetails":[{"text":"warning: [options] source value 8 is obsolete and will be removed in a future release"}],"contextualLabel":"source value 8 is obsolete and will be removed in a future release","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler.warn.option.obsolete.source","displayName":"source value 8 is obsolete and will be removed in a future release"}]},{"locations":[{"taskPath":":app:compileDebugJavaWithJavac"}],"problem":[{"text":"target value 8 is obsolete and will be removed in a future release"}],"severity":"WARNING","problemDetails":[{"text":"warning: [options] target value 8 is obsolete and will be removed in a future release"}],"contextualLabel":"target value 8 is obsolete and will be removed in a future release","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler.warn.option.obsolete.target","displayName":"target value 8 is obsolete and will be removed in a future release"}]},{"locations":[{"taskPath":":app:compileDebugJavaWithJavac"}],"problem":[{"text":"To suppress warnings about obsolete options, use -Xlint:-options."}],"severity":"WARNING","problemDetails":[{"text":"warning: [options] To suppress warnings about obsolete options, use -Xlint:-options."}],"contextualLabel":"To suppress warnings about obsolete options, use -Xlint:-options.","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler.warn.option.obsolete.suppression","displayName":"To suppress warnings about obsolete options, use -Xlint:-options."}]}],"problemsReport":{"totalProblemCount":5,"buildName":"Cuida","requestedTasks":"app:assembleDebug","documentationLink":"https://docs.gradle.org/9.2.1/userguide/reporting_problems.html","documentationLinkCaption":"Problem report","summaries":[]}}
// end-report-data
);}
</script>