Skip to content

Add "Test Connection" Button to WebDAV Settings Before Saving Credentials #18

@TheZupZup

Description

@TheZupZup

Overview

Context: The WebDAV sync client and server are fully implemented in nexanote/sync/. The SettingsScreen (app/lib/screens/settings_screen.dart) already has a form with fields for NAS URL, username, and password, and a "Sync now" button. Credentials are saved to SharedPreferences and sent to the backend via POST /sync/configure.

The gap: There's no way to test the WebDAV connection before saving credentials. If the URL or password is wrong, the user only finds out when they tap "Sync now" and the sync silently fails or produces a generic error.

What needs to be done

  • Add a "Test Connection" button next to the save button in the WebDAV settings section of SettingsScreen
  • When tapped, call ApiClient.configureSync(serverUrl, username, password) followed immediately by ApiClient.triggerSync(), then read the result from getSyncStatus()
  • If the backend returns an error (auth failure, unreachable host, etc.), display a clear inline error message below the form fields (not just a snackbar) — e.g., "Could not connect to WebDAV server: authentication failed"
  • If the connection succeeds, show a green checkmark or success message: "Connection successful"
  • Show a loading indicator on the button while the test is running

Goal

A user setting up NAS sync for the first time can tap "Test Connection" and get immediate feedback — success or a specific error — before saving their credentials.

Where to look

  • app/lib/screens/settings_screen.dart — the WebDAV settings section
  • app/lib/services/api_client.dartconfigureSync(), triggerSync(), getSyncStatus()

Testing steps

  • Enter valid WebDAV credentials and tap "Test Connection" — verify success message appears
  • Enter an incorrect password — verify an error message appears inline
  • Enter an unreachable URL — verify a connection error is shown (not a crash)
  • Verify the test does NOT save credentials automatically (the user still must tap "Save")

Notes

This is a good first issue. It's a small, contained UI improvement with no backend changes required.

Related to: #17, #26

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions