diff --git a/app/src/main/java/com/symphony/mrfit/data/exercise/ExerciseRepository.kt b/app/src/main/java/com/symphony/mrfit/data/exercise/ExerciseRepository.kt index 63ffcae..55cfe3a 100644 --- a/app/src/main/java/com/symphony/mrfit/data/exercise/ExerciseRepository.kt +++ b/app/src/main/java/com/symphony/mrfit/data/exercise/ExerciseRepository.kt @@ -83,8 +83,14 @@ class ExerciseRepository { /** * Remove a specific Exercise by it's ID */ +// suspend fun deleteExercise(exeID: String) { +// Log.d(TAG, "Removing Exercise $exeID from Firestore") +// database.collection(EXERCISE_COLLECTION).document(exeID).delete().await() +// } suspend fun deleteExercise(exeID: String) { Log.d(TAG, "Removing Exercise $exeID from Firestore") + val storageRef = storage.reference.child(EXERCISE_PICTURE).child(exeID) + storageRef.delete().await() database.collection(EXERCISE_COLLECTION).document(exeID).delete().await() } diff --git a/app/src/main/java/com/symphony/mrfit/ui/WorkoutRoutineActivity.kt b/app/src/main/java/com/symphony/mrfit/ui/WorkoutRoutineActivity.kt index f74d959..f3842e8 100644 --- a/app/src/main/java/com/symphony/mrfit/ui/WorkoutRoutineActivity.kt +++ b/app/src/main/java/com/symphony/mrfit/ui/WorkoutRoutineActivity.kt @@ -177,7 +177,7 @@ class WorkoutRoutineActivity : AppCompatActivity() { exerciseViewModel.deleteRoutine(passedRoutineID) Toast.makeText( applicationContext, - "This workout has been removed from your list", + "This template has been removed from your list", Toast.LENGTH_SHORT ).show() finish() diff --git a/app/src/main/java/com/symphony/mrfit/ui/WorkoutTemplateActivity.kt b/app/src/main/java/com/symphony/mrfit/ui/WorkoutTemplateActivity.kt index 86833ea..04139bb 100644 --- a/app/src/main/java/com/symphony/mrfit/ui/WorkoutTemplateActivity.kt +++ b/app/src/main/java/com/symphony/mrfit/ui/WorkoutTemplateActivity.kt @@ -12,6 +12,7 @@ import android.content.Intent import android.os.Bundle import android.util.Log import android.view.View +import android.widget.Toast import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AppCompatActivity import androidx.lifecycle.Observer @@ -21,9 +22,7 @@ import com.google.firebase.ktx.Firebase import com.google.firebase.storage.FirebaseStorage import com.google.firebase.storage.ktx.storage import com.symphony.mrfit.R -import com.symphony.mrfit.data.exercise.ExerciseRepository -import com.symphony.mrfit.data.exercise.ExerciseViewModel -import com.symphony.mrfit.data.exercise.ExerciseViewModelFactory +import com.symphony.mrfit.data.exercise.* import com.symphony.mrfit.data.model.Workout import com.symphony.mrfit.databinding.ActivityWorkoutTemplateBinding import com.symphony.mrfit.ui.Helper.showSnackBar @@ -187,7 +186,13 @@ class WorkoutTemplateActivity : AppCompatActivity() { deleteButton.setOnClickListener { passedList!!.remove(passedWorkoutID) exerciseViewModel.updateRoutineWorkoutList(passedRoutineID!!, passedList) + Toast.makeText( + applicationContext, + "This workout has been removed from your template", + Toast.LENGTH_SHORT + ).show() finish() + recreate() } exerciseViewModel.exercise.observe(this, Observer {