app / de.uniks.codliners.stock_simulator.repository / AchievementsRepository

AchievementsRepository

class AchievementsRepository

Repository for accessing, inserting and filtering Achievements.

Constructors

<init>

Constructor that allows repository creation from a Context.

AchievementsRepository(context: Context)

Repository for accessing, inserting and filtering Achievements.

AchievementsRepository(database: StockAppDatabase)

Properties

achievements

List of all Achievements.

val achievements: LiveData<List<Achievement>>

Functions

getAchievementsByName

Returns an Achievement by its name.

suspend fun getAchievementsByName(name: Int): Achievement?

hasAchievements

Checks if there are any Achievements in the StockAppDatabase.

suspend fun hasAchievements(): Boolean

initAchievements

Inserts Achievements that are not yet available in the database.

suspend fun initAchievements(): Unit

insertAchievement

Inserts an Achievement into the database

suspend fun insertAchievement(achievement: Achievement): Unit

resetAchievements

Resets all Achievements to the default values.

suspend fun resetAchievements(): Unit