add mark as read action
This commit is contained in:
@ -86,7 +86,7 @@ android {
|
||||
dependencies {
|
||||
def nav_version = "2.5.3"
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.9.0'
|
||||
implementation("androidx.core:core-ktx:1.12.0")
|
||||
implementation "androidx.compose.ui:ui:$compose_version"
|
||||
implementation "androidx.compose.material:material:$compose_version"
|
||||
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
|
||||
@ -111,6 +111,7 @@ dependencies {
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")
|
||||
// ViewModel utilities for Compose
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version")
|
||||
|
||||
// LiveData
|
||||
implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version")
|
||||
implementation("androidx.compose.runtime:runtime-livedata:1.3.2")
|
||||
@ -131,13 +132,13 @@ dependencies {
|
||||
implementation "androidx.security:security-crypto:1.0.0"
|
||||
implementation "androidx.datastore:datastore-preferences:1.0.0"
|
||||
|
||||
//Dagger - Hilt
|
||||
implementation "com.google.dagger:hilt-android:$hilt_version"
|
||||
kapt "com.google.dagger:hilt-compiler:$hilt_version"
|
||||
// Dagger - Hilt
|
||||
implementation("com.google.dagger:hilt-android:$hilt_version")
|
||||
kapt("com.google.dagger:hilt-compiler:$hilt_version")
|
||||
|
||||
implementation("com.apollographql.apollo3:apollo-runtime:3.8.2")
|
||||
|
||||
implementation 'androidx.compose.material3:material3:1.1.2'
|
||||
implementation("androidx.compose.material3:material3:1.1.2")
|
||||
implementation 'androidx.compose.material3:material3-window-size-class:1.1.2'
|
||||
|
||||
implementation 'com.google.android.gms:play-services-auth:20.4.0'
|
||||
|
||||
@ -3,18 +3,41 @@ package app.omnivore.omnivore.ui.library
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.lifecycle.*
|
||||
import app.omnivore.omnivore.*
|
||||
import app.omnivore.omnivore.dataService.*
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import app.omnivore.omnivore.DatastoreKeys
|
||||
import app.omnivore.omnivore.DatastoreRepository
|
||||
import app.omnivore.omnivore.R
|
||||
import app.omnivore.omnivore.dataService.DataService
|
||||
import app.omnivore.omnivore.dataService.archiveSavedItem
|
||||
import app.omnivore.omnivore.dataService.deleteSavedItem
|
||||
import app.omnivore.omnivore.dataService.fetchSavedItemContent
|
||||
import app.omnivore.omnivore.dataService.isSavedItemContentStoredInDB
|
||||
import app.omnivore.omnivore.dataService.librarySearch
|
||||
import app.omnivore.omnivore.dataService.sync
|
||||
import app.omnivore.omnivore.dataService.syncLabels
|
||||
import app.omnivore.omnivore.dataService.syncOfflineItemsWithServerIfNeeded
|
||||
import app.omnivore.omnivore.dataService.unarchiveSavedItem
|
||||
import app.omnivore.omnivore.dataService.updateWebReadingProgress
|
||||
import app.omnivore.omnivore.graphql.generated.type.CreateLabelInput
|
||||
import app.omnivore.omnivore.network.*
|
||||
import app.omnivore.omnivore.persistence.entities.*
|
||||
import app.omnivore.omnivore.network.Networker
|
||||
import app.omnivore.omnivore.network.createNewLabel
|
||||
import app.omnivore.omnivore.persistence.entities.SavedItemLabel
|
||||
import app.omnivore.omnivore.persistence.entities.SavedItemWithLabelsAndHighlights
|
||||
import app.omnivore.omnivore.ui.ResourceProvider
|
||||
import app.omnivore.omnivore.ui.setSavedItemLabels
|
||||
import com.apollographql.apollo3.api.Optional
|
||||
import com.google.gson.Gson
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.time.Instant
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -307,6 +330,20 @@ class LibraryViewModel @Inject constructor(
|
||||
currentItemLiveData.value = itemID
|
||||
bottomSheetState.value = LibraryBottomSheetState.EDIT
|
||||
}
|
||||
|
||||
SavedItemAction.MarkRead -> {
|
||||
viewModelScope.launch {
|
||||
dataService.updateWebReadingProgress(
|
||||
jsonString = Gson().toJson(
|
||||
mapOf(
|
||||
"id" to itemID,
|
||||
"readingProgressPercent" to 100.0,
|
||||
"readingProgressAnchorIndex" to 0
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
actionsMenuItemLiveData.postValue(null)
|
||||
}
|
||||
@ -405,4 +442,5 @@ enum class SavedItemAction {
|
||||
Unarchive,
|
||||
EditLabels,
|
||||
EditInfo,
|
||||
MarkRead
|
||||
}
|
||||
|
||||
@ -162,6 +162,8 @@ class SearchViewModel @Inject constructor(
|
||||
SavedItemAction.EditInfo -> {
|
||||
// TODO
|
||||
}
|
||||
|
||||
SavedItemAction.MarkRead -> TODO()
|
||||
}
|
||||
actionsMenuItemLiveData.postValue(null)
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@ package app.omnivore.omnivore.ui.savedItemViews
|
||||
|
||||
import android.content.Context
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Check
|
||||
import androidx.compose.material.icons.outlined.Delete
|
||||
import androidx.compose.material.icons.outlined.Info
|
||||
import androidx.compose.material.icons.outlined.Share
|
||||
@ -101,5 +102,18 @@ fun SavedItemContextMenu(
|
||||
)
|
||||
}
|
||||
)
|
||||
DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.saved_item_context_menu_action_mark_read)) },
|
||||
onClick = {
|
||||
actionHandler(SavedItemAction.MarkRead)
|
||||
onDismiss()
|
||||
},
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
Icons.Outlined.Check,
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,6 +186,7 @@
|
||||
<string name="saved_item_context_menu_action_unarchive">Unarchive</string>
|
||||
<string name="saved_item_context_menu_action_share_original">Share Original</string>
|
||||
<string name="saved_item_context_menu_action_remove_item">Remove Item</string>
|
||||
<string name="saved_item_context_menu_action_mark_read">Mark read</string>
|
||||
|
||||
<!-- LogoutDialog -->
|
||||
<string name="logout_dialog_title">Logout</string>
|
||||
|
||||
@ -3,7 +3,7 @@ buildscript {
|
||||
compose_version = '1.6.0'
|
||||
lifecycle_version = '2.5.1'
|
||||
hilt_version = '2.44.2'
|
||||
gradle_plugin_version = '7.4.2'
|
||||
gradle_plugin_version = '8.2.2'
|
||||
room_version = '2.4.3'
|
||||
kotlin_version = '1.7.10'
|
||||
}
|
||||
|
||||
@ -22,3 +22,5 @@ kotlin.code.style=official
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.nonFinalResIds=false
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#Wed Aug 10 17:39:47 PDT 2022
|
||||
#Thu Feb 01 13:22:21 GMT 2024
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@ -13,8 +13,8 @@ dependencyResolutionManagement {
|
||||
maven {
|
||||
url = uri("https://customers.pspdfkit.com/maven")
|
||||
}
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven(url = "https://jitpack.io")
|
||||
}
|
||||
}
|
||||
rootProject.name = "Omnivore"
|
||||
include ':app'
|
||||
include(":app")
|
||||
Reference in New Issue
Block a user