Skip to content

Fix ANR & CRASH - #54

Merged
nhoxbypass merged 9 commits into
developfrom
bug/fix_anr_crash
Apr 16, 2026
Merged

Fix ANR & CRASH#54
nhoxbypass merged 9 commits into
developfrom
bug/fix_anr_crash

Conversation

@nhoxbypass

Copy link
Copy Markdown
Owner

No description provided.

…istence

- Remove `applicationIdSuffix` from the mock product flavor and update `google-services.json` to match the base package name to avoid Firebase API key restrictions.
- Update `FakeFirebaseClientAuth` to persist and restore the mock user's email using `SharedPreferences`.
- Refactor `RepositoryModule` to provide `@ApplicationContext` to `providePreferenceRepository` and `provideAuthClient`.
- Migrate `providePreferenceRepository` from using `FakePreferencesHelper` to `AppPreferencesWrapper` with real `SharedPreferences`.
- Update `FakeFirebaseUserApiHelper` to lazily initialize and cache fake user data if it doesn't exist.
- Update `FakeFirebaseStoreApiHelper` to automatically populate the store list with fake data if empty.
- Create `app/src/mock/AndroidManifest.xml` to configure build-variant specific meta-data.
- Deactivate Firebase Performance Monitoring and Crashlytics data collection to prevent background thread crashes caused by invalid credentials in the mock flavor.
- Remove `google_maps_api_key` and `google_maps_browser_key` from `app/src/mock/res/values/secret.xml`.
- Rely on inheritance from the main source set's `secret.xml` for these keys to avoid duplication.
…n persistence

- Update `LoginViewModel` to prioritize existing user profiles from the repository and ensure basic user data is populated before updating.
- Enhance `FakeFirebaseUserApiHelper` to persist and restore mock user data (email and name) using `SharedPreferences`.
- Modify `FakeFirebaseClientAuth` to store and retrieve the mock user's name, improving data consistency across app restarts.
- Update `RepositoryModule` to provide `Context` to `FakeFirebaseUserApiHelper` for shared preferences access.
- Adjust mock sign-in logic to provide an empty name, allowing `LoginViewModel` to derive display names from emails.
- Set `checkReleaseBuilds = false` in the `lint` configuration to prevent build failures.
- Add documentation noting that `lintVitalAnalyzeProdRelease` crashes due to a known bug in the Kotlin Analysis API when processing `.kts` files.
… thread

- Wrap `WorkManager.enqueueUniquePeriodicWork` within a `CoroutineScope` using `Dispatchers.IO` to avoid blocking the main thread during initialization.
- Migrate map fragment initialization from `onActivityCreated` (deprecated) to `onViewCreated`.
- Optimize marker rendering by adding a visibility check to only add markers within the current map bounds.
- Refactor `inflateSupportMapFragment` to use `commitAllowingStateLoss()` and simplify the fragment retrieval logic.
- Update `inflateSupportMapFragment` return type to nullable `SupportMapFragment?` and remove unnecessary `executePendingTransactions()`.
…oviderClient`

- Replace deprecated `GoogleApiClient` and `FusedLocationApi` with `FusedLocationProviderClient` to prevent potential ANRs caused by blocking main thread calls.
- Update location updates to use `LocationCallback` instead of the legacy `LocationListener`.
- Implement `fetchLastLocationAsync` using a Task-based callback to retrieve the last known location without blocking.
- Update `LocationRequest` creation to use the modern `LocationRequest.Builder` with `Priority.PRIORITY_HIGH_ACCURACY`.
- Simplify provider initialization and termination logic by removing connection callbacks and manual disconnection steps.
@codecov

codecov Bot commented Apr 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 17.31%. Comparing base (ffc4957) to head (9fd389a).
⚠️ Report is 10 commits behind head on develop.

Files with missing lines Patch % Lines
...src/main/java/com/iceteaviet/fastfoodfinder/App.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop      #54   +/-   ##
==========================================
  Coverage      17.30%   17.31%           
  Complexity       196      196           
==========================================
  Files             97       97           
  Lines           2537     2536    -1     
  Branches         223      223           
==========================================
  Hits             439      439           
+ Misses          2081     2080    -1     
  Partials          17       17           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nhoxbypass
nhoxbypass merged commit 64d1446 into develop Apr 16, 2026
2 of 4 checks passed
@nhoxbypass
nhoxbypass deleted the bug/fix_anr_crash branch April 19, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant