Add share intent
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -25,9 +25,32 @@ const getMemeType = (mimeType: string): MEME_TYPE | undefined => {
|
||||
}
|
||||
};
|
||||
|
||||
const guessMimeType = (filename: string): string | undefined => {
|
||||
const extension = filename.split('.').pop()?.toLowerCase();
|
||||
switch (extension) {
|
||||
case 'bmp': {
|
||||
return 'image/bmp';
|
||||
}
|
||||
case 'jpg':
|
||||
case 'jpeg': {
|
||||
return 'image/jpeg';
|
||||
}
|
||||
case 'png': {
|
||||
return 'image/png';
|
||||
}
|
||||
case 'webp': {
|
||||
return 'image/webp';
|
||||
}
|
||||
case 'gif': {
|
||||
return 'image/gif';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
allowedImageMimeTypes,
|
||||
allowedGifMimeTypes,
|
||||
allowedMimeTypes,
|
||||
getMemeType,
|
||||
guessMimeType,
|
||||
};
|
||||
|
@@ -14,6 +14,7 @@ export {
|
||||
allowedGifMimeTypes,
|
||||
allowedMimeTypes,
|
||||
getMemeType,
|
||||
guessMimeType,
|
||||
} from './filesystem';
|
||||
export { getSortIcon, getViewIcon } from './icon';
|
||||
export {
|
||||
@@ -26,6 +27,7 @@ export {
|
||||
export {
|
||||
isPermissionForPath,
|
||||
clearPermissions,
|
||||
getFilenameFromUri,
|
||||
} from './permissions';
|
||||
export { deleteTag } from './tag';
|
||||
export {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import { Util } from 'react-native-file-access';
|
||||
import {
|
||||
getPersistedUriPermissions,
|
||||
releasePersistableUriPermission,
|
||||
@@ -16,4 +17,8 @@ const clearPermissions = async (excepts: string[] = []) => {
|
||||
});
|
||||
};
|
||||
|
||||
export { isPermissionForPath, clearPermissions };
|
||||
const getFilenameFromUri = (uri: string) => {
|
||||
return Util.basename(uri.replaceAll('%2F', '/'));
|
||||
};
|
||||
|
||||
export { isPermissionForPath, clearPermissions, getFilenameFromUri };
|
||||
|
Reference in New Issue
Block a user