Skip to content

Conversation

@richardelms
Copy link
Contributor

@richardelms richardelms commented Oct 16, 2025

This pull request refactors and extends the cache-clearing logic in Main.cs for the Maze Runner Unity app. The main focus is on improving platform-specific cache clearing, especially for Android and iOS, and making the code more modular and maintainable.

Cache clearing improvements:

  • Refactored the generic ClearUnityCache method into a new ClearCache method that delegates to platform-specific cache clearing functions (ClearUnityCache, ClearAndroidCache, ClearIOSCache), improving clarity and maintainability. ([features/fixtures/maze_runner/Assets/Scripts/Main.csL156-R330](https://github.com/bugsnag/bugsnag-unity/pull/947/files#diff-de9904b5ccc03c4a50ec009435ca97d7ec0aa87d63812badfa9a0d27659e77d1L156-R330))
  • Added comprehensive Android cache clearing: deletes specific directories and files, clears shared preferences, and logs folder contents for debugging. Introduced helper methods for file/directory deletion and folder listing, and used Unity's AndroidJava APIs to find cache and files roots. ([features/fixtures/maze_runner/Assets/Scripts/Main.csL156-R330](https://github.com/bugsnag/bugsnag-unity/pull/947/files#diff-de9904b5ccc03c4a50ec009435ca97d7ec0aa87d63812badfa9a0d27659e77d1L156-R330))
  • Renamed ClearIOSData to ClearIOSCache for consistency with other platform-specific methods. ([features/fixtures/maze_runner/Assets/Scripts/Main.csL156-R330](https://github.com/bugsnag/bugsnag-unity/pull/947/files#diff-de9904b5ccc03c4a50ec009435ca97d7ec0aa87d63812badfa9a0d27659e77d1L156-R330))

Codebase cleanup and consistency:

  • Updated the command handler to call the new ClearCache method instead of the old ClearUnityCache method, ensuring that platform-specific logic is used. ([features/fixtures/maze_runner/Assets/Scripts/Main.csL135-R133](https://github.com/bugsnag/bugsnag-unity/pull/947/files#diff-de9904b5ccc03c4a50ec009435ca97d7ec0aa87d63812badfa9a0d27659e77d1L135-R133))
  • Removed minor blank lines and improved method organization for readability. ([features/fixtures/maze_runner/Assets/Scripts/Main.csL46-L48](https://github.com/bugsnag/bugsnag-unity/pull/947/files#diff-de9904b5ccc03c4a50ec009435ca97d7ec0aa87d63812badfa9a0d27659e77d1L46-L48))

@richardelms richardelms self-assigned this Oct 16, 2025
@richardelms richardelms marked this pull request as ready for review October 16, 2025 09:08
@richardelms richardelms changed the title initial change improve native android cache clearing Oct 16, 2025
@richardelms richardelms marked this pull request as draft October 16, 2025 09:56
@bugsnagbot
Copy link
Collaborator

Build size impact

Format Size impact of Bugsnag (kB)
IL2CPP APK 2626.5
IL2CPP IPA 1753.88

Generated by 🚫 Danger

@twometresteve twometresteve removed their request for review October 16, 2025 15:07
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.

3 participants