stefan-niedermann / nextcloud-deck

šŸ“‹ Android client for nextcloud deck app
https://play.google.com/store/apps/details?id=it.niedermann.nextcloud.deck.play
GNU General Public License v3.0
491 stars 53 forks source link

Receive shares with `file://` URIs #1175

Open reox opened 2 years ago

reox commented 2 years ago

Please use GitHub reactions šŸ‘ to show that you are affected by the same issue. Please don't comment if you have no relevant information to add!

Describe the bug

Steps to reproduce the behavior:

  1. Draw some image in Autodesk Sketchbook (I use the version from GP 5.2.5
  2. Share the image, choose "Other", then Deck -> Add to existing card
  3. Crash

Expected behavior

I think this worked already, hasn't it? As far as I can remember, I sucessfully uploaded sketches from Skechbook before (or maybe it was only from the Lecturenotes or Screenshot app - which still both works perfectly fine) This is similar to #516 but a different app.

It should take the image and attach it, without the requirement to save it to disk beforehand.

Screenshots

Versions

Smartphone (please complete the following information):

Stacktrace

App Version: 1.19.4
App Version Code: 1019004
App Flavor: play

Files App Version Code: 30180090

---

OS Version: 4.4.205-21567889(T830XXU5CUE2)
OS API Level: 29
Device: gts4lwifi
Manufacturer: samsung
Model (and Product): SM-T830 (gts4lwifixx)

---

it.niedermann.nextcloud.deck.exceptions.UploadAttachmentFailedException: 1 attachments failed to upload:App Version: 1.19.4
App Version Code: 1019004
App Flavor: play

Files App Version Code: 30180090

---

OS Version: 4.4.205-21567889(T830XXU5CUE2)
OS API Level: 29
Device: gts4lwifi
Manufacturer: samsung
Model (and Product): SM-T830 (gts4lwifixx)

---

it.niedermann.nextcloud.deck.exceptions.UploadAttachmentFailedException: Unhandled URI scheme: file
    at it.niedermann.nextcloud.deck.ui.sharetarget.ShareTargetActivity.appendFilesAndFinish(ShareTargetActivity.java:115)
    at it.niedermann.nextcloud.deck.ui.sharetarget.ShareTargetActivity.onCardSelected(ShareTargetActivity.java:92)
    at it.niedermann.nextcloud.deck.ui.card.CardAdapter.lambda$onBindViewHolder$0$CardAdapter(CardAdapter.java:134)
    at it.niedermann.nextcloud.deck.ui.card.CardAdapter$$ExternalSyntheticLambda0.onClick(Unknown Source:4)
    at android.view.View.performClick(View.java:7869)
    at android.view.View.performClickInternal(View.java:7838)
    at android.view.View.access$3600(View.java:886)
    at android.view.View$PerformClick.run(View.java:29362)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:237)
    at android.app.ActivityThread.main(ActivityThread.java:8107)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

    at it.niedermann.nextcloud.deck.ui.sharetarget.ShareProgressDialogFragment.lambda$onActivityCreated$2$ShareProgressDialogFragment(ShareProgressDialogFragment.java:76)
    at it.niedermann.nextcloud.deck.ui.sharetarget.ShareProgressDialogFragment$$ExternalSyntheticLambda0.onClick(Unknown Source:6)
    at android.view.View.performClick(View.java:7869)
    at android.widget.TextView.performClick(TextView.java:14958)
    at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
    at android.view.View.performClickInternal(View.java:7838)
    at android.view.View.access$3600(View.java:886)
    at android.view.View$PerformClick.run(View.java:29362)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:237)
    at android.app.ActivityThread.main(ActivityThread.java:8107)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
stefan-niedermann commented 2 years ago

Well that's quite strange... I'll have a look into it as soon as i find some time. Does this happen also when you share from other apps (not sketchbook) into the Deck app?

reox commented 2 years ago

No, as said Lecturenotes and Screenshot Assistant have similar functionality, i.e., sharing the current image (selection) without saving it to sdcard. And they work just fine since #516 was solved.

Edit: I installed intent intercept and this is the output:

intent:#Intent;action=android.intent.action.SEND;type=image/png;launchFlags=0x1b080000;end 
------------ 
ACTION: android.intent.action.SEND 
MIME: image/png 
URI: intent:#Intent;action=android.intent.action.SEND;type=image/png;launchFlags=0x1b080000;end 
FLAGS: 
FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT 
FLAG_RECEIVER_FOREGROUND 
FLAG_ACTIVITY_FORWARD_RESULT 
FLAG_ACTIVITY_PREVIOUS_IS_TOP 
FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET 
EXTRAS: 
1 Typ: android.net.Uri$StringUri 
Key: android.intent.extra.STREAM 
Wert: file:///storage/emulated/0/Autodesk/SketchBook3/export/sketch1638525821843.png 

In contrary, the other two apps sends a content://[...]/[...].png URI

stefan-niedermann commented 2 years ago

Awesome, thanks! Indeed, we explicitly currently only support Uri-Schemes, but no File-Schemes. Adding support for File-Scheme should be quite easy to add analogue to the Uri Scheme part. Maybe you want to try a Pull Request? :slightly_smiling_face: :rocket:

reox commented 2 years ago

Maybe you want to try a Pull Request? šŸ™‚ šŸš€

I would love to but my Java is quite rusty and you probably don't want copy paste stackoverflow code šŸ˜„

stefan-niedermann commented 2 years ago

No problem, i'll implement it, just might need some time šŸ™‚