mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
fixing uri scheme for sharing images
This commit is contained in:
parent
e3bf231b32
commit
1e232d5259
@ -15,6 +15,7 @@
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
|
@ -19,7 +19,6 @@ export function AddTopic({ contentKey, shareIntent, setShareIntent }) {
|
||||
|
||||
useEffect(() => {
|
||||
if (shareIntent) {
|
||||
Alert.alert('SHARING', JSON.stringify(shareIntent));
|
||||
shareIntent.forEach(share => {
|
||||
if (share.text) {
|
||||
actions.setMessage(share.text);
|
||||
@ -27,14 +26,14 @@ export function AddTopic({ contentKey, shareIntent, setShareIntent }) {
|
||||
if (share.weblink) {
|
||||
actions.setMessage(share.weblink);
|
||||
}
|
||||
const mimeType = share.mimeType?.toLowerCase();
|
||||
if (mimeType === '.jpg' || mimeType === '.png') {
|
||||
const mime = share.mimeType?.toLowerCase();
|
||||
if (mime === '.jpg' || mime === '.png' || mime === 'image/jpeg' || mime == 'image/png' ) {
|
||||
actions.addImage(share.filePath)
|
||||
}
|
||||
if (mimeType === '.mp4') {
|
||||
if (mime === '.mp4' || mime === 'video/mp4' || mime == 'video/mpeg') {
|
||||
actions.addVideo(share.filePath)
|
||||
}
|
||||
if (mimeType === '.mp3') {
|
||||
if (mime === '.mp3') {
|
||||
actions.addAudio(share.filePath)
|
||||
}
|
||||
});
|
||||
|
@ -85,20 +85,24 @@ export function useAddTopic(contentKey) {
|
||||
updateState({ message });
|
||||
},
|
||||
addImage: (data) => {
|
||||
const url = data.startsWith('file:') ? data : 'file://' + data;
|
||||
|
||||
assetId.current++;
|
||||
Image.getSize(data, (width, height) => {
|
||||
const asset = { key: assetId.current, type: 'image', data: data, ratio: width/height };
|
||||
Image.getSize(url, (width, height) => {
|
||||
const asset = { key: assetId.current, type: 'image', data: url, ratio: width/height };
|
||||
updateState({ assets: [ ...state.assets, asset ] });
|
||||
});
|
||||
})
|
||||
},
|
||||
addVideo: (data) => {
|
||||
const url = data.startsWith('file:') ? data : 'file://' + data
|
||||
assetId.current++;
|
||||
const asset = { key: assetId.current, type: 'video', data: data, ratio: 1, duration: 0, position: 0 };
|
||||
const asset = { key: assetId.current, type: 'video', data: url, ratio: 1, duration: 0, position: 0 };
|
||||
updateState({ assets: [ ...state.assets, asset ] });
|
||||
},
|
||||
addAudio: (data, label) => {
|
||||
const url = data.startsWith('file:') ? data : 'file://' + data
|
||||
assetId.current++;
|
||||
const asset = { key: assetId.current, type: 'audio', data: data, label };
|
||||
const asset = { key: assetId.current, type: 'audio', data: url, label };
|
||||
updateState({ assets: [ ...state.assets, asset ] });
|
||||
},
|
||||
setVideoPosition: (key, position) => {
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Text, View } from 'react-native';
|
||||
import { TouchableOpacity } from 'react-native-gesture-handler';
|
||||
import { TouchableOpacity, Alert, Text, View } from 'react-native';
|
||||
import { Logo } from 'utils/Logo';
|
||||
import { styles } from './SharingItem.styled';
|
||||
import Colors from 'constants/Colors';
|
||||
|
Loading…
Reference in New Issue
Block a user