MaxAst / expo-share-extension

Expo config plugin for creating iOS share extensions with a custom view.
MIT License
161 stars 4 forks source link

Clear shared files in app group container #32

Closed MaxAst closed 1 month ago

MaxAst commented 1 month ago

Motivation

When sharing images and videos via the share extension, expo-share-extension creates a sharedData directory in the app group's container and stores the image/video files in it. These files are not removed automatically, because expo-share-extension can't know when you're done processing them. You also should not not remove them, because that would unnecessarily use up your users' storage capacity.

Implementation

This PR introduces an async clearAppGroupContainer method, which you can import from expo-share-extension to empty the sharedData directory at your own terms (e.g. after you're done processing the shared files).

See examples/with-media/app/create.tsx for an example implementation