Skip to content
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

Extra options for uploading subfolders #11852

Merged
merged 10 commits into from
Aug 30, 2023

Conversation

dean36963
Copy link
Contributor

@dean36963 dean36963 commented Aug 1, 2023

resolves #11642

Adds some extra options for uploading photos into various patterns of subfolders. yyyy or yyyy/MM or yyyy/MM/dd supported.

Currently just adds an extra field for this, and has to be used in conjunction with the "use subfolder" checkbox, the new option is greyed out and disabled when "use subfolder" is not checked.

Notes

List of considerations to add:

  • ✅ Does dropdown make sense UI/UX-wise? (Andy: fine I would say, while other option for upload behavior uses a dialog with a radio button group)

  • ✅ Does the database migrations make sense? This is the first time I've done that sort of migration so probably needs extra checks.

  • ✅ Unit tests! As there's now more ways of uploading files, should we have some new unit tests for checking new upload location is correct for all new options?

  • ✅ Order of imports and line wrapping settings, I'm not sure if this is already covered by the idea settings files in git and android-studio doing this, or do I need to run somethings?

  • ✅ Order of the dropdown isn't ideal visually, but I wanted to make sure in case after a migration, a 0 in the database should be the first option, so previous behavior is kept (though this makes an assumption that 0 is the default which might be incorrect).

  • ✅ Localisation concerns? There's been a change to prefs_instant_upload_path_use_subfolders_summary (but only in one language), due to a change in behaviour, so text might not make sense any more in other languages.

  • ✅ detectNewJavaFiles: should all new classes be Kotlin? (ah I may have forgotten copyright headers...)

  • Tests written, or not not needed

@AndyScherzinger
Copy link
Member

@dean36963 would you mind adding some screenshots, so @nextcloud/designers can have a look? Thanks in advance 👍

@dean36963
Copy link
Contributor Author

Current screenshots:

Light theme:

All Disabled Subfolder Disabled Subfolder Enabled Dropdown Selected
Screenshot_20230802-220051_Nextcloud Screenshot_20230802-220057_Nextcloud Screenshot_20230802-220105_Nextcloud Screenshot_20230802-220111_Nextcloud Screenshot_20230802-220116_Nextcloud

Dark theme:

All Disabled Subfolder Disabled Subfolder Enabled Dropdown Selected
Screenshot_20230802-212634_Nextcloud Screenshot_20230802-212639_Nextcloud Screenshot_20230802-212644_Nextcloud Screenshot_20230802-212650_Nextcloud Screenshot_20230802-212656_Nextcloud

On looking again, it looks like each area has a bold looking title text, with lighter text below. Not sure if the spinner/dropdown text should also look lighter too, but then to me it looks like it might be greyed out and not selectable.

Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice @dean36963! :) Only one adjustment maybe, to make it a little bit less busy when "Use subfolders" is not checked, the "Subfolder options" could only be shown once that is checked?

@dean36963
Copy link
Contributor Author

All Disabled Subfolder Disabled Subfolder Enabled Dropdown Selected
Screenshot_20230803-123830_Nextcloud Screenshot_20230803-123837_Nextcloud Screenshot_20230803-123844_Nextcloud Screenshot_20230803-123848_Nextcloud Screenshot_20230803-123853_Nextcloud

@@ -63,7 +63,8 @@ import com.owncloud.android.db.ProviderMeta
AutoMigration(from = 65, to = 66),
AutoMigration(from = 66, to = 67),
AutoMigration(from = 68, to = 69),
AutoMigration(from = 69, to = 70)
AutoMigration(from = 69, to = 70),
AutoMigration(from = 71, to = 72)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobiasKaminsky not needed, right? Since there is an actual migration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried reverting this section, and when I moved from a build before my changes, to a build including all my changes (including reverting this - not pushed) I saw that some auto upload folder settings were lost. Keeping this line as is currently committed seemed to keep folder settings as I'd expect when upgrading.

It might be that I'd need to revert this and also change another section, but I am unsure what that change would be.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't say for sure and would need to check if and which changes have been made for 70,71,72 to know When to set the Auto Migration. 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic of Room is, afaik:

  • if auto migrate is enabled, then it keeps entire DB, but changes/add new column
  • if no auto migrate and no manual migration -> resets entire DB -> all is lost
  • 72.json is for a new database (new app installation)
    --> now the question is, do we need a manual migration, e.g. to add a specific value to hidden or subFolderRule? If not, then it should work with AutoMigration and 72.json as it is now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now the question is, do we need a manual migration, e.g. to add a specific value to hidden or subFolderRule?

In this regard, I've currently got it so the previous option for this (YYYY/MM) is the first option in the dropdown and appears as the default value post migration (and just in general for new folders). So I think in it's current state, no default value is needing to be set.

However, if it's more sensible to reorder these options visually (yearly then monthly, then daily for example), it might be required to then do a manual migration?

val hidden: Int?
val hidden: Int?,
@ColumnInfo(name = ProviderTableMeta.SYNCED_FOLDER_SUBFOLDER_RULE)
val subFolderRule: Int?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one (new column, so no auto migration, right @tobiasKaminsky ?

@AndyScherzinger
Copy link
Member

Some minor comments and I'll bee needing some feedback from @tobiasKaminsky regarding the room migration code bits.
@jancborchardt are you fine with the dropdown for the folder options, see #11852 (comment) - keeping in mind, the "What if the file already exists?" option uses a dialog with a radio button group.

Copy link
Member

@marcoambrosini marcoambrosini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice :)

A couple of non blocking comments regarding design:

  • I think that the complexity of these settings warrant the use of a full page view as opposed to a dialog. It will also work better on smaller mobile screens.
  • There's a conceptual mismatch between the title of the page and the switch right next to it. I assume that the switch turns auto-upload on and off but the title says "preferences for auto upload", so it's a little confusing. I think we should change the title to "Auto upload" only.

@AndyScherzinger AndyScherzinger force-pushed the synced_folder_upload_subfolderoptions_pr branch from 381de90 to 35d125c Compare August 28, 2023 07:59
@AndyScherzinger AndyScherzinger added this to the Nextcloud App 3.26.0 milestone Aug 29, 2023
@tobiasKaminsky
Copy link
Member

Rebased and good to go :shipit:

@AndyScherzinger AndyScherzinger force-pushed the synced_folder_upload_subfolderoptions_pr branch from 4d78049 to c29bfc0 Compare August 30, 2023 07:34
@tobiasKaminsky tobiasKaminsky force-pushed the synced_folder_upload_subfolderoptions_pr branch from c29bfc0 to 612aad9 Compare August 30, 2023 07:44
@tobiasKaminsky tobiasKaminsky force-pushed the synced_folder_upload_subfolderoptions_pr branch from 612aad9 to e5032c9 Compare August 30, 2023 08:37
Adds some extra options for uploading photos into various patterns of
subfolders. yyyy or yyyy/MM or yyyy/MM/dd supported.

Currently just adds an extra field for this, and has to be used in
conjunction with the "use subfolder" checkbox, the new option is greyed
out and disabled when "use subfolder" is not checked.

Signed-off-by: Dean Birch <dean.birch0@gmail.com>
Signed-off-by: Dean Birch <dean.birch0@gmail.com>
Signed-off-by: Dean Birch <dean.birch0@gmail.com>
Signed-off-by: Dean Birch <dean.birch0@gmail.com>
Signed-off-by: Dean Birch <dean.birch0@gmail.com>
dean36963 and others added 4 commits August 30, 2023 11:30
Instead of greying out the subfolder rules when not active, hide them.
Also reverts changes to make a function out of getAlpha.

Signed-off-by: Dean Birch <dean.birch0@gmail.com>
Signed-off-by: Dean Birch <dean.birch0@gmail.com>
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@tobiasKaminsky tobiasKaminsky force-pushed the synced_folder_upload_subfolderoptions_pr branch from e5032c9 to 22b7d23 Compare August 30, 2023 09:30
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
@tobiasKaminsky tobiasKaminsky force-pushed the synced_folder_upload_subfolderoptions_pr branch from 22b7d23 to f32cb61 Compare August 30, 2023 10:10
@github-actions
Copy link

Codacy

Lint

TypemasterPR
Warnings8080
Errors00

SpotBugs

CategoryBaseNew
Bad practice2626
Correctness8585
Dodgy code433433
Experimental22
Internationalization99
Malicious code vulnerability22
Multithreaded correctness99
Performance5959
Security1818
Total643643

@github-actions
Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/11852.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@tobiasKaminsky tobiasKaminsky merged commit c00e614 into master Aug 30, 2023
@delete-merged-branch delete-merged-branch bot deleted the synced_folder_upload_subfolderoptions_pr branch August 30, 2023 12:35
@AndyScherzinger
Copy link
Member

Merged! Nice work @dean36963 🎉 And thanks for building and polishing it 💯

Copy link

github-actions bot commented Apr 4, 2024

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto Upload create subfolders for year only
5 participants