flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

Added macOS implementation

Open riccardo-lomazzi opened this issue 2 years ago • 13 comments

:sparkles: What kind of change does this PR introduce? (Bug fix, feature, docs update...)

This PR adds the macOS implementation of the plugin.

:arrow_heading_down: What is the current behavior?

Currently it doesn't support macOS.

:new: What is the new behavior (if this is a feature change)?

Now it supports macOS permissions.

:boom: Does this PR introduce a breaking change?

No.

:bug: Recommendations for testing

A couple of entitlements won't work as there's no equivalent to be found in macOS. Some features work only from macOS 10.12, which is the minimum version that Flutter supports.

:memo: Links to relevant issues/docs

No.

:thinking: Checklist before submitting

  • [ x] I made sure all projects build.
  • [ ] I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • [ ] I updated CHANGELOG.md to add a description of the change.
  • [ x] I followed the style guide lines (code style guide).
  • [ x] I updated the relevant documentation.
  • [ ] I rebased onto current master.

riccardo-lomazzi avatar Oct 23 '22 19:10 riccardo-lomazzi

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage :thumbsup:

Coverage data is based on head (4dc8d3f) compared to base (2e47f05). Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #946   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           16        16           
=========================================
  Hits            16        16           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Oct 23 '22 19:10 codecov[bot]

Hello, Do you have some news about macOS permission handler and this PR ? Thx

kmoreau avatar Jan 05 '23 10:01 kmoreau

Is it possible to add feature to request full disk access?

rasmusbe avatar Jan 13 '23 14:01 rasmusbe

me also waiting for this pr ,, mac os permissions is a necessary for any flutter app that is looking to support macOS platform so I think it should be a priority .

egyleader avatar Mar 24 '23 11:03 egyleader

Would also appreciate this a lot.

bvoq avatar Apr 03 '23 14:04 bvoq

Until this is merged, you can use:

  permission_handler:
    git:
      url: https://github.com/bvoq/flutter-permission-handler.git
      path: permission_handler
      ref: master

bvoq avatar Apr 04 '23 11:04 bvoq

I also vote for this feature!

LinHaoLove avatar May 23 '23 08:05 LinHaoLove

Hi @riccardo-lomazzi,

First of all, apologies for the very late reply. Due to shifting priorities and under staffing we unfortunately had to postpone our work on the open source plugins. Luckily we have resolved the staffing issue and made the open source plugins a high priority.

I really appreciate the effort put into this PR and I am hoping you would be able to make some changes so the macOS support for the permission_handler is inline with support for other plugins we host (e.g. https://github.com/baseflow/flutter-geolocator). The two major request would be to:

  1. Create the macOS project as an Objective-C project instead of using the Swift language. We are aware Swift is a more developer friendly language, however by adding Swift to the project now adds another language to the project that developers need to understand and maintain. Since the iOS version is fully coded in Objective-C we'd prefer the macOS support to also be written in Objective-C.
  2. Currently most of the code is duplicated between the iOS and the macOS project. For the geolocator project we use sym-links in the macOS project reusing the source code files from the iOS project in the macOS project. This way we only have to maintain the code in one place. Use preprocessor directives to add iOS or macOS specific code blocks:
#if TARGET_OS_OSX
#import <FlutterMacOS/FlutterMacOS.h>
#else
#import <Flutter/Flutter.h>
#endif

Please let me know if you are up for bringing this PR to a point we can merge it into the main repository. If not we would be happy to take over the PR and apply the necessary changes.

Hello @mvanbeusekom

the work I did here was barebones since I was required to implement these permissions in a company's project.

The reason I chose Swift was because

  1. I lack experience in Obj-C
  2. macOS Flutter plugins require Swift as the main language

I naively thought that I could help other people by sharing this PR, but I'm realising that most of the changes I did were a bit rough.

Right now I lack the time and the experience to do the work requested, so if you could please take in charge the PR it would be great.

Thank you.

riccardo-lomazzi avatar Jun 09 '23 06:06 riccardo-lomazzi

This PR seems to aim to close #337.

JeroenWeener avatar Jul 03 '23 11:07 JeroenWeener

Please, push this feature. 🙏🏼

efraespada avatar Aug 08 '23 16:08 efraespada

@bvoq are you able to update your README? i tried to add it in my pubspec.yaml but it seems it's not properly installed coz it's not found when i imported it.

hpelitebook745G2 avatar Sep 10 '23 13:09 hpelitebook745G2

@hpelitebook745G2 It works fine if you import it directly via Github using the method I described above. You won't be able to download the plugin and use it offline without making some small changes. If you want to host it yourself, you will have to change all the pubspec.yaml references, see: https://github.com/riccardo-lomazzi/flutter-permission-handler/compare/master...bvoq:flutter-permission-handler:master.

bvoq avatar Oct 09 '23 12:10 bvoq

Any updates?

h1376h avatar Jul 30 '24 20:07 h1376h