Skip to content

Make YouTube link previews opt-in#138

Open
thomasbuilds wants to merge 1 commit into
GrapheneOS:mainfrom
thomasbuilds:patch-1
Open

Make YouTube link previews opt-in#138
thomasbuilds wants to merge 1 commit into
GrapheneOS:mainfrom
thomasbuilds:patch-1

Conversation

@thomasbuilds

@thomasbuilds thomasbuilds commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

The conversation screen auto-fetches YouTube thumbnails from img.youtube.com as soon as a conversation containing a YouTube link is viewed, disclosing the viewer's IP address and read time to Google with no opt-out. Gate the feature behind a new YouTube link previews toggle in a Privacy settings sub-screen, disabled by default. The preference is re-read when the conversation screen is foregrounded, so toggling it applies to open conversations without reopening them.

@RankoR
RankoR self-requested a review June 5, 2026 21:12

@RankoR RankoR left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@thomasbuilds it should be configurable in settings (off by default), not fully removed

I suggest adding a sub-screen - "Privacy" and add it there as a toggle, with a short description that enabling it may reduce privacy

@thomasbuilds

Copy link
Copy Markdown
Contributor Author

I don't see any reason to special-case this third-party website?

@RankoR

RankoR commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@thomasbuilds it might be extended to other services in the future, especially if we manage to make RCS work one day. Plus, it's a pre-existing and compact (in terms of LoC) feature that improves UX (for those who want to keep it turned on), there's no reason to remove it if it will be opt-in.

But I agree that having it on by default (especially without the ability to turn it off) is a privacy issue.

@thomasbuilds thomasbuilds changed the title Remove built-in YouTube link previews Make YouTube link previews opt-in Jul 13, 2026

@RankoR RankoR left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Production combines the repository preference with conversation messages and forwards it into every mapped message in ConversationMessagesDelegate.kt lines 134–164 (

return combine(
conversationsRepository
.getConversationMessages(conversationId = conversationId)
.onEach { messages ->
currentMessages.value = messages
},
observeYouTubeLinkPreviewsEnabled(),
) { messages, isYouTubePreviewEnabled ->
messages
.asSequence()
.map { data ->
conversationMessageUiModelMapper.map(
data = data,
isYouTubePreviewEnabled = isYouTubePreviewEnabled,
)
}
.toImmutableList()
}
.flatMapLatest { messages ->
observeConversationMessagesUiState(
messages = messages,
)
}
.flowOn(defaultDispatcher)
}
private fun observeYouTubeLinkPreviewsEnabled(): Flow<Boolean> {
return refreshTriggers
.onStart { emit(Unit) }
.map { appSettingsRepository.isYouTubeLinkPreviewsEnabled() }
.distinctUntilChanged()
).

But ConversationMessagesDelegateImplTest (https://github.com/GrapheneOS/Messaging/blob/c359552bbab06ecde93bb829220ffc8386fa63c2/app/src/test/kotlin/com/android/messaging/ui/conversation/messages/delegate/ConversationMessagesDelegateImplTest.kt) only adds the new repository mock to the constructor; it does not test this behavior.

Please add a focused coroutine test that binds the delegate, returns false and then true from isYouTubeLinkPreviewsEnabled(), triggers refresh(), and verifies the mapper receives the corresponding value.

The rest looks good.

@thestinger

Copy link
Copy Markdown
Member

This can't be merged without a rebase.

The conversation screen auto-fetches YouTube thumbnails from
img.youtube.com as soon as a conversation containing a YouTube link is
viewed, disclosing the viewer's IP address and read time to Google with
no opt-out. Gate the feature behind a new YouTube link previews toggle
in a Privacy settings sub-screen, disabled by default. The preference
is re-read when the conversation screen is foregrounded, so toggling it
applies to open conversations without reopening them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants