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

Run Import/Export on non-UI thread #1897

Merged
merged 2 commits into from
May 22, 2024
Merged

Conversation

TheLastProject
Copy link
Member

This seems to fix Android sometimes throwing
NetworkOnMainThreadException when importing bit files through the Nextcloud app.

I'm not sure if this is necessary for the export too, but it doesn't seem to break anything so for consistency it makes sense to also wrap the exporter into a thread.

This change is suboptimal because it will still block the UI with a ProgressDialog (which is deprecated) and force the user to wait until the import/export completes (and will kill the import/export if the app gets backgrounded) but it should at least fix the most common crash for most users.

This seems to fix Android sometimes throwing
NetworkOnMainThreadException when importing bit files through the
Nextcloud app.

I'm not sure if this is necessary for the export too, but it doesn't
seem to break anything so for consistency it makes sense to also wrap
the exporter into a thread.

This change is suboptimal because it will still block the UI with a
ProgressDialog (which is deprecated) and force the user to wait until
the import/export completes (and will kill the import/export if the app
gets backgrounded) but it should at least fix the most common crash for
most users.
@TheLastProject
Copy link
Member Author

This is related to #513 but not a real fix for it.

@TheLastProject TheLastProject merged commit 182e7ef into main May 22, 2024
1 check passed
@TheLastProject TheLastProject deleted the fix/threadedImportExport branch May 22, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants