Page MenuHomePhabricator

[native] Add "Clear media cache" button to dev menu
ClosedPublic

Authored by bartek on May 24 2023, 11:25 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jun 21, 9:46 PM
Unknown Object (File)
Fri, Jun 21, 5:17 AM
Unknown Object (File)
Thu, Jun 20, 1:15 PM
Unknown Object (File)
Tue, Jun 18, 8:47 AM
Unknown Object (File)
Tue, Jun 18, 8:47 AM
Unknown Object (File)
Tue, Jun 18, 8:47 AM
Unknown Object (File)
Tue, Jun 18, 8:42 AM
Unknown Object (File)
Tue, Jun 18, 7:05 AM
Subscribers

Details

Summary

I use this locally to clear the media cache when I'm testing encrypted multimedia.
This is related to ENG-2745 - I just found another use case for the custom menu buttons.

This should be run as a side effect in global scope. Subsequent calls override the previous one.

Docs on this feature: https://docs.expo.dev/develop/development-builds/development-workflows/#extending-the-dev-menu

Test Plan

Run the app and open dev menu (shake / press the m key while in metro console). The button should appear.

Simulator Screen Shot - iPhone 14 Pro - 2023-05-24 at 20.22.34.png (2×1 px, 279 KB)

When clicked, the button should clear the media cache and show a toast.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ashoat added inline comments.
native/dev-menu.js
16 ↗(On Diff #27012)

This isn't mentioned in the link above – wondering, how does alert work in Expo / React Native? Is this an alias for react-native's Alert component, or is it something specific to expo-dev-menu / registerDevMenuItems? (I figure the latter since you mentioned a "toast")

This revision is now accepted and ready to land.May 24 2023, 11:47 AM
native/dev-menu.js
16 ↗(On Diff #27012)

This display system native message box. The same kind of alert pops up massively when logging in/out saying that redux/database was cleared/hydrated etc.
Importing Alert from react-native seems to be optional.

Explicitly imported Alert from react-native to avoid further confusion.