Merge remote-tracking branch 'origin/master' into dev

This commit is contained in:
Tobias Kaminsky 2024-07-09 02:31:08 +02:00
commit 3b57d5085a
8 changed files with 159 additions and 121 deletions

View file

@ -1,28 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Nextcloud Android
Upstream-Contact: Nextcloud Android team <android@nextcloud.com>
Source: https://github.com/nextcloud/android
Files: gradle/wrapper/gradle-wrapper.jar
Copyright: 2015-2021 the original authors
License: Apache-2.0
Files: user_manual/images/android-1.png user_manual/images/android-2.png user_manual/images/android-3.png user_manual/images/android-4.png user_manual/images/android-10.png user_manual/images/davdroid-1-button-in-nextcloud-app.png user_manual/images/davdroid-2-install-davdroid.png user_manual/images/davdroid-3-enter-password.png user_manual/images/davdroid-4-specify-owner-email.png
Copyright: 2016-2024 Nextcloud GmbH and Nextcloud contributors
License: AGPL-3.0-or-later
Files: user_manual/conf.py user_manual/android_app.rst user_manual/index.rst user_manual/conf.py user_manual/Makefile
Copyright: 2015-2016 ownCloud Inc., 2016-2024 Nextcloud GmbH
License: GPL-2.0-only
Files: user_manual/images/android-11.png user_manual/images/android-12.png user_manual/images/android-13.png user_manual/images/android-14.png user_manual/images/android-15.png user_manual/images/android-5.png user_manual/images/android-6.png user_manual/images/android-8.png user_manual/images/android-9.png
Copyright: 2015-2016 ownCloud Inc.
License: GPL-2.0-only
Files: app/src/*/res/mipmap-*dpi/ic_launcher.png app/src/*/ic_launcher-web.png src/generic/fastlane/metadata/android/en-US/images/icon.png src/versionDev/fastlane/metadata/android/en-US/images/icon.png app/src/main/ic_launcher-web-round.png
Copyright: 2017-2024 Nextcloud GmbH <https://nextcloud.com/trademarks/>
License: LicenseRef-NextcloudTrademarks
Files: .idea/* app/schemas/com.nextcloud.client.database.NextcloudDatabase/*.json app/screenshots/gplay/debug/*.png app/src/main/res/values-*/strings.xml src/*/fastlane/metadata/android/*/*.txt src/versionDev/fastlane/metadata/android/*/changelogs/*.txt app/src/androidTest/assets/* app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker app/src/*/google-services.json app/src/main/res/drawable-*dpi/checker_16_16.png app/src/main/res/raw/encryption_key_words.txt app/src/main/resources/ical4j.properties app/src/main/res/drawable-*dpi/apk.png app/src/main/res/drawable-*dpi/fdroid.png app/src/main/res/drawable-*dpi/playstore.png app/src/main/res/drawable-*dpi/background.png app/src/main/res/drawable-*dpi/background_nc18.png
Copyright: 2016-2024 Nextcloud GmbH and Nextcloud contributors
License: AGPL-3.0-or-later

42
REUSE.toml Normal file
View file

@ -0,0 +1,42 @@
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
version = 1
SPDX-PackageName = "Nextcloud Android"
SPDX-PackageSupplier = "Nextcloud Android team <android@nextcloud.com>"
SPDX-PackageDownloadLocation = "https://github.com/nextcloud/android"
[[annotations]]
path = "gradle/wrapper/gradle-wrapper.jar"
precedence = "aggregate"
SPDX-FileCopyrightText = "2015-2021 the original authors"
SPDX-License-Identifier = "Apache-2.0"
[[annotations]]
path = ["user_manual/images/android-1.png", "user_manual/images/android-2.png", "user_manual/images/android-3.png", "user_manual/images/android-4.png", "user_manual/images/android-10.png", "user_manual/images/davdroid-1-button-in-nextcloud-app.png", "user_manual/images/davdroid-2-install-davdroid.png", "user_manual/images/davdroid-3-enter-password.png", "user_manual/images/davdroid-4-specify-owner-email.png"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2016-2024 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"
[[annotations]]
path = ["user_manual/conf.py", "user_manual/android_app.rst", "user_manual/index.rst", "user_manual/conf.py", "user_manual/Makefile"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2015-2016 ownCloud Inc., 2016-2024 Nextcloud GmbH"
SPDX-License-Identifier = "GPL-2.0-only"
[[annotations]]
path = ["user_manual/images/android-11.png", "user_manual/images/android-12.png", "user_manual/images/android-13.png", "user_manual/images/android-14.png", "user_manual/images/android-15.png", "user_manual/images/android-5.png", "user_manual/images/android-6.png", "user_manual/images/android-8.png", "user_manual/images/android-9.png"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2015-2016 ownCloud Inc."
SPDX-License-Identifier = "GPL-2.0-only"
[[annotations]]
path = ["app/src/**/res/mipmap-**dpi/ic_launcher.png", "app/src/**/ic_launcher-web.png", "src/generic/fastlane/metadata/android/en-US/images/icon.png", "src/versionDev/fastlane/metadata/android/en-US/images/icon.png", "app/src/main/ic_launcher-web-round.png"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2017-2024 Nextcloud GmbH <https://nextcloud.com/trademarks/>"
SPDX-License-Identifier = "LicenseRef-NextcloudTrademarks"
[[annotations]]
path = [".idea/**", "app/schemas/com.nextcloud.client.database.NextcloudDatabase/**.json", "app/screenshots/gplay/debug/**.png", "app/src/main/res/values-**/strings.xml", "src/**/fastlane/metadata/android/**/**.txt", "src/versionDev/fastlane/metadata/android/**/changelogs/**.txt", "app/src/androidTest/assets/**", "app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker", "app/src/**/google-services.json", "app/src/main/res/drawable-**dpi/checker_16_16.png", "app/src/main/res/raw/encryption_key_words.txt", "app/src/main/resources/ical4j.properties", "app/src/main/res/drawable-**dpi/apk.png", "app/src/main/res/drawable-**dpi/fdroid.png", "app/src/main/res/drawable-**dpi/playstore.png", "app/src/main/res/drawable-**dpi/background.png", "app/src/main/res/drawable-**dpi/background_nc18.png"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2016-2024 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"

View file

@ -0,0 +1,55 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2024 Alper Ozturk <alper.ozturk@nextcloud.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package com.owncloud.android.utils
import android.content.Intent
import androidx.test.core.app.ActivityScenario
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.rules.ActivityScenarioRule
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.account.UserAccountManagerImpl
import com.nextcloud.client.mixins.SessionMixin
import com.owncloud.android.AbstractIT
import com.owncloud.android.ui.activity.FileDisplayActivity
import org.junit.Before
import org.junit.Rule
import org.junit.Test
class SessionMixinTest : AbstractIT() {
private lateinit var userAccountManager: UserAccountManager
private lateinit var session: SessionMixin
private var scenario: ActivityScenario<FileDisplayActivity>? = null
val intent = Intent(ApplicationProvider.getApplicationContext(), FileDisplayActivity::class.java)
@get:Rule
val activityRule = ActivityScenarioRule<FileDisplayActivity>(intent)
@Before
fun setUp() {
userAccountManager = UserAccountManagerImpl.fromContext(targetContext)
scenario = activityRule.scenario
scenario?.onActivity { sut ->
session = SessionMixin(
sut,
userAccountManager
)
}
}
@Test
fun startAccountCreation() {
session.startAccountCreation()
scenario = activityRule.scenario
scenario?.onActivity { sut ->
assert(sut.account.name == userAccountManager.accounts.first().name)
}
}
}

View file

@ -29,7 +29,7 @@ class SessionMixin(
private val activity: Activity,
private val accountManager: UserAccountManager
) : ActivityMixin {
lateinit var currentAccount: Account
var currentAccount: Account = getDefaultAccount()
private set
val capabilities: OCCapability?

View file

@ -31,6 +31,7 @@ import com.owncloud.android.databinding.RichdocumentsWebviewBinding;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.SyncedFolderProvider;
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
import com.owncloud.android.ui.asynctasks.TextEditorLoadUrlTask;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.WebViewUtil;
@ -99,6 +100,23 @@ public abstract class EditorWebView extends ExternalSiteWebView {
finish();
}
public void reload() {
if (getWebView().getVisibility() != View.VISIBLE) {
return;
}
Optional<User> user = getUser();
if (!user.isPresent()) {
return;
}
OCFile file = getFile();
if (file != null) {
TextEditorLoadUrlTask task = new TextEditorLoadUrlTask(this, user.get(), file, editorUtils);
task.execute();
}
}
@Override
protected void bindView() {
binding = RichdocumentsWebviewBinding.inflate(getLayoutInflater());
@ -281,6 +299,11 @@ public abstract class EditorWebView extends ExternalSiteWebView {
public void loaded() {
runOnUiThread(EditorWebView.this::hideLoading);
}
@JavascriptInterface
public void reload() {
EditorWebView.this.reload();
}
}
}

View file

@ -69,6 +69,7 @@ import javax.inject.Inject;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.widget.SearchView;
import androidx.core.content.ContextCompat;
@ -99,8 +100,6 @@ public class ExtendedListFragment extends Fragment implements
public static final float minColumnSize = 2.0f;
private int maxColumnSize = 5;
private int maxColumnSizePortrait = 5;
private int maxColumnSizeLandscape = 10;
@Inject AppPreferences preferences;
@Inject UserAccountManager accountManager;
@ -116,10 +115,10 @@ public class ExtendedListFragment extends Fragment implements
protected ImageView mEmptyListIcon;
// Save the state of the scroll in browsing
private ArrayList<Integer> mIndexes;
private ArrayList<Integer> mFirstPositions;
private ArrayList<Integer> mTops;
private int mHeightCell;
private ArrayList<Integer> mIndexes = new ArrayList<>();
private ArrayList<Integer> mFirstPositions = new ArrayList<>();
private ArrayList<Integer> mTops = new ArrayList<>();
private int mHeightCell = 0;
private SwipeRefreshLayout.OnRefreshListener mOnRefreshListener;
@ -127,7 +126,7 @@ public class ExtendedListFragment extends Fragment implements
protected SearchView searchView;
private ImageView closeButton;
private Handler handler = new Handler(Looper.getMainLooper());
private final Handler handler = new Handler(Looper.getMainLooper());
private float mScale = AppPreferencesImpl.DEFAULT_GRID_COLUMN;
@ -178,7 +177,7 @@ public class ExtendedListFragment extends Fragment implements
searchView.setOnQueryTextListener(this);
searchView.setOnCloseListener(this);
final Handler handler = new Handler();
final Handler handler = new Handler(Looper.getMainLooper());
DisplayMetrics displaymetrics = new DisplayMetrics();
Activity activity;
@ -399,35 +398,27 @@ public class ExtendedListFragment extends Fragment implements
mEmptyListIcon = binding.emptyList.emptyListIcon;
}
/**
* {@inheritDoc}
*/
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (savedInstanceState != null) {
mIndexes = savedInstanceState.getIntegerArrayList(KEY_INDEXES);
mFirstPositions = savedInstanceState.getIntegerArrayList(KEY_FIRST_POSITIONS);
mTops = savedInstanceState.getIntegerArrayList(KEY_TOPS);
mHeightCell = savedInstanceState.getInt(KEY_HEIGHT_CELL);
setMessageForEmptyList(savedInstanceState.getString(KEY_EMPTY_LIST_MESSAGE));
if (savedInstanceState.getBoolean(KEY_IS_GRID_VISIBLE, false) && getRecyclerView().getAdapter() != null) {
switchToGridView();
}
int referencePosition = savedInstanceState.getInt(KEY_SAVED_LIST_POSITION);
Log_OC.v(TAG, "Setting grid position " + referencePosition);
scrollToPosition(referencePosition);
} else {
mIndexes = new ArrayList<>();
mFirstPositions = new ArrayList<>();
mTops = new ArrayList<>();
mHeightCell = 0;
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (savedInstanceState == null) {
return;
}
}
mIndexes = savedInstanceState.getIntegerArrayList(KEY_INDEXES);
mFirstPositions = savedInstanceState.getIntegerArrayList(KEY_FIRST_POSITIONS);
mTops = savedInstanceState.getIntegerArrayList(KEY_TOPS);
mHeightCell = savedInstanceState.getInt(KEY_HEIGHT_CELL);
setMessageForEmptyList(savedInstanceState.getString(KEY_EMPTY_LIST_MESSAGE));
if (savedInstanceState.getBoolean(KEY_IS_GRID_VISIBLE, false) && getRecyclerView().getAdapter() != null) {
switchToGridView();
}
int referencePosition = savedInstanceState.getInt(KEY_SAVED_LIST_POSITION);
Log_OC.v(TAG, "Setting grid position " + referencePosition);
scrollToPosition(referencePosition);
}
@Override
public void onSaveInstanceState(@NonNull Bundle savedInstanceState) {
@ -485,8 +476,9 @@ public class ExtendedListFragment extends Fragment implements
* Save index and top position
*/
protected void saveIndexAndTopPosition(int index) {
mIndexes.add(index);
if (mIndexes != null) {
mIndexes.add(index);
}
RecyclerView.LayoutManager layoutManager = mRecyclerView.getLayoutManager();
int firstPosition;
@ -519,8 +511,7 @@ public class ExtendedListFragment extends Fragment implements
searchView.onActionViewCollapsed();
Activity activity;
if ((activity = getActivity()) != null && activity instanceof FileDisplayActivity) {
FileDisplayActivity fileDisplayActivity = (FileDisplayActivity) activity;
if ((activity = getActivity()) != null && activity instanceof FileDisplayActivity fileDisplayActivity) {
fileDisplayActivity.setDrawerIndicatorEnabled(fileDisplayActivity.isDrawerIndicatorAvailable());
fileDisplayActivity.hideSearchView(fileDisplayActivity.getCurrentDir());
}
@ -683,9 +674,9 @@ public class ExtendedListFragment extends Fragment implements
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
maxColumnSize = maxColumnSizeLandscape;
maxColumnSize = 10;
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
maxColumnSize = maxColumnSizePortrait;
maxColumnSize = 5;
}
if (isGridEnabled() && getColumnsCount() > maxColumnSize) {

View file

@ -92,6 +92,7 @@
<string name="auth_unsupported_multiaccount">%1$s no soporta cuentas múltiples</string>
<string name="auth_wrong_connection_title">No fue posible establecer la conexión</string>
<string name="authenticator_activity_cancel_login">Cancelar inicio de sesión</string>
<string name="authenticator_activity_login_error">Hubo un problema al procesar su solicitud de acceso. Por favor, intente más tarde.</string>
<string name="authenticator_activity_please_complete_login_process">Por favor, complete el proceso de inicio de sesión en su navegador</string>
<string name="auto_upload_file_behaviour_kept_in_folder">mantenido en la carpeta original, ya que es de solo lectura</string>
<string name="auto_upload_on_wifi">Solo cargar sobre una Wi-Fi no tarificada</string>
@ -321,6 +322,7 @@
<string name="error_showing_encryption_dialog">¡Error al mostrar el diálogo de configuración de cifrado!</string>
<string name="error_starting_direct_camera_upload">Error al iniciar la cámara</string>
<string name="error_starting_doc_scan">Error al iniciar el escaneo del documento</string>
<string name="error_uploading_direct_camera_upload">No se pudo cargar el medio tomado</string>
<string name="etm_accounts">Cuentas</string>
<string name="etm_background_execution_count">Veces ejecutado en 48h</string>
<string name="etm_background_job_created">Creado</string>
@ -352,6 +354,7 @@
<string name="failed_update_ui">Error al actualizar la interfaz gráfica</string>
<string name="favorite">Agregar a favoritos</string>
<string name="favorite_icon">Marcar como favorito</string>
<string name="file_activity_shared_file_cannot_be_updated">No se puede actualizar el archivo compartido</string>
<string name="file_already_exists">El nombre de archivo ya existe</string>
<string name="file_delete">Eliminar</string>
<string name="file_detail_activity_error">No se pudo recuperar las actividades del archivo</string>
@ -672,6 +675,7 @@
<string name="push_notifications_old_login">No hay notificaciones push debido a un inicio de sesión caduco. Por favor vuelve a ingresar a tu cuenta. </string>
<string name="push_notifications_temp_error">En este momento las notificaciones push no están disponibles.</string>
<string name="qr_could_not_be_read">¡No se pudo leer el código QR!</string>
<string name="receive_external_files_activity_start_sync_folder_is_not_exists_message">No se pudo encontrar la carpeta, la sincronización se ha cancelado</string>
<string name="recommend_subject">¡Prueba %1$s en tu dispositivo!</string>
<string name="recommend_text">Quiero invitarte a usar %1$s en tu dispositivo\nDescárgalo aquí:%2$s </string>
<string name="recommend_urls">%1$s ó %2$s</string>
@ -902,7 +906,10 @@
<string name="upload_cannot_create_file">No se puede crear el archivo local</string>
<string name="upload_chooser_title">Cargar forma…</string>
<string name="upload_content_from_other_apps">Cargar contenido de otras aplicaciones</string>
<string name="upload_direct_camera_photo">Foto</string>
<string name="upload_direct_camera_promt">¿Quiere tomar una foto o video?</string>
<string name="upload_direct_camera_upload">Cargar desde la cámara</string>
<string name="upload_direct_camera_video">Video</string>
<string name="upload_file_dialog_filename">Nombre de archivo</string>
<string name="upload_file_dialog_filetype">Tipo de archivo</string>
<string name="upload_file_dialog_filetype_googlemap_shortcut">Archivo de acceso directo a Google Maps(%s)</string>

View file

@ -1,52 +0,0 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2020 Chris Narkiewicz <hello@ezaquarii.com>
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
*/
package com.nextcloud.client.mixins
import android.app.Activity
import com.nextcloud.client.account.UserAccountManager
import org.junit.Before
import org.junit.Test
import org.mockito.Mock
import org.mockito.Mockito.same
import org.mockito.Mockito.spy
import org.mockito.MockitoAnnotations
import org.mockito.kotlin.verify
class SessionMixinTest {
@Mock
private lateinit var activity: Activity
@Mock
private lateinit var userAccountManager: UserAccountManager
private lateinit var session: SessionMixin
@Before
fun setUp() {
MockitoAnnotations.initMocks(this)
session = spy(
SessionMixin(
activity,
userAccountManager
)
)
}
@Test
fun `start account creation`() {
// WHEN
// start account creation flow
session.startAccountCreation()
// THEN
// start is delegated to account manager
// account manager receives parent activity
verify(userAccountManager).startAccountCreation(same(activity))
}
}