diff --git a/CHANGELOG.md b/CHANGELOG.md index 83c6898e20a..9d8da8c9e21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ ownCloud admins and users. * Change - Bump target SDK to 35: [#4529](https://github.com/owncloud/android/issues/4529) * Change - Replace dav4android location: [#4536](https://github.com/owncloud/android/issues/4536) * Change - Modify biometrics fail source string: [#4572](https://github.com/owncloud/android/issues/4572) +* Enhancement - QA variant: [#3791](https://github.com/owncloud/android/issues/3791) * Enhancement - Accessibility reports in 4.5.1: [#4568](https://github.com/owncloud/android/issues/4568) ## Details @@ -84,6 +85,13 @@ ownCloud admins and users. https://github.com/owncloud/android/issues/4572 https://github.com/owncloud/android/pull/4578 +* Enhancement - QA variant: [#3791](https://github.com/owncloud/android/issues/3791) + + A new flavor for QA has been created in order to make automatic tests easier. + + https://github.com/owncloud/android/issues/3791 + https://github.com/owncloud/android/pull/4569 + * Enhancement - Accessibility reports in 4.5.1: [#4568](https://github.com/owncloud/android/issues/4568) Some content descriptions that were missing have been added to provide a better diff --git a/changelog/unreleased/4569 b/changelog/unreleased/4569 new file mode 100644 index 00000000000..7914c7d8817 --- /dev/null +++ b/changelog/unreleased/4569 @@ -0,0 +1,6 @@ +Enhancement: QA variant + +A new flavor for QA has been created in order to make automatic tests easier. + +https://github.com/owncloud/android/issues/3791 +https://github.com/owncloud/android/pull/4569 diff --git a/owncloudApp/build.gradle b/owncloudApp/build.gradle index f47682847c9..6f1e059ec2a 100644 --- a/owncloudApp/build.gradle +++ b/owncloudApp/build.gradle @@ -160,6 +160,9 @@ android { mdm { dimension "management" } + qa { + dimension "management" + } } applicationVariants.all { variant -> diff --git a/owncloudApp/src/main/java/com/owncloud/android/MainApp.kt b/owncloudApp/src/main/java/com/owncloud/android/MainApp.kt index de5c897e136..49b8f2270e5 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/MainApp.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/MainApp.kt @@ -8,8 +8,9 @@ * @author David Crespo Ríos * @author Juan Carlos Garrote Gascón * @author Aitor Ballesteros Pavón + * @author Jorge Aguado Recio * - * Copyright (C) 2024 ownCloud GmbH. + * Copyright (C) 2025 ownCloud GmbH. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -260,11 +261,11 @@ class MainApp : Application() { } /** - * Screenshots allowed in debug mode. Devs and tests <3 + * Screenshots allowed in debug or QA mode. Devs and tests <3 * Otherwise, depends on branding. */ private fun areScreenshotsAllowed(): Boolean { - if (BuildConfig.DEBUG) return true + if (BuildConfig.DEBUG || BuildConfig.FLAVOR == QA_FLAVOR) return true val mdmProvider = MdmProvider(applicationContext) return mdmProvider.getBrandingBoolean(CONFIGURATION_ALLOW_SCREENSHOTS, R.bool.allow_screenshots) @@ -320,6 +321,7 @@ class MainApp : Application() { companion object { const val MDM_FLAVOR = "mdm" + const val QA_FLAVOR = "qa" lateinit var appContext: Context private set diff --git a/owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/LocalDataSourceModule.kt b/owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/LocalDataSourceModule.kt index b3bda017327..c66f8964176 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/LocalDataSourceModule.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/LocalDataSourceModule.kt @@ -4,8 +4,9 @@ * @author David González Verdugo * @author Abel García de Prada * @author Juan Carlos Garrote Gascón + * @author Jorge Aguado Recio * - * Copyright (C) 2023 ownCloud GmbH. + * Copyright (C) 2025 ownCloud GmbH. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -23,6 +24,8 @@ package com.owncloud.android.dependecyinjection import android.accounts.AccountManager +import com.owncloud.android.BuildConfig +import com.owncloud.android.MainApp import com.owncloud.android.MainApp.Companion.accountType import com.owncloud.android.MainApp.Companion.dataFolder import com.owncloud.android.data.OwncloudDatabase @@ -43,6 +46,7 @@ import com.owncloud.android.data.sharing.shares.datasources.implementation.OCLoc import com.owncloud.android.data.spaces.datasources.LocalSpacesDataSource import com.owncloud.android.data.spaces.datasources.implementation.OCLocalSpacesDataSource import com.owncloud.android.data.providers.LocalStorageProvider +import com.owncloud.android.data.providers.QaStorageProvider import com.owncloud.android.data.providers.ScopedStorageProvider import com.owncloud.android.data.transfers.datasources.LocalTransferDataSource import com.owncloud.android.data.transfers.datasources.implementation.OCLocalTransferDataSource @@ -67,7 +71,13 @@ val localDataSourceModule = module { single { OwncloudDatabase.getDatabase(androidContext()).userDao() } singleOf(::OCSharedPreferencesProvider) bind SharedPreferencesProvider::class - single { ScopedStorageProvider(dataFolder, androidContext()) } + single { + if (BuildConfig.FLAVOR == MainApp.QA_FLAVOR) { + QaStorageProvider(dataFolder) + } else { + ScopedStorageProvider(dataFolder, androidContext()) + } + } factory { OCLocalAuthenticationDataSource(androidContext(), get(), get(), accountType) } factoryOf(::OCLocalFolderBackupDataSource) bind LocalFolderBackupDataSource::class diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/authentication/LoginActivity.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/authentication/LoginActivity.kt index 00d88227c9c..29e7c386387 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/authentication/LoginActivity.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/authentication/LoginActivity.kt @@ -12,7 +12,7 @@ * @author Jorge Aguado Recio * * Copyright (C) 2012 Bartek Przybylski - * Copyright (C) 2024 ownCloud GmbH. + * Copyright (C) 2025 ownCloud GmbH. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -46,6 +46,7 @@ import androidx.core.net.toUri import androidx.core.view.isVisible import androidx.core.widget.doAfterTextChanged import com.owncloud.android.BuildConfig +import com.owncloud.android.MainApp import com.owncloud.android.MainApp.Companion.accountType import com.owncloud.android.R import com.owncloud.android.data.authentication.KEY_USER_ID @@ -372,13 +373,14 @@ class LoginActivity : AppCompatActivity(), SslUntrustedCertDialog.OnSslUntrusted } private fun checkServerType(serverInfo: ServerInfo) { + if (BuildConfig.FLAVOR == MainApp.QA_FLAVOR) { + handleBasicAuth() + return + } + when (serverInfo) { is ServerInfo.BasicServer -> { - authTokenType = BASIC_TOKEN_TYPE - oidcSupported = false - showOrHideBasicAuthFields(shouldBeVisible = true) - binding.accountUsername.doAfterTextChanged { updateLoginButtonVisibility() } - binding.accountPassword.doAfterTextChanged { updateLoginButtonVisibility() } + handleBasicAuth() } is ServerInfo.OAuth2Server -> { @@ -416,6 +418,14 @@ class LoginActivity : AppCompatActivity(), SslUntrustedCertDialog.OnSslUntrusted } } + private fun handleBasicAuth() { + authTokenType = BASIC_TOKEN_TYPE + oidcSupported = false + showOrHideBasicAuthFields(shouldBeVisible = true) + binding.accountUsername.doAfterTextChanged { updateLoginButtonVisibility() } + binding.accountPassword.doAfterTextChanged { updateLoginButtonVisibility() } + } + private fun getServerInfoIsLoading() { binding.serverStatusText.run { text = getString(R.string.auth_testing_connection) diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/releasenotes/ReleaseNotesActivity.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/releasenotes/ReleaseNotesActivity.kt index 0397a21a406..d199a6d79c3 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/releasenotes/ReleaseNotesActivity.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/releasenotes/ReleaseNotesActivity.kt @@ -2,7 +2,9 @@ * ownCloud Android client application * * @author David Crespo Ríos - * Copyright (C) 2022 ownCloud GmbH. + * @author Jorge Aguado Recio + * + * Copyright (C) 2025 ownCloud GmbH. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -93,6 +95,7 @@ class ReleaseNotesActivity : AppCompatActivity() { private fun shouldShow(context: Context): Boolean { val showReleaseNotes = context.resources.getBoolean(R.bool.release_notes_enabled) && !BuildConfig.DEBUG + && BuildConfig.FLAVOR != MainApp.QA_FLAVOR return firstRunAfterUpdate() && showReleaseNotes && ReleaseNotesViewModel.releaseNotesList.isNotEmpty() && diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/WhatsNewActivity.java b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/WhatsNewActivity.java index fee6f332d84..1a8a8f39fce 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/WhatsNewActivity.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/WhatsNewActivity.java @@ -4,8 +4,10 @@ * @author Brtosz Przybylski * @author Christian Schabesberger * @author David Crespo Ríos + * @author Jorge Aguado Recio + * * Copyright (C) 2020 Bartosz Przybylski - * Copyright (C) 2022 ownCloud GmbH. + * Copyright (C) 2025 ownCloud GmbH. *

* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -73,7 +75,7 @@ static public void runIfNeeded(Context context) { } static private boolean shouldShow(Context context) { - return context.getResources().getBoolean(R.bool.wizard_enabled) && !BuildConfig.DEBUG + return context.getResources().getBoolean(R.bool.wizard_enabled) && !BuildConfig.DEBUG && !BuildConfig.FLAVOR.equals(MainApp.QA_FLAVOR) && context instanceof LoginActivity; // When it is LoginActivity to start it only once } diff --git a/owncloudData/src/main/java/com/owncloud/android/data/providers/QaStorageProvider.kt b/owncloudData/src/main/java/com/owncloud/android/data/providers/QaStorageProvider.kt new file mode 100644 index 00000000000..9aa5ce91e4d --- /dev/null +++ b/owncloudData/src/main/java/com/owncloud/android/data/providers/QaStorageProvider.kt @@ -0,0 +1,31 @@ +/** + * ownCloud Android client application + * + * @author Jorge Aguado Recio + * + * Copyright (C) 2025 ownCloud GmbH. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program 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 this program. If not, see . + */ + +package com.owncloud.android.data.providers + +import android.os.Environment +import java.io.File + +class QaStorageProvider( + rootFolderName: String, +) : LocalStorageProvider(rootFolderName) { + + override fun getPrimaryStorageDirectory(): File = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) +}