Skip to content

Improve sync error handling - #3401

Open
alperozturk96 wants to merge 3 commits into
mainfrom
improve-sync-error-handling
Open

alperozturk96 wants to merge 3 commits into
mainfrom
improve-sync-error-handling

Conversation

@alperozturk96

@alperozturk96 alperozturk96 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

After the Files app was reinstalled, Notes couldn't sync anymore ("token mismatch")
The app said "server unreachable" instead of the real reason.
The only advice was "remove and add the account", which deletes unsynced notes.
Old errors kept popping up even after syncing worked again.

How to reproduce?

  1. Have a files app and notes app
  2. Reinstall or upgrade files app
  3. Open notes app
  4. Sync error and old error messages will appear

Changes

  • Shows better error messages.
  • Adds "Grant access" button: when Notes loses access, the error has a button that asks the Files app for access again.
  • Removes stale errors from previous session.

SSO Library PR: nextcloud/Android-SingleSignOn#1099

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
default -> {
try {
AccountImporter.onActivityResult(requestCode, resultCode, data, this, (ssoAccount) -> {
ApiProvider.getInstance().invalidateAPICache(ssoAccount);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

clear cache and post new account

private boolean syncOnlyOnWifi;
private final MutableLiveData<Boolean> syncStatus = new MutableLiveData<>(false);
private final MutableLiveData<ArrayList<Throwable>> syncErrors = new MutableLiveData<>();
private final SingleLiveEvent<ArrayList<Throwable>> syncErrors = new SingleLiveEvent<>();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

MainActivity subscribed again it got the last sync failure again, even if later syncs had succeeded. SingleLiveEvent delivers each batch once.

HTTP_UNAVAILABLE -> MAINTENANCE
HTTP_INSUFFICIENT_STORAGE -> INSUFFICIENT_STORAGE
SSO_LOCAL_FAILURE -> SERVER_UNREACHABLE
SSO_LOCAL_FAILURE -> null

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

900 doesn't mean SERVER_UNREACHABLE

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 6 minor

Alerts:
⚠ 6 issues (≤ 0 issues of at least minor severity)

Results:
6 new issues

Category Results
Documentation 6 minor

View in Codacy

🟢 Metrics 6 complexity · 0 duplication

Metric Results
Complexity 6
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@github-actions

Copy link
Copy Markdown
Contributor

📱 QA build

Download app-qa-debug.apk
QR code Open the QR code for this download
Commit f9a1897
Version 3401
Available until 7 days after this build

The QA build installs alongside a released Nextcloud app, so you can keep
using your existing install while testing.

Downloading the file requires a GitHub account, so open this link on the
device you want to test on, or transfer the APK to it.

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.

1 participant