From c2ca84c636fe022c92f0e0d6fdf54033ceeb80a7 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 19 Dec 2024 01:16:32 +0000 Subject: [PATCH 01/23] Temporarily remove Bitdrift (#7173) * Temporarily remove Bitdrift * Rm plugin --- app.config.js | 3 ++- package.json | 1 - src/lib/bitdrift.ts | 42 +++++++++++++++++------------- src/lib/statsig/statsig.tsx | 6 +++-- yarn.lock | 51 ++++++++++++++++++++++++++++++------- 5 files changed, 72 insertions(+), 31 deletions(-) diff --git a/app.config.js b/app.config.js index 2bbbfbd5a8..630ea5ad8c 100644 --- a/app.config.js +++ b/app.config.js @@ -225,7 +225,8 @@ module.exports = function (config) { }, ], 'react-native-compressor', - '@bitdrift/react-native', + // TODO: Reenable when the build issue is fixed. + // '@bitdrift/react-native', './plugins/starterPackAppClipExtension/withStarterPackAppClip.js', './plugins/withAndroidManifestPlugin.js', './plugins/withAndroidManifestFCMIconPlugin.js', diff --git a/package.json b/package.json index ff2223b489..b7fdf1177e 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,6 @@ }, "dependencies": { "@atproto/api": "^0.13.21", - "@bitdrift/react-native": "0.4.0", "@braintree/sanitize-url": "^6.0.2", "@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet", "@emoji-mart/react": "^1.1.1", diff --git a/src/lib/bitdrift.ts b/src/lib/bitdrift.ts index 3f892f6b8c..f11da6f3b2 100644 --- a/src/lib/bitdrift.ts +++ b/src/lib/bitdrift.ts @@ -1,21 +1,27 @@ -import {init} from '@bitdrift/react-native' -import {Statsig} from 'statsig-react-native-expo' -export {debug, error, info, warn} from '@bitdrift/react-native' +// import {init} from '@bitdrift/react-native' +// import {Statsig} from 'statsig-react-native-expo' +// export {debug, error, info, warn} from '@bitdrift/react-native' -import {initPromise} from './statsig/statsig' +// import {initPromise} from './statsig/statsig' -const BITDRIFT_API_KEY = process.env.BITDRIFT_API_KEY +// const BITDRIFT_API_KEY = process.env.BITDRIFT_API_KEY -initPromise.then(() => { - let isEnabled = false - try { - if (Statsig.checkGate('enable_bitdrift')) { - isEnabled = true - } - } catch (e) { - // Statsig may complain about it being called too early. - } - if (isEnabled && BITDRIFT_API_KEY) { - init(BITDRIFT_API_KEY, {url: 'https://api-bsky.bitdrift.io'}) - } -}) +// initPromise.then(() => { +// let isEnabled = false +// try { +// if (Statsig.checkGate('enable_bitdrift')) { +// isEnabled = true +// } +// } catch (e) { +// // Statsig may complain about it being called too early. +// } +// if (isEnabled && BITDRIFT_API_KEY) { +// init(BITDRIFT_API_KEY, {url: 'https://api-bsky.bitdrift.io'}) +// } +// }) + +// TODO: Reenable when the build issue is fixed. +export function debug(_message: string) {} +export function error(_message: string) {} +export function info(_message: string) {} +export function warn(_message: string) {} diff --git a/src/lib/statsig/statsig.tsx b/src/lib/statsig/statsig.tsx index e0882806d5..e59196f669 100644 --- a/src/lib/statsig/statsig.tsx +++ b/src/lib/statsig/statsig.tsx @@ -5,7 +5,8 @@ import {sha256} from 'js-sha256' import {Statsig, StatsigProvider} from 'statsig-react-native-expo' import {BUNDLE_DATE, BUNDLE_IDENTIFIER, IS_TESTFLIGHT} from '#/lib/app-info' -import * as bitdrift from '#/lib/bitdrift' +// TODO: Reenable when the build issue is fixed. +// import * as bitdrift from '#/lib/bitdrift' import {logger} from '#/logger' import {isWeb} from '#/platform/detection' import * as persisted from '#/state/persisted' @@ -107,7 +108,8 @@ export function logEvent( console.groupCollapsed(eventName) console.log(fullMetadata) console.groupEnd() - bitdrift.info(eventName, fullMetadata) + // TODO: Reenable when the build issue is fixed. + // bitdrift.info(eventName, fullMetadata) } catch (e) { // A log should never interrupt the calling code, whatever happens. logger.error('Failed to log an event', {message: e}) diff --git a/yarn.lock b/yarn.lock index 61ed0f66c7..a394657315 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3261,7 +3261,7 @@ "@babel/parser" "^7.25.9" "@babel/types" "^7.25.9" -"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3", "@babel/traverse@^7.25.3", "@babel/traverse@^7.25.9": +"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.9.tgz#a50f8fe49e7f69f53de5bea7e413cd35c5e13c84" integrity sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw== @@ -3322,6 +3322,19 @@ debug "^4.3.1" globals "^11.1.0" +"@babel/traverse@^7.25.3", "@babel/traverse@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.9.tgz#a50f8fe49e7f69f53de5bea7e413cd35c5e13c84" + integrity sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw== + dependencies: + "@babel/code-frame" "^7.25.9" + "@babel/generator" "^7.25.9" + "@babel/parser" "^7.25.9" + "@babel/template" "^7.25.9" + "@babel/types" "^7.25.9" + debug "^4.3.1" + globals "^11.1.0" + "@babel/types@^7.0.0", "@babel/types@^7.20.0", "@babel/types@^7.20.7", "@babel/types@^7.22.10", "@babel/types@^7.22.5", "@babel/types@^7.3.3", "@babel/types@^7.4.4": version "7.22.10" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.10.tgz#4a9e76446048f2c66982d1a989dd12b8a2d2dc03" @@ -3380,11 +3393,6 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@bitdrift/react-native@0.4.0": - version "0.4.0" - resolved "https://registry.yarnpkg.com/@bitdrift/react-native/-/react-native-0.4.0.tgz#e6484343ef04824aa924df2a757bd9620b2106c1" - integrity sha512-KuYzWEkoGwjjP0ZurjHwV+zfRZjQXxbXa3zhijWv0iqzMI/7kbrBd9lm+wNQo8OrkqFVDlebCb8AGPc0jMZw7A== - "@braintree/sanitize-url@^6.0.2": version "6.0.4" resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-6.0.4.tgz#923ca57e173c6b232bbbb07347b1be982f03e783" @@ -17457,7 +17465,16 @@ string-natural-compare@^3.0.1: resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -17557,7 +17574,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -17571,6 +17588,13 @@ strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -18845,7 +18869,7 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -18863,6 +18887,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From c390c3278869df4df54b7831b515c91536cee4f0 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 19 Dec 2024 04:00:27 +0000 Subject: [PATCH 02/23] Remove unreliable repository (#7176) --- app.config.js | 1 + plugins/withAndroidNoJitpackPlugin.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 plugins/withAndroidNoJitpackPlugin.js diff --git a/app.config.js b/app.config.js index 630ea5ad8c..1461b7b885 100644 --- a/app.config.js +++ b/app.config.js @@ -232,6 +232,7 @@ module.exports = function (config) { './plugins/withAndroidManifestFCMIconPlugin.js', './plugins/withAndroidStylesAccentColorPlugin.js', './plugins/withAndroidSplashScreenStatusBarTranslucentPlugin.js', + './plugins/withAndroidNoJitpackPlugin.js', './plugins/shareExtension/withShareExtensions.js', './plugins/notificationsExtension/withNotificationsExtension.js', './plugins/withAppDelegateReferrer.js', diff --git a/plugins/withAndroidNoJitpackPlugin.js b/plugins/withAndroidNoJitpackPlugin.js new file mode 100644 index 0000000000..959eb10282 --- /dev/null +++ b/plugins/withAndroidNoJitpackPlugin.js @@ -0,0 +1,20 @@ +const {withProjectBuildGradle} = require('@expo/config-plugins') + +const jitpackRepository = "maven { url 'https://www.jitpack.io' }" + +module.exports = function withAndroidNoJitpackPlugin(config) { + return withProjectBuildGradle(config, config => { + if (!config.modResults.contents.includes(jitpackRepository)) { + throw Error( + 'Expected to find the jitpack string in the config. ' + + 'You MUST verify whether it was actually removed upstream, ' + + 'or if the format has changed and this plugin no longer recognizes it.', + ) + } + config.modResults.contents = config.modResults.contents.replaceAll( + jitpackRepository, + '', + ) + return config + }) +} From 29dad38ab77bd5537cf7f0198fff35d14d776bff Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 19 Dec 2024 04:01:21 +0000 Subject: [PATCH 03/23] Add lockfile lint (#7177) --- .../workflows/bundle-deploy-eas-update.yml | 3 ++ .github/workflows/lint.yml | 2 + package.json | 24 +++++++++ yarn.lock | 52 ++++++++++++++++++- 4 files changed, 79 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bundle-deploy-eas-update.yml b/.github/workflows/bundle-deploy-eas-update.yml index 3040741566..da73ae976b 100644 --- a/.github/workflows/bundle-deploy-eas-update.yml +++ b/.github/workflows/bundle-deploy-eas-update.yml @@ -69,6 +69,9 @@ jobs: - name: Lint check run: yarn lint + - name: Lint lockfile + run: yarn lockfile-lint + - name: Prettier check run: yarn prettier --check . diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7eab1f490c..2268ce359c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,6 +28,8 @@ jobs: attempt_delay: 2000 - name: Lint check run: yarn lint + - name: Lint lockfile + run: yarn lockfile-lint - name: Prettier check run: yarn prettier --check . - name: Check & compile i18n diff --git a/package.json b/package.json index b7fdf1177e..8d84b6284a 100644 --- a/package.json +++ b/package.json @@ -250,6 +250,7 @@ "jest-expo": "^52.0.2", "jest-junit": "^16.0.0", "lint-staged": "^13.2.3", + "lockfile-lint": "^4.14.0", "metro-react-native-babel-preset": "^0.76.9", "prettier": "^2.8.3", "react-native-dotenv": "^3.4.11", @@ -329,5 +330,28 @@ "assets/icons/*.svg": [ "svgo" ] + }, + "lockfile-lint": { + "path": "yarn.lock", + "allowedHosts": [ + "npm", + "yarn" + ], + "allowedSchemes": [ + "https:" + ], + "allowedPackageNameAliases": [ + "@babel/traverse--for-generate-function-map:@babel/traverse", + "string-width-cjs:string-width", + "strip-ansi-cjs:strip-ansi", + "wrap-ansi-cjs:wrap-ansi" + ], + "allowedUrls": [ + "https://codeload.github.com/bluesky-social/react-native-bottom-sheet/tar.gz/28a87d1bb55e10fc355fa1455545a30734995908", + "https://codeload.github.com/bluesky-social/react-native-progress/tar.gz/5a372f4f2ce5feb26f4f47b6a4d187ab9b923ab4" + ], + "emptyHostname": false, + "validatePackageNames": true, + "validateIntegrity": true } } diff --git a/yarn.lock b/yarn.lock index a394657315..d022a15e74 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7417,6 +7417,14 @@ resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== +"@yarnpkg/parsers@^3.0.0-rc.48.1": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@yarnpkg/parsers/-/parsers-3.0.2.tgz#48a1517a0f49124827f4c37c284a689c607b2f32" + integrity sha512-/HcYgtUSiJiot/XWGLOlGxPYUG65+/31V8oqk17vZLW1xlCoR4PampyePljOxY2n8/3jz9+tIFzICsyGujJZoA== + dependencies: + js-yaml "^3.10.0" + tslib "^2.4.0" + "@zxing/text-encoding@^0.9.0": version "0.9.0" resolved "https://registry.yarnpkg.com/@zxing/text-encoding/-/text-encoding-0.9.0.tgz#fb50ffabc6c7c66a0c96b4c03e3d9be74864b70b" @@ -9047,6 +9055,16 @@ cosmiconfig@^8.0.0: parse-json "^5.2.0" path-type "^4.0.0" +cosmiconfig@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-9.0.0.tgz#34c3fc58287b915f3ae905ab6dc3de258b55ad9d" + integrity sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg== + dependencies: + env-paths "^2.2.1" + import-fresh "^3.3.0" + js-yaml "^4.1.0" + parse-json "^5.2.0" + create-jest@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" @@ -9809,6 +9827,11 @@ env-editor@^0.4.1: resolved "https://registry.yarnpkg.com/env-editor/-/env-editor-0.4.2.tgz#4e76568d0bd8f5c2b6d314a9412c8fe9aa3ae861" integrity sha512-ObFo8v4rQJAE59M69QzwloxPZtd33TpYEIjtKD1rrFDcM1Gd7IkDxEBU+HriziN6HSHQnBJi8Dmy+JWkav5HKA== +env-paths@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" + integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== + eol@^0.9.1: version "0.9.1" resolved "https://registry.yarnpkg.com/eol/-/eol-0.9.1.tgz#f701912f504074be35c6117a5c4ade49cd547acd" @@ -13029,7 +13052,7 @@ js-sha256@^0.9.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.13.1: +js-yaml@^3.10.0, js-yaml@^3.13.1: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== @@ -13430,6 +13453,26 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" +lockfile-lint-api@^5.9.1: + version "5.9.1" + resolved "https://registry.yarnpkg.com/lockfile-lint-api/-/lockfile-lint-api-5.9.1.tgz#12b10434792fa8b8dd0e332ddfbac55ea70a9e08" + integrity sha512-us5IT1bGA6KXbq1WrhrSzk9mtPgHKz5nhvv3S4hwcYnhcVOKW2uK0W8+PN9oIgv4pI49WsD5wBdTQFTpNChF/Q== + dependencies: + "@yarnpkg/parsers" "^3.0.0-rc.48.1" + debug "^4.3.4" + object-hash "^3.0.0" + +lockfile-lint@^4.14.0: + version "4.14.0" + resolved "https://registry.yarnpkg.com/lockfile-lint/-/lockfile-lint-4.14.0.tgz#5e240442a19aaa218691661f58879f113294a414" + integrity sha512-uyXZ8X4J6EsicG87p0y4SHorJBwABLcaXOpI/j3h8SO/OX4fKTJ6Cqqi+U3zjgU0fo+u/4KbB7fl8ZzTewd0Ow== + dependencies: + cosmiconfig "^9.0.0" + debug "^4.3.4" + fast-glob "^3.3.2" + lockfile-lint-api "^5.9.1" + yargs "^17.7.2" + lodash.chunk@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.chunk/-/lodash.chunk-4.2.0.tgz#66e5ce1f76ed27b4303d8c6512e8d1216e8106bc" @@ -14414,6 +14457,11 @@ object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1 resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== +object-hash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" + integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== + object-inspect@^1.12.3, object-inspect@^1.9.0: version "1.12.3" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9" @@ -19060,7 +19108,7 @@ yargs@^15.3.1: y18n "^4.0.0" yargs-parser "^18.1.2" -yargs@^17.3.1, yargs@^17.6.2: +yargs@^17.3.1, yargs@^17.6.2, yargs@^17.7.2: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== From 513a188a219271bb527f8a4cf3ad978116a407e3 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 19 Dec 2024 04:50:36 +0000 Subject: [PATCH 04/23] Add a GitHub Action verifying lockfile against base --- .github/workflows/verify-yarn-lock.yml | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/verify-yarn-lock.yml diff --git a/.github/workflows/verify-yarn-lock.yml b/.github/workflows/verify-yarn-lock.yml new file mode 100644 index 0000000000..f5f521e761 --- /dev/null +++ b/.github/workflows/verify-yarn-lock.yml @@ -0,0 +1,38 @@ +name: Verify yarn.lock + +on: + pull_request: +concurrency: + group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}' + cancel-in-progress: true + +jobs: + verify-yarn-lock: + name: Verify yarn.lock changes + runs-on: ubuntu-latest + steps: + - name: Check out Git repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Install node + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + - name: Verify yarn.lock + uses: Wandalen/wretry.action@master + with: + command: | + git show "${{ github.base_ref }}:yarn.lock" > yarn.lock + yarn + git diff --quiet --exit-code || { + echo '::error::`yarn.lock` does not match what Yarn would generate given the base `yarn.lock` and the head `package.json`.' + echo '::error::1. If this is intentional, you can ignore this check.' + echo '::error::2. If this is not intentional, apply the following diff:' + echo '```diff' + git --no-pager diff -R + echo '```' + exit 1 + } + attempt_limit: 3 + attempt_delay: 2000 From 24540400d93df77511caa10737a7c5b808072579 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 19 Dec 2024 05:19:57 +0000 Subject: [PATCH 05/23] Try to fix action --- .github/workflows/verify-yarn-lock.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verify-yarn-lock.yml b/.github/workflows/verify-yarn-lock.yml index f5f521e761..bd946d7f38 100644 --- a/.github/workflows/verify-yarn-lock.yml +++ b/.github/workflows/verify-yarn-lock.yml @@ -11,19 +11,24 @@ jobs: name: Verify yarn.lock changes runs-on: ubuntu-latest steps: - - name: Check out Git repository + - name: Check out PR HEAD uses: actions/checkout@v3 with: fetch-depth: 0 + + - name: Fetch base branch + run: git fetch origin ${{ github.base_ref }} --depth=1 + - name: Install node uses: actions/setup-node@v4 with: node-version-file: .nvmrc + - name: Verify yarn.lock uses: Wandalen/wretry.action@master with: command: | - git show "${{ github.base_ref }}:yarn.lock" > yarn.lock + git show "origin/${{ github.base_ref }}:yarn.lock" > yarn.lock yarn git diff --quiet --exit-code || { echo '::error::`yarn.lock` does not match what Yarn would generate given the base `yarn.lock` and the head `package.json`.' From 59739a6088e8ff03ac8210c343b42d16a4a13d67 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 19 Dec 2024 05:36:19 +0000 Subject: [PATCH 06/23] Tweak GH action --- .github/workflows/verify-yarn-lock.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/verify-yarn-lock.yml b/.github/workflows/verify-yarn-lock.yml index bd946d7f38..aa4568f5cf 100644 --- a/.github/workflows/verify-yarn-lock.yml +++ b/.github/workflows/verify-yarn-lock.yml @@ -1,4 +1,4 @@ -name: Verify yarn.lock +name: Lockfile on: pull_request: @@ -8,7 +8,7 @@ concurrency: jobs: verify-yarn-lock: - name: Verify yarn.lock changes + name: No manual yarn.lock edits runs-on: ubuntu-latest steps: - name: Check out PR HEAD @@ -32,11 +32,9 @@ jobs: yarn git diff --quiet --exit-code || { echo '::error::`yarn.lock` does not match what Yarn would generate given the base `yarn.lock` and the head `package.json`.' - echo '::error::1. If this is intentional, you can ignore this check.' - echo '::error::2. If this is not intentional, apply the following diff:' - echo '```diff' - git --no-pager diff -R - echo '```' + echo '::error:: - If this is intentional, you can ignore this check.' + echo '::error:: - If this is unintentional, apply the following diff:' + git --no-pager diff exit 1 } attempt_limit: 3 From a3031de19ba41717c8e83b818e294d44577fb434 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 19 Dec 2024 05:50:37 +0000 Subject: [PATCH 07/23] Tweak GH action --- .github/workflows/verify-yarn-lock.yml | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/verify-yarn-lock.yml b/.github/workflows/verify-yarn-lock.yml index aa4568f5cf..5525bf6644 100644 --- a/.github/workflows/verify-yarn-lock.yml +++ b/.github/workflows/verify-yarn-lock.yml @@ -24,18 +24,23 @@ jobs: with: node-version-file: .nvmrc - - name: Verify yarn.lock + - name: Reset yarn.lock to base + run: git show "origin/${{ github.base_ref }}:yarn.lock" > yarn.lock + + - name: Yarn install uses: Wandalen/wretry.action@master with: - command: | - git show "origin/${{ github.base_ref }}:yarn.lock" > yarn.lock - yarn - git diff --quiet --exit-code || { - echo '::error::`yarn.lock` does not match what Yarn would generate given the base `yarn.lock` and the head `package.json`.' - echo '::error:: - If this is intentional, you can ignore this check.' - echo '::error:: - If this is unintentional, apply the following diff:' - git --no-pager diff - exit 1 - } + # Fine to skip scripts since we don't run any code + command: yarn install --ignore-scripts attempt_limit: 3 attempt_delay: 2000 + + - name: Verify yarn.lock + run: | + git diff --quiet --exit-code || { + echo '::error::`yarn.lock` does not match what Yarn would generate given the base `yarn.lock` and the head `package.json`.' + echo '::error:: - If this is intentional, you can ignore this check.' + echo '::error:: - If this is unintentional, apply the following diff:' + git --no-pager diff + exit 1 + } From 25d20c6395a093a6cfc6aed4d08469f7f128f358 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 19 Dec 2024 21:12:58 +0000 Subject: [PATCH 08/23] Add iOS hack to fix cropper failing to show (#7191) * Add iOS hack to fix cropper failing to show * Make it 800 --- src/screens/Onboarding/StepProfile/index.tsx | 6 +++++- src/view/com/util/UserAvatar.tsx | 6 +++++- src/view/com/util/UserBanner.tsx | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/screens/Onboarding/StepProfile/index.tsx b/src/screens/Onboarding/StepProfile/index.tsx index 73472ec332..f8f6ecf4ed 100644 --- a/src/screens/Onboarding/StepProfile/index.tsx +++ b/src/screens/Onboarding/StepProfile/index.tsx @@ -15,7 +15,7 @@ import {openCropper} from '#/lib/media/picker' import {getDataUriSize} from '#/lib/media/util' import {useRequestNotificationsPermission} from '#/lib/notifications/notifications' import {logEvent, useGate} from '#/lib/statsig/statsig' -import {isNative, isWeb} from '#/platform/detection' +import {isIOS, isNative, isWeb} from '#/platform/detection' import { DescriptionText, OnboardingControls, @@ -181,6 +181,10 @@ export function StepProfile() { if (!image) return if (!isWeb) { + if (isIOS) { + // https://github.com/ivpusic/react-native-image-crop-picker/issues/1631 + await new Promise(resolve => setTimeout(resolve, 800)) + } image = await openCropper({ mediaType: 'photo', cropperCircleOverlay: true, diff --git a/src/view/com/util/UserAvatar.tsx b/src/view/com/util/UserAvatar.tsx index dbd68f8ef5..db35776afc 100644 --- a/src/view/com/util/UserAvatar.tsx +++ b/src/view/com/util/UserAvatar.tsx @@ -16,7 +16,7 @@ import { import {makeProfileLink} from '#/lib/routes/links' import {colors} from '#/lib/styles' import {logger} from '#/logger' -import {isAndroid, isNative, isWeb} from '#/platform/detection' +import {isAndroid, isIOS, isNative, isWeb} from '#/platform/detection' import {precacheProfile} from '#/state/queries/profile' import {HighPriorityImage} from '#/view/com/util/images/Image' import {tokens, useTheme} from '#/alf' @@ -319,6 +319,10 @@ let EditableUserAvatar = ({ } try { + if (isIOS) { + // https://github.com/ivpusic/react-native-image-crop-picker/issues/1631 + await new Promise(resolve => setTimeout(resolve, 800)) + } const croppedImage = await openCropper({ mediaType: 'photo', cropperCircleOverlay: true, diff --git a/src/view/com/util/UserBanner.tsx b/src/view/com/util/UserBanner.tsx index 7e71a04e9f..12f52c29ef 100644 --- a/src/view/com/util/UserBanner.tsx +++ b/src/view/com/util/UserBanner.tsx @@ -14,7 +14,7 @@ import { import {colors} from '#/lib/styles' import {useTheme} from '#/lib/ThemeContext' import {logger} from '#/logger' -import {isAndroid, isNative} from '#/platform/detection' +import {isAndroid, isIOS, isNative} from '#/platform/detection' import {EventStopper} from '#/view/com/util/EventStopper' import {tokens, useTheme as useAlfTheme} from '#/alf' import {useSheetWrapper} from '#/components/Dialog/sheet-wrapper' @@ -68,6 +68,10 @@ export function UserBanner({ } try { + if (isIOS) { + // https://github.com/ivpusic/react-native-image-crop-picker/issues/1631 + await new Promise(resolve => setTimeout(resolve, 800)) + } onSelectNewBanner?.( await openCropper({ mediaType: 'photo', From fb920f89d1afd091ab336d8fc8975607787c9a27 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 19 Dec 2024 21:45:44 +0000 Subject: [PATCH 09/23] Revert "Fix post time localization on Android (#6742)" (#7196) This reverts commit b1b6affb715326402674f6d6457dbe45288cbb2a. --- package.json | 1 - src/locale/i18n.ts | 29 ----------------------------- yarn.lock | 9 --------- 3 files changed, 39 deletions(-) diff --git a/package.json b/package.json index 8d84b6284a..85b5968e4f 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,6 @@ "@expo/webpack-config": "^19.0.0", "@floating-ui/dom": "^1.6.3", "@floating-ui/react-dom": "^2.0.8", - "@formatjs/intl-datetimeformat": "^6.17.1", "@formatjs/intl-locale": "^4.2.8", "@formatjs/intl-numberformat": "^8.15.1", "@formatjs/intl-pluralrules": "^5.4.1", diff --git a/src/locale/i18n.ts b/src/locale/i18n.ts index a78288b901..2c600276d5 100644 --- a/src/locale/i18n.ts +++ b/src/locale/i18n.ts @@ -1,10 +1,8 @@ // Don't remove -force from these because detection is VERY slow on low-end Android. // https://github.com/formatjs/formatjs/issues/4463#issuecomment-2176070577 import '@formatjs/intl-locale/polyfill-force' -import '@formatjs/intl-datetimeformat/polyfill-force' import '@formatjs/intl-pluralrules/polyfill-force' import '@formatjs/intl-numberformat/polyfill-force' -import '@formatjs/intl-datetimeformat/locale-data/en' import '@formatjs/intl-pluralrules/locale-data/en' import '@formatjs/intl-numberformat/locale-data/en' @@ -54,7 +52,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.an: { i18n.loadAndActivate({locale, messages: messagesAn}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/es'), import('@formatjs/intl-pluralrules/locale-data/an'), import('@formatjs/intl-numberformat/locale-data/es'), ]) @@ -63,7 +60,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.ast: { i18n.loadAndActivate({locale, messages: messagesAst}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/ast'), import('@formatjs/intl-pluralrules/locale-data/ast'), import('@formatjs/intl-numberformat/locale-data/ast'), ]) @@ -72,7 +68,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.ca: { i18n.loadAndActivate({locale, messages: messagesCa}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/ca'), import('@formatjs/intl-pluralrules/locale-data/ca'), import('@formatjs/intl-numberformat/locale-data/ca'), ]) @@ -81,7 +76,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.de: { i18n.loadAndActivate({locale, messages: messagesDe}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/de'), import('@formatjs/intl-pluralrules/locale-data/de'), import('@formatjs/intl-numberformat/locale-data/de'), ]) @@ -90,7 +84,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.en_GB: { i18n.loadAndActivate({locale, messages: messagesEn_GB}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/en-GB'), import('@formatjs/intl-pluralrules/locale-data/en'), import('@formatjs/intl-numberformat/locale-data/en-GB'), ]) @@ -99,7 +92,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.es: { i18n.loadAndActivate({locale, messages: messagesEs}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/es'), import('@formatjs/intl-pluralrules/locale-data/es'), import('@formatjs/intl-numberformat/locale-data/es'), ]) @@ -108,7 +100,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.fi: { i18n.loadAndActivate({locale, messages: messagesFi}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/fi'), import('@formatjs/intl-pluralrules/locale-data/fi'), import('@formatjs/intl-numberformat/locale-data/fi'), ]) @@ -117,7 +108,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.fr: { i18n.loadAndActivate({locale, messages: messagesFr}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/fr'), import('@formatjs/intl-pluralrules/locale-data/fr'), import('@formatjs/intl-numberformat/locale-data/fr'), ]) @@ -126,7 +116,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.ga: { i18n.loadAndActivate({locale, messages: messagesGa}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/ga'), import('@formatjs/intl-pluralrules/locale-data/ga'), import('@formatjs/intl-numberformat/locale-data/ga'), ]) @@ -135,7 +124,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.gl: { i18n.loadAndActivate({locale, messages: messagesGl}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/gl'), import('@formatjs/intl-pluralrules/locale-data/gl'), import('@formatjs/intl-numberformat/locale-data/gl'), ]) @@ -144,7 +132,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.hi: { i18n.loadAndActivate({locale, messages: messagesHi}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/hi'), import('@formatjs/intl-pluralrules/locale-data/hi'), import('@formatjs/intl-numberformat/locale-data/hi'), ]) @@ -153,7 +140,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.hu: { i18n.loadAndActivate({locale, messages: messagesHu}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/hu'), import('@formatjs/intl-pluralrules/locale-data/hu'), import('@formatjs/intl-numberformat/locale-data/hu'), ]) @@ -162,7 +148,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.id: { i18n.loadAndActivate({locale, messages: messagesId}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/id'), import('@formatjs/intl-pluralrules/locale-data/id'), import('@formatjs/intl-numberformat/locale-data/id'), ]) @@ -171,7 +156,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.it: { i18n.loadAndActivate({locale, messages: messagesIt}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/it'), import('@formatjs/intl-pluralrules/locale-data/it'), import('@formatjs/intl-numberformat/locale-data/it'), ]) @@ -180,7 +164,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.ja: { i18n.loadAndActivate({locale, messages: messagesJa}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/ja'), import('@formatjs/intl-pluralrules/locale-data/ja'), import('@formatjs/intl-numberformat/locale-data/ja'), ]) @@ -199,7 +182,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.ko: { i18n.loadAndActivate({locale, messages: messagesKo}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/ko'), import('@formatjs/intl-pluralrules/locale-data/ko'), import('@formatjs/intl-numberformat/locale-data/ko'), ]) @@ -208,7 +190,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.nl: { i18n.loadAndActivate({locale, messages: messagesNl}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/nl'), import('@formatjs/intl-pluralrules/locale-data/nl'), import('@formatjs/intl-numberformat/locale-data/nl'), ]) @@ -221,7 +202,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.pl: { i18n.loadAndActivate({locale, messages: messagesPl}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/pl'), import('@formatjs/intl-pluralrules/locale-data/pl'), import('@formatjs/intl-numberformat/locale-data/pl'), ]) @@ -230,7 +210,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.pt_BR: { i18n.loadAndActivate({locale, messages: messagesPt_BR}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/pt'), import('@formatjs/intl-pluralrules/locale-data/pt'), import('@formatjs/intl-numberformat/locale-data/pt'), ]) @@ -248,7 +227,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.ru: { i18n.loadAndActivate({locale, messages: messagesRu}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/ru'), import('@formatjs/intl-pluralrules/locale-data/ru'), import('@formatjs/intl-numberformat/locale-data/ru'), ]) @@ -257,7 +235,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.th: { i18n.loadAndActivate({locale, messages: messagesTh}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/th'), import('@formatjs/intl-pluralrules/locale-data/th'), import('@formatjs/intl-numberformat/locale-data/th'), ]) @@ -266,7 +243,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.tr: { i18n.loadAndActivate({locale, messages: messagesTr}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/tr'), import('@formatjs/intl-pluralrules/locale-data/tr'), import('@formatjs/intl-numberformat/locale-data/tr'), ]) @@ -275,7 +251,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.uk: { i18n.loadAndActivate({locale, messages: messagesUk}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/uk'), import('@formatjs/intl-pluralrules/locale-data/uk'), import('@formatjs/intl-numberformat/locale-data/uk'), ]) @@ -284,7 +259,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.vi: { i18n.loadAndActivate({locale, messages: messagesVi}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/vi'), import('@formatjs/intl-pluralrules/locale-data/vi'), import('@formatjs/intl-numberformat/locale-data/vi'), ]) @@ -293,7 +267,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.zh_CN: { i18n.loadAndActivate({locale, messages: messagesZh_CN}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/zh-Hans'), import('@formatjs/intl-pluralrules/locale-data/zh'), import('@formatjs/intl-numberformat/locale-data/zh'), ]) @@ -302,7 +275,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.zh_HK: { i18n.loadAndActivate({locale, messages: messagesZh_HK}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/yue'), import('@formatjs/intl-pluralrules/locale-data/zh'), import('@formatjs/intl-numberformat/locale-data/zh'), ]) @@ -311,7 +283,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.zh_TW: { i18n.loadAndActivate({locale, messages: messagesZh_TW}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/zh-Hant'), import('@formatjs/intl-pluralrules/locale-data/zh'), import('@formatjs/intl-numberformat/locale-data/zh'), ]) diff --git a/yarn.lock b/yarn.lock index d022a15e74..bce716f6e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4202,15 +4202,6 @@ dependencies: tslib "2" -"@formatjs/intl-datetimeformat@^6.17.1": - version "6.17.1" - resolved "https://registry.yarnpkg.com/@formatjs/intl-datetimeformat/-/intl-datetimeformat-6.17.1.tgz#d5e800891f9d79c8f1af1999f51db51f1384eca1" - integrity sha512-a18NqRo6R73xpREuMZo8FqjO+LnYFDHoeoviTh5de4ebI46wqLSDgbAIKoceuWblTQt8bvCpJIwvKgLItea88Q== - dependencies: - "@formatjs/ecma402-abstract" "2.3.1" - "@formatjs/intl-localematcher" "0.5.9" - tslib "2" - "@formatjs/intl-enumerator@1.8.7": version "1.8.7" resolved "https://registry.yarnpkg.com/@formatjs/intl-enumerator/-/intl-enumerator-1.8.7.tgz#3f004753333f80cc468ae34046bd8416772a0412" From 10981eec50a8e744e4878d2efbb39fa7847ad4d1 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 19 Dec 2024 21:47:00 +0000 Subject: [PATCH 10/23] Proper fix for iOS cropper being stuck (#7194) * Revert "Add iOS hack to fix cropper failing to show (#7191)" This reverts commit 25d20c6395a093a6cfc6aed4d08469f7f128f358. * Proper fix --- .../react-native-image-crop-picker+0.41.6.patch | 14 ++++++++++++++ src/screens/Onboarding/StepProfile/index.tsx | 6 +----- src/view/com/util/UserAvatar.tsx | 6 +----- src/view/com/util/UserBanner.tsx | 6 +----- 4 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 patches/react-native-image-crop-picker+0.41.6.patch diff --git a/patches/react-native-image-crop-picker+0.41.6.patch b/patches/react-native-image-crop-picker+0.41.6.patch new file mode 100644 index 0000000000..7017ac80ea --- /dev/null +++ b/patches/react-native-image-crop-picker+0.41.6.patch @@ -0,0 +1,14 @@ +diff --git a/node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m b/node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m +index 9f20973..68d4766 100644 +--- a/node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m ++++ b/node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m +@@ -126,7 +126,8 @@ - (void) setConfiguration:(NSDictionary *)options + + - (UIViewController*) getRootVC { + UIViewController *root = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; +- while (root.presentedViewController != nil) { ++ while (root.presentedViewController != nil && ++ !root.presentedViewController.isBeingDismissed) { + root = root.presentedViewController; + } + diff --git a/src/screens/Onboarding/StepProfile/index.tsx b/src/screens/Onboarding/StepProfile/index.tsx index f8f6ecf4ed..73472ec332 100644 --- a/src/screens/Onboarding/StepProfile/index.tsx +++ b/src/screens/Onboarding/StepProfile/index.tsx @@ -15,7 +15,7 @@ import {openCropper} from '#/lib/media/picker' import {getDataUriSize} from '#/lib/media/util' import {useRequestNotificationsPermission} from '#/lib/notifications/notifications' import {logEvent, useGate} from '#/lib/statsig/statsig' -import {isIOS, isNative, isWeb} from '#/platform/detection' +import {isNative, isWeb} from '#/platform/detection' import { DescriptionText, OnboardingControls, @@ -181,10 +181,6 @@ export function StepProfile() { if (!image) return if (!isWeb) { - if (isIOS) { - // https://github.com/ivpusic/react-native-image-crop-picker/issues/1631 - await new Promise(resolve => setTimeout(resolve, 800)) - } image = await openCropper({ mediaType: 'photo', cropperCircleOverlay: true, diff --git a/src/view/com/util/UserAvatar.tsx b/src/view/com/util/UserAvatar.tsx index db35776afc..dbd68f8ef5 100644 --- a/src/view/com/util/UserAvatar.tsx +++ b/src/view/com/util/UserAvatar.tsx @@ -16,7 +16,7 @@ import { import {makeProfileLink} from '#/lib/routes/links' import {colors} from '#/lib/styles' import {logger} from '#/logger' -import {isAndroid, isIOS, isNative, isWeb} from '#/platform/detection' +import {isAndroid, isNative, isWeb} from '#/platform/detection' import {precacheProfile} from '#/state/queries/profile' import {HighPriorityImage} from '#/view/com/util/images/Image' import {tokens, useTheme} from '#/alf' @@ -319,10 +319,6 @@ let EditableUserAvatar = ({ } try { - if (isIOS) { - // https://github.com/ivpusic/react-native-image-crop-picker/issues/1631 - await new Promise(resolve => setTimeout(resolve, 800)) - } const croppedImage = await openCropper({ mediaType: 'photo', cropperCircleOverlay: true, diff --git a/src/view/com/util/UserBanner.tsx b/src/view/com/util/UserBanner.tsx index 12f52c29ef..7e71a04e9f 100644 --- a/src/view/com/util/UserBanner.tsx +++ b/src/view/com/util/UserBanner.tsx @@ -14,7 +14,7 @@ import { import {colors} from '#/lib/styles' import {useTheme} from '#/lib/ThemeContext' import {logger} from '#/logger' -import {isAndroid, isIOS, isNative} from '#/platform/detection' +import {isAndroid, isNative} from '#/platform/detection' import {EventStopper} from '#/view/com/util/EventStopper' import {tokens, useTheme as useAlfTheme} from '#/alf' import {useSheetWrapper} from '#/components/Dialog/sheet-wrapper' @@ -68,10 +68,6 @@ export function UserBanner({ } try { - if (isIOS) { - // https://github.com/ivpusic/react-native-image-crop-picker/issues/1631 - await new Promise(resolve => setTimeout(resolve, 800)) - } onSelectNewBanner?.( await openCropper({ mediaType: 'photo', From 975e61d4509dfc14142085f93cdc85684c67e2e3 Mon Sep 17 00:00:00 2001 From: Hailey Date: Thu, 19 Dec 2024 13:51:18 -0800 Subject: [PATCH 11/23] bump (#7197) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85b5968e4f..574ca2639d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bsky.app", - "version": "1.96.0", + "version": "1.96.1", "private": true, "engines": { "node": ">=20" From 7f63679a5ebb27f3f509e70e34ba9eb09cd3dc12 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 19 Dec 2024 21:57:45 +0000 Subject: [PATCH 12/23] Fix build --- src/locale/i18n.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/locale/i18n.ts b/src/locale/i18n.ts index 2c600276d5..167e36d354 100644 --- a/src/locale/i18n.ts +++ b/src/locale/i18n.ts @@ -172,8 +172,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.km: { i18n.loadAndActivate({locale, messages: messagesKm}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/km'), - import('@formatjs/intl-datetimeformat/locale-data/km'), import('@formatjs/intl-pluralrules/locale-data/km'), import('@formatjs/intl-numberformat/locale-data/km'), ]) @@ -218,7 +216,6 @@ export async function dynamicActivate(locale: AppLanguage) { case AppLanguage.ro: { i18n.loadAndActivate({locale, messages: messagesRo}) await Promise.all([ - import('@formatjs/intl-datetimeformat/locale-data/ro'), import('@formatjs/intl-pluralrules/locale-data/ro'), import('@formatjs/intl-numberformat/locale-data/ro'), ]) From ab0697a0ecc5a0c96fc8512051121d384311c16d Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 19 Dec 2024 23:14:33 +0000 Subject: [PATCH 13/23] Bump clamp max value (#7198) --- src/view/com/post-thread/PostThread.tsx | 2 +- src/view/shell/bottom-bar/BottomBar.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx index a0073b02f9..1bdee53075 100644 --- a/src/view/com/post-thread/PostThread.tsx +++ b/src/view/com/post-thread/PostThread.tsx @@ -714,7 +714,7 @@ function MobileComposePrompt({onPressReply}: {onPressReply: () => unknown}) { styles.prompt, fabMinimalShellTransform, { - bottom: clamp(safeAreaInsets.bottom, 13, 30), + bottom: clamp(safeAreaInsets.bottom, 13, 60), }, ]}> diff --git a/src/view/shell/bottom-bar/BottomBar.tsx b/src/view/shell/bottom-bar/BottomBar.tsx index 47a525c04d..f814468b51 100644 --- a/src/view/shell/bottom-bar/BottomBar.tsx +++ b/src/view/shell/bottom-bar/BottomBar.tsx @@ -134,7 +134,7 @@ export function BottomBar({navigation}: BottomTabBarProps) { styles.bottomBar, pal.view, pal.border, - {paddingBottom: clamp(safeAreaInsets.bottom, 15, 30)}, + {paddingBottom: clamp(safeAreaInsets.bottom, 15, 60)}, footerMinimalShellTransform, ]} onLayout={e => { From 6afa44ddcb78b9f3a2824a06ac0166220ce05c4e Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 20 Dec 2024 16:57:19 +0000 Subject: [PATCH 14/23] Moderate composer quote (#7213) * moderate composer quote * consistency with other uses --- src/view/com/util/post-embeds/QuoteEmbed.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/view/com/util/post-embeds/QuoteEmbed.tsx b/src/view/com/util/post-embeds/QuoteEmbed.tsx index 77f5f6c951..cb549f7cda 100644 --- a/src/view/com/util/post-embeds/QuoteEmbed.tsx +++ b/src/view/com/util/post-embeds/QuoteEmbed.tsx @@ -26,7 +26,7 @@ import {useQueryClient} from '@tanstack/react-query' import {HITSLOP_20} from '#/lib/constants' import {usePalette} from '#/lib/hooks/usePalette' import {InfoCircleIcon} from '#/lib/icons' -import {moderatePost_wrapped} from '#/lib/moderatePost_wrapped' +import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped' import {makeProfileLink} from '#/lib/routes/links' import {s} from '#/lib/styles' import {useModerationOpts} from '#/state/preferences/moderation-opts' @@ -134,9 +134,7 @@ function QuoteEmbedModerated({ [viewRecord], ) const moderation = React.useMemo(() => { - return moderationOpts - ? moderatePost_wrapped(postView, moderationOpts) - : undefined + return moderationOpts ? moderatePost(postView, moderationOpts) : undefined }, [postView, moderationOpts]) return ( @@ -295,10 +293,14 @@ export function QuoteX({onRemove}: {onRemove: () => void}) { export function LazyQuoteEmbed({uri}: {uri: string}) { const {data} = useResolveLinkQuery(uri) + const moderationOpts = useModerationOpts() if (!data || data.type !== 'record' || data.kind !== 'post') { return null } - return + const moderation = moderationOpts + ? moderatePost(data.view, moderationOpts) + : undefined + return } function viewRecordToPostView( From 8a3dfcb9d0860eb8f8112a84dcf32ae522f77069 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 20 Dec 2024 18:00:30 +0000 Subject: [PATCH 15/23] Don't add unused keydown listeners (#7218) --- src/view/com/util/forms/NativeDropdown.web.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/view/com/util/forms/NativeDropdown.web.tsx b/src/view/com/util/forms/NativeDropdown.web.tsx index c1a0b80966..b3ec319e3b 100644 --- a/src/view/com/util/forms/NativeDropdown.web.tsx +++ b/src/view/com/util/forms/NativeDropdown.web.tsx @@ -70,6 +70,10 @@ export function NativeDropdown({ const menuRef = React.useRef(null) React.useEffect(() => { + if (!open) { + return + } + function clickHandler(e: MouseEvent) { const t = e.target From 8116d12c15495fa192e92f5bfb75cb561bb16402 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Fri, 20 Dec 2024 13:59:33 -0600 Subject: [PATCH 16/23] Fix Emoji picker focus (#7217) * Only portal the emoji picker where needed * Add optional portal prop to emoji picker * Use FocusScope to our advantage * Pare back, add guards, fix focus trap * Don't return focus to emoji button * Set DM input position on emoji insert * Let the caller determine next focus node --------- Co-authored-by: Dan Abramov --- .../Messages/components/MessageInput.web.tsx | 28 ++++-- .../Messages/components/MessagesList.tsx | 2 +- src/state/shell/composer/index.tsx | 3 +- src/view/com/composer/Composer.tsx | 9 +- .../text-input/web/EmojiPicker.web.tsx | 87 +++++++++++-------- src/view/shell/Composer.web.tsx | 20 +++-- 6 files changed, 96 insertions(+), 53 deletions(-) diff --git a/src/screens/Messages/components/MessageInput.web.tsx b/src/screens/Messages/components/MessageInput.web.tsx index 72e0382a93..bac163685a 100644 --- a/src/screens/Messages/components/MessageInput.web.tsx +++ b/src/screens/Messages/components/MessageInput.web.tsx @@ -3,6 +3,7 @@ import {Pressable, StyleSheet, View} from 'react-native' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import Graphemer from 'graphemer' +import {flushSync} from 'react-dom' import TextareaAutosize from 'react-textarea-autosize' import {isSafari, isTouchDevice} from '#/lib/browser' @@ -106,11 +107,19 @@ export function MessageInput({ const onEmojiInserted = React.useCallback( (emoji: Emoji) => { - const position = textAreaRef.current?.selectionStart ?? 0 - setMessage( - message => - message.slice(0, position) + emoji.native + message.slice(position), - ) + if (!textAreaRef.current) { + return + } + const position = textAreaRef.current.selectionStart ?? 0 + textAreaRef.current.focus() + flushSync(() => { + setMessage( + message => + message.slice(0, position) + emoji.native + message.slice(position), + ) + }) + textAreaRef.current.selectionStart = position + emoji.native.length + textAreaRef.current.selectionEnd = position + emoji.native.length }, [setMessage], ) @@ -148,7 +157,14 @@ export function MessageInput({