mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2146 Objects | Enhancement | Allow pinning and unpinning types in the new object-creation panel (#771)
This commit is contained in:
parent
60415edafd
commit
e6acc965ff
19 changed files with 461 additions and 37 deletions
|
@ -6,12 +6,15 @@ import com.anytypeio.anytype.core_models.Wallpaper
|
|||
import com.anytypeio.anytype.core_models.WidgetSession
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_models.primitives.TypeId
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface UserSettingsCache {
|
||||
suspend fun setCurrentSpace(space: SpaceId)
|
||||
suspend fun getCurrentSpace(): SpaceId?
|
||||
suspend fun setDefaultObjectType(space: SpaceId, type: TypeId)
|
||||
suspend fun getDefaultObjectType(space: SpaceId): TypeId?
|
||||
suspend fun setPinnedObjectTypes(space: SpaceId, types: List<TypeId>)
|
||||
fun getPinnedObjectTypes(space: SpaceId) : Flow<List<TypeId>>
|
||||
suspend fun setWallpaper(space: Id, wallpaper: Wallpaper)
|
||||
suspend fun getWallpaper(space: Id) : Wallpaper
|
||||
suspend fun setThemeMode(mode: ThemeMode)
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.anytypeio.anytype.core_models.WidgetSession
|
|||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_models.primitives.TypeId
|
||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class UserSettingsDataRepository(private val cache: UserSettingsCache) : UserSettingsRepository {
|
||||
|
||||
|
@ -28,6 +29,17 @@ class UserSettingsDataRepository(private val cache: UserSettingsCache) : UserSet
|
|||
space: SpaceId
|
||||
): TypeId? = cache.getDefaultObjectType(space = space)
|
||||
|
||||
override suspend fun setPinnedObjectTypes(space: SpaceId, types: List<TypeId>) {
|
||||
cache.setPinnedObjectTypes(
|
||||
space = space,
|
||||
types = types
|
||||
)
|
||||
}
|
||||
|
||||
override fun getPinnedObjectTypes(space: SpaceId): Flow<List<TypeId>> {
|
||||
return cache.getPinnedObjectTypes(space = space)
|
||||
}
|
||||
|
||||
override suspend fun setThemeMode(mode: ThemeMode) {
|
||||
cache.setThemeMode(mode)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue