feat(yandex-disk): REST client, repository, and app-folder storages
Add Yandex Disk API (Retrofit + OkHttp), per-vault repository with DB-backed OAuth token, YandexStorage/YandexStorageAccessor under app:/<uuid>, and a real YandexVault bootstrap (disk quota, list storages, create/remove). Expose vault and storage availability: vault is reachable after diskInfo; each storage combines vault reachability with local init readiness. Map 401 to YandexDiskAuthException and mark the vault unavailable. Add YandexAccountDao.getByVaultUuid for fresh tokens on each request. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,6 +8,8 @@ import com.github.nullptroma.wallenc.data.db.app.dao.YandexAccountDao
|
||||
import com.github.nullptroma.wallenc.data.db.app.repository.StorageKeyMapRepository
|
||||
import com.github.nullptroma.wallenc.data.db.app.repository.StorageMetaInfoRepository
|
||||
import com.github.nullptroma.wallenc.data.db.app.repository.YandexAccountRepository
|
||||
import com.github.nullptroma.wallenc.data.network.yandexdisk.YandexDiskApiFactory
|
||||
import com.github.nullptroma.wallenc.data.network.yandexdisk.repository.YandexDiskRepositoryFactory
|
||||
import com.github.nullptroma.wallenc.data.network.yandexuserinfo.YandexUserInfoApi
|
||||
import com.github.nullptroma.wallenc.data.network.yandexuserinfo.YandexUserInfoApiFactory
|
||||
import com.github.nullptroma.wallenc.data.network.yandexuserinfo.repository.YandexUserInfoRepository
|
||||
@@ -38,6 +40,26 @@ class SingletonModule {
|
||||
@Singleton
|
||||
fun provideYandexUserInfoApi(): YandexUserInfoApi = YandexUserInfoApiFactory.create()
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideYandexDiskApiFactory(
|
||||
yandexAccountRepository: YandexAccountRepository,
|
||||
@IoDispatcher ioDispatcher: CoroutineDispatcher,
|
||||
): YandexDiskApiFactory = YandexDiskApiFactory(
|
||||
accountRepository = yandexAccountRepository,
|
||||
ioDispatcher = ioDispatcher,
|
||||
)
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideYandexDiskRepositoryFactory(
|
||||
apiFactory: YandexDiskApiFactory,
|
||||
@IoDispatcher ioDispatcher: CoroutineDispatcher,
|
||||
): YandexDiskRepositoryFactory = YandexDiskRepositoryFactory(
|
||||
apiFactory = apiFactory,
|
||||
ioDispatcher = ioDispatcher,
|
||||
)
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideVaultsManager(
|
||||
@@ -46,6 +68,7 @@ class SingletonModule {
|
||||
keyRepo: StorageKeyMapRepository,
|
||||
yandexAccountRepository: YandexAccountRepository,
|
||||
yandexUserInfoRepository: YandexUserInfoRepository,
|
||||
yandexDiskRepositoryFactory: YandexDiskRepositoryFactory,
|
||||
): VaultsManager {
|
||||
return VaultsManager(
|
||||
ioDispatcher = ioDispatcher,
|
||||
@@ -53,6 +76,7 @@ class SingletonModule {
|
||||
keyRepo = keyRepo,
|
||||
yandexAccountRepository = yandexAccountRepository,
|
||||
yandexUserInfoRepository = yandexUserInfoRepository,
|
||||
yandexDiskRepositoryFactory = yandexDiskRepositoryFactory,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user