Compare commits

...

31 Commits

Author SHA1 Message Date
Eric Bailey d323fe8f2c Let's do 20 2026-03-20 11:31:31 -05:00
Eric Bailey e94426685b Increase parent batch size to reduce onStartReached calls 2026-03-20 11:11:06 -05:00
DS Boyce 3e7d7ce5f4 Fix issue with site loading on older versions of Safari (#10077) 2026-03-19 15:50:25 -07:00
DS Boyce 876e20166a Ensure mute state stays in sync after mutation (#10067) 2026-03-19 06:18:48 -07:00
pfrazee 2a87f6f6b5 Nightly source-language update 2026-03-19 03:12:12 +00:00
Eric Bailey bfd2d20192 Add back starter packs button in ProfileMenu (#10069) 2026-03-18 18:29:22 -05:00
Eric Bailey dc8570c524 Bump keyboard controller and add missing provider on web (#10068) 2026-03-18 15:43:22 -05:00
Samuel Newman 530afe87c7 web: LRU screen cache to bound memory in long sessions (#10063)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 08:50:48 -07:00
Eric Bailey 317ce2b3da Prep 1.119.0 (#10062) 2026-03-17 16:16:01 -05:00
Eric Bailey 45df50ec19 Rename translation properties for clarity (#10061) 2026-03-17 13:59:28 -05:00
surfdude29 b9a3256e51 Don't strip query parameters on in-app navigation (#9948) 2026-03-17 13:43:37 -05:00
DS Boyce 1386a559b7 Log languages a post is tagged with after translating (#10014)
Co-authored-by: Eric Bailey <git@esb.lol>
2026-03-17 12:31:23 -05:00
RetroSunstar be0d00de17 Set displayName and description to undefined if no values are provided during a profile edit (#10016) 2026-03-17 12:04:27 -05:00
RetroSunstar dbba97f28d Use proper constants.ts exports for Edit Profile Dialog limits (#10054) 2026-03-17 12:04:04 -05:00
Samuel Newman 5e8ef6aa9b Adjust VTT cue line to avoid occlusion by video controls (#10017)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 11:05:58 -05:00
surfdude29 177bdcd2b7 [bskylink] URL-encode apostrophes before HTML escaping (#9559) 2026-03-16 11:18:23 -07:00
pfrazee 2027589c55 Nightly source-language update 2026-03-14 03:04:35 +00:00
DS Boyce b8d60eb0e2 Address lint warnings in List.web.tsx (#10046) 2026-03-13 09:41:38 -07:00
DS Boyce 97fdd7c59b Create new useSuggestedFollowsByActorWithDismiss hook (#10048) 2026-03-13 09:18:23 -07:00
pfrazee 6afe48db6a Nightly source-language update 2026-03-13 03:06:17 +00:00
DS Boyce 0b6ff8000d Remove getSuggestedFollowsByActor fallbacks and use recIdStr (#9988) 2026-03-12 16:57:38 -07:00
DS Boyce 35cb2bcf94 Create codemod for updating Toast calls to v2 (#10045) 2026-03-12 11:35:58 -07:00
DS Boyce 9c9970f680 Don't show chat notification if viewer is age gated (#10042) 2026-03-12 11:21:57 -07:00
DS Boyce 7b5d5a4f76 Provide age-restricted viewers the option to delete their account (#10041) 2026-03-12 11:13:23 -07:00
Samuel Newman 4737bfb7ed Update expo deps, unpin things (#10044) 2026-03-12 05:33:11 -07:00
pfrazee 374ce2c39e Nightly source-language update 2026-03-12 03:08:04 +00:00
DS Boyce 1db01a09a8 Create codemod for addressing ESLint warnings (#10032) 2026-03-11 15:51:31 -07:00
Samuel Newman 80429ec902 Add “download image” option to web, simplify downloads (#10025) 2026-03-11 23:44:19 +02:00
heikadog 0c7b2d5353 Update issue templates to take uploads, and fix typo (#10036) 2026-03-11 14:50:35 -05:00
DS Boyce 850e6e6f52 Add new metrics for post menu interactions (#10022)
Co-authored-by: Eric Bailey <git@esb.lol>
2026-03-11 13:30:33 -05:00
Eric Bailey 0937f522af Serve og:video tags on post URLs (#10039) 2026-03-11 11:46:27 -05:00
386 changed files with 66649 additions and 63569 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
name: "Bug Report"
description: "Create a report for an issue you have experience in the app."
description: "Create a report for an issue you have experienced in the app."
labels: ["bug"]
body:
- type: markdown
@@ -19,13 +19,14 @@ body:
4. See error
validations:
required: true
- type: textarea
- type: upload
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?
+2 -1
View File
@@ -26,13 +26,14 @@ body:
4. See error
validations:
required: true
- type: textarea
- type: upload
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?
+2 -1
View File
@@ -15,7 +15,7 @@ body:
implement it in a timely manner.
validations:
required: true
- type: textarea
- type: upload
attributes:
label: Attachments
description: |
@@ -24,6 +24,7 @@ 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
@@ -0,0 +1,135 @@
/**
* 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
@@ -0,0 +1,106 @@
/**
* 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()
}
+4 -2
View File
@@ -91,7 +91,8 @@ appId: xyz.blueskyweb.app
- tapOn: "Add user to list"
- swipe:
direction: DOWN
- assertVisible: "View Bob's profile"
- assertVisible:
id: "profileCard-bob.test-link"
- tapOn: "Posts"
- assertVisible:
@@ -123,7 +124,8 @@ appId: xyz.blueskyweb.app
- tapOn: "Good Ppl"
- tapOn: "People"
- assertVisible: "View Bob's profile"
- assertVisible:
id: "profileCard-bob.test-link"
- tapOn:
point: "90%,43%"
- tapOn:
+11 -1
View File
@@ -1,10 +1,20 @@
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(link)}'" />
<meta http-equiv="refresh" content="0; URL='${escapeHTML(safeLink)}'" />
<meta
http-equiv="Cache-Control"
content="no-store, no-cache, must-revalidate, max-age=0" />
+16
View File
@@ -590,6 +590,14 @@ 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 {
@@ -600,6 +608,14 @@ 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,6 +34,14 @@
<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 }}">
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "dev-env",
"version": "0.0.0",
"scripts": {
"e2e:mock-server": "NODE_ENV=development ./dev-infra/with-test-redis-and-db.sh ts-node ./mock-server.ts"
"start": "NODE_ENV=development ./dev-infra/with-test-redis-and-db.sh ts-node ./mock-server.ts"
},
"dependencies": {
"@atproto/dev-env": "^0.3.213",
+1 -2
View File
@@ -47,8 +47,7 @@ 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: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. 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. Create a PR, ensure the translations all look correct, and merge.
1. If needed:
1. Merge all approved translation PRs (contributions from outside crowdin).
+1
View File
@@ -37,6 +37,7 @@ export default defineConfig(
'*.e2e.ts',
'*.e2e.tsx',
'eslint.config.mjs',
'.jscodeshift/**',
],
},
+24 -20
View File
@@ -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 e2e:mock-server",
"e2e:mock-server": "cd dev-env && yarn start",
"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,6 +70,7 @@
"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",
@@ -85,7 +86,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.7",
"@bsky.app/expo-translate-text": "^0.2.9",
"@bsky.app/react-native-mmkv": "2.12.5",
"@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet",
"@emoji-mart/data": "^1.2.1",
@@ -143,7 +144,7 @@
"emoji-mart": "^5.6.0",
"emoji-regex": "^10.4.0",
"eventemitter3": "^5.0.1",
"expo": "^54.0.27",
"expo": "^54.0.33",
"expo-application": "~7.0.8",
"expo-blur": "~15.0.8",
"expo-build-properties": "~1.0.10",
@@ -152,28 +153,28 @@
"expo-contacts": "^15.0.10",
"expo-dev-client": "~6.0.20",
"expo-device": "~8.0.10",
"expo-file-system": "~19.0.20",
"expo-font": "~14.0.10",
"expo-file-system": "~19.0.21",
"expo-font": "~14.0.11",
"expo-haptics": "~15.0.8",
"expo-image": "~3.0.11",
"expo-image-manipulator": "~14.0.8",
"expo-image-picker": "~17.0.9",
"expo-image-picker": "~17.0.10",
"expo-intent-launcher": "~13.0.8",
"expo-keep-awake": "~15.0.8",
"expo-linear-gradient": "~15.0.8",
"expo-linking": "~8.0.10",
"expo-linking": "~8.0.11",
"expo-localization": "~17.0.8",
"expo-location": "~19.0.8",
"expo-media-library": "~18.2.1",
"expo-notifications": "~0.32.14",
"expo-notifications": "~0.32.16",
"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.12",
"expo-splash-screen": "~31.0.13",
"expo-system-ui": "~6.0.9",
"expo-updates": "~29.0.14",
"expo-video": "~3.0.15",
"expo-updates": "~29.0.16",
"expo-video": "~3.0.16",
"expo-video-thumbnails": "^10.0.8",
"expo-web-browser": "~15.0.10",
"fast-deep-equal": "^3.1.3",
@@ -208,7 +209,7 @@
"react-native-drawer-layout": "^4.2.2",
"react-native-edge-to-edge": "^1.6.0",
"react-native-gesture-handler": "~2.28.0",
"react-native-keyboard-controller": "^1.20.7",
"react-native-keyboard-controller": "^1.21.0",
"react-native-pager-view": "6.8.0",
"react-native-progress": "bluesky-social/react-native-progress",
"react-native-qrcode-styled": "^0.3.3",
@@ -238,8 +239,9 @@
"@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.1",
"@expo/config-plugins": "~54.0.4",
"@lingui/babel-plugin-lingui-macro": "^5.9.2",
"@lingui/cli": "^5.9.2",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
@@ -258,7 +260,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.0",
"babel-preset-expo": "~54.0.10",
"eslint": "^9.39.2",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-bsky-internal": "link:./eslint",
@@ -275,7 +277,7 @@
"husky": "^8.0.3",
"is-ci": "^3.0.1",
"jest": "^29.7.0",
"jest-expo": "~54.0.14",
"jest-expo": "~54.0.17",
"jest-junit": "^16.0.0",
"lint-staged": "^13.2.3",
"lockfile-lint": "^4.14.0",
@@ -291,13 +293,15 @@
"resolutions": {
"@react-native/babel-preset": "0.81.5",
"@react-native/normalize-colors": "0.81.5",
"**/@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",
"**/@expo/image-utils": "0.8.12",
"**/multiformats": "9.9.0",
"unicode-segmenter": "0.14.5",
"@types/estree": "1.0.6"
"@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"
},
"jest": {
"preset": "jest-expo/ios",
-44
View File
@@ -1,44 +0,0 @@
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
@@ -0,0 +1,15 @@
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
@@ -1,992 +0,0 @@
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
@@ -0,0 +1,170 @@
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 {
+9 -10
View File
@@ -1,7 +1,7 @@
import '#/logger/sentry/setup'
import '#/view/icons'
import React, {useEffect, useState} from 'react'
import {Fragment, useEffect, useState} from 'react'
import {GestureHandlerRootView} from 'react-native-gesture-handler'
import {KeyboardProvider as KeyboardControllerProvider} from 'react-native-keyboard-controller'
import {
@@ -58,7 +58,6 @@ 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'
@@ -68,6 +67,7 @@ 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] = React.useState(false)
const [isReady, setIsReady] = useState(false)
const {currentAccount} = useSession()
const {resumeSession} = useSessionApi()
const theme = useColorModeTheme()
@@ -139,10 +139,9 @@ function InnerApp() {
useEffect(() => {
return listenSessionDropped(() => {
Toast.show(
_(msg`Sorry! Your session expired. Please sign in again.`),
'info',
)
Toast.show(_(msg`Sorry! Your session expired. Please sign in again.`), {
type: 'info',
})
})
}, [_])
@@ -152,7 +151,7 @@ function InnerApp() {
<ContextMenuProvider>
<Splash isReady={isReady && hasCheckedReferrer}>
<VideoVolumeProvider>
<React.Fragment
<Fragment
// Resets the entire tree below when it changes:
key={currentAccount?.did}>
<AnalyticsFeaturesContext>
@@ -208,7 +207,7 @@ function InnerApp() {
</PolicyUpdateOverlayProvider>
</QueryProvider>
</AnalyticsFeaturesContext>
</React.Fragment>
</Fragment>
</VideoVolumeProvider>
</Splash>
</ContextMenuProvider>
@@ -220,7 +219,7 @@ function InnerApp() {
function App() {
const [isReady, setReady] = useState(false)
React.useEffect(() => {
useEffect(() => {
Promise.all([initPersistedState(), Geo.resolve(), setupDeviceId]).then(() =>
setReady(true),
)
+30 -28
View File
@@ -3,6 +3,7 @@ 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'
@@ -47,7 +48,6 @@ 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,6 +58,7 @@ 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,
@@ -115,10 +116,9 @@ function InnerApp() {
useEffect(() => {
return listenSessionDropped(() => {
Toast.show(
_(msg`Sorry! Your session expired. Please sign in again.`),
'info',
)
Toast.show(_(msg`Sorry! Your session expired. Please sign in again.`), {
type: 'info',
})
})
}, [_])
@@ -212,29 +212,31 @@ function App() {
<Geo.Provider>
<AppConfigProvider>
<A11yProvider>
<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>
</KeyboardControllerProvider>
</A11yProvider>
</AppConfigProvider>
</Geo.Provider>
+6 -8
View File
@@ -1,4 +1,4 @@
import React, {useCallback, useEffect} from 'react'
import {forwardRef, useCallback, useEffect, useState} from 'react'
import {
AccessibilityInfo,
Image as RNImage,
@@ -29,7 +29,7 @@ const darkSplashImageUri = RNImage.resolveAssetSource(
darkSplashImagePointer,
).uri
export const Logo = React.forwardRef(function LogoImpl(props: SvgProps, ref) {
export const Logo = forwardRef(function LogoImpl(props: SvgProps, ref) {
const width = 1000
const height = width * (67 / 64)
return (
@@ -58,12 +58,10 @@ export function Splash(props: React.PropsWithChildren<Props>) {
const outroLogo = useSharedValue(0)
const outroApp = useSharedValue(0)
const outroAppOpacity = useSharedValue(0)
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 [isAnimationComplete, setIsAnimationComplete] = useState(false)
const [isImageLoaded, setIsImageLoaded] = useState(false)
const [isLayoutReady, setIsLayoutReady] = useState(false)
const [reduceMotion, setReduceMotion] = useState<boolean | undefined>(false)
const isReady =
props.isReady &&
isImageLoaded &&
+33 -3
View File
@@ -12,6 +12,8 @@ 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'
@@ -49,6 +51,8 @@ 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()
@@ -71,6 +75,7 @@ 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
}, [])
@@ -234,18 +239,38 @@ export function NoAccessScreen() {
</View>
)}
<View style={[a.pt_lg, a.gap_xl]}>
<View style={[a.pt_lg, a.gap_xl, {maxWidth: 280}]}>
<Logo width={120} textFill={t.atoms.text.color} />
<Text style={[a.text_sm, a.italic, t.atoms.text_contrast_medium]}>
<Text
style={[
a.text_sm,
a.italic,
a.leading_snug,
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>
@@ -255,6 +280,11 @@ 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
const serverStateEnabled = false || IS_E2E
export const serverState: AppBskyAgeassuranceGetState.OutputSchema | undefined =
serverStateEnabled
? {
+4 -2
View File
@@ -2,8 +2,10 @@ import {createContext, useCallback, useContext, useEffect, useMemo} from 'react'
import {useGetAndRegisterPushToken} from '#/lib/notifications/notifications'
import {Provider as RedirectOverlayProvider} from '#/ageAssurance/components/RedirectOverlay'
import {AgeAssuranceDataProvider} from '#/ageAssurance/data'
import {useAgeAssuranceDataContext} from '#/ageAssurance/data'
import {
AgeAssuranceDataProvider,
useAgeAssuranceDataContext,
} from '#/ageAssurance/data'
import {logger} from '#/ageAssurance/logger'
import {
useAgeAssuranceState,
+11 -15
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {createContext, useCallback, useContext, useMemo, useState} from 'react'
import {type Theme, type ThemeName} from '@bsky.app/alf'
import {
@@ -46,7 +46,7 @@ export type Alf = {
/*
* Context
*/
export const Context = React.createContext<Alf>({
export const Context = createContext<Alf>({
themeName: 'light',
theme: themes.light,
themes,
@@ -65,15 +65,13 @@ export function ThemeProvider({
children,
theme: themeName,
}: React.PropsWithChildren<{theme: ThemeName}>) {
const [fontScale, setFontScale] = React.useState<Alf['fonts']['scale']>(() =>
const [fontScale, setFontScale] = useState<Alf['fonts']['scale']>(() =>
getFontScale(),
)
const [fontScaleMultiplier, setFontScaleMultiplier] = React.useState(() =>
const [fontScaleMultiplier, setFontScaleMultiplier] = useState(() =>
computeFontScaleMultiplier(fontScale),
)
const setFontScaleAndPersist = React.useCallback<
Alf['fonts']['setFontScale']
>(
const setFontScaleAndPersist = useCallback<Alf['fonts']['setFontScale']>(
fs => {
setFontScale(fs)
persistFontScale(fs)
@@ -81,12 +79,10 @@ export function ThemeProvider({
},
[setFontScale],
)
const [fontFamily, setFontFamily] = React.useState<Alf['fonts']['family']>(
() => getFontFamily(),
const [fontFamily, setFontFamily] = useState<Alf['fonts']['family']>(() =>
getFontFamily(),
)
const setFontFamilyAndPersist = React.useCallback<
Alf['fonts']['setFontFamily']
>(
const setFontFamilyAndPersist = useCallback<Alf['fonts']['setFontFamily']>(
ff => {
setFontFamily(ff)
persistFontFamily(ff)
@@ -94,7 +90,7 @@ export function ThemeProvider({
[setFontFamily],
)
const value = React.useMemo<Alf>(
const value = useMemo<Alf>(
() => ({
themes,
themeName: themeName,
@@ -122,12 +118,12 @@ export function ThemeProvider({
}
export function useAlf() {
return React.useContext(Context)
return useContext(Context)
}
export function useTheme(theme?: ThemeName) {
const alf = useAlf()
return React.useMemo(() => {
return useMemo(() => {
return theme ? alf.themes[theme] : alf.theme
}, [theme, alf])
}
+2 -2
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useLayoutEffect} 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()
React.useLayoutEffect(() => {
useLayoutEffect(() => {
updateDocument(theme)
}, [theme])
+2 -2
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useMemo} 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 React.useMemo(() => {
return useMemo(() => {
return {
paddingTop: top === 0 ? 0 : gutters[top][activeBreakpoint || 'default'],
paddingRight:
+107 -7
View File
@@ -470,6 +470,10 @@ export type Events = {
profileDid: string
position?: number
}
'profile:mute': {}
'profile:unmute': {}
'profile:block': {}
'profile:unblock': {}
'suggestedUser:follow': {
logContext:
| 'Explore'
@@ -703,20 +707,115 @@ export type Events = {
'reportDialog:failure': {}
translate: {
sourceLanguages: string[]
targetLanguage: string
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.
*/
textLength: number
googleTranslate: boolean
}
'translate:result': {
method: 'on-device' | 'google-translate' | 'fallback-alert'
success: boolean
os: Platform['OS']
sourceLanguage: string | null
targetLanguage: string
/**
* 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
}
'translate:override': {
os: Platform['OS']
sourceLanguage: string
targetLanguage: string
/**
* 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
}
'verification:create': {}
@@ -812,6 +911,7 @@ export type Events = {
canUpdateBirthday: boolean
}
'ageAssurance:noAccessScreen:openBirthdateDialog': {}
'ageAssurance:noAccessScreen:openDeleteAccountDialog': {}
/*
* Specifically for the `BlockedGeoOverlay`
+3 -3
View File
@@ -1,4 +1,4 @@
import React, {useCallback} from 'react'
import {Fragment, useCallback} from 'react'
import {View} from 'react-native'
import {type AppBskyActorDefs} from '@atproto/api'
import {msg} from '@lingui/core/macro'
@@ -52,7 +52,7 @@ export function AccountList({
t.atoms.border_contrast_low,
]}>
{accounts.map(account => (
<React.Fragment key={account.did}>
<Fragment key={account.did}>
<AccountItem
profile={profiles?.profiles.find(p => p.did === account.did)}
account={account}
@@ -61,7 +61,7 @@ export function AccountList({
isPendingAccount={account.did === pendingDid}
/>
<View style={[a.border_b, t.atoms.border_contrast_low]} />
</React.Fragment>
</Fragment>
))}
<Button
testID="chooseAddAccountBtn"
+2 -2
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useCallback} 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 = React.useCallback(
const onChangeAppLanguage = useCallback(
(value: string) => {
if (!value) return
if (sanitizedLang !== value) {
+77 -71
View File
@@ -1,4 +1,11 @@
import React from 'react'
import {
createContext,
forwardRef,
useCallback,
useContext,
useMemo,
useState,
} from 'react'
import {
type AccessibilityProps,
type GestureResponderEvent,
@@ -108,7 +115,7 @@ export type ButtonProps = Pick<
export type ButtonTextProps = TextProps &
VariantProps & {disabled?: boolean; emoji?: boolean}
const Context = React.createContext<VariantProps & ButtonState>({
const Context = createContext<VariantProps & ButtonState>({
hovered: false,
focused: false,
pressed: false,
@@ -117,10 +124,10 @@ const Context = React.createContext<VariantProps & ButtonState>({
Context.displayName = 'ButtonContext'
export function useButtonContext() {
return React.useContext(Context)
return useContext(Context)
}
export const Button = React.forwardRef<View, ButtonProps>(
export const Button = forwardRef<View, ButtonProps>(
(
{
children,
@@ -153,13 +160,13 @@ export const Button = React.forwardRef<View, ButtonProps>(
}
const t = useTheme()
const [state, setState] = React.useState({
const [state, setState] = useState({
pressed: false,
hovered: false,
focused: false,
})
const onPressIn = React.useCallback(
const onPressIn = useCallback(
(e: GestureResponderEvent) => {
setState(s => ({
...s,
@@ -169,7 +176,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
},
[setState, onPressInOuter],
)
const onPressOut = React.useCallback(
const onPressOut = useCallback(
(e: GestureResponderEvent) => {
setState(s => ({
...s,
@@ -179,7 +186,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
},
[setState, onPressOutOuter],
)
const onHoverIn = React.useCallback(
const onHoverIn = useCallback(
(e: MouseEvent) => {
setState(s => ({
...s,
@@ -189,7 +196,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
},
[setState, onHoverInOuter],
)
const onHoverOut = React.useCallback(
const onHoverOut = useCallback(
(e: MouseEvent) => {
setState(s => ({
...s,
@@ -199,7 +206,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
},
[setState, onHoverOutOuter],
)
const onFocus = React.useCallback(
const onFocus = useCallback(
(e: NativeSyntheticEvent<TargetedEvent>) => {
setState(s => ({
...s,
@@ -209,7 +216,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
},
[setState, onFocusOuter],
)
const onBlur = React.useCallback(
const onBlur = useCallback(
(e: NativeSyntheticEvent<TargetedEvent>) => {
setState(s => ({
...s,
@@ -220,7 +227,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
[setState, onBlurOuter],
)
const {baseStyles, hoverStyles} = React.useMemo(() => {
const {baseStyles, hoverStyles} = useMemo(() => {
const baseStyles: ViewStyle[] = []
const hoverStyles: ViewStyle[] = []
@@ -526,7 +533,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
}
}, [t, variant, color, size, shape, disabled])
const context = React.useMemo<ButtonContext>(
const context = useMemo<ButtonContext>(
() => ({
...state,
variant,
@@ -581,7 +588,7 @@ Button.displayName = 'Button'
export function useSharedButtonTextStyles() {
const t = useTheme()
const {color, variant, disabled, size} = useButtonContext()
return React.useMemo(() => {
return useMemo(() => {
const baseStyles: TextStyle[] = []
/*
@@ -778,67 +785,66 @@ export function ButtonIcon({
}) {
const {size: buttonSize, shape: buttonShape} = useButtonContext()
const textStyles = useSharedButtonTextStyles()
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
>)
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
>)
/*
* 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,
/*
* 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,
}[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,
}[buttonSize || 'small']
}
return {
iconSize,
iconContainerSize,
iconNegativeMargin,
}
}, [buttonSize, buttonShape, size])
return {
iconSize,
iconContainerSize,
iconNegativeMargin,
}
}, [buttonSize, buttonShape, size])
return (
<View
+8 -5
View File
@@ -1,4 +1,7 @@
import React, {
import {
cloneElement,
Fragment,
isValidElement,
useCallback,
useEffect,
useId,
@@ -689,22 +692,22 @@ export function Outer({
t.atoms.border_contrast_low,
]}>
{flattenReactChildren(children).map((child, i) => {
return React.isValidElement(child) &&
return isValidElement(child) &&
(child.type === Item || child.type === Divider) ? (
<React.Fragment key={i}>
<Fragment key={i}>
{i > 0 ? (
<View
style={[a.border_b, t.atoms.border_contrast_low]}
/>
) : null}
{React.cloneElement(child, {
{cloneElement(child, {
// @ts-expect-error not typed
style: {
borderRadius: 0,
borderWidth: 0,
},
})}
</React.Fragment>
</Fragment>
) : null
})}
</View>
+16 -9
View File
@@ -1,4 +1,11 @@
import React, {useImperativeHandle} from 'react'
import {
forwardRef,
useCallback,
useContext,
useImperativeHandle,
useMemo,
useState,
} from 'react'
import {
FlatList,
type FlatListProps,
@@ -48,15 +55,15 @@ export function Outer({
}: React.PropsWithChildren<DialogOuterProps>) {
const {_} = useLingui()
const {gtMobile} = useBreakpoints()
const [isOpen, setIsOpen] = React.useState(false)
const [isOpen, setIsOpen] = useState(false)
const {setDialogIsOpen} = useDialogStateControlContext()
const open = React.useCallback(() => {
const open = useCallback(() => {
setDialogIsOpen(control.id, true)
setIsOpen(true)
}, [setIsOpen, setDialogIsOpen, control.id])
const close = React.useCallback<DialogControlProps['close']>(
const close = useCallback<DialogControlProps['close']>(
cb => {
setDialogIsOpen(control.id, false)
setIsOpen(false)
@@ -80,7 +87,7 @@ export function Outer({
[control.id, onClose, setDialogIsOpen],
)
const handleBackgroundPress = React.useCallback(
const handleBackgroundPress = useCallback(
async (e: GestureResponderEvent) => {
webOptions?.onBackgroundPress ? webOptions.onBackgroundPress(e) : close()
},
@@ -96,7 +103,7 @@ export function Outer({
[close, open],
)
const context = React.useMemo(
const context = useMemo(
() => ({
close,
isNativeDialog: false,
@@ -165,7 +172,7 @@ export function Inner({
contentContainerStyle,
}: DialogInnerProps) {
const t = useTheme()
const {close} = React.useContext(Context)
const {close} = useContext(Context)
const {gtMobile} = useBreakpoints()
const {reduceMotionEnabled} = useA11y()
FocusGuards.useFocusGuards()
@@ -215,7 +222,7 @@ export function Inner({
export const ScrollableInner = Inner
export const InnerFlatList = React.forwardRef<
export const InnerFlatList = forwardRef<
FlatList,
FlatListProps<any> & {label: string} & {
webInnerStyle?: StyleProp<ViewStyle>
@@ -284,7 +291,7 @@ export function FlatListFooter({
export function Close() {
const {_} = useLingui()
const {close} = React.useContext(Context)
const {close} = useContext(Context)
return (
<View
style={[
+2 -2
View File
@@ -1,9 +1,9 @@
import React from 'react'
import {useEffect} from 'react'
import {type DialogControlProps} from '#/components/Dialog/types'
export function useAutoOpen(control: DialogControlProps, showTimeout?: number) {
React.useEffect(() => {
useEffect(() => {
if (showTimeout) {
const timeout = setTimeout(() => {
control.open()
+4 -2
View File
@@ -18,7 +18,6 @@ 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 {
@@ -33,6 +32,7 @@ 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,7 +313,9 @@ 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`, 'xmark')
Toast.show(l`Failed to update feeds`, {
type: 'error',
})
}
},
[l, pin, saveFeeds, removeFeed, uri, savedFeedConfig, type],
+23 -135
View File
@@ -18,10 +18,7 @@ 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 {
useSuggestedFollowsByActorQuery,
useSuggestedFollowsQuery,
} from '#/state/queries/suggested-follows'
import {useSuggestedFollowsByActorWithDismiss} from '#/state/queries/suggested-follows'
import {useSession} from '#/state/session'
import * as userActionHistory from '#/state/userActionHistory'
import {type SeenPost} from '#/state/userActionHistory'
@@ -170,10 +167,12 @@ 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
@@ -216,86 +215,13 @@ export function SuggestedFollows({feed}: {feed: FeedDescriptor}) {
}
export function SuggestedFollowsProfile({did}: {did: string}) {
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,
])
const {profiles, onDismiss, isLoading, error} =
useSuggestedFollowsByActorWithDismiss({did})
return (
<ProfileGrid
isSuggestionsLoading={isSuggestionsLoading}
profiles={filteredProfiles}
totalProfileCount={allProfiles.length}
isSuggestionsLoading={isLoading}
profiles={profiles}
error={error}
viewContext="profile"
onDismiss={onDismiss}
@@ -304,21 +230,11 @@ 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())
@@ -326,66 +242,29 @@ export function SuggestedFollowsHome() {
setDismissedDids(prev => new Set(prev).add(did))
}, [])
// Combine profiles from experimental query with paginated suggestions
const allProfiles = useMemo(() => {
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<{
const result: Array<{
actor: bsky.profile.AnyProfileView
recId?: number
recId?: string
}> = []
for (const profile of experimentalProfiles) {
if (!seen.has(profile.did)) {
seen.add(profile.did)
combined.push({actor: profile, recId: undefined})
}
result.push({actor: profile, recId: undefined})
}
for (const profile of fallbackProfiles) {
if (!seen.has(profile.actor.did)) {
seen.add(profile.actor.did)
combined.push(profile)
}
}
return combined
}, [experimentalProfiles, moreSuggestions?.pages])
return result
}, [experimentalProfiles])
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 || suggestionsError}
error={experimentalError}
viewContext="feed"
onDismiss={onDismiss}
/>
@@ -400,14 +279,16 @@ export function ProfileGrid({
viewContext = 'feed',
onDismiss,
isVisible = true,
onRequestHide,
}: {
isSuggestionsLoading: boolean
profiles: {actor: bsky.profile.AnyProfileView; recId?: number}[]
profiles: {actor: bsky.profile.AnyProfileView; recId?: string}[]
totalProfileCount?: number
error: Error | null
viewContext: 'profile' | 'profileHeader' | 'feed'
onDismiss?: (did: string) => void
isVisible?: boolean
onRequestHide?: () => void
}) {
const t = useTheme()
const ax = useAnalytics()
@@ -651,6 +532,13 @@ 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,5 +1,4 @@
import {View} from 'react-native'
import type React from 'react'
import {atoms as a, type ViewStyleProp} from '#/alf'
+4 -6
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useRef} from 'react'
import {View} from 'react-native'
import {
type AppBskyActorDefs,
@@ -46,9 +46,7 @@ export function KnownFollowers({
minimal?: boolean
showIfEmpty?: boolean
}) {
const cache = React.useRef<Map<string, AppBskyActorDefs.KnownFollowers>>(
new Map(),
)
const cache = useRef<Map<string, AppBskyActorDefs.KnownFollowers>>(new Map())
/*
* Results for `knownFollowers` are not sorted consistently, so when
@@ -190,7 +188,7 @@ function KnownFollowersInner({
numberOfLines={2}>
{slice.length >= 2 ? (
// 2-n followers, including blocks
serverCount > 2 ? (
serverCount > 2 ? ( // only 2
<Trans>
Followed by{' '}
<Text emoji key={slice[0].profile.did} style={textStyle}>
@@ -206,7 +204,7 @@ function KnownFollowersInner({
one="# other"
other="# others"
/>
</Trans> // only 2
</Trans>
) : (
<Trans>
Followed by{' '}
@@ -3,7 +3,6 @@ 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 React from 'react'
import {useCallback} from 'react'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
@@ -22,7 +22,7 @@ export function LanguageSelect({
}) {
const {_} = useLingui()
const handleOnChange = React.useCallback(
const handleOnChange = useCallback(
(value: string) => {
if (!value) return
onChange(sanitizeAppLanguageSetting(value))
+2 -2
View File
@@ -1,6 +1,6 @@
import React from 'react'
import {createContext} from 'react'
export const ScrollbarOffsetContext = React.createContext({
export const ScrollbarOffsetContext = createContext({
isWithinOffsetView: false,
})
ScrollbarOffsetContext.displayName = 'ScrollbarOffsetContext'
+5 -5
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useCallback, useMemo, useState} 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] = React.useState(false)
const [isPTRing, setIsPTRing] = 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 = React.useMemo(() => {
const likes = useMemo(() => {
if (data?.pages) {
return data.pages.flatMap(page => page.likes)
}
return []
}, [data])
const onRefresh = React.useCallback(async () => {
const onRefresh = useCallback(async () => {
setIsPTRing(true)
try {
await refetch()
@@ -66,7 +66,7 @@ export function LikedByList({uri}: {uri: string}) {
setIsPTRing(false)
}, [refetch, setIsPTRing])
const onEndReached = React.useCallback(async () => {
const onEndReached = useCallback(async () => {
if (isFetchingNextPage || !hasNextPage || isError) return
try {
await fetchNextPage()
@@ -1,6 +1,5 @@
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 React, {useMemo} from 'react'
import {useCallback, 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 = React.useCallback(
const onPress = useCallback(
(e: GestureResponderEvent) => {
const exitEarlyIfFalse = outerOnPress?.(e)
@@ -217,7 +217,7 @@ export function useLink({
],
)
const handleLongPress = React.useCallback(() => {
const handleLongPress = useCallback(() => {
const requiresWarning = Boolean(
!disableMismatchWarning &&
displayText &&
@@ -242,7 +242,7 @@ export function useLink({
linkWarningDialogControl,
])
const onLongPress = React.useCallback(
const onLongPress = useCallback(
(e: GestureResponderEvent) => {
const exitEarlyIfFalse = outerOnLongPress?.(e)
if (exitEarlyIfFalse === false) return
+3 -3
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useEffect, useMemo} 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 = React.useMemo(() => {
const href = useMemo(() => {
return createProfileListHref({list: view})
}, [view])
React.useEffect(() => {
useEffect(() => {
precacheList(queryClient, view)
}, [view, queryClient])
+2 -2
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useEffect} from 'react'
import Animated, {
Easing,
useAnimatedStyle,
@@ -20,7 +20,7 @@ export function Loader(props: Props) {
transform: [{rotate: rotation.get() + 'deg'}],
}))
React.useEffect(() => {
useEffect(() => {
rotation.set(() =>
withRepeat(withTiming(360, {duration: 500, easing: Easing.linear}), -1),
)
-1
View File
@@ -1,5 +1,4 @@
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 React from 'react'
import {createContext, useContext} from 'react'
import {type ContextType, type ItemContextType} from '#/components/Menu/types'
export const Context = React.createContext<ContextType | null>(null)
export const Context = createContext<ContextType | null>(null)
Context.displayName = 'MenuContext'
export const ItemContext = React.createContext<ItemContextType | null>(null)
export const ItemContext = createContext<ItemContextType | null>(null)
ItemContext.displayName = 'MenuItemContext'
export function useMenuContext() {
const context = React.useContext(Context)
const context = 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 = React.useContext(ItemContext)
const context = useContext(ItemContext)
if (!context) {
throw new Error('useMenuItemContext must be used within a Context.Provider')
-1
View File
@@ -4,7 +4,6 @@ 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 React from 'react'
import {useMemo} 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 = React.useMemo(() => {
const styles = 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} = React.useMemo(() => {
const {outer, avi, text} = useMemo(() => {
switch (size) {
case 'lg': {
return {
@@ -154,7 +154,7 @@ export function Label({
export function FollowsYou({size = 'sm'}: CommonProps) {
const t = useTheme()
const variantStyles = React.useMemo(() => {
const variantStyles = useMemo(() => {
switch (size) {
case 'sm':
case 'lg':
@@ -1,4 +1,4 @@
import React from 'react'
import {useCallback, useRef, useState} 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] = React.useState(false)
const [isPlayerActive, setIsPlayerActive] = useState(false)
// Tracking whether the gif has been loaded yet
const [isPrefetched, setIsPrefetched] = React.useState(false)
const [isPrefetched, setIsPrefetched] = useState(false)
// Tracking whether the image is animating
const [isAnimating, setIsAnimating] = React.useState(true)
const [isAnimating, setIsAnimating] = useState(true)
// Used for controlling animation
const imageRef = React.useRef<Image>(null)
const imageRef = useRef<Image>(null)
const load = React.useCallback(() => {
const load = 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 = React.useCallback(
const onPlayPress = useCallback(
(event: GestureResponderEvent) => {
// Don't propagate on web
event.preventDefault()
@@ -1,4 +1,4 @@
import React from 'react'
import {useCallback, useEffect, useMemo, useState} 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 = React.useCallback(
const onShouldStartLoadWithRequest = 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] = React.useState(false)
const [isLoading, setIsLoading] = React.useState(true)
const [isPlayerActive, setPlayerActive] = useState(false)
const [isLoading, setIsLoading] = useState(true)
const aspect = React.useMemo(() => {
const aspect = 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
React.useEffect(() => {
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 = React.useCallback(() => {
const onLoad = useCallback(() => {
setIsLoading(false)
}, [])
const onPlayPress = React.useCallback(
const onPlayPress = 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 = React.useCallback(() => {
const onAcceptConsent = useCallback(() => {
setPlayerActive(true)
}, [])
@@ -1,4 +1,4 @@
import React, {useCallback} from 'react'
import {useCallback, useMemo} 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 = React.useMemo(() => {
const embedPlayerParams = useMemo(() => {
const params = parseEmbedPlayerFromUrl(link.uri)
if (params && externalEmbedPrefs?.[params.source] !== 'hide') {
@@ -1,5 +1,7 @@
import React, {
import {
createContext,
useCallback,
useContext,
useEffect,
useId,
useMemo,
@@ -10,7 +12,7 @@ import {useWindowDimensions} from 'react-native'
import {IS_NATIVE, IS_WEB} from '#/env'
const Context = React.createContext<{
const Context = createContext<{
activeViewId: string | null
setActiveView: (viewId: string) => void
sendViewPosition: (viewId: string, y: number) => void
@@ -94,7 +96,7 @@ export function Provider({children}: {children: React.ReactNode}) {
}
export function useActiveVideoWeb() {
const context = React.useContext(Context)
const context = useContext(Context)
if (!context) {
throw new Error(
'useActiveVideoWeb must be used within a ActiveVideoWebProvider',
@@ -1,4 +1,4 @@
import {useEffect, useId, useRef, useState} from 'react'
import {useCallback, 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} = useHLS({
const {hlsRef, loop, updateCuePositions} = useHLS({
playlist: embed.playlist,
setHasSubtitleTrack,
setError,
@@ -90,6 +90,7 @@ export function VideoEmbedInnerWeb({
hasSubtitleTrack={hasSubtitleTrack}
isGif={embed.presentation === 'gif'}
altText={embed.alt}
updateCuePositions={updateCuePositions}
/>
</div>
</View>
@@ -145,6 +146,47 @@ 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[]
>([])
@@ -220,6 +262,10 @@ 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])
@@ -307,5 +353,6 @@ function useHLS({
return {
hlsRef,
loop: !hasLowQualityFragmentAtStart,
updateCuePositions,
}
}
@@ -48,6 +48,7 @@ export function Controls({
hasSubtitleTrack,
isGif,
altText,
updateCuePositions,
}: {
videoRef: React.RefObject<HTMLVideoElement | null>
hlsRef: React.RefObject<Hls | undefined | null>
@@ -61,6 +62,7 @@ export function Controls({
hasSubtitleTrack: boolean
isGif: boolean
altText?: string
updateCuePositions: (controlsVisible?: boolean) => void
}) {
const {
play,
@@ -294,6 +296,13 @@ 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,7 +1,6 @@
import React from 'react'
import {createContext, useContext, useMemo, useState} from 'react'
const Context = React.createContext<{
// native
const Context = createContext<{
muted: boolean
setMuted: React.Dispatch<React.SetStateAction<boolean>>
// web
@@ -11,10 +10,10 @@ const Context = React.createContext<{
Context.displayName = 'VideoVolumeContext'
export function Provider({children}: {children: React.ReactNode}) {
const [muted, setMuted] = React.useState(true)
const [volume, setVolume] = React.useState(1)
const [muted, setMuted] = useState(true)
const [volume, setVolume] = useState(1)
const value = React.useMemo(
const value = useMemo(
() => ({
muted,
setMuted,
@@ -28,7 +27,7 @@ export function Provider({children}: {children: React.ReactNode}) {
}
export function useVideoVolumeState() {
const context = React.useContext(Context)
const context = useContext(Context)
if (!context) {
throw new Error(
'useVideoVolumeState must be used within a VideoVolumeProvider',
@@ -38,7 +37,7 @@ export function useVideoVolumeState() {
}
export function useVideoMuteState() {
const context = React.useContext(Context)
const context = useContext(Context)
if (!context) {
throw new Error(
'useVideoMuteState must be used within a VideoVolumeProvider',
+65 -56
View File
@@ -1,14 +1,17 @@
import {useCallback, useMemo} from 'react'
import {Platform, type StyleProp, type TextStyle, View} from 'react-native'
import {type AppBskyFeedDefs} from '@atproto/api'
import {type AppBskyFeedDefs, AppBskyFeedPost} from '@atproto/api'
import {Trans, useLingui} from '@lingui/react/macro'
import {HITSLOP_30} from '#/lib/constants'
import {useGoogleTranslate} from '#/lib/hooks/useGoogleTranslate'
import {useTranslate} from '#/lib/translation'
import {type TranslationFunction} from '#/lib/translation'
import {
type TranslationFunction,
type TranslationFunctionParams,
} from '#/lib/translation'
import {
codeToLanguageName,
getPostLanguageTags,
isPostInLanguage,
languageName,
} from '#/locale/helpers'
@@ -25,18 +28,17 @@ 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,
postText,
postTextStyle = a.text_md,
}: {
hideTranslateLink?: boolean
post: AppBskyFeedDefs.PostView
postText: string
postTextStyle?: StyleProp<TextStyle>
}) {
const langPrefs = useLanguagePrefs()
@@ -44,6 +46,21 @@ export function TranslatedPost({
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])
@@ -55,11 +72,11 @@ export function TranslatedPost({
case 'success':
return (
<TranslationResult
clearTranslation={clearTranslation}
translate={translate}
postText={postText}
clearTranslation={clearTranslation}
initialTranslationParams={initialTranslationParams}
postTextStyle={postTextStyle}
sourceLanguage={
resultSourceLanguage={
translationState.sourceLanguage ?? null // Fallback primarily for iOS
}
translatedText={translationState.translatedText}
@@ -68,19 +85,18 @@ export function TranslatedPost({
case 'error':
return (
<TranslationError
translate={translate}
clearTranslation={clearTranslation}
message={translationState.message}
postText={postText}
primaryLanguage={langPrefs.primaryLanguage}
initialTranslationParams={initialTranslationParams}
/>
)
default:
return (
needsTranslation && (
<TranslationLink
postText={postText}
primaryLanguage={langPrefs.primaryLanguage}
translate={translate}
initialTranslationParams={initialTranslationParams}
/>
)
)
@@ -103,30 +119,18 @@ function TranslationLoading() {
}
function TranslationLink({
postText,
primaryLanguage,
translate,
initialTranslationParams,
}: {
postText: string
primaryLanguage: string
translate: TranslationFunction
initialTranslationParams: TranslationFunctionParams
}) {
const t = useTheme()
const {t: l} = useLingui()
const ax = useAnalytics()
const handleTranslate = useCallback(() => {
void translate({
text: postText,
targetLangCode: primaryLanguage,
})
ax.metric('translate', {
sourceLanguages: [], // todo: get from post maybe?
targetLanguage: primaryLanguage,
textLength: postText.length,
})
}, [ax, postText, primaryLanguage, translate])
void translate(initialTranslationParams)
}, [initialTranslationParams, translate])
return (
<View
@@ -158,22 +162,24 @@ function TranslationLink({
}
function TranslationError({
translate,
clearTranslation,
message,
postText,
primaryLanguage,
initialTranslationParams,
}: {
translate: TranslationFunction
clearTranslation: () => void
message: string
postText: string
primaryLanguage: string
initialTranslationParams: TranslationFunctionParams
}) {
const t = useTheme()
const {t: l} = useLingui()
const translate = useGoogleTranslate()
const handleFallback = () => {
void translate(postText, primaryLanguage)
void translate({
...initialTranslationParams,
forceGoogleTranslate: true,
})
}
return (
@@ -244,24 +250,24 @@ function TranslationError({
function TranslationResult({
clearTranslation,
translate,
postText,
postTextStyle,
sourceLanguage,
resultSourceLanguage,
translatedText,
initialTranslationParams,
}: {
clearTranslation: () => void
translate: TranslationFunction
postText: string
postTextStyle?: StyleProp<TextStyle>
sourceLanguage: string | null
resultSourceLanguage: string | null
translatedText: string
initialTranslationParams: TranslationFunctionParams
}) {
const t = useTheme()
const langPrefs = useLanguagePrefs()
const {i18n, t: l} = useLingui()
const langName = sourceLanguage
? codeToLanguageName(sourceLanguage, i18n.locale)
const langName = resultSourceLanguage
? codeToLanguageName(resultSourceLanguage, i18n.locale)
: undefined
const flattenedStyle = flatten(postTextStyle) ?? {}
@@ -320,7 +326,7 @@ function TranslationResult({
<Trans>Translated</Trans>
</Text>
)}
{sourceLanguage != null && (
{resultSourceLanguage != null && (
<>
<Text
style={[
@@ -333,9 +339,9 @@ function TranslationResult({
&middot;{' '}
</Text>
<TranslationLanguageSelect
sourceLanguage={sourceLanguage}
resultSourceLanguage={resultSourceLanguage}
translate={translate}
postText={postText}
initialTranslationParams={initialTranslationParams}
/>
</>
)}
@@ -359,12 +365,12 @@ function TranslationResult({
function TranslationLanguageSelect({
translate,
postText,
sourceLanguage,
resultSourceLanguage,
initialTranslationParams,
}: {
translate: TranslationFunction
postText: string
sourceLanguage: string
resultSourceLanguage: string
initialTranslationParams: TranslationFunctionParams
}) {
const t = useTheme()
const ax = useAnalytics()
@@ -380,8 +386,8 @@ function TranslationLanguageSelect({
)
.sort((a, b) => {
// Prioritize sourceLanguage at the top
if (a.code2 === sourceLanguage) return -1
if (b.code2 === sourceLanguage) return 1
if (a.code2 === resultSourceLanguage) return -1
if (b.code2 === resultSourceLanguage) return 1
// Localized sort
return languageName(a, langPrefs.appLanguage).localeCompare(
languageName(b, langPrefs.appLanguage),
@@ -392,25 +398,28 @@ 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, sourceLanguage],
[langPrefs, resultSourceLanguage],
)
const handleChangeTranslationLanguage = (sourceLangCode: string) => {
ax.metric('translate:override', {
os: Platform.OS,
sourceLanguage: sourceLangCode,
targetLanguage: langPrefs.primaryLanguage,
possibleSourceLanguages: initialTranslationParams.possibleSourceLanguages,
expectedSourceLanguage: sourceLangCode,
expectedTargetLanguage: initialTranslationParams.expectedTargetLanguage,
resultSourceLanguage,
})
void translate({
text: postText,
targetLangCode: langPrefs.primaryLanguage,
sourceLangCode,
text: initialTranslationParams.text,
expectedTargetLanguage: initialTranslationParams.expectedTargetLanguage,
expectedSourceLanguage: sourceLangCode,
possibleSourceLanguages: initialTranslationParams.possibleSourceLanguages,
})
}
return (
<Select.Root
value={sourceLanguage}
value={resultSourceLanguage}
onValueChange={handleChangeTranslationLanguage}>
<Select.Trigger label={l`Change the source language`}>
{({props}) => {
@@ -4,7 +4,6 @@ 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,
AppBskyFeedPost,
type AppBskyFeedPost,
type AppBskyFeedThreadgate,
AtUri,
type RichText as RichTextAPI,
@@ -28,6 +28,7 @@ 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'
@@ -56,7 +57,6 @@ 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,7 +216,9 @@ let PostMenuItems = ({
},
e => {
logger.error('Failed to delete post', {message: e})
Toast.show(l`Failed to delete post, please try again`, 'xmark')
Toast.show(l`Failed to delete post, please try again`, {
type: 'error',
})
},
)
}
@@ -246,36 +248,38 @@ 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`, 'xmark')
Toast.show(l`Failed to toggle thread mute, please try again`, {
type: 'error',
})
}
}
}
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`, 'clipboard-check')
Toast.show(l`Copied to clipboard`, {
type: 'success',
})
}
const onPressTranslate = () => {
void translate({
text: record.text,
targetLangCode: langPrefs.primaryLanguage,
expectedTargetLanguage: langPrefs.primaryLanguage,
possibleSourceLanguages: getPostLanguageTags(post),
})
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 = () => {
@@ -424,8 +428,17 @@ 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()}`, 'xmark')
Toast.show(l`There was an issue! ${e.toString()}`, {
type: 'error',
})
}
} finally {
ax.metric('postMenu:blockAccount', {
uri: postUri,
authorDid: postAuthor.did,
logContext,
feedDescriptor: feedFeedback.feedDescriptor,
})
}
}
@@ -438,8 +451,17 @@ 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()}`, 'xmark')
Toast.show(l`There was an issue! ${e.toString()}`, {
type: 'error',
})
}
} finally {
ax.metric('postMenu:unmuteAccount', {
uri: postUri,
authorDid: postAuthor.did,
logContext,
feedDescriptor: feedFeedback.feedDescriptor,
})
}
} else {
try {
@@ -449,8 +471,17 @@ 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()}`, 'xmark')
Toast.show(l`There was an issue! ${e.toString()}`, {
type: 'error',
})
}
} finally {
ax.metric('postMenu:muteAccount', {
uri: postUri,
authorDid: postAuthor.did,
logContext,
feedDescriptor: feedFeedback.feedDescriptor,
})
}
}
}
@@ -601,7 +632,7 @@ let PostMenuItems = ({
<Menu.Item
testID="postDropdownMuteWordsBtn"
label={l`Mute words & tags`}
onPress={() => mutedWordsDialogControl.open()}>
onPress={onToggleWordsAndTagsMute}>
<Menu.ItemText>{l`Mute words & tags`}</Menu.ItemText>
<Menu.ItemIcon icon={Filter} position="right" />
</Menu.Item>
@@ -785,6 +816,14 @@ 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}
@@ -12,7 +12,6 @@ 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'
@@ -22,6 +21,7 @@ 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,7 +71,9 @@ let ShareMenuItems = ({
} else {
await ExpoClipboard.setStringAsync(url)
}
Toast.show(_(msg`Copied to clipboard`), 'clipboard-check')
Toast.show(_(msg`Copied to clipboard`), {
type: 'success',
})
onShareProp()
}
+10 -4
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,7 +106,9 @@ let PostControls = ({
const onPressToggleLike = async () => {
if (isBlocked) {
Toast.show(l`Cannot interact with a blocked user`, 'exclamation-circle')
Toast.show(l`Cannot interact with a blocked user`, {
type: 'warning',
})
return
}
@@ -135,7 +137,9 @@ let PostControls = ({
const onRepost = async () => {
if (isBlocked) {
Toast.show(l`Cannot interact with a blocked user`, 'exclamation-circle')
Toast.show(l`Cannot interact with a blocked user`, {
type: 'warning',
})
return
}
@@ -161,7 +165,9 @@ let PostControls = ({
const onQuote = () => {
if (isBlocked) {
Toast.show(l`Cannot interact with a blocked user`, 'exclamation-circle')
Toast.show(l`Cannot interact with a blocked user`, {
type: 'warning',
})
return
}
+8 -3
View File
@@ -22,7 +22,6 @@ 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,
@@ -43,6 +42,7 @@ 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 {type Metrics} from '#/analytics'
import {useActorStatus} from '#/features/liveNow'
@@ -145,6 +145,7 @@ export function Link({
return (
<InternalLink
testID={`profileCard-${profile.handle}-link`}
label={l`View ${
profile.displayName || sanitizeHandle(profile.handle)
}s profile`}
@@ -504,7 +505,9 @@ export function FollowButtonInner({
} catch (e) {
const err = e as Error
if (err?.name !== 'AbortError') {
Toast.show(l`An issue occurred, please try again.`, 'xmark')
Toast.show(l`An issue occurred, please try again.`, {
type: 'error',
})
}
}
}
@@ -524,7 +527,9 @@ export function FollowButtonInner({
} catch (e) {
const err = e as Error
if (err?.name !== 'AbortError') {
Toast.show(l`An issue occurred, please try again.`, 'xmark')
Toast.show(l`An issue occurred, please try again.`, {
type: 'error',
})
}
}
}
+15 -15
View File
@@ -1,4 +1,4 @@
import React, {useCallback} from 'react'
import {memo, useCallback, useEffect, useMemo, useReducer, useRef} from 'react'
import {View} from 'react-native'
import {
type AppBskyActorDefs,
@@ -61,7 +61,7 @@ const floatingMiddlewares = [
export function ProfileHoverCard(props: ProfileHoverCardProps) {
const prefetchProfileQuery = usePrefetchProfileQuery()
const prefetchedProfile = React.useRef(false)
const prefetchedProfile = useRef(false)
const onPointerMove = () => {
if (!prefetchedProfile.current) {
prefetchedProfile.current = true
@@ -116,7 +116,7 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) {
middleware: floatingMiddlewares,
})
const [currentState, dispatch] = React.useReducer(
const [currentState, dispatch] = useReducer(
// Tip: console.log(state, action) when debugging.
(state: State, action: Action): State => {
// Pressing within a card should always hide it.
@@ -262,7 +262,7 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) {
{stage: 'hidden'},
)
React.useEffect(() => {
useEffect(() => {
if (currentState.effect) {
const effect = currentState.effect
return effect()
@@ -270,16 +270,16 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) {
}, [currentState])
const prefetchProfileQuery = usePrefetchProfileQuery()
const prefetchedProfile = React.useRef(false)
const prefetchIfNeeded = React.useCallback(async () => {
const prefetchedProfile = useRef(false)
const prefetchIfNeeded = useCallback(async () => {
if (!prefetchedProfile.current) {
prefetchedProfile.current = true
prefetchProfileQuery(props.did)
}
}, [prefetchProfileQuery, props.did])
const didFireHover = React.useRef(false)
const onPointerMoveTarget = React.useCallback(() => {
const didFireHover = useRef(false)
const onPointerMoveTarget = useCallback(() => {
prefetchIfNeeded()
// Conceptually we want something like onPointerEnter,
// but we want to ignore entering only due to scrolling.
@@ -290,20 +290,20 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) {
}
}, [prefetchIfNeeded])
const onPointerLeaveTarget = React.useCallback(() => {
const onPointerLeaveTarget = useCallback(() => {
didFireHover.current = false
dispatch('unhovered-target')
}, [])
const onPointerEnterCard = React.useCallback(() => {
const onPointerEnterCard = useCallback(() => {
dispatch('hovered-card')
}, [])
const onPointerLeaveCard = React.useCallback(() => {
const onPointerLeaveCard = useCallback(() => {
dispatch('unhovered-card')
}, [])
const onPress = React.useCallback(() => {
const onPress = useCallback(() => {
dispatch('pressed')
}, [])
@@ -411,7 +411,7 @@ let Card = ({
</View>
)
}
Card = React.memo(Card)
Card = memo(Card)
function Inner({
profile,
@@ -425,7 +425,7 @@ function Inner({
const t = useTheme()
const {_, i18n} = useLingui()
const {currentAccount} = useSession()
const moderation = React.useMemo(
const moderation = useMemo(
() => moderateProfile(profile, moderationOpts),
[profile, moderationOpts],
)
@@ -453,7 +453,7 @@ function Inner({
did: profile.did,
handle: profile.handle,
})
const isMe = React.useMemo(
const isMe = useMemo(
() => currentAccount?.did === profile.did,
[currentAccount, profile],
)
+15 -8
View File
@@ -1,4 +1,11 @@
import React, {useImperativeHandle} from 'react'
import {
forwardRef,
useCallback,
useImperativeHandle,
useMemo,
useRef,
useState,
} from 'react'
import {Pressable, useWindowDimensions, View} from 'react-native'
import Animated, {
Easing,
@@ -28,25 +35,25 @@ export interface ProgressGuideToastProps {
visibleDuration?: number // default 5s
}
export const ProgressGuideToast = React.forwardRef<
export const ProgressGuideToast = forwardRef<
ProgressGuideToastRef,
ProgressGuideToastProps
>(function ProgressGuideToast({title, subtitle, visibleDuration}, ref) {
const t = useTheme()
const {_} = useLingui()
const insets = useSafeAreaInsets()
const [isOpen, setIsOpen] = React.useState(false)
const [isOpen, setIsOpen] = useState(false)
const translateY = useSharedValue(0)
const opacity = useSharedValue(0)
const animatedCheckRef = React.useRef<AnimatedCheckRef | null>(null)
const timeoutRef = React.useRef<NodeJS.Timeout | undefined>(undefined)
const animatedCheckRef = useRef<AnimatedCheckRef | null>(null)
const timeoutRef = useRef<NodeJS.Timeout | undefined>(undefined)
const winDim = useWindowDimensions()
/**
* Methods
*/
const close = React.useCallback(() => {
const close = useCallback(() => {
// clear the timeout, in case this was called imperatively
if (timeoutRef.current) {
clearTimeout(timeoutRef.current)
@@ -67,7 +74,7 @@ export const ProgressGuideToast = React.forwardRef<
)
}, [setIsOpen, opacity])
const open = React.useCallback(() => {
const open = useCallback(() => {
// set isOpen=true to render
setIsOpen(true)
@@ -105,7 +112,7 @@ export const ProgressGuideToast = React.forwardRef<
[open, close],
)
const containerStyle = React.useMemo(() => {
const containerStyle = useMemo(() => {
let left = 10
let right = 10
if (IS_WEB && winDim.width > 400) {
+2 -2
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useMemo} from 'react'
import {type StyleProp, Text as RNText, type TextStyle} from 'react-native'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
@@ -68,7 +68,7 @@ export function RichTextTag({
/*
* Mute word records that exactly match the tag in question.
*/
const removeableMuteWords = React.useMemo(() => {
const removeableMuteWords = useMemo(() => {
return (
preferences?.moderationPrefs.mutedWords?.filter(word => {
return word.value === tag
-1
View File
@@ -6,7 +6,6 @@ import Animated, {
SlideInLeft,
SlideInRight,
} from 'react-native-reanimated'
import type React from 'react'
import {IS_WEB} from '#/env'
@@ -1,4 +1,4 @@
import React, {useCallback} from 'react'
import {forwardRef, useCallback, useImperativeHandle, useState} from 'react'
import {type ListRenderItemInfo, View} from 'react-native'
import {type AppBskyFeedDefs} from '@atproto/api'
@@ -19,9 +19,9 @@ interface ProfilesListProps {
scrollElRef: ListRef
}
export const FeedsList = React.forwardRef<SectionRef, ProfilesListProps>(
export const FeedsList = forwardRef<SectionRef, ProfilesListProps>(
function FeedsListImpl({feeds, headerHeight, scrollElRef}, ref) {
const [initialHeaderHeight] = React.useState(headerHeight)
const [initialHeaderHeight] = useState(headerHeight)
const bottomBarOffset = useBottomBarOffset(20)
const t = useTheme()
@@ -32,7 +32,7 @@ export const FeedsList = React.forwardRef<SectionRef, ProfilesListProps>(
})
}, [scrollElRef, headerHeight])
React.useImperativeHandle(ref, () => ({
useImperativeHandle(ref, () => ({
scrollToTop: onScrollToTop,
}))
@@ -1,4 +1,4 @@
import React, {useCallback} from 'react'
import {forwardRef, useCallback, useImperativeHandle} from 'react'
import {View} from 'react-native'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
@@ -17,7 +17,7 @@ interface ProfilesListProps {
scrollElRef: ListRef
}
export const PostsList = React.forwardRef<SectionRef, ProfilesListProps>(
export const PostsList = forwardRef<SectionRef, ProfilesListProps>(
function PostsListImpl({listUri, headerHeight, scrollElRef}, ref) {
const feed: FeedDescriptor = `list|${listUri}`
const {_} = useLingui()
@@ -29,7 +29,7 @@ export const PostsList = React.forwardRef<SectionRef, ProfilesListProps>(
})
}, [scrollElRef, headerHeight])
React.useImperativeHandle(ref, () => ({
useImperativeHandle(ref, () => ({
scrollToTop: onScrollToTop,
}))
@@ -1,4 +1,4 @@
import React, {useCallback} from 'react'
import {forwardRef, useCallback, useImperativeHandle, useState} from 'react'
import {type ListRenderItemInfo, View} from 'react-native'
import {
type AppBskyActorDefs,
@@ -37,7 +37,7 @@ interface ProfilesListProps {
scrollElRef: ListRef
}
export const ProfilesList = React.forwardRef<SectionRef, ProfilesListProps>(
export const ProfilesList = forwardRef<SectionRef, ProfilesListProps>(
function ProfilesListImpl(
{listUri, moderationOpts, headerHeight, scrollElRef},
ref,
@@ -48,7 +48,7 @@ export const ProfilesList = React.forwardRef<SectionRef, ProfilesListProps>(
const {currentAccount} = useSession()
const {data, refetch, isError} = useAllListMembersQuery(listUri)
const [isPTRing, setIsPTRing] = React.useState(false)
const [isPTRing, setIsPTRing] = useState(false)
// The server returns these sorted by descending creation date, so we want to invert
@@ -80,7 +80,7 @@ export const ProfilesList = React.forwardRef<SectionRef, ProfilesListProps>(
})
}, [scrollElRef, headerHeight])
React.useImperativeHandle(ref, () => ({
useImperativeHandle(ref, () => ({
scrollToTop: onScrollToTop,
}))
@@ -1,4 +1,4 @@
import React from 'react'
import {useMemo} from 'react'
import {View} from 'react-native'
import {Image} from 'expo-image'
import {AppBskyGraphStarterpack, AtUri} from '@atproto/api'
@@ -115,7 +115,7 @@ export function useStarterPackLink({
}) {
const {_} = useLingui()
const qc = useQueryClient()
const {rkey, handleOrDid} = React.useMemo(() => {
const {rkey, handleOrDid} = useMemo(() => {
const rkey = new AtUri(view.uri).rkey
const {creator} = view
return {rkey, handleOrDid: creator.handle || creator.did}
@@ -148,7 +148,7 @@ export function Link({
const {_} = useLingui()
const queryClient = useQueryClient()
const {record} = starterPack
const {rkey, handleOrDid} = React.useMemo(() => {
const {rkey, handleOrDid} = useMemo(() => {
const rkey = new AtUri(starterPack.uri).rkey
const {creator} = starterPack
return {rkey, handleOrDid: creator.handle || creator.did}
+2 -2
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {isValidElement} from 'react'
import {View} from 'react-native'
import {nanoid} from 'nanoid/non-secure'
import {toast as sonner, Toaster} from 'sonner-native'
@@ -61,7 +61,7 @@ export function show(
duration: options?.duration ?? DURATION,
},
)
} else if (React.isValidElement(content)) {
} else if (isValidElement(content)) {
sonner.custom(
<ToastConfigProvider id={id} type={type}>
{content}
+2 -2
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {isValidElement} from 'react'
import {nanoid} from 'nanoid/non-secure'
import {toast as sonner, Toaster} from 'sonner'
@@ -60,7 +60,7 @@ export function show(
duration: options?.duration ?? DURATION,
},
)
} else if (React.isValidElement(content)) {
} else if (isValidElement(content)) {
sonner(
<ToastConfigProvider id={id} type={type}>
{content}
+2 -2
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useMemo} from 'react'
import {View} from 'react-native'
import {type AtUri} from '@atproto/api'
import {msg} from '@lingui/core/macro'
@@ -170,7 +170,7 @@ type ParsedTrendingTopic =
export function useTopic(raw: TrendingTopic): ParsedTrendingTopic {
const {_} = useLingui()
return React.useMemo(() => {
return useMemo(() => {
const {topic: displayName, link} = raw
if (link.startsWith('/search')) {
@@ -21,7 +21,6 @@ import {sanitizeHandle} from '#/lib/strings/handles'
import {updateProfileShadow} from '#/state/cache/profile-shadow'
import {RQKEY_getActivitySubscriptions} from '#/state/queries/activity-subscriptions'
import {useAgent} from '#/state/session'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a, platform, useTheme, web} from '#/alf'
import {Admonition} from '#/components/Admonition'
import {
@@ -34,6 +33,7 @@ import * as Dialog from '#/components/Dialog'
import * as Toggle from '#/components/forms/Toggle'
import {Loader} from '#/components/Loader'
import * as ProfileCard from '#/components/ProfileCard'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {useAnalytics} from '#/analytics'
import {IS_WEB} from '#/env'
@@ -139,7 +139,9 @@ function DialogInner({
_(
msg`You will no longer receive notifications for ${sanitizeHandle(profile.handle, '@')}`,
),
'check',
{
type: 'success',
},
)
// filter out the subscription
@@ -169,10 +171,14 @@ function DialogInner({
_(
msg`You'll start receiving notifications for ${sanitizeHandle(profile.handle, '@')}!`,
),
'check',
{
type: 'success',
},
)
} else {
Toast.show(_(msg`Changes saved`), 'check')
Toast.show(_(msg`Changes saved`), {
type: 'success',
})
}
}
})
@@ -1,4 +1,4 @@
import React from 'react'
import {useState} from 'react'
import {View} from 'react-native'
import {ToolsOzoneReportDefs} from '@atproto/api'
import {msg} from '@lingui/core/macro'
@@ -8,12 +8,12 @@ import {useMutation} from '@tanstack/react-query'
import {BLUESKY_MOD_SERVICE_HEADERS} from '#/lib/constants'
import {useAgent, useSession} from '#/state/session'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a, useBreakpoints, web} from '#/alf'
import {AgeAssuranceBadge} from '#/components/ageAssurance/AgeAssuranceBadge'
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
import {Loader} from '#/components/Loader'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {logger} from '#/ageAssurance'
import {useAnalytics} from '#/analytics'
@@ -44,7 +44,7 @@ function Inner({control}: {control: Dialog.DialogControlProps}) {
const {gtPhone} = useBreakpoints()
const agent = useAgent()
const [details, setDetails] = React.useState('')
const [details, setDetails] = useState('')
const isInvalid = details.length > 1000
const {mutate, isPending} = useMutation({
@@ -70,7 +70,9 @@ function Inner({control}: {control: Dialog.DialogControlProps}) {
logger.error('AgeAssuranceAppealDialog failed', {safeMessage: err})
Toast.show(
_(msg`Age assurance inquiry failed to send, please try again.`),
'xmark',
{
type: 'error',
},
)
},
onSuccess: () => {
+64 -65
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {forwardRef, useCallback, useEffect, useImperativeHandle} from 'react'
import Animated, {
Easing,
useAnimatedProps,
@@ -23,74 +23,73 @@ export interface AnimatedCheckProps extends Props {
playOnMount?: boolean
}
export const AnimatedCheck = React.forwardRef<
AnimatedCheckRef,
AnimatedCheckProps
>(function AnimatedCheck({playOnMount, ...props}, ref) {
const {fill, size, style, ...rest} = useCommonSVGProps(props)
const circleAnim = useSharedValue(0)
const checkAnim = useSharedValue(0)
export const AnimatedCheck = forwardRef<AnimatedCheckRef, AnimatedCheckProps>(
function AnimatedCheck({playOnMount, ...props}, ref) {
const {fill, size, style, ...rest} = useCommonSVGProps(props)
const circleAnim = useSharedValue(0)
const checkAnim = useSharedValue(0)
const circleAnimatedProps = useAnimatedProps(() => ({
strokeDashoffset: 166 - circleAnim.get() * 166,
}))
const checkAnimatedProps = useAnimatedProps(() => ({
strokeDashoffset: 48 - 48 * checkAnim.get(),
}))
const circleAnimatedProps = useAnimatedProps(() => ({
strokeDashoffset: 166 - circleAnim.get() * 166,
}))
const checkAnimatedProps = useAnimatedProps(() => ({
strokeDashoffset: 48 - 48 * checkAnim.get(),
}))
const play = React.useCallback(
(cb?: () => void) => {
circleAnim.set(0)
checkAnim.set(0)
const play = useCallback(
(cb?: () => void) => {
circleAnim.set(0)
checkAnim.set(0)
circleAnim.set(() =>
withTiming(1, {duration: 500, easing: Easing.linear}),
)
checkAnim.set(() =>
withDelay(
500,
withTiming(1, {duration: 300, easing: Easing.linear}, cb),
),
)
},
[circleAnim, checkAnim],
)
circleAnim.set(() =>
withTiming(1, {duration: 500, easing: Easing.linear}),
)
checkAnim.set(() =>
withDelay(
500,
withTiming(1, {duration: 300, easing: Easing.linear}, cb),
),
)
},
[circleAnim, checkAnim],
)
React.useImperativeHandle(ref, () => ({
play,
}))
useImperativeHandle(ref, () => ({
play,
}))
React.useEffect(() => {
if (playOnMount) {
play()
}
}, [play, playOnMount])
useEffect(() => {
if (playOnMount) {
play()
}
}, [play, playOnMount])
return (
<Svg
fill="none"
{...rest}
viewBox="0 0 52 52"
width={size}
height={size}
style={style}>
<AnimatedCircle
animatedProps={circleAnimatedProps}
cx="26"
cy="26"
r="24"
return (
<Svg
fill="none"
stroke={fill}
strokeWidth={4}
strokeDasharray={166}
/>
<AnimatedPath
animatedProps={checkAnimatedProps}
stroke={fill}
d={PATH}
strokeWidth={4}
strokeDasharray={48}
/>
</Svg>
)
})
{...rest}
viewBox="0 0 52 52"
width={size}
height={size}
style={style}>
<AnimatedCircle
animatedProps={circleAnimatedProps}
cx="26"
cy="26"
r="24"
fill="none"
stroke={fill}
strokeWidth={4}
strokeDasharray={166}
/>
<AnimatedPath
animatedProps={checkAnimatedProps}
stroke={fill}
d={PATH}
strokeWidth={4}
strokeDasharray={48}
/>
</Svg>
)
},
)
+4 -6
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useCallback, useMemo, useState} from 'react'
import {View} from 'react-native'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
@@ -125,12 +125,10 @@ function BirthdayInner({
}) {
const {_} = useLingui()
const cleanError = useCleanError()
const [date, setDate] = React.useState(
preferences.birthDate || getDateAgo(18),
)
const [date, setDate] = useState(preferences.birthDate || getDateAgo(18))
const {isPending, error, mutateAsync: setBirthDate} = useBirthdateMutation()
const hasChanged = date !== preferences.birthDate
const errorMessage = React.useMemo(() => {
const errorMessage = useMemo(() => {
if (error) {
const {raw, clean} = cleanError(error)
return clean || raw || error.toString()
@@ -141,7 +139,7 @@ function BirthdayInner({
const isUnder13 = age < 13
const isUnder18 = age >= 13 && age < 18
const onSave = React.useCallback(async () => {
const onSave = useCallback(async () => {
try {
// skip if date is the same
if (hasChanged) {
+8 -8
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useCallback, useState} from 'react'
import {View} from 'react-native'
import {type AppBskyActorDefs, sanitizeMutedWordValue} from '@atproto/api'
import {msg} from '@lingui/core/macro'
@@ -58,13 +58,13 @@ function MutedWordsInner() {
error: preferencesError,
} = usePreferencesQuery()
const {isPending, mutateAsync: addMutedWord} = useUpsertMutedWordsMutation()
const [field, setField] = React.useState('')
const [targets, setTargets] = React.useState(['content'])
const [error, setError] = React.useState('')
const [durations, setDurations] = React.useState(['forever'])
const [excludeFollowing, setExcludeFollowing] = React.useState(false)
const [field, setField] = useState('')
const [targets, setTargets] = useState(['content'])
const [error, setError] = useState('')
const [durations, setDurations] = useState(['forever'])
const [excludeFollowing, setExcludeFollowing] = useState(false)
const submit = React.useCallback(async () => {
const submit = useCallback(async () => {
const sanitizedValue = sanitizeMutedWordValue(field)
const surfaces = ['tag', targets.includes('content') && 'content'].filter(
Boolean,
@@ -431,7 +431,7 @@ function MutedWordRow({
const isExpired = expiryDate && expiryDate < new Date()
const formatDistance = useFormatDistance()
const remove = React.useCallback(async () => {
const remove = useCallback(async () => {
control.close()
removeMutedWord(word)
}, [removeMutedWord, word, control])
@@ -37,7 +37,6 @@ import {
usePostThreadContext,
} from '#/state/queries/usePostThread'
import {useAgent, useSession} from '#/state/session'
import * as Toast from '#/view/com/util/Toast'
import {UserAvatar} from '#/view/com/util/UserAvatar'
import {atoms as a, useTheme, web} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
@@ -50,6 +49,7 @@ import {
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
import {CloseQuote_Stroke2_Corner1_Rounded as QuoteIcon} from '#/components/icons/Quote'
import {Loader} from '#/components/Loader'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {useAnalytics} from '#/analytics'
import {IS_IOS} from '#/env'
@@ -240,7 +240,9 @@ export function PostInteractionSettingsDialogControlledInner(
_(
msg`There was an issue. Please check your internet connection and try again.`,
),
'xmark',
{
type: 'error',
},
)
} finally {
setIsSaving(false)
+3 -3
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useCallback} from 'react'
import {View} from 'react-native'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
@@ -32,12 +32,12 @@ function SigninDialogInner({}: {control: Dialog.DialogOuterProps['control']}) {
const {requestSwitchToAccount} = useLoggedOutViewControls()
const closeAllActiveElements = useCloseAllActiveElements()
const showSignIn = React.useCallback(() => {
const showSignIn = useCallback(() => {
closeAllActiveElements()
requestSwitchToAccount({requestedAccount: 'none'})
}, [requestSwitchToAccount, closeAllActiveElements])
const showCreateAccount = React.useCallback(() => {
const showCreateAccount = useCallback(() => {
closeAllActiveElements()
requestSwitchToAccount({requestedAccount: 'new'})
}, [requestSwitchToAccount, closeAllActiveElements])
+11 -2
View File
@@ -19,6 +19,7 @@ import {
useListMembershipRemoveMutation,
} from '#/state/queries/list-memberships'
import {useProfileQuery} from '#/state/queries/profile'
import {useSession} from '#/state/session'
import {atoms as a, native, platform, useTheme} from '#/alf'
import {AvatarStack} from '#/components/AvatarStack'
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
@@ -260,6 +261,8 @@ function StarterPackItem({
const t = useTheme()
const ax = useAnalytics()
const {_} = useLingui()
const {currentAccount} = useSession()
const isSelf = subject?.did === currentAccount?.did
const starterPack = starterPackWithMembership.starterPack
const isInPack = !!starterPackWithMembership.listItem
@@ -373,11 +376,17 @@ function StarterPackItem({
label={isInPack ? _(msg`Remove`) : _(msg`Add`)}
color={isInPack ? 'secondary' : 'primary_subtle'}
size="tiny"
disabled={isPending}
disabled={isPending || isSelf}
onPress={handleToggleMembership}>
{isPending && <ButtonIcon icon={Loader} />}
<ButtonText>
{isInPack ? <Trans>Remove</Trans> : <Trans>Add</Trans>}
{isSelf ? (
<Trans>Owner</Trans>
) : isInPack ? (
<Trans>Remove</Trans>
) : (
<Trans>Add</Trans>
)}
</ButtonText>
</Button>
</View>
@@ -17,7 +17,6 @@ import {
} from '#/state/queries/list'
import {useAgent} from '#/state/session'
import {ErrorMessage} from '#/view/com/util/error/ErrorMessage'
import * as Toast from '#/view/com/util/Toast'
import {EditableUserAvatar} from '#/view/com/util/UserAvatar'
import {atoms as a, useTheme, web} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
@@ -25,6 +24,7 @@ import * as Dialog from '#/components/Dialog'
import * as TextField from '#/components/forms/TextField'
import {Loader} from '#/components/Loader'
import * as Prompt from '#/components/Prompt'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {IS_WEB} from '#/env'
@@ -14,7 +14,6 @@ import {
useListMembershipAddMutation,
useListMembershipRemoveMutation,
} from '#/state/queries/list-memberships'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
@@ -24,6 +23,7 @@ import {
} from '#/components/dialogs/SearchablePeopleList'
import {Loader} from '#/components/Loader'
import * as ProfileCard from '#/components/ProfileCard'
import * as Toast from '#/components/Toast'
import type * as bsky from '#/types/bsky'
export function ListAddRemoveUsersDialog({
@@ -113,7 +113,10 @@ function UserResult({
Toast.show(_(msg`Added to list`))
onChange?.('add', profile)
},
onError: e => Toast.show(cleanError(e), 'xmark'),
onError: e =>
Toast.show(cleanError(e), {
type: 'error',
}),
})
const {mutate: listMembershipRemove, isPending: isRemovingPending} =
useListMembershipRemoveMutation({
@@ -121,7 +124,10 @@ function UserResult({
Toast.show(_(msg`Removed from list`))
onChange?.('remove', profile)
},
onError: e => Toast.show(cleanError(e), 'xmark'),
onError: e =>
Toast.show(cleanError(e), {
type: 'error',
}),
})
const isMutating = isAddingPending || isRemovingPending
+6 -6
View File
@@ -6,11 +6,11 @@ import {useLingui} from '@lingui/react'
import {useConvoActive} from '#/state/messages/convo'
import {useSession} from '#/state/session'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a, useTheme} from '#/alf'
import {MessageContextMenu} from '#/components/dms/MessageContextMenu'
import {DotGrid3x1_Stroke2_Corner0_Rounded as DotsHorizontalIcon} from '#/components/icons/DotGrid'
import {EmojiSmile_Stroke2_Corner0_Rounded as EmojiSmileIcon} from '#/components/icons/Emoji'
import * as Toast from '#/components/Toast'
import {EmojiReactionPicker} from './EmojiReactionPicker'
import {hasReachedReactionLimit} from './util'
@@ -60,11 +60,11 @@ export function ActionsWrapper({
.catch(() => Toast.show(_(msg`Failed to remove emoji reaction`)))
} else {
if (hasReachedReactionLimit(message, currentAccount?.did)) return
convo
.addReaction(message.id, emoji)
.catch(() =>
Toast.show(_(msg`Failed to add emoji reaction`), 'xmark'),
)
convo.addReaction(message.id, emoji).catch(() =>
Toast.show(_(msg`Failed to add emoji reaction`), {
type: 'error',
}),
)
}
},
[_, convo, message, currentAccount?.did],
+7 -4
View File
@@ -5,7 +5,6 @@ import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro'
import {StackActions, useNavigation} from '@react-navigation/native'
import type React from 'react'
import {type NavigationProp} from '#/lib/routes/types'
import {useProfileShadow} from '#/state/cache/profile-shadow'
@@ -14,12 +13,12 @@ import {
useProfileBlockMutationQueue,
useProfileQuery,
} from '#/state/queries/profile'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a, platform, useBreakpoints, useTheme, web} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
import * as Toggle from '#/components/forms/Toggle'
import {Loader} from '#/components/Loader'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {IS_NATIVE} from '#/env'
@@ -136,7 +135,9 @@ function DoneStep({
}
},
onError: () => {
Toast.show(_(msg`Could not leave chat`), 'xmark')
Toast.show(_(msg`Could not leave chat`), {
type: 'error',
})
},
})
@@ -162,7 +163,9 @@ function DoneStep({
leaveConvo()
}
if (toastMsg) {
Toast.show(toastMsg, 'check')
Toast.show(toastMsg, {
type: 'success',
})
}
})
}
+3 -6
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {Fragment} from 'react'
import {View} from 'react-native'
import {type ModerationCause} from '@atproto/api'
import {msg} from '@lingui/core/macro'
@@ -25,7 +25,6 @@ export function BlockedByListDialog({
return (
<Prompt.Outer control={control} testID="blockedByListDialog">
<Prompt.TitleText>{_(msg`User blocked by list`)}</Prompt.TitleText>
<View style={[a.gap_sm, a.pb_lg]}>
<Text
selectable
@@ -39,7 +38,7 @@ export function BlockedByListDialog({
{_(msg`Lists blocking this user:`)}{' '}
{listBlocks.map((block, i) =>
block.source.type === 'list' ? (
<React.Fragment key={block.source.list.uri}>
<Fragment key={block.source.list.uri}>
{i === 0 ? null : ', '}
<InlineLinkText
label={block.source.list.name}
@@ -47,16 +46,14 @@ export function BlockedByListDialog({
style={[a.text_md, a.leading_snug]}>
{block.source.list.name}
</InlineLinkText>
</React.Fragment>
</Fragment>
) : null,
)}
</Text>
</View>
<Prompt.Actions>
<Prompt.Action cta={_(msg`I understand`)} onPress={() => {}} />
</Prompt.Actions>
<Dialog.Close />
</Prompt.Outer>
)
+6 -6
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useCallback, useMemo, useState} from 'react'
import {Pressable, View} from 'react-native'
import Animated, {
runOnJS,
@@ -24,11 +24,11 @@ export function ChatEmptyPill() {
const t = useTheme()
const {_} = useLingui()
const playHaptic = useHaptics()
const [promptIndex, setPromptIndex] = React.useState(lastIndex)
const [promptIndex, setPromptIndex] = useState(lastIndex)
const scale = useSharedValue(1)
const prompts = React.useMemo(() => {
const prompts = useMemo(() => {
return [
_(msg`Say hello!`),
_(msg`Share your favorite feed!`),
@@ -40,17 +40,17 @@ export function ChatEmptyPill() {
]
}, [_])
const onPressIn = React.useCallback(() => {
const onPressIn = useCallback(() => {
if (IS_WEB) return
scale.set(() => withTiming(1.075, {duration: 100}))
}, [scale])
const onPressOut = React.useCallback(() => {
const onPressOut = useCallback(() => {
if (IS_WEB) return
scale.set(() => withTiming(1, {duration: 100}))
}, [scale])
const onPress = React.useCallback(() => {
const onPress = useCallback(() => {
runOnJS(playHaptic)()
let randomPromptIndex = Math.floor(Math.random() * prompts.length)
while (randomPromptIndex === lastIndex) {
+7 -5
View File
@@ -1,4 +1,4 @@
import React, {useCallback} from 'react'
import {memo, useCallback} from 'react'
import {Keyboard, View} from 'react-native'
import {type ChatBskyConvoDefs, type ModerationCause} from '@atproto/api'
import {msg} from '@lingui/core/macro'
@@ -18,7 +18,6 @@ import {
unstableCacheProfileView,
useProfileBlockMutationQueue,
} from '#/state/queries/profile'
import * as Toast from '#/view/com/util/Toast'
import {type ViewStyleProp} from '#/alf'
import {atoms as a} from '#/alf'
import {Button, ButtonIcon} from '#/components/Button'
@@ -40,6 +39,7 @@ import {SpeakerVolumeFull_Stroke2_Corner0_Rounded as Unmute} from '#/components/
import * as Menu from '#/components/Menu'
import {ReportDialog} from '#/components/moderation/ReportDialog'
import * as Prompt from '#/components/Prompt'
import * as Toast from '#/components/Toast'
import type * as bsky from '#/types/bsky'
let ConvoMenu = ({
@@ -159,7 +159,7 @@ let ConvoMenu = ({
</>
)
}
ConvoMenu = React.memo(ConvoMenu)
ConvoMenu = memo(ConvoMenu)
function MenuContent({
convo: initialConvo,
@@ -205,13 +205,15 @@ function MenuContent({
}
},
onError: () => {
Toast.show(_(msg`Could not mute chat`), 'xmark')
Toast.show(_(msg`Could not mute chat`), {
type: 'error',
})
},
})
const [queueBlock, queueUnblock] = useProfileBlockMutationQueue(profile)
const toggleBlock = React.useCallback(() => {
const toggleBlock = useCallback(() => {
if (listBlocks.length) {
blockedByListControl.open()
return
+2 -2
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {memo} from 'react'
import {View} from 'react-native'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
@@ -78,5 +78,5 @@ let DateDivider = ({date: dateStr}: {date: string}): React.ReactNode => {
</View>
)
}
DateDivider = React.memo(DateDivider)
DateDivider = memo(DateDivider)
export {DateDivider}
+4 -2
View File
@@ -4,9 +4,9 @@ import {StackActions, useNavigation} from '@react-navigation/native'
import {type NavigationProp} from '#/lib/routes/types'
import {useLeaveConvo} from '#/state/queries/messages/leave-conversation'
import * as Toast from '#/view/com/util/Toast'
import {type DialogOuterProps} from '#/components/Dialog'
import * as Prompt from '#/components/Prompt'
import * as Toast from '#/components/Toast'
import {IS_NATIVE} from '#/env'
export function LeaveConvoPrompt({
@@ -32,7 +32,9 @@ export function LeaveConvoPrompt({
}
},
onError: () => {
Toast.show(_(msg`Could not leave chat`), 'xmark')
Toast.show(_(msg`Could not leave chat`), {
type: 'error',
})
},
})
+3 -3
View File
@@ -1,6 +1,6 @@
import React from 'react'
import {createContext, useContext} from 'react'
const MessageContext = React.createContext(false)
const MessageContext = createContext(false)
MessageContext.displayName = 'MessageContext'
export function MessageContextProvider({
@@ -14,5 +14,5 @@ export function MessageContextProvider({
}
export function useIsWithinMessage() {
return React.useContext(MessageContext)
return useContext(MessageContext)
}
+14 -10
View File
@@ -1,5 +1,5 @@
import {memo, useCallback} from 'react'
import {LayoutAnimation} from 'react-native'
import {LayoutAnimation, Platform} from 'react-native'
import * as Clipboard from 'expo-clipboard'
import {type ChatBskyConvoDefs, RichText} from '@atproto/api'
import {msg} from '@lingui/core/macro'
@@ -12,7 +12,6 @@ import {useConvoActive} from '#/state/messages/convo'
import {useLanguagePrefs} from '#/state/preferences'
import {unstableCacheProfileView} from '#/state/queries/unstable-profile-cache'
import {useSession} from '#/state/session'
import * as Toast from '#/view/com/util/Toast'
import * as ContextMenu from '#/components/ContextMenu'
import {type TriggerProps} from '#/components/ContextMenu/types'
import {AfterReportDialog} from '#/components/dms/AfterReportDialog'
@@ -23,6 +22,7 @@ import {Warning_Stroke2_Corner0_Rounded as Warning} from '#/components/icons/War
import {ReportDialog} from '#/components/moderation/ReportDialog'
import * as Prompt from '#/components/Prompt'
import {usePromptControl} from '#/components/Prompt'
import * as Toast from '#/components/Toast'
import {useAnalytics} from '#/analytics'
import {IS_NATIVE} from '#/env'
import {EmojiReactionPicker} from './EmojiReactionPicker'
@@ -58,16 +58,20 @@ export let MessageContextMenu = ({
)
void Clipboard.setStringAsync(str)
Toast.show(_(msg`Copied to clipboard`), 'clipboard-check')
Toast.show(_(msg`Copied to clipboard`), {
type: 'success',
})
}, [_, message.text, message.facets])
const onPressTranslateMessage = useCallback(() => {
void translate(message.text, langPrefs.primaryLanguage)
ax.metric('translate', {
sourceLanguages: [],
targetLanguage: langPrefs.primaryLanguage,
os: Platform.OS,
possibleSourceLanguages: [], // N/A for chats
expectedTargetLanguage: langPrefs.primaryLanguage,
textLength: message.text.length,
googleTranslate: true,
})
}, [ax, langPrefs.primaryLanguage, message.text, translate])
@@ -95,11 +99,11 @@ export let MessageContextMenu = ({
.catch(() => Toast.show(_(msg`Failed to remove emoji reaction`)))
} else {
if (hasReachedReactionLimit(message, currentAccount?.did)) return
convo
.addReaction(message.id, emoji)
.catch(() =>
Toast.show(_(msg`Failed to add emoji reaction`), 'xmark'),
)
convo.addReaction(message.id, emoji).catch(() =>
Toast.show(_(msg`Failed to add emoji reaction`), {
type: 'error',
}),
)
}
},
[_, convo, message, currentAccount?.did],
+3 -3
View File
@@ -1,4 +1,4 @@
import React, {useCallback, useMemo} from 'react'
import {memo, useCallback, useMemo} from 'react'
import {
type GestureResponderEvent,
type StyleProp,
@@ -233,7 +233,7 @@ let MessageItem = ({
</>
)
}
MessageItem = React.memo(MessageItem)
MessageItem = memo(MessageItem)
export {MessageItem}
let MessageItemMetadata = ({
@@ -328,5 +328,5 @@ let MessageItemMetadata = ({
</Text>
)
}
MessageItemMetadata = React.memo(MessageItemMetadata)
MessageItemMetadata = memo(MessageItemMetadata)
export {MessageItemMetadata}
+3 -4
View File
@@ -1,10 +1,9 @@
import React from 'react'
import {memo} from 'react'
import {useWindowDimensions, View} from 'react-native'
import {type $Typed, type AppBskyEmbedRecord} from '@atproto/api'
import {atoms as a, native, tokens, useTheme, web} from '#/alf'
import {PostEmbedViewContext} from '#/components/Post/Embed'
import {Embed} from '#/components/Post/Embed'
import {Embed, PostEmbedViewContext} from '#/components/Post/Embed'
import {MessageContextProvider} from './MessageContext'
let MessageItemEmbed = ({
@@ -43,5 +42,5 @@ let MessageItemEmbed = ({
</MessageContextProvider>
)
}
MessageItemEmbed = React.memo(MessageItemEmbed)
MessageItemEmbed = memo(MessageItemEmbed)
export {MessageItemEmbed}
+3 -3
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useCallback} from 'react'
import {View} from 'react-native'
import {type AppBskyActorDefs} from '@atproto/api'
import {msg} from '@lingui/core/macro'
@@ -10,11 +10,11 @@ import {useRequireEmailVerification} from '#/lib/hooks/useRequireEmailVerificati
import {type NavigationProp} from '#/lib/routes/types'
import {useGetConvoAvailabilityQuery} from '#/state/queries/messages/get-convo-availability'
import {useGetConvoForMembers} from '#/state/queries/messages/get-convo-for-members'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a, useTheme} from '#/alf'
import {Button, ButtonIcon} from '#/components/Button'
import {canBeMessaged} from '#/components/dms/util'
import {Message_Stroke2_Corner0_Rounded as Message} from '#/components/icons/Message'
import * as Toast from '#/components/Toast'
import {useAnalytics} from '#/analytics'
export function MessageProfileButton({
@@ -39,7 +39,7 @@ export function MessageProfileButton({
},
})
const onPress = React.useCallback(() => {
const onPress = useCallback(() => {
if (!convoAvailability?.canChat) {
return
}
@@ -1,4 +1,4 @@
import React from 'react'
import {useCallback, useMemo} from 'react'
import {View} from 'react-native'
import {type ModerationDecision} from '@atproto/api'
import {msg} from '@lingui/core/macro'
@@ -38,7 +38,7 @@ export function MessagesListBlockedFooter({
const reportControl = useDialogControl()
const blockedByListControl = useDialogControl()
const {listBlocks, userBlock} = React.useMemo(() => {
const {listBlocks, userBlock} = useMemo(() => {
const modui = moderation.ui('profileView')
const blocks = modui.alerts.filter(alert => alert.type === 'blocking')
const listBlocks = blocks.filter(alert => alert.source.type === 'list')
@@ -51,7 +51,7 @@ export function MessagesListBlockedFooter({
const isBlocking = !!userBlock || !!listBlocks.length
const onUnblockPress = React.useCallback(() => {
const onUnblockPress = useCallback(() => {
if (listBlocks.length) {
blockedByListControl.open()
} else {

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