diff --git a/app/src/main/java/app/pachli/components/preference/AccountPreferencesFragment.kt b/app/src/main/java/app/pachli/components/preference/AccountPreferencesFragment.kt index 1784ed8cf..0d1802acc 100644 --- a/app/src/main/java/app/pachli/components/preference/AccountPreferencesFragment.kt +++ b/app/src/main/java/app/pachli/components/preference/AccountPreferencesFragment.kt @@ -29,6 +29,7 @@ import app.pachli.core.accounts.AccountManager import app.pachli.core.activity.extensions.TransitionKind import app.pachli.core.activity.extensions.startActivityWithTransition import app.pachli.core.common.util.unsafeLazy +import app.pachli.core.data.repository.AccountPreferenceDataStore import app.pachli.core.data.repository.ServerRepository import app.pachli.core.designsystem.R as DR import app.pachli.core.navigation.AccountListActivityIntent @@ -46,7 +47,6 @@ import app.pachli.core.network.model.Account import app.pachli.core.network.model.Status import app.pachli.core.network.retrofit.MastodonApi import app.pachli.core.preferences.PrefKeys -import app.pachli.settings.AccountPreferenceDataStore import app.pachli.settings.listPreference import app.pachli.settings.makePreferenceScreen import app.pachli.settings.preference diff --git a/app/src/main/java/app/pachli/util/StatusDisplayOptionsRepository.kt b/app/src/main/java/app/pachli/util/StatusDisplayOptionsRepository.kt index 39f852348..263ff37f2 100644 --- a/app/src/main/java/app/pachli/util/StatusDisplayOptionsRepository.kt +++ b/app/src/main/java/app/pachli/util/StatusDisplayOptionsRepository.kt @@ -21,13 +21,13 @@ import androidx.annotation.VisibleForTesting import androidx.annotation.VisibleForTesting.Companion.PRIVATE import app.pachli.core.accounts.AccountManager import app.pachli.core.common.di.ApplicationScope +import app.pachli.core.data.repository.AccountPreferenceDataStore import app.pachli.core.data.repository.ServerRepository import app.pachli.core.database.model.AccountEntity import app.pachli.core.network.ServerOperation.ORG_JOINMASTODON_STATUSES_TRANSLATE import app.pachli.core.preferences.CardViewMode import app.pachli.core.preferences.PrefKeys import app.pachli.core.preferences.SharedPreferencesRepository -import app.pachli.settings.AccountPreferenceDataStore import com.github.michaelbull.result.onFailure import com.github.michaelbull.result.onSuccess import io.github.z4kn4fein.semver.constraints.toConstraint diff --git a/app/src/test/java/app/pachli/components/notifications/NotificationsViewModelTestBase.kt b/app/src/test/java/app/pachli/components/notifications/NotificationsViewModelTestBase.kt index aa954a7f9..616394c6f 100644 --- a/app/src/test/java/app/pachli/components/notifications/NotificationsViewModelTestBase.kt +++ b/app/src/test/java/app/pachli/components/notifications/NotificationsViewModelTestBase.kt @@ -22,6 +22,7 @@ import app.pachli.appstore.EventHub import app.pachli.components.timeline.FilterKind import app.pachli.components.timeline.FiltersRepository import app.pachli.core.accounts.AccountManager +import app.pachli.core.data.repository.AccountPreferenceDataStore import app.pachli.core.data.repository.ServerRepository import app.pachli.core.database.model.AccountEntity import app.pachli.core.network.model.nodeinfo.UnvalidatedJrd @@ -31,7 +32,6 @@ import app.pachli.core.network.retrofit.NodeInfoApi import app.pachli.core.preferences.SharedPreferencesRepository import app.pachli.core.testing.fakes.InMemorySharedPreferences import app.pachli.core.testing.rules.MainCoroutineRule -import app.pachli.settings.AccountPreferenceDataStore import app.pachli.usecase.TimelineCases import app.pachli.util.StatusDisplayOptionsRepository import at.connyduck.calladapter.networkresult.NetworkResult diff --git a/app/src/test/java/app/pachli/util/StatusDisplayOptionsRepositoryTest.kt b/app/src/test/java/app/pachli/util/StatusDisplayOptionsRepositoryTest.kt index 08a20d362..2a2e715bd 100644 --- a/app/src/test/java/app/pachli/util/StatusDisplayOptionsRepositoryTest.kt +++ b/app/src/test/java/app/pachli/util/StatusDisplayOptionsRepositoryTest.kt @@ -22,6 +22,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import app.cash.turbine.test import app.pachli.PachliApplication import app.pachli.core.accounts.AccountManager +import app.pachli.core.data.repository.AccountPreferenceDataStore import app.pachli.core.network.model.Account import app.pachli.core.network.model.nodeinfo.UnvalidatedJrd import app.pachli.core.network.model.nodeinfo.UnvalidatedNodeInfo @@ -30,7 +31,6 @@ import app.pachli.core.network.retrofit.NodeInfoApi import app.pachli.core.preferences.PrefKeys import app.pachli.core.preferences.SharedPreferencesRepository import app.pachli.core.testing.rules.MainCoroutineRule -import app.pachli.settings.AccountPreferenceDataStore import at.connyduck.calladapter.networkresult.NetworkResult import com.google.common.truth.Truth.assertThat import dagger.hilt.android.testing.CustomTestApplication diff --git a/core/data/build.gradle.kts b/core/data/build.gradle.kts index a61bae88f..0393c6689 100644 --- a/core/data/build.gradle.kts +++ b/core/data/build.gradle.kts @@ -34,6 +34,10 @@ dependencies { implementation(projects.core.database) implementation(projects.core.model) implementation(projects.core.network) + implementation(projects.core.preferences) + + // PreferenceDataStore + implementation(libs.bundles.androidx) testImplementation(projects.core.networkTest) testImplementation(libs.bundles.mockito) diff --git a/app/src/main/java/app/pachli/settings/AccountPreferenceDataStore.kt b/core/data/src/main/kotlin/app/pachli/core/data/repository/AccountPreferenceDataStore.kt similarity index 68% rename from app/src/main/java/app/pachli/settings/AccountPreferenceDataStore.kt rename to core/data/src/main/kotlin/app/pachli/core/data/repository/AccountPreferenceDataStore.kt index 1e860d880..43d9f2f06 100644 --- a/app/src/main/java/app/pachli/settings/AccountPreferenceDataStore.kt +++ b/core/data/src/main/kotlin/app/pachli/core/data/repository/AccountPreferenceDataStore.kt @@ -1,4 +1,21 @@ -package app.pachli.settings +/* + * Copyright 2024 Pachli Association + * + * This file is a part of Pachli. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation; either version 3 of the + * License, or (at your option) any later version. + * + * Pachli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Pachli; if not, + * see . + */ + +package app.pachli.core.data.repository import androidx.preference.PreferenceDataStore import app.pachli.core.accounts.AccountManager