TaxonomiesRepository

@Singleton
class TaxonomiesRepository @Inject constructor(    context: Context,     daoSession: <Error class: unknown class>,     analysisDataApi: AnalysisDataAPI,     taxonomiesManager: TaxonomiesManager,     picasso: Picasso)

This is a repository class which implements repository interface.

Author

Lobster

Since

03.03.18

Constructors

Link copied to clipboard
@Inject
fun TaxonomiesRepository(    context: Context,     daoSession: <Error class: unknown class>,     analysisDataApi: AnalysisDataAPI,     taxonomiesManager: TaxonomiesManager,     picasso: Picasso)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun deleteIngredientCascade()

Delete rows from Ingredient, IngredientName and IngredientsRelation set the autoincrement to 0

Link copied to clipboard
suspend fun downloadAdditives(lastModifiedDate: Long): List<Additive>
Link copied to clipboard
suspend fun downloadAllergens(lastModifiedDate: Long): List<Allergen>
Link copied to clipboard
suspend fun downloadAnalysisTagConfigs(lastModifiedDate: Long): List<AnalysisTagConfig>
Link copied to clipboard
suspend fun downloadAnalysisTags(lastModifiedDate: Long): List<AnalysisTag>
Link copied to clipboard
suspend fun downloadBrands(lastModifiedDate: Long): List<Brand>
Link copied to clipboard
suspend fun downloadCategories(lastModifiedDate: Long): List<Category>
Link copied to clipboard
suspend fun downloadCountries(lastModifiedDate: Long): List<Country>
Link copied to clipboard
suspend fun downloadIngredients(lastModifiedDate: Long): List<Ingredient>
Link copied to clipboard
suspend fun downloadInvalidBarcodes(lastModifiedDate: Long): List<InvalidBarcode>
Link copied to clipboard
suspend fun downloadLabels(lastModifiedDate: Long): List<Label>
Link copied to clipboard
suspend fun downloadStates(lastModifiedDate: Long): List<States>
Link copied to clipboard
suspend fun downloadStores(lastModifiedDate: Long): List<Store>
Link copied to clipboard
suspend fun downloadTags(lastModifiedDate: Long): List<Tag>
Link copied to clipboard
suspend fun fetchCategories(): List<Category>
Link copied to clipboard
suspend fun getAdditive(additiveTag: String?, languageCode: String = ApiFields.Defaults.DEFAULT_LANGUAGE): AdditiveName

Loads translated additive from the local database by unique tag of additive and language code

Link copied to clipboard
suspend fun getAllergenName(allergenTag: String?, languageCode: String = ApiFields.Defaults.DEFAULT_LANGUAGE): AllergenName

Loads translated allergen from the local database by unique tag of allergen and language code

Link copied to clipboard
suspend fun getAllergens(checkUpdate: Boolean = false): List<Allergen>

suspend fun getAllergens(languageCode: String?): <Error class: unknown class>

Loads all translated allergens.

suspend fun getAllergens(isEnabled: Boolean, lc: String): <Error class: unknown class>

Loads translated and selected/unselected allergens.

Link copied to clipboard
suspend fun getAnalysisTagConfig(analysisTag: String?, languageCode: String): AnalysisTagConfig?
Link copied to clipboard
suspend fun getCategories(languageCode: String = ApiFields.Defaults.DEFAULT_LANGUAGE): <Error class: unknown class>

Loads list of translated category names from the local database by language code

Link copied to clipboard
suspend fun getCategory(categoryTag: String, languageCode: String = ApiFields.Defaults.DEFAULT_LANGUAGE): CategoryName

Loads translated category from the local database by unique tag of category and language code

Link copied to clipboard
suspend fun getCountries(): List<Country>
Link copied to clipboard
suspend fun getCountry(cc2: String): Country?
Link copied to clipboard
suspend fun getEnabledAllergens(): List<Allergen>

Load allergens which user selected earlier (i.e user's allergens)

Link copied to clipboard
suspend fun getLabel(labelTag: String?, languageCode: String = ApiFields.Defaults.DEFAULT_LANGUAGE): LabelName

Loads translated label from the local database by unique tag of label and language code

Link copied to clipboard
suspend fun getStatesName(statesTag: String, languageCode: String?): StatesName

Loads translated states from the local database by unique tag of states and language code

Link copied to clipboard
suspend fun getUnknownAnalysisTagConfigs(languageCode: String): <Error class: unknown class>
Link copied to clipboard
suspend fun reloadAdditivesFromServer(): List<Additive>

Load additives from the server or local database

Link copied to clipboard
suspend fun reloadAllergensFromServer(): List<Allergen>

Load allergens from the server or local database

Link copied to clipboard
suspend fun reloadAnalysisTagConfigs(): List<AnalysisTagConfig>
Link copied to clipboard
suspend fun reloadAnalysisTags(): List<AnalysisTag>

Load analysis tags from the server or local database

Link copied to clipboard
suspend fun reloadBrandsFromServer(): List<Brand>
Link copied to clipboard
suspend fun reloadCategoriesFromServer(): List<Category>

Load categories from the server or local database

Link copied to clipboard
suspend fun reloadCountriesFromServer(): List<Country>

Load countries from the server or local database

Link copied to clipboard
suspend fun reloadIngredientsFromServer(): List<Ingredient>

TODO to be improved by loading only in the user language ? Load ingredients from (the server or) local database If SharedPreferences lastDownloadIngredients is set try this : if file from the server is newer than last download delete database, load the file and fill database, else if database is empty, download the file and fill database, else return the content from the local database.

Link copied to clipboard
suspend fun reloadInvalidBarcodesFromServer(): List<InvalidBarcode>
Link copied to clipboard
suspend fun reloadLabelsFromServer(): List<Label>

Load labels from the server or local database

Link copied to clipboard
suspend fun reloadStatesFromServer(): List<States>

Load states from the server or local database

Link copied to clipboard
suspend fun reloadStoresFromServer(): List<Store>

Load stores from the server or local database

Link copied to clipboard
suspend fun reloadTagsFromServer(): List<Tag>

Load tags from the server or local database

Link copied to clipboard
fun saveAllergens(allergens: List<Allergen>)

Save a list of allergens to the local DB.

Link copied to clipboard
suspend fun setAllergenEnabled(allergenTag: String, isEnabled: Boolean): <Error class: unknown class>

Changes enabled field of allergen and updates it.