mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 00:50:03 +00:00
fixing android share sheet
This commit is contained in:
parent
7a4cf10614
commit
992be9a737
@ -108,7 +108,7 @@ function App(): React.JSX.Element {
|
||||
ReceiveSharingIntent.getReceivedFiles(files => {
|
||||
if (files && files.length) {
|
||||
const { filePath, mimeType } = files[0];
|
||||
setShare({ filePath, mimeType });
|
||||
setShare({ filePath: filePath.startsWith('file') ? filePath : `file://${filePath}`, mimeType });
|
||||
}
|
||||
},
|
||||
(error) =>{
|
||||
|
@ -8,6 +8,8 @@ import com.facebook.react.defaults.DefaultReactActivityDelegate
|
||||
import android.os.Bundle;
|
||||
import org.devio.rn.splashscreen.SplashScreen;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
class MainActivity : ReactActivity() {
|
||||
|
||||
/**
|
||||
@ -16,6 +18,11 @@ class MainActivity : ReactActivity() {
|
||||
*/
|
||||
override fun getMainComponentName(): String = "Databag"
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
SplashScreen.show(this)
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -103,14 +103,13 @@ export function useConversation() {
|
||||
if (sharing && focus && state.loaded) {
|
||||
const focused = focus.getFocused();
|
||||
if (focused.cardId == sharing.cardId && focused.channelId == sharing.channelId) {
|
||||
console.log("APPLY SHARING OF: ", sharing);
|
||||
const { mimeType, filePath } = sharing;
|
||||
const ext = mimeType.toLowerCase();
|
||||
if (ext == '.jpg' || ext == '.png' || ext == '.webp' || ext == '.bmp') {
|
||||
if (ext == '.jpg' || ext == 'image/jpeg' || ext == '.png' || ext == 'image/png' || ext == '.webp' || ext == 'image/webp' || ext == '.bmp' || ext == 'image/bmp') {
|
||||
actions.addImage(filePath, mimeType, IMAGE_SCALE_SIZE);
|
||||
} else if (ext == '.mp4' || ext == '.mov') {
|
||||
} else if (ext == '.mp4' || ext == 'videp/mp4' || ext == '.mov' || ext == 'video/mov') {
|
||||
actions.addVideo(filePath, mimeType);
|
||||
} else if (ext == '.mp3' || ext == '.aac') {
|
||||
} else if (ext == '.mp3' || ext == 'audio/mp3' || ext == '.aac' || 'audio/aac') {
|
||||
actions.addAudio(filePath, mimeType);
|
||||
} else {
|
||||
actions.addBinary(filePath, filePath.split('/').pop());
|
||||
@ -344,7 +343,6 @@ export function useConversation() {
|
||||
}
|
||||
},
|
||||
addImage: (path: string, mime: string, size: number) => {
|
||||
console.log("ADD IMAGE");
|
||||
const type = 'image';
|
||||
updateState({ assets: [ ...state.assets, { type, path, mime, size } ]});
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user