Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/SCCapstone/Symphony into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
NikM3 committed Apr 22, 2023
2 parents ade6087 + cb4521b commit 47cccdf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 47cccdf

Please sign in to comment.