Add logging for Ktor client and handle photo upload exceptions in sync - #47
Open
iamrajeshk wants to merge 1 commit into
Open
Add logging for Ktor client and handle photo upload exceptions in sync#47iamrajeshk wants to merge 1 commit into
iamrajeshk wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
KartaViewApiClientto 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 theuploadImages,uploadPhoto, andgetPhotoLthUrlmethods to work with photo IDs instead of sequence indices. [1] [2] [3] [4] [5] [6]PhotoandPhotoLookupResponsedata models to align with the new API responses:Photonow includes anidfield, andPhotoLookupResult.datais now a nullable single object instead of a list. [1] [2]Error handling and upload robustness:
ElementEditsUploaderandNoteEditsUploaderto catchKartaViewExceptionduring 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:
Loggingplugin, with logs directed to Android'sLog.dinstead ofSystem.errfor 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.