Refactor(Data): Rename datastore into data

Rename top.fatweb.oxygen.toolbox.datastore into top.fatweb.oxygen.toolbox.data
This commit is contained in:
2024-04-24 17:13:39 +08:00
parent 54a7625c1b
commit 23893a4ac1
15 changed files with 31 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
package top.fatweb.oxygen.toolbox.datastore.tool
package top.fatweb.oxygen.toolbox.data.tool
import kotlinx.coroutines.flow.flowOf
import top.fatweb.oxygen.toolbox.icon.OxygenIcons

View File

@@ -1,8 +1,8 @@
package top.fatweb.oxygen.toolbox.datastore.userdata
package top.fatweb.oxygen.toolbox.data.userdata
import androidx.datastore.core.DataMigration
import top.fatweb.oxygen.toolbox.datastore.UserPreferences
import top.fatweb.oxygen.toolbox.datastore.copy
import top.fatweb.oxygen.toolbox.data.UserPreferences
import top.fatweb.oxygen.toolbox.data.copy
internal object IntToStringIdsMigration : DataMigration<UserPreferences> {
override suspend fun cleanUp() = Unit

View File

@@ -1,13 +1,13 @@
package top.fatweb.oxygen.toolbox.datastore.userdata
package top.fatweb.oxygen.toolbox.data.userdata
import androidx.datastore.core.DataStore
import kotlinx.coroutines.flow.map
import top.fatweb.oxygen.toolbox.datastore.DarkThemeConfigProto
import top.fatweb.oxygen.toolbox.datastore.LanguageConfigProto
import top.fatweb.oxygen.toolbox.datastore.LaunchPageConfigProto
import top.fatweb.oxygen.toolbox.datastore.ThemeBrandConfigProto
import top.fatweb.oxygen.toolbox.datastore.UserPreferences
import top.fatweb.oxygen.toolbox.datastore.copy
import top.fatweb.oxygen.toolbox.data.DarkThemeConfigProto
import top.fatweb.oxygen.toolbox.data.LanguageConfigProto
import top.fatweb.oxygen.toolbox.data.LaunchPageConfigProto
import top.fatweb.oxygen.toolbox.data.ThemeBrandConfigProto
import top.fatweb.oxygen.toolbox.data.UserPreferences
import top.fatweb.oxygen.toolbox.data.copy
import top.fatweb.oxygen.toolbox.model.userdata.DarkThemeConfig
import top.fatweb.oxygen.toolbox.model.userdata.LanguageConfig
import top.fatweb.oxygen.toolbox.model.userdata.LaunchPageConfig

View File

@@ -1,9 +1,9 @@
package top.fatweb.oxygen.toolbox.datastore.userdata
package top.fatweb.oxygen.toolbox.data.userdata
import androidx.datastore.core.CorruptionException
import androidx.datastore.core.Serializer
import com.google.protobuf.InvalidProtocolBufferException
import top.fatweb.oxygen.toolbox.datastore.UserPreferences
import top.fatweb.oxygen.toolbox.data.UserPreferences
import java.io.InputStream
import java.io.OutputStream
import javax.inject.Inject

View File

@@ -8,9 +8,9 @@ import top.fatweb.oxygen.toolbox.monitor.ConnectivityManagerNetworkMonitor
import top.fatweb.oxygen.toolbox.monitor.NetworkMonitor
import top.fatweb.oxygen.toolbox.monitor.TimeZoneBroadcastMonitor
import top.fatweb.oxygen.toolbox.monitor.TimeZoneMonitor
import top.fatweb.oxygen.toolbox.repository.tool.OfflineFirstToolRepository
import top.fatweb.oxygen.toolbox.repository.tool.LocalToolRepository
import top.fatweb.oxygen.toolbox.repository.tool.ToolRepository
import top.fatweb.oxygen.toolbox.repository.userdata.OfflineFirstUserDataRepository
import top.fatweb.oxygen.toolbox.repository.userdata.LocalUserDataRepository
import top.fatweb.oxygen.toolbox.repository.userdata.UserDataRepository
@Module
@@ -23,8 +23,8 @@ abstract class DataModule {
internal abstract fun bindsTimeZoneMonitor(timeZoneMonitor: TimeZoneBroadcastMonitor): TimeZoneMonitor
@Binds
internal abstract fun bindsUserDataRepository(userDataRepository: OfflineFirstUserDataRepository): UserDataRepository
internal abstract fun bindsUserDataRepository(userDataRepository: LocalUserDataRepository): UserDataRepository
@Binds
internal abstract fun bindsToolRepository(toolRepository: OfflineFirstToolRepository): ToolRepository
internal abstract fun bindsToolRepository(toolRepository: LocalToolRepository): ToolRepository
}

View File

@@ -11,9 +11,9 @@ import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import top.fatweb.oxygen.toolbox.datastore.UserPreferences
import top.fatweb.oxygen.toolbox.datastore.userdata.IntToStringIdsMigration
import top.fatweb.oxygen.toolbox.datastore.userdata.UserPreferencesSerializer
import top.fatweb.oxygen.toolbox.data.UserPreferences
import top.fatweb.oxygen.toolbox.data.userdata.IntToStringIdsMigration
import top.fatweb.oxygen.toolbox.data.userdata.UserPreferencesSerializer
import top.fatweb.oxygen.toolbox.network.Dispatcher
import top.fatweb.oxygen.toolbox.network.OxygenDispatchers
import javax.inject.Singleton

View File

@@ -1,11 +1,11 @@
package top.fatweb.oxygen.toolbox.repository.tool
import kotlinx.coroutines.flow.Flow
import top.fatweb.oxygen.toolbox.datastore.tool.ToolDataSource
import top.fatweb.oxygen.toolbox.data.tool.ToolDataSource
import top.fatweb.oxygen.toolbox.model.tool.ToolGroup
import javax.inject.Inject
internal class OfflineFirstToolRepository @Inject constructor(
internal class LocalToolRepository @Inject constructor(
toolDataSource: ToolDataSource
) : ToolRepository {
override val toolGroups: Flow<List<ToolGroup>> =

View File

@@ -1,7 +1,7 @@
package top.fatweb.oxygen.toolbox.repository.userdata
import kotlinx.coroutines.flow.Flow
import top.fatweb.oxygen.toolbox.datastore.userdata.OxygenPreferencesDataSource
import top.fatweb.oxygen.toolbox.data.userdata.OxygenPreferencesDataSource
import top.fatweb.oxygen.toolbox.model.userdata.DarkThemeConfig
import top.fatweb.oxygen.toolbox.model.userdata.LanguageConfig
import top.fatweb.oxygen.toolbox.model.userdata.LaunchPageConfig
@@ -9,7 +9,7 @@ import top.fatweb.oxygen.toolbox.model.userdata.ThemeBrandConfig
import top.fatweb.oxygen.toolbox.model.userdata.UserData
import javax.inject.Inject
internal class OfflineFirstUserDataRepository @Inject constructor(
internal class LocalUserDataRepository @Inject constructor(
private val oxygenPreferencesDataSource: OxygenPreferencesDataSource
) : UserDataRepository {
override val userData: Flow<UserData> =

View File

@@ -34,7 +34,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
import top.fatweb.oxygen.toolbox.datastore.tool.ToolDataSource
import top.fatweb.oxygen.toolbox.data.tool.ToolDataSource
import top.fatweb.oxygen.toolbox.icon.OxygenIcons
import top.fatweb.oxygen.toolbox.model.tool.Tool
import top.fatweb.oxygen.toolbox.model.tool.ToolGroup

View File

@@ -32,7 +32,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
import top.fatweb.oxygen.toolbox.R
import top.fatweb.oxygen.toolbox.datastore.tool.ToolDataSource
import top.fatweb.oxygen.toolbox.data.tool.ToolDataSource
import top.fatweb.oxygen.toolbox.ui.component.scrollbar.DraggableScrollbar
import top.fatweb.oxygen.toolbox.ui.component.scrollbar.rememberDraggableScroller
import top.fatweb.oxygen.toolbox.ui.component.scrollbar.scrollbarState

View File

@@ -1,6 +1,6 @@
syntax = "proto3";
option java_package = "top.fatweb.oxygen.toolbox.datastore";
option java_package = "top.fatweb.oxygen.toolbox.data";
option java_multiple_files = true;
enum DarkThemeConfigProto {

View File

@@ -1,6 +1,6 @@
syntax = "proto3";
option java_package = "top.fatweb.oxygen.toolbox.datastore";
option java_package = "top.fatweb.oxygen.toolbox.data";
option java_multiple_files = true;
enum LanguageConfigProto {

View File

@@ -1,6 +1,6 @@
syntax = "proto3";
option java_package = "top.fatweb.oxygen.toolbox.datastore";
option java_package = "top.fatweb.oxygen.toolbox.data";
option java_multiple_files = true;
enum LaunchPageConfigProto {

View File

@@ -1,6 +1,6 @@
syntax = "proto3";
option java_package = "top.fatweb.oxygen.toolbox.datastore";
option java_package = "top.fatweb.oxygen.toolbox.data";
option java_multiple_files = true;
enum ThemeBrandConfigProto {

View File

@@ -5,7 +5,7 @@ import "com/fatweb/oxygen/toolbox/data/launch_page_config.proto";
import "com/fatweb/oxygen/toolbox/data/theme_brand_config.proto";
import "com/fatweb/oxygen/toolbox/data/dark_theme_config.proto";
option java_package = "top.fatweb.oxygen.toolbox.datastore";
option java_package = "top.fatweb.oxygen.toolbox.data";
option java_multiple_files = true;
message UserPreferences {