Skip to content

FaceID TouchID and friends#316

Open
tht7 wants to merge 29 commits intomlemgroup:masterfrom
tht7:faceId
Open

FaceID TouchID and friends#316
tht7 wants to merge 29 commits intomlemgroup:masterfrom
tht7:faceId

Conversation

@tht7
Copy link
Contributor

@tht7 tht7 commented Jun 26, 2023

Checklist

  • I have described what this PR contains

Choose one of the following two options:

    • This PR does not introduce major changes
    • This PR introduces major changes, and I have consulted the Mlem Development Matrix room

Choose one of the following two options:

    • This PR does not change the UI in any way
    • This PR adds new UI elements / changes the UI, and I have attached pictures or videos of the new / changed UI elements

Pull Request Information

Wop wop made a new place to place all changing account preferences that's way more reactive with SwfitUI
added a new option to lock an account with FaceID

Screenshots and Videos

RPReplay_Final1687620258.mov

Additional Context

Maybe mlemgroup/mlem#118

tht7 and others added 15 commits June 23, 2023 16:02
…ented

- doing that allowed us to push/pop anything we want to the navigation stack
- added new link handling, now if a link looks even remotely "sus" I will ask Lemmy's servers if they know it, if they do know it: We push the appropriate object to the navigation stack
 if they don't know about it and it's an HTTP link, kept the old behavior
 otherwise I let the system try to open it (which is way nicer than telling the user "it's not supported" especially for mailto: links XD
…in there SwiftUI should pick up on it better (that solved a bug where the upvote/downvotes weren't updating correctly sometimes

- updated every place that expects APIPostView.id == APIPostView.post.id to reference the correct id (usually .post.id)
- Since ExpandedPost is not more independent made the postView within it it's state
…n-app

# Conflicts:
#	Mlem.xcodeproj/project.pbxproj
…n-app

# Conflicts:
#	Mlem/Views/Tabs/Posts/Components/Post/Components/Community View/Community Search/Community Search View.swift
- saved a new security on it
- included touchID / FaceID
Had to commit some more crims to keep the SwiftUI state all synced up nicely
Made sure to noty double up on the NavigationStack in the user page since it really crashs everything for some reason
# Conflicts:
#	Mlem.xcodeproj/project.pbxproj
#	Mlem/Extensions/View - Handle Lemmy Links.swift
#	Mlem/Views/Tabs/Posts/Components/Post/Components/Instance and Community List/Accounts Page.swift
@tht7 tht7 requested a review from JakeShirley June 26, 2023 07:08
Copy link
Collaborator

@ShadowJonathan ShadowJonathan left a comment

Choose a reason for hiding this comment

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

The blur is clear enough that someone can still somewhat make out the things behind it, maybe make it even more blurred?

Otherwise, looks good, other than another code pass

@tht7
Copy link
Contributor Author

tht7 commented Jun 26, 2023

I found your comment kinda funny buttt I loved it so, there you go it’s the same screen (of the Mlem community) but now with iOS’s thiccMaterial image

ShadowJonathan
ShadowJonathan previously approved these changes Jun 26, 2023
Copy link
Collaborator

@ShadowJonathan ShadowJonathan left a comment

Choose a reason for hiding this comment

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

Thanks, no further nits, i'll leave @JakeShirley to review this further :)

@mormaer
Copy link
Collaborator

mormaer commented Jun 26, 2023

should a blocking screen like this not be presented as a .fullScreenCover?

in the video we're only covering the central content, the navigation and tab bars remain visible which show potentially sensitive information like the users name and community names etc?

Is interaction blocked on those visible elements?

@mormaer
Copy link
Collaborator

mormaer commented Jun 26, 2023

Another small thought, generally biometric locks like this on iOS will attempt authentication automatically when you open, as opposed to requiring the user to interact by tapping?

@tht7
Copy link
Contributor Author

tht7 commented Jun 26, 2023

I was still working on this, but in order to achieve this, we need to introduce some artificial delay since swiftUI doesn’t like it for some reason (and also a lot of times FaceID is so fast you don’t even notice the locking screen is there which is confusing and jarring especially if the faceID sensor is still warm from unlocking your phone)

@JakeShirley
Copy link
Member

Visually could we align this with the darkened blur + white text?

JakeShirley
JakeShirley previously approved these changes Jun 26, 2023
Copy link
Member

@JakeShirley JakeShirley left a comment

Choose a reason for hiding this comment

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

Minor nit but "Account Settings" makes it sound like it will only apply to a single account but these seem to apply cross-account.

}
} catch {}
// if all went well we shouldn't get here
// await MainActor.run {
Copy link
Member

Choose a reason for hiding this comment

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

Looks like some left over debug code

Copy link
Member

@EricBAndrews EricBAndrews left a comment

Choose a reason for hiding this comment

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

One nit, everything else looks good

Comment on lines +21 to +22
if let account = account {
if accountsTracker.accountPreferences[account.id]?.requiresSecurity == true {
Copy link
Member

Choose a reason for hiding this comment

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

else condition is idempotent, condense these into a single check

@EricBAndrews
Copy link
Member

Visually could we align this with the darkened blur + white text?

Agreed, that's a good idea

tht7 and others added 3 commits June 27, 2023 15:28
…pp, it takes a url and uses our cache to load it, and blurs it according to the users wishes if you marked it as NSFW

introduced a new CachedImageProvider that can give you the uniform cached image view that's loaded from a URL and respects the nsfw setting

Had to break the Markdown view since it wasn't flexible enough, so now the MarkdownView handles images before passing on the torch of actual markdown to the library's Markdown View
…faceId

# Conflicts:
#	Mlem.xcodeproj/project.pbxproj
Itay sharzer and others added 6 commits June 27, 2023 17:25
…mage-handling

# Conflicts:
#	Mlem/Views/Shared/Markdown View.swift
#	Mlem/Views/Shared/Website Icon Complex.swift
#	Mlem/Views/Tabs/Posts/Components/Comment/Components/Comment Item Old.swift
#	Mlem/Views/Tabs/Posts/Components/Comment/Components/Comment Item.swift
#	Mlem/Views/Tabs/Posts/Components/Post/Components/Community View/Post Item/Post Types/Large Post.swift
…faceId

# Conflicts:
#	Mlem/App Constants.swift
#	Mlem/Logic/File Management/Decode Data from File.swift
#	Mlem/MlemApp.swift
#	Mlem/Views/Tabs/Posts/Components/Post/Components/Community List View/Community List View.swift
#	Mlem/Views/Tabs/Settings/Components/Views/General.swift
- made faceID try automaticlly once the device *wakes up from sleep* or when the app returns from the background

- also merged the better-ish-image-handling... don't
@tht7 tht7 dismissed stale reviews from JakeShirley and ShadowJonathan via c2adc8e June 27, 2023 19:14
@tht7
Copy link
Contributor Author

tht7 commented Jun 28, 2023

Whoa guys I didn’t notice all those Nits so let me address them all

  1. This is not displayed using a full cover, I wanted the user to be able to go back, especially to the accounts, or the Settings menu if he’s ever in trouble, but be sure that the content itself has interactions disabled

1.2
Once Face ID has been enabled for a certain account, you need to scan Face ID in order to remove it so you can’t remove it without consequence

1.3
As an escape mechanism, if you delete an account and relogin, Face ID goes away, I didn’t want to create a death trap and if they know the password, they are pretty much the owner of the account XD

  1. I’ve made a change to the biometrics such that when the app becomes foreground or the device wakes up from sleep the biometrics will be attempted automatically, but I left in the tapping action just in case something goes wrong.

3 and 5.
You guys need to make up your mind I got told that the shield is too transparent, making the content underneath semi-visual and so I made it specifically iOS’s thiccMaterial
So do you want it less opaque?

  1. It says account settings because it is genuinely account specific settings.

The Face ID protects per account
So, if you go back to the account list and choose a different account, Face ID won’t protect it if it’s not specifically ticked off
(my use case here was the obvious regular and alt accounts
where the regular is a meme stream you can share with friends and the alt account needs to be protected,
so it would be less annoying if you could leave the biometrics off for the main account, but enable them on the secondary account)

@mormaer
Copy link
Collaborator

mormaer commented Jun 28, 2023

This is not displayed using a full cover, I wanted the user to be able to go back, especially to the accounts, or the Settings menu if he’s ever in trouble, but be sure that the content itself has interactions disabled

I must say I disagree with this approach, any and all biometric lock I've seen implemented in iOS blocks all interaction with the application. FaceID/TouchID is a reliable system feature, and as long as we allow fallback to the users passcode they're not at risk of getting stuck unless they've lost their finger / face and forgot their code 🙃

What do other people think, should only part of the interface be obscured when locked?

I can see some value in allowing it to be set by account, but to me again we'd block the entire interface, if someone needed out they could always swap the app away and when it re-opens it will be on the account screen, tapping on a protected account could prompt for biometrics before pushing into the user feed?

--- EDIT

Also, just to be clear I'm saying I disagree, I'm not the boss, it's just my opinion 🙃

@EricBAndrews
Copy link
Member

We've been erring on the side of "do it the Apple way" pretty much every time it's come up, for consistency I'm going to agree with morm here

@tht7
Copy link
Contributor Author

tht7 commented Jun 28, 2023

I honestly don’t disagree. I think both approaches have a value to them, and I wanted to air on the side of caution (to me, that meant a lock that you can always escape from)

So I'll gladly change it

(I believe we should strive to be system, consistent and looking at a few examples I can confirm that the usual behavior is Face ID stop the interaction all together (so full cover), and when it comes to critical stuff when you can’t scan Face ID, or tap your passcode, it goes back to the previous interaction, which matches your description, so I’m also happy to change)

I will change the behavior for this feature in my next update

@mormaer
Copy link
Collaborator

mormaer commented Jun 28, 2023

Screenshot 2023-06-28 at 23 10 20

here's a disgusting draw.io fever-dream of how I would envision it working if we offer it per account 🙈

I know, I know, I should be a designer 😂

tht7 and others added 2 commits June 29, 2023 09:11
# Conflicts:
#	Mlem.xcodeproj/project.pbxproj
#	Mlem/Views/Shared/Markdown View.swift
#	Mlem/Views/Tabs/Posts/Components/Comment/Components/Comment Item Old.swift
#	Mlem/Views/Tabs/Posts/Components/Comment/Components/Comment Item.swift
#	Mlem/Views/Tabs/Posts/Components/Post/Components/Community View/Components/Sidebar.swift
#	Mlem/Views/Tabs/Posts/Components/Post/Components/Community View/Post Item/Post Types/Large Post.swift
#	Mlem/Views/Tabs/Posts/Components/User/Components/User View.swift
@ShadowJonathan
Copy link
Collaborator

Heya @tht7, we have a new repo at https://github.com/mlemgroup/mlem, due to some shuffling around we couldn't get it migrated properly, but if you could reopen this PR there, and link it back here, then it can continue to be considered ^^

@ShadowJonathan ShadowJonathan added the needs migration Issues or PRs that still need to be migrated to the new repo label Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs migration Issues or PRs that still need to be migrated to the new repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants