This commit is contained in:
Stefano Sansone
2024-04-09 00:20:28 +02:00
parent 135295c4cf
commit 9cf57b4916
2 changed files with 12 additions and 20 deletions

View File

@ -1,8 +0,0 @@
package app.omnivore.omnivore.core.data
import app.omnivore.omnivore.core.network.savedItemLabels
suspend fun DataService.syncLabels() {
val fetchedLabels = networker.savedItemLabels()
db.savedItemLabelDao().insertAll(fetchedLabels)
}

View File

@ -6,19 +6,19 @@ import app.omnivore.omnivore.graphql.generated.type.CreateLabelInput
import app.omnivore.omnivore.graphql.generated.type.SetLabelsInput
suspend fun Networker.updateLabelsForSavedItem(input: SetLabelsInput): List<SetLabelsMutation.Label>? {
return try {
val result = authenticatedApolloClient().mutation(SetLabelsMutation(input)).execute()
return result.data?.setLabels?.onSetLabelsSuccess?.labels
} catch (e: java.lang.Exception) {
return null
}
return try {
val result = authenticatedApolloClient().mutation(SetLabelsMutation(input)).execute()
result.data?.setLabels?.onSetLabelsSuccess?.labels
} catch (e: java.lang.Exception) {
null
}
}
suspend fun Networker.createNewLabel(input: CreateLabelInput): CreateLabelMutation.Label? {
return try {
val result = authenticatedApolloClient().mutation(CreateLabelMutation(input)).execute()
return result.data?.createLabel?.onCreateLabelSuccess?.label
} catch (e: java.lang.Exception) {
null
}
return try {
val result = authenticatedApolloClient().mutation(CreateLabelMutation(input)).execute()
return result.data?.createLabel?.onCreateLabelSuccess?.label
} catch (e: java.lang.Exception) {
null
}
}