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

Unify Notifications #12907

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft

Unify Notifications #12907

wants to merge 11 commits into from

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Apr 19, 2024

  • Tests written, or not not needed

Before

before.mp4

After

after.mp4

Improvements

  • All notifications are dismissible. Some users are experiencing problems with notifications that are stuck.

  • One notification can be used for downloads and uploads. Instead of showing progress with one by one now we can show all progress with one notification.

Example

1 / 10 abc.rtf …
2 / 10 abc2.docx…
...
...
10 / 10 abc3.pdf…

How to Test

  • Test one file download

  • Test one file upload

  • Test multiple file upload

  • Test multiple file download

  • Test all above scenarios for e2e

@alperozturk96 alperozturk96 linked an issue Apr 19, 2024 that may be closed by this pull request
@alperozturk96 alperozturk96 force-pushed the feature/unify-notifications branch 2 times, most recently from 46bf27c to 32d0efb Compare April 26, 2024 14:05
@alperozturk96 alperozturk96 force-pushed the feature/unify-notifications branch 3 times, most recently from f8cc620 to fb239e5 Compare May 2, 2024 14:29
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Copy link

github-actions bot commented May 3, 2024

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/12907.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.

Copy link

github-actions bot commented May 3, 2024

Codacy

Lint

TypemasterPR
Warnings7272
Errors33

SpotBugs

CategoryBaseNew
Bad practice6666
Correctness7373
Dodgy code349349
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness66
Performance5757
Security1919
Total580580

Copy link
Collaborator

@ZetaTom ZetaTom left a comment

Choose a reason for hiding this comment

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

In general these changes seem to work and not break anything.

Please revert any changes made to app/src/main/res/values-*/strings.xml as these files are managed via transifex.

@@ -182,8 +182,11 @@
<string name="active_user">Active user</string>
<string name="upload_chooser_title">Upload from…</string>
<string name="uploader_info_dirname">Folder name</string>

<string name="upload_notification_manager_start_text" translatable="false">%1$d / %2$d - %3$s</string>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure how translatable="false" affects RTL languages and how this should be displayed in this case.

Copy link
Member

Choose a reason for hiding this comment

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

It won't be added on transifex, text within the UI element will be right aligned, nothing else. Hence the text block will be right aligned while the information in its order ir ltr sorted.

Hence it makes sense to make it translatable even thought it won't differ in its from except for RTL / LTR

Comment on lines +164 to +167
run uploads@{
uploads.forEachIndexed { currentUploadIndex, upload ->
if (isStopped) {
return@uploads
Copy link
Collaborator

Choose a reason for hiding this comment

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

This run could be removed and the return@uploads replaced with a regular return, if I'm not mistaken.

uploadsStorageManager.removeUpload(upload.uploadId)
}

notificationManager.dismissWorkerNotifications()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't this cause the notification to be cancelled immediately after notificationManager.notify() is called?

notification = notificationBuilder.build()
}
private val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
private var currentOperationTitle: String? = "null"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
private var currentOperationTitle: String? = "null"
private var currentOperationTitle: String? = null

This attribute should be moved to the same place as currentOperationTitle is placed in DownloadNotificationManager.

startIntent: PendingIntent
startIntent: PendingIntent,
currentUploadIndex: Int,
totalUploadSize: Int
) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The function prepareForStart() is called by FileUploadWorker#uploadFiles(), which is in turn called from FileUploadWorker#retrievePagesBySortingUploadsByID(). This function queries the database for pending uploads using UploadsStorageManager#getCurrentAndPendingUploadsForAccountPageAscById().

Because of QUERY_PAGE_SIZE = 100, totalUploadSize will never exceed 100. Even if one uploads a large folder containing several hundred files.

All of this results in the notification always displaying n / 100 - filename.ext.

@alperozturk96 alperozturk96 marked this pull request as draft May 8, 2024 13:11
auto-merge was automatically disabled May 8, 2024 13:11

Pull request was converted to draft

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.

Unified Notifications
3 participants