Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capacitor 4.0 support #39

Merged
merged 1 commit into from
Sep 18, 2022

Conversation

AshleyMedway
Copy link
Contributor

@AshleyMedway AshleyMedway commented Aug 2, 2022

I think #38 is missing the podspec and gradle changes

Additional if you want to install this early in your project you can run npm i ProteanSoftware/capacitor-filesharer#master

@tho-masn
Copy link

tho-masn commented Aug 10, 2022

@AshleyMedway: Did you have any troubles with this Branch, Capacitor 4 and Android so far?
I keep getting the following error.
Not sure if it's because of the Capacitor 4 upgrade though.

E/DatabaseUtils: Writing exception to parcel
    java.lang.SecurityException: Permission Denial: reading com.byteowls.capacitor.filesharer.FileSharerProvider uri content://com..... from pid=27862, uid=1000 requires the provider be exported, or grantUriPermission()
        at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:912)
        at android.content.ContentProvider.semEnforceReadPermission(ContentProvider.java:830)
        at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:708)
        at android.content.ContentProvider$Transport.query(ContentProvider.java:247)
        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:107)
        at android.os.Binder.execTransactInternal(Binder.java:1215)
        at android.os.Binder.execTransact(Binder.java:1179)

@moberwasserlechner
Copy link
Owner

If you are confident that this works I'm happy to merge and release a new version asap, but I do not have the time to test it myself. BR

@AshleyMedway
Copy link
Contributor Author

Let me do some further testing today. I've got to do a regression of our app in Capacitor 4 today. Will report back :)

@tho-masn
Copy link

I've tested the branch with a few devices (iOS and Android) and everything looks good so far. The error I mentioned above is still happening on Android as soon as a file gets shared, but it doesn't seem to have any negative consequences.

@hermitdemschoenenleben
Copy link

in addition to the error mentioned above, my android app also crashes after sharing with the following exception:

     Caused by: java.lang.IllegalArgumentException: method com.byteowls.capacitor.filesharer.FileSharerPlugin.callbackComplete argument 2 has type android.app.Instrumentation$ActivityResult, got androidx.activity.result.ActivityResult
        at java.lang.reflect.Method.invoke(Native Method)
        at com.getcapacitor.Plugin.triggerActivityCallback(Plugin.java:155)
        at com.getcapacitor.Plugin.lambda$initializeActivityLaunchers$0$com-getcapacitor-Plugin(Plugin.java:117)
        at com.getcapacitor.Plugin$$ExternalSyntheticLambda0.onActivityResult(Unknown Source:6)
        at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:409)
        at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:366)
        at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:712)
        at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:140)
        at com.getcapacitor.BridgeActivity.onActivityResult(BridgeActivity.java:173)
        at android.app.Activity.dispatchActivityResult(Activity.java:8613)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:5340)

Does anybody know how to fix this? A naive fix by changing the type of result in callbackComplete to androidx.activity.result.ActivityResult didn't work, because I can't import this.

@tho-masn
Copy link

@hermitdemschoenenleben Did you install the PR with npm i ProteanSoftware/capacitor-filesharer#master as mentioned in the first post? The description is a bit misleading and actually doesn't work. You need to install the #v4 branch in order to get the latest version, which fixes the ActivityResult.

@hermitdemschoenenleben
Copy link

@tho-masn you're right, I was indeed misled by the description and checked out the wrong branch, sorry for that! With the v4 branch, it works fine. Thank you very much for your work and quick response!

@moberwasserlechner moberwasserlechner added this to the 4.0.0 milestone Sep 18, 2022
@moberwasserlechner moberwasserlechner merged commit c16db1e into moberwasserlechner:main Sep 18, 2022
@moberwasserlechner
Copy link
Owner

I'm in the middle of releasing. Which version did you try. 4.0.0 is not released yet.

@moberwasserlechner
Copy link
Owner

@sander-spruit One more thing: I have no connection to ProteanSoftware. I have planned to do the release this weekend so your rather disrespectful behavior is for sure not the reason I'm releasing. Such comments are not motivating me to spend my spare time in providing open source software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants