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

feat(mobile): allow contact picking for names in mobile app #15817

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

samolego
Copy link

@samolego samolego commented Jan 31, 2025

Hi there!

I love immich but thought it could use a minor improvement when naming your persons. If you do it via mobile app, we have access to user's contact list, so we can use it to suggest people names.

I've implemented that, you can see how it looks in the attached screenshots:

Here's a (very blurred) video as well, I had little time to edit but I hope you get the point:

immich.mp4

Edit: better video with some fake contacts:

screen-20250205-110824.mp4

I'm opening this as a draft as design (especially of dropdown) can be improved and I'd like to get a feedback on what you think

@samolego samolego marked this pull request as draft January 31, 2025 22:03
@samolego samolego changed the title Allow contact picking for the People in mobile app feat(mobile) Allow contact picking for the People in mobile app Jan 31, 2025
@alextran1502
Copy link
Contributor

Hello, this is very cool!

@bo0tzz bo0tzz changed the title feat(mobile) Allow contact picking for the People in mobile app feat(mobile): allow contact picking for names in mobile app Feb 1, 2025
@samolego samolego marked this pull request as ready for review February 2, 2025 09:50
@samolego
Copy link
Author

samolego commented Feb 2, 2025

I've since done some other designs but was actually the most satisfied with this one. I'm marking this as open for review.

@phipz
Copy link

phipz commented Feb 4, 2025

I understand this only checks the Android phone local contacts.

What about:

  1. Checking first if the name already exists on the server and merge the faces, like on the WebUI?
  2. What about the iOS app?

@samolego
Copy link
Author

samolego commented Feb 4, 2025

This uses https://pub.dev/packages/fast_contacts so it should work on iOS too. I don't have an iPhone, so I couldn't test it. Maybe someone else can?

Merging faces is possible but imho that should be a separate PR?

@NicholasFlamy
Copy link
Member

If you deny Contacts permission (people might not want to have immich accessing contacts), it fails to achieve contacts permissions and puts away the keyboard every time, so I have to tap the text box:

Screen_Recording_20250204_190716.mp4

Regular app:

Debug build of your branch (the box is wider, just something to notice):

Also, with Contacts allowed, it works great (tested on Android), shows the contact names as you type and when you tap on one it fills the name in immich for you. Maybe someone can add a feature to set the contact photo right then and there (similar to Samsung Gallery (and maybe GPhotos)).

@samolego
Copy link
Author

samolego commented Feb 5, 2025

Thanks for spotting! I fixed the keyboard issue, also set the dialog width to MediaQuery.of(context).size.width * 0.6, which looks similar to before.

After first time (after asking for the permission) keyboard can still be hidden, though it works fine after that. I couldn't get it to show right after clicking on the permission dialog though.

@NicholasFlamy
Copy link
Member

NicholasFlamy commented Feb 5, 2025

After first time (after asking for the permission) keyboard can still be hidden, though it works fine after that. I couldn't get it to show right after clicking on the permission dialog though.

To be clear, it works fine for me if I allowed the Contacts permission. The video is after I denied Contacts permission and Android doesn't allow the app to ask again (cause I denied at least twice in a row).

Edit: I will test this again when I get home.

@samolego
Copy link
Author

samolego commented Feb 5, 2025

To be clear, it works fine for me if I allowed the Contacts permission. The video is after I denied Contacts permission and Android doesn't allow the app to ask again

Yeah, got that - it should be fixed with the above commits :).

@NicholasFlamy
Copy link
Member

NicholasFlamy commented Feb 6, 2025

To be clear, it works fine for me if I allowed the Contacts permission. The video is after I denied Contacts permission and Android doesn't allow the app to ask again

Yeah, got that - it should be fixed with the above commits :).

It behaves correctly now. There is a very slight stutter while it opens so I need to build a release apk and test that to confirm if it's this PR or if it's just the debug build being JIT or wtv.

NicholasFlamy

This comment was marked as outdated.

@NicholasFlamy NicholasFlamy self-requested a review February 6, 2025 05:18
NicholasFlamy

This comment was marked as outdated.

@NicholasFlamy
Copy link
Member

Good job! It works great! No issues with the permission allowed or denied.

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

Successfully merging this pull request may close these issues.

5 participants