Page MenuHomePhabricator

D7966.diff
No OneTemporary

D7966.diff

diff --git a/native/dev-menu.js b/native/dev-menu.js
new file mode 100644
--- /dev/null
+++ b/native/dev-menu.js
@@ -0,0 +1,28 @@
+// @flow
+
+import { registerDevMenuItems } from 'expo-dev-menu';
+import { Alert } from 'react-native';
+
+import { getMessageForException } from 'lib/utils/errors.js';
+
+import { filesystemMediaCache } from './media/media-cache.js';
+
+// see https://docs.expo.dev/develop/development-builds/development-workflows/#extending-the-dev-menu
+// for details on extending the dev menu
+if (__DEV__) {
+ const devMenuItems = [
+ {
+ name: 'Clear media cache',
+ callback: async () => {
+ try {
+ await filesystemMediaCache.clearCache();
+ Alert.alert('Media cache cleared');
+ } catch (e) {
+ Alert.alert('Cache clear failed', getMessageForException(e));
+ }
+ },
+ },
+ ];
+
+ registerDevMenuItems(devMenuItems);
+}
diff --git a/native/root.react.js b/native/root.react.js
--- a/native/root.react.js
+++ b/native/root.react.js
@@ -57,6 +57,9 @@
import ThemeHandler from './themes/theme-handler.react.js';
import { provider } from './utils/ethers-utils.js';
+// Add custom items to expo-dev-menu
+import './dev-menu.js';
+
if (Platform.OS === 'android') {
UIManager.setLayoutAnimationEnabledExperimental &&
UIManager.setLayoutAnimationEnabledExperimental(true);

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 1, 1:02 PM (19 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605055
Default Alt Text
D7966.diff (1 KB)

Event Timeline