app / sg.edu.ntu.scse.cz2006.gymbuddies.ui.gymlist / GymListViewModel

GymListViewModel

open class GymListViewModel : ViewModel

View model for the favourite gyms fragment

Author
Kenneth Soh

Since
2019-10-03

Constructors

<init>

View model for the favourite gyms fragment

GymListViewModel()

Properties

currentUserFavList

Live data of the current logged in user's favourite gyms

var currentUserFavList: MutableLiveData<HashMap<String!, Int!>!>!

favCount

Live data for the current selected gym object favourite count

var favCount: MutableLiveData<Int!>!

selectedGym

Live data for the selected gym object

var selectedGym: MutableLiveData<GymShell!>!

Functions

getCurrentUserFavourites

Gets the live data of the user's current favourited gyms

open fun getCurrentUserFavourites(): LiveData<HashMap<String!, Int!>!>!

getFavCount

Gets selected gym favourite count live data

open fun getFavCount(): LiveData<Int!>!

getSelectedGym

Gets selected gym live data

open fun getSelectedGym(): LiveData<GymShell!>!

setSelectedGym

Updates selected gym

open fun setSelectedGym(gym: FavGymObject?): Unit

updateCurrentUserFavourites

Sets the current logged in user's favourited gyms and their live favourite counts

open fun updateCurrentUserFavourites(currentFav: HashMap<String!, Int!>): Unit

updateFavCount

Updates favourite count for selected gym

open fun updateFavCount(count: Int): Unit