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

Apple NSFW detector: detect and blur sensitive content option #1553

Open
alltheseas opened this issue Sep 22, 2023 · 24 comments
Open

Apple NSFW detector: detect and blur sensitive content option #1553

alltheseas opened this issue Sep 22, 2023 · 24 comments
Labels

Comments

@alltheseas
Copy link
Collaborator

alltheseas commented Sep 22, 2023

user story

As a Damus user that browses nostr, I would like to have the option of Damus detecting nsfw images, so that I do not see NSFW content on my device.

acceptance criteria

  1. User has the option to turn on or off detect nsfw content feature
  2. If on, nsfw content is automagically detected
  3. If on, nsfw content is automagically blurred (?) (see design discussion)

design

@robagreda does it make sense to "flag" nsfw content, and e.g. blur image, or to not show nsfw identified content altogether?

Might this be two settings: 1) identify and blur nsfw content, and 2) do not show nsfw content?

We could have a setting for that, we add the label with a segmented control to either show, hide or blur. Up to the user

Apple implementation reference

https://developer.apple.com/documentation/sensitivecontentanalysis

origin: #910 (comment)

Related

NIP-36 #910

@alltheseas alltheseas added feature New feature request iOS 17 labels Sep 22, 2023
@alltheseas alltheseas changed the title Apple NSFW detector: detect sensitive content Apple NSFW detector: detect and blur sensitive content option Sep 22, 2023
@jerihass
Copy link
Contributor

jerihass commented Oct 3, 2023

I'm going to start working on this one this week.

@robagreda
Copy link
Contributor

robagreda commented Oct 3, 2023

Great, will work on some design today :) will post the design link here when finish!

@alltheseas
Copy link
Collaborator Author

Great, will work on some design today :) will post the design link here when finish!

My personal preferences:

-for nsfw PFP blur or entirely do not display PFP, show blank/solid color, avatar/emoji (e.g. see robosats), or replace image
-for posts with nsfw do not show me at all

@robagreda
Copy link
Contributor

robagreda commented Oct 3, 2023

If you want to take the whole settings redesign @jerihass do it :)

https://www.figma.com/file/ORaT1T0Ywfbm0sIjwy5Rgq/Damus-iOS?type=design&node-id=3436%3A32823&mode=design&t=lhs654Fya7JdSWv9-1

CleanShot 2023-10-03 at 16 50 31@2x
Something like this could work? @alltheseas @jerihass @jb55

@alltheseas
Copy link
Collaborator Author

Something like this could work? @alltheseas @jerihass @jb55

I would add a "show" option to PFP, as you have with the show nsfw tagged posts.

I would also add a new row titled

"iOS Sensitive Content Analysis"

with options hide, blur, show options.

Question for you @robagreda - if the user chooses blur setting, would they expect to reveal the blurred image with a tap?

@jerihass
Copy link
Contributor

jerihass commented Oct 3, 2023 via email

@alltheseas
Copy link
Collaborator Author

One thing to note:

The Apple framework (SensitiveContentAnalysis) is iOS 17 only.

That's fine. Damus has already accepted nav stack for iOS 17 only is my understanding

@robagreda
Copy link
Contributor

CleanShot 2023-10-03 at 17 36 58@2x
Something like this @alltheseas ?

@jerihass
Copy link
Contributor

jerihass commented Oct 4, 2023

@robagreda For the emoji selection - is that for the NSFW PFP or all NSFW images? We can basically design the blurred NSFW images or cover them however we want (see images at https://developer.apple.com/documentation/sensitivecontentanalysis/detecting_nudity_in_media_and_providing_intervention_options).

So, the blurred image stuff can be customized and if we want to have any sort of buttons/options we can put those in too. In fact we have to design it all, as the NSFW stuff just analyzes the images and tells us if it is NSFW, then we handle accordingly.

@robagreda
Copy link
Contributor

robagreda commented Oct 4, 2023

Yes the emoji is for the PFP only. The control above is to all images or content tagged with NSFW. We will use that blur feature when selected as such using the segmented controls in the settings page.

And great, will design a version of images blurred with options to un-blur maybe only when you tap the button.

@robagreda
Copy link
Contributor

robagreda commented Oct 4, 2023

@jerihass
Copy link
Contributor

jerihass commented Oct 6, 2023

CleanShot 2023-10-03 at 17 36 58@2x Something like this @alltheseas ?

The last option here -- can you clarify the purpose?

Is it to choose from:
-blurred content
-emoji covering
-override the setting that is in System Setting?

If it is the last option is present I think it could be confusing to users.

Maybe there could be a link to the sensitive content system setting option page?

@alltheseas
Copy link
Collaborator Author

The last option here -- can you clarify the purpose?

If it is the last option is present I think it could be confusing to users.

Maybe there could be a link to the sensitive content system setting option page?

Why do you think the option would be confusing?

Damus previously received feedback from an accessibility setting (I believe it was disable animations) where initially we referred users to iOS settings. The specific request from this set of users was to have an individual setting in Damus settings menu that overrides iOS settings.

@jerihass
Copy link
Contributor

jerihass commented Oct 6, 2023 via email

@alltheseas
Copy link
Collaborator Author

alltheseas commented Oct 6, 2023

reverse expected behavior.

This is a fair concern.

Further thinking I’m inclined to have some way to show the user that the iOS system Sensitive Content settings are enabled or disabled in this view, and in this fashion the behavior would be more up front.

I like this approach.

Question for you, @robagreda, and @jb55 - do we want to have an altogether not show content labeled as sensitive by iOS (similar to do not show #nsfw tagged posts)?

@jb55
Copy link
Collaborator

jb55 commented Oct 8, 2023 via email

@jerihass
Copy link
Contributor

jerihass commented Oct 8, 2023

To clarify - I was suggesting a way to notify the user that image content can be screened with the system filter, and I think that we just show or hide the options based on whether the system settings support.

One more thing - sometimes the content filter takes a while to determine if isSensitive is true/false, and we can show a loading or temporary view there.

Most things are screened properly, but others still slip by the settings, unfortunately.

Need to work on profile pictures.
IMG_0044
IMG_0045

@jb55
Copy link
Collaborator

jb55 commented Oct 11, 2023 via email

@alltheseas
Copy link
Collaborator Author

On Sun, Oct 08, 2023 at 02:12:29PM -0700, jerihass wrote: One more thing - sometimes the content filter takes a while to determine if isSensitive is true/false, and we can show a loading or temporary view there.
it should probably be a part of the preloading logic then. We preload stuff before it scrolls into view.

@jerihass do you need help with the preloading logic?

@jerihass
Copy link
Contributor

jerihass commented Oct 12, 2023 via email

@jerihass
Copy link
Contributor

@alltheseas The static and animated images are at a 95% solution; needs some refactoring. One thing I am unable to figure out is what is causing some images to not be analyzed. Initially I thought the analyzer is taking a long time, but now I think that some images are not going through the pre-loader and are missing the analyzing process, but I'm not sure where in the codebase this is happening. Is there a chance some images get called with Kingfisher without being called in the preload image function. https://gist.github.com/jerihass/99663a5489fc60c169bb2dac3700fd88

@alltheseas
Copy link
Collaborator Author

@jb55 do you recall who helped with kingfisher?

@alltheseas alltheseas added the nsfw label Feb 5, 2024
@alltheseas
Copy link
Collaborator Author

I wonder how iOS sensntive content detect performance compares to dignifai #1981

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

4 participants