OutdatedGuy / receive_sharing_intent_plus

Unlock seamless content sharing in your Flutter apps with text, photos, and URLs - one plugin away.
https://pub.dev/packages/receive_sharing_intent_plus
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Sharing Text Files (.txt) Doesn't Work #6

Open ImranR98 opened 11 months ago

ImranR98 commented 11 months ago

Seems like the plugin tries to interpret .txt files as normal shared text, so the content is null.

You can reproduce this using the share menu in the Markor app. Try creating a test file then using Share -> File.

OutdatedGuy commented 10 months ago

Yo @ImranR98, thanks for brining issue to my attention. I tested it on both Android and iOS and it seems only text file are not being shared due to some bug.

Will fix it after I get some free time.

OutdatedGuy commented 9 months ago

@ImranR98, hi can you try adding below code in the AndroidManifest.xml file and see if it works on Android?

<queries>
    <intent>
        <action android:name="android.intent.action.PROCESS_TEXT"/>
        <data android:mimeType="text/plain"/>
    </intent>
</queries>

I cannot seem to get any solution for iOS yet.

pingdong commented 7 months ago

Sharing .csv file as file, from Files App, doesn't work on iOS as well, works on Android.

ultormagister commented 7 months ago

@pingdong from ShareViewController.swift inside handleFiles method change newPath with:

let newPath = FileManager.default .containerURL(forSecurityApplicationGroupIdentifier: this.appGroupId)! .appendingPathComponent(" \ (fileName) " ) //space added to avoid github format

this should append the file correctly and it should work. In my case solved problem with json files

pingdong commented 7 months ago

@ultormagister thanks for help, unfortunately, it doesn't work.

Here is the log

2024-04-08 21:50:30.590267+1200 File Uploader[7189:919692] [core] SLComposeServiceViewController got NSURL file:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/Downloads/test%202.txt for public.file-url error: (null) 2024-04-08 21:50:30.646189+1200 File Uploader[7189:919491] [core] SLComposeServiceViewController got attachment coarseType 0 2024-04-08 21:50:30.646325+1200 File Uploader[7189:919491] [core] SLComposeServiceViewController made no attachment for itemProvider conforming to public.file-url 2024-04-08 21:50:30.881340+1200 File Uploader[7189:919491] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles 2024-04-08 21:50:30.883238+1200 File Uploader[7189:919491] [MC] Reading from public effective user settings. 2024-04-08 21:50:31.672428+1200 File Uploader[7189:919491] [Common] _BSMachError: port 7903; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND" [ERROR] Error loading data! 2024-04-08 21:50:31.837708+1200 File Uploader[7189:919697] [Assert] Cannot be called with asCopy = NO on non-main thread. 2024-04-08 21:50:31.838322+1200 File Uploader[7189:919697] [Assert] Cannot be called with asCopy = NO on non-main thread. 2024-04-08 21:50:31.838525+1200 File Uploader[7189:919697] [Assert] Cannot be called with asCopy = NO on non-main thread. 2024-04-08 21:50:31.838984+1200 File Uploader[7189:919697] [Assert] Cannot be called with asCopy = NO on non-main thread. 2024-04-08 21:50:31.958461+1200 File Uploader[7189:919697] [Assert] Cannot be called with asCopy = NO on non-main thread. 2024-04-08 21:50:31.958660+1200 File Uploader[7189:919697] [Assert] Cannot be called with asCopy = NO on non-main thread. 2024-04-08 21:50:31.994617+1200 File Uploader[7189:919697] [Assert] Cannot be called with asCopy = NO on non-main thread. 2024-04-08 21:50:31.994787+1200 File Uploader[7189:919697] [Assert] Cannot be called with asCopy = NO on non-main thread. 2024-04-08 21:50:32.010750+1200 File Uploader[7189:919697] [Assert] Cannot be called with asCopy = NO on non-main thread. 2024-04-08 21:50:32.010942+1200 File Uploader[7189:919697] [Assert] Cannot be called with asCopy = NO on non-main thread. 2024-04-08 21:50:32.022697+1200 File Uploader[7189:919697] [Animation] +[UIView setAnimationsEnabled:] being called from a background thread. Performing any operation from a background thread on UIView or a subclass is not supported and may result in unexpected and insidious behavior. trace=( 0 UIKitCore 0x00000001c86e17f0 + 116 1 libdispatch.dylib 0x000000019b2bd7d4 + 16 2 libdispatch.dylib 0x000000019b260eb8 + 28 3 UIKitCore 0x00000001c86e1778 + 100 4 UIKitCore 0x00000001c86e18e4 + 92 5 UIKitCore 0x00000001c80f3db8 + 408 6 UIKitCore 0x00000001c80defb0 + 88 7 UIKitCore 0x00000001c80e349c + 168 8 UIKitCore 0x00000001c7cbe114 + 1232 9 UIKitCore 0x00000001c7cbfccc + 4300 10 UIKitCore 0x00000001c7cc23a8 + 104 11 UIKitCore 0x00000001c7cc28a4 + 508 12 UIKitCore 0x00000001c7cc2300 + 176 13 UIKitCore 0x00000001c7cc2560 + 160 14 File Uploader 0x0000000100f7a2e4 $s13File_Uploader19ShareViewControllerC16dismissWithError33_C3E789C08EE88B77150BB6DED3E748A9LLyyF + 540 15 File Uploader 0x0000000100f7698c $s13File_Uploader19ShareViewControllerC10handleText33_C3E789C08EE88B77150BB6DED3E748A9LL7content10attachment5indexySo15NSExtensionItemC_So14NSItemProviderCSitFySo14NSSecureCoding_pSg_s5ErrorpSgtYbcfU + 1496 16 File Uploader 0x0000000100f76a84 $sSo14NSSecureCoding_pSgs5Error_pSgIeghgg_ABSo7NSErrorCSgIeyBhyy_TR + 140 17 Foundation 0x000000019c3135d0 + 140 18 libdispatch.dylib 0x000000019b2bca38 + 24 19 libdispatch.dylib 0x000000019b2bd7d4 + 16 20 libdispatch.dylib 0x000000019b266324 + 592 21 libdispatch.dylib 0x000000019b266e40 + 428 22 libdispatch.dylib 0x000000019b26f4ac + 596 23 libsystem_pthread.dylib 0x000000019b49e114 _pthread_wqthread + 304 24 libsystem_pthread.dylib 0x000000019b4a0cd4 start_wqthread + 4 ) 2024-04-08 21:50:32.059129+1200 File Uploader[7189:919697] Assertion failure in -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore/UIKit-3698.140/Keyboard/UIKeyboardTaskQueue.m:453 2024-04-08 21:50:32.147830+1200 File Uploader[7189:919697] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] may only be called from the main thread.' *** First throw call stack: (0x19b87f180 0x19aa579f8 0x19b79888c 0x19c25cb38 0x1c80d0898 0x1c808c11c 0x1c80db518 0x1c80e362c 0x1c7cbe114 0x1c7cbfccc 0x1c7cc23a8 0x1c7cc28a4 0x1c7cc2300 0x1c7cc2560 0x100f7a2e4 0x100f7698c 0x100f76a84 0x19c3135d0 0x19b2bca38 0x19b2bd7d4 0x19b266324 0x19b266e40 0x19b26f4ac 0x19b49e114 0x19b4a0cd4) libc++abi.dylib: terminating with uncaught exception of type NSException