-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
When uploading a single file, offer input field to change file name #16298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This streamlines the upload from files, e.g. from email attachments. Closes #9215. The approach via the listener mFileDisplayNameTransformer was chosen because this allows a potential extension to multiple files (with multiple input fields). Alternatively, ReceiveExternalFilesActivity#uploadFile() could've been used, which requires the storage to a temporary file first. nextFocusForward and nextFocusDown are both needed to support navigation with the Tab key as well as the Enter key Signed-off-by: Philipp Hasper <vcs@hasper.info>
This streamlines the renaming and speeds up the process. Signed-off-by: Philipp Hasper <vcs@hasper.info>
When running the screenshot tests, the following error was raised: com.owncloud.android.ui.activity.ReceiveExternalFilesActivityIT > openMultiAccount[uiComparison(AVD) - 9] FAILED java.lang.AssertionError: Can't create multiple screenshots with the same name: com.owncloud.android.ui.activity.ReceiveExternalFilesActivityIT_open at com.facebook.testing.screenshot.internal.AlbumImpl.addRecord This happened because openMultiAccount() simply calls the open() test which "hardcodes" the screenshot name Signed-off-by: Philipp Hasper <vcs@hasper.info>
The UI only allows to proceed with the upload, if the permissions are given accordingly, so the test setup needs access to the corresponding permission keys. Instead of only making one of the keys available, all were made public. Because why should these magic strings be private after all? This only invites duplication and hinders maintenance. Signed-off-by: Philipp Hasper <vcs@hasper.info>
The automated test only tests this partially, because the only invalid name was an emtpy name. All other characters which are typically unsuitable for a filename, like the directory separator '/' are not properly rejected during the test run, because the FileNameValidator is based on the user capabilities, which are null because this is a sever-less test. Signed-off-by: Philipp Hasper <vcs@hasper.info>
Signed-off-by: Philipp Hasper <vcs@hasper.info>
To reduce duplication, the file and folders are setup in a @before method, but this also affects the existing screenshot tests. Signed-off-by: Philipp Hasper <vcs@hasper.info>
Working around the limitation of returns as well as the condition complexity was attempted but made the code just less readable. Ignoring these two specific findings is more appropriate here. Signed-off-by: Philipp Hasper <vcs@hasper.info>
Signed-off-by: Philipp Hasper <vcs@hasper.info>
|
@kra-mo I recreated the PR in the main repo now, so the automated tests are executed. Regarding your comment:
I added one commit which introduces padding at the top. See the comparison:
|
|
blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed. |
|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16298.apk |



Original PR: #16215
This streamlines the upload from files, e.g. from email attachments.
Closes #9215.
Also offers a convenient pre-selection of the filename without extension when entering the input field, as well as file name validation.
Recording of the automated test:
(The upload failure in the end is expected, as there is no server mocked)
Screen_recording_20260102_124130.mp4
Technical details
@Beforemethod which apply to all tests. Screenshot tests are broken on master right now, so I did not feel confident to provide updated screenshots with no way of verifying them. Either they need to be updated later, or the tests should be separated in two files