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

This commit is contained in:
Tobias Kaminsky 2023-09-16 03:35:58 +02:00
commit 55a5e45fb8
10 changed files with 95 additions and 16 deletions

View file

@ -32,7 +32,7 @@ jobs:
with: with:
swap-size-gb: 10 swap-size-gb: 10
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@701f152f28d4350ad289a5e31435e9ab6169a7ca # v2.21.6 uses: github/codeql-action/init@04daf014b50eaf774287bf3f0f1869d4b4c4b913 # v2.21.7
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
- name: Set up JDK 17 - name: Set up JDK 17
@ -46,4 +46,4 @@ jobs:
echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties" echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
./gradlew assembleDebug ./gradlew assembleDebug
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@701f152f28d4350ad289a5e31435e9ab6169a7ca # v2.21.6 uses: github/codeql-action/analyze@04daf014b50eaf774287bf3f0f1869d4b4c4b913 # v2.21.7

View file

@ -37,6 +37,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard. # Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@701f152f28d4350ad289a5e31435e9ab6169a7ca # v2.21.6 uses: github/codeql-action/upload-sarif@04daf014b50eaf774287bf3f0f1869d4b4c4b913 # v2.21.7
with: with:
sarif_file: results.sarif sarif_file: results.sarif

View file

@ -88,7 +88,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}} run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}}
- name: Archive Espresso results - name: Archive Espresso results
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
if: ${{ always() }} if: ${{ always() }}
with: with:
name: Report-${{ matrix.color }}-${{ matrix.scheme }} name: Report-${{ matrix.color }}-${{ matrix.scheme }}

View file

@ -46,7 +46,7 @@ jobs:
fail_ci_if_error: true fail_ci_if_error: true
- name: Upload jacoco artifacts - name: Upload jacoco artifacts
if: ${{ failure() }} if: ${{ failure() }}
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with: with:
name: test-results name: test-results
path: app/build/reports/tests/testGplayDebugUnitTest/ path: app/build/reports/tests/testGplayDebugUnitTest/

View file

@ -0,0 +1,52 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2023 Tobias Kaminsky
* Copyright (C) 2023 Nextcloud GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.owncloud.android.utils.theme
import com.owncloud.android.AbstractIT
import com.owncloud.android.lib.resources.status.NextcloudVersion
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import junit.framework.TestCase.assertFalse
import junit.framework.TestCase.assertTrue
import org.junit.Test
class CapabilityUtilsIT : AbstractIT() {
@Test
fun checkOutdatedWarning() {
assertFalse(test(NextcloudVersion.nextcloud_27))
assertFalse(test(NextcloudVersion.nextcloud_26))
assertFalse(test(NextcloudVersion.nextcloud_25))
assertFalse(test(NextcloudVersion.nextcloud_24))
assertTrue(test(NextcloudVersion.nextcloud_23))
assertTrue(test(NextcloudVersion.nextcloud_22))
assertTrue(test(NextcloudVersion.nextcloud_21))
assertTrue(test(OwnCloudVersion.nextcloud_20))
assertTrue(test(OwnCloudVersion.nextcloud_19))
assertTrue(test(OwnCloudVersion.nextcloud_18))
assertTrue(test(OwnCloudVersion.nextcloud_17))
assertTrue(test(OwnCloudVersion.nextcloud_16))
}
private fun test(version: OwnCloudVersion): Boolean {
return CapabilityUtils.checkOutdatedWarning(targetContext.resources, version, false)
}
}

View file

@ -125,6 +125,7 @@ import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertL
import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.ErrorMessageAdapter; import com.owncloud.android.utils.ErrorMessageAdapter;
import com.owncloud.android.utils.PermissionUtil; import com.owncloud.android.utils.PermissionUtil;
import com.owncloud.android.utils.theme.CapabilityUtils;
import com.owncloud.android.utils.theme.ViewThemeUtils; import com.owncloud.android.utils.theme.ViewThemeUtils;
import java.io.InputStream; import java.io.InputStream;
@ -900,9 +901,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
mServerInfo = (GetServerInfoOperation.ServerInfo) (result.getData().get(0)); mServerInfo = (GetServerInfoOperation.ServerInfo) (result.getData().get(0));
// show outdated warning // show outdated warning
if (getResources().getBoolean(R.bool.show_outdated_server_warning) && if (CapabilityUtils.checkOutdatedWarning(getResources(),
MainApp.OUTDATED_SERVER_VERSION.isSameMajorVersion(mServerInfo.mVersion) && mServerInfo.mVersion,
!mServerInfo.hasExtendedSupport) { mServerInfo.hasExtendedSupport)) {
DisplayUtils.showServerOutdatedSnackbar(this, Snackbar.LENGTH_INDEFINITE); DisplayUtils.showServerOutdatedSnackbar(this, Snackbar.LENGTH_INDEFINITE);
} }

View file

@ -135,6 +135,7 @@ import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.PermissionUtil; import com.owncloud.android.utils.PermissionUtil;
import com.owncloud.android.utils.PushUtils; import com.owncloud.android.utils.PushUtils;
import com.owncloud.android.utils.StringUtils; import com.owncloud.android.utils.StringUtils;
import com.owncloud.android.utils.theme.CapabilityUtils;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -436,16 +437,16 @@ public class FileDisplayActivity extends FileActivity
private void checkOutdatedServer() { private void checkOutdatedServer() {
Optional<User> user = getUser(); Optional<User> user = getUser();
if (getResources().getBoolean(R.bool.show_outdated_server_warning) && user.isPresent()) {
OwnCloudVersion serverVersion = user.get().getServer().getVersion(); OwnCloudVersion serverVersion = user.get().getServer().getVersion();
// show outdated warning // show outdated warning
if (MainApp.OUTDATED_SERVER_VERSION.isSameMajorVersion(serverVersion) && if (user.isPresent() &&
getCapabilities().getExtendedSupport().isFalse()) { CapabilityUtils.checkOutdatedWarning(getResources(),
serverVersion,
getCapabilities().getExtendedSupport().isTrue())) {
DisplayUtils.showServerOutdatedSnackbar(this, Snackbar.LENGTH_LONG); DisplayUtils.showServerOutdatedSnackbar(this, Snackbar.LENGTH_LONG);
} }
} }
}
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,

View file

@ -24,12 +24,16 @@ package com.owncloud.android.utils.theme;
import android.accounts.Account; import android.accounts.Account;
import android.content.Context; import android.content.Context;
import android.content.res.Resources;
import com.nextcloud.client.account.User; import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManagerImpl; import com.nextcloud.client.account.UserAccountManagerImpl;
import com.nextcloud.java.util.Optional; import com.nextcloud.java.util.Optional;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.lib.resources.status.OCCapability; import com.owncloud.android.lib.resources.status.OCCapability;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -88,4 +92,13 @@ public final class CapabilityUtils {
public static void updateCapability(OCCapability capability) { public static void updateCapability(OCCapability capability) {
cachedCapabilities.put(capability.getAccountName(), capability); cachedCapabilities.put(capability.getAccountName(), capability);
} }
public static boolean checkOutdatedWarning(Resources resources,
OwnCloudVersion version,
boolean hasExtendedSupport) {
return resources.getBoolean(R.bool.show_outdated_server_warning) &&
(MainApp.OUTDATED_SERVER_VERSION.isSameMajorVersion(version) ||
version.isOlderThan(MainApp.OUTDATED_SERVER_VERSION))
&& !hasExtendedSupport;
}
} }

View file

@ -422,6 +422,12 @@
<string name="image_editor_rotate_ccw">Ruota in senso anti orario</string> <string name="image_editor_rotate_ccw">Ruota in senso anti orario</string>
<string name="image_editor_rotate_cw">Ruota in senso orario</string> <string name="image_editor_rotate_cw">Ruota in senso orario</string>
<string name="image_editor_unable_to_edit_image">Impossibile modificare l\'immagine.</string> <string name="image_editor_unable_to_edit_image">Impossibile modificare l\'immagine.</string>
<string name="image_preview_filedetails">Dettagli del file</string>
<string name="image_preview_unit_fnumber">ƒ/%s</string>
<string name="image_preview_unit_iso">ISO %s</string>
<string name="image_preview_unit_megapixel">%s MP</string>
<string name="image_preview_unit_millimetres">%s mm</string>
<string name="image_preview_unit_seconds">%s s</string>
<string name="in_folder">nella cartella %1$s</string> <string name="in_folder">nella cartella %1$s</string>
<string name="instant_upload_existing">Carica anche i file esistenti</string> <string name="instant_upload_existing">Carica anche i file esistenti</string>
<string name="instant_upload_on_charging">Carica solo durante la ricarica</string> <string name="instant_upload_on_charging">Carica solo durante la ricarica</string>
@ -502,8 +508,9 @@
<string name="no_calendar_exists">Nessun calendario esistente</string> <string name="no_calendar_exists">Nessun calendario esistente</string>
<string name="no_email_app_available">Nessuna app disponibile per gestire l\'indirizzo email</string> <string name="no_email_app_available">Nessuna app disponibile per gestire l\'indirizzo email</string>
<string name="no_items">Nessun elemento</string> <string name="no_items">Nessun elemento</string>
<string name="no_map_app_availble">Nessuna applicazione disponibile per gestire mappe</string>
<string name="no_mutliple_accounts_allowed">Solo un account consentito</string> <string name="no_mutliple_accounts_allowed">Solo un account consentito</string>
<string name="no_pdf_app_available">Nessun applicazione disponibile per gestire i PDF</string> <string name="no_pdf_app_available">Nessuna applicazione disponibile per gestire i PDF</string>
<string name="no_send_app">Nessuna app disponibile per inviare i file selezionati</string> <string name="no_send_app">Nessuna app disponibile per inviare i file selezionati</string>
<string name="no_share_permission_selected">Seleziona almeno un permesso da condividere.</string> <string name="no_share_permission_selected">Seleziona almeno un permesso da condividere.</string>
<string name="note_confirm">Invia</string> <string name="note_confirm">Invia</string>
@ -588,7 +595,9 @@
<string name="prefs_imprint">Imprint</string> <string name="prefs_imprint">Imprint</string>
<string name="prefs_instant_behaviour_dialogTitle">Il file originale sarà…</string> <string name="prefs_instant_behaviour_dialogTitle">Il file originale sarà…</string>
<string name="prefs_instant_behaviour_title">Il file originale sarà…</string> <string name="prefs_instant_behaviour_title">Il file originale sarà…</string>
<string name="prefs_instant_upload_path_use_date_subfolders_summary">Archivia in sottocartelle in base alla data</string>
<string name="prefs_instant_upload_path_use_subfolders_title">Usa sottocartelle</string> <string name="prefs_instant_upload_path_use_subfolders_title">Usa sottocartelle</string>
<string name="prefs_instant_upload_subfolder_rule_title">Opzioni sottocartella</string>
<string name="prefs_keys_exist">Abilità la cifratura end-to-end a questo client</string> <string name="prefs_keys_exist">Abilità la cifratura end-to-end a questo client</string>
<string name="prefs_license">Licenza</string> <string name="prefs_license">Licenza</string>
<string name="prefs_lock">Codice di sicurezza</string> <string name="prefs_lock">Codice di sicurezza</string>
@ -778,6 +787,8 @@
<string name="stream_not_possible_headline">Trasmissione interna non possibile</string> <string name="stream_not_possible_headline">Trasmissione interna non possibile</string>
<string name="stream_not_possible_message">Scarica invece il media o usa un\'applicazione esterna.</string> <string name="stream_not_possible_message">Scarica invece il media o usa un\'applicazione esterna.</string>
<string name="strict_mode">Modalità rigorosa: nessuna connessione HTTP consentita! </string> <string name="strict_mode">Modalità rigorosa: nessuna connessione HTTP consentita! </string>
<string name="sub_folder_rule_day">Anno/Mese/Giorno</string>
<string name="sub_folder_rule_month">Anno/Mese</string>
<string name="sub_folder_rule_year">Anno</string> <string name="sub_folder_rule_year">Anno</string>
<string name="subject_shared_with_you">\"%1$s\" è stato condiviso con te</string> <string name="subject_shared_with_you">\"%1$s\" è stato condiviso con te</string>
<string name="subject_user_shared_with_you">%1$s ha condiviso \"%2$s\" con te</string> <string name="subject_user_shared_with_you">%1$s ha condiviso \"%2$s\" con te</string>

View file

@ -53,6 +53,7 @@
android:title="@string/prefs_show_hidden_files" android:title="@string/prefs_show_hidden_files"
android:key="show_hidden_files"/> android:key="show_hidden_files"/>
<com.owncloud.android.ui.ThemeableSwitchPreference <com.owncloud.android.ui.ThemeableSwitchPreference
android:defaultValue="true"
android:title="@string/prefs_show_ecosystem_apps" android:title="@string/prefs_show_ecosystem_apps"
android:key="show_ecosystem_apps" android:key="show_ecosystem_apps"
android:summary="@string/prefs_show_ecosystem_apps_summary"/> android:summary="@string/prefs_show_ecosystem_apps_summary"/>