Skip to content

Commit a44cea8

Browse files
committed
feat: create a new storage provider using the shared storage for QA variant
1 parent 4a2e193 commit a44cea8

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/LocalDataSourceModule.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
* @author David González Verdugo
55
* @author Abel García de Prada
66
* @author Juan Carlos Garrote Gascón
7+
* @author Jorge Aguado Recio
78
*
8-
* Copyright (C) 2023 ownCloud GmbH.
9+
* Copyright (C) 2025 ownCloud GmbH.
910
*
1011
* This program is free software: you can redistribute it and/or modify
1112
* it under the terms of the GNU General Public License version 2,
@@ -23,6 +24,8 @@
2324
package com.owncloud.android.dependecyinjection
2425

2526
import android.accounts.AccountManager
27+
import com.owncloud.android.BuildConfig
28+
import com.owncloud.android.MainApp
2629
import com.owncloud.android.MainApp.Companion.accountType
2730
import com.owncloud.android.MainApp.Companion.dataFolder
2831
import com.owncloud.android.data.OwncloudDatabase
@@ -43,6 +46,7 @@ import com.owncloud.android.data.sharing.shares.datasources.implementation.OCLoc
4346
import com.owncloud.android.data.spaces.datasources.LocalSpacesDataSource
4447
import com.owncloud.android.data.spaces.datasources.implementation.OCLocalSpacesDataSource
4548
import com.owncloud.android.data.providers.LocalStorageProvider
49+
import com.owncloud.android.data.providers.QaStorageProvider
4650
import com.owncloud.android.data.providers.ScopedStorageProvider
4751
import com.owncloud.android.data.transfers.datasources.LocalTransferDataSource
4852
import com.owncloud.android.data.transfers.datasources.implementation.OCLocalTransferDataSource
@@ -67,7 +71,13 @@ val localDataSourceModule = module {
6771
single { OwncloudDatabase.getDatabase(androidContext()).userDao() }
6872

6973
singleOf(::OCSharedPreferencesProvider) bind SharedPreferencesProvider::class
70-
single<LocalStorageProvider> { ScopedStorageProvider(dataFolder, androidContext()) }
74+
single<LocalStorageProvider> {
75+
if (BuildConfig.FLAVOR == MainApp.QA_FLAVOR) {
76+
QaStorageProvider(dataFolder)
77+
} else {
78+
ScopedStorageProvider(dataFolder, androidContext())
79+
}
80+
}
7181

7282
factory<LocalAuthenticationDataSource> { OCLocalAuthenticationDataSource(androidContext(), get(), get(), accountType) }
7383
factoryOf(::OCLocalFolderBackupDataSource) bind LocalFolderBackupDataSource::class
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* ownCloud Android client application
3+
*
4+
* @author Jorge Aguado Recio
5+
*
6+
* Copyright (C) 2025 ownCloud GmbH.
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License version 2,
10+
* as published by the Free Software Foundation.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
* <p>
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
21+
package com.owncloud.android.data.providers
22+
23+
import android.os.Environment
24+
import java.io.File
25+
26+
class QaStorageProvider(
27+
rootFolderName: String,
28+
) : LocalStorageProvider(rootFolderName) {
29+
30+
override fun getPrimaryStorageDirectory(): File = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
31+
}

0 commit comments

Comments
 (0)