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

[local_auth] Support for macOS platform #140685

Closed
OutdatedGuy opened this issue Dec 28, 2023 · 11 comments · Fixed by flutter/packages#7274
Closed

[local_auth] Support for macOS platform #140685

OutdatedGuy opened this issue Dec 28, 2023 · 11 comments · Fixed by flutter/packages#7274
Labels
a: desktop Running on desktop p: local_auth Plugin for local authentification P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. platform-mac Building on or for macOS specifically team-macos Owned by the macOS platform team triaged-macos Triaged by the macOS platform team

Comments

@OutdatedGuy
Copy link
Contributor

Use case

The local_auth plugin currently supports only android, ios and windows platform. It would be great to have support for macOS as well.

Proposal

We can copy the implementation of local_auth_ios and make necessary and proprietary changes to support macOS platform.

@stuartmorgan stuartmorgan added platform-mac Building on or for macOS specifically p: local_auth Plugin for local authentification package flutter/packages repository. See also p: labels. a: desktop Running on desktop P3 Issues that are less important to the Flutter project team-desktop labels Dec 28, 2023
@stuartmorgan
Copy link
Contributor

stuartmorgan commented Dec 28, 2023

We can copy the implementation of local_auth_ios

We don't copy implementations, since that would require maintaining two copies forever; instead we share them. See path_provider, shared_preferences, and video_player for some examples.

The first step in adding macOS support would be renaming the existing iOS package. Normally we use the name of the shared implementing framework; unfortunately in this case that's the LocalAuthentication framework, which would make the name local_auth_localauthentication. Given that I think we'll want to fall back to the less accurate, but more useful in distinguishing the implementation packages, local_auth_darwin.

(For anyone interested in doing this, renaming needs to be done in its own PR, without any macOS additions, and then adding macOS would be a follow-up PR once the rename has landed.)

@stuartmorgan
Copy link
Contributor

Normally we use the name of the shared implementing framework; unfortunately in this case that's the LocalAuthentication framework, which would make the name local_auth_localauthentication. Given that I think we'll want to fall back to the less accurate, but more useful in distinguishing the implementation packages, local_auth_darwin.

/cc @jmagman in case you have any alternate thoughts for our latest installment of "Name That Shared iOS/macOS Code!" 🙂.

@OutdatedGuy
Copy link
Contributor Author

We can copy the implementation of local_auth_ios

We don't copy implementations, since that would require maintaining two copies forever; instead we share them. See path_provider, shared_preferences, and video_player for some examples.

The first step in adding macOS support would be renaming the existing package iOS. Normally we use the name of the shared implementing framework; unfortunately in this case that's the LocalAuthentication framework, which would make the name local_auth_localauthentication. Given that I think we'll want to fall back to the less accurate, but more useful in distinguishing the implementation packages, local_auth_darwin.

(For anyone interested in doing this, renaming needs to be done in its own PR, without any macOS additions, and then adding macOS would be a follow-up PR once the rename has landed.)

Hi, I don't quite understand what you mean. Can you elaborate more on this statement with a simple explanation.

@stuartmorgan
Copy link
Contributor

I'm not sure what elaboration you are looking for. Which part isn't clear?

@OutdatedGuy
Copy link
Contributor Author

The first step in adding macOS support would be renaming the existing iOS package. Normally we use the name of the shared implementing framework; unfortunately in this case that's the LocalAuthentication framework, which would make the name local_auth_localauthentication. Given that I think we'll want to fall back to the less accurate, but more useful in distinguishing the implementation packages, local_auth_darwin.

I didn't understand what you are telling me to do

@stuartmorgan
Copy link
Contributor

stuartmorgan commented Dec 29, 2023

I'm not telling you to do anything; what you choose to contribute is entirely up to you. I'm describing what we would accept for adding an endorsed macOS implementation of local_auth, which is a single package containing the shared iOS and macOS implementation.

The process for getting from the current state to that state is at least three separate PRs:

  1. Rename local_auth_ios to something more generic, as described above.
  2. Add macOS support to that renamed package.
  3. Switch local_auth to using the new package instead of local_auth_ios.

The relative order of 2 and 3 isn't particularly important, but 1 must be done first.

@depombo

This comment was marked as off-topic.

@alexrabin-sentracam
Copy link

Just wanted to give y'all a quick update, I am awaiting approval on my pr and hopefully it gets merged soon!

@Rimantovas

This comment was marked as off-topic.

@cbracken cbracken added team-macos Owned by the macOS platform team and removed team-desktop labels Jun 5, 2024
@flutter-triage-bot
Copy link

The triaged-desktop label is irrelevant if there is no team-desktop label or fyi-desktop label.

@jmagman jmagman added the triaged-macos Triaged by the macOS platform team label Jun 7, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this issue Aug 1, 2024
Adds macOS support for local_auth_darwin

![Screenshot 2024-03-05 at 8 30 35�AM](https://github.com/flutter/packages/assets/160153899/89bcfa78-b998-401e-869c-28b9d82a9229)

![Screenshot 2024-03-05 at 8 30 56�AM](https://github.com/flutter/packages/assets/160153899/69f0e215-1a7c-45eb-99a6-264458b0e771)

## Cancelled Example:

![Screenshot 2024-03-05 at 8 31 12�AM](https://github.com/flutter/packages/assets/160153899/1196b4e9-c010-4e96-994b-7467d1561ad1)

## Success Example

![Screenshot 2024-03-05 at 8 31 32�AM](https://github.com/flutter/packages/assets/160153899/acd0d550-3be2-46cf-957c-fbbe445abfa4)

## Error Example
<img width="912" alt="Screenshot 2024-03-05 at 4 01 58�PM" src="https://github.com/flutter/packages/assets/160153899/3a16eed5-d8b1-42a2-b6ab-ca82ade101ce">

*List which issues are fixed by this PR. You must list at least one issue.*

flutter/flutter#140685

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
auto-submit bot pushed a commit to flutter/packages that referenced this issue Aug 6, 2024
Updates the app-facing package to endorse `local_auth_darwin` as the macOS implementation, and require a version of that package with macOS support. Updates the README to indicate that macOS is supported. Adds macOS support to the example app (using `flutter create --platforms=macos .` in the example).

Fixes flutter/flutter#140685
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: desktop Running on desktop p: local_auth Plugin for local authentification P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. platform-mac Building on or for macOS specifically team-macos Owned by the macOS platform team triaged-macos Triaged by the macOS platform team
Projects
None yet
7 participants