Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

[WIP] Permission plugin #83

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

[WIP] Permission plugin #83

wants to merge 5 commits into from

Conversation

Cheesebaron
Copy link
Member

  • Create wrapper around @jamesmontemagno's Permission plugin
  • Update nuspecs with dependency on this new plugin
  • Use plugin in relevant plugins

{
public class MvxPermissions : IMvxPermissions
{
public Task<bool> ShouldShowRequestPermissionRationaleAsync(Permission permission)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be async await?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to create an unnecessary context sync / wrap I believe, just pass the Task to the caller.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is nothing wrong with this. No need to await it here, you can just pass the task along.

@martijn00
Copy link
Contributor

Is there a list available of which plugins need this?

@Cheesebaron
Copy link
Member Author

  • Location (GPS)
  • PictureChooser (External Storage)
  • File (External Storage)
  • Accelerometer (Sensor)

As far as I gather these need it.

@danieleardissone
Copy link

Hello,
is this Permission Plugin still work in progress?
I need to manage run time permissions for Android 6 Marshmallow in some plugins like File or PictureChooser.
Thanks.

@jamesmontemagno
Copy link

Any reason why to have a wrapper around it and not just use mine? @danieleardissone check: https://github.com/jamesmontemagno/PermissionsPlugin

@Cheesebaron
Copy link
Member Author

The wrapper is just to register yours with the IoC and official MvvmCross classes usually contain Mvx smurf naming.

@jamesmontemagno
Copy link

ah gotcha gotcha 👍 thanks @Cheesebaron

@jamesmontemagno
Copy link

@Cheesebaron Right now I do have a dependency on CurrentActivity... wondering if we can re-work that at all perhaps so it is easier to integrate with MvxPlugin Wrappers?

@danieleardissone
Copy link

danieleardissone commented Jul 18, 2016

@jamesmontemagno is your plugin working properly with Storage Permissions?
I wrapped the plugin to use it with MVVMCross like @Cheesebaron said and that's ok.
Now when I manually confirm the permissions, nothing happens.
It seems like no permissions are setted 'cause when I try to access to the sdcard I get an exception.
Any suggestions?
Thanks a lot!

@Cheesebaron
Copy link
Member Author

Do you have the permission in your manifest as well?

@danieleardissone
Copy link

@Cheesebaron yes of course, in my manifest I have READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions.
I created the wrapper project (PCL), I referenced it in my main PCL project, I created the bootstrap for the MVVMCross plugin, I registered it with the IoC in the Android project and I tried to use it in Services and ViewModels classes where I need interactions with files stored on the sdcard (I'm using MVVMCross FileStore plugin).
Now when I manually confirm runtime storage permissions, OnRequestPermissionsResult in my BaseActivity receives correct permissions but nothing happens after that, I always get the same exception: "UnauthorizedAccessException (access to the path is denied)".
If I try to restart the app, the system doesn't call me to confirm permissions anymore because they are already granted, so seem that they were setted in the right way.
I don't know exactly if this is the correct approach but I can't resolve this issue.
Any idea about what I am doing wrong?
Thanks a lot!

@dgandhi17
Copy link

dgandhi17 commented Jul 20, 2016

@Cheesebaron isn't It would be good if we can create a sample app for implementing permissions in application ?

@Cheesebaron
Copy link
Member Author

Well, as the title says this is Work In Progress (WIP). I haven't had time to look into it further. If you want to hurry the process you are very welcome to do so.

@danieleardissone
Copy link

For your information I solved it.
Xamarin Permissions Plugin and my wrapper work properly, I made a mistake during the interaction with the storage.
Thanks for the support.

@jamesmontemagno
Copy link

Is there a specific reason why you couldn't just use my plugin? Why is there a need for a wrapper around it? Seems like it may get out of date if I am updating it.

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

Successfully merging this pull request may close these issues.

None yet

6 participants