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

This commit is contained in:
Tobias Kaminsky 2024-08-16 03:39:41 +02:00
commit af6d9c2ede
11 changed files with 76 additions and 11 deletions

View file

@ -39,7 +39,7 @@ jobs:
with:
swap-size-gb: 10
- name: Initialize CodeQL
uses: github/codeql-action/init@29d86d22a34ea372b1bbf3b2dced2e25ca6b3384 # v3.26.1
uses: github/codeql-action/init@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2
with:
languages: ${{ matrix.language }}
- name: Set up JDK 17
@ -53,4 +53,4 @@ jobs:
echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
./gradlew assembleDebug
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@29d86d22a34ea372b1bbf3b2dced2e25ca6b3384 # v3.26.1
uses: github/codeql-action/analyze@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2

View file

@ -42,6 +42,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@29d86d22a34ea372b1bbf3b2dced2e25ca6b3384 # v3.26.1
uses: github/codeql-action/upload-sarif@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2
with:
sarif_file: results.sarif

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -8,9 +8,16 @@
package com.owncloud.android.ui.activity
import android.content.Intent
import androidx.annotation.UiThread
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.IdlingRegistry
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.intent.rule.IntentsTestRule
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.isRoot
import com.nextcloud.test.GrantStoragePermissionRule
import com.owncloud.android.AbstractIT
import com.owncloud.android.utils.EspressoIdlingResource
import com.owncloud.android.utils.FileStorageUtils
import com.owncloud.android.utils.ScreenshotTest
import org.junit.After
@ -20,6 +27,8 @@ import org.junit.Test
import java.io.File
class UploadFilesActivityIT : AbstractIT() {
private val testClassName = "com.owncloud.android.ui.activity.UploadFilesActivityIT"
@get:Rule
var activityRule = IntentsTestRule(UploadFilesActivity::class.java, true, false)
@ -39,6 +48,16 @@ class UploadFilesActivityIT : AbstractIT() {
directories.forEach { it.deleteRecursively() }
}
@Before
fun registerIdlingResource() {
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
}
@After
fun unregisterIdlingResource() {
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
}
@Test
@ScreenshotTest
fun noneSelected() {
@ -88,6 +107,33 @@ class UploadFilesActivityIT : AbstractIT() {
screenshot(sut)
}
@Test
@UiThread
@ScreenshotTest
fun search() {
val sut: UploadFilesActivity = activityRule.launchActivity(null)
sut.runOnUiThread {
sut.fileListFragment.setFiles(
directories +
listOf(
File("1.txt"),
File("2.pdf"),
File("3.mp3")
)
)
onIdleSync {
EspressoIdlingResource.increment()
sut.fileListFragment.performSearch("1.txt", arrayListOf(), false)
EspressoIdlingResource.decrement()
val screenShotName = createName(testClassName + "_" + "search", "")
onView(isRoot()).check(matches(isDisplayed()))
screenshotViaName(sut, screenShotName)
}
}
}
fun fileSelected() {
val sut: UploadFilesActivity = activityRule.launchActivity(null)

View file

@ -80,6 +80,7 @@ class EtmBackgroundJobsFragment : EtmBaseFragment(), Injectable {
private val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:MM:ssZ", Locale.getDefault())
var backgroundJobs: List<JobInfo> = emptyList()
@SuppressLint("NotifyDataSetChanged")
set(value) {
field = value
notifyDataSetChanged()

View file

@ -246,6 +246,10 @@ public class ExtendedListFragment extends Fragment implements
performSearch(query, listOfHiddenFiles, false);
return true;
}
if (adapter instanceof LocalFileListAdapter) {
performSearch(query, new ArrayList<>(), false);
return true;
}
return false;
}
@ -253,6 +257,7 @@ public class ExtendedListFragment extends Fragment implements
handler.removeCallbacksAndMessages(null);
RecyclerView.Adapter adapter = getRecyclerView().getAdapter();
Activity activity = getActivity();
if (activity != null) {
if (activity instanceof FileDisplayActivity) {
if (isBackPressed && TextUtils.isEmpty(query)) {
@ -274,8 +279,7 @@ public class ExtendedListFragment extends Fragment implements
new SearchEvent(query, SearchRemoteOperation.SearchType.FILE_SEARCH)
);
}
} else if (adapter instanceof LocalFileListAdapter) {
LocalFileListAdapter localFileListAdapter = (LocalFileListAdapter) adapter;
} else if (adapter instanceof LocalFileListAdapter localFileListAdapter) {
localFileListAdapter.filter(query);
}
});
@ -284,10 +288,12 @@ public class ExtendedListFragment extends Fragment implements
searchView.clearFocus();
}
}
} else if (activity instanceof UploadFilesActivity) {
} else if (activity instanceof UploadFilesActivity uploadFilesActivity) {
LocalFileListAdapter localFileListAdapter = (LocalFileListAdapter) adapter;
localFileListAdapter.filter(query);
((UploadFilesActivity) activity).showToolbarSpinner();
if (localFileListAdapter != null) {
localFileListAdapter.filter(query);
uploadFilesActivity.getFileListFragment().setLoading(false);
}
} else if (activity instanceof FolderPickerActivity) {
((FolderPickerActivity) activity).search(query);
}
@ -630,6 +636,10 @@ public class ExtendedListFragment extends Fragment implements
setMessageForEmptyList(R.string.file_list_empty_headline_server_search,
R.string.file_list_empty_gallery,
R.drawable.file_image);
} else if (searchType == SearchType.LOCAL_SEARCH) {
setMessageForEmptyList(R.string.file_list_empty_headline_server_search,
R.string.file_list_empty_local_search,
R.drawable.ic_search_light_grey);
}
}
});

View file

@ -374,7 +374,7 @@ public class LocalFileListFragment extends ExtendedListFragment implements
new Handler().post(() -> {
mAdapter.notifyDataSetChanged();
if (mAdapter.getFilesCount() == 0) {
setEmptyListMessage(SearchType.NO_SEARCH);
setEmptyListMessage(SearchType.LOCAL_SEARCH);
}
});
}

View file

@ -13,6 +13,7 @@ import kotlinx.parcelize.Parcelize
@Parcelize
enum class SearchType : Parcelable {
NO_SEARCH,
LOCAL_SEARCH,
REGULAR_FILTER,
FILE_SEARCH,
FAVORITE_SEARCH,

View file

@ -512,6 +512,7 @@
<string name="manage_space_clear_data">Effacer les données</string>
<string name="manage_space_description">Les paramètres, la base de données et les certificats du serveur provenant de %1$s seront définitivement effacés. \n\nLes fichiers téléchargés ne seront pas impactés.\n\nCette opération peut prendre du temps.</string>
<string name="manage_space_title">Gestion de l\'espace</string>
<string name="max_file_count_warning_message">Vous avez atteint la limite maximum de téléversement. Veuillez téléverser moins de 500 fichiers à la fois.</string>
<string name="media_err_invalid_progressive_playback">Le fichier ne peut être streamer</string>
<string name="media_err_io">Impossible de lire le fichier média</string>
<string name="media_err_malformed">Le fichier média n\'est pas correctement encodé</string>
@ -666,8 +667,10 @@
<string name="prefs_value_theme_light">Clair</string>
<string name="prefs_value_theme_system">Selon le système</string>
<string name="preview_image_description">Prévisualisation de l\'image</string>
<string name="preview_image_downloading_image_for_edit">Téléchargement de l\'image afin de lancer l\'écran d\'édition, veuillez patienter…</string>
<string name="preview_image_error_no_local_file">Il n\'y a aucun fichier local à prévisualiser</string>
<string name="preview_image_error_unknown_format">L\'image ne peut pas être affichée</string>
<string name="preview_image_file_is_not_downloaded">Le fichier n\'est pas téléchargé</string>
<string name="preview_image_file_is_not_exist">Le fichier nexiste pas</string>
<string name="preview_media_unhandled_http_code_message">Ce fichier est actuellement vérouillé par un autre utilisateur ou processus et ne peut donc pas être supprimé. Veuillez réessayer plus tard.</string>
<string name="preview_sorry">Désolé</string>
@ -678,6 +681,7 @@
<string name="push_notifications_temp_error">Les notifications push ne sont pas disponibles actuellement.</string>
<string name="qr_could_not_be_read">Le code QR ne peut être lu</string>
<string name="receive_external_files_activity_start_sync_folder_is_not_exists_message">Le dossier est introuvable, l\'opération de synchronisation est annulée.</string>
<string name="receive_external_files_activity_unable_to_find_file_to_upload">Impossible de trouver le fichier à téléverser</string>
<string name="recommend_subject">Essayez %1$s sur votre appareil !</string>
<string name="recommend_text">J\'aimerais vous inviter à utiliser %1$s sur votre appareil.\nTéléchargez-la ici : %2$s</string>
<string name="recommend_urls">%1$s ou %2$s</string>
@ -885,6 +889,9 @@
<string name="trashbin_file_remove">Supprimer définitivement</string>
<string name="trashbin_loading_failed">Le chargement de la corbeille a échoué !</string>
<string name="trashbin_not_emptied">Des fichiers n\'ont pas pu être supprimés de manière définitive !</string>
<string name="unified_search_fragment_calendar_event_not_found">Événement introuvable; vous pouvez toujours synchroniser pour mettre à jour. Redirection au web…</string>
<string name="unified_search_fragment_contact_not_found">Contact introuvable, vous pouvez toujours synchroniser pour mettre à jour. Redirection au web...</string>
<string name="unified_search_fragment_permission_needed">Des permissions sont requises pour ouvrir le résultat de recherche, autrement ceci redirigera au web…</string>
<string name="unlock_file">Déverrouiller le fichier</string>
<string name="unread_comments">Il y a des commentaire non lus</string>
<string name="unset_encrypted">Désactiver le chiffrement</string>

View file

@ -197,6 +197,7 @@
<string name="create_new_folder">Nieuwe map</string>
<string name="create_new_presentation">Nieuwe presentatie</string>
<string name="create_new_spreadsheet">Nieuw werkblad</string>
<string name="create_rich_workspace">Mapomschrijving toevoegen</string>
<string name="credentials_disabled">Inloggegevens uitgeschakeld</string>
<string name="daily_backup">Dagelijkse back-up</string>
<string name="data_to_back_up">Te back-uppen data</string>

View file

@ -1213,8 +1213,7 @@
<string name="sub_folder_rule_day">Year/Month/Day</string>
<string name="secure_share_not_set_up">Secure sharing is not set up for this user</string>
<string name="share_not_allowed_when_file_drop">Resharing is not allowed during secure file drop</string>
<string name="file_list_empty_local_search">No file or folder matching your search</string>
<string name="unified_search_fragment_calendar_event_not_found">Event not found, you can always sync to update. Redirecting to web…</string>
<string name="unified_search_fragment_contact_not_found">Contact not found, you can always sync to update. Redirecting to web…</string>
<string name="unified_search_fragment_permission_needed">Permissions are required to open search result otherwise it will redirected to web…</string>