Skip to content

Fix repetitive crashes in HttpClient and LocalStorage#6

Open
abdallahyassein-dev wants to merge 3 commits intoproductminds:mainfrom
abdallahyassein-dev:main
Open

Fix repetitive crashes in HttpClient and LocalStorage#6
abdallahyassein-dev wants to merge 3 commits intoproductminds:mainfrom
abdallahyassein-dev:main

Conversation

@abdallahyassein-dev
Copy link
Copy Markdown

This PR addresses critical crashes reported in Firebase Crashlytics related to network timeouts, host lookups, and local storage parsing.

  1. Fixed HttpClient Crashes (SocketException, TimeoutException)

Wrapped the HTTP request logic in a try-catch block to handle network-level failures (offline, timeout) gracefully.
Network errors now log a debug warning instead of propagating unhandled exceptions that crash the host app.
Fixed the timeout implementation (previously, the timeout configuration was ignored).
Corrected the retry logic to properly await recursive calls and prevent invalid execution flow after a failure.
2. Fixed LocalStorage Crash (FormatException)

Updated LocalStorage.load to validate that a string looks like a JSON object (starts with {) before attempting to jsonDecode it.

This prevents FormatException crashes when the SDK scans SharedPreferences that contain plain strings (e.g., locale codes like "en") created by other parts of the application.

Screenshot 2025-12-17 at 12 35 04 PM

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