Merge branch 'main' into main
This commit is contained in:
+4
-5
@@ -1,8 +1,9 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
extends: [
|
extends: [
|
||||||
'@react-native-community',
|
'@react-native',
|
||||||
'plugin:react/recommended',
|
'plugin:react/recommended',
|
||||||
|
'plugin:react/jsx-runtime',
|
||||||
'plugin:react-native-a11y/ios',
|
'plugin:react-native-a11y/ios',
|
||||||
'prettier',
|
'prettier',
|
||||||
],
|
],
|
||||||
@@ -16,9 +17,8 @@ module.exports = {
|
|||||||
'eslint-plugin-react-compiler',
|
'eslint-plugin-react-compiler',
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
// Temporary until https://github.com/facebook/react-native/pull/43756 gets into a release.
|
|
||||||
'prettier/prettier': 0,
|
|
||||||
'react/no-unescaped-entities': 0,
|
'react/no-unescaped-entities': 0,
|
||||||
|
'react/prop-types': 0,
|
||||||
'react-native/no-inline-styles': 0,
|
'react-native/no-inline-styles': 0,
|
||||||
'bsky-internal/avoid-unwrapped-text': [
|
'bsky-internal/avoid-unwrapped-text': [
|
||||||
'error',
|
'error',
|
||||||
@@ -79,8 +79,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
'simple-import-sort/exports': 'error',
|
'simple-import-sort/exports': 'error',
|
||||||
// TODO: Reenable when we figure out why it gets stuck on CI.
|
'react-compiler/react-compiler': 'warn',
|
||||||
// 'react-compiler/react-compiler': 'error',
|
|
||||||
'no-restricted-imports': [
|
'no-restricted-imports': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- bnewbold/embedr
|
|
||||||
- bnewbold/embedr-rebase
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
|
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ WORKDIR /usr/src/social-app
|
|||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Node
|
# Node
|
||||||
ENV NODE_VERSION=18
|
ENV NODE_VERSION=20
|
||||||
ENV NVM_DIR=/usr/share/nvm
|
ENV NVM_DIR=/usr/share/nvm
|
||||||
|
|
||||||
# Go
|
# Go
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ appId: xyz.blueskyweb.app
|
|||||||
- inputText: "Post with an image"
|
- inputText: "Post with an image"
|
||||||
- tapOn:
|
- tapOn:
|
||||||
id: "openGalleryBtn"
|
id: "openGalleryBtn"
|
||||||
- tapOn:
|
- tapOn: "Content warnings"
|
||||||
id: "labelsBtn"
|
- tapOn: "Content warnings"
|
||||||
- tapOn: "Porn"
|
- tapOn: "Porn"
|
||||||
- tapOn:
|
- tapOn:
|
||||||
label: "Tap on confirm"
|
label: "Tap on confirm"
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ appId: xyz.blueskyweb.app
|
|||||||
- pressKey: Enter
|
- pressKey: Enter
|
||||||
- tapOn:
|
- tapOn:
|
||||||
id: "nextBtn"
|
id: "nextBtn"
|
||||||
- tapOn: "Not now"
|
|
||||||
- tapOn:
|
- tapOn:
|
||||||
id: "handleInput"
|
id: "handleInput"
|
||||||
- inputText: "e2e-test"
|
- inputText: "e2e-test"
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ appId: xyz.blueskyweb.app
|
|||||||
id: "editDescriptionInput"
|
id: "editDescriptionInput"
|
||||||
- inputText: "They good"
|
- inputText: "They good"
|
||||||
- tapOn: "Save"
|
- tapOn: "Save"
|
||||||
|
- tapOn: "Save"
|
||||||
- assertNotVisible:
|
- assertNotVisible:
|
||||||
id: "createOrEditListModal"
|
id: "createOrEditListModal"
|
||||||
- tapOn: "About"
|
- tapOn: "About"
|
||||||
@@ -45,6 +46,7 @@ appId: xyz.blueskyweb.app
|
|||||||
- eraseText
|
- eraseText
|
||||||
- inputText: "They bad"
|
- inputText: "They bad"
|
||||||
- tapOn: "Save"
|
- tapOn: "Save"
|
||||||
|
- tapOn: "Save"
|
||||||
- assertNotVisible:
|
- assertNotVisible:
|
||||||
id: "createOrEditListModal"
|
id: "createOrEditListModal"
|
||||||
- assertVisible: Bad Ppl
|
- assertVisible: Bad Ppl
|
||||||
@@ -60,6 +62,7 @@ appId: xyz.blueskyweb.app
|
|||||||
id: "editDescriptionInput"
|
id: "editDescriptionInput"
|
||||||
- eraseText
|
- eraseText
|
||||||
- tapOn: "Save"
|
- tapOn: "Save"
|
||||||
|
- tapOn: "Save"
|
||||||
- assertNotVisible:
|
- assertNotVisible:
|
||||||
id: "createOrEditListModal"
|
id: "createOrEditListModal"
|
||||||
- assertNotVisible:
|
- assertNotVisible:
|
||||||
@@ -87,6 +90,7 @@ appId: xyz.blueskyweb.app
|
|||||||
id: "editDescriptionInput"
|
id: "editDescriptionInput"
|
||||||
- inputText: "They good"
|
- inputText: "They good"
|
||||||
- tapOn: "Save"
|
- tapOn: "Save"
|
||||||
|
- tapOn: "Save"
|
||||||
- assertNotVisible:
|
- assertNotVisible:
|
||||||
id: "createOrEditListModal"
|
id: "createOrEditListModal"
|
||||||
- tapOn: "About"
|
- tapOn: "About"
|
||||||
|
|||||||
@@ -23,5 +23,4 @@ appId: xyz.blueskyweb.app
|
|||||||
id: "loginPasswordInput"
|
id: "loginPasswordInput"
|
||||||
- inputText: "hunter2"
|
- inputText: "hunter2"
|
||||||
- pressKey: Enter
|
- pressKey: Enter
|
||||||
- tapOn: "Not now"
|
|
||||||
- assertVisible: "Following"
|
- assertVisible: "Following"
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ appId: xyz.blueskyweb.app
|
|||||||
id: "editDescriptionInput"
|
id: "editDescriptionInput"
|
||||||
- inputText: "Shhh"
|
- inputText: "Shhh"
|
||||||
- tapOn: "Save"
|
- tapOn: "Save"
|
||||||
|
- tapOn: "Save"
|
||||||
|
|
||||||
# view modlist
|
# view modlist
|
||||||
- assertVisible: "Muted Users"
|
- assertVisible: "Muted Users"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ appId: xyz.blueskyweb.app
|
|||||||
- tapOn: "Select an avatar"
|
- tapOn: "Select an avatar"
|
||||||
- waitForAnimationToEnd
|
- waitForAnimationToEnd
|
||||||
- tapOn:
|
- tapOn:
|
||||||
point: "16%,22%"
|
point: "50%,22%"
|
||||||
- waitForAnimationToEnd
|
- waitForAnimationToEnd
|
||||||
- tapOn: "Choose"
|
- tapOn: "Choose"
|
||||||
- waitForAnimationToEnd
|
- waitForAnimationToEnd
|
||||||
|
|||||||
@@ -92,6 +92,31 @@ module.exports = function (config) {
|
|||||||
'Used to save images to your library.',
|
'Used to save images to your library.',
|
||||||
NSPhotoLibraryUsageDescription:
|
NSPhotoLibraryUsageDescription:
|
||||||
'Used for profile pictures, posts, and other kinds of content',
|
'Used for profile pictures, posts, and other kinds of content',
|
||||||
|
CFBundleSpokenName: 'Blue Sky',
|
||||||
|
CFBundleLocalizations: [
|
||||||
|
'en',
|
||||||
|
'ca',
|
||||||
|
'de',
|
||||||
|
'es',
|
||||||
|
'fi',
|
||||||
|
'fr',
|
||||||
|
'ga',
|
||||||
|
'hi',
|
||||||
|
'hu',
|
||||||
|
'id',
|
||||||
|
'it',
|
||||||
|
'ja',
|
||||||
|
'ko',
|
||||||
|
'pl',
|
||||||
|
'pt',
|
||||||
|
'ru',
|
||||||
|
'th',
|
||||||
|
'tr',
|
||||||
|
'uk',
|
||||||
|
'zh_CN',
|
||||||
|
'zh_HK',
|
||||||
|
'zh_TW',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
associatedDomains: ASSOCIATED_DOMAINS,
|
associatedDomains: ASSOCIATED_DOMAINS,
|
||||||
splash: {
|
splash: {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" fill-rule="evenodd" d="M15.439 3.148a1 1 0 0 1 .41.645l.568 3.22a7 7 0 1 1-6.174 10.97L4.32 19.027a1 1 0 0 1-1.159-.811L1.078 6.398a1 1 0 0 1 .81-1.158l12.803-2.258a1 1 0 0 1 .748.166ZM9.325 16.114A7 7 0 0 1 9 14c0-1.56.51-3 1.372-4.164l-6.456 1.139 1.041 5.909 4.368-.77ZM3.568 9.005l10.833-1.91-.347-1.97L3.22 7.036l.347 1.97ZM16 9a5 5 0 1 0 0 10 5 5 0 0 0 0-10Zm0 2a1 1 0 0 1 1 1v1.586l1.374 1.374a1 1 0 0 1-1.414 1.414l-1.667-1.667A1 1 0 0 1 15 14v-2a1 1 0 0 1 1-1Z" clip-rule="evenodd"/></svg>
|
||||||
|
After Width: | Height: | Size: 589 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" fill-rule="evenodd" d="M18.535 5.465a5.003 5.003 0 0 0-7.076 0l-.005.005-.752.742a1 1 0 1 1-1.404-1.424l.749-.74a7.003 7.003 0 0 1 9.904 9.905l-.002.003-.737.746a1 1 0 1 1-1.424-1.404l.747-.757a5.003 5.003 0 0 0 0-7.076ZM6.202 9.288a1 1 0 0 1 .01 1.414l-.747.757a5.003 5.003 0 1 0 7.076 7.076l.005-.005.752-.742a1 1 0 1 1 1.404 1.424l-.746.737-.003.002a7.003 7.003 0 0 1-9.904-9.904l.74-.75a1 1 0 0 1 1.413-.009Zm8.505.005a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414l4-4a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"/></svg>
|
||||||
|
After Width: | Height: | Size: 610 B |
+1
-6
@@ -17,12 +17,7 @@ module.exports = function (api) {
|
|||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
'macros',
|
'macros',
|
||||||
[
|
['babel-plugin-react-compiler', {target: '18'}],
|
||||||
'babel-plugin-react-compiler',
|
|
||||||
{
|
|
||||||
runtimeModule: 'react-compiler-runtime',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'module:react-native-dotenv',
|
'module:react-native-dotenv',
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import {
|
|||||||
AppBskyGraphDefs,
|
AppBskyGraphDefs,
|
||||||
AppBskyGraphStarterpack,
|
AppBskyGraphStarterpack,
|
||||||
AppBskyLabelerDefs,
|
AppBskyLabelerDefs,
|
||||||
AtUri,
|
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {ComponentChildren, h} from 'preact'
|
import {ComponentChildren, h} from 'preact'
|
||||||
import {useMemo} from 'preact/hooks'
|
import {useMemo} from 'preact/hooks'
|
||||||
@@ -437,14 +436,14 @@ function StarterPackEmbed({
|
|||||||
|
|
||||||
// from #/lib/strings/starter-pack.ts
|
// from #/lib/strings/starter-pack.ts
|
||||||
function getStarterPackImage(starterPack: AppBskyGraphDefs.StarterPackView) {
|
function getStarterPackImage(starterPack: AppBskyGraphDefs.StarterPackView) {
|
||||||
const rkey = new AtUri(starterPack.uri).rkey
|
const rkey = getRkey({uri: starterPack.uri})
|
||||||
return `https://ogcard.cdn.bsky.app/start/${starterPack.creator.did}/${rkey}`
|
return `https://ogcard.cdn.bsky.app/start/${starterPack.creator.did}/${rkey}`
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStarterPackHref(
|
function getStarterPackHref(
|
||||||
starterPack: AppBskyGraphDefs.StarterPackViewBasic,
|
starterPack: AppBskyGraphDefs.StarterPackViewBasic,
|
||||||
) {
|
) {
|
||||||
const rkey = new AtUri(starterPack.uri).rkey
|
const rkey = getRkey({uri: starterPack.uri})
|
||||||
const handleOrDid = starterPack.creator.handle || starterPack.creator.did
|
const handleOrDid = starterPack.creator.handle || starterPack.creator.did
|
||||||
return `/starter-pack/${handleOrDid}/${rkey}`
|
return `/starter-pack/${handleOrDid}/${rkey}`
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-6
@@ -4209,12 +4209,7 @@ yocto-queue@^0.1.0:
|
|||||||
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
|
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
|
||||||
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
|
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
|
||||||
|
|
||||||
zod@^3.21.4:
|
zod@^3.21.4, zod@^3.23.8:
|
||||||
version "3.22.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff"
|
|
||||||
integrity sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==
|
|
||||||
|
|
||||||
zod@^3.23.8:
|
|
||||||
version "3.23.8"
|
version "3.23.8"
|
||||||
resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d"
|
resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d"
|
||||||
integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==
|
integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==
|
||||||
|
|||||||
@@ -112,8 +112,8 @@ func serve(cctx *cli.Context) error {
|
|||||||
Skipper: middleware.DefaultSkipper,
|
Skipper: middleware.DefaultSkipper,
|
||||||
Store: middleware.NewRateLimiterMemoryStoreWithConfig(
|
Store: middleware.NewRateLimiterMemoryStoreWithConfig(
|
||||||
middleware.RateLimiterMemoryStoreConfig{
|
middleware.RateLimiterMemoryStoreConfig{
|
||||||
Rate: 10, // requests per second
|
Rate: 20, // requests per second
|
||||||
Burst: 30, // allow bursts
|
Burst: 150, // allow bursts
|
||||||
ExpiresIn: 3 * time.Minute, // garbage collect entries older than 3 minutes
|
ExpiresIn: 3 * time.Minute, // garbage collect entries older than 3 minutes
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
Vendored
-21
@@ -1,21 +0,0 @@
|
|||||||
const React = require('react')
|
|
||||||
const $empty = Symbol.for('react.memo_cache_sentinel')
|
|
||||||
/**
|
|
||||||
* DANGER: this hook is NEVER meant to be called directly!
|
|
||||||
*
|
|
||||||
* Note that this is a temporary userspace implementation of this function
|
|
||||||
* from React 19. It is not as efficient and may invalidate more frequently
|
|
||||||
* than the official API. Please upgrade to React 19 as soon as you can.
|
|
||||||
**/
|
|
||||||
export function c(size) {
|
|
||||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
||||||
return React.useState(() => {
|
|
||||||
const $ = new Array(size)
|
|
||||||
for (let ii = 0; ii < size; ii++) {
|
|
||||||
$[ii] = $empty
|
|
||||||
}
|
|
||||||
// @ts-ignore
|
|
||||||
$[$empty] = true
|
|
||||||
return $
|
|
||||||
})[0]
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "react-compiler-runtime",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "index.js",
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^18.2.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+3
-1
@@ -9,18 +9,20 @@ module.exports = {
|
|||||||
'fi',
|
'fi',
|
||||||
'fr',
|
'fr',
|
||||||
'ga',
|
'ga',
|
||||||
|
'gl',
|
||||||
'hi',
|
'hi',
|
||||||
'hu',
|
'hu',
|
||||||
'id',
|
'id',
|
||||||
'it',
|
'it',
|
||||||
'ja',
|
'ja',
|
||||||
'ko',
|
'ko',
|
||||||
'nl',
|
'pl',
|
||||||
'pt-BR',
|
'pt-BR',
|
||||||
'ru',
|
'ru',
|
||||||
'th',
|
'th',
|
||||||
'tr',
|
'tr',
|
||||||
'uk',
|
'uk',
|
||||||
|
'vi',
|
||||||
'zh-CN',
|
'zh-CN',
|
||||||
'zh-HK',
|
'zh-HK',
|
||||||
'zh-TW',
|
'zh-TW',
|
||||||
|
|||||||
+16
-1
@@ -9,6 +9,11 @@ cfg.resolver.sourceExts = process.env.RN_SRC_EXT
|
|||||||
if (cfg.resolver.resolveRequest) {
|
if (cfg.resolver.resolveRequest) {
|
||||||
throw Error('Update this override because it is conflicting now.')
|
throw Error('Update this override because it is conflicting now.')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process.env.BSKY_PROFILE) {
|
||||||
|
cfg.cacheVersion += ':PROFILE'
|
||||||
|
}
|
||||||
|
|
||||||
cfg.resolver.resolveRequest = (context, moduleName, platform) => {
|
cfg.resolver.resolveRequest = (context, moduleName, platform) => {
|
||||||
// HACK: manually resolve a few packages that use `exports` in `package.json`.
|
// HACK: manually resolve a few packages that use `exports` in `package.json`.
|
||||||
// A proper solution is to enable `unstable_enablePackageExports` but this needs careful testing.
|
// A proper solution is to enable `unstable_enablePackageExports` but this needs careful testing.
|
||||||
@@ -29,6 +34,15 @@ cfg.resolver.resolveRequest = (context, moduleName, platform) => {
|
|||||||
if (moduleName === '@ipld/dag-cbor') {
|
if (moduleName === '@ipld/dag-cbor') {
|
||||||
return context.resolveRequest(context, '@ipld/dag-cbor/src', platform)
|
return context.resolveRequest(context, '@ipld/dag-cbor/src', platform)
|
||||||
}
|
}
|
||||||
|
if (process.env.BSKY_PROFILE) {
|
||||||
|
if (moduleName.endsWith('ReactNativeRenderer-prod')) {
|
||||||
|
return context.resolveRequest(
|
||||||
|
context,
|
||||||
|
moduleName.replace('-prod', '-profiling'),
|
||||||
|
platform,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
return context.resolveRequest(context, moduleName, platform)
|
return context.resolveRequest(context, moduleName, platform)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,9 +52,10 @@ cfg.transformer.getTransformOptions = async () => ({
|
|||||||
inlineRequires: true,
|
inlineRequires: true,
|
||||||
nonInlinedRequires: [
|
nonInlinedRequires: [
|
||||||
// We can remove this option and rely on the default after
|
// We can remove this option and rely on the default after
|
||||||
// https://github.com/facebook/metro/pull/1126 is released.
|
// https://github.com/facebook/metro/pull/1390 is released.
|
||||||
'React',
|
'React',
|
||||||
'react',
|
'react',
|
||||||
|
'react-compiler-runtime',
|
||||||
'react/jsx-dev-runtime',
|
'react/jsx-dev-runtime',
|
||||||
'react/jsx-runtime',
|
'react/jsx-runtime',
|
||||||
'react-native',
|
'react-native',
|
||||||
|
|||||||
+31
-49
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bsky.app",
|
"name": "bsky.app",
|
||||||
"version": "1.94.0",
|
"version": "1.95.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20"
|
"node": ">=20"
|
||||||
@@ -11,6 +11,8 @@
|
|||||||
"postinstall": "patch-package && yarn intl:compile",
|
"postinstall": "patch-package && yarn intl:compile",
|
||||||
"prebuild": "expo prebuild --clean",
|
"prebuild": "expo prebuild --clean",
|
||||||
"android": "expo run:android",
|
"android": "expo run:android",
|
||||||
|
"android:prod": "expo run:android --variant release",
|
||||||
|
"android:profile": "BSKY_PROFILE=1 expo run:android --variant release",
|
||||||
"ios": "expo run:ios",
|
"ios": "expo run:ios",
|
||||||
"web": "expo start --web",
|
"web": "expo start --web",
|
||||||
"use-build-number": "./scripts/useBuildNumberEnv.sh",
|
"use-build-number": "./scripts/useBuildNumberEnv.sh",
|
||||||
@@ -23,7 +25,6 @@
|
|||||||
"build-embed": "cd bskyembed && yarn build && yarn build-snippet && cd .. && node ./scripts/post-embed-build.js",
|
"build-embed": "cd bskyembed && yarn build && yarn build-snippet && cd .. && node ./scripts/post-embed-build.js",
|
||||||
"start": "expo start --dev-client",
|
"start": "expo start --dev-client",
|
||||||
"start:prod": "expo start --dev-client --no-dev --minify",
|
"start:prod": "expo start --dev-client --no-dev --minify",
|
||||||
"clean-cache": "rm -rf node_modules/.cache/babel-loader/*",
|
|
||||||
"test": "NODE_ENV=test jest --forceExit --testTimeout=20000 --bail",
|
"test": "NODE_ENV=test jest --forceExit --testTimeout=20000 --bail",
|
||||||
"test-watch": "NODE_ENV=test jest --watchAll",
|
"test-watch": "NODE_ENV=test jest --watchAll",
|
||||||
"test-ci": "NODE_ENV=test jest --ci --forceExit --reporters=default --reporters=jest-junit",
|
"test-ci": "NODE_ENV=test jest --ci --forceExit --reporters=default --reporters=jest-junit",
|
||||||
@@ -53,7 +54,7 @@
|
|||||||
"icons:optimize": "svgo -f ./assets/icons"
|
"icons:optimize": "svgo -f ./assets/icons"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@atproto/api": "^0.13.11",
|
"@atproto/api": "^0.13.18",
|
||||||
"@braintree/sanitize-url": "^6.0.2",
|
"@braintree/sanitize-url": "^6.0.2",
|
||||||
"@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet",
|
"@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet",
|
||||||
"@emoji-mart/react": "^1.1.1",
|
"@emoji-mart/react": "^1.1.1",
|
||||||
@@ -89,18 +90,18 @@
|
|||||||
"@tanstack/query-async-storage-persister": "^5.25.0",
|
"@tanstack/query-async-storage-persister": "^5.25.0",
|
||||||
"@tanstack/react-query": "^5.8.1",
|
"@tanstack/react-query": "^5.8.1",
|
||||||
"@tanstack/react-query-persist-client": "^5.25.0",
|
"@tanstack/react-query-persist-client": "^5.25.0",
|
||||||
"@tiptap/core": "^2.6.6",
|
"@tiptap/core": "^2.9.1",
|
||||||
"@tiptap/extension-document": "^2.6.6",
|
"@tiptap/extension-document": "^2.9.1",
|
||||||
"@tiptap/extension-hard-break": "^2.6.6",
|
"@tiptap/extension-hard-break": "^2.9.1",
|
||||||
"@tiptap/extension-history": "^2.6.6",
|
"@tiptap/extension-history": "^2.9.1",
|
||||||
"@tiptap/extension-mention": "^2.6.6",
|
"@tiptap/extension-mention": "^2.9.1",
|
||||||
"@tiptap/extension-paragraph": "^2.6.6",
|
"@tiptap/extension-paragraph": "^2.9.1",
|
||||||
"@tiptap/extension-placeholder": "^2.6.6",
|
"@tiptap/extension-placeholder": "^2.9.1",
|
||||||
"@tiptap/extension-text": "^2.6.6",
|
"@tiptap/extension-text": "^2.9.1",
|
||||||
"@tiptap/html": "^2.6.6",
|
"@tiptap/html": "^2.9.1",
|
||||||
"@tiptap/pm": "^2.6.6",
|
"@tiptap/pm": "^2.9.1",
|
||||||
"@tiptap/react": "^2.6.6",
|
"@tiptap/react": "^2.9.1",
|
||||||
"@tiptap/suggestion": "^2.6.6",
|
"@tiptap/suggestion": "^2.9.1",
|
||||||
"@types/invariant": "^2.2.37",
|
"@types/invariant": "^2.2.37",
|
||||||
"@types/lodash.throttle": "^4.1.9",
|
"@types/lodash.throttle": "^4.1.9",
|
||||||
"@types/node": "^20.14.3",
|
"@types/node": "^20.14.3",
|
||||||
@@ -140,6 +141,7 @@
|
|||||||
"expo-sharing": "^12.0.1",
|
"expo-sharing": "^12.0.1",
|
||||||
"expo-splash-screen": "~0.27.4",
|
"expo-splash-screen": "~0.27.4",
|
||||||
"expo-status-bar": "~1.12.1",
|
"expo-status-bar": "~1.12.1",
|
||||||
|
"expo-system-ui": "^3.0.4",
|
||||||
"expo-task-manager": "~11.8.1",
|
"expo-task-manager": "~11.8.1",
|
||||||
"expo-updates": "~0.25.14",
|
"expo-updates": "~0.25.14",
|
||||||
"expo-web-browser": "~13.0.3",
|
"expo-web-browser": "~13.0.3",
|
||||||
@@ -152,11 +154,6 @@
|
|||||||
"lodash.chunk": "^4.2.0",
|
"lodash.chunk": "^4.2.0",
|
||||||
"lodash.debounce": "^4.0.8",
|
"lodash.debounce": "^4.0.8",
|
||||||
"lodash.isequal": "^4.5.0",
|
"lodash.isequal": "^4.5.0",
|
||||||
"lodash.omit": "^4.5.0",
|
|
||||||
"lodash.once": "^4.1.1",
|
|
||||||
"lodash.random": "^3.2.0",
|
|
||||||
"lodash.samplesize": "^4.2.0",
|
|
||||||
"lodash.set": "^4.3.2",
|
|
||||||
"lodash.shuffle": "^4.2.0",
|
"lodash.shuffle": "^4.2.0",
|
||||||
"lodash.throttle": "^4.1.1",
|
"lodash.throttle": "^4.1.1",
|
||||||
"multiformats": "^13.1.0",
|
"multiformats": "^13.1.0",
|
||||||
@@ -166,14 +163,14 @@
|
|||||||
"postinstall-postinstall": "^2.1.0",
|
"postinstall-postinstall": "^2.1.0",
|
||||||
"psl": "^1.9.0",
|
"psl": "^1.9.0",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-compiler-runtime": "file:./lib/react-compiler-runtime",
|
"react-compiler-runtime": "19.0.0-beta-a7bf2bd-20241110",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-image-crop": "^11.0.7",
|
"react-image-crop": "^11.0.7",
|
||||||
"react-keyed-flatten-children": "^3.0.0",
|
"react-keyed-flatten-children": "^3.0.0",
|
||||||
"react-native": "0.74.1",
|
"react-native": "0.74.1",
|
||||||
"react-native-compressor": "^1.8.24",
|
"react-native-compressor": "^1.8.24",
|
||||||
"react-native-date-picker": "^4.4.2",
|
"react-native-date-picker": "^4.4.2",
|
||||||
"react-native-drawer-layout": "^4.0.0-alpha.3",
|
"react-native-drawer-layout": "^4.0.1",
|
||||||
"react-native-gesture-handler": "2.20.0",
|
"react-native-gesture-handler": "2.20.0",
|
||||||
"react-native-get-random-values": "~1.11.0",
|
"react-native-get-random-values": "~1.11.0",
|
||||||
"react-native-image-crop-picker": "0.41.2",
|
"react-native-image-crop-picker": "0.41.2",
|
||||||
@@ -207,7 +204,7 @@
|
|||||||
"zod": "^3.20.2"
|
"zod": "^3.20.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@atproto/dev-env": "^0.3.55",
|
"@atproto/dev-env": "^0.3.64",
|
||||||
"@babel/core": "^7.23.2",
|
"@babel/core": "^7.23.2",
|
||||||
"@babel/preset-env": "^7.20.0",
|
"@babel/preset-env": "^7.20.0",
|
||||||
"@babel/runtime": "^7.20.0",
|
"@babel/runtime": "^7.20.0",
|
||||||
@@ -217,44 +214,35 @@
|
|||||||
"@lingui/cli": "^4.5.0",
|
"@lingui/cli": "^4.5.0",
|
||||||
"@lingui/macro": "^4.5.0",
|
"@lingui/macro": "^4.5.0",
|
||||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
|
||||||
"@react-native-community/eslint-config": "^3.0.0",
|
"@react-native/eslint-config": "^0.76.2",
|
||||||
"@react-native/typescript-config": "^0.74.1",
|
"@react-native/typescript-config": "^0.74.1",
|
||||||
"@testing-library/jest-native": "^5.4.1",
|
"@testing-library/jest-native": "^5.4.1",
|
||||||
"@testing-library/react-native": "^11.5.2",
|
"@testing-library/react-native": "^11.5.2",
|
||||||
"@tsconfig/react-native": "^2.0.3",
|
|
||||||
"@types/he": "^1.1.2",
|
|
||||||
"@types/jest": "^29.4.0",
|
"@types/jest": "^29.4.0",
|
||||||
"@types/lodash.chunk": "^4.2.7",
|
"@types/lodash.chunk": "^4.2.7",
|
||||||
"@types/lodash.debounce": "^4.0.7",
|
"@types/lodash.debounce": "^4.0.7",
|
||||||
"@types/lodash.isequal": "^4.5.6",
|
"@types/lodash.isequal": "^4.5.6",
|
||||||
"@types/lodash.omit": "^4.5.7",
|
|
||||||
"@types/lodash.once": "^4.1.7",
|
|
||||||
"@types/lodash.random": "^3.2.7",
|
|
||||||
"@types/lodash.samplesize": "^4.2.7",
|
|
||||||
"@types/lodash.set": "^4.3.7",
|
|
||||||
"@types/lodash.shuffle": "^4.2.7",
|
"@types/lodash.shuffle": "^4.2.7",
|
||||||
"@types/psl": "^1.1.1",
|
"@types/psl": "^1.1.1",
|
||||||
"@types/react-dom": "^18.2.18",
|
"@types/react-dom": "^18.2.18",
|
||||||
"@types/react-responsive": "^8.0.5",
|
"@types/react-responsive": "^8.0.5",
|
||||||
"@types/react-test-renderer": "^17.0.1",
|
"@types/react-test-renderer": "^17.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.48.2",
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||||
"@typescript-eslint/parser": "^5.48.2",
|
"@typescript-eslint/parser": "^7.18.0",
|
||||||
"babel-jest": "^29.7.0",
|
"babel-jest": "^29.7.0",
|
||||||
"babel-loader": "^9.1.2",
|
|
||||||
"babel-plugin-macros": "^3.1.0",
|
"babel-plugin-macros": "^3.1.0",
|
||||||
"babel-plugin-module-resolver": "^5.0.0",
|
"babel-plugin-module-resolver": "^5.0.0",
|
||||||
"babel-plugin-react-compiler": "^0.0.0-experimental-592953e-20240517",
|
"babel-plugin-react-compiler": "19.0.0-beta-a7bf2bd-20241110",
|
||||||
"babel-plugin-react-native-web": "^0.18.12",
|
|
||||||
"babel-preset-expo": "^10.0.0",
|
"babel-preset-expo": "^10.0.0",
|
||||||
"eslint": "^8.19.0",
|
"eslint": "^8.19.0",
|
||||||
"eslint-plugin-bsky-internal": "link:./eslint",
|
"eslint-plugin-bsky-internal": "link:./eslint",
|
||||||
"eslint-plugin-ft-flow": "^2.0.3",
|
"eslint-plugin-ft-flow": "^2.0.3",
|
||||||
"eslint-plugin-lingui": "^0.2.0",
|
"eslint-plugin-lingui": "^0.2.0",
|
||||||
"eslint-plugin-react": "^7.33.2",
|
"eslint-plugin-react": "^7.33.2",
|
||||||
"eslint-plugin-react-compiler": "^0.0.0-experimental-c8b3f72-20240517",
|
"eslint-plugin-react-compiler": "19.0.0-beta-a7bf2bd-20241110",
|
||||||
"eslint-plugin-react-native-a11y": "^3.3.0",
|
"eslint-plugin-react-native-a11y": "^3.3.0",
|
||||||
"eslint-plugin-simple-import-sort": "^12.0.0",
|
"eslint-plugin-simple-import-sort": "^12.0.0",
|
||||||
"html-webpack-plugin": "^5.5.0",
|
"file-loader": "6.2.0",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"is-ci": "^3.0.1",
|
"is-ci": "^3.0.1",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
@@ -265,25 +253,19 @@
|
|||||||
"prettier": "^2.8.3",
|
"prettier": "^2.8.3",
|
||||||
"react-native-dotenv": "^3.3.1",
|
"react-native-dotenv": "^3.3.1",
|
||||||
"react-refresh": "^0.14.0",
|
"react-refresh": "^0.14.0",
|
||||||
"react-scripts": "^5.0.1",
|
|
||||||
"react-test-renderer": "18.2.0",
|
"react-test-renderer": "18.2.0",
|
||||||
"svgo": "^3.3.2",
|
"svgo": "^3.3.2",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^5.5.4",
|
"typescript": "^5.7.2",
|
||||||
"url-loader": "^4.1.1",
|
"webpack-bundle-analyzer": "^4.10.1"
|
||||||
"webpack": "^5.75.0",
|
|
||||||
"webpack-bundle-analyzer": "^4.10.1",
|
|
||||||
"webpack-cli": "^5.0.1",
|
|
||||||
"webpack-dev-server": "^4.11.1"
|
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
"@radix-ui/react-focus-scope": "1.1.0",
|
||||||
|
"@react-native/babel-preset": "0.74.1",
|
||||||
"@types/react": "^18",
|
"@types/react": "^18",
|
||||||
"**/zeed-dom": "0.10.9",
|
|
||||||
"**/zod": "3.23.8",
|
|
||||||
"**/expo-constants": "16.0.1",
|
"**/expo-constants": "16.0.1",
|
||||||
"**/expo-device": "6.0.2",
|
"**/expo-device": "6.0.2",
|
||||||
"@react-native/babel-preset": "0.74.1",
|
"**/zod": "3.23.8"
|
||||||
"@radix-ui/react-focus-scope": "1.1.0"
|
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "jest-expo/ios",
|
"preset": "jest-expo/ios",
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ index e9b330f..ec5f58c 100644
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
||||||
index b09e653..288e60c 100644
|
index b09e653..d2b4e05 100644
|
||||||
--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
||||||
+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
||||||
@@ -22,6 +22,7 @@ @implementation RCTRefreshControl {
|
@@ -22,6 +22,7 @@ @implementation RCTRefreshControl {
|
||||||
@@ -152,6 +152,119 @@ index 40aaf9c..1c60164 100644
|
|||||||
RCT_EXPORT_METHOD(setNativeRefreshing : (nonnull NSNumber *)viewTag toRefreshing : (BOOL)refreshing)
|
RCT_EXPORT_METHOD(setNativeRefreshing : (nonnull NSNumber *)viewTag toRefreshing : (BOOL)refreshing)
|
||||||
{
|
{
|
||||||
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||||
|
diff --git a/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m b/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m
|
||||||
|
index 1aead51..39e6244 100644
|
||||||
|
--- a/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m
|
||||||
|
+++ b/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m
|
||||||
|
@@ -159,31 +159,6 @@ - (BOOL)touchesShouldCancelInContentView:(__unused UIView *)view
|
||||||
|
return !shouldDisableScrollInteraction;
|
||||||
|
}
|
||||||
|
|
||||||
|
-/*
|
||||||
|
- * Automatically centers the content such that if the content is smaller than the
|
||||||
|
- * ScrollView, we force it to be centered, but when you zoom or the content otherwise
|
||||||
|
- * becomes larger than the ScrollView, there is no padding around the content but it
|
||||||
|
- * can still fill the whole view.
|
||||||
|
- */
|
||||||
|
-- (void)setContentOffset:(CGPoint)contentOffset
|
||||||
|
-{
|
||||||
|
- UIView *contentView = [self contentView];
|
||||||
|
- if (contentView && _centerContent && !CGSizeEqualToSize(contentView.frame.size, CGSizeZero)) {
|
||||||
|
- CGSize subviewSize = contentView.frame.size;
|
||||||
|
- CGSize scrollViewSize = self.bounds.size;
|
||||||
|
- if (subviewSize.width <= scrollViewSize.width) {
|
||||||
|
- contentOffset.x = -(scrollViewSize.width - subviewSize.width) / 2.0;
|
||||||
|
- }
|
||||||
|
- if (subviewSize.height <= scrollViewSize.height) {
|
||||||
|
- contentOffset.y = -(scrollViewSize.height - subviewSize.height) / 2.0;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- super.contentOffset = CGPointMake(
|
||||||
|
- RCTSanitizeNaNValue(contentOffset.x, @"scrollView.contentOffset.x"),
|
||||||
|
- RCTSanitizeNaNValue(contentOffset.y, @"scrollView.contentOffset.y"));
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
- (void)setFrame:(CGRect)frame
|
||||||
|
{
|
||||||
|
// Preserving and revalidating `contentOffset`.
|
||||||
|
@@ -427,6 +402,11 @@ - (void)setRemoveClippedSubviews:(__unused BOOL)removeClippedSubviews
|
||||||
|
// Does nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
+- (void)setFrame:(CGRect)frame {
|
||||||
|
+ [super setFrame:frame];
|
||||||
|
+ [self centerContentIfNeeded];
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
- (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex
|
||||||
|
{
|
||||||
|
[super insertReactSubview:view atIndex:atIndex];
|
||||||
|
@@ -444,6 +424,8 @@ - (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex
|
||||||
|
RCTApplyTransformationAccordingLayoutDirection(_contentView, self.reactLayoutDirection);
|
||||||
|
[_scrollView addSubview:view];
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ [self centerContentIfNeeded];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)removeReactSubview:(UIView *)subview
|
||||||
|
@@ -652,9 +634,46 @@ -(void)delegateMethod : (UIScrollView *)scrollView \
|
||||||
|
}
|
||||||
|
|
||||||
|
RCT_SCROLL_EVENT_HANDLER(scrollViewWillBeginDecelerating, onMomentumScrollBegin)
|
||||||
|
-RCT_SCROLL_EVENT_HANDLER(scrollViewDidZoom, onScroll)
|
||||||
|
RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
|
||||||
|
|
||||||
|
+-(void)scrollViewDidZoom : (UIScrollView *)scrollView
|
||||||
|
+{
|
||||||
|
+ [self centerContentIfNeeded];
|
||||||
|
+
|
||||||
|
+ RCT_SEND_SCROLL_EVENT(onScroll, nil);
|
||||||
|
+ RCT_FORWARD_SCROLL_EVENT(scrollViewDidZoom : scrollView);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Automatically centers the content such that if the content is smaller than the
|
||||||
|
+ * ScrollView, we force it to be centered, but when you zoom or the content otherwise
|
||||||
|
+ * becomes larger than the ScrollView, there is no padding around the content but it
|
||||||
|
+ * can still fill the whole view.
|
||||||
|
+ *
|
||||||
|
+ * PATCHED: This deviates from the original React Native implementation to fix two issues:
|
||||||
|
+ *
|
||||||
|
+ * - The scroll view was swallowing any taps immediately after pinching
|
||||||
|
+ * - The scroll view was jittering when crossing the full screen threshold while pinching
|
||||||
|
+ *
|
||||||
|
+ * This implementation is based on https://petersteinberger.com/blog/2013/how-to-center-uiscrollview/.
|
||||||
|
+ */
|
||||||
|
+-(void)centerContentIfNeeded
|
||||||
|
+{
|
||||||
|
+ if (_scrollView.centerContent &&
|
||||||
|
+ !CGSizeEqualToSize(self.contentSize, CGSizeZero) &&
|
||||||
|
+ !CGSizeEqualToSize(self.bounds.size, CGSizeZero)
|
||||||
|
+ ) {
|
||||||
|
+ CGFloat top = 0, left = 0;
|
||||||
|
+ if (self.contentSize.width < self.bounds.size.width) {
|
||||||
|
+ left = (self.bounds.size.width - self.contentSize.width) * 0.5f;
|
||||||
|
+ }
|
||||||
|
+ if (self.contentSize.height < self.bounds.size.height) {
|
||||||
|
+ top = (self.bounds.size.height - self.contentSize.height) * 0.5f;
|
||||||
|
+ }
|
||||||
|
+ _scrollView.contentInset = UIEdgeInsetsMake(top, left, top, left);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
- (void)addScrollListener:(NSObject<UIScrollViewDelegate> *)scrollListener
|
||||||
|
{
|
||||||
|
[_scrollListeners addObject:scrollListener];
|
||||||
|
@@ -913,6 +932,7 @@ - (void)updateContentSizeIfNeeded
|
||||||
|
CGSize contentSize = self.contentSize;
|
||||||
|
if (!CGSizeEqualToSize(_scrollView.contentSize, contentSize)) {
|
||||||
|
_scrollView.contentSize = contentSize;
|
||||||
|
+ [self centerContentIfNeeded];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java
|
diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java
|
||||||
index 5f5e1ab..aac00b6 100644
|
index 5f5e1ab..aac00b6 100644
|
||||||
--- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java
|
--- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
diff --git a/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java b/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java
|
||||||
|
index 06829bd..1b15818 100644
|
||||||
|
--- a/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java
|
||||||
|
+++ b/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java
|
||||||
|
@@ -14,17 +14,33 @@ import android.graphics.Paint;
|
||||||
|
import android.graphics.Path;
|
||||||
|
import com.facebook.react.bridge.ReactContext;
|
||||||
|
|
||||||
|
+import java.util.ArrayList;
|
||||||
|
+import java.util.HashMap;
|
||||||
|
+
|
||||||
|
+class ParsedPath {
|
||||||
|
+ final Path path;
|
||||||
|
+ final ArrayList<PathElement> elements;
|
||||||
|
+
|
||||||
|
+ ParsedPath(Path path, ArrayList<PathElement> elements) {
|
||||||
|
+ this.path = path;
|
||||||
|
+ this.elements = elements;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
@SuppressLint("ViewConstructor")
|
||||||
|
class PathView extends RenderableView {
|
||||||
|
private Path mPath;
|
||||||
|
|
||||||
|
+ // This grows forever but for our use case (static icons) it's ok.
|
||||||
|
+ private static final HashMap<String, ParsedPath> sPathCache = new HashMap<>();
|
||||||
|
+
|
||||||
|
public PathView(ReactContext reactContext) {
|
||||||
|
super(reactContext);
|
||||||
|
PathParser.mScale = mScale;
|
||||||
|
mPath = new Path();
|
||||||
|
}
|
||||||
|
|
||||||
|
- public void setD(String d) {
|
||||||
|
+ void setDByParsing(String d) {
|
||||||
|
mPath = PathParser.parse(d);
|
||||||
|
elements = PathParser.elements;
|
||||||
|
for (PathElement elem : elements) {
|
||||||
|
@@ -33,6 +49,17 @@ class PathView extends RenderableView {
|
||||||
|
point.y *= mScale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setD(String d) {
|
||||||
|
+ ParsedPath cached = sPathCache.get(d);
|
||||||
|
+ if (cached != null) {
|
||||||
|
+ mPath = cached.path;
|
||||||
|
+ elements = cached.elements;
|
||||||
|
+ } else {
|
||||||
|
+ setDByParsing(d);
|
||||||
|
+ sPathCache.put(d, new ParsedPath(mPath, elements));
|
||||||
|
+ }
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
+37
-34
@@ -69,6 +69,7 @@ import {Provider as PortalProvider} from '#/components/Portal'
|
|||||||
import {Splash} from '#/Splash'
|
import {Splash} from '#/Splash'
|
||||||
import {BottomSheetProvider} from '../modules/bottom-sheet'
|
import {BottomSheetProvider} from '../modules/bottom-sheet'
|
||||||
import {BackgroundNotificationPreferencesProvider} from '../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
|
import {BackgroundNotificationPreferencesProvider} from '../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
|
||||||
|
import {AppProfiler} from './AppProfiler'
|
||||||
|
|
||||||
SplashScreen.preventAutoHideAsync()
|
SplashScreen.preventAutoHideAsync()
|
||||||
|
|
||||||
@@ -184,40 +185,42 @@ function App() {
|
|||||||
* that is set up in the InnerApp component above.
|
* that is set up in the InnerApp component above.
|
||||||
*/
|
*/
|
||||||
return (
|
return (
|
||||||
<GeolocationProvider>
|
<AppProfiler>
|
||||||
<A11yProvider>
|
<GeolocationProvider>
|
||||||
<KeyboardProvider enabled={false} statusBarTranslucent={true}>
|
<A11yProvider>
|
||||||
<SessionProvider>
|
<KeyboardProvider enabled={false} statusBarTranslucent={true}>
|
||||||
<PrefsStateProvider>
|
<SessionProvider>
|
||||||
<I18nProvider>
|
<PrefsStateProvider>
|
||||||
<ShellStateProvider>
|
<I18nProvider>
|
||||||
<InvitesStateProvider>
|
<ShellStateProvider>
|
||||||
<ModalStateProvider>
|
<InvitesStateProvider>
|
||||||
<DialogStateProvider>
|
<ModalStateProvider>
|
||||||
<LightboxStateProvider>
|
<DialogStateProvider>
|
||||||
<PortalProvider>
|
<LightboxStateProvider>
|
||||||
<BottomSheetProvider>
|
<PortalProvider>
|
||||||
<StarterPackProvider>
|
<BottomSheetProvider>
|
||||||
<SafeAreaProvider
|
<StarterPackProvider>
|
||||||
initialMetrics={initialWindowMetrics}>
|
<SafeAreaProvider
|
||||||
<IntentDialogProvider>
|
initialMetrics={initialWindowMetrics}>
|
||||||
<InnerApp />
|
<IntentDialogProvider>
|
||||||
</IntentDialogProvider>
|
<InnerApp />
|
||||||
</SafeAreaProvider>
|
</IntentDialogProvider>
|
||||||
</StarterPackProvider>
|
</SafeAreaProvider>
|
||||||
</BottomSheetProvider>
|
</StarterPackProvider>
|
||||||
</PortalProvider>
|
</BottomSheetProvider>
|
||||||
</LightboxStateProvider>
|
</PortalProvider>
|
||||||
</DialogStateProvider>
|
</LightboxStateProvider>
|
||||||
</ModalStateProvider>
|
</DialogStateProvider>
|
||||||
</InvitesStateProvider>
|
</ModalStateProvider>
|
||||||
</ShellStateProvider>
|
</InvitesStateProvider>
|
||||||
</I18nProvider>
|
</ShellStateProvider>
|
||||||
</PrefsStateProvider>
|
</I18nProvider>
|
||||||
</SessionProvider>
|
</PrefsStateProvider>
|
||||||
</KeyboardProvider>
|
</SessionProvider>
|
||||||
</A11yProvider>
|
</KeyboardProvider>
|
||||||
</GeolocationProvider>
|
</A11yProvider>
|
||||||
|
</GeolocationProvider>
|
||||||
|
</AppProfiler>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import React, {Profiler} from 'react'
|
||||||
|
|
||||||
|
// Don't let it get stripped out in profiling builds (which apply production Babel preset).
|
||||||
|
const log = (global as any)['con' + 'sole'].log
|
||||||
|
|
||||||
|
function onRender(id: string, phase: string, actualDuration: number) {
|
||||||
|
if (!__DEV__) {
|
||||||
|
// This block of code will exist in the production build of the app.
|
||||||
|
// However, only profiling builds of React call `onRender` so it's dead code in actual production.
|
||||||
|
const message = `<Profiler> ${id}:${phase} ${
|
||||||
|
actualDuration > 500
|
||||||
|
? '(╯°□°)╯ '
|
||||||
|
: actualDuration > 100
|
||||||
|
? '[!!] '
|
||||||
|
: actualDuration > 16
|
||||||
|
? '[!] '
|
||||||
|
: ''
|
||||||
|
}${Math.round(actualDuration)}ms`
|
||||||
|
log(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AppProfiler({children}: {children: React.ReactNode}) {
|
||||||
|
return (
|
||||||
|
<Profiler id="app" onRender={onRender}>
|
||||||
|
{children}
|
||||||
|
</Profiler>
|
||||||
|
)
|
||||||
|
}
|
||||||
+2
-8
@@ -32,7 +32,7 @@ import {
|
|||||||
import {RouteParams, State} from '#/lib/routes/types'
|
import {RouteParams, State} from '#/lib/routes/types'
|
||||||
import {attachRouteToLogEvents, logEvent} from '#/lib/statsig/statsig'
|
import {attachRouteToLogEvents, logEvent} from '#/lib/statsig/statsig'
|
||||||
import {bskyTitle} from '#/lib/strings/headings'
|
import {bskyTitle} from '#/lib/strings/headings'
|
||||||
import {isAndroid, isNative, isWeb} from '#/platform/detection'
|
import {isNative, isWeb} from '#/platform/detection'
|
||||||
import {useModalControls} from '#/state/modals'
|
import {useModalControls} from '#/state/modals'
|
||||||
import {useUnreadNotifications} from '#/state/queries/notifications/unread'
|
import {useUnreadNotifications} from '#/state/queries/notifications/unread'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
@@ -453,7 +453,6 @@ function HomeTabNavigator() {
|
|||||||
return (
|
return (
|
||||||
<HomeTab.Navigator
|
<HomeTab.Navigator
|
||||||
screenOptions={{
|
screenOptions={{
|
||||||
animation: isAndroid ? 'ios' : undefined,
|
|
||||||
animationDuration: 285,
|
animationDuration: 285,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
fullScreenGestureEnabled: true,
|
fullScreenGestureEnabled: true,
|
||||||
@@ -472,7 +471,6 @@ function SearchTabNavigator() {
|
|||||||
return (
|
return (
|
||||||
<SearchTab.Navigator
|
<SearchTab.Navigator
|
||||||
screenOptions={{
|
screenOptions={{
|
||||||
animation: isAndroid ? 'ios' : undefined,
|
|
||||||
animationDuration: 285,
|
animationDuration: 285,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
fullScreenGestureEnabled: true,
|
fullScreenGestureEnabled: true,
|
||||||
@@ -490,7 +488,6 @@ function NotificationsTabNavigator() {
|
|||||||
return (
|
return (
|
||||||
<NotificationsTab.Navigator
|
<NotificationsTab.Navigator
|
||||||
screenOptions={{
|
screenOptions={{
|
||||||
animation: isAndroid ? 'ios' : undefined,
|
|
||||||
animationDuration: 285,
|
animationDuration: 285,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
fullScreenGestureEnabled: true,
|
fullScreenGestureEnabled: true,
|
||||||
@@ -512,7 +509,6 @@ function MyProfileTabNavigator() {
|
|||||||
return (
|
return (
|
||||||
<MyProfileTab.Navigator
|
<MyProfileTab.Navigator
|
||||||
screenOptions={{
|
screenOptions={{
|
||||||
animation: isAndroid ? 'ios' : undefined,
|
|
||||||
animationDuration: 285,
|
animationDuration: 285,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
fullScreenGestureEnabled: true,
|
fullScreenGestureEnabled: true,
|
||||||
@@ -538,7 +534,6 @@ function MessagesTabNavigator() {
|
|||||||
return (
|
return (
|
||||||
<MessagesTab.Navigator
|
<MessagesTab.Navigator
|
||||||
screenOptions={{
|
screenOptions={{
|
||||||
animation: isAndroid ? 'ios' : undefined,
|
|
||||||
animationDuration: 285,
|
animationDuration: 285,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
fullScreenGestureEnabled: true,
|
fullScreenGestureEnabled: true,
|
||||||
@@ -572,7 +567,6 @@ const FlatNavigator = () => {
|
|||||||
<Flat.Navigator
|
<Flat.Navigator
|
||||||
screenListeners={screenListeners}
|
screenListeners={screenListeners}
|
||||||
screenOptions={{
|
screenOptions={{
|
||||||
animation: isAndroid ? 'ios' : undefined,
|
|
||||||
animationDuration: 285,
|
animationDuration: 285,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
fullScreenGestureEnabled: true,
|
fullScreenGestureEnabled: true,
|
||||||
@@ -696,7 +690,7 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
|
|||||||
onStateChange={() => {
|
onStateChange={() => {
|
||||||
const routeName = getCurrentRouteName()
|
const routeName = getCurrentRouteName()
|
||||||
if (routeName === 'Notifications') {
|
if (routeName === 'Notifications') {
|
||||||
logEvent('router:navigate:notifications:sampled', {})
|
logEvent('router:navigate:notifications', {})
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onReady={() => {
|
onReady={() => {
|
||||||
|
|||||||
+40
-32
@@ -81,40 +81,40 @@ export function Splash(props: React.PropsWithChildren<Props>) {
|
|||||||
return {
|
return {
|
||||||
transform: [
|
transform: [
|
||||||
{
|
{
|
||||||
scale: interpolate(intro.value, [0, 1], [0.8, 1], 'clamp'),
|
scale: interpolate(intro.get(), [0, 1], [0.8, 1], 'clamp'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scale: interpolate(
|
scale: interpolate(
|
||||||
outroLogo.value,
|
outroLogo.get(),
|
||||||
[0, 0.08, 1],
|
[0, 0.08, 1],
|
||||||
[1, 0.8, 500],
|
[1, 0.8, 500],
|
||||||
'clamp',
|
'clamp',
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
opacity: interpolate(intro.value, [0, 1], [0, 1], 'clamp'),
|
opacity: interpolate(intro.get(), [0, 1], [0, 1], 'clamp'),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const bottomLogoAnimation = useAnimatedStyle(() => {
|
const bottomLogoAnimation = useAnimatedStyle(() => {
|
||||||
return {
|
return {
|
||||||
opacity: interpolate(intro.value, [0, 1], [0, 1], 'clamp'),
|
opacity: interpolate(intro.get(), [0, 1], [0, 1], 'clamp'),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const reducedLogoAnimation = useAnimatedStyle(() => {
|
const reducedLogoAnimation = useAnimatedStyle(() => {
|
||||||
return {
|
return {
|
||||||
transform: [
|
transform: [
|
||||||
{
|
{
|
||||||
scale: interpolate(intro.value, [0, 1], [0.8, 1], 'clamp'),
|
scale: interpolate(intro.get(), [0, 1], [0.8, 1], 'clamp'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
opacity: interpolate(intro.value, [0, 1], [0, 1], 'clamp'),
|
opacity: interpolate(intro.get(), [0, 1], [0, 1], 'clamp'),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const logoWrapperAnimation = useAnimatedStyle(() => {
|
const logoWrapperAnimation = useAnimatedStyle(() => {
|
||||||
return {
|
return {
|
||||||
opacity: interpolate(
|
opacity: interpolate(
|
||||||
outroAppOpacity.value,
|
outroAppOpacity.get(),
|
||||||
[0, 0.1, 0.2, 1],
|
[0, 0.1, 0.2, 1],
|
||||||
[1, 1, 0, 0],
|
[1, 1, 0, 0],
|
||||||
'clamp',
|
'clamp',
|
||||||
@@ -126,11 +126,11 @@ export function Splash(props: React.PropsWithChildren<Props>) {
|
|||||||
return {
|
return {
|
||||||
transform: [
|
transform: [
|
||||||
{
|
{
|
||||||
scale: interpolate(outroApp.value, [0, 1], [1.1, 1], 'clamp'),
|
scale: interpolate(outroApp.get(), [0, 1], [1.1, 1], 'clamp'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
opacity: interpolate(
|
opacity: interpolate(
|
||||||
outroAppOpacity.value,
|
outroAppOpacity.get(),
|
||||||
[0, 0.1, 0.2, 1],
|
[0, 0.1, 0.2, 1],
|
||||||
[0, 0, 1, 1],
|
[0, 0, 1, 1],
|
||||||
'clamp',
|
'clamp',
|
||||||
@@ -146,29 +146,37 @@ export function Splash(props: React.PropsWithChildren<Props>) {
|
|||||||
if (isReady) {
|
if (isReady) {
|
||||||
SplashScreen.hideAsync()
|
SplashScreen.hideAsync()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
intro.value = withTiming(
|
intro.set(() =>
|
||||||
1,
|
withTiming(
|
||||||
{duration: 400, easing: Easing.out(Easing.cubic)},
|
1,
|
||||||
async () => {
|
{duration: 400, easing: Easing.out(Easing.cubic)},
|
||||||
// set these values to check animation at specific point
|
async () => {
|
||||||
// outroLogo.value = 0.1
|
// set these values to check animation at specific point
|
||||||
// outroApp.value = 0.1
|
// outroLogo.set(0.1)
|
||||||
outroLogo.value = withTiming(
|
// outroApp.set(0.1)
|
||||||
1,
|
outroLogo.set(() =>
|
||||||
{duration: 1200, easing: Easing.in(Easing.cubic)},
|
withTiming(
|
||||||
() => {
|
1,
|
||||||
runOnJS(onFinish)()
|
{duration: 1200, easing: Easing.in(Easing.cubic)},
|
||||||
},
|
() => {
|
||||||
)
|
runOnJS(onFinish)()
|
||||||
outroApp.value = withTiming(1, {
|
},
|
||||||
duration: 1200,
|
),
|
||||||
easing: Easing.inOut(Easing.cubic),
|
)
|
||||||
})
|
outroApp.set(() =>
|
||||||
outroAppOpacity.value = withTiming(1, {
|
withTiming(1, {
|
||||||
duration: 1200,
|
duration: 1200,
|
||||||
easing: Easing.in(Easing.cubic),
|
easing: Easing.inOut(Easing.cubic),
|
||||||
})
|
}),
|
||||||
},
|
)
|
||||||
|
outroAppOpacity.set(() =>
|
||||||
|
withTiming(1, {
|
||||||
|
duration: 1200,
|
||||||
|
easing: Easing.in(Easing.cubic),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
import React, {Children} from 'react'
|
||||||
|
import {TextProps as RNTextProps} from 'react-native'
|
||||||
|
import {StyleProp, TextStyle} from 'react-native'
|
||||||
|
import {UITextView} from 'react-native-uitextview'
|
||||||
|
import createEmojiRegex from 'emoji-regex'
|
||||||
|
|
||||||
|
import {isNative} from '#/platform/detection'
|
||||||
|
import {isIOS} from '#/platform/detection'
|
||||||
|
import {Alf, applyFonts, atoms, flatten} from '#/alf'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Util to calculate lineHeight from a text size atom and a leading atom
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* `leading(atoms.text_md, atoms.leading_normal)` // => 24
|
||||||
|
*/
|
||||||
|
export function leading<
|
||||||
|
Size extends {fontSize?: number},
|
||||||
|
Leading extends {lineHeight?: number},
|
||||||
|
>(textSize: Size, leading: Leading) {
|
||||||
|
const size = textSize?.fontSize || atoms.text_md.fontSize
|
||||||
|
const lineHeight = leading?.lineHeight || atoms.leading_normal.lineHeight
|
||||||
|
return Math.round(size * lineHeight)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures that `lineHeight` defaults to a relative value of `1`, or applies
|
||||||
|
* other relative leading atoms.
|
||||||
|
*
|
||||||
|
* If the `lineHeight` value is > 2, we assume it's an absolute value and
|
||||||
|
* returns it as-is.
|
||||||
|
*/
|
||||||
|
export function normalizeTextStyles(
|
||||||
|
styles: StyleProp<TextStyle>,
|
||||||
|
{
|
||||||
|
fontScale,
|
||||||
|
fontFamily,
|
||||||
|
}: {
|
||||||
|
fontScale: number
|
||||||
|
fontFamily: Alf['fonts']['family']
|
||||||
|
} & Pick<Alf, 'flags'>,
|
||||||
|
) {
|
||||||
|
const s = flatten(styles)
|
||||||
|
// should always be defined on these components
|
||||||
|
s.fontSize = (s.fontSize || atoms.text_md.fontSize) * fontScale
|
||||||
|
|
||||||
|
if (s?.lineHeight) {
|
||||||
|
if (s.lineHeight !== 0 && s.lineHeight <= 2) {
|
||||||
|
s.lineHeight = Math.round(s.fontSize * s.lineHeight)
|
||||||
|
}
|
||||||
|
} else if (!isNative) {
|
||||||
|
s.lineHeight = s.fontSize
|
||||||
|
}
|
||||||
|
|
||||||
|
applyFonts(s, fontFamily)
|
||||||
|
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
export type StringChild = string | (string | null)[]
|
||||||
|
export type TextProps = RNTextProps & {
|
||||||
|
/**
|
||||||
|
* Lets the user select text, to use the native copy and paste functionality.
|
||||||
|
*/
|
||||||
|
selectable?: boolean
|
||||||
|
/**
|
||||||
|
* Provides `data-*` attributes to the underlying `UITextView` component on
|
||||||
|
* web only.
|
||||||
|
*/
|
||||||
|
dataSet?: Record<string, string | number | undefined>
|
||||||
|
/**
|
||||||
|
* Appears as a small tooltip on web hover.
|
||||||
|
*/
|
||||||
|
title?: string
|
||||||
|
/**
|
||||||
|
* Whether the children could possibly contain emoji.
|
||||||
|
*/
|
||||||
|
emoji?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const EMOJI = createEmojiRegex()
|
||||||
|
|
||||||
|
export function childHasEmoji(children: React.ReactNode) {
|
||||||
|
let hasEmoji = false
|
||||||
|
Children.forEach(children, child => {
|
||||||
|
if (typeof child === 'string' && createEmojiRegex().test(child)) {
|
||||||
|
hasEmoji = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return hasEmoji
|
||||||
|
}
|
||||||
|
|
||||||
|
export function renderChildrenWithEmoji(
|
||||||
|
children: React.ReactNode,
|
||||||
|
props: Omit<TextProps, 'children'> = {},
|
||||||
|
emoji: boolean,
|
||||||
|
) {
|
||||||
|
if (!isIOS || !emoji) {
|
||||||
|
return children
|
||||||
|
}
|
||||||
|
return Children.map(children, child => {
|
||||||
|
if (typeof child !== 'string') return child
|
||||||
|
|
||||||
|
const emojis = child.match(EMOJI)
|
||||||
|
|
||||||
|
if (emojis === null) {
|
||||||
|
return child
|
||||||
|
}
|
||||||
|
|
||||||
|
return child.split(EMOJI).map((stringPart, index) => [
|
||||||
|
stringPart,
|
||||||
|
emojis[index] ? (
|
||||||
|
<UITextView
|
||||||
|
{...props}
|
||||||
|
style={[props?.style, {color: 'black', fontFamily: 'System'}]}>
|
||||||
|
{emojis[index]}
|
||||||
|
</UITextView>
|
||||||
|
) : null,
|
||||||
|
])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const SINGLE_EMOJI_RE = /^[\p{Emoji_Presentation}\p{Extended_Pictographic}]+$/u
|
||||||
|
export function isOnlyEmoji(text: string) {
|
||||||
|
return text.length <= 15 && SINGLE_EMOJI_RE.test(text)
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {moderateProfile} from '@atproto/api'
|
import {moderateProfile} from '@atproto/api'
|
||||||
|
|
||||||
|
|||||||
@@ -458,7 +458,6 @@ export const Button = React.forwardRef<View, ButtonProps>(
|
|||||||
// @ts-ignore - this will always be a pressable
|
// @ts-ignore - this will always be a pressable
|
||||||
ref={ref}
|
ref={ref}
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
aria-pressed={state.pressed}
|
|
||||||
accessibilityLabel={label}
|
accessibilityLabel={label}
|
||||||
disabled={disabled || false}
|
disabled={disabled || false}
|
||||||
accessibilityState={{
|
accessibilityState={{
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export function Outer({
|
|||||||
try {
|
try {
|
||||||
cb()
|
cb()
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
logger.error('Error running close callback', e)
|
logger.error(e || 'Error running close callback')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
View,
|
View,
|
||||||
ViewStyle,
|
ViewStyle,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import Animated, {FadeIn, FadeInDown} from 'react-native-reanimated'
|
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {DismissableLayer} from '@radix-ui/react-dismissable-layer'
|
import {DismissableLayer} from '@radix-ui/react-dismissable-layer'
|
||||||
@@ -42,7 +41,6 @@ export function Outer({
|
|||||||
onClose,
|
onClose,
|
||||||
}: React.PropsWithChildren<DialogOuterProps>) {
|
}: React.PropsWithChildren<DialogOuterProps>) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
const [isOpen, setIsOpen] = React.useState(false)
|
const [isOpen, setIsOpen] = React.useState(false)
|
||||||
const {setDialogIsOpen} = useDialogStateControlContext()
|
const {setDialogIsOpen} = useDialogStateControlContext()
|
||||||
@@ -118,16 +116,7 @@ export function Outer({
|
|||||||
gtMobile ? a.p_lg : a.p_md,
|
gtMobile ? a.p_lg : a.p_md,
|
||||||
{overflowY: 'auto'},
|
{overflowY: 'auto'},
|
||||||
]}>
|
]}>
|
||||||
<Animated.View
|
<Backdrop />
|
||||||
entering={FadeIn.duration(150)}
|
|
||||||
// exiting={FadeOut.duration(150)}
|
|
||||||
style={[
|
|
||||||
web(a.fixed),
|
|
||||||
a.inset_0,
|
|
||||||
{opacity: 0.8, backgroundColor: t.palette.black},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
a.w_full,
|
a.w_full,
|
||||||
@@ -164,7 +153,7 @@ export function Inner({
|
|||||||
useFocusGuards()
|
useFocusGuards()
|
||||||
return (
|
return (
|
||||||
<FocusScope loop asChild trapped>
|
<FocusScope loop asChild trapped>
|
||||||
<Animated.View
|
<View
|
||||||
role="dialog"
|
role="dialog"
|
||||||
aria-role="dialog"
|
aria-role="dialog"
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
@@ -174,8 +163,6 @@ export function Inner({
|
|||||||
onClick={stopPropagation}
|
onClick={stopPropagation}
|
||||||
onStartShouldSetResponder={_ => true}
|
onStartShouldSetResponder={_ => true}
|
||||||
onTouchEnd={stopPropagation}
|
onTouchEnd={stopPropagation}
|
||||||
entering={FadeInDown.duration(100)}
|
|
||||||
// exiting={FadeOut.duration(100)}
|
|
||||||
style={flatten([
|
style={flatten([
|
||||||
a.relative,
|
a.relative,
|
||||||
a.rounded_md,
|
a.rounded_md,
|
||||||
@@ -188,6 +175,8 @@ export function Inner({
|
|||||||
shadowColor: t.palette.black,
|
shadowColor: t.palette.black,
|
||||||
shadowOpacity: t.name === 'light' ? 0.1 : 0.4,
|
shadowOpacity: t.name === 'light' ? 0.1 : 0.4,
|
||||||
shadowRadius: 30,
|
shadowRadius: 30,
|
||||||
|
// @ts-ignore web only
|
||||||
|
animation: 'fadeIn ease-out 0.1s',
|
||||||
},
|
},
|
||||||
flatten(style),
|
flatten(style),
|
||||||
])}>
|
])}>
|
||||||
@@ -201,7 +190,7 @@ export function Inner({
|
|||||||
{children}
|
{children}
|
||||||
</View>
|
</View>
|
||||||
</DismissableLayer>
|
</DismissableLayer>
|
||||||
</Animated.View>
|
</View>
|
||||||
</FocusScope>
|
</FocusScope>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -268,3 +257,25 @@ export function Close() {
|
|||||||
export function Handle() {
|
export function Handle() {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Backdrop() {
|
||||||
|
const t = useTheme()
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
opacity: 0.8,
|
||||||
|
}}>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
a.fixed,
|
||||||
|
a.inset_0,
|
||||||
|
{
|
||||||
|
backgroundColor: t.palette.black,
|
||||||
|
// @ts-ignore web only
|
||||||
|
animation: 'fadeIn ease-out 0.15s',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {StyleProp, TextStyle, View, ViewStyle} from 'react-native'
|
import {StyleProp, TextStyle, View, ViewStyle} from 'react-native'
|
||||||
|
|
||||||
import {atoms as a, useTheme, web} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
export function Header({
|
export function Header({
|
||||||
@@ -29,10 +29,8 @@ export function Header({
|
|||||||
a.border_b,
|
a.border_b,
|
||||||
t.atoms.border_contrast_medium,
|
t.atoms.border_contrast_medium,
|
||||||
t.atoms.bg,
|
t.atoms.bg,
|
||||||
web([
|
{borderTopLeftRadius: a.rounded_md.borderRadius},
|
||||||
{borderRadiusTopLeft: a.rounded_md.borderRadius},
|
{borderTopRightRadius: a.rounded_md.borderRadius},
|
||||||
{borderRadiusTopRight: a.rounded_md.borderRadius},
|
|
||||||
]),
|
|
||||||
style,
|
style,
|
||||||
]}>
|
]}>
|
||||||
{renderLeft && (
|
{renderLeft && (
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
|
|
||||||
import {atoms as a, flatten, useTheme, ViewStyleProp} from '#/alf'
|
import {atoms as a, flatten, useTheme, ViewStyleProp} from '#/alf'
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {LinearGradient} from 'expo-linear-gradient'
|
import {LinearGradient} from 'expo-linear-gradient'
|
||||||
|
|
||||||
import {atoms as a, tokens} from '#/alf'
|
import {atoms as a, tokens} from '#/alf'
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, {useCallback, useMemo} from 'react'
|
import {useCallback, useMemo} from 'react'
|
||||||
import {ActivityIndicator, FlatList, View} from 'react-native'
|
import {ActivityIndicator, FlatList, View} from 'react-native'
|
||||||
import {AppBskyFeedGetLikes as GetLikes} from '@atproto/api'
|
import {AppBskyFeedGetLikes as GetLikes} from '@atproto/api'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
|
|||||||
+9
-13
@@ -223,7 +223,7 @@ export function Link({
|
|||||||
{...web({
|
{...web({
|
||||||
hrefAttrs: {
|
hrefAttrs: {
|
||||||
target: download ? undefined : isExternal ? 'blank' : undefined,
|
target: download ? undefined : isExternal ? 'blank' : undefined,
|
||||||
rel: isExternal ? 'noopener noreferrer' : undefined,
|
rel: isExternal ? 'noopener' : undefined,
|
||||||
download,
|
download,
|
||||||
},
|
},
|
||||||
dataSet: {
|
dataSet: {
|
||||||
@@ -274,11 +274,6 @@ export function InlineLinkText({
|
|||||||
onOut: onHoverOut,
|
onOut: onHoverOut,
|
||||||
} = useInteractionState()
|
} = useInteractionState()
|
||||||
const {state: focused, onIn: onFocus, onOut: onBlur} = useInteractionState()
|
const {state: focused, onIn: onFocus, onOut: onBlur} = useInteractionState()
|
||||||
const {
|
|
||||||
state: pressed,
|
|
||||||
onIn: onPressIn,
|
|
||||||
onOut: onPressOut,
|
|
||||||
} = useInteractionState()
|
|
||||||
const flattenedStyle = flatten(style) || {}
|
const flattenedStyle = flatten(style) || {}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -289,19 +284,20 @@ export function InlineLinkText({
|
|||||||
{...rest}
|
{...rest}
|
||||||
style={[
|
style={[
|
||||||
{color: t.palette.primary_500},
|
{color: t.palette.primary_500},
|
||||||
(hovered || focused || pressed) &&
|
(hovered || focused) &&
|
||||||
!disableUnderline && {
|
!disableUnderline && {
|
||||||
...web({outline: 0}),
|
...web({
|
||||||
textDecorationLine: 'underline',
|
outline: 0,
|
||||||
textDecorationColor: flattenedStyle.color ?? t.palette.primary_500,
|
textDecorationLine: 'underline',
|
||||||
|
textDecorationColor:
|
||||||
|
flattenedStyle.color ?? t.palette.primary_500,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
flattenedStyle,
|
flattenedStyle,
|
||||||
]}
|
]}
|
||||||
role="link"
|
role="link"
|
||||||
onPress={download ? undefined : onPress}
|
onPress={download ? undefined : onPress}
|
||||||
onLongPress={onLongPress}
|
onLongPress={onLongPress}
|
||||||
onPressIn={onPressIn}
|
|
||||||
onPressOut={onPressOut}
|
|
||||||
onFocus={onFocus}
|
onFocus={onFocus}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
onMouseEnter={onHoverIn}
|
onMouseEnter={onHoverIn}
|
||||||
@@ -311,7 +307,7 @@ export function InlineLinkText({
|
|||||||
{...web({
|
{...web({
|
||||||
hrefAttrs: {
|
hrefAttrs: {
|
||||||
target: download ? undefined : isExternal ? 'blank' : undefined,
|
target: download ? undefined : isExternal ? 'blank' : undefined,
|
||||||
rel: isExternal ? 'noopener noreferrer' : undefined,
|
rel: isExternal ? 'noopener' : undefined,
|
||||||
download,
|
download,
|
||||||
},
|
},
|
||||||
dataSet: {
|
dataSet: {
|
||||||
|
|||||||
@@ -17,13 +17,12 @@ export function Loader(props: Props) {
|
|||||||
const rotation = useSharedValue(0)
|
const rotation = useSharedValue(0)
|
||||||
|
|
||||||
const animatedStyles = useAnimatedStyle(() => ({
|
const animatedStyles = useAnimatedStyle(() => ({
|
||||||
transform: [{rotate: rotation.value + 'deg'}],
|
transform: [{rotate: rotation.get() + 'deg'}],
|
||||||
}))
|
}))
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
rotation.value = withRepeat(
|
rotation.set(() =>
|
||||||
withTiming(360, {duration: 500, easing: Easing.linear}),
|
withRepeat(withTiming(360, {duration: 500, easing: Easing.linear}), -1),
|
||||||
-1,
|
|
||||||
)
|
)
|
||||||
}, [rotation])
|
}, [rotation])
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
|
|
||||||
import {atoms as a, flatten, useTheme} from '#/alf'
|
import {atoms as a, flatten, useTheme} from '#/alf'
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable react/prop-types */
|
|
||||||
|
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {Pressable, StyleProp, View, ViewStyle} from 'react-native'
|
import {Pressable, StyleProp, View, ViewStyle} from 'react-native'
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
|
|||||||
@@ -283,8 +283,8 @@ export function DescriptionPlaceholder({
|
|||||||
export type FollowButtonProps = {
|
export type FollowButtonProps = {
|
||||||
profile: AppBskyActorDefs.ProfileViewBasic
|
profile: AppBskyActorDefs.ProfileViewBasic
|
||||||
moderationOpts: ModerationOpts
|
moderationOpts: ModerationOpts
|
||||||
logContext: LogEvents['profile:follow:sampled']['logContext'] &
|
logContext: LogEvents['profile:follow']['logContext'] &
|
||||||
LogEvents['profile:unfollow:sampled']['logContext']
|
LogEvents['profile:unfollow']['logContext']
|
||||||
} & Partial<ButtonProps>
|
} & Partial<ButtonProps>
|
||||||
|
|
||||||
export function FollowButton(props: FollowButtonProps) {
|
export function FollowButton(props: FollowButtonProps) {
|
||||||
|
|||||||
@@ -302,8 +302,8 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) {
|
|||||||
const animationStyle = {
|
const animationStyle = {
|
||||||
animation:
|
animation:
|
||||||
currentState.stage === 'hiding'
|
currentState.stage === 'hiding'
|
||||||
? `avatarHoverFadeOut ${HIDE_DURATION}ms both`
|
? `fadeOut ${HIDE_DURATION}ms both`
|
||||||
: `avatarHoverFadeIn ${SHOW_DURATION}ms both`,
|
: `fadeIn ${SHOW_DURATION}ms both`,
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {StyleProp, View, ViewStyle} from 'react-native'
|
import {StyleProp, View, ViewStyle} from 'react-native'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import * as Progress from 'react-native-progress'
|
import * as Progress from 'react-native-progress'
|
||||||
|
|
||||||
|
|||||||
@@ -55,13 +55,15 @@ export const ProgressGuideToast = React.forwardRef<
|
|||||||
|
|
||||||
// animate the opacity then set isOpen to false when done
|
// animate the opacity then set isOpen to false when done
|
||||||
const setIsntOpen = () => setIsOpen(false)
|
const setIsntOpen = () => setIsOpen(false)
|
||||||
opacity.value = withTiming(
|
opacity.set(() =>
|
||||||
0,
|
withTiming(
|
||||||
{
|
0,
|
||||||
duration: 400,
|
{
|
||||||
easing: Easing.out(Easing.cubic),
|
duration: 400,
|
||||||
},
|
easing: Easing.out(Easing.cubic),
|
||||||
() => runOnJS(setIsntOpen)(),
|
},
|
||||||
|
() => runOnJS(setIsntOpen)(),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}, [setIsOpen, opacity])
|
}, [setIsOpen, opacity])
|
||||||
|
|
||||||
@@ -71,20 +73,24 @@ export const ProgressGuideToast = React.forwardRef<
|
|||||||
|
|
||||||
// animate the vertical translation, the opacity, and the checkmark
|
// animate the vertical translation, the opacity, and the checkmark
|
||||||
const playCheckmark = () => animatedCheckRef.current?.play()
|
const playCheckmark = () => animatedCheckRef.current?.play()
|
||||||
opacity.value = 0
|
opacity.set(0)
|
||||||
opacity.value = withTiming(
|
opacity.set(() =>
|
||||||
1,
|
withTiming(
|
||||||
{
|
1,
|
||||||
duration: 100,
|
{
|
||||||
easing: Easing.out(Easing.cubic),
|
duration: 100,
|
||||||
},
|
easing: Easing.out(Easing.cubic),
|
||||||
() => runOnJS(playCheckmark)(),
|
},
|
||||||
|
() => runOnJS(playCheckmark)(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
translateY.set(0)
|
||||||
|
translateY.set(() =>
|
||||||
|
withTiming(insets.top + 10, {
|
||||||
|
duration: 500,
|
||||||
|
easing: Easing.out(Easing.cubic),
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
translateY.value = 0
|
|
||||||
translateY.value = withTiming(insets.top + 10, {
|
|
||||||
duration: 500,
|
|
||||||
easing: Easing.out(Easing.cubic),
|
|
||||||
})
|
|
||||||
|
|
||||||
// start the countdown timer to autoclose
|
// start the countdown timer to autoclose
|
||||||
timeoutRef.current = setTimeout(close, visibleDuration || 5e3)
|
timeoutRef.current = setTimeout(close, visibleDuration || 5e3)
|
||||||
@@ -114,8 +120,8 @@ export const ProgressGuideToast = React.forwardRef<
|
|||||||
}, [winDim.width])
|
}, [winDim.width])
|
||||||
|
|
||||||
const animatedStyle = useAnimatedStyle(() => ({
|
const animatedStyle = useAnimatedStyle(() => ({
|
||||||
transform: [{translateY: translateY.value}],
|
transform: [{translateY: translateY.get()}],
|
||||||
opacity: opacity.value,
|
opacity: opacity.get(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {AppBskyLabelerDefs} from '@atproto/api'
|
import {AppBskyLabelerDefs} from '@atproto/api'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {NavigationProp} from '#/lib/routes/types'
|
|||||||
import {toShortUrl} from '#/lib/strings/url-helpers'
|
import {toShortUrl} from '#/lib/strings/url-helpers'
|
||||||
import {isNative} from '#/platform/detection'
|
import {isNative} from '#/platform/detection'
|
||||||
import {atoms as a, flatten, native, TextStyleProp, useTheme, web} from '#/alf'
|
import {atoms as a, flatten, native, TextStyleProp, useTheme, web} from '#/alf'
|
||||||
|
import {isOnlyEmoji} from '#/alf/typography'
|
||||||
import {useInteractionState} from '#/components/hooks/useInteractionState'
|
import {useInteractionState} from '#/components/hooks/useInteractionState'
|
||||||
import {InlineLinkText, LinkProps} from '#/components/Link'
|
import {InlineLinkText, LinkProps} from '#/components/Link'
|
||||||
import {ProfileHoverCard} from '#/components/ProfileHoverCard'
|
import {ProfileHoverCard} from '#/components/ProfileHoverCard'
|
||||||
@@ -53,7 +54,6 @@ export function RichText({
|
|||||||
const plainStyles = [a.leading_snug, flattenedStyle]
|
const plainStyles = [a.leading_snug, flattenedStyle]
|
||||||
const interactiveStyles = [
|
const interactiveStyles = [
|
||||||
a.leading_snug,
|
a.leading_snug,
|
||||||
a.pointer_events_auto,
|
|
||||||
flatten(interactiveStyle),
|
flatten(interactiveStyle),
|
||||||
flattenedStyle,
|
flattenedStyle,
|
||||||
]
|
]
|
||||||
@@ -151,17 +151,14 @@ export function RichText({
|
|||||||
/>,
|
/>,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
els.push(
|
els.push(segment.text)
|
||||||
<Text key={key} emoji style={plainStyles}>
|
|
||||||
{segment.text}
|
|
||||||
</Text>,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
key++
|
key++
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Text
|
<Text
|
||||||
|
emoji
|
||||||
selectable={selectable}
|
selectable={selectable}
|
||||||
testID={testID}
|
testID={testID}
|
||||||
style={plainStyles}
|
style={plainStyles}
|
||||||
@@ -194,11 +191,6 @@ function RichTextTag({
|
|||||||
onOut: onHoverOut,
|
onOut: onHoverOut,
|
||||||
} = useInteractionState()
|
} = useInteractionState()
|
||||||
const {state: focused, onIn: onFocus, onOut: onBlur} = useInteractionState()
|
const {state: focused, onIn: onFocus, onOut: onBlur} = useInteractionState()
|
||||||
const {
|
|
||||||
state: pressed,
|
|
||||||
onIn: onPressIn,
|
|
||||||
onOut: onPressOut,
|
|
||||||
} = useInteractionState()
|
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
|
|
||||||
const navigateToPage = React.useCallback(() => {
|
const navigateToPage = React.useCallback(() => {
|
||||||
@@ -228,8 +220,6 @@ function RichTextTag({
|
|||||||
accessibilityRole: isNative ? 'button' : undefined,
|
accessibilityRole: isNative ? 'button' : undefined,
|
||||||
onPress: navigateToPage,
|
onPress: navigateToPage,
|
||||||
onLongPress: openDialog,
|
onLongPress: openDialog,
|
||||||
onPressIn: onPressIn,
|
|
||||||
onPressOut: onPressOut,
|
|
||||||
})}
|
})}
|
||||||
{...web({
|
{...web({
|
||||||
onMouseEnter: onHoverIn,
|
onMouseEnter: onHoverIn,
|
||||||
@@ -243,10 +233,12 @@ function RichTextTag({
|
|||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
}),
|
}),
|
||||||
{color: t.palette.primary_500},
|
{color: t.palette.primary_500},
|
||||||
(hovered || focused || pressed) && {
|
(hovered || focused) && {
|
||||||
...web({outline: 0}),
|
...web({
|
||||||
textDecorationLine: 'underline',
|
outline: 0,
|
||||||
textDecorationColor: t.palette.primary_500,
|
textDecorationLine: 'underline',
|
||||||
|
textDecorationColor: t.palette.primary_500,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
style,
|
style,
|
||||||
]}>
|
]}>
|
||||||
@@ -256,10 +248,3 @@ function RichTextTag({
|
|||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isOnlyEmoji(text: string) {
|
|
||||||
return (
|
|
||||||
text.length <= 15 &&
|
|
||||||
/^[\p{Emoji_Presentation}\p{Extended_Pictographic}]+$/u.test(text)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const ProfilesList = React.forwardRef<SectionRef, ProfilesListProps>(
|
|||||||
ref,
|
ref,
|
||||||
) {
|
) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const bottomBarOffset = useBottomBarOffset(300)
|
const bottomBarOffset = useBottomBarOffset(headerHeight)
|
||||||
const initialNumToRender = useInitialNumToRender()
|
const initialNumToRender = useInitialNumToRender()
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
const {data, refetch, isError} = useAllListMembersQuery(listUri)
|
const {data, refetch, isError} = useAllListMembersQuery(listUri)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {InfiniteData, UseInfiniteQueryResult} from '@tanstack/react-query'
|
|||||||
|
|
||||||
import {useGenerateStarterPackMutation} from '#/lib/generate-starterpack'
|
import {useGenerateStarterPackMutation} from '#/lib/generate-starterpack'
|
||||||
import {useBottomBarOffset} from '#/lib/hooks/useBottomBarOffset'
|
import {useBottomBarOffset} from '#/lib/hooks/useBottomBarOffset'
|
||||||
|
import {useEmail} from '#/lib/hooks/useEmail'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
import {NavigationProp} from '#/lib/routes/types'
|
import {NavigationProp} from '#/lib/routes/types'
|
||||||
import {parseStarterPackUri} from '#/lib/strings/starter-pack'
|
import {parseStarterPackUri} from '#/lib/strings/starter-pack'
|
||||||
@@ -27,6 +28,7 @@ import {LinearGradientBackground} from '#/components/LinearGradientBackground'
|
|||||||
import {Loader} from '#/components/Loader'
|
import {Loader} from '#/components/Loader'
|
||||||
import * as Prompt from '#/components/Prompt'
|
import * as Prompt from '#/components/Prompt'
|
||||||
import {Default as StarterPackCard} from '#/components/StarterPack/StarterPackCard'
|
import {Default as StarterPackCard} from '#/components/StarterPack/StarterPackCard'
|
||||||
|
import {VerifyEmailDialog} from '../dialogs/VerifyEmailDialog'
|
||||||
import {PlusSmall_Stroke2_Corner0_Rounded as Plus} from '../icons/Plus'
|
import {PlusSmall_Stroke2_Corner0_Rounded as Plus} from '../icons/Plus'
|
||||||
|
|
||||||
interface SectionRef {
|
interface SectionRef {
|
||||||
@@ -186,6 +188,9 @@ function Empty() {
|
|||||||
const followersDialogControl = useDialogControl()
|
const followersDialogControl = useDialogControl()
|
||||||
const errorDialogControl = useDialogControl()
|
const errorDialogControl = useDialogControl()
|
||||||
|
|
||||||
|
const {needsEmailVerification} = useEmail()
|
||||||
|
const verifyEmailControl = useDialogControl()
|
||||||
|
|
||||||
const [isGenerating, setIsGenerating] = React.useState(false)
|
const [isGenerating, setIsGenerating] = React.useState(false)
|
||||||
|
|
||||||
const {mutate: generateStarterPack} = useGenerateStarterPackMutation({
|
const {mutate: generateStarterPack} = useGenerateStarterPackMutation({
|
||||||
@@ -249,7 +254,13 @@ function Empty() {
|
|||||||
color="primary"
|
color="primary"
|
||||||
size="small"
|
size="small"
|
||||||
disabled={isGenerating}
|
disabled={isGenerating}
|
||||||
onPress={confirmDialogControl.open}
|
onPress={() => {
|
||||||
|
if (needsEmailVerification) {
|
||||||
|
verifyEmailControl.open()
|
||||||
|
} else {
|
||||||
|
confirmDialogControl.open()
|
||||||
|
}
|
||||||
|
}}
|
||||||
style={{backgroundColor: 'transparent'}}>
|
style={{backgroundColor: 'transparent'}}>
|
||||||
<ButtonText style={{color: 'white'}}>
|
<ButtonText style={{color: 'white'}}>
|
||||||
<Trans>Make one for me</Trans>
|
<Trans>Make one for me</Trans>
|
||||||
@@ -262,7 +273,13 @@ function Empty() {
|
|||||||
color="primary"
|
color="primary"
|
||||||
size="small"
|
size="small"
|
||||||
disabled={isGenerating}
|
disabled={isGenerating}
|
||||||
onPress={() => navigation.navigate('StarterPackWizard')}
|
onPress={() => {
|
||||||
|
if (needsEmailVerification) {
|
||||||
|
verifyEmailControl.open()
|
||||||
|
} else {
|
||||||
|
navigation.navigate('StarterPackWizard')
|
||||||
|
}
|
||||||
|
}}
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: 'white',
|
backgroundColor: 'white',
|
||||||
borderColor: 'white',
|
borderColor: 'white',
|
||||||
@@ -318,6 +335,12 @@ function Empty() {
|
|||||||
onConfirm={generate}
|
onConfirm={generate}
|
||||||
confirmButtonCta={_(msg`Retry`)}
|
confirmButtonCta={_(msg`Retry`)}
|
||||||
/>
|
/>
|
||||||
|
<VerifyEmailDialog
|
||||||
|
reasonText={_(
|
||||||
|
msg`Before creating a starter pack, you must first verify your email.`,
|
||||||
|
)}
|
||||||
|
control={verifyEmailControl}
|
||||||
|
/>
|
||||||
</LinearGradientBackground>
|
</LinearGradientBackground>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {Image} from 'expo-image'
|
import {Image} from 'expo-image'
|
||||||
import {requestMediaLibraryPermissionsAsync} from 'expo-image-picker'
|
import {requestMediaLibraryPermissionsAsync} from 'expo-image-picker'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, {useRef} from 'react'
|
import {useRef} from 'react'
|
||||||
import type {ListRenderItemInfo} from 'react-native'
|
import type {ListRenderItemInfo} from 'react-native'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {AppBskyActorDefs, ModerationOpts} from '@atproto/api'
|
import {AppBskyActorDefs, ModerationOpts} from '@atproto/api'
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {Keyboard, View} from 'react-native'
|
import {Keyboard, View} from 'react-native'
|
||||||
import {
|
import {
|
||||||
AppBskyActorDefs,
|
AppBskyActorDefs,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
export function SubtleWebHover({}: {hover: boolean}) {
|
import {ViewStyleProp} from '#/alf'
|
||||||
|
|
||||||
|
export function SubtleWebHover({}: ViewStyleProp & {hover: boolean}) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import React from 'react'
|
|
||||||
import {StyleSheet, View} from 'react-native'
|
import {StyleSheet, View} from 'react-native'
|
||||||
|
|
||||||
import {isTouchDevice} from '#/lib/browser'
|
import {isTouchDevice} from '#/lib/browser'
|
||||||
import {useTheme} from '#/alf'
|
import {useTheme, ViewStyleProp} from '#/alf'
|
||||||
|
|
||||||
export function SubtleWebHover({hover}: {hover: boolean}) {
|
export function SubtleWebHover({
|
||||||
|
style,
|
||||||
|
hover,
|
||||||
|
}: ViewStyleProp & {hover: boolean}) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
if (isTouchDevice) {
|
if (isTouchDevice) {
|
||||||
return null
|
return null
|
||||||
@@ -26,9 +28,8 @@ export function SubtleWebHover({hover}: {hover: boolean}) {
|
|||||||
style={[
|
style={[
|
||||||
t.atoms.bg_contrast_25,
|
t.atoms.bg_contrast_25,
|
||||||
styles.container,
|
styles.container,
|
||||||
{
|
{opacity: hover ? opacity : 0},
|
||||||
opacity: hover ? opacity : 0,
|
style,
|
||||||
},
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
+164
-150
@@ -40,9 +40,37 @@ export function TagMenu({
|
|||||||
tag: string
|
tag: string
|
||||||
authorHandle?: string
|
authorHandle?: string
|
||||||
}>) {
|
}>) {
|
||||||
|
const navigation = useNavigation<NavigationProp>()
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{children}
|
||||||
|
<Dialog.Outer control={control}>
|
||||||
|
<Dialog.Handle />
|
||||||
|
<TagMenuInner
|
||||||
|
control={control}
|
||||||
|
tag={tag}
|
||||||
|
authorHandle={authorHandle}
|
||||||
|
navigation={navigation}
|
||||||
|
/>
|
||||||
|
</Dialog.Outer>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function TagMenuInner({
|
||||||
|
control,
|
||||||
|
tag,
|
||||||
|
authorHandle,
|
||||||
|
navigation,
|
||||||
|
}: {
|
||||||
|
control: Dialog.DialogOuterProps['control']
|
||||||
|
tag: string
|
||||||
|
authorHandle?: string
|
||||||
|
// Passed down because on native, we don't use real portals (and context would be wrong).
|
||||||
|
navigation: NavigationProp
|
||||||
|
}) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const navigation = useNavigation<NavigationProp>()
|
|
||||||
const {isLoading: isPreferencesLoading, data: preferences} =
|
const {isLoading: isPreferencesLoading, data: preferences} =
|
||||||
usePreferencesQuery()
|
usePreferencesQuery()
|
||||||
const {
|
const {
|
||||||
@@ -79,32 +107,75 @@ export function TagMenu({
|
|||||||
}, [tag, preferences?.moderationPrefs?.mutedWords])
|
}, [tag, preferences?.moderationPrefs?.mutedWords])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Dialog.Inner label={_(msg`Tag menu: ${displayTag}`)}>
|
||||||
{children}
|
{isPreferencesLoading ? (
|
||||||
|
<View style={[a.w_full, a.align_center]}>
|
||||||
<Dialog.Outer control={control}>
|
<Loader size="lg" />
|
||||||
<Dialog.Handle />
|
</View>
|
||||||
<Dialog.Inner label={_(msg`Tag menu: ${displayTag}`)}>
|
) : (
|
||||||
{isPreferencesLoading ? (
|
<>
|
||||||
<View style={[a.w_full, a.align_center]}>
|
<View
|
||||||
<Loader size="lg" />
|
style={[
|
||||||
</View>
|
a.rounded_md,
|
||||||
) : (
|
a.border,
|
||||||
<>
|
a.mb_md,
|
||||||
|
t.atoms.border_contrast_low,
|
||||||
|
t.atoms.bg_contrast_25,
|
||||||
|
]}>
|
||||||
|
<Link
|
||||||
|
label={_(msg`View all posts with tag ${displayTag}`)}
|
||||||
|
{...createStaticClick(() => {
|
||||||
|
control.close(() => {
|
||||||
|
navigation.push('Hashtag', {
|
||||||
|
tag: encodeURIComponent(tag),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})}>
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
a.rounded_md,
|
a.w_full,
|
||||||
a.border,
|
a.flex_row,
|
||||||
a.mb_md,
|
a.align_center,
|
||||||
t.atoms.border_contrast_low,
|
a.justify_start,
|
||||||
t.atoms.bg_contrast_25,
|
a.gap_md,
|
||||||
|
a.px_lg,
|
||||||
|
a.py_md,
|
||||||
]}>
|
]}>
|
||||||
|
<Search size="lg" style={[t.atoms.text_contrast_medium]} />
|
||||||
|
<Text
|
||||||
|
numberOfLines={1}
|
||||||
|
ellipsizeMode="middle"
|
||||||
|
style={[
|
||||||
|
a.flex_1,
|
||||||
|
a.text_md,
|
||||||
|
a.font_bold,
|
||||||
|
native({top: 2}),
|
||||||
|
t.atoms.text_contrast_medium,
|
||||||
|
]}>
|
||||||
|
<Trans>
|
||||||
|
See{' '}
|
||||||
|
<Text style={[a.text_md, a.font_bold, t.atoms.text]}>
|
||||||
|
{displayTag}
|
||||||
|
</Text>{' '}
|
||||||
|
posts
|
||||||
|
</Trans>
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</Link>
|
||||||
|
|
||||||
|
{authorHandle && !isInvalidHandle(authorHandle) && (
|
||||||
|
<>
|
||||||
|
<Divider />
|
||||||
|
|
||||||
<Link
|
<Link
|
||||||
label={_(msg`View all posts with tag ${displayTag}`)}
|
label={_(
|
||||||
|
msg`View all posts by @${authorHandle} with tag ${displayTag}`,
|
||||||
|
)}
|
||||||
{...createStaticClick(() => {
|
{...createStaticClick(() => {
|
||||||
control.close(() => {
|
control.close(() => {
|
||||||
navigation.push('Hashtag', {
|
navigation.push('Hashtag', {
|
||||||
tag: encodeURIComponent(tag),
|
tag: encodeURIComponent(tag),
|
||||||
|
author: authorHandle,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})}>
|
})}>
|
||||||
@@ -118,7 +189,7 @@ export function TagMenu({
|
|||||||
a.px_lg,
|
a.px_lg,
|
||||||
a.py_md,
|
a.py_md,
|
||||||
]}>
|
]}>
|
||||||
<Search size="lg" style={[t.atoms.text_contrast_medium]} />
|
<Person size="lg" style={[t.atoms.text_contrast_medium]} />
|
||||||
<Text
|
<Text
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
ellipsizeMode="middle"
|
ellipsizeMode="middle"
|
||||||
@@ -134,143 +205,86 @@ export function TagMenu({
|
|||||||
<Text style={[a.text_md, a.font_bold, t.atoms.text]}>
|
<Text style={[a.text_md, a.font_bold, t.atoms.text]}>
|
||||||
{displayTag}
|
{displayTag}
|
||||||
</Text>{' '}
|
</Text>{' '}
|
||||||
posts
|
posts by this user
|
||||||
</Trans>
|
</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</Link>
|
</Link>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{authorHandle && !isInvalidHandle(authorHandle) && (
|
{preferences ? (
|
||||||
<>
|
<>
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
<Link
|
<Button
|
||||||
label={_(
|
label={
|
||||||
msg`View all posts by @${authorHandle} with tag ${displayTag}`,
|
isMuted
|
||||||
)}
|
? _(msg`Unmute all ${displayTag} posts`)
|
||||||
{...createStaticClick(() => {
|
: _(msg`Mute all ${displayTag} posts`)
|
||||||
control.close(() => {
|
}
|
||||||
navigation.push('Hashtag', {
|
onPress={() => {
|
||||||
tag: encodeURIComponent(tag),
|
control.close(() => {
|
||||||
author: authorHandle,
|
if (isMuted) {
|
||||||
})
|
resetUpsert()
|
||||||
})
|
removeMutedWords(removeableMuteWords)
|
||||||
})}>
|
} else {
|
||||||
<View
|
resetRemove()
|
||||||
style={[
|
upsertMutedWord([
|
||||||
a.w_full,
|
{
|
||||||
a.flex_row,
|
value: tag,
|
||||||
a.align_center,
|
targets: ['tag'],
|
||||||
a.justify_start,
|
actorTarget: 'all',
|
||||||
a.gap_md,
|
},
|
||||||
a.px_lg,
|
])
|
||||||
a.py_md,
|
|
||||||
]}>
|
|
||||||
<Person
|
|
||||||
size="lg"
|
|
||||||
style={[t.atoms.text_contrast_medium]}
|
|
||||||
/>
|
|
||||||
<Text
|
|
||||||
numberOfLines={1}
|
|
||||||
ellipsizeMode="middle"
|
|
||||||
style={[
|
|
||||||
a.flex_1,
|
|
||||||
a.text_md,
|
|
||||||
a.font_bold,
|
|
||||||
native({top: 2}),
|
|
||||||
t.atoms.text_contrast_medium,
|
|
||||||
]}>
|
|
||||||
<Trans>
|
|
||||||
See{' '}
|
|
||||||
<Text
|
|
||||||
style={[a.text_md, a.font_bold, t.atoms.text]}>
|
|
||||||
{displayTag}
|
|
||||||
</Text>{' '}
|
|
||||||
posts by this user
|
|
||||||
</Trans>
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</Link>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{preferences ? (
|
|
||||||
<>
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
label={
|
|
||||||
isMuted
|
|
||||||
? _(msg`Unmute all ${displayTag} posts`)
|
|
||||||
: _(msg`Mute all ${displayTag} posts`)
|
|
||||||
}
|
}
|
||||||
onPress={() => {
|
})
|
||||||
control.close(() => {
|
}}>
|
||||||
if (isMuted) {
|
<View
|
||||||
resetUpsert()
|
style={[
|
||||||
removeMutedWords(removeableMuteWords)
|
a.w_full,
|
||||||
} else {
|
a.flex_row,
|
||||||
resetRemove()
|
a.align_center,
|
||||||
upsertMutedWord([
|
a.justify_start,
|
||||||
{
|
a.gap_md,
|
||||||
value: tag,
|
a.px_lg,
|
||||||
targets: ['tag'],
|
a.py_md,
|
||||||
actorTarget: 'all',
|
]}>
|
||||||
},
|
<Mute size="lg" style={[t.atoms.text_contrast_medium]} />
|
||||||
])
|
<Text
|
||||||
}
|
numberOfLines={1}
|
||||||
})
|
ellipsizeMode="middle"
|
||||||
}}>
|
style={[
|
||||||
<View
|
a.flex_1,
|
||||||
style={[
|
a.text_md,
|
||||||
a.w_full,
|
a.font_bold,
|
||||||
a.flex_row,
|
native({top: 2}),
|
||||||
a.align_center,
|
t.atoms.text_contrast_medium,
|
||||||
a.justify_start,
|
]}>
|
||||||
a.gap_md,
|
{isMuted ? _(msg`Unmute`) : _(msg`Mute`)}{' '}
|
||||||
a.px_lg,
|
<Text style={[a.text_md, a.font_bold, t.atoms.text]}>
|
||||||
a.py_md,
|
{displayTag}
|
||||||
]}>
|
</Text>{' '}
|
||||||
<Mute
|
<Trans>posts</Trans>
|
||||||
size="lg"
|
</Text>
|
||||||
style={[t.atoms.text_contrast_medium]}
|
</View>
|
||||||
/>
|
</Button>
|
||||||
<Text
|
</>
|
||||||
numberOfLines={1}
|
) : null}
|
||||||
ellipsizeMode="middle"
|
</View>
|
||||||
style={[
|
|
||||||
a.flex_1,
|
|
||||||
a.text_md,
|
|
||||||
a.font_bold,
|
|
||||||
native({top: 2}),
|
|
||||||
t.atoms.text_contrast_medium,
|
|
||||||
]}>
|
|
||||||
{isMuted ? _(msg`Unmute`) : _(msg`Mute`)}{' '}
|
|
||||||
<Text style={[a.text_md, a.font_bold, t.atoms.text]}>
|
|
||||||
{displayTag}
|
|
||||||
</Text>{' '}
|
|
||||||
<Trans>posts</Trans>
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
) : null}
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
label={_(msg`Close this dialog`)}
|
label={_(msg`Close this dialog`)}
|
||||||
size="small"
|
size="small"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
onPress={() => control.close()}>
|
onPress={() => control.close()}>
|
||||||
<ButtonText>
|
<ButtonText>
|
||||||
<Trans>Cancel</Trans>
|
<Trans>Cancel</Trans>
|
||||||
</ButtonText>
|
</ButtonText>
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Dialog.Inner>
|
</Dialog.Inner>
|
||||||
</Dialog.Outer>
|
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-139
@@ -1,140 +1,15 @@
|
|||||||
import React from 'react'
|
|
||||||
import {StyleProp, TextProps as RNTextProps, TextStyle} from 'react-native'
|
|
||||||
import {UITextView} from 'react-native-uitextview'
|
import {UITextView} from 'react-native-uitextview'
|
||||||
import createEmojiRegex from 'emoji-regex'
|
|
||||||
|
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {isIOS, isNative} from '#/platform/detection'
|
import {atoms, flatten, useAlf, useTheme, web} from '#/alf'
|
||||||
import {Alf, applyFonts, atoms, flatten, useAlf, useTheme, web} from '#/alf'
|
import {
|
||||||
|
childHasEmoji,
|
||||||
|
normalizeTextStyles,
|
||||||
|
renderChildrenWithEmoji,
|
||||||
|
TextProps,
|
||||||
|
} from '#/alf/typography'
|
||||||
import {IS_DEV} from '#/env'
|
import {IS_DEV} from '#/env'
|
||||||
|
export type {TextProps}
|
||||||
export type StringChild = string | (string | null)[]
|
|
||||||
|
|
||||||
export type TextProps = Omit<RNTextProps, 'children'> & {
|
|
||||||
/**
|
|
||||||
* Lets the user select text, to use the native copy and paste functionality.
|
|
||||||
*/
|
|
||||||
selectable?: boolean
|
|
||||||
/**
|
|
||||||
* Provides `data-*` attributes to the underlying `UITextView` component on
|
|
||||||
* web only.
|
|
||||||
*/
|
|
||||||
dataSet?: Record<string, string | number | undefined>
|
|
||||||
/**
|
|
||||||
* Appears as a small tooltip on web hover.
|
|
||||||
*/
|
|
||||||
title?: string
|
|
||||||
} & (
|
|
||||||
| {
|
|
||||||
emoji?: true
|
|
||||||
children: StringChild
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
emoji?: false
|
|
||||||
children: RNTextProps['children']
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
const EMOJI = createEmojiRegex()
|
|
||||||
|
|
||||||
export function childHasEmoji(children: React.ReactNode) {
|
|
||||||
return (Array.isArray(children) ? children : [children]).some(
|
|
||||||
child => typeof child === 'string' && createEmojiRegex().test(child),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function childIsString(
|
|
||||||
children: React.ReactNode,
|
|
||||||
): children is StringChild {
|
|
||||||
return (
|
|
||||||
typeof children === 'string' ||
|
|
||||||
(Array.isArray(children) &&
|
|
||||||
children.every(child => typeof child === 'string' || child === null))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function renderChildrenWithEmoji(
|
|
||||||
children: StringChild,
|
|
||||||
props: Omit<TextProps, 'children'> = {},
|
|
||||||
) {
|
|
||||||
const normalized = Array.isArray(children) ? children : [children]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<UITextView {...props}>
|
|
||||||
{normalized.map(child => {
|
|
||||||
if (typeof child !== 'string') return child
|
|
||||||
|
|
||||||
const emojis = child.match(EMOJI)
|
|
||||||
|
|
||||||
if (emojis === null) {
|
|
||||||
return child
|
|
||||||
}
|
|
||||||
|
|
||||||
return child.split(EMOJI).map((stringPart, index) => (
|
|
||||||
<UITextView key={index} {...props}>
|
|
||||||
{stringPart}
|
|
||||||
{emojis[index] ? (
|
|
||||||
<UITextView
|
|
||||||
{...props}
|
|
||||||
style={[props?.style, {color: 'black', fontFamily: 'System'}]}>
|
|
||||||
{emojis[index]}
|
|
||||||
</UITextView>
|
|
||||||
) : null}
|
|
||||||
</UITextView>
|
|
||||||
))
|
|
||||||
})}
|
|
||||||
</UITextView>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Util to calculate lineHeight from a text size atom and a leading atom
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* `leading(atoms.text_md, atoms.leading_normal)` // => 24
|
|
||||||
*/
|
|
||||||
export function leading<
|
|
||||||
Size extends {fontSize?: number},
|
|
||||||
Leading extends {lineHeight?: number},
|
|
||||||
>(textSize: Size, leading: Leading) {
|
|
||||||
const size = textSize?.fontSize || atoms.text_md.fontSize
|
|
||||||
const lineHeight = leading?.lineHeight || atoms.leading_normal.lineHeight
|
|
||||||
return Math.round(size * lineHeight)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ensures that `lineHeight` defaults to a relative value of `1`, or applies
|
|
||||||
* other relative leading atoms.
|
|
||||||
*
|
|
||||||
* If the `lineHeight` value is > 2, we assume it's an absolute value and
|
|
||||||
* returns it as-is.
|
|
||||||
*/
|
|
||||||
export function normalizeTextStyles(
|
|
||||||
styles: StyleProp<TextStyle>,
|
|
||||||
{
|
|
||||||
fontScale,
|
|
||||||
fontFamily,
|
|
||||||
}: {
|
|
||||||
fontScale: number
|
|
||||||
fontFamily: Alf['fonts']['family']
|
|
||||||
} & Pick<Alf, 'flags'>,
|
|
||||||
) {
|
|
||||||
const s = flatten(styles)
|
|
||||||
// should always be defined on these components
|
|
||||||
s.fontSize = (s.fontSize || atoms.text_md.fontSize) * fontScale
|
|
||||||
|
|
||||||
if (s?.lineHeight) {
|
|
||||||
if (s.lineHeight !== 0 && s.lineHeight <= 2) {
|
|
||||||
s.lineHeight = Math.round(s.fontSize * s.lineHeight)
|
|
||||||
}
|
|
||||||
} else if (!isNative) {
|
|
||||||
s.lineHeight = s.fontSize
|
|
||||||
}
|
|
||||||
|
|
||||||
applyFonts(s, fontFamily)
|
|
||||||
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Our main text component. Use this most of the time.
|
* Our main text component. Use this most of the time.
|
||||||
@@ -162,10 +37,6 @@ export function Text({
|
|||||||
`Text: emoji detected but emoji not enabled: "${children}"\n\nPlease add <Text emoji />'`,
|
`Text: emoji detected but emoji not enabled: "${children}"\n\nPlease add <Text emoji />'`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (emoji && !childIsString(children)) {
|
|
||||||
logger.error('Text: when <Text emoji />, children can only be strings.')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const shared = {
|
const shared = {
|
||||||
@@ -178,12 +49,12 @@ export function Text({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<UITextView {...shared}>
|
<UITextView {...shared}>
|
||||||
{isIOS && emoji ? renderChildrenWithEmoji(children, shared) : children}
|
{renderChildrenWithEmoji(children, shared, emoji ?? false)}
|
||||||
</UITextView>
|
</UITextView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createHeadingElement({level}: {level: number}) {
|
function createHeadingElement({level}: {level: number}) {
|
||||||
return function HeadingElement({style, ...rest}: TextProps) {
|
return function HeadingElement({style, ...rest}: TextProps) {
|
||||||
const attr =
|
const attr =
|
||||||
web({
|
web({
|
||||||
|
|||||||
@@ -32,21 +32,25 @@ export const AnimatedCheck = React.forwardRef<
|
|||||||
const checkAnim = useSharedValue(0)
|
const checkAnim = useSharedValue(0)
|
||||||
|
|
||||||
const circleAnimatedProps = useAnimatedProps(() => ({
|
const circleAnimatedProps = useAnimatedProps(() => ({
|
||||||
strokeDashoffset: 166 - circleAnim.value * 166,
|
strokeDashoffset: 166 - circleAnim.get() * 166,
|
||||||
}))
|
}))
|
||||||
const checkAnimatedProps = useAnimatedProps(() => ({
|
const checkAnimatedProps = useAnimatedProps(() => ({
|
||||||
strokeDashoffset: 48 - 48 * checkAnim.value,
|
strokeDashoffset: 48 - 48 * checkAnim.get(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const play = React.useCallback(
|
const play = React.useCallback(
|
||||||
(cb?: () => void) => {
|
(cb?: () => void) => {
|
||||||
circleAnim.value = 0
|
circleAnim.set(0)
|
||||||
checkAnim.value = 0
|
checkAnim.set(0)
|
||||||
|
|
||||||
circleAnim.value = withTiming(1, {duration: 500, easing: Easing.linear})
|
circleAnim.set(() =>
|
||||||
checkAnim.value = withDelay(
|
withTiming(1, {duration: 500, easing: Easing.linear}),
|
||||||
500,
|
)
|
||||||
withTiming(1, {duration: 300, easing: Easing.linear}, cb),
|
checkAnim.set(() =>
|
||||||
|
withDelay(
|
||||||
|
500,
|
||||||
|
withTiming(1, {duration: 300, easing: Easing.linear}, cb),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
[circleAnim, checkAnim],
|
[circleAnim, checkAnim],
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, {useCallback} from 'react'
|
import {useCallback} from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|||||||
@@ -256,6 +256,9 @@ export function PostInteractionSettingsForm({
|
|||||||
} else {
|
} else {
|
||||||
newSelected.splice(i, 1)
|
newSelected.splice(i, 1)
|
||||||
}
|
}
|
||||||
|
if (newSelected.length === 0) {
|
||||||
|
newSelected.push({type: 'everybody'})
|
||||||
|
}
|
||||||
|
|
||||||
onChangeThreadgateAllowUISettings(newSelected)
|
onChangeThreadgateAllowUISettings(newSelected)
|
||||||
}
|
}
|
||||||
@@ -306,7 +309,7 @@ export function PostInteractionSettingsForm({
|
|||||||
}
|
}
|
||||||
value={quotesEnabled}
|
value={quotesEnabled}
|
||||||
onChange={onChangeQuotesEnabled}
|
onChange={onChangeQuotesEnabled}
|
||||||
style={[, a.justify_between, a.pt_xs]}>
|
style={[a.justify_between, a.pt_xs]}>
|
||||||
<Text style={[t.atoms.text_contrast_medium]}>
|
<Text style={[t.atoms.text_contrast_medium]}>
|
||||||
{quotesEnabled ? (
|
{quotesEnabled ? (
|
||||||
<Trans>Quote posts enabled</Trans>
|
<Trans>Quote posts enabled</Trans>
|
||||||
@@ -483,7 +486,7 @@ function Selectable({
|
|||||||
a.justify_between,
|
a.justify_between,
|
||||||
a.rounded_sm,
|
a.rounded_sm,
|
||||||
a.p_md,
|
a.p_md,
|
||||||
{height: 40}, // for consistency with checkmark icon visible or not
|
{minHeight: 40}, // for consistency with checkmark icon visible or not
|
||||||
t.atoms.bg_contrast_50,
|
t.atoms.bg_contrast_50,
|
||||||
(hovered || focused) && t.atoms.bg_contrast_100,
|
(hovered || focused) && t.atoms.bg_contrast_100,
|
||||||
isSelected && {
|
isSelected && {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, {useCallback} from 'react'
|
import {useCallback} from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|||||||
@@ -18,8 +18,14 @@ import {Text} from '#/components/Typography'
|
|||||||
|
|
||||||
export function VerifyEmailDialog({
|
export function VerifyEmailDialog({
|
||||||
control,
|
control,
|
||||||
|
onCloseWithoutVerifying,
|
||||||
|
onCloseAfterVerifying,
|
||||||
|
reasonText,
|
||||||
}: {
|
}: {
|
||||||
control: Dialog.DialogControlProps
|
control: Dialog.DialogControlProps
|
||||||
|
onCloseWithoutVerifying?: () => void
|
||||||
|
onCloseAfterVerifying?: () => void
|
||||||
|
reasonText?: string
|
||||||
}) {
|
}) {
|
||||||
const agent = useAgent()
|
const agent = useAgent()
|
||||||
|
|
||||||
@@ -30,18 +36,24 @@ export function VerifyEmailDialog({
|
|||||||
control={control}
|
control={control}
|
||||||
onClose={async () => {
|
onClose={async () => {
|
||||||
if (!didVerify) {
|
if (!didVerify) {
|
||||||
|
onCloseWithoutVerifying?.()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await agent.resumeSession(agent.session!)
|
await agent.resumeSession(agent.session!)
|
||||||
|
onCloseAfterVerifying?.()
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
logger.error(String(e))
|
logger.error(String(e))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
<Dialog.Handle />
|
<Dialog.Handle />
|
||||||
<Inner control={control} setDidVerify={setDidVerify} />
|
<Inner
|
||||||
|
control={control}
|
||||||
|
setDidVerify={setDidVerify}
|
||||||
|
reasonText={reasonText}
|
||||||
|
/>
|
||||||
</Dialog.Outer>
|
</Dialog.Outer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -49,9 +61,11 @@ export function VerifyEmailDialog({
|
|||||||
export function Inner({
|
export function Inner({
|
||||||
control,
|
control,
|
||||||
setDidVerify,
|
setDidVerify,
|
||||||
|
reasonText,
|
||||||
}: {
|
}: {
|
||||||
control: Dialog.DialogControlProps
|
control: Dialog.DialogControlProps
|
||||||
setDidVerify: (value: boolean) => void
|
setDidVerify: (value: boolean) => void
|
||||||
|
reasonText?: string
|
||||||
}) {
|
}) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
@@ -132,34 +146,63 @@ export function Inner({
|
|||||||
<ErrorMessage message={error} />
|
<ErrorMessage message={error} />
|
||||||
</View>
|
</View>
|
||||||
) : null}
|
) : null}
|
||||||
<Text style={[a.text_md, a.leading_snug]}>
|
{currentStep === 'StepOne' ? (
|
||||||
{currentStep === 'StepOne' ? (
|
<View>
|
||||||
<>
|
{reasonText ? (
|
||||||
<Trans>
|
<View style={[a.gap_sm]}>
|
||||||
You'll receive an email at{' '}
|
<Text style={[a.text_md, a.leading_snug]}>{reasonText}</Text>
|
||||||
<Text style={[a.text_md, a.leading_snug, a.font_bold]}>
|
<Text style={[a.text_md, a.leading_snug]}>
|
||||||
{currentAccount?.email}
|
Don't have access to{' '}
|
||||||
</Text>{' '}
|
<Text style={[a.text_md, a.leading_snug, a.font_bold]}>
|
||||||
to verify it's you.
|
{currentAccount?.email}
|
||||||
</Trans>{' '}
|
</Text>
|
||||||
<InlineLinkText
|
?{' '}
|
||||||
to="#"
|
<InlineLinkText
|
||||||
label={_(msg`Change email address`)}
|
to="#"
|
||||||
style={[a.text_md, a.leading_snug]}
|
label={_(msg`Change email address`)}
|
||||||
onPress={e => {
|
style={[a.text_md, a.leading_snug]}
|
||||||
e.preventDefault()
|
onPress={e => {
|
||||||
control.close(() => {
|
e.preventDefault()
|
||||||
openModal({name: 'change-email'})
|
control.close(() => {
|
||||||
})
|
openModal({name: 'change-email'})
|
||||||
return false
|
})
|
||||||
}}>
|
return false
|
||||||
<Trans>Need to change it?</Trans>
|
}}>
|
||||||
</InlineLinkText>
|
<Trans>Change your email address</Trans>
|
||||||
</>
|
</InlineLinkText>
|
||||||
) : (
|
.
|
||||||
uiStrings[currentStep].message
|
</Text>
|
||||||
)}
|
</View>
|
||||||
</Text>
|
) : (
|
||||||
|
<Text style={[a.text_md, a.leading_snug]}>
|
||||||
|
<Trans>
|
||||||
|
You'll receive an email at{' '}
|
||||||
|
<Text style={[a.text_md, a.leading_snug, a.font_bold]}>
|
||||||
|
{currentAccount?.email}
|
||||||
|
</Text>{' '}
|
||||||
|
to verify it's you.
|
||||||
|
</Trans>{' '}
|
||||||
|
<InlineLinkText
|
||||||
|
to="#"
|
||||||
|
label={_(msg`Change email address`)}
|
||||||
|
style={[a.text_md, a.leading_snug]}
|
||||||
|
onPress={e => {
|
||||||
|
e.preventDefault()
|
||||||
|
control.close(() => {
|
||||||
|
openModal({name: 'change-email'})
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}}>
|
||||||
|
<Trans>Need to change it?</Trans>
|
||||||
|
</InlineLinkText>
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
) : (
|
||||||
|
<Text style={[a.text_md, a.leading_snug]}>
|
||||||
|
{uiStrings[currentStep].message}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
{currentStep === 'StepTwo' ? (
|
{currentStep === 'StepTwo' ? (
|
||||||
<View>
|
<View>
|
||||||
|
|||||||
@@ -1,117 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
|
||||||
import {msg, Trans} from '@lingui/macro'
|
|
||||||
import {useLingui} from '@lingui/react'
|
|
||||||
|
|
||||||
import {AppearanceToggleButtonGroup} from '#/screens/Settings/AppearanceSettings'
|
|
||||||
import {atoms as a, useAlf, useTheme} from '#/alf'
|
|
||||||
import * as Dialog from '#/components/Dialog'
|
|
||||||
import {useNuxDialogContext} from '#/components/dialogs/nuxs'
|
|
||||||
import {Divider} from '#/components/Divider'
|
|
||||||
import {TextSize_Stroke2_Corner0_Rounded as TextSize} from '#/components/icons/TextSize'
|
|
||||||
import {TitleCase_Stroke2_Corner0_Rounded as Aa} from '#/components/icons/TitleCase'
|
|
||||||
import {Text} from '#/components/Typography'
|
|
||||||
|
|
||||||
export function NeueTypography() {
|
|
||||||
const t = useTheme()
|
|
||||||
const {_} = useLingui()
|
|
||||||
const nuxDialogs = useNuxDialogContext()
|
|
||||||
const control = Dialog.useDialogControl()
|
|
||||||
const {fonts} = useAlf()
|
|
||||||
|
|
||||||
Dialog.useAutoOpen(control, 3e3)
|
|
||||||
|
|
||||||
const onClose = React.useCallback(() => {
|
|
||||||
nuxDialogs.dismissActiveNux()
|
|
||||||
}, [nuxDialogs])
|
|
||||||
|
|
||||||
const onChangeFontFamily = React.useCallback(
|
|
||||||
(values: string[]) => {
|
|
||||||
const next = values[0] === 'system' ? 'system' : 'theme'
|
|
||||||
fonts.setFontFamily(next)
|
|
||||||
},
|
|
||||||
[fonts],
|
|
||||||
)
|
|
||||||
|
|
||||||
const onChangeFontScale = React.useCallback(
|
|
||||||
(values: string[]) => {
|
|
||||||
const next = values[0] || ('0' as any)
|
|
||||||
fonts.setFontScale(next)
|
|
||||||
},
|
|
||||||
[fonts],
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dialog.Outer control={control} onClose={onClose}>
|
|
||||||
<Dialog.Handle />
|
|
||||||
<Dialog.ScrollableInner label={_(msg`Introducing new font settings`)}>
|
|
||||||
<View style={[a.gap_xl]}>
|
|
||||||
<View style={[a.gap_md]}>
|
|
||||||
<Text style={[a.text_3xl, a.font_heavy]}>
|
|
||||||
<Trans>New font settings ✨</Trans>
|
|
||||||
</Text>
|
|
||||||
<Text style={[a.text_lg, a.leading_snug, {maxWidth: 400}]}>
|
|
||||||
<Trans>
|
|
||||||
We're introducing a new theme font, along with adjustable font
|
|
||||||
sizing.
|
|
||||||
</Trans>
|
|
||||||
</Text>
|
|
||||||
<Text
|
|
||||||
style={[a.text_sm, a.leading_snug, t.atoms.text_contrast_medium]}>
|
|
||||||
<Trans>
|
|
||||||
You can adjust these in your Appearance Settings later.
|
|
||||||
</Trans>
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
<View style={[a.gap_lg]}>
|
|
||||||
<AppearanceToggleButtonGroup
|
|
||||||
title={_(msg`Font`)}
|
|
||||||
description={_(
|
|
||||||
msg`For the best experience, we recommend using the theme font.`,
|
|
||||||
)}
|
|
||||||
icon={Aa}
|
|
||||||
items={[
|
|
||||||
{
|
|
||||||
label: _(msg`System`),
|
|
||||||
name: 'system',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: _(msg`Theme`),
|
|
||||||
name: 'theme',
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
values={[fonts.family]}
|
|
||||||
onChange={onChangeFontFamily}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<AppearanceToggleButtonGroup
|
|
||||||
title={_(msg`Font size`)}
|
|
||||||
icon={TextSize}
|
|
||||||
items={[
|
|
||||||
{
|
|
||||||
label: _(msg`Smaller`),
|
|
||||||
name: '-1',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: _(msg`Default`),
|
|
||||||
name: '0',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: _(msg`Larger`),
|
|
||||||
name: '1',
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
values={[fonts.scale]}
|
|
||||||
onChange={onChangeFontScale}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<Dialog.Close />
|
|
||||||
</Dialog.ScrollableInner>
|
|
||||||
</Dialog.Outer>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -19,7 +19,6 @@ import {useOnboardingState} from '#/state/shell'
|
|||||||
/*
|
/*
|
||||||
* NUXs
|
* NUXs
|
||||||
*/
|
*/
|
||||||
import {NeueTypography} from '#/components/dialogs/nuxs/NeueTypography'
|
|
||||||
import {isSnoozed, snooze, unsnooze} from '#/components/dialogs/nuxs/snoozing'
|
import {isSnoozed, snooze, unsnooze} from '#/components/dialogs/nuxs/snoozing'
|
||||||
import {IS_DEV} from '#/env'
|
import {IS_DEV} from '#/env'
|
||||||
|
|
||||||
@@ -36,19 +35,7 @@ const queuedNuxs: {
|
|||||||
currentProfile: AppBskyActorDefs.ProfileViewDetailed
|
currentProfile: AppBskyActorDefs.ProfileViewDetailed
|
||||||
preferences: UsePreferencesQueryResponse
|
preferences: UsePreferencesQueryResponse
|
||||||
}) => boolean
|
}) => boolean
|
||||||
}[] = [
|
}[] = []
|
||||||
{
|
|
||||||
id: Nux.NeueTypography,
|
|
||||||
enabled(props) {
|
|
||||||
if (props.currentProfile.createdAt) {
|
|
||||||
if (new Date(props.currentProfile.createdAt) < new Date('2024-10-09')) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const Context = React.createContext<Context>({
|
const Context = React.createContext<Context>({
|
||||||
activeNux: undefined,
|
activeNux: undefined,
|
||||||
@@ -66,7 +53,14 @@ export function NuxDialogs() {
|
|||||||
const onboardingActive = useOnboardingState().isActive
|
const onboardingActive = useOnboardingState().isActive
|
||||||
|
|
||||||
const isLoading =
|
const isLoading =
|
||||||
!currentAccount || !preferences || !profile || onboardingActive
|
onboardingActive ||
|
||||||
|
!currentAccount ||
|
||||||
|
!preferences ||
|
||||||
|
!profile ||
|
||||||
|
// Profile isn't legit ready until createdAt is a real date.
|
||||||
|
!profile.createdAt ||
|
||||||
|
profile.createdAt === '0001-01-01T00:00:00.000Z' // TODO: Fix this in AppView.
|
||||||
|
|
||||||
return !isLoading ? (
|
return !isLoading ? (
|
||||||
<Inner
|
<Inner
|
||||||
currentAccount={currentAccount}
|
currentAccount={currentAccount}
|
||||||
@@ -174,7 +168,7 @@ function Inner({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Context.Provider value={ctx}>
|
<Context.Provider value={ctx}>
|
||||||
{activeNux === Nux.NeueTypography && <NeueTypography />}
|
{/*For example, activeNux === Nux.NeueTypography && <NeueTypography />*/}
|
||||||
</Context.Provider>
|
</Context.Provider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export function ActionsWrapper({
|
|||||||
const scale = useSharedValue(1)
|
const scale = useSharedValue(1)
|
||||||
|
|
||||||
const animatedStyle = useAnimatedStyle(() => ({
|
const animatedStyle = useAnimatedStyle(() => ({
|
||||||
transform: [{scale: scale.value}],
|
transform: [{scale: scale.get()}],
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const open = React.useCallback(() => {
|
const open = React.useCallback(() => {
|
||||||
@@ -46,7 +46,7 @@ export function ActionsWrapper({
|
|||||||
const shrink = React.useCallback(() => {
|
const shrink = React.useCallback(() => {
|
||||||
'worklet'
|
'worklet'
|
||||||
cancelAnimation(scale)
|
cancelAnimation(scale)
|
||||||
scale.value = withTiming(1, {duration: 200})
|
scale.set(() => withTiming(1, {duration: 200}))
|
||||||
}, [scale])
|
}, [scale])
|
||||||
|
|
||||||
const doubleTapGesture = Gesture.Tap()
|
const doubleTapGesture = Gesture.Tap()
|
||||||
@@ -58,11 +58,13 @@ export function ActionsWrapper({
|
|||||||
const pressAndHoldGesture = Gesture.LongPress()
|
const pressAndHoldGesture = Gesture.LongPress()
|
||||||
.onStart(() => {
|
.onStart(() => {
|
||||||
'worklet'
|
'worklet'
|
||||||
scale.value = withTiming(1.05, {duration: 200}, finished => {
|
scale.set(() =>
|
||||||
if (!finished) return
|
withTiming(1.05, {duration: 200}, finished => {
|
||||||
runOnJS(open)()
|
if (!finished) return
|
||||||
shrink()
|
runOnJS(open)()
|
||||||
})
|
shrink()
|
||||||
|
}),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.onTouchesUp(shrink)
|
.onTouchesUp(shrink)
|
||||||
.onTouchesMove(shrink)
|
.onTouchesMove(shrink)
|
||||||
|
|||||||
@@ -42,12 +42,12 @@ export function ChatEmptyPill() {
|
|||||||
|
|
||||||
const onPressIn = React.useCallback(() => {
|
const onPressIn = React.useCallback(() => {
|
||||||
if (isWeb) return
|
if (isWeb) return
|
||||||
scale.value = withTiming(1.075, {duration: 100})
|
scale.set(() => withTiming(1.075, {duration: 100}))
|
||||||
}, [scale])
|
}, [scale])
|
||||||
|
|
||||||
const onPressOut = React.useCallback(() => {
|
const onPressOut = React.useCallback(() => {
|
||||||
if (isWeb) return
|
if (isWeb) return
|
||||||
scale.value = withTiming(1, {duration: 100})
|
scale.set(() => withTiming(1, {duration: 100}))
|
||||||
}, [scale])
|
}, [scale])
|
||||||
|
|
||||||
const onPress = React.useCallback(() => {
|
const onPress = React.useCallback(() => {
|
||||||
@@ -61,7 +61,7 @@ export function ChatEmptyPill() {
|
|||||||
}, [playHaptic, prompts.length])
|
}, [playHaptic, prompts.length])
|
||||||
|
|
||||||
const animatedStyle = useAnimatedStyle(() => ({
|
const animatedStyle = useAnimatedStyle(() => ({
|
||||||
transform: [{scale: scale.value}],
|
transform: [{scale: scale.get()}],
|
||||||
}))
|
}))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ let ConvoMenu = ({
|
|||||||
{...props}
|
{...props}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
Keyboard.dismiss()
|
Keyboard.dismiss()
|
||||||
// eslint-disable-next-line react/prop-types -- eslint is confused by the name `props`
|
|
||||||
props.onPress()
|
props.onPress()
|
||||||
}}
|
}}
|
||||||
style={[
|
style={[
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useNavigation} from '@react-navigation/native'
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ import {ConvoItem} from '#/state/messages/convo/types'
|
|||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {TimeElapsed} from '#/view/com/util/TimeElapsed'
|
import {TimeElapsed} from '#/view/com/util/TimeElapsed'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
|
import {isOnlyEmoji} from '#/alf/typography'
|
||||||
import {ActionsWrapper} from '#/components/dms/ActionsWrapper'
|
import {ActionsWrapper} from '#/components/dms/ActionsWrapper'
|
||||||
import {InlineLinkText} from '#/components/Link'
|
import {InlineLinkText} from '#/components/Link'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
import {isOnlyEmoji, RichText} from '../RichText'
|
import {RichText} from '../RichText'
|
||||||
import {DateDivider} from './DateDivider'
|
import {DateDivider} from './DateDivider'
|
||||||
import {MessageItemEmbed} from './MessageItemEmbed'
|
import {MessageItemEmbed} from './MessageItemEmbed'
|
||||||
import {localDateString} from './util'
|
import {localDateString} from './util'
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export let MessageMenu = ({
|
|||||||
message.text,
|
message.text,
|
||||||
langPrefs.primaryLanguage,
|
langPrefs.primaryLanguage,
|
||||||
)
|
)
|
||||||
openLink(translatorUrl)
|
openLink(translatorUrl, true)
|
||||||
}, [langPrefs.primaryLanguage, message.text, openLink])
|
}, [langPrefs.primaryLanguage, message.text, openLink])
|
||||||
|
|
||||||
const onDelete = React.useCallback(() => {
|
const onDelete = React.useCallback(() => {
|
||||||
|
|||||||
@@ -3,14 +3,18 @@ import {View} from 'react-native'
|
|||||||
import {AppBskyActorDefs} from '@atproto/api'
|
import {AppBskyActorDefs} from '@atproto/api'
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
|
import {useEmail} from '#/lib/hooks/useEmail'
|
||||||
|
import {NavigationProp} from '#/lib/routes/types'
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import {useMaybeConvoForUser} from '#/state/queries/messages/get-convo-for-members'
|
import {useMaybeConvoForUser} from '#/state/queries/messages/get-convo-for-members'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {ButtonIcon} from '#/components/Button'
|
import {Button, ButtonIcon} from '#/components/Button'
|
||||||
import {canBeMessaged} from '#/components/dms/util'
|
import {canBeMessaged} from '#/components/dms/util'
|
||||||
import {Message_Stroke2_Corner0_Rounded as Message} from '#/components/icons/Message'
|
import {Message_Stroke2_Corner0_Rounded as Message} from '#/components/icons/Message'
|
||||||
import {Link} from '#/components/Link'
|
import {useDialogControl} from '../Dialog'
|
||||||
|
import {VerifyEmailDialog} from '../dialogs/VerifyEmailDialog'
|
||||||
|
|
||||||
export function MessageProfileButton({
|
export function MessageProfileButton({
|
||||||
profile,
|
profile,
|
||||||
@@ -19,15 +23,29 @@ export function MessageProfileButton({
|
|||||||
}) {
|
}) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
|
const navigation = useNavigation<NavigationProp>()
|
||||||
|
const {needsEmailVerification} = useEmail()
|
||||||
|
const verifyEmailControl = useDialogControl()
|
||||||
|
|
||||||
const {data: convo, isPending} = useMaybeConvoForUser(profile.did)
|
const {data: convo, isPending} = useMaybeConvoForUser(profile.did)
|
||||||
|
|
||||||
const onPress = React.useCallback(() => {
|
const onPress = React.useCallback(() => {
|
||||||
|
if (!convo?.id) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needsEmailVerification) {
|
||||||
|
verifyEmailControl.open()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (convo && !convo.lastMessage) {
|
if (convo && !convo.lastMessage) {
|
||||||
logEvent('chat:create', {logContext: 'ProfileHeader'})
|
logEvent('chat:create', {logContext: 'ProfileHeader'})
|
||||||
}
|
}
|
||||||
logEvent('chat:open', {logContext: 'ProfileHeader'})
|
logEvent('chat:open', {logContext: 'ProfileHeader'})
|
||||||
}, [convo])
|
|
||||||
|
navigation.navigate('MessagesConversation', {conversation: convo.id})
|
||||||
|
}, [needsEmailVerification, verifyEmailControl, convo, navigation])
|
||||||
|
|
||||||
if (isPending) {
|
if (isPending) {
|
||||||
// show pending state based on declaration
|
// show pending state based on declaration
|
||||||
@@ -53,18 +71,26 @@ export function MessageProfileButton({
|
|||||||
|
|
||||||
if (convo) {
|
if (convo) {
|
||||||
return (
|
return (
|
||||||
<Link
|
<>
|
||||||
testID="dmBtn"
|
<Button
|
||||||
size="small"
|
accessibilityRole="button"
|
||||||
color="secondary"
|
testID="dmBtn"
|
||||||
variant="solid"
|
size="small"
|
||||||
shape="round"
|
color="secondary"
|
||||||
label={_(msg`Message ${profile.handle}`)}
|
variant="solid"
|
||||||
to={`/messages/${convo.id}`}
|
shape="round"
|
||||||
style={[a.justify_center]}
|
label={_(msg`Message ${profile.handle}`)}
|
||||||
onPress={onPress}>
|
style={[a.justify_center]}
|
||||||
<ButtonIcon icon={Message} size="md" />
|
onPress={onPress}>
|
||||||
</Link>
|
<ButtonIcon icon={Message} size="md" />
|
||||||
|
</Button>
|
||||||
|
<VerifyEmailDialog
|
||||||
|
reasonText={_(
|
||||||
|
msg`Before you may message another user, you must first verify your email.`,
|
||||||
|
)}
|
||||||
|
control={verifyEmailControl}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -35,12 +35,12 @@ export function NewMessagesPill({
|
|||||||
|
|
||||||
const onPressIn = React.useCallback(() => {
|
const onPressIn = React.useCallback(() => {
|
||||||
if (isWeb) return
|
if (isWeb) return
|
||||||
scale.value = withTiming(1.075, {duration: 100})
|
scale.set(() => withTiming(1.075, {duration: 100}))
|
||||||
}, [scale])
|
}, [scale])
|
||||||
|
|
||||||
const onPressOut = React.useCallback(() => {
|
const onPressOut = React.useCallback(() => {
|
||||||
if (isWeb) return
|
if (isWeb) return
|
||||||
scale.value = withTiming(1, {duration: 100})
|
scale.set(() => withTiming(1, {duration: 100}))
|
||||||
}, [scale])
|
}, [scale])
|
||||||
|
|
||||||
const onPress = React.useCallback(() => {
|
const onPress = React.useCallback(() => {
|
||||||
@@ -49,7 +49,7 @@ export function NewMessagesPill({
|
|||||||
}, [onPressInner, playHaptic])
|
}, [onPressInner, playHaptic])
|
||||||
|
|
||||||
const animatedStyle = useAnimatedStyle(() => ({
|
const animatedStyle = useAnimatedStyle(() => ({
|
||||||
transform: [{scale: scale.value}],
|
transform: [{scale: scale.get()}],
|
||||||
}))
|
}))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import React, {useCallback} from 'react'
|
import {useCallback} from 'react'
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
|
import {useEmail} from '#/lib/hooks/useEmail'
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {useGetConvoForMembers} from '#/state/queries/messages/get-convo-for-members'
|
import {useGetConvoForMembers} from '#/state/queries/messages/get-convo-for-members'
|
||||||
@@ -9,6 +10,8 @@ import {FAB} from '#/view/com/util/fab/FAB'
|
|||||||
import * as Toast from '#/view/com/util/Toast'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
import {useTheme} from '#/alf'
|
import {useTheme} from '#/alf'
|
||||||
import * as Dialog from '#/components/Dialog'
|
import * as Dialog from '#/components/Dialog'
|
||||||
|
import {useDialogControl} from '#/components/Dialog'
|
||||||
|
import {VerifyEmailDialog} from '#/components/dialogs/VerifyEmailDialog'
|
||||||
import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus'
|
import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus'
|
||||||
import {SearchablePeopleList} from './SearchablePeopleList'
|
import {SearchablePeopleList} from './SearchablePeopleList'
|
||||||
|
|
||||||
@@ -21,6 +24,8 @@ export function NewChat({
|
|||||||
}) {
|
}) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
const {needsEmailVerification} = useEmail()
|
||||||
|
const verifyEmailControl = useDialogControl()
|
||||||
|
|
||||||
const {mutate: createChat} = useGetConvoForMembers({
|
const {mutate: createChat} = useGetConvoForMembers({
|
||||||
onSuccess: data => {
|
onSuccess: data => {
|
||||||
@@ -48,7 +53,13 @@ export function NewChat({
|
|||||||
<>
|
<>
|
||||||
<FAB
|
<FAB
|
||||||
testID="newChatFAB"
|
testID="newChatFAB"
|
||||||
onPress={control.open}
|
onPress={() => {
|
||||||
|
if (needsEmailVerification) {
|
||||||
|
verifyEmailControl.open()
|
||||||
|
} else {
|
||||||
|
control.open()
|
||||||
|
}
|
||||||
|
}}
|
||||||
icon={<Plus size="lg" fill={t.palette.white} />}
|
icon={<Plus size="lg" fill={t.palette.white} />}
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
accessibilityLabel={_(msg`New chat`)}
|
accessibilityLabel={_(msg`New chat`)}
|
||||||
@@ -62,6 +73,13 @@ export function NewChat({
|
|||||||
onSelectChat={onCreateChat}
|
onSelectChat={onCreateChat}
|
||||||
/>
|
/>
|
||||||
</Dialog.Outer>
|
</Dialog.Outer>
|
||||||
|
|
||||||
|
<VerifyEmailDialog
|
||||||
|
reasonText={_(
|
||||||
|
msg`Before you may message another user, you must first verify your email.`,
|
||||||
|
)}
|
||||||
|
control={verifyEmailControl}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ export function SearchablePeopleList({
|
|||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={[, web([a.pt_xs])]}>
|
<View style={web([a.pt_xs])}>
|
||||||
<SearchInput
|
<SearchInput
|
||||||
inputRef={inputRef}
|
inputRef={inputRef}
|
||||||
value={searchText}
|
value={searchText}
|
||||||
@@ -313,6 +313,7 @@ export function SearchablePeopleList({
|
|||||||
web([a.py_0, {height: '100vh', maxHeight: 600}, a.px_0]),
|
web([a.py_0, {height: '100vh', maxHeight: 600}, a.px_0]),
|
||||||
native({height: '100%'}),
|
native({height: '100%'}),
|
||||||
]}
|
]}
|
||||||
|
webInnerContentContainerStyle={a.py_0}
|
||||||
webInnerStyle={[a.py_0, {maxWidth: 500, minWidth: 200}]}
|
webInnerStyle={[a.py_0, {maxWidth: 500, minWidth: 200}]}
|
||||||
keyboardDismissMode="on-drag"
|
keyboardDismissMode="on-drag"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, {useCallback} from 'react'
|
import {useCallback} from 'react'
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {Pressable, View} from 'react-native'
|
import {Pressable, View} from 'react-native'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
|
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
es,
|
es,
|
||||||
fi,
|
fi,
|
||||||
fr,
|
fr,
|
||||||
|
gl,
|
||||||
hi,
|
hi,
|
||||||
hu,
|
hu,
|
||||||
id,
|
id,
|
||||||
@@ -23,11 +24,13 @@ import {
|
|||||||
ja,
|
ja,
|
||||||
ko,
|
ko,
|
||||||
nl,
|
nl,
|
||||||
|
pl,
|
||||||
ptBR,
|
ptBR,
|
||||||
ru,
|
ru,
|
||||||
th,
|
th,
|
||||||
tr,
|
tr,
|
||||||
uk,
|
uk,
|
||||||
|
vi,
|
||||||
zhCN,
|
zhCN,
|
||||||
zhHK,
|
zhHK,
|
||||||
zhTW,
|
zhTW,
|
||||||
@@ -48,6 +51,7 @@ const locales: Record<AppLanguage, Locale | undefined> = {
|
|||||||
fi,
|
fi,
|
||||||
fr,
|
fr,
|
||||||
ga: undefined,
|
ga: undefined,
|
||||||
|
gl,
|
||||||
hi,
|
hi,
|
||||||
hu,
|
hu,
|
||||||
id,
|
id,
|
||||||
@@ -55,11 +59,13 @@ const locales: Record<AppLanguage, Locale | undefined> = {
|
|||||||
ja,
|
ja,
|
||||||
ko,
|
ko,
|
||||||
nl,
|
nl,
|
||||||
|
pl,
|
||||||
['pt-BR']: ptBR,
|
['pt-BR']: ptBR,
|
||||||
ru,
|
ru,
|
||||||
th,
|
th,
|
||||||
tr,
|
tr,
|
||||||
uk,
|
uk,
|
||||||
|
vi,
|
||||||
['zh-CN']: zhCN,
|
['zh-CN']: zhCN,
|
||||||
['zh-HK']: zhHK,
|
['zh-HK']: zhHK,
|
||||||
['zh-TW']: zhTW,
|
['zh-TW']: zhTW,
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ export function useFollowMethods({
|
|||||||
logContext,
|
logContext,
|
||||||
}: {
|
}: {
|
||||||
profile: Shadow<AppBskyActorDefs.ProfileViewBasic>
|
profile: Shadow<AppBskyActorDefs.ProfileViewBasic>
|
||||||
logContext: LogEvents['profile:follow:sampled']['logContext'] &
|
logContext: LogEvents['profile:follow']['logContext'] &
|
||||||
LogEvents['profile:unfollow:sampled']['logContext']
|
LogEvents['profile:unfollow']['logContext']
|
||||||
}) {
|
}) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const requireAuth = useRequireAuth()
|
const requireAuth = useRequireAuth()
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import {createSinglePathSVG} from './TEMPLATE'
|
||||||
|
|
||||||
|
export const CalendarClock_Stroke2_Corner0_Rounded = createSinglePathSVG({
|
||||||
|
path: 'M15.439 3.148a1 1 0 0 1 .41.645l.568 3.22a7 7 0 1 1-6.174 10.97L4.32 19.027a1 1 0 0 1-1.159-.811L1.078 6.398a1 1 0 0 1 .81-1.158l12.803-2.258a1 1 0 0 1 .748.166ZM9.325 16.114A7 7 0 0 1 9 14c0-1.56.51-3 1.372-4.164l-6.456 1.139 1.041 5.909 4.368-.77ZM3.568 9.005l10.833-1.91-.347-1.97L3.22 7.036l.347 1.97ZM16 9a5 5 0 1 0 0 10 5 5 0 0 0 0-10Zm0 2a1 1 0 0 1 1 1v1.586l1.374 1.374a1 1 0 0 1-1.414 1.414l-1.667-1.667A1 1 0 0 1 15 14v-2a1 1 0 0 1 1-1Z',
|
||||||
|
})
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import {createSinglePathSVG} from './TEMPLATE'
|
||||||
|
|
||||||
|
export const ChainLink3_Stroke2_Corner0_Rounded = createSinglePathSVG({
|
||||||
|
path: 'M18.535 5.465a5.003 5.003 0 0 0-7.076 0l-.005.005-.752.742a1 1 0 1 1-1.404-1.424l.749-.74a7.003 7.003 0 0 1 9.904 9.905l-.002.003-.737.746a1 1 0 1 1-1.424-1.404l.747-.757a5.003 5.003 0 0 0 0-7.076ZM6.202 9.288a1 1 0 0 1 .01 1.414l-.747.757a5.003 5.003 0 1 0 7.076 7.076l.005-.005.752-.742a1 1 0 1 1 1.404 1.424l-.746.737-.003.002a7.003 7.003 0 0 1-9.904-9.904l.74-.75a1 1 0 0 1 1.413-.009Zm8.505.005a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414l4-4a1 1 0 0 1 1.414 0Z',
|
||||||
|
})
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {StyleSheet, TextProps} from 'react-native'
|
import {StyleSheet, TextProps} from 'react-native'
|
||||||
import type {PathProps, SvgProps} from 'react-native-svg'
|
import type {PathProps, SvgProps} from 'react-native-svg'
|
||||||
import {Defs, LinearGradient, Stop} from 'react-native-svg'
|
import {Defs, LinearGradient, Stop} from 'react-native-svg'
|
||||||
|
|||||||
@@ -31,6 +31,37 @@ export function ContentHider({
|
|||||||
ignoreMute?: boolean
|
ignoreMute?: boolean
|
||||||
style?: StyleProp<ViewStyle>
|
style?: StyleProp<ViewStyle>
|
||||||
childContainerStyle?: StyleProp<ViewStyle>
|
childContainerStyle?: StyleProp<ViewStyle>
|
||||||
|
}>) {
|
||||||
|
const blur = modui?.blurs[0]
|
||||||
|
if (!blur || (ignoreMute && isJustAMute(modui))) {
|
||||||
|
return (
|
||||||
|
<View testID={testID} style={style}>
|
||||||
|
{children}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<ContentHiderActive
|
||||||
|
testID={testID}
|
||||||
|
modui={modui}
|
||||||
|
style={style}
|
||||||
|
childContainerStyle={childContainerStyle}>
|
||||||
|
{children}
|
||||||
|
</ContentHiderActive>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ContentHiderActive({
|
||||||
|
testID,
|
||||||
|
modui,
|
||||||
|
style,
|
||||||
|
childContainerStyle,
|
||||||
|
children,
|
||||||
|
}: React.PropsWithChildren<{
|
||||||
|
testID?: string
|
||||||
|
modui: ModerationUI
|
||||||
|
style?: StyleProp<ViewStyle>
|
||||||
|
childContainerStyle?: StyleProp<ViewStyle>
|
||||||
}>) {
|
}>) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
@@ -40,7 +71,6 @@ export function ContentHider({
|
|||||||
const {labelDefs} = useLabelDefinitions()
|
const {labelDefs} = useLabelDefinitions()
|
||||||
const globalLabelStrings = useGlobalLabelStrings()
|
const globalLabelStrings = useGlobalLabelStrings()
|
||||||
const {i18n} = useLingui()
|
const {i18n} = useLingui()
|
||||||
|
|
||||||
const blur = modui?.blurs[0]
|
const blur = modui?.blurs[0]
|
||||||
const desc = useModerationCauseDescription(blur)
|
const desc = useModerationCauseDescription(blur)
|
||||||
|
|
||||||
@@ -99,14 +129,6 @@ export function ContentHider({
|
|||||||
globalLabelStrings,
|
globalLabelStrings,
|
||||||
])
|
])
|
||||||
|
|
||||||
if (!blur || (ignoreMute && isJustAMute(modui))) {
|
|
||||||
return (
|
|
||||||
<View testID={testID} style={style}>
|
|
||||||
{children}
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View testID={testID} style={[a.overflow_hidden, style]}>
|
<View testID={testID} style={[a.overflow_hidden, style]}>
|
||||||
<ModerationDetailsDialog control={control} modcause={blur} />
|
<ModerationDetailsDialog control={control} modcause={blur} />
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export function Outer({children}: React.PropsWithChildren<{}>) {
|
|||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
a.flex_row,
|
a.flex_row,
|
||||||
a.gap_md,
|
a.gap_sm,
|
||||||
a.px_lg,
|
a.px_lg,
|
||||||
a.py_lg,
|
a.py_lg,
|
||||||
a.justify_between,
|
a.justify_between,
|
||||||
@@ -74,10 +74,9 @@ export function Buttons({
|
|||||||
hideLabel?: string
|
hideLabel?: string
|
||||||
}) {
|
}) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {gtPhone} = useBreakpoints()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[{minHeight: 35}, gtPhone ? undefined : a.w_full]}>
|
<View style={[{minHeight: 35}, a.w_full]}>
|
||||||
<ToggleButton.Group
|
<ToggleButton.Group
|
||||||
label={_(
|
label={_(
|
||||||
msg`Configure content filtering setting for category: ${name}`,
|
msg`Configure content filtering setting for category: ${name}`,
|
||||||
@@ -259,7 +258,7 @@ export function LabelerLabelPreference({
|
|||||||
</Content>
|
</Content>
|
||||||
|
|
||||||
{showConfig && (
|
{showConfig && (
|
||||||
<View style={[gtPhone ? undefined : a.w_full]}>
|
<>
|
||||||
{cantConfigure ? (
|
{cantConfigure ? (
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
@@ -290,7 +289,7 @@ export function LabelerLabelPreference({
|
|||||||
hideLabel={hideLabel}
|
hideLabel={hideLabel}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</View>
|
</>
|
||||||
)}
|
)}
|
||||||
</Outer>
|
</Outer>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {StyleProp, View, ViewStyle} from 'react-native'
|
import {StyleProp, View, ViewStyle} from 'react-native'
|
||||||
import {AppBskyFeedDefs, ComAtprotoLabelDefs} from '@atproto/api'
|
import {AppBskyFeedDefs, ComAtprotoLabelDefs} from '@atproto/api'
|
||||||
import {msg, Plural} from '@lingui/macro'
|
import {msg, Plural} from '@lingui/macro'
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {ModerationCause} from '@atproto/api'
|
import {ModerationCause} from '@atproto/api'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {StyleProp, ViewStyle} from 'react-native'
|
import {StyleProp, ViewStyle} from 'react-native'
|
||||||
import {ModerationCause, ModerationUI} from '@atproto/api'
|
import {ModerationCause, ModerationUI} from '@atproto/api'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {StyleProp, ViewStyle} from 'react-native'
|
import {StyleProp, ViewStyle} from 'react-native'
|
||||||
import {ModerationDecision} from '@atproto/api'
|
import {ModerationDecision} from '@atproto/api'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
|
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
@@ -10,39 +9,23 @@ export function PlayButtonIcon({size = 32}: {size?: number}) {
|
|||||||
const fg = t.name === 'light' ? t.palette.contrast_975 : t.palette.contrast_25
|
const fg = t.name === 'light' ? t.palette.contrast_975 : t.palette.contrast_25
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<>
|
||||||
style={[
|
|
||||||
a.rounded_full,
|
|
||||||
a.overflow_hidden,
|
|
||||||
a.align_center,
|
|
||||||
a.justify_center,
|
|
||||||
t.atoms.shadow_lg,
|
|
||||||
{
|
|
||||||
width: size + size / 1.5,
|
|
||||||
height: size + size / 1.5,
|
|
||||||
},
|
|
||||||
]}>
|
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
a.absolute,
|
a.rounded_full,
|
||||||
a.inset_0,
|
|
||||||
{
|
{
|
||||||
backgroundColor: bg,
|
backgroundColor: bg,
|
||||||
|
shadowColor: 'black',
|
||||||
|
shadowRadius: 32,
|
||||||
|
shadowOpacity: 0.5,
|
||||||
|
elevation: 24,
|
||||||
|
width: size + size / 1.5,
|
||||||
|
height: size + size / 1.5,
|
||||||
opacity: 0.7,
|
opacity: 0.7,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<PlayIcon
|
<PlayIcon width={size} fill={fg} style={a.absolute} />
|
||||||
width={size}
|
</>
|
||||||
fill={fg}
|
|
||||||
style={[
|
|
||||||
a.relative,
|
|
||||||
a.z_10,
|
|
||||||
{
|
|
||||||
left: size / 50,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export const STARTER_PACK_MAX_SIZE = 150
|
|||||||
// code and update this number with each release until we can get the
|
// code and update this number with each release until we can get the
|
||||||
// server route done.
|
// server route done.
|
||||||
// -prf
|
// -prf
|
||||||
export const JOINED_THIS_WEEK = 650000 // estimate as of 10/28/24
|
export const JOINED_THIS_WEEK = 3500000 // estimate as of 11/16/24
|
||||||
|
|
||||||
export const DISCOVER_DEBUG_DIDS: Record<string, true> = {
|
export const DISCOVER_DEBUG_DIDS: Record<string, true> = {
|
||||||
'did:plc:oisofpd7lj26yvgiivf3lxsi': true, // hailey.at
|
'did:plc:oisofpd7lj26yvgiivf3lxsi': true, // hailey.at
|
||||||
@@ -154,6 +154,7 @@ export const SUPPORTED_MIME_TYPES = [
|
|||||||
'video/mpeg',
|
'video/mpeg',
|
||||||
'video/webm',
|
'video/webm',
|
||||||
'video/quicktime',
|
'video/quicktime',
|
||||||
|
'image/gif',
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
export type SupportedMimeTypes = (typeof SUPPORTED_MIME_TYPES)[number]
|
export type SupportedMimeTypes = (typeof SUPPORTED_MIME_TYPES)[number]
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export function GestureActionView({
|
|||||||
const clampedTransX = useDerivedValue(() => {
|
const clampedTransX = useDerivedValue(() => {
|
||||||
const min = actions.leftFirst ? -MAX_WIDTH : 0
|
const min = actions.leftFirst ? -MAX_WIDTH : 0
|
||||||
const max = actions.rightFirst ? MAX_WIDTH : 0
|
const max = actions.rightFirst ? MAX_WIDTH : 0
|
||||||
return clamp(transX.value, min, max)
|
return clamp(transX.get(), min, max)
|
||||||
})
|
})
|
||||||
|
|
||||||
const iconScale = useSharedValue(1)
|
const iconScale = useSharedValue(1)
|
||||||
@@ -75,21 +75,23 @@ export function GestureActionView({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
iconScale.value = withSequence(
|
iconScale.set(() =>
|
||||||
withTiming(1.2, {duration: 175}),
|
withSequence(
|
||||||
withTiming(1, {duration: 100}),
|
withTiming(1.2, {duration: 175}),
|
||||||
|
withTiming(1, {duration: 100}),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
useAnimatedReaction(
|
useAnimatedReaction(
|
||||||
() => transX,
|
() => transX,
|
||||||
() => {
|
() => {
|
||||||
if (transX.value === 0) {
|
if (transX.get() === 0) {
|
||||||
runOnJS(setActiveAction)(null)
|
runOnJS(setActiveAction)(null)
|
||||||
} else if (transX.value < 0) {
|
} else if (transX.get() < 0) {
|
||||||
if (
|
if (
|
||||||
actions.leftSecond &&
|
actions.leftSecond &&
|
||||||
transX.value <= -actions.leftSecond.threshold
|
transX.get() <= -actions.leftSecond.threshold
|
||||||
) {
|
) {
|
||||||
if (activeAction !== 'leftSecond') {
|
if (activeAction !== 'leftSecond') {
|
||||||
runOnJS(setActiveAction)('leftSecond')
|
runOnJS(setActiveAction)('leftSecond')
|
||||||
@@ -97,10 +99,10 @@ export function GestureActionView({
|
|||||||
} else if (activeAction !== 'leftFirst') {
|
} else if (activeAction !== 'leftFirst') {
|
||||||
runOnJS(setActiveAction)('leftFirst')
|
runOnJS(setActiveAction)('leftFirst')
|
||||||
}
|
}
|
||||||
} else if (transX.value > 0) {
|
} else if (transX.get() > 0) {
|
||||||
if (
|
if (
|
||||||
actions.rightSecond &&
|
actions.rightSecond &&
|
||||||
transX.value > actions.rightSecond.threshold
|
transX.get() > actions.rightSecond.threshold
|
||||||
) {
|
) {
|
||||||
if (activeAction !== 'rightSecond') {
|
if (activeAction !== 'rightSecond') {
|
||||||
runOnJS(setActiveAction)('rightSecond')
|
runOnJS(setActiveAction)('rightSecond')
|
||||||
@@ -119,44 +121,44 @@ export function GestureActionView({
|
|||||||
.activeOffsetY([-200, 200])
|
.activeOffsetY([-200, 200])
|
||||||
.onStart(() => {
|
.onStart(() => {
|
||||||
'worklet'
|
'worklet'
|
||||||
isActive.value = true
|
isActive.set(true)
|
||||||
})
|
})
|
||||||
.onChange(e => {
|
.onChange(e => {
|
||||||
'worklet'
|
'worklet'
|
||||||
transX.value = e.translationX
|
transX.set(e.translationX)
|
||||||
|
|
||||||
if (e.translationX < 0) {
|
if (e.translationX < 0) {
|
||||||
// Left side
|
// Left side
|
||||||
if (actions.leftSecond) {
|
if (actions.leftSecond) {
|
||||||
if (
|
if (
|
||||||
e.translationX <= -actions.leftSecond.threshold &&
|
e.translationX <= -actions.leftSecond.threshold &&
|
||||||
!hitSecond.value
|
!hitSecond.get()
|
||||||
) {
|
) {
|
||||||
runPopAnimation()
|
runPopAnimation()
|
||||||
runOnJS(haptic)()
|
runOnJS(haptic)()
|
||||||
hitSecond.value = true
|
hitSecond.set(true)
|
||||||
} else if (
|
} else if (
|
||||||
hitSecond.value &&
|
hitSecond.get() &&
|
||||||
e.translationX > -actions.leftSecond.threshold
|
e.translationX > -actions.leftSecond.threshold
|
||||||
) {
|
) {
|
||||||
runPopAnimation()
|
runPopAnimation()
|
||||||
hitSecond.value = false
|
hitSecond.set(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hitSecond.value && actions.leftFirst) {
|
if (!hitSecond.get() && actions.leftFirst) {
|
||||||
if (
|
if (
|
||||||
e.translationX <= -actions.leftFirst.threshold &&
|
e.translationX <= -actions.leftFirst.threshold &&
|
||||||
!hitFirst.value
|
!hitFirst.get()
|
||||||
) {
|
) {
|
||||||
runPopAnimation()
|
runPopAnimation()
|
||||||
runOnJS(haptic)()
|
runOnJS(haptic)()
|
||||||
hitFirst.value = true
|
hitFirst.set(true)
|
||||||
} else if (
|
} else if (
|
||||||
hitFirst.value &&
|
hitFirst.get() &&
|
||||||
e.translationX > -actions.leftFirst.threshold
|
e.translationX > -actions.leftFirst.threshold
|
||||||
) {
|
) {
|
||||||
hitFirst.value = false
|
hitFirst.set(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (e.translationX > 0) {
|
} else if (e.translationX > 0) {
|
||||||
@@ -164,33 +166,33 @@ export function GestureActionView({
|
|||||||
if (actions.rightSecond) {
|
if (actions.rightSecond) {
|
||||||
if (
|
if (
|
||||||
e.translationX >= actions.rightSecond.threshold &&
|
e.translationX >= actions.rightSecond.threshold &&
|
||||||
!hitSecond.value
|
!hitSecond.get()
|
||||||
) {
|
) {
|
||||||
runPopAnimation()
|
runPopAnimation()
|
||||||
runOnJS(haptic)()
|
runOnJS(haptic)()
|
||||||
hitSecond.value = true
|
hitSecond.set(true)
|
||||||
} else if (
|
} else if (
|
||||||
hitSecond.value &&
|
hitSecond.get() &&
|
||||||
e.translationX < actions.rightSecond.threshold
|
e.translationX < actions.rightSecond.threshold
|
||||||
) {
|
) {
|
||||||
runPopAnimation()
|
runPopAnimation()
|
||||||
hitSecond.value = false
|
hitSecond.set(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hitSecond.value && actions.rightFirst) {
|
if (!hitSecond.get() && actions.rightFirst) {
|
||||||
if (
|
if (
|
||||||
e.translationX >= actions.rightFirst.threshold &&
|
e.translationX >= actions.rightFirst.threshold &&
|
||||||
!hitFirst.value
|
!hitFirst.get()
|
||||||
) {
|
) {
|
||||||
runPopAnimation()
|
runPopAnimation()
|
||||||
runOnJS(haptic)()
|
runOnJS(haptic)()
|
||||||
hitFirst.value = true
|
hitFirst.set(true)
|
||||||
} else if (
|
} else if (
|
||||||
hitFirst.value &&
|
hitFirst.get() &&
|
||||||
e.translationX < actions.rightFirst.threshold
|
e.translationX < actions.rightFirst.threshold
|
||||||
) {
|
) {
|
||||||
hitFirst.value = false
|
hitFirst.set(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,29 +200,29 @@ export function GestureActionView({
|
|||||||
.onEnd(e => {
|
.onEnd(e => {
|
||||||
'worklet'
|
'worklet'
|
||||||
if (e.translationX < 0) {
|
if (e.translationX < 0) {
|
||||||
if (hitSecond.value && actions.leftSecond) {
|
if (hitSecond.get() && actions.leftSecond) {
|
||||||
runOnJS(actions.leftSecond.action)()
|
runOnJS(actions.leftSecond.action)()
|
||||||
} else if (hitFirst.value && actions.leftFirst) {
|
} else if (hitFirst.get() && actions.leftFirst) {
|
||||||
runOnJS(actions.leftFirst.action)()
|
runOnJS(actions.leftFirst.action)()
|
||||||
}
|
}
|
||||||
} else if (e.translationX > 0) {
|
} else if (e.translationX > 0) {
|
||||||
if (hitSecond.value && actions.rightSecond) {
|
if (hitSecond.get() && actions.rightSecond) {
|
||||||
runOnJS(actions.rightSecond.action)()
|
runOnJS(actions.rightSecond.action)()
|
||||||
} else if (hitSecond.value && actions.rightFirst) {
|
} else if (hitSecond.get() && actions.rightFirst) {
|
||||||
runOnJS(actions.rightFirst.action)()
|
runOnJS(actions.rightFirst.action)()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
transX.value = withTiming(0, {duration: 200})
|
transX.set(() => withTiming(0, {duration: 200}))
|
||||||
hitFirst.value = false
|
hitFirst.set(false)
|
||||||
hitSecond.value = false
|
hitSecond.set(false)
|
||||||
isActive.value = false
|
isActive.set(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
const composedGesture = Gesture.Simultaneous(panGesture)
|
const composedGesture = Gesture.Simultaneous(panGesture)
|
||||||
|
|
||||||
const animatedSliderStyle = useAnimatedStyle(() => {
|
const animatedSliderStyle = useAnimatedStyle(() => {
|
||||||
return {
|
return {
|
||||||
transform: [{translateX: clampedTransX.value}],
|
transform: [{translateX: clampedTransX.get()}],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -274,7 +276,7 @@ export function GestureActionView({
|
|||||||
const animatedBackgroundStyle = useAnimatedStyle(() => {
|
const animatedBackgroundStyle = useAnimatedStyle(() => {
|
||||||
return {
|
return {
|
||||||
backgroundColor: interpolateColor(
|
backgroundColor: interpolateColor(
|
||||||
clampedTransX.value,
|
clampedTransX.get(),
|
||||||
interpolation.inputRange,
|
interpolation.inputRange,
|
||||||
// @ts-expect-error - Weird type expected by reanimated, but this is okay
|
// @ts-expect-error - Weird type expected by reanimated, but this is okay
|
||||||
interpolation.outputRange,
|
interpolation.outputRange,
|
||||||
@@ -283,10 +285,10 @@ export function GestureActionView({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const animatedIconStyle = useAnimatedStyle(() => {
|
const animatedIconStyle = useAnimatedStyle(() => {
|
||||||
const absTransX = Math.abs(clampedTransX.value)
|
const absTransX = Math.abs(clampedTransX.get())
|
||||||
return {
|
return {
|
||||||
opacity: interpolate(absTransX, [0, 75], [0.15, 1]),
|
opacity: interpolate(absTransX, [0, 75], [0.15, 1]),
|
||||||
transform: [{scale: iconScale.value}],
|
transform: [{scale: iconScale.get()}],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import Animated, {
|
import Animated, {
|
||||||
Keyframe,
|
Keyframe,
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import React from 'react'
|
|
||||||
import {Pressable, PressableProps, StyleProp, ViewStyle} from 'react-native'
|
import {Pressable, PressableProps, StyleProp, ViewStyle} from 'react-native'
|
||||||
import Animated, {
|
import Animated, {
|
||||||
cancelAnimation,
|
cancelAnimation,
|
||||||
runOnJS,
|
|
||||||
useAnimatedStyle,
|
useAnimatedStyle,
|
||||||
useReducedMotion,
|
useReducedMotion,
|
||||||
useSharedValue,
|
useSharedValue,
|
||||||
@@ -32,27 +30,25 @@ export function PressableScale({
|
|||||||
const scale = useSharedValue(1)
|
const scale = useSharedValue(1)
|
||||||
|
|
||||||
const animatedStyle = useAnimatedStyle(() => ({
|
const animatedStyle = useAnimatedStyle(() => ({
|
||||||
transform: [{scale: scale.value}],
|
transform: [{scale: scale.get()}],
|
||||||
}))
|
}))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AnimatedPressable
|
<AnimatedPressable
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
onPressIn={e => {
|
onPressIn={e => {
|
||||||
'worklet'
|
|
||||||
if (onPressIn) {
|
if (onPressIn) {
|
||||||
runOnJS(onPressIn)(e)
|
onPressIn(e)
|
||||||
}
|
}
|
||||||
cancelAnimation(scale)
|
cancelAnimation(scale)
|
||||||
scale.value = withTiming(targetScale, {duration: 100})
|
scale.set(() => withTiming(targetScale, {duration: 100}))
|
||||||
}}
|
}}
|
||||||
onPressOut={e => {
|
onPressOut={e => {
|
||||||
'worklet'
|
|
||||||
if (onPressOut) {
|
if (onPressOut) {
|
||||||
runOnJS(onPressOut)(e)
|
onPressOut(e)
|
||||||
}
|
}
|
||||||
cancelAnimation(scale)
|
cancelAnimation(scale)
|
||||||
scale.value = withTiming(1, {duration: 100})
|
scale.set(() => withTiming(1, {duration: 100}))
|
||||||
}}
|
}}
|
||||||
style={[!reducedMotion && animatedStyle, style]}
|
style={[!reducedMotion && animatedStyle, style]}
|
||||||
{...rest}>
|
{...rest}>
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import {useServiceConfigQuery} from '#/state/queries/email-verification-required'
|
||||||
|
import {useProfileQuery} from '#/state/queries/profile'
|
||||||
|
import {useSession} from '#/state/session'
|
||||||
|
import {BSKY_SERVICE} from '../constants'
|
||||||
|
import {getHostnameFromUrl} from '../strings/url-helpers'
|
||||||
|
|
||||||
|
export function useEmail() {
|
||||||
|
const {currentAccount} = useSession()
|
||||||
|
|
||||||
|
const {data: serviceConfig} = useServiceConfigQuery()
|
||||||
|
const {data: profile} = useProfileQuery({did: currentAccount?.did})
|
||||||
|
|
||||||
|
const checkEmailConfirmed = !!serviceConfig?.checkEmailConfirmed
|
||||||
|
|
||||||
|
// Date set for 11 AM PST on the 18th of November
|
||||||
|
const isNewEnough =
|
||||||
|
!!profile?.createdAt &&
|
||||||
|
Date.parse(profile.createdAt) >= Date.parse('2024-11-18T19:00:00.000Z')
|
||||||
|
|
||||||
|
const isSelfHost =
|
||||||
|
currentAccount &&
|
||||||
|
getHostnameFromUrl(currentAccount.service) !==
|
||||||
|
getHostnameFromUrl(BSKY_SERVICE)
|
||||||
|
|
||||||
|
const needsEmailVerification =
|
||||||
|
!isSelfHost &&
|
||||||
|
checkEmailConfirmed &&
|
||||||
|
!currentAccount?.emailConfirmed &&
|
||||||
|
isNewEnough
|
||||||
|
|
||||||
|
return {needsEmailVerification}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import {useState} from 'react'
|
||||||
|
import {AnimatedRef, measure, MeasuredDimensions} from 'react-native-reanimated'
|
||||||
|
|
||||||
|
export type HandleRef = {
|
||||||
|
(node: any): void
|
||||||
|
current: null | number
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is a lighterweight alternative to `useAnimatedRef()` for imperative UI thread actions.
|
||||||
|
// Render it like <View ref={ref} />, then pass `ref.current` to `measureHandle()` and such.
|
||||||
|
export function useHandleRef(): HandleRef {
|
||||||
|
return useState(() => {
|
||||||
|
const ref = (node: any) => {
|
||||||
|
if (node) {
|
||||||
|
ref.current =
|
||||||
|
node._nativeTag ??
|
||||||
|
node.__nativeTag ??
|
||||||
|
node.canonical?.nativeTag ??
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
ref.current = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ref.current = null
|
||||||
|
return ref
|
||||||
|
})[0] as HandleRef
|
||||||
|
}
|
||||||
|
|
||||||
|
// When using this version, you need to read ref.current on the JS thread, and pass it to UI.
|
||||||
|
export function measureHandle(
|
||||||
|
current: number | null,
|
||||||
|
): MeasuredDimensions | null {
|
||||||
|
'worklet'
|
||||||
|
if (current !== null) {
|
||||||
|
return measure((() => current) as AnimatedRef<any>)
|
||||||
|
} else {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,15 +10,16 @@ export function useMinimalShellHeaderTransform() {
|
|||||||
const {headerHeight} = useShellLayout()
|
const {headerHeight} = useShellLayout()
|
||||||
|
|
||||||
const headerTransform = useAnimatedStyle(() => {
|
const headerTransform = useAnimatedStyle(() => {
|
||||||
|
const headerModeValue = headerMode.get()
|
||||||
return {
|
return {
|
||||||
pointerEvents: headerMode.value === 0 ? 'auto' : 'none',
|
pointerEvents: headerModeValue === 0 ? 'auto' : 'none',
|
||||||
opacity: Math.pow(1 - headerMode.value, 2),
|
opacity: Math.pow(1 - headerModeValue, 2),
|
||||||
transform: [
|
transform: [
|
||||||
{
|
{
|
||||||
translateY: interpolate(
|
translateY: interpolate(
|
||||||
headerMode.value,
|
headerModeValue,
|
||||||
[0, 1],
|
[0, 1],
|
||||||
[0, -headerHeight.value],
|
[0, -headerHeight.get()],
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -33,15 +34,16 @@ export function useMinimalShellFooterTransform() {
|
|||||||
const {footerHeight} = useShellLayout()
|
const {footerHeight} = useShellLayout()
|
||||||
|
|
||||||
const footerTransform = useAnimatedStyle(() => {
|
const footerTransform = useAnimatedStyle(() => {
|
||||||
|
const footerModeValue = footerMode.get()
|
||||||
return {
|
return {
|
||||||
pointerEvents: footerMode.value === 0 ? 'auto' : 'none',
|
pointerEvents: footerModeValue === 0 ? 'auto' : 'none',
|
||||||
opacity: Math.pow(1 - footerMode.value, 2),
|
opacity: Math.pow(1 - footerModeValue, 2),
|
||||||
transform: [
|
transform: [
|
||||||
{
|
{
|
||||||
translateY: interpolate(
|
translateY: interpolate(
|
||||||
footerMode.value,
|
footerModeValue,
|
||||||
[0, 1],
|
[0, 1],
|
||||||
[0, footerHeight.value],
|
[0, footerHeight.get()],
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -58,7 +60,7 @@ export function useMinimalShellFabTransform() {
|
|||||||
return {
|
return {
|
||||||
transform: [
|
transform: [
|
||||||
{
|
{
|
||||||
translateY: interpolate(footerMode.value, [0, 1], [-44, 0]),
|
translateY: interpolate(footerMode.get(), [0, 1], [-44, 0]),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import * as WebBrowser from 'expo-web-browser'
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
createBskyAppAbsoluteUrl,
|
createBskyAppAbsoluteUrl,
|
||||||
|
isBskyAppUrl,
|
||||||
isBskyRSSUrl,
|
isBskyRSSUrl,
|
||||||
isRelativeUrl,
|
isRelativeUrl,
|
||||||
} from '#/lib/strings/url-helpers'
|
} from '#/lib/strings/url-helpers'
|
||||||
import {isNative} from '#/platform/detection'
|
import {isNative} from '#/platform/detection'
|
||||||
import {useModalControls} from '#/state/modals'
|
import {useModalControls} from '#/state/modals'
|
||||||
import {useInAppBrowser} from '#/state/preferences/in-app-browser'
|
import {useInAppBrowser} from '#/state/preferences/in-app-browser'
|
||||||
|
import {useOptOutOfUtm} from '#/state/preferences/opt-out-of-utm'
|
||||||
import {useTheme} from '#/alf'
|
import {useTheme} from '#/alf'
|
||||||
import {useSheetWrapper} from '#/components/Dialog/sheet-wrapper'
|
import {useSheetWrapper} from '#/components/Dialog/sheet-wrapper'
|
||||||
|
|
||||||
@@ -18,6 +20,7 @@ export function useOpenLink() {
|
|||||||
const enabled = useInAppBrowser()
|
const enabled = useInAppBrowser()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const sheetWrapper = useSheetWrapper()
|
const sheetWrapper = useSheetWrapper()
|
||||||
|
const optOutOfUtm = useOptOutOfUtm()
|
||||||
|
|
||||||
const openLink = useCallback(
|
const openLink = useCallback(
|
||||||
async (url: string, override?: boolean) => {
|
async (url: string, override?: boolean) => {
|
||||||
@@ -26,6 +29,9 @@ export function useOpenLink() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isNative && !url.startsWith('mailto:')) {
|
if (isNative && !url.startsWith('mailto:')) {
|
||||||
|
if (!optOutOfUtm && !isBskyAppUrl(url) && url.startsWith('http')) {
|
||||||
|
url = addUtmSource(url)
|
||||||
|
}
|
||||||
if (override === undefined && enabled === undefined) {
|
if (override === undefined && enabled === undefined) {
|
||||||
openModal({
|
openModal({
|
||||||
name: 'in-app-browser-consent',
|
name: 'in-app-browser-consent',
|
||||||
@@ -47,8 +53,24 @@ export function useOpenLink() {
|
|||||||
}
|
}
|
||||||
Linking.openURL(url)
|
Linking.openURL(url)
|
||||||
},
|
},
|
||||||
[enabled, openModal, t, sheetWrapper],
|
[enabled, openModal, t, sheetWrapper, optOutOfUtm],
|
||||||
)
|
)
|
||||||
|
|
||||||
return openLink
|
return openLink
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addUtmSource(url: string): string {
|
||||||
|
let parsedUrl
|
||||||
|
try {
|
||||||
|
parsedUrl = new URL(url)
|
||||||
|
} catch (e) {
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
if (!parsedUrl.searchParams.has('utm_source')) {
|
||||||
|
parsedUrl.searchParams.set('utm_source', 'bluesky')
|
||||||
|
if (!parsedUrl.searchParams.has('utm_medium')) {
|
||||||
|
parsedUrl.searchParams.set('utm_medium', 'social')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return parsedUrl.toString()
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react'
|
|
||||||
import {StyleProp, TextStyle, ViewStyle} from 'react-native'
|
import {StyleProp, TextStyle, ViewStyle} from 'react-native'
|
||||||
import Svg, {Ellipse, Line, Path, Rect} from 'react-native-svg'
|
import Svg, {Ellipse, Line, Path, Rect} from 'react-native-svg'
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user