Skip to content

Add logging for Ktor client and handle photo upload exceptions in sync - #47

Open
iamrajeshk wants to merge 1 commit into
aviv-dev-latestfrom
kartview-api-2.0
Open

Add logging for Ktor client and handle photo upload exceptions in sync#47
iamrajeshk wants to merge 1 commit into
aviv-dev-latestfrom
kartview-api-2.0

Conversation

@iamrajeshk

Copy link
Copy Markdown
Collaborator

This pull request introduces several important improvements to the KartaView photo upload integration and its error handling, as well as enhanced logging for network requests. The main changes include switching from sequence-based to photo ID-based lookups for uploaded images, updating data models to match the new API responses, and improving the robustness of upload error handling to avoid aborting all uploads on a single failure.

KartaView API integration improvements:

  • Changed the photo upload and lookup process in KartaViewApiClient to use photo IDs returned by the upload API, rather than relying on sequence and index, for more reliable and future-proof image retrieval. This includes updating the uploadImages, uploadPhoto, and getPhotoLthUrl methods to work with photo IDs instead of sequence indices. [1] [2] [3] [4] [5] [6]
  • Updated the Photo and PhotoLookupResponse data models to align with the new API responses: Photo now includes an id field, and PhotoLookupResult.data is now a nullable single object instead of a list. [1] [2]

Error handling and upload robustness:

  • Improved error handling in both ElementEditsUploader and NoteEditsUploader to catch KartaViewException during photo uploads. If a photo upload fails, the specific edit is left unsynced for the next attempt, and the upload process for other edits continues, preventing a single failure from aborting all queued uploads. [1] [2]

Logging and developer experience:

  • Added Ktor HTTP client logging to Android using the Logging plugin, with logs directed to Android's Log.d instead of System.err for better log visibility and filtering.

These changes collectively make photo uploads to KartaView more reliable, easier to debug, and less prone to failures that block other queued uploads.

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.

1 participant