Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New arch] Fetch list of files #2918

Merged
merged 9 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import com.owncloud.android.data.authentication.datasources.implementation.OCLoc
import com.owncloud.android.data.capabilities.datasources.LocalCapabilitiesDataSource
import com.owncloud.android.data.capabilities.datasources.implementation.OCLocalCapabilitiesDataSource
import com.owncloud.android.data.capabilities.datasources.mapper.OCCapabilityMapper
import com.owncloud.android.data.files.datasources.LocalFileDataSource
import com.owncloud.android.data.files.datasources.implementation.OCLocalFileDataSource
import com.owncloud.android.data.files.datasources.mapper.OCFileMapper
import com.owncloud.android.data.sharing.shares.datasources.LocalShareDataSource
import com.owncloud.android.data.sharing.shares.datasources.implementation.OCLocalShareDataSource
import com.owncloud.android.data.sharing.shares.datasources.mapper.OCShareMapper
Expand All @@ -37,18 +40,21 @@ import org.koin.android.ext.koin.androidContext
import org.koin.dsl.module

val localDataSourceModule = module {
single { AccountManager.get(androidContext())}
single { AccountManager.get(androidContext()) }

single { OwncloudDatabase.getDatabase(androidContext()).capabilityDao() }
single { OwncloudDatabase.getDatabase(androidContext()).fileDao() }
single { OwncloudDatabase.getDatabase(androidContext()).shareDao() }
single { OwncloudDatabase.getDatabase(androidContext()).userDao() }

factory { OCCapabilityMapper() }
factory { OCFileMapper() }
factory { OCShareMapper() }
factory { UserQuotaMapper() }

factory<LocalAuthenticationDataSource> { OCLocalAuthenticationDataSource(androidContext(), get(), accountType) }
factory<LocalCapabilitiesDataSource> { OCLocalCapabilitiesDataSource(get(), get()) }
factory<LocalFileDataSource> { OCLocalFileDataSource(get(), get()) }
factory<LocalShareDataSource> { OCLocalShareDataSource(get(), get()) }
factory<LocalUserDataSource> { OCLocalUserDataSource(get(), get()) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import com.owncloud.android.data.capabilities.datasources.implementation.OCRemot
import com.owncloud.android.data.capabilities.datasources.mapper.RemoteCapabilityMapper
import com.owncloud.android.data.files.datasources.RemoteFileDataSource
import com.owncloud.android.data.files.datasources.implementation.OCRemoteFileDataSource
import com.owncloud.android.data.files.datasources.mapper.RemoteFileMapper
import com.owncloud.android.data.server.datasources.RemoteServerInfoDataSource
import com.owncloud.android.data.server.datasources.implementation.OCRemoteServerInfoDataSource
import com.owncloud.android.data.sharing.sharees.datasources.RemoteShareeDataSource
Expand Down Expand Up @@ -71,7 +72,7 @@ val remoteDataSourceModule = module {

factory<RemoteAuthenticationDataSource> { OCRemoteAuthenticationDataSource(androidContext(), get()) }
factory<RemoteCapabilitiesDataSource> { OCRemoteCapabilitiesDataSource(get(), get()) }
factory<RemoteFileDataSource> { OCRemoteFileDataSource(get()) }
factory<RemoteFileDataSource> { OCRemoteFileDataSource(get(), get()) }
factory<RemoteServerInfoDataSource> { OCRemoteServerInfoDataSource(get()) }
factory<RemoteShareDataSource> { OCRemoteShareDataSource(get(), get()) }
factory<RemoteShareeDataSource> { OCRemoteShareeDataSource(get()) }
Expand All @@ -80,6 +81,7 @@ val remoteDataSourceModule = module {
).toInt()) }

factory { RemoteCapabilityMapper() }
factory { RemoteFileMapper() }
factory { RemoteShareMapper() }
factory { RemoteUserAvatarMapper() }
factory { RemoteUserInfoMapper() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import org.koin.dsl.module
val repositoryModule = module {
factory<AuthenticationRepository> { OCAuthenticationRepository(get(), get()) }
factory<CapabilityRepository> { OCCapabilityRepository(get(), get()) }
factory<FileRepository> { OCFileRepository(get()) }
factory<FileRepository> { OCFileRepository(get(), get()) }
factory<ServerInfoRepository> { OCServerInfoRepository(get()) }
factory<ShareeRepository> { OCShareeRepository(get()) }
factory<ShareRepository> { OCShareRepository(get(), get()) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.owncloud.android.domain.authentication.usecases.SupportsOAuth2UseCase
import com.owncloud.android.domain.capabilities.usecases.GetCapabilitiesAsLiveDataUseCase
import com.owncloud.android.domain.capabilities.usecases.GetStoredCapabilitiesUseCase
import com.owncloud.android.domain.capabilities.usecases.RefreshCapabilitiesFromServerAsyncUseCase
import com.owncloud.android.domain.files.RefreshFolderFromServerAsyncUseCase
import com.owncloud.android.domain.server.usecases.GetServerInfoAsyncUseCase
import com.owncloud.android.domain.sharing.sharees.GetShareesAsyncUseCase
import com.owncloud.android.domain.sharing.shares.usecases.CreatePrivateShareAsyncUseCase
Expand Down Expand Up @@ -54,6 +55,9 @@ val useCaseModule = module {
factory { GetStoredCapabilitiesUseCase(get()) }
factory { RefreshCapabilitiesFromServerAsyncUseCase(get()) }

// Files
factory { RefreshFolderFromServerAsyncUseCase(get()) }

// Sharing
factory { GetShareesAsyncUseCase(get()) }
factory { GetSharesAsLiveDataUseCase(get()) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import com.owncloud.android.lib.common.operations.OperationCancelledException;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
import com.owncloud.android.lib.resources.files.RemoteFile;
import com.owncloud.android.lib.resources.files.services.implementation.OCFileService;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.services.OperationsService;
import com.owncloud.android.utils.FileStorageUtils;
Expand Down Expand Up @@ -259,9 +259,8 @@ private RemoteOperationResult<ArrayList<RemoteFile>> fetchRemoteFolder(OwnCloudC
if (mCancellationRequested.get()) {
throw new OperationCancelledException();
}

ReadRemoteFolderOperation readFolderOperation = new ReadRemoteFolderOperation(mRemotePath);
return readFolderOperation.execute(client);
OCFileService ocFileService = new OCFileService(client);
return ocFileService.refreshFolder(mRemotePath);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
package com.owncloud.android.presentation.viewmodels.drawer

import android.accounts.Account
import android.accounts.AccountManager
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.ViewModel
import com.owncloud.android.MainApp
import com.owncloud.android.authentication.AccountUtils
import com.owncloud.android.domain.user.model.UserQuota
import com.owncloud.android.domain.user.usecases.GetStoredQuotaUseCase
Expand Down
Loading