Compare commits

..

3 Commits

Author SHA1 Message Date
Eric Bailey 4b7c863835 Apply suggestion from @ds-boyce 2026-03-05 12:02:45 -06:00
Eric Bailey 1ead06f6ff Add test note 2026-03-05 10:38:07 -06:00
Eric Bailey f97a74e974 Add docs on directory structures and naming conventions 2026-03-05 10:36:19 -06:00
453 changed files with 68844 additions and 73646 deletions
+2 -3
View File
@@ -1,5 +1,5 @@
name: "Bug Report"
description: "Create a report for an issue you have experienced in the app."
description: "Create a report for an issue you have experience in the app."
labels: ["bug"]
body:
- type: markdown
@@ -19,14 +19,13 @@ body:
4. See error
validations:
required: true
- type: upload
- type: textarea
attributes:
label: Attachments
description: |
If possible, please provide any images or videos that may help us understand the issue you are experiencing.
validations:
required: false
accept: ".png,.jpg,.jpeg,.gif,.webp,.mp4,.mov,.webm"
- type: dropdown
attributes:
label: What platform(s) does this occur on?
+1 -2
View File
@@ -26,14 +26,13 @@ body:
4. See error
validations:
required: true
- type: upload
- type: textarea
attributes:
label: Attachments
description: |
If possible, please provide any images or videos that may help us understand the issue you are experiencing.
validations:
required: false
accept: ".png,.jpg,.jpeg,.gif,.webp,.mp4,.mov,.webm"
- type: dropdown
attributes:
label: What platform(s) does this occur on?
+1 -2
View File
@@ -15,7 +15,7 @@ body:
implement it in a timely manner.
validations:
required: true
- type: upload
- type: textarea
attributes:
label: Attachments
description: |
@@ -24,7 +24,6 @@ body:
in or is missing from.
validations:
required: false
accept: ".png,.jpg,.jpeg,.gif,.webp,.mp4,.mov,.webm"
- type: textarea
attributes:
label: Describe Alternatives
-135
View File
@@ -1,135 +0,0 @@
/**
* Codemod to replace namespaced React calls with named imports
*
* Before:
* import React from 'react'
* React.useEffect(() => {}, [])
*
* After:
* import { useEffect } from 'react'
* useEffect(() => {}, [])
*
* Usage: jscodeshift -t .jscodeshift/react-import.js <file-path>
* Example: jscodeshift -t .jscodeshift/react-import.js src/App.native.tsx
*/
/* eslint-disable */
export const parser = 'tsx'
export default function transformer(file, api) {
const j = api.jscodeshift
const root = j(file.source)
// Find the React import
let reactImportPath = null
const reactMembers = new Set()
root.find(j.ImportDeclaration).forEach(path => {
const node = path.value
if (node.source.value === 'react') {
node.specifiers.forEach(spec => {
// Check if this is a default import of React
if (
spec.type === 'ImportDefaultSpecifier' &&
spec.local.name === 'React'
) {
reactImportPath = path
}
})
}
})
if (!reactImportPath) {
// No React import found, nothing to do
return file.source
}
// Find all React.* member expressions
root
.find(j.MemberExpression)
.filter(path => {
const node = path.value
return (
node.object.type === 'Identifier' &&
node.object.name === 'React' &&
node.property.type === 'Identifier'
)
})
.forEach(path => {
const propertyName = path.value.property.name
reactMembers.add(propertyName)
})
// Find all React.* JSX member expressions (e.g., <React.Fragment>)
root
.find(j.JSXMemberExpression)
.filter(path => {
const node = path.value
return node.object.name === 'React' && node.property.name
})
.forEach(path => {
const propertyName = path.value.property.name
reactMembers.add(propertyName)
})
// If no React members are used, remove the import
if (reactMembers.size === 0) {
reactImportPath.prune()
return root.toSource()
}
// Sort the members for consistent output
const sortedMembers = Array.from(reactMembers).sort()
// Create new import specifiers
const newSpecifiers = sortedMembers.map(name =>
j.importSpecifier(j.identifier(name), j.identifier(name)),
)
// Get the existing import specifiers
const sortedImports = Array.from(reactImportPath.value.specifiers).sort()
const existingSpecifiers = sortedImports.filter(
specifier => specifier.type !== 'ImportDefaultSpecifier',
)
const allSpecifiers = [
...new Map(
[...existingSpecifiers, ...newSpecifiers].map(item => [
item.imported.name,
item,
]),
).values(),
]
// Update the import declaration
reactImportPath.value.specifiers = allSpecifiers
// Replace all React.* member expressions with just the identifier
root
.find(j.MemberExpression)
.filter(path => {
const node = path.value
return (
node.object.type === 'Identifier' &&
node.object.name === 'React' &&
node.property.type === 'Identifier'
)
})
.replaceWith(path => {
return j.identifier(path.value.property.name)
})
// Replace all React.* JSX member expressions with just the identifier
root
.find(j.JSXMemberExpression)
.filter(path => {
const node = path.value
return node.object.name === 'React' && node.property.name
})
.replaceWith(path => {
return j.jsxIdentifier(path.value.property.name)
})
return root.toSource()
}
-106
View File
@@ -1,106 +0,0 @@
/**
* Codemod to replace namespaced React calls with named imports
*
* Before:
* import * as Toast from '#/view/com/util/Toast'
* Toast.show(message, 'xmark')
*
* After:
* import * as Toast from '#/components/Toast'
* Toast.show(message, {type: 'error'})
*
* Usage: jscodeshift -t .jscodeshift/toast-v2.js <file-path>
* Example: jscodeshift -t .jscodeshift/toast-v2.js src/App.native.tsx
*/
/* eslint-disable */
export const parser = 'tsx'
const OLD_IMPORT = '#/view/com/util/Toast'
const NEW_IMPORT = '#/components/Toast'
const convertLegacyToastType = type => {
switch (type) {
// these ones are fine
case 'default':
case 'success':
case 'error':
case 'warning':
case 'info':
return type
// legacy ones need conversion
case 'xmark':
return 'error'
case 'exclamation-circle':
return 'warning'
case 'check':
return 'success'
case 'clipboard-check':
return 'success'
case 'circle-exclamation':
case 'exclamation-circle':
return 'warning'
default:
return 'default'
}
}
export default function transformer(file, api) {
const j = api.jscodeshift
const root = j(file.source)
// Find Toast import declarations using the old path
const toastImports = root
.find(j.ImportDeclaration)
.filter(path => path.value.source.value === OLD_IMPORT)
if (toastImports.length === 0) {
return file.source
}
// Update import path
toastImports.forEach(path => {
path.value.source.value = NEW_IMPORT
})
// Collect all local names the Toast namespace is bound to
const toastLocalNames = new Set()
toastImports.forEach(path => {
path.value.specifiers.forEach(spec => {
if (spec.type === 'ImportNamespaceSpecifier') {
toastLocalNames.add(spec.local.name)
}
})
})
// Transform Toast.show(message, type) calls
root.find(j.CallExpression).forEach(path => {
const {callee, arguments: args} = path.value
// Match <ToastName>.show(...)
if (
callee.type !== 'MemberExpression' ||
callee.object.type !== 'Identifier' ||
!toastLocalNames.has(callee.object.name) ||
callee.property.name !== 'show'
) {
return
}
// Only transform 2-arg calls where the second arg is a string literal
if (args.length !== 2) return
const typeArg = args[1]
if (typeArg.type !== 'StringLiteral' && typeArg.type !== 'Literal') return
const legacyType = typeArg.value
const newType = convertLegacyToastType(legacyType)
// Replace the second argument with an options object: {type: 'newType'}
args[1] = j.objectExpression([
j.property('init', j.identifier('type'), j.stringLiteral(newType)),
])
})
return root.toSource()
}
+2 -4
View File
@@ -91,8 +91,7 @@ appId: xyz.blueskyweb.app
- tapOn: "Add user to list"
- swipe:
direction: DOWN
- assertVisible:
id: "profileCard-bob.test-link"
- assertVisible: "View Bob's profile"
- tapOn: "Posts"
- assertVisible:
@@ -124,8 +123,7 @@ appId: xyz.blueskyweb.app
- tapOn: "Good Ppl"
- tapOn: "People"
- assertVisible:
id: "profileCard-bob.test-link"
- assertVisible: "View Bob's profile"
- tapOn:
point: "90%,43%"
- tapOn:
+529
View File
@@ -0,0 +1,529 @@
import {createServer as createHTTPServer} from 'node:http'
import {parse} from 'node:url'
import {createServer, type TestPDS} from '../jest/test-pds'
async function main() {
let server: TestPDS
createHTTPServer(async (req, res) => {
const url = parse(req.url || '/', true)
if (req.method !== 'POST') {
return res.writeHead(200).end()
}
try {
console.log('Closing old server')
await server?.close()
console.log('Starting new server')
const inviteRequired = url?.query && 'invite' in url.query
server = await createServer({inviteRequired})
console.log('Listening at', server.pdsUrl)
if (url?.query) {
if ('users' in url.query) {
console.log('Generating mock users')
await server.mocker.createUser('alice')
await server.mocker.createUser('bob')
await server.mocker.createUser('carla')
await server.mocker.users.alice.agent.upsertProfile(() => ({
displayName: 'Alice',
description: 'Test user 1',
}))
await server.mocker.users.bob.agent.upsertProfile(() => ({
displayName: 'Bob',
description: 'Test user 2',
}))
await server.mocker.users.carla.agent.upsertProfile(() => ({
displayName: 'Carla',
description: 'Test user 3',
}))
if (inviteRequired) {
await server.mocker.createInvite(server.mocker.users.alice.did)
}
}
if ('follows' in url.query) {
console.log('Generating mock follows')
await server.mocker.follow('alice', 'bob')
await server.mocker.follow('alice', 'carla')
await server.mocker.follow('bob', 'alice')
await server.mocker.follow('bob', 'carla')
await server.mocker.follow('carla', 'alice')
await server.mocker.follow('carla', 'bob')
}
if ('posts' in url.query) {
console.log('Generating mock posts')
for (let user in server.mocker.users) {
await server.mocker.users[user].agent.post({text: 'Post'})
}
}
if ('feeds' in url.query) {
console.log('Generating mock feed')
await server.mocker.createFeed('alice', 'alice-favs', [])
}
if ('thread' in url.query) {
console.log('Generating mock posts')
const res = await server.mocker.users.bob.agent.post({
text: 'Thread root',
})
await server.mocker.users.carla.agent.post({
text: 'Thread reply',
reply: {
parent: {cid: res.cid, uri: res.uri},
root: {cid: res.cid, uri: res.uri},
},
})
}
if ('mergefeed' in url.query) {
console.log('Generating mock users')
await server.mocker.createUser('alice')
await server.mocker.createUser('bob')
await server.mocker.createUser('carla')
await server.mocker.createUser('dan')
await server.mocker.users.alice.agent.upsertProfile(() => ({
displayName: 'Alice',
description: 'Test user 1',
}))
await server.mocker.users.bob.agent.upsertProfile(() => ({
displayName: 'Bob',
description: 'Test user 2',
}))
await server.mocker.users.carla.agent.upsertProfile(() => ({
displayName: 'Carla',
description: 'Test user 3',
}))
await server.mocker.users.dan.agent.upsertProfile(() => ({
displayName: 'Dan',
description: 'Test user 4',
}))
console.log('Generating mock follows')
await server.mocker.follow('alice', 'bob')
await server.mocker.follow('alice', 'carla')
console.log('Generating mock posts')
let posts: Record<string, any[]> = {
alice: [],
bob: [],
carla: [],
dan: [],
}
for (let i = 0; i < 10; i++) {
for (let user in server.mocker.users) {
if (user === 'alice') continue
posts[user].push(
await server.mocker.createPost(user, `Post ${i}`),
)
}
}
for (let i = 0; i < 10; i++) {
for (let user in server.mocker.users) {
if (user === 'alice') continue
if (i % 5 === 0) {
await server.mocker.createReply(user, 'Self reply', {
cid: posts[user][i].cid,
uri: posts[user][i].uri,
})
}
if (i % 5 === 1) {
await server.mocker.createReply(user, 'Reply to bob', {
cid: posts.bob[i].cid,
uri: posts.bob[i].uri,
})
}
if (i % 5 === 2) {
await server.mocker.createReply(user, 'Reply to dan', {
cid: posts.dan[i].cid,
uri: posts.dan[i].uri,
})
}
await server.mocker.users[user].agent.post({text: `Post ${i}`})
}
}
console.log('Generating mock feeds')
await server.mocker.createFeed(
'alice',
'alice-favs',
posts.dan.map(p => p.uri),
)
await server.mocker.createFeed(
'alice',
'alice-favs2',
posts.dan.map(p => p.uri),
)
}
if ('labels' in url.query) {
console.log('Generating naughty users with labels')
const anchorPost = await server.mocker.createPost(
'alice',
'Anchor post',
)
for (const user of [
'dmca-account',
'dmca-profile',
'dmca-posts',
'porn-account',
'porn-profile',
'porn-posts',
'nudity-account',
'nudity-profile',
'nudity-posts',
'scam-account',
'scam-profile',
'scam-posts',
'unknown-account',
'unknown-profile',
'unknown-posts',
'hide-account',
'hide-profile',
'hide-posts',
'no-promote-account',
'no-promote-profile',
'no-promote-posts',
'warn-account',
'warn-profile',
'warn-posts',
'muted-account',
'muted-by-list-acc',
'blocking-account',
'blockedby-account',
'mutual-block-acc',
]) {
await server.mocker.createUser(user)
await server.mocker.follow('alice', user)
await server.mocker.follow(user, 'alice')
await server.mocker.createPost(user, `Unlabeled post from ${user}`)
await server.mocker.createReply(
user,
`Unlabeled reply from ${user}`,
anchorPost,
)
await server.mocker.like(user, anchorPost)
}
await server.mocker.labelAccount('dmca-violation', 'dmca-account')
await server.mocker.labelProfile('dmca-violation', 'dmca-profile')
await server.mocker.labelPost(
'dmca-violation',
await server.mocker.createPost('dmca-posts', 'dmca post'),
)
await server.mocker.labelPost(
'dmca-violation',
await server.mocker.createQuotePost(
'dmca-posts',
'dmca quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'dmca-violation',
await server.mocker.createReply(
'dmca-posts',
'dmca reply',
anchorPost,
),
)
await server.mocker.labelAccount('porn', 'porn-account')
await server.mocker.labelProfile('porn', 'porn-profile')
await server.mocker.labelPost(
'porn',
await server.mocker.createImagePost('porn-posts', 'porn post'),
)
await server.mocker.labelPost(
'porn',
await server.mocker.createQuotePost(
'porn-posts',
'porn quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'porn',
await server.mocker.createReply(
'porn-posts',
'porn reply',
anchorPost,
),
)
await server.mocker.labelAccount('nudity', 'nudity-account')
await server.mocker.labelProfile('nudity', 'nudity-profile')
await server.mocker.labelPost(
'nudity',
await server.mocker.createImagePost('nudity-posts', 'nudity post'),
)
await server.mocker.labelPost(
'nudity',
await server.mocker.createQuotePost(
'nudity-posts',
'nudity quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'nudity',
await server.mocker.createReply(
'nudity-posts',
'nudity reply',
anchorPost,
),
)
await server.mocker.labelAccount('scam', 'scam-account')
await server.mocker.labelProfile('scam', 'scam-profile')
await server.mocker.labelPost(
'scam',
await server.mocker.createPost('scam-posts', 'scam post'),
)
await server.mocker.labelPost(
'scam',
await server.mocker.createQuotePost(
'scam-posts',
'scam quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'scam',
await server.mocker.createReply(
'scam-posts',
'scam reply',
anchorPost,
),
)
await server.mocker.labelAccount(
'not-a-real-label',
'unknown-account',
)
await server.mocker.labelProfile(
'not-a-real-label',
'unknown-profile',
)
await server.mocker.labelPost(
'not-a-real-label',
await server.mocker.createPost('unknown-posts', 'unknown post'),
)
await server.mocker.labelPost(
'not-a-real-label',
await server.mocker.createQuotePost(
'unknown-posts',
'unknown quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'not-a-real-label',
await server.mocker.createReply(
'unknown-posts',
'unknown reply',
anchorPost,
),
)
await server.mocker.labelAccount('!hide', 'hide-account')
await server.mocker.labelProfile('!hide', 'hide-profile')
await server.mocker.labelPost(
'!hide',
await server.mocker.createPost('hide-posts', 'hide post'),
)
await server.mocker.labelPost(
'!hide',
await server.mocker.createQuotePost(
'hide-posts',
'hide quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'!hide',
await server.mocker.createReply(
'hide-posts',
'hide reply',
anchorPost,
),
)
await server.mocker.labelAccount('!no-promote', 'no-promote-account')
await server.mocker.labelProfile('!no-promote', 'no-promote-profile')
await server.mocker.labelPost(
'!no-promote',
await server.mocker.createPost(
'no-promote-posts',
'no-promote post',
),
)
await server.mocker.labelPost(
'!no-promote',
await server.mocker.createQuotePost(
'no-promote-posts',
'no-promote quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'!no-promote',
await server.mocker.createReply(
'no-promote-posts',
'no-promote reply',
anchorPost,
),
)
await server.mocker.labelAccount('!warn', 'warn-account')
await server.mocker.labelProfile('!warn', 'warn-profile')
await server.mocker.labelPost(
'!warn',
await server.mocker.createPost('warn-posts', 'warn post'),
)
await server.mocker.labelPost(
'!warn',
await server.mocker.createQuotePost(
'warn-posts',
'warn quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'!warn',
await server.mocker.createReply(
'warn-posts',
'warn reply',
anchorPost,
),
)
await server.mocker.users.alice.agent.mute('muted-account.test')
await server.mocker.createPost('muted-account', 'muted post')
await server.mocker.createQuotePost(
'muted-account',
'muted quote post',
anchorPost,
)
await server.mocker.createReply(
'muted-account',
'muted reply',
anchorPost,
)
const list = await server.mocker.createMuteList(
'alice',
'Muted Users',
)
await server.mocker.addToMuteList(
'alice',
list,
server.mocker.users['muted-by-list-acc'].did,
)
await server.mocker.createPost('muted-by-list-acc', 'muted post')
await server.mocker.createQuotePost(
'muted-by-list-acc',
'account quote post',
anchorPost,
)
await server.mocker.createReply(
'muted-by-list-acc',
'account reply',
anchorPost,
)
await server.mocker.createPost('blocking-account', 'blocking post')
await server.mocker.createQuotePost(
'blocking-account',
'blocking quote post',
anchorPost,
)
await server.mocker.createReply(
'blocking-account',
'blocking reply',
anchorPost,
)
await server.mocker.users.alice.agent.app.bsky.graph.block.create(
{
repo: server.mocker.users.alice.did,
},
{
subject: server.mocker.users['blocking-account'].did,
createdAt: new Date().toISOString(),
},
)
await server.mocker.createPost('blockedby-account', 'blockedby post')
await server.mocker.createQuotePost(
'blockedby-account',
'blockedby quote post',
anchorPost,
)
await server.mocker.createReply(
'blockedby-account',
'blockedby reply',
anchorPost,
)
await server.mocker.users[
'blockedby-account'
].agent.app.bsky.graph.block.create(
{
repo: server.mocker.users['blockedby-account'].did,
},
{
subject: server.mocker.users.alice.did,
createdAt: new Date().toISOString(),
},
)
await server.mocker.createPost(
'mutual-block-acc',
'mutual-block post',
)
await server.mocker.createQuotePost(
'mutual-block-acc',
'mutual-block quote post',
anchorPost,
)
await server.mocker.createReply(
'mutual-block-acc',
'mutual-block reply',
anchorPost,
)
await server.mocker.users.alice.agent.app.bsky.graph.block.create(
{
repo: server.mocker.users.alice.did,
},
{
subject: server.mocker.users['mutual-block-acc'].did,
createdAt: new Date().toISOString(),
},
)
await server.mocker.users[
'mutual-block-acc'
].agent.app.bsky.graph.block.create(
{
repo: server.mocker.users['mutual-block-acc'].did,
},
{
subject: server.mocker.users.alice.did,
createdAt: new Date().toISOString(),
},
)
// flush caches
await server.mocker.testNet.processAll()
}
}
console.log('Ready')
return res
.writeHead(200, {
'content-type': 'application/json',
})
.end(
JSON.stringify({
pdsUrl: server.pdsUrl,
appviewDid: server.appviewDid,
}),
)
} catch (e) {
console.error('Error!', e)
return res.writeHead(500).end()
}
}).listen(1986)
console.log('Mock server manager listening on 1986')
}
main()
+1 -1
View File
@@ -268,7 +268,7 @@ module.exports = function (_config) {
],
},
android: {
compileSdkVersion: 36,
compileSdkVersion: 35,
targetSdkVersion: 35,
buildToolsVersion: '35.0.0',
buildReactNativeFromSource: IS_PRODUCTION,
-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" fill-rule="evenodd" d="M12 0a2 2 0 0 1 1 3.73V5h4.2c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.31 1.31C22 7.28 22 8.12 22 9.8v.25a2.501 2.501 0 0 1 0 4.9V15c0 2.8 0 4.2-.545 5.27a5 5 0 0 1-2.185 2.185C18.2 23 16.8 23 14 23h-4c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C2 19.2 2 17.8 2 15v-.05a2.5 2.5 0 0 1 0-4.9V9.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.31-1.31C4.28 5 5.12 5 6.8 5H11V3.73A2 2 0 0 1 12 0M8 10a2 2 0 0 0-2 2v2a2 2 0 1 0 4 0v-2a2 2 0 0 0-2-2m8 0a2 2 0 0 0-2 2v2a2 2 0 1 0 4 0v-2a2 2 0 0 0-2-2" clip-rule="evenodd"/></svg>

Before

Width:  |  Height:  |  Size: 621 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" d="M12 2a1 1 0 0 1 1 1v2h3.2l1.113.005c.975.015 1.568.077 2.05.322a3 3 0 0 1 1.31 1.31C21 7.28 21 8.12 21 9.8v.287a1.498 1.498 0 0 1-.005 2.827c-.006 2.204-.058 3.41-.54 4.356l-.093.174a5 5 0 0 1-2.092 2.011l-.205.096c-.766.33-1.72.417-3.21.44L13 20h-2l-1.854-.009c-1.49-.023-2.445-.11-3.211-.44l-.205-.096a5 5 0 0 1-2.185-2.185c-.409-.803-.51-1.79-.536-3.415l-.005-.94A1.498 1.498 0 0 1 3 10.086V9.8c0-1.575 0-2.412.27-3.04l.057-.122a3 3 0 0 1 1.105-1.196l.206-.115C5.279 5 6.12 5 7.8 5H11V3a1 1 0 0 1 1-1M7.8 7c-.873 0-1.408.002-1.808.034a3 3 0 0 0-.367.051l-.063.018-.016.006a1 1 0 0 0-.437.437l-.006.016-.018.063a3 3 0 0 0-.05.367C5.001 8.392 5 8.927 5 9.8V12c0 1.433.002 2.388.062 3.121.058.71.16 1.036.265 1.241a3 3 0 0 0 1.31 1.31c.207.106.532.209 1.242.267.733.06 1.688.061 3.121.061h2c1.433 0 2.388-.002 3.121-.061.71-.058 1.036-.161 1.241-.266a3 3 0 0 0 1.31-1.31c.106-.206.209-.532.267-1.242.06-.733.061-1.688.061-3.121V9.8c0-.873-.002-1.408-.034-1.808a2.5 2.5 0 0 0-.051-.367l-.017-.063-.007-.016a1 1 0 0 0-.437-.437l-.015-.006-.064-.018a3 3 0 0 0-.367-.05C17.608 7.001 17.073 7 16.2 7zM9 10a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0v-2a1 1 0 0 1 1-1m6 0a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0v-2a1 1 0 0 1 1-1"/></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

-10
View File
@@ -10,7 +10,6 @@ import logo from '../../assets/logo_full_name.svg'
import {Like as LikeIcon} from '../icons/Like'
import {Reply as ReplyIcon} from '../icons/Reply'
import {Repost as RepostIcon} from '../icons/Repost'
import {Robot as RobotIcon} from '../icons/Robot'
import {CONTENT_LABELS} from '../labels'
import * as bsky from '../types/bsky'
import {niceDate} from '../util/nice-date'
@@ -44,9 +43,6 @@ export function Post({thread}: Props) {
}
const verification = getVerificationState({profile: post.author})
const isBot = post.author.labels?.some(
l => l.val === 'bot' && l.src === post.author.did,
)
const href = `/profile/${post.author.did}/post/${getRkey(post)}`
@@ -80,12 +76,6 @@ export function Post({thread}: Props) {
size={15}
/>
)}
{isBot && (
<RobotIcon
className="pl-[3px] mt-px shrink-0 text-slate-500 dark:text-slate-400"
size={15}
/>
)}
</div>
<Link
href={`/profile/${post.author.did}`}
-22
View File
@@ -1,22 +0,0 @@
import {h} from 'preact'
export const Robot = ({
size = 14,
className,
}: {
size?: number
className?: string
}) => (
<svg
className={className}
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M12 0C13.1046 0 14 0.89543 14 2C14 2.73976 13.5971 3.3835 13 3.72949V5H17.2002C18.8802 5 19.7206 5.00018 20.3623 5.32715C20.9265 5.61472 21.3853 6.07347 21.6729 6.6377C21.9998 7.27941 22 8.11978 22 9.7998V10.0498C23.1411 10.2814 24 11.2905 24 12.5C24 13.7094 23.141 14.7175 22 14.9492V15C22 17.8 21.9999 19.2 21.4551 20.2695C20.9757 21.2103 20.2103 21.9757 19.2695 22.4551C18.2 22.9999 16.8 23 14 23H10C7.20005 23 5.79998 22.9999 4.73047 22.4551C3.78966 21.9757 3.02429 21.2103 2.54492 20.2695C2.00013 19.2 2 17.8 2 15V14.9492C0.858955 14.7175 0 13.7094 0 12.5C0 11.2905 0.85886 10.2814 2 10.0498V9.7998C2 8.11978 2.00018 7.27941 2.32715 6.6377C2.61472 6.07347 3.07347 5.61472 3.6377 5.32715C4.27941 5.00018 5.11978 5 6.7998 5H11V3.72949C10.4029 3.3835 10 2.73976 10 2C10 0.89543 10.8954 0 12 0ZM8 10C6.89543 10 6 10.8954 6 12V14C6 15.1046 6.89543 16 8 16C9.10457 16 10 15.1046 10 14V12C10 10.8954 9.10457 10 8 10ZM16 10C14.8954 10 14 10.8954 14 12V14C14 15.1046 14.8954 16 16 16C17.1046 16 18 15.1046 18 14V12C18 10.8954 17.1046 10 16 10Z"
fill="currentColor"
/>
</svg>
)
+1 -11
View File
@@ -1,20 +1,10 @@
import escapeHTML from 'escape-html'
export function linkRedirectContents(link: string): string {
// Encode characters that could break out of the single-quoted URL in meta refresh.
// HTML entity escaping (&#39;) is insufficient because the browser decodes entities
// before the meta refresh parser processes the URL, allowing apostrophes to
// prematurely terminate the URL string.
//
// Example: "They're" with HTML escaping becomes "They&#39;re" in HTML, but after
// the browser decodes the content attribute, the meta refresh parser sees "They're"
// and interprets the apostrophe as the closing quote, truncating the URL to "They".
const safeLink = link.replace(/'/g, '%27')
return `
<html>
<head>
<meta http-equiv="refresh" content="0; URL='${escapeHTML(safeLink)}'" />
<meta http-equiv="refresh" content="0; URL='${escapeHTML(link)}'" />
<meta
http-equiv="Cache-Control"
content="no-store, no-cache, must-revalidate, max-age=0" />
-1
View File
@@ -1,6 +1,5 @@
import React from 'react'
// @NOTE satori does not currently support webp, see vercel/satori#273
function detectMime(buf: Buffer): string {
if (buf[0] === 0xff && buf[1] === 0xd8) return 'image/jpeg'
if (buf[0] === 0x89 && buf[1] === 0x50) return 'image/png'
+4 -10
View File
@@ -1,9 +1,9 @@
import assert from 'node:assert'
import React from 'react'
import {type AppBskyGraphDefs, AtUri} from '@atproto/api'
import {AppBskyGraphDefs, AtUri} from '@atproto/api'
import resvg from '@resvg/resvg-js'
import {type Express} from 'express'
import {Express} from 'express'
import satori from 'satori'
import {
@@ -11,7 +11,7 @@ import {
STARTERPACK_HEIGHT,
STARTERPACK_WIDTH,
} from '../components/StarterPack.js'
import {type AppContext} from '../context.js'
import {AppContext} from '../context.js'
import {httpLogger} from '../logger.js'
import {loadEmojiAsSvg} from '../util.js'
import {handler, originVerifyMiddleware} from './util.js'
@@ -83,18 +83,12 @@ export default function (ctx: AppContext, app: Express) {
}
async function getImage(url: string) {
const response = await fetch(ensureJpeg(url))
const response = await fetch(url)
const arrayBuf = await response.arrayBuffer() // must drain body even if it will be discarded
if (response.status !== 200) return null
return Buffer.from(arrayBuf)
}
// CDN URLs end with @jpeg, @webp, or no extension (which may default to webp).
// We want to ensure the image URLs we use are for jpegs, required for compat with satori.
function ensureJpeg(url: string) {
return url.replace(/(@[a-z]{3,5})?$/, '@jpeg')
}
const hideAvatarLabels = new Set([
'!hide',
'!warn',
-17
View File
@@ -292,7 +292,6 @@ func serve(cctx *cli.Context) error {
e.GET("/settings/accessibility", server.WebGeneric)
e.GET("/settings/appearance", server.WebGeneric)
e.GET("/settings/account", server.WebGeneric)
e.GET("/settings/automation-label", server.WebGeneric)
e.GET("/settings/privacy-and-security", server.WebGeneric)
e.GET("/settings/privacy-and-security/activity", server.WebGeneric)
e.GET("/settings/content-and-media", server.WebGeneric)
@@ -590,14 +589,6 @@ func (srv *Server) WebPost(c echo.Context) error {
if postView.Embed.EmbedVideo_View.Thumbnail != nil {
data["imgThumbUrls"] = []string{*postView.Embed.EmbedVideo_View.Thumbnail}
}
if postView.Embed.EmbedVideo_View.Playlist != "" {
data["videoUrl"] = postView.Embed.EmbedVideo_View.Playlist
data["videoType"] = "application/vnd.apple.mpegurl"
if postView.Embed.EmbedVideo_View.AspectRatio != nil {
data["videoWidth"] = postView.Embed.EmbedVideo_View.AspectRatio.Width
data["videoHeight"] = postView.Embed.EmbedVideo_View.AspectRatio.Height
}
}
} else if hasMediaImages {
var thumbUrls []string
for i := range postView.Embed.EmbedRecordWithMedia_View.Media.EmbedImages_View.Images {
@@ -608,14 +599,6 @@ func (srv *Server) WebPost(c echo.Context) error {
if postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.Thumbnail != nil {
data["imgThumbUrls"] = []string{*postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.Thumbnail}
}
if postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.Playlist != "" {
data["videoUrl"] = postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.Playlist
data["videoType"] = "application/vnd.apple.mpegurl"
if postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.AspectRatio != nil {
data["videoWidth"] = postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.AspectRatio.Width
data["videoHeight"] = postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.AspectRatio.Height
}
}
}
}
-8
View File
@@ -34,14 +34,6 @@
<meta property="twitter:image" content="{{ imgThumbUrl }}">
{% endfor %}
<meta name="twitter:card" content="summary_large_image">
{%- if videoUrl %}
<meta property="og:video" content="{{ videoUrl }}">
<meta property="og:video:type" content="{{ videoType }}">
{%- if videoWidth %}
<meta property="og:video:width" content="{{ videoWidth }}">
<meta property="og:video:height" content="{{ videoHeight }}">
{% endif -%}
{% endif -%}
{% else %}
<meta property="og:image" content="{{ postView.Author.Avatar|avatar_thumbnail }}">
<meta property="twitter:image" content="{{ postView.Author.Avatar|avatar_thumbnail }}">
-510
View File
@@ -1,510 +0,0 @@
import {createServer as createHTTPServer} from 'node:http'
import {parse} from 'node:url'
import {createServer, type TestPDS} from './test-pds'
let server: TestPDS
// eslint-disable-next-line @typescript-eslint/no-misused-promises
createHTTPServer(async (req, res) => {
const url = parse(req.url || '/', true)
if (req.method !== 'POST') {
return res.writeHead(200).end()
}
try {
console.log('Closing old server')
await server?.close()
console.log('Starting new server')
const inviteRequired = url?.query && 'invite' in url.query
server = await createServer({inviteRequired})
console.log('Listening at', server.pdsUrl)
if (url?.query) {
if ('users' in url.query) {
console.log('Generating mock users')
await server.mocker.createUser('alice')
await server.mocker.createUser('bob')
await server.mocker.createUser('carla')
await server.mocker.users.alice.agent.upsertProfile(() => ({
displayName: 'Alice',
description: 'Test user 1',
}))
await server.mocker.users.bob.agent.upsertProfile(() => ({
displayName: 'Bob',
description: 'Test user 2',
}))
await server.mocker.users.carla.agent.upsertProfile(() => ({
displayName: 'Carla',
description: 'Test user 3',
}))
if (inviteRequired) {
await server.mocker.createInvite(server.mocker.users.alice.did)
}
}
if ('follows' in url.query) {
console.log('Generating mock follows')
await server.mocker.follow('alice', 'bob')
await server.mocker.follow('alice', 'carla')
await server.mocker.follow('bob', 'alice')
await server.mocker.follow('bob', 'carla')
await server.mocker.follow('carla', 'alice')
await server.mocker.follow('carla', 'bob')
}
if ('posts' in url.query) {
console.log('Generating mock posts')
for (let user in server.mocker.users) {
await server.mocker.users[user].agent.post({text: 'Post'})
}
}
if ('feeds' in url.query) {
console.log('Generating mock feed')
await server.mocker.createFeed('alice', 'alice-favs', [])
}
if ('thread' in url.query) {
console.log('Generating mock posts')
const res = await server.mocker.users.bob.agent.post({
text: 'Thread root',
})
await server.mocker.users.carla.agent.post({
text: 'Thread reply',
reply: {
parent: {cid: res.cid, uri: res.uri},
root: {cid: res.cid, uri: res.uri},
},
})
}
if ('mergefeed' in url.query) {
console.log('Generating mock users')
await server.mocker.createUser('alice')
await server.mocker.createUser('bob')
await server.mocker.createUser('carla')
await server.mocker.createUser('dan')
await server.mocker.users.alice.agent.upsertProfile(() => ({
displayName: 'Alice',
description: 'Test user 1',
}))
await server.mocker.users.bob.agent.upsertProfile(() => ({
displayName: 'Bob',
description: 'Test user 2',
}))
await server.mocker.users.carla.agent.upsertProfile(() => ({
displayName: 'Carla',
description: 'Test user 3',
}))
await server.mocker.users.dan.agent.upsertProfile(() => ({
displayName: 'Dan',
description: 'Test user 4',
}))
console.log('Generating mock follows')
await server.mocker.follow('alice', 'bob')
await server.mocker.follow('alice', 'carla')
console.log('Generating mock posts')
let posts: Record<string, any[]> = {
alice: [],
bob: [],
carla: [],
dan: [],
}
for (let i = 0; i < 10; i++) {
for (let user in server.mocker.users) {
if (user === 'alice') continue
posts[user].push(await server.mocker.createPost(user, `Post ${i}`))
}
}
for (let i = 0; i < 10; i++) {
for (let user in server.mocker.users) {
if (user === 'alice') continue
if (i % 5 === 0) {
await server.mocker.createReply(user, 'Self reply', {
cid: posts[user][i].cid,
uri: posts[user][i].uri,
})
}
if (i % 5 === 1) {
await server.mocker.createReply(user, 'Reply to bob', {
cid: posts.bob[i].cid,
uri: posts.bob[i].uri,
})
}
if (i % 5 === 2) {
await server.mocker.createReply(user, 'Reply to dan', {
cid: posts.dan[i].cid,
uri: posts.dan[i].uri,
})
}
await server.mocker.users[user].agent.post({text: `Post ${i}`})
}
}
console.log('Generating mock feeds')
await server.mocker.createFeed(
'alice',
'alice-favs',
posts.dan.map(p => p.uri),
)
await server.mocker.createFeed(
'alice',
'alice-favs2',
posts.dan.map(p => p.uri),
)
}
if ('labels' in url.query) {
console.log('Generating naughty users with labels')
const anchorPost = await server.mocker.createPost(
'alice',
'Anchor post',
)
for (const user of [
'dmca-account',
'dmca-profile',
'dmca-posts',
'porn-account',
'porn-profile',
'porn-posts',
'nudity-account',
'nudity-profile',
'nudity-posts',
'scam-account',
'scam-profile',
'scam-posts',
'unknown-account',
'unknown-profile',
'unknown-posts',
'hide-account',
'hide-profile',
'hide-posts',
'no-promote-account',
'no-promote-profile',
'no-promote-posts',
'warn-account',
'warn-profile',
'warn-posts',
'muted-account',
'muted-by-list-acc',
'blocking-account',
'blockedby-account',
'mutual-block-acc',
]) {
await server.mocker.createUser(user)
await server.mocker.follow('alice', user)
await server.mocker.follow(user, 'alice')
await server.mocker.createPost(user, `Unlabeled post from ${user}`)
await server.mocker.createReply(
user,
`Unlabeled reply from ${user}`,
anchorPost,
)
await server.mocker.like(user, anchorPost)
}
await server.mocker.labelAccount('dmca-violation', 'dmca-account')
await server.mocker.labelProfile('dmca-violation', 'dmca-profile')
await server.mocker.labelPost(
'dmca-violation',
await server.mocker.createPost('dmca-posts', 'dmca post'),
)
await server.mocker.labelPost(
'dmca-violation',
await server.mocker.createQuotePost(
'dmca-posts',
'dmca quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'dmca-violation',
await server.mocker.createReply(
'dmca-posts',
'dmca reply',
anchorPost,
),
)
await server.mocker.labelAccount('porn', 'porn-account')
await server.mocker.labelProfile('porn', 'porn-profile')
await server.mocker.labelPost(
'porn',
await server.mocker.createImagePost('porn-posts', 'porn post'),
)
await server.mocker.labelPost(
'porn',
await server.mocker.createQuotePost(
'porn-posts',
'porn quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'porn',
await server.mocker.createReply(
'porn-posts',
'porn reply',
anchorPost,
),
)
await server.mocker.labelAccount('nudity', 'nudity-account')
await server.mocker.labelProfile('nudity', 'nudity-profile')
await server.mocker.labelPost(
'nudity',
await server.mocker.createImagePost('nudity-posts', 'nudity post'),
)
await server.mocker.labelPost(
'nudity',
await server.mocker.createQuotePost(
'nudity-posts',
'nudity quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'nudity',
await server.mocker.createReply(
'nudity-posts',
'nudity reply',
anchorPost,
),
)
await server.mocker.labelAccount('scam', 'scam-account')
await server.mocker.labelProfile('scam', 'scam-profile')
await server.mocker.labelPost(
'scam',
await server.mocker.createPost('scam-posts', 'scam post'),
)
await server.mocker.labelPost(
'scam',
await server.mocker.createQuotePost(
'scam-posts',
'scam quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'scam',
await server.mocker.createReply(
'scam-posts',
'scam reply',
anchorPost,
),
)
await server.mocker.labelAccount('not-a-real-label', 'unknown-account')
await server.mocker.labelProfile('not-a-real-label', 'unknown-profile')
await server.mocker.labelPost(
'not-a-real-label',
await server.mocker.createPost('unknown-posts', 'unknown post'),
)
await server.mocker.labelPost(
'not-a-real-label',
await server.mocker.createQuotePost(
'unknown-posts',
'unknown quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'not-a-real-label',
await server.mocker.createReply(
'unknown-posts',
'unknown reply',
anchorPost,
),
)
await server.mocker.labelAccount('!hide', 'hide-account')
await server.mocker.labelProfile('!hide', 'hide-profile')
await server.mocker.labelPost(
'!hide',
await server.mocker.createPost('hide-posts', 'hide post'),
)
await server.mocker.labelPost(
'!hide',
await server.mocker.createQuotePost(
'hide-posts',
'hide quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'!hide',
await server.mocker.createReply(
'hide-posts',
'hide reply',
anchorPost,
),
)
await server.mocker.labelAccount('!no-promote', 'no-promote-account')
await server.mocker.labelProfile('!no-promote', 'no-promote-profile')
await server.mocker.labelPost(
'!no-promote',
await server.mocker.createPost('no-promote-posts', 'no-promote post'),
)
await server.mocker.labelPost(
'!no-promote',
await server.mocker.createQuotePost(
'no-promote-posts',
'no-promote quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'!no-promote',
await server.mocker.createReply(
'no-promote-posts',
'no-promote reply',
anchorPost,
),
)
await server.mocker.labelAccount('!warn', 'warn-account')
await server.mocker.labelProfile('!warn', 'warn-profile')
await server.mocker.labelPost(
'!warn',
await server.mocker.createPost('warn-posts', 'warn post'),
)
await server.mocker.labelPost(
'!warn',
await server.mocker.createQuotePost(
'warn-posts',
'warn quote post',
anchorPost,
),
)
await server.mocker.labelPost(
'!warn',
await server.mocker.createReply(
'warn-posts',
'warn reply',
anchorPost,
),
)
await server.mocker.users.alice.agent.mute('muted-account.test')
await server.mocker.createPost('muted-account', 'muted post')
await server.mocker.createQuotePost(
'muted-account',
'muted quote post',
anchorPost,
)
await server.mocker.createReply(
'muted-account',
'muted reply',
anchorPost,
)
const list = await server.mocker.createMuteList('alice', 'Muted Users')
await server.mocker.addToMuteList(
'alice',
list,
server.mocker.users['muted-by-list-acc'].did,
)
await server.mocker.createPost('muted-by-list-acc', 'muted post')
await server.mocker.createQuotePost(
'muted-by-list-acc',
'account quote post',
anchorPost,
)
await server.mocker.createReply(
'muted-by-list-acc',
'account reply',
anchorPost,
)
await server.mocker.createPost('blocking-account', 'blocking post')
await server.mocker.createQuotePost(
'blocking-account',
'blocking quote post',
anchorPost,
)
await server.mocker.createReply(
'blocking-account',
'blocking reply',
anchorPost,
)
await server.mocker.users.alice.agent.app.bsky.graph.block.create(
{
repo: server.mocker.users.alice.did,
},
{
subject: server.mocker.users['blocking-account'].did,
createdAt: new Date().toISOString(),
},
)
await server.mocker.createPost('blockedby-account', 'blockedby post')
await server.mocker.createQuotePost(
'blockedby-account',
'blockedby quote post',
anchorPost,
)
await server.mocker.createReply(
'blockedby-account',
'blockedby reply',
anchorPost,
)
await server.mocker.users[
'blockedby-account'
].agent.app.bsky.graph.block.create(
{
repo: server.mocker.users['blockedby-account'].did,
},
{
subject: server.mocker.users.alice.did,
createdAt: new Date().toISOString(),
},
)
await server.mocker.createPost('mutual-block-acc', 'mutual-block post')
await server.mocker.createQuotePost(
'mutual-block-acc',
'mutual-block quote post',
anchorPost,
)
await server.mocker.createReply(
'mutual-block-acc',
'mutual-block reply',
anchorPost,
)
await server.mocker.users.alice.agent.app.bsky.graph.block.create(
{
repo: server.mocker.users.alice.did,
},
{
subject: server.mocker.users['mutual-block-acc'].did,
createdAt: new Date().toISOString(),
},
)
await server.mocker.users[
'mutual-block-acc'
].agent.app.bsky.graph.block.create(
{
repo: server.mocker.users['mutual-block-acc'].did,
},
{
subject: server.mocker.users.alice.did,
createdAt: new Date().toISOString(),
},
)
// flush caches
await server.mocker.testNet.processAll()
}
}
console.log('Ready')
return res
.writeHead(200, {
'content-type': 'application/json',
})
.end(
JSON.stringify({
pdsUrl: server.pdsUrl,
appviewDid: server.appviewDid,
}),
)
} catch (e) {
console.error('Error!', e)
return res.writeHead(500).end()
}
}).listen(1986)
console.log('Mock server manager listening on 1986')
-12
View File
@@ -1,12 +0,0 @@
{
"name": "dev-env",
"version": "0.0.0",
"scripts": {
"start": "NODE_ENV=development ./dev-infra/with-test-redis-and-db.sh ts-node ./mock-server.ts"
},
"dependencies": {
"@atproto/dev-env": "^0.3.213",
"ts-node": "^10.9.2",
"typescript": "^5.9.3"
}
}
-4308
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -47,7 +47,8 @@ Every night, a GitHub action will run `yarn intl:extract` to update the english
### Release process
1. Pull main and create a branch.
1. Run `yarn intl:release` to fetch all translation updates from Crowdin and extract all `.po` files so that they're synced with the latest code. Commit that.
1. Run `yarn intl:pull` to fetch all translation updates from Crowdin. Commit.
1. Run `yarn intl:extract:all` to ensure all `.po` files are synced with the current state of the code. Commit.
1. Create a PR, ensure the translations all look correct, and merge.
1. If needed:
1. Merge all approved translation PRs (contributions from outside crowdin).
-6
View File
@@ -3,12 +3,6 @@
Make sure you've copied `.env.example` to `.env.test` and provided any required
values.
Install dependencies in `/dev-env`
```
cd dev-env && yarn
```
## Using Maestro
1. Install Maestro by following [these instructions](https://maestro.mobile.dev/getting-started/installing-maestro). This will help us run the E2E tests.
-1
View File
@@ -37,7 +37,6 @@ export default defineConfig(
'*.e2e.ts',
'*.e2e.tsx',
'eslint.config.mjs',
'.jscodeshift/**',
],
},
@@ -25,8 +25,8 @@ class BottomSheetModule : Module() {
view.dismiss()
}
Prop("fullHeight") { view: BottomSheetView, prop: Boolean ->
view.fullHeight = prop
AsyncFunction("updateLayout") { view: BottomSheetView ->
view.updateLayout()
}
Prop("disableDrag") { view: BottomSheetView, prop: Boolean ->
@@ -8,7 +8,10 @@ import android.view.ViewStructure
import android.view.Window
import android.view.accessibility.AccessibilityEvent
import android.widget.FrameLayout
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import androidx.core.view.allViews
import com.facebook.react.bridge.LifecycleEventListener
import com.facebook.react.bridge.ReactContext
import com.facebook.react.bridge.UiThreadUtil
@@ -31,20 +34,11 @@ class BottomSheetView(
private lateinit var dialogRootViewGroup: DialogRootViewGroup
private var eventDispatcher: EventDispatcher? = null
private var isKeyboardVisible: Boolean = false
// Native content height observation (eliminates JS bridge round-trip)
private var contentLayoutListener: View.OnLayoutChangeListener? = null
private var observedChildren: List<View> = emptyList()
private var lastObservedContentHeight: Float = 0f
private var pendingLayoutUpdate: Boolean = false
private val screenHeight: Float =
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.VANILLA_ICE_CREAM) {
context.resources.displayMetrics.heightPixels.toFloat()
} else {
val wm = context.getSystemService(Context.WINDOW_SERVICE) as android.view.WindowManager
wm.currentWindowMetrics.bounds.height().toFloat()
}
private val screenHeight =
context.resources.displayMetrics.heightPixels
.toFloat()
private fun getNavigationBarHeight(): Int {
val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")
@@ -70,15 +64,8 @@ class BottomSheetView(
set(value) {
field = value
this.dialog?.setCancelable(!value)
// Full-height sheets have no half-expanded snap point, so any drag
// would dismiss. Disable dragging when dismiss is prevented.
if (fullHeight) {
this.setDraggable(!value && !disableDrag)
}
}
var fullHeight = false
var preventExpansion = false
var minHeight = 0f
@@ -142,7 +129,6 @@ class BottomSheetView(
}
private fun destroy() {
this.stopObservingContentHeight()
this.isClosing = false
this.isOpen = false
this.dialog = null
@@ -207,40 +193,31 @@ class BottomSheetView(
val bottomSheet = dialog.findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet)
bottomSheet?.let {
it.setBackgroundColor(0)
it.elevation = 0f
val behavior = BottomSheetBehavior.from(it)
behavior.state = BottomSheetBehavior.STATE_HIDDEN
behavior.isFitToContents = true
behavior.halfExpandedRatio = getHalfExpandedRatio(contentHeight)
behavior.skipCollapsed = true
behavior.isDraggable = true
behavior.isHideable = true
if (fullHeight) {
behavior.isFitToContents = false
behavior.expandedOffset = getStatusBarHeight()
if (preventExpansion) {
behavior.maxHeight = (behavior.halfExpandedRatio * screenHeight).toInt()
} else {
behavior.maxHeight = (screenHeight - getStatusBarHeight()).toInt()
}
val targetHeight = this.getTargetHeight()
val availableHeight = screenHeight - getStatusBarHeight() - getNavigationBarHeight()
val shouldBeExpanded = targetHeight >= availableHeight
if (shouldBeExpanded) {
behavior.state = BottomSheetBehavior.STATE_EXPANDED
this.selectedSnapPoint = 2
} else if (preventExpansion) {
behavior.isFitToContents = true
behavior.halfExpandedRatio = getHalfExpandedRatio(contentHeight)
behavior.maxHeight = (behavior.halfExpandedRatio * screenHeight).toInt()
} else {
behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
this.selectedSnapPoint = 1
} else {
behavior.isFitToContents = false
behavior.halfExpandedRatio = getHalfExpandedRatio(contentHeight)
behavior.expandedOffset = getStatusBarHeight()
val targetHeight = this.getTargetHeight()
val availableHeight = screenHeight - getStatusBarHeight() - getNavigationBarHeight()
val shouldBeExpanded = targetHeight >= availableHeight
if (shouldBeExpanded) {
behavior.state = BottomSheetBehavior.STATE_EXPANDED
this.selectedSnapPoint = 2
} else {
behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
this.selectedSnapPoint = 1
}
}
behavior.addBottomSheetCallback(
@@ -249,23 +226,12 @@ class BottomSheetView(
bottomSheet: View,
newState: Int,
) {
if (newState == BottomSheetBehavior.STATE_EXPANDED && preventExpansion) {
behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
return
}
when (newState) {
BottomSheetBehavior.STATE_EXPANDED -> selectedSnapPoint = 2
BottomSheetBehavior.STATE_COLLAPSED -> selectedSnapPoint = 1
BottomSheetBehavior.STATE_HALF_EXPANDED -> selectedSnapPoint = 1
BottomSheetBehavior.STATE_HIDDEN -> selectedSnapPoint = 0
}
// Apply deferred layout update after gesture completes
if (newState != BottomSheetBehavior.STATE_DRAGGING &&
newState != BottomSheetBehavior.STATE_SETTLING &&
pendingLayoutUpdate) {
pendingLayoutUpdate = false
updateLayout()
}
}
override fun onSlide(
@@ -279,14 +245,25 @@ class BottomSheetView(
this.isOpening = true
dialog.show()
this.dialog = dialog
if (!fullHeight) {
this.startObservingContentHeight()
}
ViewCompat.setOnApplyWindowInsetsListener(dialogRootViewGroup) { view, insets ->
val imeVisible = insets.isVisible(WindowInsetsCompat.Type.ime())
val bottomSheet = dialog.findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet)
val behavior = bottomSheet?.let { BottomSheetBehavior.from(it) }
val wasKeyboardVisible = isKeyboardVisible
isKeyboardVisible = imeVisible
if (imeVisible && behavior?.state == BottomSheetBehavior.STATE_HALF_EXPANDED) {
behavior.state = BottomSheetBehavior.STATE_EXPANDED
} else if (!imeVisible && wasKeyboardVisible) {
updateLayout()
}
insets
}
}
fun updateLayout() {
if (fullHeight) return
val dialog = this.dialog ?: return
val contentHeight = this.getContentHeight()
@@ -297,34 +274,21 @@ class BottomSheetView(
val oldRatio = behavior.halfExpandedRatio
val newRatio = getHalfExpandedRatio(contentHeight)
behavior.halfExpandedRatio = newRatio
if (preventExpansion) {
behavior.maxHeight = (behavior.halfExpandedRatio * screenHeight).toInt()
}
val targetHeight = this.getTargetHeight()
val availableHeight = screenHeight - getStatusBarHeight() - getNavigationBarHeight()
val shouldBeExpanded = targetHeight >= availableHeight
// Don't update during user gestures — defer until the gesture completes.
if (currentState == BottomSheetBehavior.STATE_DRAGGING) {
pendingLayoutUpdate = true
return
}
behavior.halfExpandedRatio = newRatio
if (preventExpansion) {
behavior.maxHeight = (behavior.halfExpandedRatio * screenHeight).toInt()
it.requestLayout()
}
// During settling (programmatic animation from our own state change),
// redirect the animation to the new position if the ratio changed.
if (currentState == BottomSheetBehavior.STATE_SETTLING) {
if (oldRatio != newRatio) {
behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
if (isKeyboardVisible) {
if (behavior.state != BottomSheetBehavior.STATE_EXPANDED) {
behavior.state = BottomSheetBehavior.STATE_EXPANDED
}
return
}
if (shouldBeExpanded && behavior.state != BottomSheetBehavior.STATE_EXPANDED && !preventExpansion) {
} else if (shouldBeExpanded && behavior.state != BottomSheetBehavior.STATE_EXPANDED && !preventExpansion) {
behavior.state = BottomSheetBehavior.STATE_EXPANDED
} else if (!shouldBeExpanded && behavior.state != BottomSheetBehavior.STATE_HALF_EXPANDED) {
behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
@@ -335,77 +299,21 @@ class BottomSheetView(
}
fun dismiss() {
val dialog = this.dialog ?: return
// Mark as closing so the content observer doesn't fight the dismiss
// animation by calling updateLayout() mid-hide.
this.isClosing = true
// Temporarily make cancelable so cancel() works — cancel() gives the
// slide-out animation, while dismiss() does a plain fade.
dialog.setCancelable(true)
dialog.cancel()
}
// Observe each direct child of innerView via OnLayoutChangeListener so that
// height updates are detected purely on the native side. We use OnLayoutChangeListener
// (not OnGlobalLayoutListener) because React Native calls view.layout() directly
// via Yoga, bypassing requestLayout()/performTraversals(). OnLayoutChangeListener
// fires from setFrame() which IS called by layout(), so it catches RN updates.
private fun startObservingContentHeight() {
stopObservingContentHeight()
val innerViewGroup = this.innerView as? ViewGroup ?: return
val listener = View.OnLayoutChangeListener { _, _, top, _, bottom, _, _, oldTop, oldBottom ->
val newHeight = bottom - top
val oldHeight = oldBottom - oldTop
if (newHeight != oldHeight) {
val contentHeight = getContentHeight()
if (contentHeight != lastObservedContentHeight && contentHeight > 0 && (isOpen || isOpening) && !isClosing) {
lastObservedContentHeight = contentHeight
updateLayout()
}
}
}
val children = mutableListOf<View>()
for (i in 0 until innerViewGroup.childCount) {
val child = innerViewGroup.getChildAt(i)
child.addOnLayoutChangeListener(listener)
children.add(child)
}
this.contentLayoutListener = listener
this.observedChildren = children
// Pick up current height if content is already laid out
val contentHeight = getContentHeight()
if (contentHeight > 0 && contentHeight != lastObservedContentHeight) {
lastObservedContentHeight = contentHeight
updateLayout()
}
}
private fun stopObservingContentHeight() {
contentLayoutListener?.let { listener ->
observedChildren.forEach { it.removeOnLayoutChangeListener(listener) }
}
contentLayoutListener = null
observedChildren = emptyList()
lastObservedContentHeight = 0f
this.dialog?.dismiss()
}
// Util
private fun getContentHeight(): Float {
val innerView = this.innerView as? ViewGroup ?: return 0f
// Use the tallest direct child's height. The handle is absolutely positioned
// (overlaps the content), so summing would double-count its height as padding.
var maxChildHeight = 0f
for (i in 0 until innerView.childCount) {
val h = innerView.getChildAt(i).height.toFloat()
if (h > maxChildHeight) maxChildHeight = h
val innerView = this.innerView ?: return 0f
var index = 0
innerView.allViews.forEach {
if (index == 1) {
return it.height.toFloat()
}
index++
}
return maxChildHeight
return 0f
}
private fun getTargetHeight(): Float {
@@ -1,12 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="EdgeToEdgeBottomSheetDialogTheme" parent="ThemeOverlay.Material3.DayNight.BottomSheetDialog">
<!-- Enable edge-to-edge, matching react-native-edge-to-edge's setup -->
<style name="EdgeToEdgeBottomSheetDialogTheme" parent="Theme.Material3.DayNight.BottomSheetDialog">
<!-- Enable edge-to-edge -->
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:fitsSystemWindows">false</item>
<item name="enableEdgeToEdge">true</item>
<!-- Configure bottom sheet to respect system window insets -->
@@ -18,6 +16,5 @@
<item name="paddingLeftSystemWindowInsets">true</item>
<item name="paddingRightSystemWindowInsets">true</item>
<item name="paddingTopSystemWindowInsets">false</item>
<item name="backgroundTint">@android:color/transparent</item>
</style>
</resources>
@@ -19,8 +19,8 @@ public class BottomSheetModule: Module {
view.dismiss()
}
Prop("fullHeight") { (view: SheetView, prop: Bool) in
view.fullHeight = prop
AsyncFunction("updateLayout") { (view: SheetView) in
view.updateLayout()
}
Prop("cornerRadius") { (view: SheetView, prop: Float) in
+9 -32
View File
@@ -8,9 +8,6 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
private var innerView: UIView?
private var touchHandler: RCTTouchHandler?
// Native content height observation (eliminates JS bridge round-trip)
private var contentHeightObservation: NSKeyValueObservation?
// Events
private let onAttemptDismiss = EventDispatcher()
private let onSnapPointChange = EventDispatcher()
@@ -26,7 +23,6 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
}
// React view props
var fullHeight = false
var preventDismiss = false
var preventExpansion = false
var cornerRadius: CGFloat?
@@ -72,6 +68,7 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
}
}
}
private var prevLayoutDetentIdentifier: UISheetPresentationController.Detent.Identifier?
// MARK: - Lifecycle
@@ -109,8 +106,6 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
}
private func destroy() {
self.contentHeightObservation?.invalidate()
self.contentHeightObservation = nil
self.isClosing = false
self.isOpen = false
self.sheetVc = nil
@@ -133,7 +128,7 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
}
let sheetVc = SheetViewController()
sheetVc.setDetents(contentHeight: self.clampHeight(contentHeight), preventExpansion: self.preventExpansion, fullHeight: self.fullHeight)
sheetVc.setDetents(contentHeight: self.clampHeight(contentHeight), preventExpansion: self.preventExpansion)
if let sheet = sheetVc.sheetPresentationController {
sheet.delegate = self
sheet.preferredCornerRadius = self.cornerRadius
@@ -152,9 +147,6 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
self.sheetVc = sheetVc
self.isOpening = true
if !self.fullHeight {
self.startObservingContentHeight()
}
rvc.present(sheetVc, animated: true) { [weak self] in
self?.isOpening = false
@@ -162,30 +154,15 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
}
}
// Observe the content view's bounds via KVO so that height changes are detected
// purely on the native side, without a JS bridge round-trip through onLayout.
// Calls updateDetents directly with the observed height rather than going through
// updateLayout(), which has a prevLayoutDetentIdentifier guard that can block
// legitimate content-driven updates when detent identifiers drift during animations.
private func startObservingContentHeight() {
self.contentHeightObservation?.invalidate()
guard let contentView = self.innerView?.subviews.first else { return }
self.contentHeightObservation = contentView.observe(
\.bounds,
options: [.old, .new]
) { [weak self] _, change in
guard let self = self,
(self.isOpen || self.isOpening) && !self.isClosing,
let oldBounds = change.oldValue,
let newBounds = change.newValue,
oldBounds.height != newBounds.height,
newBounds.height > 0 else { return }
let clampedHeight = self.clampHeight(newBounds.height)
self.sheetVc?.updateDetents(contentHeight: clampedHeight, preventExpansion: self.preventExpansion)
func updateLayout() {
// Allow updates either when identifiers match OR when prevLayoutDetentIdentifier is nil (first real content update)
if self.prevLayoutDetentIdentifier == self.selectedDetentIdentifier || self.prevLayoutDetentIdentifier == nil,
let contentHeight = self.innerView?.subviews.first?.frame.size.height {
self.sheetVc?.updateDetents(contentHeight: self.clampHeight(contentHeight),
preventExpansion: self.preventExpansion)
self.selectedDetentIdentifier = self.sheetVc?.getCurrentDetentIdentifier()
}
self.prevLayoutDetentIdentifier = self.selectedDetentIdentifier
}
func dismiss() {
@@ -20,19 +20,13 @@ class SheetViewController: UIViewController {
}
}
func setDetents(contentHeight: CGFloat, preventExpansion: Bool, fullHeight: Bool = false) {
func setDetents(contentHeight: CGFloat, preventExpansion: Bool) {
guard let sheet = self.sheetPresentationController,
let screenHeight = Util.getScreenHeight()
else {
return
}
if fullHeight {
sheet.detents = [.large()]
sheet.selectedDetentIdentifier = .large
return
}
// On iOS 26, the floaty sheet presentation adds the device bottom safe area
// on top of the custom detent value, creating visible padding inside the pill.
// Subtract it so the pill height matches our actual content.
@@ -26,7 +26,6 @@ export interface BottomSheetViewProps {
disableDrag?: boolean
sourceViewTag?: number
fullHeight?: boolean
minHeight?: number
maxHeight?: number
@@ -12,6 +12,7 @@ import {
import {useSafeAreaInsets} from 'react-native-safe-area-context'
import {requireNativeModule, requireNativeViewManager} from 'expo-modules-core'
import {IS_IOS} from '#/env'
import {
type BottomSheetState,
type BottomSheetViewProps,
@@ -34,10 +35,6 @@ const IS_IOS15 =
Platform.OS === 'ios' &&
// semvar - can be 3 segments, so can't use Number(Platform.Version)
Number(Platform.Version.split('.').at(0)) < 16
// older android versions (15 and below) aren't naturally edge-to-edge
// and behave a little differently
const IS_NON_E2E_ANDROID =
Platform.OS === 'android' && Number(Platform.Version) < 35
export class BottomSheetNativeComponent extends React.Component<
BottomSheetViewProps,
@@ -74,6 +71,10 @@ export class BottomSheetNativeComponent extends React.Component<
this.props.onStateChange?.(event)
}
private updateLayout = () => {
this.ref.current?.updateLayout()
}
static dismissAll = async () => {
await NativeModule.dismissAll()
}
@@ -112,14 +113,23 @@ export class BottomSheetNativeComponent extends React.Component<
nativeViewRef={this.ref}
onStateChange={this.onStateChange}
extraStyles={extraStyles}
onLayout={
IS_IOS15
? e => {
const {height} = e.nativeEvent.layout
this.setState({viewHeight: height})
}
: undefined
}
onLayout={e => {
if (IS_IOS15) {
const {height} = e.nativeEvent.layout
this.setState({viewHeight: height})
}
if (Platform.OS === 'android') {
// TEMP HACKFIX: I had to timebox this, but this is Bad.
// On Android, if you run updateLayout() immediately,
// it will take ages to actually run on the native side.
// However, adding literally any delay will fix this, including
// a console.log() - just sending the log to the CLI is enough.
// TODO: Get to the bottom of this and fix it properly! -sfn
setTimeout(() => this.updateLayout())
} else {
this.updateLayout()
}
}}
/>
</Portal>
)
@@ -140,18 +150,13 @@ function BottomSheetNativeComponentInner({
event: NativeSyntheticEvent<{state: BottomSheetState}>,
) => void
nativeViewRef: React.RefObject<View>
onLayout?: (event: LayoutChangeEvent) => void
onLayout: (event: LayoutChangeEvent) => void
}) {
const insets = useSafeAreaInsets()
const cornerRadius = rest.cornerRadius ?? 0
const {height: screenHeight} = useWindowDimensions()
// sigh... on older Android versions, screenHeight does not include safe area insets
// on newer Androids + iOS, it does. we need to find the inner bit + the bottom inset
// for the sheet content
const sheetHeight = IS_NON_E2E_ANDROID
? screenHeight + insets.bottom
: screenHeight - insets.top
const sheetHeight = IS_IOS ? screenHeight - insets.top : screenHeight
return (
<NativeView
+28 -30
View File
@@ -1,6 +1,6 @@
{
"name": "bsky.app",
"version": "1.119.0",
"version": "1.118.0",
"private": true,
"engines": {
"node": ">=20"
@@ -52,7 +52,7 @@
"lint-native": "swiftlint ./modules && ktlint ./modules",
"lint-native:fix": "swiftlint --fix ./modules && ktlint --format ./modules",
"typecheck": "tsc --project ./tsconfig.check.json",
"e2e:mock-server": "cd dev-env && yarn start",
"e2e:mock-server": "NODE_ENV=development ./jest/dev-infra/with-test-redis-and-db.sh ts-node --project tsconfig.e2e.json __e2e__/mock-server.ts",
"e2e:build": "EXPO_PUBLIC_ENV=e2e NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo run:ios",
"e2e:build-android": "EXPO_PUBLIC_ENV=e2e NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo run:android",
"e2e:start": "EXPO_PUBLIC_ENV=e2e NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo start -c",
@@ -70,7 +70,6 @@
"intl:pull": "crowdin download translations --verbose -b main",
"intl:push": "crowdin push translations --verbose -b main",
"intl:push-sources": "crowdin push sources --verbose -b main",
"intl:release": "yarn intl:pull && yarn intl:extract:all",
"nuke": "rm -rf ./node_modules && rm -rf ./ios && rm -rf ./android",
"update-extensions": "bash scripts/updateExtensions.sh",
"export": "npx expo export --dump-sourcemap && yarn upload-native-sourcemaps",
@@ -86,7 +85,7 @@
"@braintree/sanitize-url": "^6.0.2",
"@bsky.app/alf": "^0.1.7",
"@bsky.app/expo-image-crop-tool": "^0.5.0",
"@bsky.app/expo-translate-text": "^0.2.9",
"@bsky.app/expo-translate-text": "^0.2.7",
"@bsky.app/react-native-mmkv": "2.12.5",
"@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet",
"@emoji-mart/data": "^1.2.1",
@@ -113,9 +112,9 @@
"@miblanchard/react-native-slider": "^2.6.0",
"@mozzius/expo-dynamic-app-icon": "^1.8.0",
"@react-native-async-storage/async-storage": "2.2.0",
"@react-navigation/bottom-tabs": "^7.15.5",
"@react-navigation/native": "^7.1.33",
"@react-navigation/native-stack": "^7.14.4",
"@react-navigation/bottom-tabs": "^7.9.0",
"@react-navigation/native": "^7.1.26",
"@react-navigation/native-stack": "^7.9.0",
"@sentry/react-native": "~6.20.0",
"@tanstack/query-async-storage-persister": "^5.25.0",
"@tanstack/react-query": "5.25.0",
@@ -144,7 +143,7 @@
"emoji-mart": "^5.6.0",
"emoji-regex": "^10.4.0",
"eventemitter3": "^5.0.1",
"expo": "^54.0.33",
"expo": "^54.0.27",
"expo-application": "~7.0.8",
"expo-blur": "~15.0.8",
"expo-build-properties": "~1.0.10",
@@ -153,28 +152,28 @@
"expo-contacts": "^15.0.10",
"expo-dev-client": "~6.0.20",
"expo-device": "~8.0.10",
"expo-file-system": "~19.0.21",
"expo-font": "~14.0.11",
"expo-file-system": "~19.0.20",
"expo-font": "~14.0.10",
"expo-haptics": "~15.0.8",
"expo-image": "~3.0.11",
"expo-image-manipulator": "~14.0.8",
"expo-image-picker": "~17.0.10",
"expo-image-picker": "~17.0.9",
"expo-intent-launcher": "~13.0.8",
"expo-keep-awake": "~15.0.8",
"expo-linear-gradient": "~15.0.8",
"expo-linking": "~8.0.11",
"expo-linking": "~8.0.10",
"expo-localization": "~17.0.8",
"expo-location": "~19.0.8",
"expo-media-library": "~18.2.1",
"expo-notifications": "~0.32.16",
"expo-notifications": "~0.32.14",
"expo-privacy-sensitive": "^0.1.0",
"expo-screen-orientation": "~9.0.8",
"expo-sharing": "~14.0.8",
"expo-sms": "^14.0.7",
"expo-splash-screen": "~31.0.13",
"expo-splash-screen": "~31.0.12",
"expo-system-ui": "~6.0.9",
"expo-updates": "~29.0.16",
"expo-video": "~3.0.16",
"expo-updates": "~29.0.14",
"expo-video": "~3.0.15",
"expo-video-thumbnails": "^10.0.8",
"expo-web-browser": "~15.0.10",
"fast-deep-equal": "^3.1.3",
@@ -206,16 +205,16 @@
"react-native-compressor": "^1.13.0",
"react-native-date-picker": "^5.0.13",
"react-native-device-attest": "^0.1.6",
"react-native-drawer-layout": "^4.2.2",
"react-native-drawer-layout": "^4.2.1",
"react-native-edge-to-edge": "^1.6.0",
"react-native-gesture-handler": "~2.28.0",
"react-native-keyboard-controller": "^1.21.0",
"react-native-keyboard-controller": "^1.20.7",
"react-native-pager-view": "6.8.0",
"react-native-progress": "bluesky-social/react-native-progress",
"react-native-qrcode-styled": "^0.3.3",
"react-native-reanimated": "^3.19.1",
"react-native-safe-area-context": "~5.6.0",
"react-native-screens": "^4.24.0",
"react-native-screens": "^4.19.0",
"react-native-svg": "15.12.1",
"react-native-uitextview": "^1.4.0",
"react-native-uuid": "^2.0.3",
@@ -236,12 +235,12 @@
"zod": "^3.20.2"
},
"devDependencies": {
"@atproto/dev-env": "^0.3.209",
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@babel/runtime": "^7.26.0",
"@crowdin/cli": "^4.14.1",
"@eslint/js": "^9.39.2",
"@expo/config-plugins": "~54.0.4",
"@expo/config-plugins": "~54.0.1",
"@lingui/babel-plugin-lingui-macro": "^5.9.2",
"@lingui/cli": "^5.9.2",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
@@ -260,7 +259,7 @@
"babel-jest": "^29.7.0",
"babel-plugin-module-resolver": "^5.0.2",
"babel-plugin-react-compiler": "^19.1.0-rc.3",
"babel-preset-expo": "~54.0.10",
"babel-preset-expo": "~54.0.0",
"eslint": "^9.39.2",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-bsky-internal": "link:./eslint",
@@ -277,7 +276,7 @@
"husky": "^8.0.3",
"is-ci": "^3.0.1",
"jest": "^29.7.0",
"jest-expo": "~54.0.17",
"jest-expo": "~54.0.14",
"jest-junit": "^16.0.0",
"lint-staged": "^13.2.3",
"lockfile-lint": "^4.14.0",
@@ -285,6 +284,7 @@
"react-native-dotenv": "^3.4.11",
"react-refresh": "^0.14.0",
"svgo": "^3.3.2",
"ts-node": "^10.9.1",
"ts-plugin-sort-import-suggestions": "^1.0.4",
"typescript": "^5.9.3",
"typescript-eslint": "^8.56.0",
@@ -293,15 +293,13 @@
"resolutions": {
"@react-native/babel-preset": "0.81.5",
"@react-native/normalize-colors": "0.81.5",
"**/@expo/image-utils": "0.8.12",
"**/@expo/image-utils": "0.8.7",
"**/@react-native-async-storage/async-storage": "2.2.0",
"**/expo-constants": "18.0.8",
"**/expo-device": "7.1.4",
"**/multiformats": "9.9.0",
"unicode-segmenter": "0.14.5",
"@types/estree": "1.0.6",
"metro": "0.83.3",
"metro-core": "0.83.3",
"metro-config": "0.83.3",
"metro-runtime": "0.83.3",
"metro-source-map": "0.83.3"
"@types/estree": "1.0.6"
},
"jest": {
"preset": "jest-expo/ios",
+44
View File
@@ -0,0 +1,44 @@
diff --git a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultLauncher.kt b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultLauncher.kt
index d300fc2..0890878 100644
--- a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultLauncher.kt
+++ b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultLauncher.kt
@@ -3,8 +3,8 @@ package expo.modules.kotlin.activityresult
import androidx.activity.result.ActivityResultCallback
import androidx.activity.result.contract.ActivityResultContract
import java.io.Serializable
+import kotlinx.coroutines.suspendCancellableCoroutine
import kotlin.coroutines.resume
-import kotlin.coroutines.suspendCoroutine
/**
* A launcher for a previously-[AppContextActivityResultCaller.registerForActivityResult] prepared call
@@ -22,8 +22,12 @@ abstract class AppContextActivityResultLauncher<I : Serializable, O> {
*/
abstract fun launch(input: I, callback: ActivityResultCallback<O>)
- suspend fun launch(input: I): O = suspendCoroutine { continuation ->
- launch(input) { output -> continuation.resume(output) }
+ suspend fun launch(input: I): O = suspendCancellableCoroutine { continuation ->
+ launch(input) { output ->
+ if (continuation.isActive) {
+ continuation.resume(output)
+ }
+ }
}
abstract val contract: AppContextActivityResultContract<I, O>
diff --git a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt
index 47c4d15..afe138d 100644
--- a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt
+++ b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt
@@ -125,6 +125,10 @@ internal fun peekResponseBody(
}
internal fun shouldParseBody(response: Response): Boolean {
+ if (response.request.url.encodedPath == "/bitdrift_public.protobuf.client.v1.ApiService/Mux") {
+ return false
+ }
+
// Check for Content-Type
val skipContentTypes = listOf(
"text/event-stream", // Server Sent Events
-15
View File
@@ -1,15 +0,0 @@
diff --git a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt
index 47c4d15..afe138d 100644
--- a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt
+++ b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt
@@ -125,6 +125,10 @@ internal fun peekResponseBody(
}
internal fun shouldParseBody(response: Response): Boolean {
+ if (response.request.url.encodedPath == "/bitdrift_public.protobuf.client.v1.ApiService/Mux") {
+ return false
+ }
+
// Check for Content-Type
val skipContentTypes = listOf(
"text/event-stream", // Server Sent Events
+992
View File
@@ -0,0 +1,992 @@
diff --git a/node_modules/expo-notifications/android/.gradle/8.10/checksums/checksums.lock b/node_modules/expo-notifications/android/.gradle/8.10/checksums/checksums.lock
new file mode 100644
index 0000000..883ef6a
Binary files /dev/null and b/node_modules/expo-notifications/android/.gradle/8.10/checksums/checksums.lock differ
diff --git a/node_modules/expo-notifications/android/.gradle/8.10/dependencies-accessors/gc.properties b/node_modules/expo-notifications/android/.gradle/8.10/dependencies-accessors/gc.properties
new file mode 100644
index 0000000..e69de29
diff --git a/node_modules/expo-notifications/android/.gradle/8.10/fileChanges/last-build.bin b/node_modules/expo-notifications/android/.gradle/8.10/fileChanges/last-build.bin
new file mode 100644
index 0000000..f76dd23
Binary files /dev/null and b/node_modules/expo-notifications/android/.gradle/8.10/fileChanges/last-build.bin differ
diff --git a/node_modules/expo-notifications/android/.gradle/8.10/fileHashes/fileHashes.lock b/node_modules/expo-notifications/android/.gradle/8.10/fileHashes/fileHashes.lock
new file mode 100644
index 0000000..774caf7
Binary files /dev/null and b/node_modules/expo-notifications/android/.gradle/8.10/fileHashes/fileHashes.lock differ
diff --git a/node_modules/expo-notifications/android/.gradle/8.10/gc.properties b/node_modules/expo-notifications/android/.gradle/8.10/gc.properties
new file mode 100644
index 0000000..e69de29
diff --git a/node_modules/expo-notifications/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/node_modules/expo-notifications/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
new file mode 100644
index 0000000..a3c1514
Binary files /dev/null and b/node_modules/expo-notifications/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/node_modules/expo-notifications/android/.gradle/buildOutputCleanup/cache.properties b/node_modules/expo-notifications/android/.gradle/buildOutputCleanup/cache.properties
new file mode 100644
index 0000000..0e5b4da
--- /dev/null
+++ b/node_modules/expo-notifications/android/.gradle/buildOutputCleanup/cache.properties
@@ -0,0 +1,2 @@
+#Thu Apr 24 20:44:36 PDT 2025
+gradle.version=8.10
diff --git a/node_modules/expo-notifications/android/.gradle/config.properties b/node_modules/expo-notifications/android/.gradle/config.properties
new file mode 100644
index 0000000..0bd71c6
--- /dev/null
+++ b/node_modules/expo-notifications/android/.gradle/config.properties
@@ -0,0 +1,2 @@
+#Thu Apr 24 20:44:32 PDT 2025
+java.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home
diff --git a/node_modules/expo-notifications/android/.gradle/vcs-1/gc.properties b/node_modules/expo-notifications/android/.gradle/vcs-1/gc.properties
new file mode 100644
index 0000000..e69de29
diff --git a/node_modules/expo-notifications/android/.idea/.gitignore b/node_modules/expo-notifications/android/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/node_modules/expo-notifications/android/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/node_modules/expo-notifications/android/.idea/AndroidProjectSystem.xml b/node_modules/expo-notifications/android/.idea/AndroidProjectSystem.xml
new file mode 100644
index 0000000..4a53bee
--- /dev/null
+++ b/node_modules/expo-notifications/android/.idea/AndroidProjectSystem.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="AndroidProjectSystem">
+ <option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
+ </component>
+</project>
\ No newline at end of file
diff --git a/node_modules/expo-notifications/android/.idea/caches/deviceStreaming.xml b/node_modules/expo-notifications/android/.idea/caches/deviceStreaming.xml
new file mode 100644
index 0000000..9e9ba09
--- /dev/null
+++ b/node_modules/expo-notifications/android/.idea/caches/deviceStreaming.xml
@@ -0,0 +1,607 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="DeviceStreaming">
+ <option name="deviceSelectionList">
+ <list>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="27" />
+ <option name="brand" value="DOCOMO" />
+ <option name="codename" value="F01L" />
+ <option name="id" value="F01L" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="FUJITSU" />
+ <option name="name" value="F-01L" />
+ <option name="screenDensity" value="360" />
+ <option name="screenX" value="720" />
+ <option name="screenY" value="1280" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="OnePlus" />
+ <option name="codename" value="OP5552L1" />
+ <option name="id" value="OP5552L1" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="OnePlus" />
+ <option name="name" value="CPH2415" />
+ <option name="screenDensity" value="480" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2412" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="OPPO" />
+ <option name="codename" value="OP573DL1" />
+ <option name="id" value="OP573DL1" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="OPPO" />
+ <option name="name" value="CPH2557" />
+ <option name="screenDensity" value="480" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2400" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="28" />
+ <option name="brand" value="DOCOMO" />
+ <option name="codename" value="SH-01L" />
+ <option name="id" value="SH-01L" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="SHARP" />
+ <option name="name" value="AQUOS sense2 SH-01L" />
+ <option name="screenDensity" value="480" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2160" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="Lenovo" />
+ <option name="codename" value="TB370FU" />
+ <option name="formFactor" value="Tablet" />
+ <option name="id" value="TB370FU" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Lenovo" />
+ <option name="name" value="Tab P12" />
+ <option name="screenDensity" value="340" />
+ <option name="screenX" value="1840" />
+ <option name="screenY" value="2944" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="a15" />
+ <option name="id" value="a15" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="A15" />
+ <option name="screenDensity" value="450" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2340" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="a35x" />
+ <option name="id" value="a35x" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="A35" />
+ <option name="screenDensity" value="450" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2340" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="31" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="a51" />
+ <option name="id" value="a51" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy A51" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2400" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="google" />
+ <option name="codename" value="akita" />
+ <option name="id" value="akita" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 8a" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2400" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="motorola" />
+ <option name="codename" value="arcfox" />
+ <option name="id" value="arcfox" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Motorola" />
+ <option name="name" value="razr plus 2024" />
+ <option name="screenDensity" value="360" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="1272" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="33" />
+ <option name="brand" value="motorola" />
+ <option name="codename" value="austin" />
+ <option name="id" value="austin" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Motorola" />
+ <option name="name" value="moto g 5G (2022)" />
+ <option name="screenDensity" value="280" />
+ <option name="screenX" value="720" />
+ <option name="screenY" value="1600" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="33" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="b0q" />
+ <option name="id" value="b0q" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy S22 Ultra" />
+ <option name="screenDensity" value="600" />
+ <option name="screenX" value="1440" />
+ <option name="screenY" value="3088" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="32" />
+ <option name="brand" value="google" />
+ <option name="codename" value="bluejay" />
+ <option name="id" value="bluejay" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 6a" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2400" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="google" />
+ <option name="codename" value="caiman" />
+ <option name="id" value="caiman" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 9 Pro" />
+ <option name="screenDensity" value="360" />
+ <option name="screenX" value="960" />
+ <option name="screenY" value="2142" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="google" />
+ <option name="codename" value="comet" />
+ <option name="default" value="true" />
+ <option name="id" value="comet" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 9 Pro Fold" />
+ <option name="screenDensity" value="390" />
+ <option name="screenX" value="2076" />
+ <option name="screenY" value="2152" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="29" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="crownqlteue" />
+ <option name="id" value="crownqlteue" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy Note9" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="2220" />
+ <option name="screenY" value="1080" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="dm2q" />
+ <option name="id" value="dm2q" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="S23 Plus" />
+ <option name="screenDensity" value="450" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2340" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="dm3q" />
+ <option name="id" value="dm3q" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy S23 Ultra" />
+ <option name="screenDensity" value="600" />
+ <option name="screenX" value="1440" />
+ <option name="screenY" value="3088" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="e1q" />
+ <option name="default" value="true" />
+ <option name="id" value="e1q" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy S24" />
+ <option name="screenDensity" value="480" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2340" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="e3q" />
+ <option name="id" value="e3q" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy S24 Ultra" />
+ <option name="screenDensity" value="450" />
+ <option name="screenX" value="1440" />
+ <option name="screenY" value="3120" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="33" />
+ <option name="brand" value="google" />
+ <option name="codename" value="eos" />
+ <option name="id" value="eos" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Eos" />
+ <option name="screenDensity" value="320" />
+ <option name="screenX" value="384" />
+ <option name="screenY" value="384" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="33" />
+ <option name="brand" value="google" />
+ <option name="codename" value="felix" />
+ <option name="id" value="felix" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel Fold" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="2208" />
+ <option name="screenY" value="1840" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="google" />
+ <option name="codename" value="felix" />
+ <option name="id" value="felix" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel Fold" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="2208" />
+ <option name="screenY" value="1840" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="33" />
+ <option name="brand" value="google" />
+ <option name="codename" value="felix_camera" />
+ <option name="id" value="felix_camera" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel Fold (Camera-enabled)" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="2208" />
+ <option name="screenY" value="1840" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="motorola" />
+ <option name="codename" value="fogona" />
+ <option name="id" value="fogona" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Motorola" />
+ <option name="name" value="moto g play - 2024" />
+ <option name="screenDensity" value="280" />
+ <option name="screenX" value="720" />
+ <option name="screenY" value="1600" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="g0q" />
+ <option name="id" value="g0q" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="SM-S906U1" />
+ <option name="screenDensity" value="450" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2340" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="gta9pwifi" />
+ <option name="id" value="gta9pwifi" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="SM-X210" />
+ <option name="screenDensity" value="240" />
+ <option name="screenX" value="1200" />
+ <option name="screenY" value="1920" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="gts7xllite" />
+ <option name="id" value="gts7xllite" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="SM-T738U" />
+ <option name="screenDensity" value="340" />
+ <option name="screenX" value="1600" />
+ <option name="screenY" value="2560" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="33" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="gts8uwifi" />
+ <option name="formFactor" value="Tablet" />
+ <option name="id" value="gts8uwifi" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy Tab S8 Ultra" />
+ <option name="screenDensity" value="320" />
+ <option name="screenX" value="1848" />
+ <option name="screenY" value="2960" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="gts8wifi" />
+ <option name="formFactor" value="Tablet" />
+ <option name="id" value="gts8wifi" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy Tab S8" />
+ <option name="screenDensity" value="274" />
+ <option name="screenX" value="1600" />
+ <option name="screenY" value="2560" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="gts9fe" />
+ <option name="id" value="gts9fe" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy Tab S9 FE 5G" />
+ <option name="screenDensity" value="280" />
+ <option name="screenX" value="1440" />
+ <option name="screenY" value="2304" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="google" />
+ <option name="codename" value="husky" />
+ <option name="id" value="husky" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 8 Pro" />
+ <option name="screenDensity" value="390" />
+ <option name="screenX" value="1008" />
+ <option name="screenY" value="2244" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="30" />
+ <option name="brand" value="motorola" />
+ <option name="codename" value="java" />
+ <option name="id" value="java" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Motorola" />
+ <option name="name" value="G20" />
+ <option name="screenDensity" value="280" />
+ <option name="screenX" value="720" />
+ <option name="screenY" value="1600" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="google" />
+ <option name="codename" value="komodo" />
+ <option name="id" value="komodo" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 9 Pro XL" />
+ <option name="screenDensity" value="360" />
+ <option name="screenX" value="1008" />
+ <option name="screenY" value="2244" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="33" />
+ <option name="brand" value="google" />
+ <option name="codename" value="lynx" />
+ <option name="id" value="lynx" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 7a" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2400" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="33" />
+ <option name="brand" value="motorola" />
+ <option name="codename" value="maui" />
+ <option name="id" value="maui" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Motorola" />
+ <option name="name" value="moto g play - 2023" />
+ <option name="screenDensity" value="280" />
+ <option name="screenX" value="720" />
+ <option name="screenY" value="1600" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="o1q" />
+ <option name="id" value="o1q" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy S21" />
+ <option name="screenDensity" value="421" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2400" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="31" />
+ <option name="brand" value="google" />
+ <option name="codename" value="oriole" />
+ <option name="id" value="oriole" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 6" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2400" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="33" />
+ <option name="brand" value="google" />
+ <option name="codename" value="panther" />
+ <option name="id" value="panther" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 7" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2400" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="q5q" />
+ <option name="id" value="q5q" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy Z Fold5" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="1812" />
+ <option name="screenY" value="2176" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="q6q" />
+ <option name="id" value="q6q" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy Z Fold6" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="1856" />
+ <option name="screenY" value="2160" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="30" />
+ <option name="brand" value="google" />
+ <option name="codename" value="r11" />
+ <option name="formFactor" value="Wear OS" />
+ <option name="id" value="r11" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel Watch" />
+ <option name="screenDensity" value="320" />
+ <option name="screenX" value="384" />
+ <option name="screenY" value="384" />
+ <option name="type" value="WEAR_OS" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="r11q" />
+ <option name="id" value="r11q" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="SM-S711U" />
+ <option name="screenDensity" value="450" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2340" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="30" />
+ <option name="brand" value="google" />
+ <option name="codename" value="redfin" />
+ <option name="id" value="redfin" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 5" />
+ <option name="screenDensity" value="440" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2340" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="google" />
+ <option name="codename" value="shiba" />
+ <option name="id" value="shiba" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 8" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2400" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="samsung" />
+ <option name="codename" value="t2q" />
+ <option name="id" value="t2q" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Samsung" />
+ <option name="name" value="Galaxy S21 Plus" />
+ <option name="screenDensity" value="394" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2400" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="33" />
+ <option name="brand" value="google" />
+ <option name="codename" value="tangorpro" />
+ <option name="formFactor" value="Tablet" />
+ <option name="id" value="tangorpro" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel Tablet" />
+ <option name="screenDensity" value="320" />
+ <option name="screenX" value="1600" />
+ <option name="screenY" value="2560" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="34" />
+ <option name="brand" value="google" />
+ <option name="codename" value="tokay" />
+ <option name="default" value="true" />
+ <option name="id" value="tokay" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 9" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2424" />
+ </PersistentDeviceSelectionData>
+ <PersistentDeviceSelectionData>
+ <option name="api" value="35" />
+ <option name="brand" value="google" />
+ <option name="codename" value="tokay" />
+ <option name="default" value="true" />
+ <option name="id" value="tokay" />
+ <option name="labId" value="google" />
+ <option name="manufacturer" value="Google" />
+ <option name="name" value="Pixel 9" />
+ <option name="screenDensity" value="420" />
+ <option name="screenX" value="1080" />
+ <option name="screenY" value="2424" />
+ </PersistentDeviceSelectionData>
+ </list>
+ </option>
+ </component>
+</project>
\ No newline at end of file
diff --git a/node_modules/expo-notifications/android/.idea/gradle.xml b/node_modules/expo-notifications/android/.idea/gradle.xml
new file mode 100644
index 0000000..b838237
--- /dev/null
+++ b/node_modules/expo-notifications/android/.idea/gradle.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="GradleSettings">
+ <option name="linkedExternalProjectsSettings">
+ <GradleProjectSettings>
+ <option name="testRunner" value="CHOOSE_PER_TEST" />
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
+ <option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
+ </GradleProjectSettings>
+ </option>
+ </component>
+</project>
\ No newline at end of file
diff --git a/node_modules/expo-notifications/android/.idea/migrations.xml b/node_modules/expo-notifications/android/.idea/migrations.xml
new file mode 100644
index 0000000..f8051a6
--- /dev/null
+++ b/node_modules/expo-notifications/android/.idea/migrations.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectMigrations">
+ <option name="MigrateToGradleLocalJavaHome">
+ <set>
+ <option value="$PROJECT_DIR$" />
+ </set>
+ </option>
+ </component>
+</project>
\ No newline at end of file
diff --git a/node_modules/expo-notifications/android/.idea/misc.xml b/node_modules/expo-notifications/android/.idea/misc.xml
new file mode 100644
index 0000000..3040d03
--- /dev/null
+++ b/node_modules/expo-notifications/android/.idea/misc.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ExternalStorageConfigurationManager" enabled="true" />
+ <component name="ProjectRootManager">
+ <output url="file://$PROJECT_DIR$/build/classes" />
+ </component>
+ <component name="ProjectType">
+ <option name="id" value="Android" />
+ </component>
+</project>
\ No newline at end of file
diff --git a/node_modules/expo-notifications/android/.idea/runConfigurations.xml b/node_modules/expo-notifications/android/.idea/runConfigurations.xml
new file mode 100644
index 0000000..16660f1
--- /dev/null
+++ b/node_modules/expo-notifications/android/.idea/runConfigurations.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="RunConfigurationProducerService">
+ <option name="ignoredProducers">
+ <set>
+ <option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
+ <option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
+ <option value="com.intellij.execution.junit.PatternConfigurationProducer" />
+ <option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
+ <option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
+ <option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
+ <option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
+ <option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
+ </set>
+ </option>
+ </component>
+</project>
\ No newline at end of file
diff --git a/node_modules/expo-notifications/android/.idea/workspace.xml b/node_modules/expo-notifications/android/.idea/workspace.xml
new file mode 100644
index 0000000..df26928
--- /dev/null
+++ b/node_modules/expo-notifications/android/.idea/workspace.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="AutoImportSettings">
+ <option name="autoReloadType" value="NONE" />
+ </component>
+ <component name="ChangeListManager">
+ <list default="true" id="fed6a9c0-2e93-4b6e-953a-d1cd1e93b59f" name="Changes" comment="" />
+ <option name="SHOW_DIALOG" value="false" />
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+ <option name="LAST_RESOLUTION" value="IGNORE" />
+ </component>
+ <component name="ClangdSettings">
+ <option name="formatViaClangd" value="false" />
+ </component>
+ <component name="ProjectColorInfo"><![CDATA[{
+ "associatedIndex": 4
+}]]></component>
+ <component name="ProjectId" id="2wCjuanPzVGKP91vdmftQVgUlaM" />
+ <component name="ProjectViewState">
+ <option name="hideEmptyMiddlePackages" value="true" />
+ <option name="showLibraryContents" value="true" />
+ </component>
+ <component name="PropertiesComponent"><![CDATA[{
+ "keyToString": {
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.cidr.known.project.marker": "true",
+ "RunOnceActivity.readMode.enableVisualFormatting": "true",
+ "android.gradle.sync.needed": "true",
+ "cf.first.check.clang-format": "false",
+ "cidr.known.project.marker": "true",
+ "kotlin-language-version-configured": "true",
+ "last_opened_file_path": "/Users/hailey/bsky/social-app/node_modules/expo-notifications/android"
+ }
+}]]></component>
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
+ <component name="TaskManager">
+ <task active="true" id="Default" summary="Default task">
+ <changelist id="fed6a9c0-2e93-4b6e-953a-d1cd1e93b59f" name="Changes" comment="" />
+ <created>1745552672693</created>
+ <option name="number" value="Default" />
+ <option name="presentableId" value="Default" />
+ <updated>1745552672693</updated>
+ </task>
+ <servers />
+ </component>
+</project>
\ No newline at end of file
diff --git a/node_modules/expo-notifications/android/build.gradle b/node_modules/expo-notifications/android/build.gradle
index bc479ee..1ebfa00 100644
--- a/node_modules/expo-notifications/android/build.gradle
+++ b/node_modules/expo-notifications/android/build.gradle
@@ -42,6 +42,7 @@ dependencies {
implementation 'com.google.firebase:firebase-messaging:24.0.1'
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
+ implementation project(':expo-background-notification-handler')
if (project.findProject(':expo-modules-test-core')) {
testImplementation project(':expo-modules-test-core')
diff --git a/node_modules/expo-notifications/android/local.properties b/node_modules/expo-notifications/android/local.properties
new file mode 100644
index 0000000..ab4c86d
--- /dev/null
+++ b/node_modules/expo-notifications/android/local.properties
@@ -0,0 +1,8 @@
+## This file must *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+#
+# Location of the SDK. This is only used by Gradle.
+# For customization when using a Version Control System, please read the
+# header note.
+#Thu Apr 24 20:44:32 PDT 2025
+sdk.dir=/Users/hailey/Library/Android/sdk
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt
index 7b99e6c..45a450d 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt
@@ -15,6 +15,7 @@ import org.json.JSONObject
* This interface exists to provide a common API for both classes.
* */
interface INotificationContent : Parcelable {
+ val channelId: String?
val title: String?
val text: String?
val subText: String?
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java
index 191b64e..fe8b3c5 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java
@@ -35,6 +35,7 @@ import kotlin.coroutines.Continuation;
* Refactoring this class may require a migration strategy for the data stored in SharedPreferences.
*/
public class NotificationContent implements Parcelable, Serializable, INotificationContent {
+ private String mChannelId;
private String mTitle;
private String mText;
private String mSubtitle;
@@ -65,6 +66,11 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
}
};
+ @Nullable
+ public String getChannelId() {
+ return mChannelId;
+ }
+
@Nullable
public String getTitle() {
return mTitle;
@@ -158,6 +164,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
}
protected NotificationContent(Parcel in) {
+ mChannelId = in.readString();
mTitle = in.readString();
mText = in.readString();
mSubtitle = in.readString();
@@ -183,6 +190,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
@Override
public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(mChannelId);
dest.writeString(mTitle);
dest.writeString(mText);
dest.writeString(mSubtitle);
@@ -203,6 +211,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
private static final long serialVersionUID = 397666843266836802L;
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
+ out.writeObject(mChannelId);
out.writeObject(mTitle);
out.writeObject(mText);
out.writeObject(mSubtitle);
@@ -285,6 +294,11 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
useDefaultVibrationPattern();
}
+ public Builder setChannelId(String channelId) {
+ content.mChannelId = channelId;
+ return this;
+ }
+
public Builder setTitle(String title) {
content.mTitle = title;
return this;
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt
index 3af254c..3c77e9d 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt
@@ -11,6 +11,9 @@ import org.json.JSONObject
* */
@JvmInline
value class NotificationData(private val data: Map<String, String>) {
+ val channelId: String?
+ get() = data["channelId"]
+
val title: String?
get() = data["title"]
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt
index d2cc6cf..6a48ff2 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt
@@ -31,6 +31,8 @@ class RemoteNotificationContent(private val remoteMessage: RemoteMessage) : INot
return remoteMessage.notification?.imageUrl != null
}
+ override val channelId = remoteMessage.notification?.channelId ?: notificationData.channelId
+
override val title = remoteMessage.notification?.title ?: notificationData.title
override val text = remoteMessage.notification?.body ?: notificationData.message
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt
index 98f003f..2f745e8 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt
@@ -101,6 +101,9 @@ open class ExpoNotificationBuilder(
builder.setOngoing(content.isSticky)
// see "Notification anatomy" https://developer.android.com/develop/ui/views/notifications#Templates
+ content.channelId?.let {
+ builder.setChannelId(it)
+ }
builder.setContentTitle(content.title)
builder.setContentText(content.text)
builder.setSubText(content.subText)
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt
index 90ca4ff..9d4cb09 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt
@@ -3,6 +3,9 @@ package expo.modules.notifications.service.delegates
import android.content.Context
import android.os.Bundle
import com.google.firebase.messaging.RemoteMessage
+import expo.modules.backgroundnotificationhandler.BackgroundNotificationHandler
+import expo.modules.backgroundnotificationhandler.BackgroundNotificationHandlerInterface
+import expo.modules.backgroundnotificationhandler.ExpoBackgroundNotificationHandlerModule
import expo.modules.interfaces.taskManager.TaskServiceProviderHelper
import expo.modules.notifications.notifications.RemoteMessageSerializer
import expo.modules.notifications.notifications.background.BackgroundRemoteNotificationTaskConsumer
@@ -18,7 +21,7 @@ import expo.modules.notifications.tokens.interfaces.FirebaseTokenListener
import java.lang.ref.WeakReference
import java.util.*
-open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseMessagingDelegate {
+open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseMessagingDelegate, BackgroundNotificationHandlerInterface{
companion object {
// Unfortunately we cannot save state between instances of a service other way
// than by static properties. Fortunately, using weak references we can
@@ -105,8 +108,19 @@ open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseM
DebugLogging.logRemoteMessage("FirebaseMessagingDelegate.onMessageReceived: message", remoteMessage)
val notification = createNotification(remoteMessage)
DebugLogging.logNotification("FirebaseMessagingDelegate.onMessageReceived: notification", notification)
- NotificationsService.receive(context, notification)
- runTaskManagerTasks(context.applicationContext, RemoteMessageSerializer.toBundle(remoteMessage))
+ if (!ExpoBackgroundNotificationHandlerModule.isForegrounded) {
+ BackgroundNotificationHandler(context, this).handleMessage(remoteMessage)
+ } else {
+ NotificationsService.receive(context, notification)
+ runTaskManagerTasks(
+ context.applicationContext,
+ RemoteMessageSerializer.toBundle(remoteMessage)
+ )
+ }
+ }
+
+ override fun showMessage(remoteMessage: RemoteMessage) {
+ NotificationsService.receive(context, createNotification(remoteMessage))
}
protected fun createNotification(remoteMessage: RemoteMessage): Notification {
-170
View File
@@ -1,170 +0,0 @@
diff --git a/node_modules/expo-notifications/android/build.gradle b/node_modules/expo-notifications/android/build.gradle
index bc479ee..1ebfa00 100644
--- a/node_modules/expo-notifications/android/build.gradle
+++ b/node_modules/expo-notifications/android/build.gradle
@@ -42,6 +42,7 @@ dependencies {
implementation 'com.google.firebase:firebase-messaging:24.0.1'
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
+ implementation project(':expo-background-notification-handler')
if (project.findProject(':expo-modules-test-core')) {
testImplementation project(':expo-modules-test-core')
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt
index 7b99e6c..45a450d 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt
@@ -15,6 +15,7 @@ import org.json.JSONObject
* This interface exists to provide a common API for both classes.
* */
interface INotificationContent : Parcelable {
+ val channelId: String?
val title: String?
val text: String?
val subText: String?
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java
index 191b64e..fe8b3c5 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java
@@ -35,6 +35,7 @@ import kotlin.coroutines.Continuation;
* Refactoring this class may require a migration strategy for the data stored in SharedPreferences.
*/
public class NotificationContent implements Parcelable, Serializable, INotificationContent {
+ private String mChannelId;
private String mTitle;
private String mText;
private String mSubtitle;
@@ -65,6 +66,11 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
}
};
+ @Nullable
+ public String getChannelId() {
+ return mChannelId;
+ }
+
@Nullable
public String getTitle() {
return mTitle;
@@ -158,6 +164,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
}
protected NotificationContent(Parcel in) {
+ mChannelId = in.readString();
mTitle = in.readString();
mText = in.readString();
mSubtitle = in.readString();
@@ -183,6 +190,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
@Override
public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(mChannelId);
dest.writeString(mTitle);
dest.writeString(mText);
dest.writeString(mSubtitle);
@@ -203,6 +211,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
private static final long serialVersionUID = 397666843266836802L;
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
+ out.writeObject(mChannelId);
out.writeObject(mTitle);
out.writeObject(mText);
out.writeObject(mSubtitle);
@@ -285,6 +294,11 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
useDefaultVibrationPattern();
}
+ public Builder setChannelId(String channelId) {
+ content.mChannelId = channelId;
+ return this;
+ }
+
public Builder setTitle(String title) {
content.mTitle = title;
return this;
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt
index 3af254c..3c77e9d 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt
@@ -11,6 +11,9 @@ import org.json.JSONObject
* */
@JvmInline
value class NotificationData(private val data: Map<String, String>) {
+ val channelId: String?
+ get() = data["channelId"]
+
val title: String?
get() = data["title"]
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt
index d2cc6cf..6a48ff2 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt
@@ -31,6 +31,8 @@ class RemoteNotificationContent(private val remoteMessage: RemoteMessage) : INot
return remoteMessage.notification?.imageUrl != null
}
+ override val channelId = remoteMessage.notification?.channelId ?: notificationData.channelId
+
override val title = remoteMessage.notification?.title ?: notificationData.title
override val text = remoteMessage.notification?.body ?: notificationData.message
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt
index 98f003f..2f745e8 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt
@@ -101,6 +101,9 @@ open class ExpoNotificationBuilder(
builder.setOngoing(content.isSticky)
// see "Notification anatomy" https://developer.android.com/develop/ui/views/notifications#Templates
+ content.channelId?.let {
+ builder.setChannelId(it)
+ }
builder.setContentTitle(content.title)
builder.setContentText(content.text)
builder.setSubText(content.subText)
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt
index 90ca4ff..9d4cb09 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt
@@ -3,6 +3,9 @@ package expo.modules.notifications.service.delegates
import android.content.Context
import android.os.Bundle
import com.google.firebase.messaging.RemoteMessage
+import expo.modules.backgroundnotificationhandler.BackgroundNotificationHandler
+import expo.modules.backgroundnotificationhandler.BackgroundNotificationHandlerInterface
+import expo.modules.backgroundnotificationhandler.ExpoBackgroundNotificationHandlerModule
import expo.modules.interfaces.taskManager.TaskServiceProviderHelper
import expo.modules.notifications.notifications.RemoteMessageSerializer
import expo.modules.notifications.notifications.background.BackgroundRemoteNotificationTaskConsumer
@@ -18,7 +21,7 @@ import expo.modules.notifications.tokens.interfaces.FirebaseTokenListener
import java.lang.ref.WeakReference
import java.util.*
-open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseMessagingDelegate {
+open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseMessagingDelegate, BackgroundNotificationHandlerInterface{
companion object {
// Unfortunately we cannot save state between instances of a service other way
// than by static properties. Fortunately, using weak references we can
@@ -105,8 +108,19 @@ open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseM
DebugLogging.logRemoteMessage("FirebaseMessagingDelegate.onMessageReceived: message", remoteMessage)
val notification = createNotification(remoteMessage)
DebugLogging.logNotification("FirebaseMessagingDelegate.onMessageReceived: notification", notification)
- NotificationsService.receive(context, notification)
- runTaskManagerTasks(context.applicationContext, RemoteMessageSerializer.toBundle(remoteMessage))
+ if (!ExpoBackgroundNotificationHandlerModule.isForegrounded) {
+ BackgroundNotificationHandler(context, this).handleMessage(remoteMessage)
+ } else {
+ NotificationsService.receive(context, notification)
+ runTaskManagerTasks(
+ context.applicationContext,
+ RemoteMessageSerializer.toBundle(remoteMessage)
+ )
+ }
+ }
+
+ override fun showMessage(remoteMessage: RemoteMessage) {
+ NotificationsService.receive(context, createNotification(remoteMessage))
}
protected fun createNotification(remoteMessage: RemoteMessage): Notification {
+10 -9
View File
@@ -1,7 +1,7 @@
import '#/logger/sentry/setup'
import '#/view/icons'
import {Fragment, useEffect, useState} from 'react'
import React, {useEffect, useState} from 'react'
import {GestureHandlerRootView} from 'react-native-gesture-handler'
import {KeyboardProvider as KeyboardControllerProvider} from 'react-native-keyboard-controller'
import {
@@ -58,6 +58,7 @@ import {Provider as SelectedFeedProvider} from '#/state/shell/selected-feed'
import {Provider as StarterPackProvider} from '#/state/shell/starter-pack'
import {Provider as HiddenRepliesProvider} from '#/state/threadgate-hidden-replies'
import {TestCtrls} from '#/view/com/testing/TestCtrls'
import * as Toast from '#/view/com/util/Toast'
import {Shell} from '#/view/shell'
import {ThemeProvider as Alf} from '#/alf'
import {useColorModeTheme} from '#/alf/util/useColorModeTheme'
@@ -67,7 +68,6 @@ import {Provider as IntentDialogProvider} from '#/components/intents/IntentDialo
import {Provider as PolicyUpdateOverlayProvider} from '#/components/PolicyUpdateOverlay'
import {Provider as PortalProvider} from '#/components/Portal'
import {Provider as VideoVolumeProvider} from '#/components/Post/Embed/VideoEmbed/VideoVolumeContext'
import * as Toast from '#/components/Toast'
import {ToastOutlet} from '#/components/Toast'
import {
prefetchAgeAssuranceConfig,
@@ -111,7 +111,7 @@ prefetchLiveEvents()
prefetchAppConfig()
function InnerApp() {
const [isReady, setIsReady] = useState(false)
const [isReady, setIsReady] = React.useState(false)
const {currentAccount} = useSession()
const {resumeSession} = useSessionApi()
const theme = useColorModeTheme()
@@ -139,9 +139,10 @@ function InnerApp() {
useEffect(() => {
return listenSessionDropped(() => {
Toast.show(_(msg`Sorry! Your session expired. Please sign in again.`), {
type: 'info',
})
Toast.show(
_(msg`Sorry! Your session expired. Please sign in again.`),
'info',
)
})
}, [_])
@@ -151,7 +152,7 @@ function InnerApp() {
<ContextMenuProvider>
<Splash isReady={isReady && hasCheckedReferrer}>
<VideoVolumeProvider>
<Fragment
<React.Fragment
// Resets the entire tree below when it changes:
key={currentAccount?.did}>
<AnalyticsFeaturesContext>
@@ -207,7 +208,7 @@ function InnerApp() {
</PolicyUpdateOverlayProvider>
</QueryProvider>
</AnalyticsFeaturesContext>
</Fragment>
</React.Fragment>
</VideoVolumeProvider>
</Splash>
</ContextMenuProvider>
@@ -219,7 +220,7 @@ function InnerApp() {
function App() {
const [isReady, setReady] = useState(false)
useEffect(() => {
React.useEffect(() => {
Promise.all([initPersistedState(), Geo.resolve(), setupDeviceId]).then(() =>
setReady(true),
)
+28 -30
View File
@@ -3,7 +3,6 @@ import '#/view/icons'
import './style.css'
import {Fragment, useEffect, useState} from 'react'
import {KeyboardProvider as KeyboardControllerProvider} from 'react-native-keyboard-controller'
import {SafeAreaProvider} from 'react-native-safe-area-context'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
@@ -48,6 +47,7 @@ import {Provider as ProgressGuideProvider} from '#/state/shell/progress-guide'
import {Provider as SelectedFeedProvider} from '#/state/shell/selected-feed'
import {Provider as StarterPackProvider} from '#/state/shell/starter-pack'
import {Provider as HiddenRepliesProvider} from '#/state/threadgate-hidden-replies'
import * as Toast from '#/view/com/util/Toast'
import {Shell} from '#/view/shell/index'
import {ThemeProvider as Alf} from '#/alf'
import {useColorModeTheme} from '#/alf/util/useColorModeTheme'
@@ -58,7 +58,6 @@ import {Provider as PolicyUpdateOverlayProvider} from '#/components/PolicyUpdate
import {Provider as PortalProvider} from '#/components/Portal'
import {Provider as ActiveVideoProvider} from '#/components/Post/Embed/VideoEmbed/ActiveVideoWebContext'
import {Provider as VideoVolumeProvider} from '#/components/Post/Embed/VideoEmbed/VideoVolumeContext'
import * as Toast from '#/components/Toast'
import {ToastOutlet} from '#/components/Toast'
import {
prefetchAgeAssuranceConfig,
@@ -116,9 +115,10 @@ function InnerApp() {
useEffect(() => {
return listenSessionDropped(() => {
Toast.show(_(msg`Sorry! Your session expired. Please sign in again.`), {
type: 'info',
})
Toast.show(
_(msg`Sorry! Your session expired. Please sign in again.`),
'info',
)
})
}, [_])
@@ -212,31 +212,29 @@ function App() {
<Geo.Provider>
<AppConfigProvider>
<A11yProvider>
<KeyboardControllerProvider>
<OnboardingProvider>
<AnalyticsContext>
<SessionProvider>
<PrefsStateProvider>
<I18nProvider>
<ShellStateProvider>
<ModalStateProvider>
<DialogStateProvider>
<LightboxStateProvider>
<PortalProvider>
<StarterPackProvider>
<InnerApp />
</StarterPackProvider>
</PortalProvider>
</LightboxStateProvider>
</DialogStateProvider>
</ModalStateProvider>
</ShellStateProvider>
</I18nProvider>
</PrefsStateProvider>
</SessionProvider>
</AnalyticsContext>
</OnboardingProvider>
</KeyboardControllerProvider>
<OnboardingProvider>
<AnalyticsContext>
<SessionProvider>
<PrefsStateProvider>
<I18nProvider>
<ShellStateProvider>
<ModalStateProvider>
<DialogStateProvider>
<LightboxStateProvider>
<PortalProvider>
<StarterPackProvider>
<InnerApp />
</StarterPackProvider>
</PortalProvider>
</LightboxStateProvider>
</DialogStateProvider>
</ModalStateProvider>
</ShellStateProvider>
</I18nProvider>
</PrefsStateProvider>
</SessionProvider>
</AnalyticsContext>
</OnboardingProvider>
</A11yProvider>
</AppConfigProvider>
</Geo.Provider>
-9
View File
@@ -103,7 +103,6 @@ import {ActivityPrivacySettingsScreen} from '#/screens/Settings/ActivityPrivacyS
import {AppearanceSettingsScreen} from '#/screens/Settings/AppearanceSettings'
import {AppIconSettingsScreen} from '#/screens/Settings/AppIconSettings'
import {AppPasswordsScreen} from '#/screens/Settings/AppPasswords'
import {AutomationLabelSettingsScreen} from '#/screens/Settings/AutomationLabelSettings'
import {ContentAndMediaSettingsScreen} from '#/screens/Settings/ContentAndMediaSettings'
import {ExternalMediaPreferencesScreen} from '#/screens/Settings/ExternalMediaPreferences'
import {FindContactsSettingsScreen} from '#/screens/Settings/FindContactsSettings'
@@ -404,14 +403,6 @@ function commonScreens(Stack: typeof Flat, unreadCountLabel?: string) {
requireAuth: true,
}}
/>
<Stack.Screen
name="AutomationLabelSettings"
getComponent={() => AutomationLabelSettingsScreen}
options={{
title: title(msg`Automation Label`),
requireAuth: true,
}}
/>
<Stack.Screen
name="PrivacyAndSecuritySettings"
getComponent={() => PrivacyAndSecuritySettingsScreen}
+8 -6
View File
@@ -1,4 +1,4 @@
import {forwardRef, useCallback, useEffect, useState} from 'react'
import React, {useCallback, useEffect} from 'react'
import {
AccessibilityInfo,
Image as RNImage,
@@ -29,7 +29,7 @@ const darkSplashImageUri = RNImage.resolveAssetSource(
darkSplashImagePointer,
).uri
export const Logo = forwardRef(function LogoImpl(props: SvgProps, ref) {
export const Logo = React.forwardRef(function LogoImpl(props: SvgProps, ref) {
const width = 1000
const height = width * (67 / 64)
return (
@@ -58,10 +58,12 @@ export function Splash(props: React.PropsWithChildren<Props>) {
const outroLogo = useSharedValue(0)
const outroApp = useSharedValue(0)
const outroAppOpacity = useSharedValue(0)
const [isAnimationComplete, setIsAnimationComplete] = useState(false)
const [isImageLoaded, setIsImageLoaded] = useState(false)
const [isLayoutReady, setIsLayoutReady] = useState(false)
const [reduceMotion, setReduceMotion] = useState<boolean | undefined>(false)
const [isAnimationComplete, setIsAnimationComplete] = React.useState(false)
const [isImageLoaded, setIsImageLoaded] = React.useState(false)
const [isLayoutReady, setIsLayoutReady] = React.useState(false)
const [reduceMotion, setReduceMotion] = React.useState<boolean | undefined>(
false,
)
const isReady =
props.isReady &&
isImageLoaded &&
+3 -33
View File
@@ -12,8 +12,6 @@ import {
import {dateDiff, useGetTimeAgo} from '#/lib/hooks/useTimeAgo'
import {useIsBirthdateUpdateAllowed} from '#/state/birthdate'
import {useSessionApi} from '#/state/session'
import {DeactivateAccountDialog} from '#/screens/Settings/components/DeactivateAccountDialog'
import {DeleteAccountDialog} from '#/screens/Settings/components/DeleteAccountDialog'
import {atoms as a, useBreakpoints, useTheme, web} from '#/alf'
import {Admonition} from '#/components/Admonition'
import {AgeAssuranceAppealDialog} from '#/components/ageAssurance/AgeAssuranceAppealDialog'
@@ -51,8 +49,6 @@ export function NoAccessScreen() {
const {gtPhone} = useBreakpoints()
const insets = useSafeAreaInsets()
const birthdateControl = useDialogControl()
const deactivateAccountControl = useDialogControl()
const deleteAccountControl = useDialogControl()
const {data} = useAgeAssuranceDataContext()
const region = useAgeAssuranceRegionConfig()
const isBirthdateUpdateAllowed = useIsBirthdateUpdateAllowed()
@@ -75,7 +71,6 @@ export function NoAccessScreen() {
hasDeclaredAge,
canUpdateBirthday,
})
// TODO This can be cleaned up with useEffectEvent once we're on 19.2
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
@@ -239,38 +234,18 @@ export function NoAccessScreen() {
</View>
)}
<View style={[a.pt_lg, a.gap_xl, {maxWidth: 280}]}>
<View style={[a.pt_lg, a.gap_xl]}>
<Logo width={120} textFill={t.atoms.text.color} />
<Text
style={[
a.text_sm,
a.italic,
a.leading_snug,
t.atoms.text_contrast_medium,
]}>
<Text style={[a.text_sm, a.italic, t.atoms.text_contrast_medium]}>
<Trans>
To log out,{' '}
<SimpleInlineLinkText
label={_(msg`Click here to log out`)}
{...createStaticClick(() => {
onPressLogout()
})}
style={[a.italic]}>
})}>
click here
</SimpleInlineLinkText>
. Or if youd prefer, you can{' '}
<SimpleInlineLinkText
label={_(msg`Click here to delete your account`)}
{...createStaticClick(() => {
ax.metric(
'ageAssurance:noAccessScreen:openDeleteAccountDialog',
{},
)
deleteAccountControl.open()
})}
style={[a.italic]}>
delete your account
</SimpleInlineLinkText>
.
</Trans>
</Text>
@@ -280,11 +255,6 @@ export function NoAccessScreen() {
</View>
<BirthDateSettingsDialog control={birthdateControl} />
<DeactivateAccountDialog control={deactivateAccountControl} />
<DeleteAccountDialog
control={deleteAccountControl}
deactivateDialogControl={deactivateAccountControl}
/>
{/*
* While this blocking overlay is up, other dialogs in the shell
+1 -1
View File
@@ -57,7 +57,7 @@ export const otherRequiredData: OtherRequiredData = {
birthdate: new Date(2000, 1, 1).toISOString(),
}
const serverStateEnabled = false || IS_E2E
const serverStateEnabled = false
export const serverState: AppBskyAgeassuranceGetState.OutputSchema | undefined =
serverStateEnabled
? {
+2 -4
View File
@@ -2,10 +2,8 @@ import {createContext, useCallback, useContext, useEffect, useMemo} from 'react'
import {useGetAndRegisterPushToken} from '#/lib/notifications/notifications'
import {Provider as RedirectOverlayProvider} from '#/ageAssurance/components/RedirectOverlay'
import {
AgeAssuranceDataProvider,
useAgeAssuranceDataContext,
} from '#/ageAssurance/data'
import {AgeAssuranceDataProvider} from '#/ageAssurance/data'
import {useAgeAssuranceDataContext} from '#/ageAssurance/data'
import {logger} from '#/ageAssurance/logger'
import {
useAgeAssuranceState,
+15 -11
View File
@@ -1,4 +1,4 @@
import {createContext, useCallback, useContext, useMemo, useState} from 'react'
import React from 'react'
import {type Theme, type ThemeName} from '@bsky.app/alf'
import {
@@ -46,7 +46,7 @@ export type Alf = {
/*
* Context
*/
export const Context = createContext<Alf>({
export const Context = React.createContext<Alf>({
themeName: 'light',
theme: themes.light,
themes,
@@ -65,13 +65,15 @@ export function ThemeProvider({
children,
theme: themeName,
}: React.PropsWithChildren<{theme: ThemeName}>) {
const [fontScale, setFontScale] = useState<Alf['fonts']['scale']>(() =>
const [fontScale, setFontScale] = React.useState<Alf['fonts']['scale']>(() =>
getFontScale(),
)
const [fontScaleMultiplier, setFontScaleMultiplier] = useState(() =>
const [fontScaleMultiplier, setFontScaleMultiplier] = React.useState(() =>
computeFontScaleMultiplier(fontScale),
)
const setFontScaleAndPersist = useCallback<Alf['fonts']['setFontScale']>(
const setFontScaleAndPersist = React.useCallback<
Alf['fonts']['setFontScale']
>(
fs => {
setFontScale(fs)
persistFontScale(fs)
@@ -79,10 +81,12 @@ export function ThemeProvider({
},
[setFontScale],
)
const [fontFamily, setFontFamily] = useState<Alf['fonts']['family']>(() =>
getFontFamily(),
const [fontFamily, setFontFamily] = React.useState<Alf['fonts']['family']>(
() => getFontFamily(),
)
const setFontFamilyAndPersist = useCallback<Alf['fonts']['setFontFamily']>(
const setFontFamilyAndPersist = React.useCallback<
Alf['fonts']['setFontFamily']
>(
ff => {
setFontFamily(ff)
persistFontFamily(ff)
@@ -90,7 +94,7 @@ export function ThemeProvider({
[setFontFamily],
)
const value = useMemo<Alf>(
const value = React.useMemo<Alf>(
() => ({
themes,
themeName: themeName,
@@ -118,12 +122,12 @@ export function ThemeProvider({
}
export function useAlf() {
return useContext(Context)
return React.useContext(Context)
}
export function useTheme(theme?: ThemeName) {
const alf = useAlf()
return useMemo(() => {
return React.useMemo(() => {
return theme ? alf.themes[theme] : alf.theme
}, [theme, alf])
}
+2 -2
View File
@@ -1,4 +1,4 @@
import {useLayoutEffect} from 'react'
import React from 'react'
import {type ColorSchemeName, useColorScheme} from 'react-native'
import {type ThemeName} from '@bsky.app/alf'
@@ -9,7 +9,7 @@ import {IS_WEB} from '#/env'
export function useColorModeTheme(): ThemeName {
const theme = useThemeName()
useLayoutEffect(() => {
React.useLayoutEffect(() => {
updateDocument(theme)
}, [theme])
+2 -2
View File
@@ -1,4 +1,4 @@
import {useMemo} from 'react'
import React from 'react'
import {type Breakpoint, useBreakpoints} from '#/alf/breakpoints'
import * as tokens from '#/alf/tokens'
@@ -52,7 +52,7 @@ export function useGutters([top, right, bottom, left]: Gutter[]) {
bottom = top
left = right
}
return useMemo(() => {
return React.useMemo(() => {
return {
paddingTop: top === 0 ? 0 : gutters[top][activeBreakpoint || 'default'],
paddingRight:
+7 -110
View File
@@ -470,10 +470,6 @@ export type Events = {
profileDid: string
position?: number
}
'profile:mute': {}
'profile:unmute': {}
'profile:block': {}
'profile:unblock': {}
'suggestedUser:follow': {
logContext:
| 'Explore'
@@ -707,115 +703,20 @@ export type Events = {
'reportDialog:failure': {}
translate: {
os: Platform['OS']
/**
* The languages the content might be in, such as the user-supplied
* language codes on posts. Currently only available on posts.
*/
possibleSourceLanguages: string[] | undefined
/**
* This is the user's configured primary language, which is always defined.
*/
expectedTargetLanguage: string
/**
* The length of the text being translated. We assume shorter texts are
* more likely to have inaccurate translations.
*/
sourceLanguages: string[]
targetLanguage: string
textLength: number
googleTranslate: boolean
}
'translate:result': {
success: boolean
method: 'on-device' | 'google-translate' | 'fallback-alert'
os: Platform['OS']
/**
* The languages the content might be in, such as the user-supplied
* language codes on posts. Currently only available on posts.
*/
possibleSourceLanguages: string[] | undefined
/**
* The language we expected the content to be in. This could be based on
* user selection or on our confidence in the detected language. This is
* nullable because we may not always have an expected source language.
*/
expectedSourceLanguage: string | null
/**
* This is the user's configured primary language, which is always defined.
*/
expectedTargetLanguage: string
/**
* The language the translation result was actually in. This is nullable
* because the translation could have failed, in which case we won't have a
* result source language.
*/
resultSourceLanguage: string | null
/**
* The language the translation result was translated into. This should be
* the same as `expectedTargetLanguage`, but we include it for completeness
* and in case there are any edge cases where they differ. This is nullable
* because if the translation failed, we won't have a result target
* language.
*/
resultTargetLanguage: string | null
/**
* The length of the text being translated. We assume shorter texts are
* more likely to have inaccurate translations.
*/
textLength: number
sourceLanguage: string | null
targetLanguage: string
}
'translate:override': {
os: Platform['OS']
/**
* The languages the content might be in, such as the user-supplied
* language codes on posts. Currently only available on posts.
*/
possibleSourceLanguages: string[] | undefined
/**
* The language the user has indicated the content is actually in, which
* may be different from the expected source language if the user is
* overriding the auto-detected language. This is the language the user
* wants to translate from after overriding.
*/
expectedSourceLanguage: string
/**
* This is the user's configured primary language, which is always defined.
*/
expectedTargetLanguage: string
/**
* The language the translation result was actually in, which the user now
* wishes to override.
*/
resultSourceLanguage: string
}
'postMenu:openMuteWordsDialog': {
uri: string
authorDid: string
logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo'
feedDescriptor?: string
}
'postMenu:muteAccount': {
uri: string
authorDid: string
logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo'
feedDescriptor?: string
}
'postMenu:unmuteAccount': {
uri: string
authorDid: string
logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo'
feedDescriptor?: string
}
'postMenu:blockAccount': {
uri: string
authorDid: string
logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo'
feedDescriptor?: string
}
'postMenu:reportPost': {
uri: string
authorDid: string
logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo'
feedDescriptor?: string
sourceLanguage: string
targetLanguage: string
}
'verification:create': {}
@@ -831,9 +732,6 @@ export type Events = {
'verification:settings:hideBadges': {}
'verification:settings:unHideBadges': {}
'bot:label:toggle': {state: 'add' | 'remove'}
'bot:badge:click': {}
'live:create': {duration: number}
'live:edit': {}
'live:remove': {}
@@ -911,7 +809,6 @@ export type Events = {
canUpdateBirthday: boolean
}
'ageAssurance:noAccessScreen:openBirthdateDialog': {}
'ageAssurance:noAccessScreen:openDeleteAccountDialog': {}
/*
* Specifically for the `BlockedGeoOverlay`
+13 -10
View File
@@ -1,4 +1,4 @@
import {Fragment, useCallback} from 'react'
import React, {useCallback} from 'react'
import {View} from 'react-native'
import {type AppBskyActorDefs} from '@atproto/api'
import {msg} from '@lingui/core/macro'
@@ -16,8 +16,9 @@ import {Button} from '#/components/Button'
import {CheckThick_Stroke2_Corner0_Rounded as CheckIcon} from '#/components/icons/Check'
import {ChevronRight_Stroke2_Corner0_Rounded as ChevronIcon} from '#/components/icons/Chevron'
import {PlusLarge_Stroke2_Corner0_Rounded as PlusIcon} from '#/components/icons/Plus'
import {ProfileBadges} from '#/components/ProfileBadges'
import {Text} from '#/components/Typography'
import {useSimpleVerificationState} from '#/components/verification'
import {VerificationCheck} from '#/components/verification/VerificationCheck'
import {useActorStatus} from '#/features/liveNow'
export function AccountList({
@@ -52,7 +53,7 @@ export function AccountList({
t.atoms.border_contrast_low,
]}>
{accounts.map(account => (
<Fragment key={account.did}>
<React.Fragment key={account.did}>
<AccountItem
profile={profiles?.profiles.find(p => p.did === account.did)}
account={account}
@@ -61,7 +62,7 @@ export function AccountList({
isPendingAccount={account.did === pendingDid}
/>
<View style={[a.border_b, t.atoms.border_contrast_low]} />
</Fragment>
</React.Fragment>
))}
<Button
testID="chooseAddAccountBtn"
@@ -115,6 +116,7 @@ function AccountItem({
}) {
const t = useTheme()
const {_} = useLingui()
const verification = useSimpleVerificationState({profile})
const {isActive: live} = useActorStatus(profile)
const onPress = useCallback(() => {
@@ -162,12 +164,13 @@ function AccountItem({
profile?.displayName || profile?.handle || account.handle,
)}
</Text>
{profile && (
<ProfileBadges
profile={profile}
size="sm"
style={[{marginTop: -2}]}
/>
{verification.showBadge && (
<View>
<VerificationCheck
width={12}
verifier={verification.role === 'verifier'}
/>
</View>
)}
</View>
<Text
+2 -2
View File
@@ -1,4 +1,4 @@
import {useCallback} from 'react'
import React from 'react'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {useQueryClient} from '@tanstack/react-query'
@@ -20,7 +20,7 @@ export function AppLanguageDropdown() {
const setLangPrefs = useLanguagePrefsApi()
const sanitizedLang = sanitizeAppLanguageSetting(langPrefs.appLanguage)
const onChangeAppLanguage = useCallback(
const onChangeAppLanguage = React.useCallback(
(value: string) => {
if (!value) return
if (sanitizedLang !== value) {
-79
View File
@@ -1,79 +0,0 @@
import {View} from 'react-native'
import {Trans, useLingui} from '@lingui/react/macro'
import {useSession} from '#/state/session'
import {atoms as a, useTheme, web} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
import {Bot_Filled as RobotIcon} from '#/components/icons/Bot'
import {Text} from '#/components/Typography'
import {navigate} from '#/Navigation'
import type * as bsky from '#/types/bsky'
export function BotAccountAlert({
control,
profile,
}: {
control: Dialog.DialogControlProps
profile: bsky.profile.AnyProfileView
}) {
const {t: l} = useLingui()
const t = useTheme()
const {currentAccount} = useSession()
const isSelf = profile.did === currentAccount?.did
const description = isSelf
? l`You have marked this account as automated. You can remove it at any time from your account settings.`
: l`This account has been marked as automated by its owner.`
return (
<Dialog.Outer control={control} nativeOptions={{preventExpansion: true}}>
<Dialog.ScrollableInner
label={l`Automated account`}
style={[web({maxWidth: 320})]}>
<View style={[a.align_center, a.pb_md, a.shadow_sm]}>
<RobotIcon width={48} fill={t.atoms.text_contrast_medium.color} />
</View>
<View style={[a.align_center]}>
<Text
style={[
a.leading_snug,
a.text_center,
a.pb_xl,
a.text_md,
t.atoms.text_contrast_high,
{maxWidth: 300},
]}>
{description}
</Text>
</View>
<View style={[a.w_full, a.gap_sm]}>
<Button
label={l`Okay`}
onPress={() => control.close()}
color="primary"
size="large">
<ButtonText>
<Trans>Okay</Trans>
</ButtonText>
</Button>
{isSelf ? (
<Button
label={l`Open settings`}
onPress={() => {
control.close(() => {
navigate('AutomationLabelSettings')
})
}}
color="secondary"
size="large">
<ButtonText>
<Trans>Open settings</Trans>
</ButtonText>
</Button>
) : null}
</View>
</Dialog.ScrollableInner>
</Dialog.Outer>
)
}
-92
View File
@@ -1,92 +0,0 @@
import {View} from 'react-native'
import {type ComAtprotoLabelDefs} from '@atproto/api'
import {useLingui} from '@lingui/react/macro'
import {atoms as a, useTheme} from '#/alf'
import {BotAccountAlert} from '#/components/BotAccountAlert'
import {Button} from '#/components/Button'
import {useDialogControl} from '#/components/Dialog'
import {Bot_Filled as RobotIcon} from '#/components/icons/Bot'
import {useAnalytics} from '#/analytics'
import type * as bsky from '#/types/bsky'
export function isBotAccount(profile: {
did: string
labels?: ComAtprotoLabelDefs.Label[]
}): boolean {
return (
profile.labels?.some(l => l.val === 'bot' && l.src === profile.did) ?? false
)
}
export function BotBadge({
profile,
alwaysShow = false,
width,
}: {
profile: bsky.profile.AnyProfileView
alwaysShow?: boolean
width: number
}) {
const t = useTheme()
if (!isBotAccount(profile) && !alwaysShow) {
return null
}
return (
<View>
<RobotIcon width={width} fill={t.atoms.text_contrast_medium.color} />
</View>
)
}
export function BotBadgeButton({
profile,
width,
}: {
profile: bsky.profile.AnyProfileView
width: number
}) {
const t = useTheme()
const ax = useAnalytics()
const {t: l} = useLingui()
const control = useDialogControl()
if (!isBotAccount(profile)) {
return null
}
return (
<>
<Button
label={l`Automated account`}
hitSlop={20}
onPress={evt => {
evt.preventDefault()
ax.metric('bot:badge:click', {})
control.open()
}}>
{({hovered}) => (
<View
style={[
a.justify_end,
a.align_end,
a.transition_transform,
{
width: width,
height: width,
transform: [{scale: hovered ? 1.1 : 1}],
},
]}>
<RobotIcon
width={width}
fill={t.atoms.text_contrast_medium.color}
/>
</View>
)}
</Button>
<BotAccountAlert control={control} profile={profile} />
</>
)
}
+71 -77
View File
@@ -1,11 +1,4 @@
import {
createContext,
forwardRef,
useCallback,
useContext,
useMemo,
useState,
} from 'react'
import React from 'react'
import {
type AccessibilityProps,
type GestureResponderEvent,
@@ -115,7 +108,7 @@ export type ButtonProps = Pick<
export type ButtonTextProps = TextProps &
VariantProps & {disabled?: boolean; emoji?: boolean}
const Context = createContext<VariantProps & ButtonState>({
const Context = React.createContext<VariantProps & ButtonState>({
hovered: false,
focused: false,
pressed: false,
@@ -124,10 +117,10 @@ const Context = createContext<VariantProps & ButtonState>({
Context.displayName = 'ButtonContext'
export function useButtonContext() {
return useContext(Context)
return React.useContext(Context)
}
export const Button = forwardRef<View, ButtonProps>(
export const Button = React.forwardRef<View, ButtonProps>(
(
{
children,
@@ -160,13 +153,13 @@ export const Button = forwardRef<View, ButtonProps>(
}
const t = useTheme()
const [state, setState] = useState({
const [state, setState] = React.useState({
pressed: false,
hovered: false,
focused: false,
})
const onPressIn = useCallback(
const onPressIn = React.useCallback(
(e: GestureResponderEvent) => {
setState(s => ({
...s,
@@ -176,7 +169,7 @@ export const Button = forwardRef<View, ButtonProps>(
},
[setState, onPressInOuter],
)
const onPressOut = useCallback(
const onPressOut = React.useCallback(
(e: GestureResponderEvent) => {
setState(s => ({
...s,
@@ -186,7 +179,7 @@ export const Button = forwardRef<View, ButtonProps>(
},
[setState, onPressOutOuter],
)
const onHoverIn = useCallback(
const onHoverIn = React.useCallback(
(e: MouseEvent) => {
setState(s => ({
...s,
@@ -196,7 +189,7 @@ export const Button = forwardRef<View, ButtonProps>(
},
[setState, onHoverInOuter],
)
const onHoverOut = useCallback(
const onHoverOut = React.useCallback(
(e: MouseEvent) => {
setState(s => ({
...s,
@@ -206,7 +199,7 @@ export const Button = forwardRef<View, ButtonProps>(
},
[setState, onHoverOutOuter],
)
const onFocus = useCallback(
const onFocus = React.useCallback(
(e: NativeSyntheticEvent<TargetedEvent>) => {
setState(s => ({
...s,
@@ -216,7 +209,7 @@ export const Button = forwardRef<View, ButtonProps>(
},
[setState, onFocusOuter],
)
const onBlur = useCallback(
const onBlur = React.useCallback(
(e: NativeSyntheticEvent<TargetedEvent>) => {
setState(s => ({
...s,
@@ -227,7 +220,7 @@ export const Button = forwardRef<View, ButtonProps>(
[setState, onBlurOuter],
)
const {baseStyles, hoverStyles} = useMemo(() => {
const {baseStyles, hoverStyles} = React.useMemo(() => {
const baseStyles: ViewStyle[] = []
const hoverStyles: ViewStyle[] = []
@@ -533,7 +526,7 @@ export const Button = forwardRef<View, ButtonProps>(
}
}, [t, variant, color, size, shape, disabled])
const context = useMemo<ButtonContext>(
const context = React.useMemo<ButtonContext>(
() => ({
...state,
variant,
@@ -588,7 +581,7 @@ Button.displayName = 'Button'
export function useSharedButtonTextStyles() {
const t = useTheme()
const {color, variant, disabled, size} = useButtonContext()
return useMemo(() => {
return React.useMemo(() => {
const baseStyles: TextStyle[] = []
/*
@@ -785,66 +778,67 @@ export function ButtonIcon({
}) {
const {size: buttonSize, shape: buttonShape} = useButtonContext()
const textStyles = useSharedButtonTextStyles()
const {iconSize, iconContainerSize, iconNegativeMargin} = useMemo(() => {
/**
* Pre-set icon sizes for different button sizes
*/
const iconSizeShorthand =
size ??
(({
large: 'md',
small: 'sm',
tiny: 'xs',
}[buttonSize || 'small'] || 'sm') as Exclude<
SVGIconProps['size'],
undefined
>)
const {iconSize, iconContainerSize, iconNegativeMargin} =
React.useMemo(() => {
/**
* Pre-set icon sizes for different button sizes
*/
const iconSizeShorthand =
size ??
(({
large: 'md',
small: 'sm',
tiny: 'xs',
}[buttonSize || 'small'] || 'sm') as Exclude<
SVGIconProps['size'],
undefined
>)
/*
* Copied here from icons/common.tsx so we can tweak if we need to, but
* also so that we can calculate transforms.
*/
const iconSize = {
xs: 12,
sm: 16,
md: 18,
lg: 24,
xl: 28,
'2xs': 8,
'2xl': 32,
'3xl': 40,
}[iconSizeShorthand]
/*
* Copied here from icons/common.tsx so we can tweak if we need to, but
* also so that we can calculate transforms.
*/
const iconSize = {
xs: 12,
sm: 16,
md: 18,
lg: 24,
xl: 28,
'2xs': 8,
'2xl': 32,
'3xl': 40,
}[iconSizeShorthand]
/*
* Goal here is to match rendered text size so that different size icons
* don't increase button size
*/
const iconContainerSize = {
large: 20,
small: 17,
tiny: 15,
}[buttonSize || 'small']
/*
* The icon needs to be closer to the edge of the button than the text. Therefore
* we make the gap slightly too large, and then pull in the sides using negative margins.
*/
let iconNegativeMargin = 0
if (buttonShape === 'default') {
iconNegativeMargin = {
large: -2,
small: -2,
tiny: -1,
/*
* Goal here is to match rendered text size so that different size icons
* don't increase button size
*/
const iconContainerSize = {
large: 20,
small: 17,
tiny: 15,
}[buttonSize || 'small']
}
return {
iconSize,
iconContainerSize,
iconNegativeMargin,
}
}, [buttonSize, buttonShape, size])
/*
* The icon needs to be closer to the edge of the button than the text. Therefore
* we make the gap slightly too large, and then pull in the sides using negative margins.
*/
let iconNegativeMargin = 0
if (buttonShape === 'default') {
iconNegativeMargin = {
large: -2,
small: -2,
tiny: -1,
}[buttonSize || 'small']
}
return {
iconSize,
iconContainerSize,
iconNegativeMargin,
}
}, [buttonSize, buttonShape, size])
return (
<View
+5 -8
View File
@@ -1,7 +1,4 @@
import {
cloneElement,
Fragment,
isValidElement,
import React, {
useCallback,
useEffect,
useId,
@@ -692,22 +689,22 @@ export function Outer({
t.atoms.border_contrast_low,
]}>
{flattenReactChildren(children).map((child, i) => {
return isValidElement(child) &&
return React.isValidElement(child) &&
(child.type === Item || child.type === Divider) ? (
<Fragment key={i}>
<React.Fragment key={i}>
{i > 0 ? (
<View
style={[a.border_b, t.atoms.border_contrast_low]}
/>
) : null}
{cloneElement(child, {
{React.cloneElement(child, {
// @ts-expect-error not typed
style: {
borderRadius: 0,
borderWidth: 0,
},
})}
</Fragment>
</React.Fragment>
) : null
})}
</View>
+34 -50
View File
@@ -1,14 +1,5 @@
import React, {useImperativeHandle} from 'react'
import {
forwardRef,
useCallback,
useImperativeHandle,
useMemo,
useRef,
useState,
} from 'react'
import {
Keyboard,
type KeyboardEventListener,
type LayoutChangeEvent,
type NativeScrollEvent,
type NativeSyntheticEvent,
@@ -43,7 +34,6 @@ import {
type DialogOuterProps,
} from '#/components/Dialog/types'
import {createInput} from '#/components/forms/TextField'
import {useOnKeyboard} from '#/components/hooks/useOnKeyboard'
import {IS_ANDROID, IS_IOS, IS_LIQUID_GLASS} from '#/env'
import {BottomSheet, BottomSheetSnapPoint} from '../../../modules/bottom-sheet'
import {
@@ -68,21 +58,21 @@ export function Outer({
}: React.PropsWithChildren<DialogOuterProps>) {
const themeName = useThemeName()
const t = useTheme(themeName)
const ref = useRef<BottomSheetNativeComponent>(null)
const closeCallbacks = useRef<(() => void)[]>([])
const ref = React.useRef<BottomSheetNativeComponent>(null)
const closeCallbacks = React.useRef<(() => void)[]>([])
const {setDialogIsOpen, setFullyExpandedCount} =
useDialogStateControlContext()
const prevSnapPoint = useRef<BottomSheetSnapPoint>(
const prevSnapPoint = React.useRef<BottomSheetSnapPoint>(
BottomSheetSnapPoint.Hidden,
)
const [disableDrag, setDisableDrag] = useState(false)
const [snapPoint, setSnapPoint] = useState<BottomSheetSnapPoint>(
const [disableDrag, setDisableDrag] = React.useState(false)
const [snapPoint, setSnapPoint] = React.useState<BottomSheetSnapPoint>(
BottomSheetSnapPoint.Partial,
)
const callQueuedCallbacks = useCallback(() => {
const callQueuedCallbacks = React.useCallback(() => {
for (const cb of closeCallbacks.current) {
try {
cb()
@@ -94,7 +84,7 @@ export function Outer({
closeCallbacks.current = []
}, [])
const open = useCallback<DialogControlProps['open']>(() => {
const open = React.useCallback<DialogControlProps['open']>(() => {
// Run any leftover callbacks that might have been queued up before calling `.open()`
callQueuedCallbacks()
setDialogIsOpen(control.id, true)
@@ -102,7 +92,7 @@ export function Outer({
}, [setDialogIsOpen, control.id, callQueuedCallbacks])
// This is the function that we call when we want to dismiss the dialog.
const close = useCallback<DialogControlProps['close']>(cb => {
const close = React.useCallback<DialogControlProps['close']>(cb => {
if (typeof cb === 'function') {
closeCallbacks.current.push(cb)
}
@@ -111,7 +101,7 @@ export function Outer({
// This is the actual thing we are doing once we "confirm" the dialog. We want the dialog's close animation to
// happen before we run this. It is passed to the `BottomSheet` component.
const onCloseAnimationComplete = useCallback(() => {
const onCloseAnimationComplete = React.useCallback(() => {
// This removes the dialog from our list of stored dialogs. Not super necessary on iOS, but on Android this
// tells us that we need to toggle the accessibility overlay setting
setDialogIsOpen(control.id, false)
@@ -157,7 +147,7 @@ export function Outer({
[open, close],
)
const context = useMemo(
const context = React.useMemo(
() => ({
close,
isNativeDialog: true,
@@ -211,23 +201,25 @@ export function Inner({children, style, header}: DialogInnerProps) {
)
}
export const ScrollableInner = forwardRef<ScrollView, DialogInnerProps>(
export const ScrollableInner = React.forwardRef<ScrollView, DialogInnerProps>(
function ScrollableInner(
{children, contentContainerStyle, header, ...props},
ref,
) {
const {nativeSnapPoint, disableDrag, setDisableDrag} = useDialogContext()
const isAtMaxSnapPoint = nativeSnapPoint === BottomSheetSnapPoint.Full
const insets = useSafeAreaInsets()
const [keyboardHeight, setKeyboardHeight] = useState(() =>
IS_ANDROID ? (Keyboard.metrics()?.height ?? 0) : 0,
)
const isAtMaxSnapPoint = nativeSnapPoint === BottomSheetSnapPoint.Full
const keyboardEventHandler = useCallback<KeyboardEventListener>(e => {
setKeyboardHeight(e.endCoordinates.height)
}, [])
useOnKeyboard('keyboardDidShow', keyboardEventHandler)
useOnKeyboard('keyboardDidHide', keyboardEventHandler)
let paddingBottom = 0
if (IS_IOS) {
paddingBottom = tokens.space._2xl
} else {
paddingBottom =
Math.max(insets.bottom, tokens.space._5xl) + tokens.space._2xl
if (isAtMaxSnapPoint) {
paddingBottom += insets.top
}
}
const onScroll = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
if (!IS_ANDROID) {
@@ -246,12 +238,7 @@ export const ScrollableInner = forwardRef<ScrollView, DialogInnerProps>(
contentContainerStyle={[
a.pt_2xl,
IS_LIQUID_GLASS ? a.px_2xl : a.px_xl,
platform({
ios: a.pb_2xl,
android: {
paddingBottom: keyboardHeight + insets.bottom + tokens.space.xl,
},
}),
{paddingBottom},
contentContainerStyle,
]}
ref={ref}
@@ -263,12 +250,7 @@ export const ScrollableInner = forwardRef<ScrollView, DialogInnerProps>(
{...props}
bounces={isAtMaxSnapPoint}
scrollEventThrottle={50}
// set drag state based on scroll on android.
// we want to detect if it's at the top or not, so watch
// scrollEndDrag and momentumScrollEnd as well
onScroll={android(onScroll)}
onScrollEndDrag={android(onScroll)}
onMomentumScrollEnd={android(onScroll)}
onScroll={IS_ANDROID ? onScroll : undefined}
keyboardShouldPersistTaps="handled"
// TODO: figure out why this positions the header absolutely (rather than stickily)
// on Android. fine to disable for now, because we don't have any
@@ -281,7 +263,7 @@ export const ScrollableInner = forwardRef<ScrollView, DialogInnerProps>(
},
)
export const InnerFlatList = forwardRef<
export const InnerFlatList = React.forwardRef<
ListMethods,
ListProps<any> & {
webInnerStyle?: StyleProp<ViewStyle>
@@ -311,10 +293,7 @@ export const InnerFlatList = forwardRef<
}
return (
<ScrollProvider
onScroll={onScroll}
onEndDrag={onScroll}
onMomentumEnd={onScroll}>
<ScrollProvider onScroll={onScroll}>
<List
keyboardShouldPersistTaps="handled"
contentInsetAdjustmentBehavior={
@@ -348,7 +327,7 @@ export function FlatListFooter({
onLayout?: (event: LayoutChangeEvent) => void
}) {
const t = useTheme()
const {bottom} = useSafeAreaInsets()
const {top, bottom} = useSafeAreaInsets()
const {height} = useReanimatedKeyboardAnimation()
const animatedStyle = useAnimatedStyle(() => {
@@ -371,7 +350,12 @@ export function FlatListFooter({
t.atoms.border_contrast_low,
a.px_lg,
a.pt_md,
{paddingBottom: bottom + tokens.space.md},
{
paddingBottom: platform({
ios: tokens.space.md + bottom + (IS_LIQUID_GLASS ? top : 0),
android: tokens.space.md + bottom + top,
}),
},
// TODO: had to admit defeat here, but we should
// try and get this to work for Android as well -sfn
ios(animatedStyle),
+9 -16
View File
@@ -1,11 +1,4 @@
import {
forwardRef,
useCallback,
useContext,
useImperativeHandle,
useMemo,
useState,
} from 'react'
import React, {useImperativeHandle} from 'react'
import {
FlatList,
type FlatListProps,
@@ -55,15 +48,15 @@ export function Outer({
}: React.PropsWithChildren<DialogOuterProps>) {
const {_} = useLingui()
const {gtMobile} = useBreakpoints()
const [isOpen, setIsOpen] = useState(false)
const [isOpen, setIsOpen] = React.useState(false)
const {setDialogIsOpen} = useDialogStateControlContext()
const open = useCallback(() => {
const open = React.useCallback(() => {
setDialogIsOpen(control.id, true)
setIsOpen(true)
}, [setIsOpen, setDialogIsOpen, control.id])
const close = useCallback<DialogControlProps['close']>(
const close = React.useCallback<DialogControlProps['close']>(
cb => {
setDialogIsOpen(control.id, false)
setIsOpen(false)
@@ -87,7 +80,7 @@ export function Outer({
[control.id, onClose, setDialogIsOpen],
)
const handleBackgroundPress = useCallback(
const handleBackgroundPress = React.useCallback(
async (e: GestureResponderEvent) => {
webOptions?.onBackgroundPress ? webOptions.onBackgroundPress(e) : close()
},
@@ -103,7 +96,7 @@ export function Outer({
[close, open],
)
const context = useMemo(
const context = React.useMemo(
() => ({
close,
isNativeDialog: false,
@@ -172,7 +165,7 @@ export function Inner({
contentContainerStyle,
}: DialogInnerProps) {
const t = useTheme()
const {close} = useContext(Context)
const {close} = React.useContext(Context)
const {gtMobile} = useBreakpoints()
const {reduceMotionEnabled} = useA11y()
FocusGuards.useFocusGuards()
@@ -222,7 +215,7 @@ export function Inner({
export const ScrollableInner = Inner
export const InnerFlatList = forwardRef<
export const InnerFlatList = React.forwardRef<
FlatList,
FlatListProps<any> & {label: string} & {
webInnerStyle?: StyleProp<ViewStyle>
@@ -291,7 +284,7 @@ export function FlatListFooter({
export function Close() {
const {_} = useLingui()
const {close} = useContext(Context)
const {close} = React.useContext(Context)
return (
<View
style={[
+1 -3
View File
@@ -67,9 +67,7 @@ export function HeaderText({
style?: StyleProp<TextStyle>
}) {
return (
<Text
style={[a.text_lg, a.text_center, a.font_semi_bold, style]}
maxFontSizeMultiplier={2}>
<Text style={[a.text_lg, a.text_center, a.font_semi_bold, style]}>
{children}
</Text>
)
+2 -2
View File
@@ -1,9 +1,9 @@
import {useEffect} from 'react'
import React from 'react'
import {type DialogControlProps} from '#/components/Dialog/types'
export function useAutoOpen(control: DialogControlProps, showTimeout?: number) {
useEffect(() => {
React.useEffect(() => {
if (showTimeout) {
const timeout = setTimeout(() => {
control.open()
+2 -4
View File
@@ -18,6 +18,7 @@ import {
useRemoveFeedMutation,
} from '#/state/queries/preferences'
import {useSession} from '#/state/session'
import * as Toast from '#/view/com/util/Toast'
import {UserAvatar} from '#/view/com/util/UserAvatar'
import {atoms as a, select, useTheme} from '#/alf'
import {
@@ -32,7 +33,6 @@ import {Link as InternalLink, type LinkProps} from '#/components/Link'
import {Loader} from '#/components/Loader'
import * as Prompt from '#/components/Prompt'
import {RichText, type RichTextProps} from '#/components/RichText'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {useActiveLiveEventFeedUris} from '#/features/liveEvents/context'
import type * as bsky from '#/types/bsky'
@@ -313,9 +313,7 @@ function SaveButtonInner({
Toast.show(l({message: 'Feeds updated!', context: 'toast'}))
} catch (err: any) {
logger.error(err, {message: `FeedCard: failed to update feeds`, pin})
Toast.show(l`Failed to update feeds`, {
type: 'error',
})
Toast.show(l`Failed to update feeds`, 'xmark')
}
},
[l, pin, saveFeeds, removeFeed, uri, savedFeedConfig, type],
+135 -23
View File
@@ -18,7 +18,10 @@ import {useModerationOpts} from '#/state/preferences/moderation-opts'
import {useGetPopularFeedsQuery} from '#/state/queries/feed'
import {type FeedDescriptor} from '#/state/queries/post-feed'
import {useProfilesQuery} from '#/state/queries/profile'
import {useSuggestedFollowsByActorWithDismiss} from '#/state/queries/suggested-follows'
import {
useSuggestedFollowsByActorQuery,
useSuggestedFollowsQuery,
} from '#/state/queries/suggested-follows'
import {useSession} from '#/state/session'
import * as userActionHistory from '#/state/userActionHistory'
import {type SeenPost} from '#/state/userActionHistory'
@@ -167,12 +170,10 @@ function useExperimentalSuggestedUsersQuery() {
if (followSuggestions.length > 0) {
suggestedDids = [
// It's ok if these will pick the same item (weighed by its frequency)
/* eslint-disable react-hooks/purity */
followSuggestions[Math.floor(Math.random() * followSuggestions.length)],
followSuggestions[Math.floor(Math.random() * followSuggestions.length)],
followSuggestions[Math.floor(Math.random() * followSuggestions.length)],
followSuggestions[Math.floor(Math.random() * followSuggestions.length)],
/* eslint-enable react-hooks/purity */
]
}
const seenDids = seen
@@ -215,13 +216,86 @@ export function SuggestedFollows({feed}: {feed: FeedDescriptor}) {
}
export function SuggestedFollowsProfile({did}: {did: string}) {
const {profiles, onDismiss, isLoading, error} =
useSuggestedFollowsByActorWithDismiss({did})
const {gtMobile} = useBreakpoints()
const moderationOpts = useModerationOpts()
const maxLength = gtMobile ? 4 : 6
const {
isLoading: isSuggestionsLoading,
data,
error,
} = useSuggestedFollowsByActorQuery({
did,
})
const {
data: moreSuggestions,
fetchNextPage,
hasNextPage,
isFetchingNextPage,
} = useSuggestedFollowsQuery({limit: 25})
const [dismissedDids, setDismissedDids] = useState<Set<string>>(new Set())
const onDismiss = useCallback((dismissedDid: string) => {
setDismissedDids(prev => new Set(prev).add(dismissedDid))
}, [])
// Combine profiles from the actor-specific query with fallback suggestions
const allProfiles = useMemo(() => {
const actorProfiles = data?.suggestions ?? []
const fallbackProfiles =
moreSuggestions?.pages.flatMap(page =>
page.actors.map(actor => ({actor, recId: page.recId})),
) ?? []
// Dedupe by did, preferring actor-specific profiles
const seen = new Set<string>()
const combined: {actor: bsky.profile.AnyProfileView; recId?: number}[] = []
for (const profile of actorProfiles) {
if (!seen.has(profile.did)) {
seen.add(profile.did)
combined.push({actor: profile, recId: data?.recId})
}
}
for (const profile of fallbackProfiles) {
if (!seen.has(profile.actor.did) && profile.actor.did !== did) {
seen.add(profile.actor.did)
combined.push(profile)
}
}
return combined
}, [data?.suggestions, moreSuggestions?.pages, did, data?.recId])
const filteredProfiles = useMemo(() => {
return allProfiles.filter(p => !dismissedDids.has(p.actor.did))
}, [allProfiles, dismissedDids])
// Fetch more when running low
useEffect(() => {
if (
moderationOpts &&
filteredProfiles.length < maxLength &&
hasNextPage &&
!isFetchingNextPage
) {
void fetchNextPage()
}
}, [
filteredProfiles.length,
maxLength,
hasNextPage,
isFetchingNextPage,
fetchNextPage,
moderationOpts,
])
return (
<ProfileGrid
isSuggestionsLoading={isLoading}
profiles={profiles}
isSuggestionsLoading={isSuggestionsLoading}
profiles={filteredProfiles}
totalProfileCount={allProfiles.length}
error={error}
viewContext="profile"
onDismiss={onDismiss}
@@ -230,11 +304,21 @@ export function SuggestedFollowsProfile({did}: {did: string}) {
}
export function SuggestedFollowsHome() {
const {gtMobile} = useBreakpoints()
const moderationOpts = useModerationOpts()
const maxLength = gtMobile ? 4 : 6
const {
isLoading: isSuggestionsLoading,
profiles: experimentalProfiles,
error: experimentalError,
} = useExperimentalSuggestedUsersQuery()
const {
data: moreSuggestions,
fetchNextPage,
hasNextPage,
isFetchingNextPage,
error: suggestionsError,
} = useSuggestedFollowsQuery({limit: 25})
const [dismissedDids, setDismissedDids] = useState<Set<string>>(new Set())
@@ -242,29 +326,66 @@ export function SuggestedFollowsHome() {
setDismissedDids(prev => new Set(prev).add(did))
}, [])
// Combine profiles from experimental query with paginated suggestions
const allProfiles = useMemo(() => {
const result: Array<{
const fallbackProfiles =
moreSuggestions?.pages.flatMap(page =>
page.actors.map(actor => ({actor, recId: page.recId})),
) ?? []
// Dedupe by did, preferring experimental profiles
const seen = new Set<string>()
const combined: Array<{
actor: bsky.profile.AnyProfileView
recId?: string
recId?: number
}> = []
for (const profile of experimentalProfiles) {
result.push({actor: profile, recId: undefined})
if (!seen.has(profile.did)) {
seen.add(profile.did)
combined.push({actor: profile, recId: undefined})
}
}
return result
}, [experimentalProfiles])
for (const profile of fallbackProfiles) {
if (!seen.has(profile.actor.did)) {
seen.add(profile.actor.did)
combined.push(profile)
}
}
return combined
}, [experimentalProfiles, moreSuggestions?.pages])
const filteredProfiles = useMemo(() => {
return allProfiles.filter(p => !dismissedDids.has(p.actor.did))
}, [allProfiles, dismissedDids])
// Fetch more when running low
useEffect(() => {
if (
moderationOpts &&
filteredProfiles.length < maxLength &&
hasNextPage &&
!isFetchingNextPage
) {
void fetchNextPage()
}
}, [
filteredProfiles.length,
maxLength,
hasNextPage,
isFetchingNextPage,
fetchNextPage,
moderationOpts,
])
return (
<ProfileGrid
isSuggestionsLoading={isSuggestionsLoading}
profiles={filteredProfiles}
totalProfileCount={allProfiles.length}
error={experimentalError}
error={experimentalError || suggestionsError}
viewContext="feed"
onDismiss={onDismiss}
/>
@@ -279,16 +400,14 @@ export function ProfileGrid({
viewContext = 'feed',
onDismiss,
isVisible = true,
onRequestHide,
}: {
isSuggestionsLoading: boolean
profiles: {actor: bsky.profile.AnyProfileView; recId?: string}[]
profiles: {actor: bsky.profile.AnyProfileView; recId?: number}[]
totalProfileCount?: number
error: Error | null
viewContext: 'profile' | 'profileHeader' | 'feed'
onDismiss?: (did: string) => void
isVisible?: boolean
onRequestHide?: () => void
}) {
const t = useTheme()
const ax = useAnalytics()
@@ -532,13 +651,6 @@ export function ProfileGrid({
// Use totalProfileCount (before dismissals) for minLength check on initial render.
const profileCountForMinCheck = totalProfileCount ?? profiles.length
useEffect(() => {
if (error || (!isLoading && profileCountForMinCheck < minLength)) {
onRequestHide?.()
}
}, [error, isLoading, onRequestHide, profileCountForMinCheck, minLength])
if (error || (!isLoading && profileCountForMinCheck < minLength)) {
ax.logger.debug(`Not enough profiles to show suggested follows`)
return null
+1
View File
@@ -1,4 +1,5 @@
import {View} from 'react-native'
import type React from 'react'
import {atoms as a, type ViewStyleProp} from '#/alf'
+6 -4
View File
@@ -1,4 +1,4 @@
import {useRef} from 'react'
import React from 'react'
import {View} from 'react-native'
import {
type AppBskyActorDefs,
@@ -46,7 +46,9 @@ export function KnownFollowers({
minimal?: boolean
showIfEmpty?: boolean
}) {
const cache = useRef<Map<string, AppBskyActorDefs.KnownFollowers>>(new Map())
const cache = React.useRef<Map<string, AppBskyActorDefs.KnownFollowers>>(
new Map(),
)
/*
* Results for `knownFollowers` are not sorted consistently, so when
@@ -188,7 +190,7 @@ function KnownFollowersInner({
numberOfLines={2}>
{slice.length >= 2 ? (
// 2-n followers, including blocks
serverCount > 2 ? ( // only 2
serverCount > 2 ? (
<Trans>
Followed by{' '}
<Text emoji key={slice[0].profile.did} style={textStyle}>
@@ -204,7 +206,7 @@ function KnownFollowersInner({
one="# other"
other="# others"
/>
</Trans>
</Trans> // only 2
) : (
<Trans>
Followed by{' '}
@@ -3,6 +3,7 @@ import {type AppBskyLabelerDefs} from '@atproto/api'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {Plural, Trans} from '@lingui/react/macro'
import type React from 'react'
import {getLabelingServiceTitle} from '#/lib/moderation'
import {sanitizeHandle} from '#/lib/strings/handles'
+2 -2
View File
@@ -1,4 +1,4 @@
import {useCallback} from 'react'
import React from 'react'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
@@ -22,7 +22,7 @@ export function LanguageSelect({
}) {
const {_} = useLingui()
const handleOnChange = useCallback(
const handleOnChange = React.useCallback(
(value: string) => {
if (!value) return
onChange(sanitizeAppLanguageSetting(value))
+1 -2
View File
@@ -191,8 +191,7 @@ export function TitleText({
style,
]}
numberOfLines={2}
emoji
maxFontSizeMultiplier={2}>
emoji>
{children}
</Text>
)
+2 -2
View File
@@ -1,6 +1,6 @@
import {createContext} from 'react'
import React from 'react'
export const ScrollbarOffsetContext = createContext({
export const ScrollbarOffsetContext = React.createContext({
isWithinOffsetView: false,
})
ScrollbarOffsetContext.displayName = 'ScrollbarOffsetContext'
+5 -5
View File
@@ -1,4 +1,4 @@
import {useCallback, useMemo, useState} from 'react'
import React from 'react'
import {type AppBskyFeedGetLikes as GetLikes} from '@atproto/api'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
@@ -29,7 +29,7 @@ function keyExtractor(item: GetLikes.Like) {
export function LikedByList({uri}: {uri: string}) {
const {_} = useLingui()
const initialNumToRender = useInitialNumToRender()
const [isPTRing, setIsPTRing] = useState(false)
const [isPTRing, setIsPTRing] = React.useState(false)
const {
data: resolvedUri,
@@ -49,14 +49,14 @@ export function LikedByList({uri}: {uri: string}) {
const error = resolveError || likedByError
const isError = !!resolveError || !!likedByError
const likes = useMemo(() => {
const likes = React.useMemo(() => {
if (data?.pages) {
return data.pages.flatMap(page => page.likes)
}
return []
}, [data])
const onRefresh = useCallback(async () => {
const onRefresh = React.useCallback(async () => {
setIsPTRing(true)
try {
await refetch()
@@ -66,7 +66,7 @@ export function LikedByList({uri}: {uri: string}) {
setIsPTRing(false)
}, [refetch, setIsPTRing])
const onEndReached = useCallback(async () => {
const onEndReached = React.useCallback(async () => {
if (isFetchingNextPage || !hasNextPage || isError) return
try {
await fetchNextPage()
@@ -1,5 +1,6 @@
import {type StyleProp, type ViewStyle} from 'react-native'
import {LinearGradient} from 'expo-linear-gradient'
import type React from 'react'
import {gradients} from '#/alf/tokens'
+4 -4
View File
@@ -1,4 +1,4 @@
import {useCallback, useMemo} from 'react'
import React, {useMemo} from 'react'
import {type GestureResponderEvent, Linking} from 'react-native'
import {sanitizeUrl} from '@braintree/sanitize-url'
import {
@@ -117,7 +117,7 @@ export function useLink({
const {linkWarningDialogControl} = useGlobalDialogsControlContext()
const openLink = useOpenLink()
const onPress = useCallback(
const onPress = React.useCallback(
(e: GestureResponderEvent) => {
const exitEarlyIfFalse = outerOnPress?.(e)
@@ -217,7 +217,7 @@ export function useLink({
],
)
const handleLongPress = useCallback(() => {
const handleLongPress = React.useCallback(() => {
const requiresWarning = Boolean(
!disableMismatchWarning &&
displayText &&
@@ -242,7 +242,7 @@ export function useLink({
linkWarningDialogControl,
])
const onLongPress = useCallback(
const onLongPress = React.useCallback(
(e: GestureResponderEvent) => {
const exitEarlyIfFalse = outerOnLongPress?.(e)
if (exitEarlyIfFalse === false) return
+3 -3
View File
@@ -1,4 +1,4 @@
import {useEffect, useMemo} from 'react'
import React from 'react'
import {View} from 'react-native'
import {
type AppBskyGraphDefs,
@@ -88,11 +88,11 @@ export function Link({
}: Props & Omit<LinkProps, 'to' | 'label'>) {
const queryClient = useQueryClient()
const href = useMemo(() => {
const href = React.useMemo(() => {
return createProfileListHref({list: view})
}, [view])
useEffect(() => {
React.useEffect(() => {
precacheList(queryClient, view)
}, [view, queryClient])
+2 -2
View File
@@ -1,4 +1,4 @@
import {useEffect} from 'react'
import React from 'react'
import Animated, {
Easing,
useAnimatedStyle,
@@ -20,7 +20,7 @@ export function Loader(props: Props) {
transform: [{rotate: rotation.get() + 'deg'}],
}))
useEffect(() => {
React.useEffect(() => {
rotation.set(() =>
withRepeat(withTiming(360, {duration: 500, easing: Easing.linear}), -1),
)
+1
View File
@@ -1,4 +1,5 @@
import {StyleSheet} from 'react-native'
import type React from 'react'
import {atoms as a, platform, useTheme, type ViewStyleProp} from '#/alf'
import {Fill} from '#/components/Fill'
+5 -5
View File
@@ -1,15 +1,15 @@
import {createContext, useContext} from 'react'
import React from 'react'
import {type ContextType, type ItemContextType} from '#/components/Menu/types'
export const Context = createContext<ContextType | null>(null)
export const Context = React.createContext<ContextType | null>(null)
Context.displayName = 'MenuContext'
export const ItemContext = createContext<ItemContextType | null>(null)
export const ItemContext = React.createContext<ItemContextType | null>(null)
ItemContext.displayName = 'MenuItemContext'
export function useMenuContext() {
const context = useContext(Context)
const context = React.useContext(Context)
if (!context) {
throw new Error('useMenuContext must be used within a Context.Provider')
@@ -19,7 +19,7 @@ export function useMenuContext() {
}
export function useMenuItemContext() {
const context = useContext(ItemContext)
const context = React.useContext(ItemContext)
if (!context) {
throw new Error('useMenuItemContext must be used within a Context.Provider')
+1
View File
@@ -4,6 +4,7 @@ import {
type GestureResponderEvent,
type PressableProps,
} from 'react-native'
import type React from 'react'
import {type TextStyleProp, type ViewStyleProp} from '#/alf'
import type * as Dialog from '#/components/Dialog'
+4 -4
View File
@@ -1,4 +1,4 @@
import {useMemo} from 'react'
import React from 'react'
import {View} from 'react-native'
import {BSKY_LABELER_DID, type ModerationCause} from '@atproto/api'
import {Trans} from '@lingui/react/macro'
@@ -32,7 +32,7 @@ export function Row({
size = 'sm',
}: {children: React.ReactNode | React.ReactNode[]} & CommonProps &
ViewStyleProp) {
const styles = useMemo(() => {
const styles = React.useMemo(() => {
switch (size) {
case 'lg':
return [{gap: 5}]
@@ -67,7 +67,7 @@ export function Label({
const isBlueskyLabel =
desc.sourceType === 'labeler' && desc.sourceDid === BSKY_LABELER_DID
const {outer, avi, text} = useMemo(() => {
const {outer, avi, text} = React.useMemo(() => {
switch (size) {
case 'lg': {
return {
@@ -154,7 +154,7 @@ export function Label({
export function FollowsYou({size = 'sm'}: CommonProps) {
const t = useTheme()
const variantStyles = useMemo(() => {
const variantStyles = React.useMemo(() => {
switch (size) {
case 'sm':
case 'lg':
@@ -1,4 +1,4 @@
import {useCallback, useRef, useState} from 'react'
import React from 'react'
import {
ActivityIndicator,
type GestureResponderEvent,
@@ -31,16 +31,16 @@ export function ExternalGif({
const consentDialogControl = useDialogControl()
// Tracking if the placer has been activated
const [isPlayerActive, setIsPlayerActive] = useState(false)
const [isPlayerActive, setIsPlayerActive] = React.useState(false)
// Tracking whether the gif has been loaded yet
const [isPrefetched, setIsPrefetched] = useState(false)
const [isPrefetched, setIsPrefetched] = React.useState(false)
// Tracking whether the image is animating
const [isAnimating, setIsAnimating] = useState(true)
const [isAnimating, setIsAnimating] = React.useState(true)
// Used for controlling animation
const imageRef = useRef<Image>(null)
const imageRef = React.useRef<Image>(null)
const load = useCallback(() => {
const load = React.useCallback(() => {
setIsPlayerActive(true)
Image.prefetch(params.playerUri).then(() => {
// Replace the image once it's fetched
@@ -48,7 +48,7 @@ export function ExternalGif({
})
}, [params.playerUri])
const onPlayPress = useCallback(
const onPlayPress = React.useCallback(
(event: GestureResponderEvent) => {
// Don't propagate on web
event.preventDefault()
@@ -1,4 +1,4 @@
import {useCallback, useEffect, useMemo, useState} from 'react'
import React from 'react'
import {
ActivityIndicator,
type GestureResponderEvent,
@@ -84,7 +84,7 @@ function Player({
}) {
// ensures we only load what's requested
// when it's a youtube video, we need to allow both bsky.app and youtube.com
const onShouldStartLoadWithRequest = useCallback(
const onShouldStartLoadWithRequest = React.useCallback(
(event: ShouldStartLoadRequest) =>
event.url === params.playerUri ||
(params.source.startsWith('youtube') &&
@@ -129,10 +129,10 @@ export function ExternalPlayer({
const externalEmbedsPrefs = useExternalEmbedsPrefs()
const consentDialogControl = useDialogControl()
const [isPlayerActive, setPlayerActive] = useState(false)
const [isLoading, setIsLoading] = useState(true)
const [isPlayerActive, setPlayerActive] = React.useState(false)
const [isLoading, setIsLoading] = React.useState(true)
const aspect = useMemo(() => {
const aspect = React.useMemo(() => {
return getPlayerAspect({
type: params.type,
width: windowDims.width,
@@ -166,7 +166,7 @@ export function ExternalPlayer({
}, false) // False here disables autostarting the callback
// watch for leaving the viewport due to scrolling
useEffect(() => {
React.useEffect(() => {
// We don't want to do anything if the player isn't active
if (!isPlayerActive) return
@@ -185,11 +185,11 @@ export function ExternalPlayer({
}
}, [navigation, isPlayerActive, frameCallback])
const onLoad = useCallback(() => {
const onLoad = React.useCallback(() => {
setIsLoading(false)
}, [])
const onPlayPress = useCallback(
const onPlayPress = React.useCallback(
(event: GestureResponderEvent) => {
// Prevent this from propagating upward on web
event.preventDefault()
@@ -204,7 +204,7 @@ export function ExternalPlayer({
[externalEmbedsPrefs, consentDialogControl, params.source],
)
const onAcceptConsent = useCallback(() => {
const onAcceptConsent = React.useCallback(() => {
setPlayerActive(true)
}, [])
@@ -1,4 +1,4 @@
import {useCallback, useMemo} from 'react'
import React, {useCallback} from 'react'
import {type StyleProp, View, type ViewStyle} from 'react-native'
import {Image} from 'expo-image'
import {type AppBskyEmbedExternal} from '@atproto/api'
@@ -38,7 +38,7 @@ export const ExternalEmbed = ({
const externalEmbedPrefs = useExternalEmbedsPrefs()
const niceUrl = toNiceDomain(link.uri)
const imageUri = link.thumb
const embedPlayerParams = useMemo(() => {
const embedPlayerParams = React.useMemo(() => {
const params = parseEmbedPlayerFromUrl(link.uri)
if (params && externalEmbedPrefs?.[params.source] !== 'hide') {
@@ -1,7 +1,5 @@
import {
createContext,
import React, {
useCallback,
useContext,
useEffect,
useId,
useMemo,
@@ -12,7 +10,7 @@ import {useWindowDimensions} from 'react-native'
import {IS_NATIVE, IS_WEB} from '#/env'
const Context = createContext<{
const Context = React.createContext<{
activeViewId: string | null
setActiveView: (viewId: string) => void
sendViewPosition: (viewId: string, y: number) => void
@@ -96,7 +94,7 @@ export function Provider({children}: {children: React.ReactNode}) {
}
export function useActiveVideoWeb() {
const context = useContext(Context)
const context = React.useContext(Context)
if (!context) {
throw new Error(
'useActiveVideoWeb must be used within a ActiveVideoWebProvider',
@@ -1,4 +1,4 @@
import {useCallback, useEffect, useId, useRef, useState} from 'react'
import {useEffect, useId, useRef, useState} from 'react'
import {View} from 'react-native'
import {type AppBskyEmbedVideo} from '@atproto/api'
import {msg} from '@lingui/core/macro'
@@ -37,7 +37,7 @@ export function VideoEmbedInnerWeb({
throw error
}
const {hlsRef, loop, updateCuePositions} = useHLS({
const {hlsRef, loop} = useHLS({
playlist: embed.playlist,
setHasSubtitleTrack,
setError,
@@ -90,7 +90,6 @@ export function VideoEmbedInnerWeb({
hasSubtitleTrack={hasSubtitleTrack}
isGif={embed.presentation === 'gif'}
altText={embed.alt}
updateCuePositions={updateCuePositions}
/>
</div>
</View>
@@ -146,47 +145,6 @@ function useHLS({
}, [Hls, setHlsLoading])
const hlsRef = useRef<HlsTypes.default | undefined>(undefined)
const controlsVisibleRef = useRef(false)
/**
* Repositions VTT subtitle cues using percentage-based line values
* (snapToLines=false) so that multi-line/wrapped cues grow upward
* instead of extending offscreen. Moves cues higher when controls
* are visible to avoid occlusion by the scrub bar.
*
* Called from two sites:
* - SUBTITLE_FRAG_PROCESSED: applies positioning to newly loaded cues
* - VideoControls effect: updates positioning when controls show/hide
*/
const updateCuePositions = useCallback(
(controlsVisible?: boolean) => {
if (controlsVisible != null) {
// save controlsVisible state so that when it's called from SUBTITLE_FRAG_PROCESSED,
// the most recent value is used (as we won't know the control state there)
controlsVisibleRef.current = controlsVisible
}
// magic numbers: cue position, % from top of video
const line = controlsVisibleRef.current ? 70 : 85
const video = videoRef.current
if (!video) return
for (let i = 0; i < video.textTracks.length; i++) {
const track = video.textTracks[i]
if (track.cues) {
for (let j = 0; j < track.cues.length; j++) {
const cue = track.cues[j] as VTTCue
cue.snapToLines = false
cue.line = line
}
}
// toggle track mode to force the browser to re-render active cues
if (track.mode === 'showing') {
track.mode = 'hidden'
track.mode = 'showing'
}
}
},
[videoRef],
)
const [lowQualityFragments, setLowQualityFragments] = useState<
HlsTypes.Fragment[]
>([])
@@ -262,10 +220,6 @@ function useHLS({
}
})
hls.on(Hls.Events.SUBTITLE_FRAG_PROCESSED, () => {
updateCuePositions()
})
hls.on(Hls.Events.FRAG_BUFFERED, (_event, {frag}) => {
if (frag.level === 0) {
setLowQualityFragments(prev => [...prev, frag])
@@ -353,6 +307,5 @@ function useHLS({
return {
hlsRef,
loop: !hasLowQualityFragmentAtStart,
updateCuePositions,
}
}
@@ -48,7 +48,6 @@ export function Controls({
hasSubtitleTrack,
isGif,
altText,
updateCuePositions,
}: {
videoRef: React.RefObject<HTMLVideoElement | null>
hlsRef: React.RefObject<Hls | undefined | null>
@@ -62,7 +61,6 @@ export function Controls({
hasSubtitleTrack: boolean
isGif: boolean
altText?: string
updateCuePositions: (controlsVisible?: boolean) => void
}) {
const {
play,
@@ -296,13 +294,6 @@ export function Controls({
((focused || autoplayDisabled) && !playing) ||
(interactingViaKeypress ? hasFocus : hovered)
// adjust subtitle cue positioning to avoid occlusion by controls
// uses percentage-based positioning (snapToLines=false) so wrapped
// multi-line cues grow upward instead of extending offscreen
useEffect(() => {
updateCuePositions(showControls)
}, [showControls, updateCuePositions])
if (isGif) {
return (
<GifPresentationControls
@@ -1,6 +1,7 @@
import {createContext, useContext, useMemo, useState} from 'react'
import React from 'react'
const Context = createContext<{
const Context = React.createContext<{
// native
muted: boolean
setMuted: React.Dispatch<React.SetStateAction<boolean>>
// web
@@ -10,10 +11,10 @@ const Context = createContext<{
Context.displayName = 'VideoVolumeContext'
export function Provider({children}: {children: React.ReactNode}) {
const [muted, setMuted] = useState(true)
const [volume, setVolume] = useState(1)
const [muted, setMuted] = React.useState(true)
const [volume, setVolume] = React.useState(1)
const value = useMemo(
const value = React.useMemo(
() => ({
muted,
setMuted,
@@ -27,7 +28,7 @@ export function Provider({children}: {children: React.ReactNode}) {
}
export function useVideoVolumeState() {
const context = useContext(Context)
const context = React.useContext(Context)
if (!context) {
throw new Error(
'useVideoVolumeState must be used within a VideoVolumeProvider',
@@ -37,7 +38,7 @@ export function useVideoVolumeState() {
}
export function useVideoMuteState() {
const context = useContext(Context)
const context = React.useContext(Context)
if (!context) {
throw new Error(
'useVideoMuteState must be used within a VideoVolumeProvider',
+121 -165
View File
@@ -1,23 +1,16 @@
import {useCallback, useMemo} from 'react'
import {Platform, type StyleProp, type TextStyle, View} from 'react-native'
import {type AppBskyFeedDefs, AppBskyFeedPost} from '@atproto/api'
import {Platform, View} from 'react-native'
import {type AppBskyFeedDefs} from '@atproto/api'
import {Trans, useLingui} from '@lingui/react/macro'
import {HITSLOP_30} from '#/lib/constants'
import {useTranslate} from '#/lib/translation'
import {
type TranslationFunction,
type TranslationFunctionParams,
} from '#/lib/translation'
import {
codeToLanguageName,
getPostLanguageTags,
isPostInLanguage,
languageName,
} from '#/locale/helpers'
import {useGoogleTranslate} from '#/lib/hooks/useGoogleTranslate'
import {guessLanguage, useTranslate} from '#/lib/translation'
import {type TranslationFunction} from '#/lib/translation'
import {codeToLanguageName, languageName} from '#/locale/helpers'
import {LANGUAGES} from '#/locale/languages'
import {useLanguagePrefs} from '#/state/preferences'
import {atoms as a, flatten, native, useTheme, web} from '#/alf'
import {atoms as a, native, useTheme, web} from '#/alf'
import {Button} from '#/components/Button'
import {ArrowRight_Stroke2_Corner0_Rounded as ArrowRightIcon} from '#/components/icons/Arrow'
import {TimesLarge_Stroke2_Corner0_Rounded as XIcon} from '#/components/icons/Times'
@@ -28,43 +21,23 @@ import * as Select from '#/components/Select'
import {Text} from '#/components/Typography'
import {useAnalytics} from '#/analytics'
import {IS_WEB} from '#/env'
import * as bsky from '#/types/bsky'
const X_ICON_OFFSET = 16
export function TranslatedPost({
hideTranslateLink = false,
post,
postTextStyle = a.text_md,
postText,
}: {
hideTranslateLink?: boolean
post: AppBskyFeedDefs.PostView
postTextStyle?: StyleProp<TextStyle>
postText: string
}) {
const langPrefs = useLanguagePrefs()
const {clearTranslation, translate, translationState} = useTranslate({
key: post.uri,
})
const record = useMemo<AppBskyFeedPost.Record | undefined>(() => {
return bsky.dangerousIsType<AppBskyFeedPost.Record>(
post.record,
AppBskyFeedPost.isRecord,
)
? post.record
: undefined
}, [post])
const initialTranslationParams = useMemo<TranslationFunctionParams>(() => {
return {
text: record?.text || '',
expectedTargetLanguage: langPrefs.primaryLanguage,
possibleSourceLanguages: getPostLanguageTags(post),
}
}, [post, record, langPrefs])
const needsTranslation = useMemo(() => {
if (hideTranslateLink) return false
return !isPostInLanguage(post, [langPrefs.primaryLanguage])
}, [hideTranslateLink, post, langPrefs.primaryLanguage])
const postLanguage = useMemo(() => guessLanguage(postText), [postText])
const needsTranslation = postLanguage !== langPrefs.primaryLanguage
switch (translationState.status) {
case 'loading':
@@ -72,12 +45,11 @@ export function TranslatedPost({
case 'success':
return (
<TranslationResult
translate={translate}
clearTranslation={clearTranslation}
initialTranslationParams={initialTranslationParams}
postTextStyle={postTextStyle}
resultSourceLanguage={
translationState.sourceLanguage ?? null // Fallback primarily for iOS
translate={translate}
postText={postText}
sourceLanguage={
translationState.sourceLanguage ?? postLanguage ?? null // Fallback primarily for iOS
}
translatedText={translationState.translatedText}
/>
@@ -85,18 +57,21 @@ export function TranslatedPost({
case 'error':
return (
<TranslationError
translate={translate}
clearTranslation={clearTranslation}
message={translationState.message}
initialTranslationParams={initialTranslationParams}
postText={postText}
primaryLanguage={langPrefs.primaryLanguage}
/>
)
default:
return (
!hideTranslateLink &&
needsTranslation && (
<TranslationLink
postText={postText}
primaryLanguage={langPrefs.primaryLanguage}
sourceLanguage={postLanguage}
translate={translate}
initialTranslationParams={initialTranslationParams}
/>
)
)
@@ -107,36 +82,50 @@ function TranslationLoading() {
const t = useTheme()
return (
<View style={[a.gap_md, a.mt_sm, a.align_start]}>
<View style={[a.gap_md, a.pt_md, a.align_start]}>
<View style={[a.flex_row, a.align_center, a.gap_xs]}>
<Loader size="xs" />
<Text style={[a.text_sm, t.atoms.text_contrast_medium]}>
<Trans>Translating</Trans>
<Trans>Translating</Trans>
</Text>
<Loader size="xs" fill={t.atoms.text_contrast_medium.color} />
</View>
</View>
)
}
function TranslationLink({
postText,
primaryLanguage,
sourceLanguage,
translate,
initialTranslationParams,
}: {
postText: string
primaryLanguage: string
sourceLanguage: string | null
translate: TranslationFunction
initialTranslationParams: TranslationFunctionParams
}) {
const t = useTheme()
const {t: l} = useLingui()
const ax = useAnalytics()
const handleTranslate = useCallback(() => {
void translate(initialTranslationParams)
}, [initialTranslationParams, translate])
void translate({
text: postText,
targetLangCode: primaryLanguage,
})
ax.metric('translate', {
sourceLanguages: sourceLanguage ? [sourceLanguage] : [],
targetLanguage: primaryLanguage,
textLength: postText.length,
})
}, [ax, postText, primaryLanguage, translate, sourceLanguage])
return (
<View
style={[
a.gap_md,
a.mt_sm,
a.pt_md,
a.align_start,
a.flex_row,
a.align_center,
@@ -162,64 +151,51 @@ function TranslationLink({
}
function TranslationError({
translate,
clearTranslation,
message,
initialTranslationParams,
postText,
primaryLanguage,
}: {
translate: TranslationFunction
clearTranslation: () => void
message: string
initialTranslationParams: TranslationFunctionParams
postText: string
primaryLanguage: string
}) {
const t = useTheme()
const {t: l} = useLingui()
const translate = useGoogleTranslate()
const handleFallback = () => {
void translate({
...initialTranslationParams,
forceGoogleTranslate: true,
})
void translate(postText, primaryLanguage)
}
return (
<View
style={[
a.p_md,
a.px_lg,
a.pt_sm,
a.pb_md,
a.mt_sm,
a.border,
a.rounded_lg,
a.gap_xs,
t.atoms.border_contrast_high,
]}>
<View
style={[
a.flex_row,
a.align_start,
a.gap_xs,
{
paddingRight: X_ICON_OFFSET,
},
]}>
<WarningIcon size="sm" fill={t.atoms.text_contrast_medium.color} />
<Text
style={[
a.flex_1,
a.text_xs,
a.leading_snug,
t.atoms.text_contrast_high,
]}>
{message}
</Text>
<Button
label={l`Hide translation`}
hitSlop={HITSLOP_30}
hoverStyle={native({opacity: 0.5})}
style={[a.absolute, a.z_10, {top: 0, right: 0}]}
onPress={clearTranslation}>
<XIcon size="sm" fill={t.atoms.text_contrast_medium.color} />
</Button>
<View style={[a.flex_row, a.align_center, a.justify_between]}>
<View style={[a.flex_row, a.align_center, a.mb_sm, a.gap_xs]}>
<WarningIcon size="sm" fill={t.atoms.text_contrast_medium.color} />
<Text style={[a.text_xs, a.font_medium, t.atoms.text_contrast_high]}>
{message}
</Text>
</View>
<View style={[a.flex_row, a.align_center, a.mb_xs]}>
<Button
label={l`Hide translation`}
hitSlop={HITSLOP_30}
hoverStyle={{opacity: 0.5}}
onPress={clearTranslation}>
<XIcon size="sm" fill={t.atoms.text_contrast_medium.color} />
</Button>
</View>
</View>
<View style={[a.flex_row, a.align_center]}>
<Link
@@ -233,12 +209,7 @@ function TranslationError({
]}
hitSlop={HITSLOP_30}>
<Text
style={[
a.text_xs,
a.font_medium,
a.leading_snug,
{color: t.palette.primary_500},
]}>
style={[a.text_xs, a.font_medium, {color: t.palette.primary_500}]}>
<Trans>Try Google Translate</Trans>
</Text>
</Link>
@@ -250,67 +221,57 @@ function TranslationError({
function TranslationResult({
clearTranslation,
translate,
postTextStyle,
resultSourceLanguage,
postText,
sourceLanguage,
translatedText,
initialTranslationParams,
}: {
clearTranslation: () => void
translate: TranslationFunction
postTextStyle?: StyleProp<TextStyle>
resultSourceLanguage: string | null
postText: string
sourceLanguage: string | null
translatedText: string
initialTranslationParams: TranslationFunctionParams
}) {
const t = useTheme()
const langPrefs = useLanguagePrefs()
const {i18n, t: l} = useLingui()
const langName = resultSourceLanguage
? codeToLanguageName(resultSourceLanguage, i18n.locale)
const langName = sourceLanguage
? codeToLanguageName(sourceLanguage, i18n.locale)
: undefined
const flattenedStyle = flatten(postTextStyle) ?? {}
const fontSize = flattenedStyle.fontSize
return (
<View>
<View
style={[
a.p_md,
a.px_lg,
a.pt_sm,
a.pb_md,
a.mt_sm,
a.border,
a.rounded_lg,
a.gap_xs,
t.atoms.border_contrast_high,
]}>
<View
style={[
a.flex_row,
a.align_center,
a.flex_wrap,
{
paddingRight: X_ICON_OFFSET,
},
]}>
<View style={[a.flex_row, a.align_center, a.mb_xs]}>
{langName ? (
<>
<View style={[a.flex_row, a.align_center]}>
<Text
style={[
a.text_xs,
a.leading_snug,
a.font_medium,
t.atoms.text_contrast_medium,
]}>
{langName}{' '}
</Text>
<ArrowRightIcon
size="xs"
fill={t.atoms.text_contrast_medium.color}
/>
<View style={[a.mt_2xs]}>
<ArrowRightIcon
size="xs"
fill={t.atoms.text_contrast_medium.color}
/>
</View>
<Text
style={[
a.text_xs,
a.leading_snug,
a.font_medium,
t.atoms.text_contrast_medium,
]}>
{' '}
@@ -319,45 +280,48 @@ function TranslationResult({
langPrefs.appLanguage,
)}
</Text>
</>
</View>
) : (
<Text
style={[a.text_xs, a.leading_snug, t.atoms.text_contrast_medium]}>
style={[
a.text_xs,
a.font_medium,
t.atoms.text_contrast_medium,
a.mb_xs,
]}>
<Trans>Translated</Trans>
</Text>
)}
{resultSourceLanguage != null && (
{sourceLanguage != null && (
<>
<Text
style={[
a.text_xs,
a.font_medium,
a.leading_snug,
t.atoms.text_contrast_medium,
]}>
{' '}
&middot;{' '}
</Text>
<TranslationLanguageSelect
resultSourceLanguage={resultSourceLanguage}
sourceLanguage={sourceLanguage}
translate={translate}
initialTranslationParams={initialTranslationParams}
postText={postText}
/>
</>
)}
<Button
label={l`Hide translation`}
hitSlop={HITSLOP_30}
hoverStyle={native({opacity: 0.5})}
style={[a.absolute, a.z_10, {top: 0, right: 0}]}
onPress={clearTranslation}>
<XIcon size="sm" fill={t.atoms.text_contrast_medium.color} />
</Button>
</View>
<Text emoji selectable style={[a.leading_snug, {fontSize}]}>
<Text emoji selectable style={[a.text_md, a.leading_snug]}>
{translatedText}
</Text>
<Button
label={l`Hide translation`}
hitSlop={HITSLOP_30}
hoverStyle={native({opacity: 0.5})}
style={[a.absolute, a.z_10, {top: 12, right: 14}]}
onPress={clearTranslation}>
<XIcon size="sm" fill={t.atoms.text_contrast_medium.color} />
</Button>
</View>
</View>
)
@@ -365,12 +329,12 @@ function TranslationResult({
function TranslationLanguageSelect({
translate,
resultSourceLanguage,
initialTranslationParams,
postText,
sourceLanguage,
}: {
translate: TranslationFunction
resultSourceLanguage: string
initialTranslationParams: TranslationFunctionParams
postText: string
sourceLanguage: string
}) {
const t = useTheme()
const ax = useAnalytics()
@@ -386,8 +350,8 @@ function TranslationLanguageSelect({
)
.sort((a, b) => {
// Prioritize sourceLanguage at the top
if (a.code2 === resultSourceLanguage) return -1
if (b.code2 === resultSourceLanguage) return 1
if (a.code2 === sourceLanguage) return -1
if (b.code2 === sourceLanguage) return 1
// Localized sort
return languageName(a, langPrefs.appLanguage).localeCompare(
languageName(b, langPrefs.appLanguage),
@@ -398,28 +362,25 @@ function TranslationLanguageSelect({
label: languageName(l, langPrefs.appLanguage), // The viewer may not be familiar with the source language, so localize the name
value: l.code2,
})),
[langPrefs, resultSourceLanguage],
[langPrefs, sourceLanguage],
)
const handleChangeTranslationLanguage = (sourceLangCode: string) => {
ax.metric('translate:override', {
os: Platform.OS,
possibleSourceLanguages: initialTranslationParams.possibleSourceLanguages,
expectedSourceLanguage: sourceLangCode,
expectedTargetLanguage: initialTranslationParams.expectedTargetLanguage,
resultSourceLanguage,
sourceLanguage: sourceLangCode,
targetLanguage: langPrefs.primaryLanguage,
})
void translate({
text: initialTranslationParams.text,
expectedTargetLanguage: initialTranslationParams.expectedTargetLanguage,
expectedSourceLanguage: sourceLangCode,
possibleSourceLanguages: initialTranslationParams.possibleSourceLanguages,
text: postText,
targetLangCode: langPrefs.primaryLanguage,
sourceLangCode,
})
}
return (
<Select.Root
value={resultSourceLanguage}
value={sourceLanguage}
onValueChange={handleChangeTranslationLanguage}>
<Select.Trigger label={l`Change the source language`}>
{({props}) => {
@@ -430,12 +391,7 @@ function TranslationLanguageSelect({
hitSlop={HITSLOP_30}
hoverStyle={native({opacity: 0.5})}>
<Text
style={[
a.text_xs,
a.font_medium,
a.leading_snug,
t.atoms.text_contrast_high,
]}>
style={[a.text_xs, a.font_medium, t.atoms.text_contrast_high]}>
<Trans>Change</Trans>
</Text>
</Button>
@@ -4,6 +4,7 @@ import {type AppBskyFeedDefs} from '@atproto/api'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro'
import type React from 'react'
import {useCleanError} from '#/lib/hooks/useCleanError'
import {type Shadow} from '#/state/cache/post-shadow'
@@ -8,7 +8,7 @@ import {
import * as Clipboard from 'expo-clipboard'
import {
type AppBskyFeedDefs,
type AppBskyFeedPost,
AppBskyFeedPost,
type AppBskyFeedThreadgate,
AtUri,
type RichText as RichTextAPI,
@@ -28,7 +28,6 @@ import {
import {richTextToString} from '#/lib/strings/rich-text-helpers'
import {toShareUrl} from '#/lib/strings/url-helpers'
import {useTranslate} from '#/lib/translation'
import {getPostLanguageTags} from '#/locale/helpers'
import {logger} from '#/logger'
import {type Shadow} from '#/state/cache/post-shadow'
import {useProfileShadow} from '#/state/cache/profile-shadow'
@@ -57,6 +56,7 @@ import {
} from '#/state/queries/threadgate'
import {useRequireAuth, useSession} from '#/state/session'
import {useMergedThreadgateHiddenReplies} from '#/state/threadgate-hidden-replies'
import * as Toast from '#/view/com/util/Toast'
import {useDialogControl} from '#/components/Dialog'
import {useGlobalDialogsControlContext} from '#/components/dialogs/Context'
import {
@@ -93,9 +93,9 @@ import {
useReportDialogControl,
} from '#/components/moderation/ReportDialog'
import * as Prompt from '#/components/Prompt'
import * as Toast from '#/components/Toast'
import {useAnalytics} from '#/analytics'
import {IS_INTERNAL} from '#/env'
import * as bsky from '#/types/bsky'
let PostMenuItems = ({
post,
@@ -216,9 +216,7 @@ let PostMenuItems = ({
},
e => {
logger.error('Failed to delete post', {message: e})
Toast.show(l`Failed to delete post, please try again`, {
type: 'error',
})
Toast.show(l`Failed to delete post, please try again`, 'xmark')
},
)
}
@@ -248,38 +246,36 @@ let PostMenuItems = ({
const e = err as Error
if (e?.name !== 'AbortError') {
logger.error('Failed to toggle thread mute', {message: e})
Toast.show(l`Failed to toggle thread mute, please try again`, {
type: 'error',
})
Toast.show(l`Failed to toggle thread mute, please try again`, 'xmark')
}
}
}
const onToggleWordsAndTagsMute = () => {
ax.metric('postMenu:openMuteWordsDialog', {
uri: postUri,
authorDid: postAuthor.did,
logContext,
feedDescriptor: feedFeedback.feedDescriptor,
})
mutedWordsDialogControl.open()
}
const onCopyPostText = () => {
const str = richTextToString(richText, true)
void Clipboard.setStringAsync(str)
Toast.show(l`Copied to clipboard`, {
type: 'success',
})
Toast.show(l`Copied to clipboard`, 'clipboard-check')
}
const onPressTranslate = () => {
void translate({
text: record.text,
expectedTargetLanguage: langPrefs.primaryLanguage,
possibleSourceLanguages: getPostLanguageTags(post),
targetLangCode: langPrefs.primaryLanguage,
})
if (
bsky.dangerousIsType<AppBskyFeedPost.Record>(
post.record,
AppBskyFeedPost.isRecord,
)
) {
ax.metric('translate', {
sourceLanguages: post.record.langs ?? [],
targetLanguage: langPrefs.primaryLanguage,
textLength: post.record.text.length,
})
}
}
const onHidePost = () => {
@@ -428,17 +424,8 @@ let PostMenuItems = ({
const e = err as Error
if (e?.name !== 'AbortError') {
logger.error('Failed to block account', {message: e})
Toast.show(l`There was an issue! ${e.toString()}`, {
type: 'error',
})
Toast.show(l`There was an issue! ${e.toString()}`, 'xmark')
}
} finally {
ax.metric('postMenu:blockAccount', {
uri: postUri,
authorDid: postAuthor.did,
logContext,
feedDescriptor: feedFeedback.feedDescriptor,
})
}
}
@@ -451,17 +438,8 @@ let PostMenuItems = ({
const e = err as Error
if (e?.name !== 'AbortError') {
logger.error('Failed to unmute account', {message: e})
Toast.show(l`There was an issue! ${e.toString()}`, {
type: 'error',
})
Toast.show(l`There was an issue! ${e.toString()}`, 'xmark')
}
} finally {
ax.metric('postMenu:unmuteAccount', {
uri: postUri,
authorDid: postAuthor.did,
logContext,
feedDescriptor: feedFeedback.feedDescriptor,
})
}
} else {
try {
@@ -471,17 +449,8 @@ let PostMenuItems = ({
const e = err as Error
if (e?.name !== 'AbortError') {
logger.error('Failed to mute account', {message: e})
Toast.show(l`There was an issue! ${e.toString()}`, {
type: 'error',
})
Toast.show(l`There was an issue! ${e.toString()}`, 'xmark')
}
} finally {
ax.metric('postMenu:muteAccount', {
uri: postUri,
authorDid: postAuthor.did,
logContext,
feedDescriptor: feedFeedback.feedDescriptor,
})
}
}
}
@@ -632,7 +601,7 @@ let PostMenuItems = ({
<Menu.Item
testID="postDropdownMuteWordsBtn"
label={l`Mute words & tags`}
onPress={onToggleWordsAndTagsMute}>
onPress={() => mutedWordsDialogControl.open()}>
<Menu.ItemText>{l`Mute words & tags`}</Menu.ItemText>
<Menu.ItemIcon icon={Filter} position="right" />
</Menu.Item>
@@ -816,14 +785,6 @@ let PostMenuItems = ({
...post,
$type: 'app.bsky.feed.defs#postView',
}}
onAfterSubmit={() => {
ax.metric('postMenu:reportPost', {
uri: postUri,
authorDid: postAuthor.did,
logContext,
feedDescriptor: feedFeedback.feedDescriptor,
})
}}
/>
<PostInteractionSettingsDialog
control={postInteractionSettingsDialogControl}
@@ -17,8 +17,9 @@ import {UserAvatar} from '#/view/com/util/UserAvatar'
import {atoms as a, tokens, useTheme} from '#/alf'
import {Button} from '#/components/Button'
import {useDialogContext} from '#/components/Dialog'
import {ProfileBadges} from '#/components/ProfileBadges'
import {Text} from '#/components/Typography'
import {useSimpleVerificationState} from '#/components/verification'
import {VerificationCheck} from '#/components/verification/VerificationCheck'
import {useAnalytics} from '#/analytics'
import type * as bsky from '#/types/bsky'
@@ -110,6 +111,7 @@ function RecentChatItem({
profile.displayName || sanitizeHandle(profile.handle),
moderation.ui('displayName'),
)
const verification = useSimpleVerificationState({profile})
if (isBlockedOrBlocking(profile) || isMuted(profile)) {
return null
@@ -139,7 +141,14 @@ function RecentChatItem({
numberOfLines={1}>
{name}
</Text>
<ProfileBadges profile={profile} size="xs" style={[a.pl_2xs]} />
{verification.showBadge && (
<View style={[a.pl_2xs]}>
<VerificationCheck
width={10}
verifier={verification.role === 'verifier'}
/>
</View>
)}
</View>
</Button>
)
@@ -12,6 +12,7 @@ import {shareText, shareUrl} from '#/lib/sharing'
import {toShareUrl} from '#/lib/strings/url-helpers'
import {useProfileShadow} from '#/state/cache/profile-shadow'
import {useSession} from '#/state/session'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a} from '#/alf'
import {Admonition} from '#/components/Admonition'
import {useDialogControl} from '#/components/Dialog'
@@ -21,7 +22,6 @@ import {ChainLink_Stroke2_Corner0_Rounded as ChainLinkIcon} from '#/components/i
import {Clipboard_Stroke2_Corner2_Rounded as ClipboardIcon} from '#/components/icons/Clipboard'
import {PaperPlane_Stroke2_Corner0_Rounded as PaperPlaneIcon} from '#/components/icons/PaperPlane'
import * as Menu from '#/components/Menu'
import * as Toast from '#/components/Toast'
import {useAgeAssurance} from '#/ageAssurance'
import {useAnalytics} from '#/analytics'
import {IS_IOS} from '#/env'
@@ -71,9 +71,7 @@ let ShareMenuItems = ({
} else {
await ExpoClipboard.setStringAsync(url)
}
Toast.show(_(msg`Copied to clipboard`), {
type: 'success',
})
Toast.show(_(msg`Copied to clipboard`), 'clipboard-check')
onShareProp()
}
+4 -10
View File
@@ -24,11 +24,11 @@ import {
ProgressGuideAction,
useProgressGuideControls,
} from '#/state/shell/progress-guide'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a, useBreakpoints} from '#/alf'
import {Reply as Bubble} from '#/components/icons/Reply'
import {useFormatPostStatCount} from '#/components/PostControls/util'
import * as Skele from '#/components/Skeleton'
import * as Toast from '#/components/Toast'
import {useAnalytics} from '#/analytics'
import {BookmarkButton} from './BookmarkButton'
import {
@@ -106,9 +106,7 @@ let PostControls = ({
const onPressToggleLike = async () => {
if (isBlocked) {
Toast.show(l`Cannot interact with a blocked user`, {
type: 'warning',
})
Toast.show(l`Cannot interact with a blocked user`, 'exclamation-circle')
return
}
@@ -137,9 +135,7 @@ let PostControls = ({
const onRepost = async () => {
if (isBlocked) {
Toast.show(l`Cannot interact with a blocked user`, {
type: 'warning',
})
Toast.show(l`Cannot interact with a blocked user`, 'exclamation-circle')
return
}
@@ -165,9 +161,7 @@ let PostControls = ({
const onQuote = () => {
if (isBlocked) {
Toast.show(l`Cannot interact with a blocked user`, {
type: 'warning',
})
Toast.show(l`Cannot interact with a blocked user`, 'exclamation-circle')
return
}
-76
View File
@@ -1,76 +0,0 @@
import {View} from 'react-native'
import {useProfileShadow} from '#/state/cache/profile-shadow'
import {atoms as a, type ViewStyleProp} from '#/alf'
import {BotBadge, BotBadgeButton, isBotAccount} from '#/components/BotBadge'
import {useSimpleVerificationState} from '#/components/verification'
import {VerificationCheck} from '#/components/verification/VerificationCheck'
import {VerificationCheckButton} from '#/components/verification/VerificationCheckButton'
import type * as bsky from '#/types/bsky'
export type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
const verificationIconSizes: Record<Size, number> = {
xs: 10,
sm: 12,
md: 14,
lg: 18,
xl: 22,
} as const
const botIconSizes: Record<Size, number> = {
xs: 11,
sm: 13,
md: 15,
lg: 19,
xl: 23,
} as const
export function ProfileBadges({
profile,
interactive = false,
size,
style,
}: ViewStyleProp & {
profile: bsky.profile.AnyProfileView
interactive?: boolean
size: Size
}) {
const shadowed = useProfileShadow(profile)
const verification = useSimpleVerificationState({profile})
// if nothing to show, don't render the container at all
if (!verification.showBadge && !isBotAccount(shadowed)) return null
const isOnTheSmallSide = size === 'xs' || size === 'sm'
return (
<View
style={[
a.flex_row,
a.align_center,
isOnTheSmallSide ? a.gap_2xs : a.gap_xs,
style,
]}>
{interactive ? (
<>
<VerificationCheckButton
profile={shadowed}
width={verificationIconSizes[size]}
/>
<BotBadgeButton profile={shadowed} width={botIconSizes[size]} />
</>
) : (
<>
{verification.showBadge && (
<VerificationCheck
verifier={verification.role === 'verifier'}
width={verificationIconSizes[size]}
/>
)}
<BotBadge profile={shadowed} width={botIconSizes[size]} />
</>
)}
</View>
)
}
+32 -26
View File
@@ -14,7 +14,6 @@ import {
import {useLingui} from '@lingui/react/macro'
import {getModerationCauseKey} from '#/lib/moderation'
import {makeProfileLink} from '#/lib/routes/links'
import {forceLTR} from '#/lib/strings/bidi'
import {NON_BREAKING_SPACE} from '#/lib/strings/constants'
import {sanitizeDisplayName} from '#/lib/strings/display-names'
@@ -22,6 +21,7 @@ import {sanitizeHandle} from '#/lib/strings/handles'
import {useProfileShadow} from '#/state/cache/profile-shadow'
import {useProfileFollowMutationQueue} from '#/state/queries/profile'
import {useSession} from '#/state/session'
import * as Toast from '#/view/com/util/Toast'
import {PreviewableUserAvatar, UserAvatar} from '#/view/com/util/UserAvatar'
import {
atoms as a,
@@ -40,10 +40,10 @@ import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check'
import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus'
import {Link as InternalLink, type LinkProps} from '#/components/Link'
import * as Pills from '#/components/Pills'
import {ProfileBadges} from '#/components/ProfileBadges'
import {RichText} from '#/components/RichText'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {useSimpleVerificationState} from '#/components/verification'
import {VerificationCheck} from '#/components/verification/VerificationCheck'
import {type Metrics} from '#/analytics'
import {useActorStatus} from '#/features/liveNow'
import type * as bsky from '#/types/bsky'
@@ -138,18 +138,15 @@ export function Link({
} & Omit<LinkProps, 'to' | 'label'>) {
const {t: l} = useLingui()
const profileURL = makeProfileLink({
did: profile.did,
handle: profile.handle,
})
return (
<InternalLink
testID={`profileCard-${profile.handle}-link`}
label={l`View ${
profile.displayName || sanitizeHandle(profile.handle)
}s profile`}
to={profileURL}
to={{
screen: 'Profile',
params: {name: profile.did},
}}
style={[a.flex_col, style]}
{...rest}>
{children}
@@ -242,6 +239,7 @@ function InlineNameAndHandle({
moderationOpts: ModerationOpts
}) {
const t = useTheme()
const verification = useSimpleVerificationState({profile})
const moderation = moderateProfile(profile, moderationOpts)
const name = sanitizeDisplayName(
profile.displayName || sanitizeHandle(profile.handle),
@@ -261,15 +259,19 @@ function InlineNameAndHandle({
numberOfLines={1}>
{forceLTR(name)}
</Text>
<ProfileBadges
profile={profile}
size="md"
style={[
a.pl_2xs,
a.self_center,
{marginTop: platform({default: 0, android: -1})},
]}
/>
{verification.showBadge && (
<View
style={[
a.pl_2xs,
a.self_center,
{marginTop: platform({default: 0, android: -1})},
]}>
<VerificationCheck
width={platform({android: 13, default: 12})}
verifier={verification.role === 'verifier'}
/>
</View>
)}
<Text
emoji
style={[
@@ -300,6 +302,7 @@ export function Name({
profile.displayName || sanitizeHandle(profile.handle),
moderation.ui('displayName'),
)
const verification = useSimpleVerificationState({profile})
return (
<View style={[a.flex_row, a.align_center, a.max_w_full, style]}>
<Text
@@ -315,7 +318,14 @@ export function Name({
numberOfLines={1}>
{name}
</Text>
<ProfileBadges profile={profile} size="md" style={[a.pl_xs]} />
{verification.showBadge && (
<View style={[a.pl_xs]}>
<VerificationCheck
width={14}
verifier={verification.role === 'verifier'}
/>
</View>
)}
</View>
)
}
@@ -505,9 +515,7 @@ export function FollowButtonInner({
} catch (e) {
const err = e as Error
if (err?.name !== 'AbortError') {
Toast.show(l`An issue occurred, please try again.`, {
type: 'error',
})
Toast.show(l`An issue occurred, please try again.`, 'xmark')
}
}
}
@@ -527,9 +535,7 @@ export function FollowButtonInner({
} catch (e) {
const err = e as Error
if (err?.name !== 'AbortError') {
Toast.show(l`An issue occurred, please try again.`, {
type: 'error',
})
Toast.show(l`An issue occurred, please try again.`, 'xmark')
}
}
}
+32 -26
View File
@@ -1,4 +1,4 @@
import {memo, useCallback, useEffect, useMemo, useReducer, useRef} from 'react'
import React, {useCallback} from 'react'
import {View} from 'react-native'
import {
type AppBskyActorDefs,
@@ -36,9 +36,10 @@ import {InlineLinkText, Link} from '#/components/Link'
import {Loader} from '#/components/Loader'
import * as Pills from '#/components/Pills'
import {Portal} from '#/components/Portal'
import {ProfileBadges} from '#/components/ProfileBadges'
import {RichText} from '#/components/RichText'
import {Text} from '#/components/Typography'
import {useSimpleVerificationState} from '#/components/verification'
import {VerificationCheck} from '#/components/verification/VerificationCheck'
import {IS_WEB_TOUCH_DEVICE} from '#/env'
import {useActorStatus} from '#/features/liveNow'
import {LiveStatus} from '#/features/liveNow/components/LiveStatusDialog'
@@ -61,7 +62,7 @@ const floatingMiddlewares = [
export function ProfileHoverCard(props: ProfileHoverCardProps) {
const prefetchProfileQuery = usePrefetchProfileQuery()
const prefetchedProfile = useRef(false)
const prefetchedProfile = React.useRef(false)
const onPointerMove = () => {
if (!prefetchedProfile.current) {
prefetchedProfile.current = true
@@ -116,7 +117,7 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) {
middleware: floatingMiddlewares,
})
const [currentState, dispatch] = useReducer(
const [currentState, dispatch] = React.useReducer(
// Tip: console.log(state, action) when debugging.
(state: State, action: Action): State => {
// Pressing within a card should always hide it.
@@ -262,7 +263,7 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) {
{stage: 'hidden'},
)
useEffect(() => {
React.useEffect(() => {
if (currentState.effect) {
const effect = currentState.effect
return effect()
@@ -270,16 +271,16 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) {
}, [currentState])
const prefetchProfileQuery = usePrefetchProfileQuery()
const prefetchedProfile = useRef(false)
const prefetchIfNeeded = useCallback(async () => {
const prefetchedProfile = React.useRef(false)
const prefetchIfNeeded = React.useCallback(async () => {
if (!prefetchedProfile.current) {
prefetchedProfile.current = true
prefetchProfileQuery(props.did)
}
}, [prefetchProfileQuery, props.did])
const didFireHover = useRef(false)
const onPointerMoveTarget = useCallback(() => {
const didFireHover = React.useRef(false)
const onPointerMoveTarget = React.useCallback(() => {
prefetchIfNeeded()
// Conceptually we want something like onPointerEnter,
// but we want to ignore entering only due to scrolling.
@@ -290,20 +291,20 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) {
}
}, [prefetchIfNeeded])
const onPointerLeaveTarget = useCallback(() => {
const onPointerLeaveTarget = React.useCallback(() => {
didFireHover.current = false
dispatch('unhovered-target')
}, [])
const onPointerEnterCard = useCallback(() => {
const onPointerEnterCard = React.useCallback(() => {
dispatch('hovered-card')
}, [])
const onPointerLeaveCard = useCallback(() => {
const onPointerLeaveCard = React.useCallback(() => {
dispatch('unhovered-card')
}, [])
const onPress = useCallback(() => {
const onPress = React.useCallback(() => {
dispatch('pressed')
}, [])
@@ -411,7 +412,7 @@ let Card = ({
</View>
)
}
Card = memo(Card)
Card = React.memo(Card)
function Inner({
profile,
@@ -425,7 +426,7 @@ function Inner({
const t = useTheme()
const {_, i18n} = useLingui()
const {currentAccount} = useSession()
const moderation = useMemo(
const moderation = React.useMemo(
() => moderateProfile(profile, moderationOpts),
[profile, moderationOpts],
)
@@ -453,11 +454,12 @@ function Inner({
did: profile.did,
handle: profile.handle,
})
const isMe = useMemo(
const isMe = React.useMemo(
() => currentAccount?.did === profile.did,
[currentAccount, profile],
)
const isLabeler = profile.associated?.labeler
const verification = useSimpleVerificationState({profile})
return (
<View>
@@ -525,16 +527,20 @@ function Inner({
moderation.ui('displayName'),
)}
</Text>
<ProfileBadges
profile={profile}
size="md"
style={[
a.pl_xs,
{
marginTop: -1,
},
]}
/>
{verification.showBadge && (
<View
style={[
a.pl_xs,
{
marginTop: -2,
},
]}>
<VerificationCheck
width={16}
verifier={verification.role === 'verifier'}
/>
</View>
)}
</View>
<ProfileHeaderHandle profile={profileShadow} disableTaps />

Some files were not shown because too many files have changed in this diff Show More