Skip to content

Refactor image upload logic to use access token from preferences and error handling#26

Open
iamrajeshk wants to merge 2 commits into
aviv-dev-latestfrom
bugfix-kartaview
Open

Refactor image upload logic to use access token from preferences and error handling#26
iamrajeshk wants to merge 2 commits into
aviv-dev-latestfrom
bugfix-kartaview

Conversation

@iamrajeshk

Copy link
Copy Markdown
Collaborator

This pull request introduces several improvements and refactors to the KartaView photo upload flow, focusing on better API usage, improved error handling, and more secure access token management. The changes also add a dedicated HTTP client for KartaView with retries and update some constants and preferences.

KartaView Integration and Refactoring:

  • Refactored the KartaView photo upload process in AbstractOsmQuestForm to:

    • Use the access token from the new Preferences.kartaViewAccessToken property instead of hardcoded values.
    • Split the photo URL retrieval into a separate getPhotoLthUrl function, which fetches the correct LTH image URL via a dedicated API call.
    • Simplify the upload logic to return a success boolean instead of a tuple, and improve error handling and logging throughout the process. [1] [2] [3]
  • Added a dedicated KartaView HTTP client (named("kartaViewClient")) with JSON support and automatic retries for server errors and exceptions, improving reliability of network operations. [1] [2]

Preferences and Configuration:

  • Introduced a new kartaViewAccessToken property in the Preferences class, with a default value, allowing the access token to be managed securely and consistently across the app. [1] [2]

Other Minor Updates:

  • Updated the error report email address in ApplicationConstants to a new support address.

  • Cleaned up imports in AbstractOsmQuestForm to reflect updated dependencies and removed unused classes. [1] [2] [3]

These changes collectively improve the maintainability, security, and reliability of the KartaView photo upload feature.

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