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)
Wed, Nov 6, 3:43 PM
Unknown Object (File)
Wed, Nov 6, 3:43 PM
Unknown Object (File)
Wed, Nov 6, 3:43 PM
Unknown Object (File)
Wed, Nov 6, 3:43 PM
Unknown Object (File)
Wed, Nov 6, 3:43 PM
Unknown Object (File)
Wed, Oct 30, 1:20 PM
Unknown Object (File)
Oct 3 2024, 9:39 PM
Unknown Object (File)
Oct 2 2024, 5:08 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.