android
android copied to clipboard
Multiple instances of UploadsStorageManager
Bug:
* have 3 images in Camera * upload them * install this branch * enable "upload previously" * enable upload for folder "Camera" * see that three items as conflict in upload list view +1 * click on one, select "keep server" * still see three items --> it should be two
This is a display bug, if you refresh up to date list is displayed.
FileDownloader L645
and UploadsStorageManager L238
-> UploadListAdapter doesn't register as an Observer of UploadsStorageManager
. But there are multiple instances (see screenshot) of UploadsStorageManager
so it doesn't work anyway. I need your help @tobiasKaminsky on how you would make this class an effective singleton; else there is no way to properly update the view.
@tobiasKaminsky up on my answers to your comments btw.
Originally posted by @ArisuOngaku in https://github.com/nextcloud/android/pull/4788#issuecomment-586173105
But there are multiple instances (see screenshot) of
UploadsStorageManager
so it doesn't work anyway.
This should per se be no problem, as all queries are against a database, which synchronizes it. I guess that we just do not have a callback (or obsverable, as you said) to detect that we have to reload the list.
Registering a ContentObserver
on the database means we have to unregister it once we're done with the instance of UploadsStorageManager
. A new instance of this almost every time an activity is opened (and more), this gets hard to be tracked.
Making this a singleton (should be fine) means that there's only one ContentObserver
on the db.
Anyway UploadListAdapter has to either:
- register an observer on UploadsStorageManager because it currently doesn't get updated on notifyObservers()
- receive an "upload message" in some way (through
UploadMessagesReceiver
)
See #5488 for 1st solution