Compare commits
179 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d43bf4aa5 | |||
| 46b8a5819b | |||
| 8dacc91908 | |||
| 5bf38e3721 | |||
| 7eec65ac78 | |||
| cdb8d4bfb8 | |||
| e832791367 | |||
| deb3f26d3e | |||
| a90bb66d67 | |||
| 9762a6eef4 | |||
| 7b490d8bcd | |||
| 6fc31eeb48 | |||
| bf371d7ecc | |||
| 9ba11baab7 | |||
| 8d6d4f9850 | |||
| 18143d051b | |||
| 38c8adcc27 | |||
| dcc06a90a0 | |||
| c7e9efbf99 | |||
| 1c38665d4c | |||
| 5d40532aa9 | |||
| abe0ca521d | |||
| 07344f70fc | |||
| bfdaab0a14 | |||
| 3153ea4302 | |||
| 6d53459e92 | |||
| 2ab1e2c9e9 | |||
| 0df1d6f53e | |||
| 18052f08e0 | |||
| 3931b90818 | |||
| 985129dd34 | |||
| 8c2e4c6fad | |||
| d58ff89441 | |||
| 014ffac903 | |||
| ae0c2e8697 | |||
| b8cabfaae6 | |||
| 444c5787c5 | |||
| 2798e98c9c | |||
| 9778a3da16 | |||
| 52b8201d2f | |||
| dddc022747 | |||
| 5df51bdea7 | |||
| bc3672ceeb | |||
| 35411e88c9 | |||
| 935347c73d | |||
| feebc6a98b | |||
| 587dc8dfe8 | |||
| 43108533eb | |||
| adca192f3a | |||
| 591504307d | |||
| bc9ad2c2d9 | |||
| 9e9ff70682 | |||
| 226a321a27 | |||
| e58feaeb0f | |||
| a77b6e3525 | |||
| a97b15b204 | |||
| 8f56fca82c | |||
| 524cbc514d | |||
| 3358e1947b | |||
| 6e3c9c3a9f | |||
| ac68cfe98c | |||
| 36c95d7dc6 | |||
| 9f3c21e298 | |||
| e10c05d735 | |||
| a9e170b6d0 | |||
| f51602b3fe | |||
| cc8f22887f | |||
| cc861093c2 | |||
| 8c5899fc93 | |||
| 6d8b4a2070 | |||
| 5fb3af71c6 | |||
| e804546809 | |||
| d3f5093817 | |||
| 75c9e2c181 | |||
| b9561f78ee | |||
| 19e2dc939a | |||
| ecc78efb12 | |||
| bcbc114189 | |||
| 8d3eba2381 | |||
| 59a2d19c26 | |||
| eee2df6d3a | |||
| c56427c6fb | |||
| 9c502b38e5 | |||
| 1f6d6d0545 | |||
| 27d1b96e73 | |||
| 5d0b900719 | |||
| 9b31bb8470 | |||
| 02daa0179b | |||
| ff294edd1e | |||
| a7b6cd4504 | |||
| 888eca73b3 | |||
| 2c717dc1e7 | |||
| ff68e4036d | |||
| 170e169ad1 | |||
| 19df58f1ef | |||
| c79dff9b3e | |||
| 13b453e506 | |||
| d8fdfddbaf | |||
| ff30d39355 | |||
| 9c65a8a78c | |||
| 8c9a11dc3f | |||
| d01362a01e | |||
| 3ff40e9603 | |||
| cfeac097e1 | |||
| c42940b0ad | |||
| a0d4af5c5f | |||
| 5ad3597fdb | |||
| 987a656904 | |||
| d0d00ba9f8 | |||
| e4b4e48acb | |||
| 925ae29b5f | |||
| f6b8854a9b | |||
| 3d0fbc5030 | |||
| 0a5ae17738 | |||
| 02b849996c | |||
| f231b67b76 | |||
| d2519a4f67 | |||
| a049a6538c | |||
| 3c21fee6c2 | |||
| e74b57ab78 | |||
| a169bd862f | |||
| 8bd6d9d135 | |||
| 5868804d3b | |||
| bdce8e8ecd | |||
| 99257f2816 | |||
| 011d8d2f7c | |||
| c0d3010f3e | |||
| 3685439ffb | |||
| 165dd5a779 | |||
| 84b026efb7 | |||
| be56066ee9 | |||
| cca3326b21 | |||
| e0ea778e58 | |||
| 9fe808f8a8 | |||
| b9f3d04d65 | |||
| 68a4d73d61 | |||
| eb566c5fcc | |||
| 512e550c2e | |||
| 500fc1c934 | |||
| b196ddef73 | |||
| 5a2135733f | |||
| 69164c640f | |||
| f30acadc73 | |||
| 9b20023c86 | |||
| e8ee30398a | |||
| 6897116625 | |||
| 2262040797 | |||
| 498d321bb1 | |||
| a697841a21 | |||
| 8ac63d780d | |||
| 0419066f45 | |||
| 1463323289 | |||
| f4e14626aa | |||
| ce000ada50 | |||
| 4d0774b75e | |||
| bc7b6f1e13 | |||
| d44060a34e | |||
| 2c828b5755 | |||
| c06312f09a | |||
| cc5580848c | |||
| fa84c451d0 | |||
| 894e2b89d4 | |||
| 3e37696d88 | |||
| 6a15ca88b6 | |||
| 5a6942025c | |||
| 3866142ccd | |||
| 7fd6f8f04b | |||
| 21d8b07bfe | |||
| f08bf5fef9 | |||
| 3e7e859c9c | |||
| 854ae60e7b | |||
| cc4a436e45 | |||
| 0532e120b8 | |||
| 288fad67f4 | |||
| 0e1e790c34 | |||
| 74d8ca8fa7 | |||
| 34d8c6fe58 | |||
| 5bcb909081 | |||
| e28f6d2f37 |
@@ -56,7 +56,7 @@ jobs:
|
||||
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: "26.0"
|
||||
xcode-version: "26.4"
|
||||
|
||||
- name: ☕️ Setup Cocoapods
|
||||
uses: maxim-lobanov/setup-cocoapods@v1
|
||||
@@ -109,23 +109,46 @@ jobs:
|
||||
run: |
|
||||
if [ -f "build.tar.gz" ]; then
|
||||
echo "Extracting build.tar.gz..."
|
||||
mkdir ios-build
|
||||
rm -rf ios-build
|
||||
mkdir -p ios-build
|
||||
tar -xzf build.tar.gz -C ios-build
|
||||
echo "Extraction completed successfully"
|
||||
|
||||
echo ""
|
||||
echo "Top-level extracted files:"
|
||||
find ios-build -maxdepth 3 -print
|
||||
|
||||
echo ""
|
||||
echo "Searching for IPA..."
|
||||
IPA_PATH="$(find ios-build -type f -name '*.ipa' -print -quit)"
|
||||
if [ -z "$IPA_PATH" ]; then
|
||||
echo "ERROR: No .ipa found anywhere under ios-build."
|
||||
echo "Archive contents:"
|
||||
tar -tzf build.tar.gz | sed -n '1,200p'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BUILD_DIR="$(dirname "$IPA_PATH")"
|
||||
echo "Found IPA at: $IPA_PATH"
|
||||
echo "Build dir: $BUILD_DIR"
|
||||
echo ""
|
||||
echo "Build dir contents:"
|
||||
ls -la "$BUILD_DIR"
|
||||
echo "BUILD_DIR=$BUILD_DIR" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Archive file not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 🚀 Deploy
|
||||
run: eas submit -p ios --non-interactive --path ios-build/ios/build/Bluesky.ipa
|
||||
run: eas submit -p ios --non-interactive --path "$BUILD_DIR/Bluesky.ipa"
|
||||
|
||||
- name: 🪲 Upload dSYM to Sentry
|
||||
run: >
|
||||
SENTRY_ORG=blueskyweb
|
||||
SENTRY_PROJECT=app
|
||||
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
yarn sentry-cli debug-files upload ios-build/ios/build/Bluesky.app.dSYM.zip --include-sources
|
||||
yarn sentry-cli debug-files upload "$BUILD_DIR/Bluesky.app.dSYM.zip" --include-sources
|
||||
|
||||
- name: 📚 Get version from package.json
|
||||
id: get-build-info
|
||||
|
||||
@@ -197,7 +197,7 @@ jobs:
|
||||
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: "26.0"
|
||||
xcode-version: "26.4"
|
||||
|
||||
- name: ☕️ Setup Cocoapods
|
||||
uses: maxim-lobanov/setup-cocoapods@v1
|
||||
@@ -239,10 +239,52 @@ jobs:
|
||||
yarn use-build-number-with-bump
|
||||
eas build -p ios
|
||||
--profile testflight
|
||||
--local --output build.ipa --non-interactive
|
||||
--local --output build.tar.gz --non-interactive
|
||||
|
||||
- name: 📂 Extract build artifact
|
||||
run: |
|
||||
if [ -f "build.tar.gz" ]; then
|
||||
echo "Extracting build.tar.gz..."
|
||||
rm -rf ios-build
|
||||
mkdir -p ios-build
|
||||
tar -xzf build.tar.gz -C ios-build
|
||||
echo "Extraction completed successfully"
|
||||
|
||||
echo ""
|
||||
echo "Top-level extracted files:"
|
||||
find ios-build -maxdepth 3 -print
|
||||
|
||||
echo ""
|
||||
echo "Searching for IPA..."
|
||||
IPA_PATH="$(find ios-build -type f -name '*.ipa' -print -quit)"
|
||||
if [ -z "$IPA_PATH" ]; then
|
||||
echo "ERROR: No .ipa found anywhere under ios-build."
|
||||
echo "Archive contents:"
|
||||
tar -tzf build.tar.gz | sed -n '1,200p'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BUILD_DIR="$(dirname "$IPA_PATH")"
|
||||
echo "Found IPA at: $IPA_PATH"
|
||||
echo "Build dir: $BUILD_DIR"
|
||||
echo ""
|
||||
echo "Build dir contents:"
|
||||
ls -la "$BUILD_DIR"
|
||||
echo "BUILD_DIR=$BUILD_DIR" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Archive file not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 🚀 Deploy
|
||||
run: eas submit -p ios --non-interactive --path build.ipa
|
||||
run: eas submit -p ios --non-interactive --path "$BUILD_DIR/Bluesky.ipa"
|
||||
|
||||
- name: 🪲 Upload dSYM to Sentry
|
||||
run: >
|
||||
SENTRY_ORG=blueskyweb
|
||||
SENTRY_PROJECT=app
|
||||
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
yarn sentry-cli debug-files upload "$BUILD_DIR/Bluesky.app.dSYM.zip" --include-sources
|
||||
|
||||
- name: ⬇️ Restore Cache
|
||||
id: get-base-commit
|
||||
|
||||
@@ -51,4 +51,4 @@ jobs:
|
||||
# NOTE(sfn): we can add a custom system prompt here
|
||||
|
||||
claude_args: |
|
||||
--model claude-opus-4-5-20251101
|
||||
--model claude-opus-4-7
|
||||
|
||||
@@ -431,16 +431,30 @@ yarn intl:compile # Compile translations for runtime
|
||||
// src/state/queries/profile.ts
|
||||
import {useQuery, useMutation, useQueryClient} from '@tanstack/react-query'
|
||||
|
||||
// Query key pattern
|
||||
const RQKEY_ROOT = 'profile'
|
||||
export const RQKEY = (did: string) => [RQKEY_ROOT, did]
|
||||
import {createQueryKey} from '#/state/queries/util'
|
||||
|
||||
// Query hook
|
||||
/*
|
||||
* Query key name should match the query hook name for consistency
|
||||
*/
|
||||
const profileQueryKeyRoot = 'profile'
|
||||
|
||||
/*
|
||||
* Use object params and createQueryKey helper for better readability and to
|
||||
* avoid bugs with parameter order or types.
|
||||
*/
|
||||
export const createProfileQueryKey = (args: {did: string}) =>
|
||||
createQueryKey(profileQueryKeyRoot, args)
|
||||
|
||||
/*
|
||||
* Query hook should be named use[Name]Query, where [Name] describes the data
|
||||
* being fetched. This is not a strict requirement, but it's a helpful
|
||||
* convention for discoverability
|
||||
*/
|
||||
export function useProfileQuery({did}: {did: string}) {
|
||||
const agent = useAgent()
|
||||
|
||||
return useQuery({
|
||||
queryKey: RQKEY(did),
|
||||
queryKey: createProfileQueryKey({did}),
|
||||
queryFn: async () => {
|
||||
const res = await agent.getProfile({actor: did})
|
||||
return res.data
|
||||
@@ -450,8 +464,12 @@ export function useProfileQuery({did}: {did: string}) {
|
||||
})
|
||||
}
|
||||
|
||||
// Mutation hook
|
||||
export function useUpdateProfile() {
|
||||
/*
|
||||
* Mutation hook should match the name of the query hook, but with "Mutation"
|
||||
* suffix. This is not a strict requirement, but it's a helpful convention for
|
||||
* discoverability and consistency.
|
||||
*/
|
||||
export function useProfileMutation() {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
@@ -459,7 +477,9 @@ export function useUpdateProfile() {
|
||||
// Update logic
|
||||
},
|
||||
onSuccess: (_, variables) => {
|
||||
queryClient.invalidateQueries({queryKey: RQKEY(variables.did)})
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: createProfileQueryKey({did: variables.did}),
|
||||
})
|
||||
},
|
||||
onError: (error) => {
|
||||
if (isNetworkError(error)) {
|
||||
@@ -473,6 +493,24 @@ export function useUpdateProfile() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
* If cache mutation is needed, include specific interfaces for the specific
|
||||
* mutations you require adjacent to the source queries. Naming should be
|
||||
* descriptive of the mutation's purpose, e.g. use[Name]CacheMutation. This is
|
||||
* not a strict requirement, but it's a helpful convention for discoverability
|
||||
* and consistency.
|
||||
*/
|
||||
export function useProfileCacheMutation() {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return (data: Partial<Profile>) => {
|
||||
queryClient.setQueryData(createProfileQueryKey({did: data.did}), oldData => {
|
||||
if (!oldData) return oldData
|
||||
return {...oldData, ...data}
|
||||
})
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Stale Time Constants** (from `src/state/queries/index.ts`):
|
||||
@@ -491,7 +529,7 @@ export function useDraftsQuery() {
|
||||
const agent = useAgent()
|
||||
|
||||
return useInfiniteQuery({
|
||||
queryKey: ['drafts'],
|
||||
queryKey: createQueryKey('drafts'),
|
||||
queryFn: async ({pageParam}) => {
|
||||
const res = await agent.app.bsky.draft.getDrafts({cursor: pageParam})
|
||||
return res.data
|
||||
@@ -504,6 +542,19 @@ export function useDraftsQuery() {
|
||||
|
||||
To get all items from pages: `data?.pages.flatMap(page => page.items) ?? []`
|
||||
|
||||
**Persisted Queries**
|
||||
|
||||
To persist query data across app restarts, `createQueryKey` supports a third
|
||||
parameter called `options`, which has a `persistedVersion` property. When this
|
||||
property is set to a number, the query will be persisted.
|
||||
|
||||
When this property is updated (e.g. incremented), the persisted data will be cleared and replaced with the new data from the query function. This is useful for cases where the shape of the data has changed and old persisted data would no longer be valid.
|
||||
|
||||
```tsx
|
||||
export const createProfileQueryKey = (args: {did: string}) =>
|
||||
createQueryKey(profileQueryKeyRoot, args, {persistedVersion: 1})
|
||||
```
|
||||
|
||||
### Preferences (React Context)
|
||||
|
||||
```tsx
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.25-bookworm AS build-env
|
||||
FROM golang:1.26-bookworm AS build-env
|
||||
|
||||
WORKDIR /usr/src/social-app
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.25-bookworm AS build-env
|
||||
FROM golang:1.26-bookworm AS build-env
|
||||
|
||||
WORKDIR /usr/src/social-app
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
parseStarterPackUri,
|
||||
} from '#/lib/strings/starter-pack'
|
||||
import {messages} from '#/locale/locales/en/messages'
|
||||
import {klipyUrlToBskyGifUrl} from '#/state/queries/klipy'
|
||||
import {tenorUrlToBskyGifUrl} from '#/state/queries/tenor'
|
||||
import {cleanError} from '../../src/lib/strings/errors'
|
||||
import {createFullHandle, makeValidHandle} from '../../src/lib/strings/handles'
|
||||
@@ -450,6 +451,13 @@ describe('parseEmbedPlayerFromUrl', () => {
|
||||
'https://sufjanstevens.bandcamp.com',
|
||||
'https://bandcamp.com/',
|
||||
'https://bandcamp.com',
|
||||
|
||||
'https://static.klipy.com/ii/abc123/73/ac/someFile.gif?hh=200&ww=300',
|
||||
'https://static.klipy.com/ii/abc123/73/ac/someFile.gif?hh=200&ww=300&mp4=videoSlugMp4&webm=videoSlugWebm',
|
||||
'https://static.klipy.com/ii/abc123/73/ac/someFile.gif?hh=200',
|
||||
'https://static.klipy.com/ii/abc123/73/ac/someFile.gif',
|
||||
'https://static.klipy.com/other/path.gif?hh=200&ww=300',
|
||||
'https://static.klipy.com',
|
||||
]
|
||||
|
||||
const outputs = [
|
||||
@@ -845,6 +853,35 @@ describe('parseEmbedPlayerFromUrl', () => {
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
|
||||
{
|
||||
type: 'klipy_gif',
|
||||
source: 'klipy',
|
||||
isGif: true,
|
||||
hideDetails: true,
|
||||
playerUri: 'https://k.gifs.bsky.app/ii/abc123/73/ac/someFile.gif',
|
||||
dimensions: {
|
||||
width: 300,
|
||||
height: 200,
|
||||
},
|
||||
},
|
||||
// With video slug params — on native (test env), keeps gif filename,
|
||||
// strips mp4/webm params. On web, would swap to video filename.
|
||||
{
|
||||
type: 'klipy_gif',
|
||||
source: 'klipy',
|
||||
isGif: true,
|
||||
hideDetails: true,
|
||||
playerUri: 'https://k.gifs.bsky.app/ii/abc123/73/ac/someFile.gif',
|
||||
dimensions: {
|
||||
width: 300,
|
||||
height: 200,
|
||||
},
|
||||
},
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
]
|
||||
|
||||
it('correctly grabs the correct id from uri', () => {
|
||||
@@ -1049,3 +1086,31 @@ describe('tenorUrlToBskyGifUrl', () => {
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
describe('klipyUrlToBskyGifUrl', () => {
|
||||
const inputs = [
|
||||
'https://static.klipy.com/ii/abc123/73/ac/someFile.gif',
|
||||
'https://static.klipy.com/ii/abc123/73/ac/someFile.gif?hh=200&ww=300',
|
||||
]
|
||||
|
||||
it.each(inputs)(
|
||||
'returns url with k.gifs.bsky.app as hostname for input url',
|
||||
input => {
|
||||
const out = klipyUrlToBskyGifUrl(input)
|
||||
expect(out.startsWith('https://k.gifs.bsky.app/')).toEqual(true)
|
||||
},
|
||||
)
|
||||
|
||||
it('preserves the path and query params when rewriting', () => {
|
||||
const out = klipyUrlToBskyGifUrl(
|
||||
'https://static.klipy.com/ii/abc123/73/ac/someFile.gif?hh=200&ww=300',
|
||||
)
|
||||
expect(out).toEqual(
|
||||
'https://k.gifs.bsky.app/ii/abc123/73/ac/someFile.gif?hh=200&ww=300',
|
||||
)
|
||||
})
|
||||
|
||||
it('returns empty string for invalid URLs', () => {
|
||||
expect(klipyUrlToBskyGifUrl('not-a-url')).toEqual('')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -54,7 +54,7 @@ module.exports = function (_config) {
|
||||
},
|
||||
icon: './assets/app-icons/ios_icon_default_next.png',
|
||||
userInterfaceStyle: 'automatic',
|
||||
primaryColor: '#1083fe',
|
||||
primaryColor: '#006AFF',
|
||||
newArchEnabled: false,
|
||||
ios: {
|
||||
supportsTablet: false,
|
||||
@@ -64,7 +64,9 @@ module.exports = function (_config) {
|
||||
},
|
||||
icon: IOS_ICON_FILE,
|
||||
infoPlist: {
|
||||
CADisableMinimumFrameDurationOnPhone: true,
|
||||
UIBackgroundModes: ['remote-notification'],
|
||||
NSUserActivityTypes: ['INSendMessageIntent'],
|
||||
NSCameraUsageDescription:
|
||||
'Used for profile pictures, posts, and other kinds of content.',
|
||||
NSMicrophoneUsageDescription:
|
||||
@@ -122,6 +124,7 @@ module.exports = function (_config) {
|
||||
'com.apple.developer.kernel.increased-memory-limit': true,
|
||||
'com.apple.developer.kernel.extended-virtual-addressing': true,
|
||||
'com.apple.security.application-groups': 'group.app.bsky',
|
||||
'com.apple.developer.usernotifications.communication': true,
|
||||
// 'com.apple.developer.device-information.user-assigned-device-name': true,
|
||||
},
|
||||
privacyManifests: {
|
||||
@@ -296,7 +299,6 @@ module.exports = function (_config) {
|
||||
'./plugins/withAndroidManifestFCMIconPlugin.js',
|
||||
'./plugins/withAndroidManifestIntentQueriesPlugin.js',
|
||||
'./plugins/withAndroidStylesAccentColorPlugin.js',
|
||||
'./plugins/withAndroidDayNightThemePlugin.js',
|
||||
'./plugins/withAndroidNoJitpackPlugin.js',
|
||||
'./plugins/shareExtension/withShareExtensions.js',
|
||||
'./plugins/notificationsExtension/withNotificationsExtension.js',
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" d="M17 3a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4h-2a1 1 0 1 1 0-2h2a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2a1 1 0 1 1 0-2h2Zm-6.707 4.793a1 1 0 0 1 1.414 0l3.5 3.5a1 1 0 0 1 0 1.414l-3.5 3.5a1 1 0 1 1-1.414-1.414L12.086 13H4a1 1 0 1 1 0-2h8.086l-1.793-1.793a1 1 0 0 1 0-1.414Z"/></svg>
|
||||
|
After Width: | Height: | Size: 360 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" d="M14.3 23v-1.1a1 1 0 0 1 2 0V23a1 1 0 1 1-2 0Zm5.243-3.457a1 1 0 0 1 1.414 0l1.1 1.1a1 1 0 1 1-1.414 1.414l-1.1-1.1a1 1 0 0 1 0-1.414ZM4.788 9.298a1 1 0 0 1 1.424 1.404l-.742.752-.004.005a5.003 5.003 0 1 0 7.075 7.075l.005-.004.752-.742a1 1 0 0 1 1.404 1.424l-.747.736a7.003 7.003 0 1 1-9.904-9.904l.737-.746ZM23 14.3a1 1 0 0 1 0 2h-1.1a1 1 0 1 1 0-2H23ZM10.044 4.05a7.005 7.005 0 0 1 9.905 9.906h0l-.737.746a1 1 0 0 1-1.424-1.404l.742-.752.004-.005a5.003 5.003 0 1 0-7.075-7.075l-.005.004-.752.742a1 1 0 0 1-1.404-1.424l.746-.737ZM2.1 7.7a1 1 0 1 1 0 2H1a1 1 0 0 1 0-2h1.1Zm-.157-5.757a1 1 0 0 1 1.414 0l1.1 1.1a1 1 0 1 1-1.414 1.414l-1.1-1.1a1 1 0 0 1 0-1.414ZM7.7 2.1V1a1 1 0 1 1 2 0v1.1a1 1 0 0 1-2 0Z"/></svg>
|
||||
|
After Width: | Height: | Size: 807 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" d="M3 16.8V7.2c0-.544-.001-1.011.03-1.395.033-.395.104-.789.297-1.167a3 3 0 0 1 1.31-1.31c.379-.193.772-.265 1.168-.297C6.188 2.999 6.657 3 7.2 3H11a1 1 0 1 1 0 2H7.2c-.576 0-.949 0-1.232.023-.272.022-.373.06-.422.085a1 1 0 0 0-.437.437c-.025.05-.062.15-.085.422C5.001 6.251 5 6.623 5 7.2v9.6c0 .577.001.95.024 1.232.023.272.06.373.085.422a1 1 0 0 0 .437.437c.05.025.15.063.422.085.283.023.656.024 1.232.024h9.6c.576 0 .949-.001 1.232-.024.272-.022.373-.06.422-.085a1 1 0 0 0 .437-.437c.025-.049.062-.15.085-.422.023-.283.024-.655.024-1.232V13a1 1 0 1 1 2 0v3.8c0 .543.001 1.011-.03 1.395-.033.395-.104.788-.297 1.167a3 3 0 0 1-1.31 1.311c-.379.193-.772.264-1.168.296-.383.031-.852.031-1.395.031H7.2c-.543 0-1.012 0-1.395-.031-.396-.032-.789-.103-1.167-.296a3 3 0 0 1-1.31-1.311c-.194-.379-.265-.772-.298-1.167C3 17.81 3 17.343 3 16.8M16.629 2.957a3 3 0 0 1 4.242 0l.172.171a3 3 0 0 1 0 4.243L13 15.414a2 2 0 0 1-1.414.586H9a1 1 0 0 1-1-1v-2.586A2 2 0 0 1 8.586 11zM10 14h1.586l8.043-8.043a1 1 0 0 0 0-1.414l-.172-.172a1 1 0 0 0-1.414 0L10 12.414z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10a10 10 0 0 1-4.136-.893l-4.68.876A1 1 0 0 1 2.02 20.8l.93-4.537A10 10 0 0 1 2 12C2 6.477 6.477 2 12 2Zm0 2a8 8 0 0 0-7.111 11.668 1 1 0 0 1 .09.66l-.7 3.415 3.537-.662c.214-.04.435-.009.63.088A8 8 0 1 0 12 4Zm0 4a1 1 0 0 1 1 1v2h2a1 1 0 1 1 0 2h-2v2a1 1 0 1 1-2 0v-2H9a1 1 0 1 1 0-2h2V9a1 1 0 0 1 1-1Z"/></svg>
|
||||
|
After Width: | Height: | Size: 448 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" d="M10.655 3.718c.55-1.116 2.14-1.116 2.69 0l7.548 15.317c.578 1.172-.515 2.471-1.768 2.103L13 19.336V15a1 1 0 0 0-2 0v4.336l-6.124 1.802c-1.254.369-2.346-.93-1.769-2.103l7.548-15.317Z"/></svg>
|
||||
|
After Width: | Height: | Size: 284 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" d="M20 4.25a.25.25 0 0 0-.25-.25h-9.5a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25zM4 19.75c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V16h-3.75A2.25 2.25 0 0 1 8 13.75V10H4.25a.25.25 0 0 0-.25.25zm18-6A2.25 2.25 0 0 1 19.75 16H16v3.75A2.25 2.25 0 0 1 13.75 22h-9.5A2.25 2.25 0 0 1 2 19.75v-9.5A2.25 2.25 0 0 1 4.25 8H8V4.25A2.25 2.25 0 0 1 10.25 2h9.5A2.25 2.25 0 0 1 22 4.25z"/></svg>
|
||||
|
After Width: | Height: | Size: 502 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" d="M12 2a5 5 0 0 1 4.843 3.751 1 1 0 0 1-1.938.498A3.002 3.002 0 0 0 9 7v2h8a3 3 0 0 1 3 3v7a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3v-7a3 3 0 0 1 3-3V7a5 5 0 0 1 5-5m-5 9a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1v-7a1 1 0 0 0-1-1zm5 2a1 1 0 0 1 1 1v3a1 1 0 1 1-2 0v-3a1 1 0 0 1 1-1"/></svg>
|
||||
|
After Width: | Height: | Size: 376 B |
@@ -1,10 +1,10 @@
|
||||
<svg width="105" height="32" viewBox="0 0 105 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19.7901 9.77492C21.7947 11.2889 23.9508 14.3587 24.7425 16.0059C25.5342 14.3587 27.6903 11.2889 29.6949 9.77492C31.1413 8.68251 33.485 7.83725 33.485 10.5269C33.485 11.064 33.1789 15.0393 32.9993 15.6848C32.3752 17.9285 30.1009 18.5008 28.0778 18.1544C31.6141 18.7598 32.5136 20.7653 30.5709 22.7708C26.1996 27.2831 24.7425 20.3569 24.7425 20.3569C24.7425 20.3569 23.2854 27.2831 18.9142 22.7708C16.9714 20.7653 17.871 18.7598 21.4072 18.1544C19.3841 18.5008 17.1099 17.9285 16.4857 15.6848C16.3061 15.0393 16 11.064 16 10.5269C16 7.83725 18.3437 8.68251 19.7901 9.77492Z" fill="white"/>
|
||||
<path d="M44.3863 16.3646C45.5901 16.7932 46.2292 17.7837 46.2292 18.8924C46.2292 20.7698 44.9659 21.908 42.5434 21.908H37.5942V11.3828H42.3799C44.6835 11.3828 45.7982 12.5506 45.7982 14.1028C45.7982 15.1376 45.3226 15.8915 44.3863 16.3646ZM42.2313 13.0237H39.6006V15.7732H42.2313C43.2568 15.7732 43.8067 15.2411 43.8067 14.3541C43.8067 13.5411 43.2419 13.0237 42.2313 13.0237ZM39.6006 20.2524H42.4393C43.5689 20.2524 44.1782 19.735 44.1782 18.8037C44.1782 17.828 43.5986 17.3402 42.4393 17.3402H39.6006V20.2524Z" fill="white"/>
|
||||
<path d="M49.0111 21.908H47.1385V11.3828H49.0111V21.908Z" fill="white"/>
|
||||
<path d="M55.2202 18.5524V14.2802H57.0929V21.908H55.2797V20.7993C54.7 21.6567 53.8975 22.0854 52.872 22.0854C51.252 22.0854 50.1968 21.1098 50.1968 19.3359V14.2802H52.0694V19.0254C52.0694 19.9863 52.545 20.4741 53.5111 20.4741C54.4177 20.4741 55.2202 19.8089 55.2202 18.5524Z" fill="white"/>
|
||||
<path d="M65.6167 18.2272V18.6706H59.8799C60.0137 19.9863 60.7419 20.6367 61.8714 20.6367C62.7334 20.6367 63.3131 20.2672 63.6252 19.5428H65.4235C65.0222 21.095 63.6846 22.0854 61.8566 22.0854C60.7122 22.0854 59.7907 21.7159 59.0922 20.9915C58.3937 20.2672 58.037 19.3063 58.037 18.0941C58.037 16.8967 58.3788 15.9359 59.0773 15.1967C59.7759 14.4724 60.6825 14.1028 61.8269 14.1028C62.9861 14.1028 63.9076 14.4872 64.5912 15.2411C65.2749 15.995 65.6167 17.0002 65.6167 18.2272ZM61.812 15.5515C60.7865 15.5515 60.0731 16.1428 59.8948 17.3698H63.7441C63.5806 16.2611 62.8969 15.5515 61.812 15.5515Z" fill="white"/>
|
||||
<path d="M69.7673 22.115C67.5379 22.115 66.3638 21.2428 66.2598 19.4837H68.0878C68.1918 20.4298 68.6674 20.7846 69.797 20.7846C70.8076 20.7846 71.3129 20.4741 71.3129 19.868C71.3129 19.3211 70.9562 19.055 69.8118 18.8628L68.935 18.715C67.2555 18.4341 66.4232 17.6654 66.4232 16.4089C66.4232 14.975 67.5676 14.1028 69.6038 14.1028C71.7885 14.1028 72.9181 14.9602 72.9924 16.6898H71.2238C71.1792 15.7585 70.6293 15.4332 69.6038 15.4332C68.712 15.4332 68.2662 15.7289 68.2662 16.3202C68.2662 16.8524 68.6526 17.0889 69.5443 17.2515L70.5104 17.3993C72.3681 17.7393 73.1707 18.4193 73.1707 19.7202C73.1707 21.2576 71.9223 22.115 69.7673 22.115Z" fill="white"/>
|
||||
<path d="M81.3899 21.908H79.2497L77.0204 18.3602L75.8611 19.5132V21.908H74.0182V11.3828H75.8611V17.4437L78.9822 14.2802H81.2116L78.3134 17.1628L81.3899 21.908Z" fill="white"/>
|
||||
<path d="M86.2805 16.2019L86.9047 14.2802H88.8665L85.909 22.5289C85.5968 23.3715 85.2104 23.9776 84.72 24.3176C84.2295 24.6576 83.531 24.8202 82.6095 24.8202C82.2974 24.8202 82.0299 24.8054 81.7921 24.7759V23.3124H82.5055C83.3526 23.3124 83.7688 22.795 83.7688 22.0854C83.7688 21.7306 83.6499 21.2132 83.4121 20.548L81.1827 14.2802H83.204L83.8282 16.1872C84.289 17.6211 84.6902 19.0402 85.0469 20.4446C85.3739 19.2324 85.7901 17.8132 86.2805 16.2019Z" fill="white"/>
|
||||
<svg width="120" height="28" viewBox="0 0 120 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6.23031 1.75921C9.52558 4.31406 13.0698 9.49434 14.3713 12.2741C15.6727 9.49434 19.2169 4.31406 22.5122 1.75921C24.8899 -0.0842317 28.7425 -1.5106 28.7425 3.02818C28.7425 3.93462 28.2393 10.6429 27.9441 11.7321C26.9181 15.5183 23.1796 16.4841 19.8539 15.8995C25.667 16.9212 27.1457 20.3055 23.9521 23.6897C16.7665 31.3043 14.3713 19.6163 14.3713 19.6163C14.3713 19.6163 11.976 31.3043 4.79042 23.6897C1.59681 20.3055 3.07554 16.9212 8.88858 15.8995C5.56292 16.4841 1.82441 15.5183 0.798403 11.7321C0.503259 10.6429 0 3.93462 0 3.02818C0 -1.5106 3.85263 -0.0842317 6.23031 1.75921Z" fill="#006AFF"/>
|
||||
<path d="M46.662 12.8778C48.641 13.6012 49.6915 15.2726 49.6915 17.1435C49.6915 20.3116 47.6149 22.2324 43.6326 22.2324H35.497V4.47113H43.3638C47.1507 4.47113 48.983 6.44184 48.983 9.06113C48.983 10.8073 48.2012 12.0796 46.662 12.8778ZM43.1195 7.2401H38.7952V11.88H43.1195C44.8053 11.88 45.7092 10.9819 45.7092 9.48521C45.7092 8.1132 44.7808 7.2401 43.1195 7.2401ZM38.7952 19.4385H43.4616C45.3183 19.4385 46.32 18.5654 46.32 16.9938C46.32 15.3474 45.3672 14.5242 43.4616 14.5242H38.7952V19.4385Z" fill="#006AFF"/>
|
||||
<path d="M54.2645 22.2324H51.1862V4.47113H54.2645V22.2324Z" fill="#006AFF"/>
|
||||
<path d="M64.4712 16.5698V9.36048H67.5495V22.2324H64.5689V20.3615C63.6161 21.8084 62.2968 22.5318 60.6111 22.5318C57.9481 22.5318 56.2135 20.8854 56.2135 17.8919V9.36048H59.2918V17.368C59.2918 18.9895 60.0736 19.8127 61.6616 19.8127C63.1519 19.8127 64.4712 18.6902 64.4712 16.5698Z" fill="#006AFF"/>
|
||||
<path d="M81.5614 16.021V16.7693H72.131C72.3508 18.9895 73.548 20.0871 75.4047 20.0871C76.8217 20.0871 77.7746 19.4635 78.2876 18.2411H81.2438C80.5841 20.8604 78.3853 22.5318 75.3803 22.5318C73.4991 22.5318 71.9844 21.9081 70.8361 20.6858C69.6878 19.4635 69.1015 17.842 69.1015 15.7965C69.1015 13.7759 69.6634 12.1544 70.8117 10.9071C71.9599 9.68477 73.4502 9.06113 75.3314 9.06113C77.2371 9.06113 78.7518 9.70972 79.8756 10.9819C80.9995 12.2542 81.5614 13.9505 81.5614 16.021ZM75.307 11.5058C73.6213 11.5058 72.4486 12.5036 72.1554 14.5741H78.4831C78.2143 12.7032 77.0905 11.5058 75.307 11.5058Z" fill="#006AFF"/>
|
||||
<path d="M88.3842 22.5817C84.7195 22.5817 82.7894 21.1099 82.6184 18.1413H85.6234C85.7944 19.7379 86.5762 20.3366 88.433 20.3366C90.0943 20.3366 90.925 19.8127 90.925 18.7899C90.925 17.8669 90.3386 17.4179 88.4574 17.0936L87.016 16.8442C84.2553 16.3702 82.8871 15.073 82.8871 12.9527C82.8871 10.5329 84.7683 9.06113 88.1154 9.06113C91.7068 9.06113 93.5636 10.508 93.6857 13.4266H90.7784C90.7051 11.855 89.8012 11.3062 88.1154 11.3062C86.6495 11.3062 85.9166 11.8052 85.9166 12.803C85.9166 13.701 86.5518 14.1002 88.0177 14.3746L89.6057 14.624C92.6596 15.1978 93.9789 16.3453 93.9789 18.5405C93.9789 21.1348 91.9267 22.5817 88.3842 22.5817Z" fill="#006AFF"/>
|
||||
<path d="M107.49 22.2324H103.972L100.307 16.2455L98.4015 18.1912V22.2324H95.372V4.47113H98.4015V14.6988L103.532 9.36048H107.197L102.433 14.2249L107.49 22.2324Z" fill="#006AFF"/>
|
||||
<path d="M115.529 12.6034L116.555 9.36048H119.78L114.918 23.2802C114.405 24.7021 113.77 25.7248 112.964 26.2986C112.158 26.8723 111.009 27.1467 109.495 27.1467C108.982 27.1467 108.542 27.1218 108.151 27.0719V24.6023H109.324C110.716 24.6023 111.4 23.7292 111.4 22.5318C111.4 21.9331 111.205 21.06 110.814 19.9374L107.149 9.36048H110.472L111.498 12.5785C112.255 14.9982 112.915 17.393 113.501 19.7628C114.039 17.7173 114.723 15.3225 115.529 12.6034Z" fill="#006AFF"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#fff" d="M6.514 2.143A1 1 0 0 0 5 3v18a1 1 0 0 0 1.514.858l15-9a1 1 0 0 0 0-1.716l-15-9Z"/></svg>
|
||||
|
After Width: | Height: | Size: 182 B |
@@ -9,7 +9,11 @@ export function applyTheme(theme: 'light' | 'dark') {
|
||||
document.documentElement.classList.add(theme)
|
||||
}
|
||||
|
||||
export function initSystemColorMode() {
|
||||
export function initSystemColorMode({additionalBodyClasses = ''} = {}) {
|
||||
if (additionalBodyClasses) {
|
||||
document.body.classList.add(additionalBodyClasses)
|
||||
}
|
||||
|
||||
applyTheme(
|
||||
window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
? 'dark'
|
||||
|
||||
@@ -20,7 +20,7 @@ export function Container({
|
||||
if (!entry) return
|
||||
|
||||
let {height} = entry.contentRect
|
||||
height += 2 // border top and bottom
|
||||
height += 4 // border-2 = 2px top + 2px bottom
|
||||
if (height !== prevHeight.current) {
|
||||
prevHeight.current = height
|
||||
window.parent.postMessage(
|
||||
@@ -37,7 +37,7 @@ export function Container({
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
className="w-full bg-brand text-black dark:bg-brand relative transition-colors max-w-[600px] min-w-[300px] flex items-center dark:text-slate-200 rounded-[20px] cursor-pointer hover:bg-opacity-90"
|
||||
className="w-full border-2 border-brand text-black relative transition-colors max-w-[600px] min-w-[300px] flex items-center dark:text-slate-200 rounded-[32px] overflow-hidden cursor-pointer"
|
||||
onClick={() => {
|
||||
if (ref.current && href) {
|
||||
// forwardRef requires preact/compat - let's keep it simple
|
||||
@@ -49,9 +49,7 @@ export function Container({
|
||||
}
|
||||
}}>
|
||||
{href && <Link href={href} />}
|
||||
<div className="flex-1 px-[6px] pt-[6px] pb-2.5 max-w-full">
|
||||
{children}
|
||||
</div>
|
||||
<div className="flex-1 max-w-full">{children}</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -14,8 +14,9 @@ import {ComponentChildren, h} from 'preact'
|
||||
import {useMemo} from 'preact/hooks'
|
||||
|
||||
import infoIcon from '../../assets/circleInfo_stroke2_corner0_rounded.svg'
|
||||
import playIcon from '../../assets/play_filled_corner2_rounded.svg'
|
||||
import playIcon from '../../assets/play_filled_corner0_rounded.svg'
|
||||
import starterPackIcon from '../../assets/starterPack.svg'
|
||||
import {Globe} from '../icons/Globe'
|
||||
import {CONTENT_LABELS, labelsToInfo} from '../labels'
|
||||
import * as bsky from '../types/bsky'
|
||||
import {getRkey} from '../util/rkey'
|
||||
@@ -93,7 +94,7 @@ export function Embed({
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-1 items-center shrink min-w-0 min-h-0">
|
||||
<p className="block text-sm shrink-0 font-bold max-w-[70%] line-clamp-1">
|
||||
<p className="text-sm shrink-0 font-semibold max-w-[70%] truncate">
|
||||
{record.author.displayName?.trim() || record.author.handle}
|
||||
</p>
|
||||
{verification.isVerified && (
|
||||
@@ -103,7 +104,7 @@ export function Embed({
|
||||
size={12}
|
||||
/>
|
||||
)}
|
||||
<p className="block line-clamp-1 text-sm text-textLight dark:text-textDimmed shrink-[10] ml-1">
|
||||
<p className="text-sm text-textLight dark:text-textDimmed min-w-0 truncate ml-1">
|
||||
@{record.author.handle}
|
||||
</p>
|
||||
</div>
|
||||
@@ -334,13 +335,18 @@ function ExternalEmbed({
|
||||
/>
|
||||
)}
|
||||
<div className="py-3 px-4">
|
||||
<p className="text-sm text-textLight dark:text-textDimmed line-clamp-1">
|
||||
{toNiceDomain(content.external.uri)}
|
||||
<p className="font-semibold leading-tight line-clamp-3">
|
||||
{content.external.title}
|
||||
</p>
|
||||
<p className="font-semibold line-clamp-3">{content.external.title}</p>
|
||||
<p className="text-sm text-textLight dark:text-textDimmed line-clamp-2 mt-0.5">
|
||||
<p className="text-sm leading-snug text-textLight dark:text-textDimmed line-clamp-2 mt-0.5">
|
||||
{content.external.description}
|
||||
</p>
|
||||
<div className="flex flex-row items-center gap-1 border-t dark:border-slate-600 mt-1 pt-1.5">
|
||||
<Globe size={12} className="text-textLight dark:text-textDimmed" />
|
||||
<p className="text-sm leading-none text-textLight dark:text-textDimmed line-clamp-1">
|
||||
{toNiceDomain(content.external.uri)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)
|
||||
@@ -374,7 +380,7 @@ function GenericWithImageEmbed({
|
||||
<div className="w-8 h-8 rounded-md bg-brand shrink-0" />
|
||||
)}
|
||||
<div className="flex-1">
|
||||
<p className="font-bold text-sm">{title}</p>
|
||||
<p className="font-semibold text-sm">{title}</p>
|
||||
<p className="text-textLight dark:text-textDimmed text-sm">
|
||||
{subtitle}
|
||||
</p>
|
||||
@@ -389,7 +395,6 @@ function GenericWithImageEmbed({
|
||||
)
|
||||
}
|
||||
|
||||
// just the thumbnail and a play button
|
||||
function VideoEmbed({content}: {content: AppBskyEmbedVideo.View}) {
|
||||
let aspectRatio = 1
|
||||
|
||||
@@ -398,6 +403,28 @@ function VideoEmbed({content}: {content: AppBskyEmbedVideo.View}) {
|
||||
aspectRatio = clamp(width / height, 1 / 1, 3 / 1)
|
||||
}
|
||||
|
||||
const supportsHls = useMemo(() => {
|
||||
const video = document.createElement('video')
|
||||
return video.canPlayType('application/vnd.apple.mpegurl') !== ''
|
||||
}, [])
|
||||
|
||||
if (supportsHls) {
|
||||
return (
|
||||
<video
|
||||
src={content.playlist}
|
||||
poster={content.thumbnail}
|
||||
controls
|
||||
playsinline
|
||||
preload="metadata"
|
||||
loading="lazy"
|
||||
aria-label={content.alt || undefined}
|
||||
onClickCapture={evt => evt.stopPropagation()}
|
||||
className="w-full rounded-xl bg-black"
|
||||
style={{aspectRatio: `${aspectRatio} / 1`}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="w-full overflow-hidden rounded-xl aspect-square relative"
|
||||
|
||||
@@ -53,7 +53,7 @@ export function Post({thread}: Props) {
|
||||
return (
|
||||
<Container href={href}>
|
||||
<div
|
||||
className="flex-1 flex-col flex gap-2 bg-neutral-50 dark:bg-black dark:hover:bg-slate-900 hover:bg-blue-50 rounded-[14px] p-4"
|
||||
className="flex-1 flex-col flex gap-4 bg-white dark:bg-black hover:bg-brandHover dark:hover:bg-brandHoverDark rounded-[30px] p-5"
|
||||
lang={record?.langs?.[0]}>
|
||||
<div className="flex gap-2.5 items-center cursor-pointer w-full max-w-full ">
|
||||
<Link
|
||||
@@ -70,7 +70,7 @@ export function Post({thread}: Props) {
|
||||
<div className="flex flex-1 items-center">
|
||||
<Link
|
||||
href={`/profile/${post.author.did}`}
|
||||
className="block font-bold text-[17px] leading-5 line-clamp-1 hover:underline underline-offset-2 text-ellipsis decoration-2">
|
||||
className="block font-semibold text-[15px] min-[400px]:text-[17px] leading-5 line-clamp-1 hover:underline underline-offset-2 text-ellipsis decoration-2">
|
||||
{post.author.displayName?.trim() || post.author.handle}
|
||||
</Link>
|
||||
{verification.isVerified && (
|
||||
@@ -87,72 +87,68 @@ export function Post({thread}: Props) {
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<Link
|
||||
href={`/profile/${post.author.did}`}
|
||||
className="block text-[15px] text-textLight dark:text-textDimmed hover:underline line-clamp-1">
|
||||
@{post.author.handle}
|
||||
</Link>
|
||||
<div className="flex items-center gap-1 text-[13px] min-[400px]:text-[15px] min-w-0">
|
||||
<Link
|
||||
href={`/profile/${post.author.did}`}
|
||||
className="text-textNeutral hover:underline line-clamp-1">
|
||||
@{post.author.handle}
|
||||
</Link>
|
||||
<span className="text-textNeutral shrink-0">·</span>
|
||||
<Link
|
||||
href={`/profile/${post.author.did}`}
|
||||
className="text-brand hover:underline shrink-0">
|
||||
Follow
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<PostContent record={record} />
|
||||
<Embed content={post.embed} labels={post.labels} />
|
||||
|
||||
<div className="flex items-center justify-between w-full pt-2.5 text-sm">
|
||||
<div className="flex items-center gap-3 text-sm cursor-pointer">
|
||||
{!!post.likeCount && (
|
||||
<div className="flex items-center gap-1 cursor-pointer group">
|
||||
<LikeIcon
|
||||
width={20}
|
||||
height={20}
|
||||
className="text-slate-600 dark:text-slate-400 group-hover:text-neutral-800 dark:group-hover:text-white transition-colors"
|
||||
/>
|
||||
<p className="font-medium text-slate-600 text-neutral-600 dark:text-neutral-300 mb-px group-hover:text-neutral-800 dark:group-hover:text-white transition-colors dark:text-slate-400">
|
||||
{prettyNumber(post.likeCount)}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{!!post.replyCount && (
|
||||
<div className="flex items-center gap-1 cursor-pointer group">
|
||||
<ReplyIcon
|
||||
width={20}
|
||||
height={20}
|
||||
className="text-slate-600 dark:text-slate-400 group-hover:text-neutral-800 dark:group-hover:text-white transition-colors"
|
||||
/>
|
||||
<p className="font-medium text-slate-600 text-neutral-600 dark:text-neutral-300 mb-px group-hover:text-neutral-800 dark:group-hover:text-white transition-colors dark:text-slate-400">
|
||||
{prettyNumber(post.replyCount)}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!!post.repostCount && (
|
||||
<div className="flex items-center gap-1 cursor-pointer group">
|
||||
<RepostIcon
|
||||
width={20}
|
||||
height={20}
|
||||
className="text-slate-600 dark:text-slate-400 group-hover:text-neutral-800 dark:group-hover:text-white transition-colors"
|
||||
/>
|
||||
<p className="font-medium text-slate-600 dark:text-slate-400 mb-px group-hover:text-neutral-800 dark:group-hover:text-white transition-colors">
|
||||
{prettyNumber(post.repostCount)}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-end justify-between w-full">
|
||||
<div className="flex flex-col min-[400px]:gap-0.5">
|
||||
<div className="flex items-center gap-3 text-sm cursor-pointer ml-[-2px]">
|
||||
{!!post.likeCount && (
|
||||
<div className="flex items-center gap-0.5 min-[400px]:gap-1 cursor-pointer group">
|
||||
<LikeIcon className="w-5 h-5 min-[400px]:w-[22px] min-[400px]:h-[22px] text-textLight dark:text-textDimmed group-hover:text-neutral-800 dark:group-hover:text-white transition-colors" />
|
||||
<p className="text-[11px] min-[400px]:text-[15px] font-semibold text-textLight dark:text-textDimmed mb-px group-hover:text-neutral-800 dark:group-hover:text-white transition-colors">
|
||||
{prettyNumber(post.likeCount)}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{!!post.replyCount && (
|
||||
<div className="flex items-center gap-0.5 min-[400px]:gap-1 cursor-pointer group">
|
||||
<ReplyIcon className="w-5 h-5 min-[400px]:w-[22px] min-[400px]:h-[22px] text-textLight dark:text-textDimmed group-hover:text-neutral-800 dark:group-hover:text-white transition-colors" />
|
||||
<p className="text-[11px] min-[400px]:text-[15px] font-semibold text-textLight dark:text-textDimmed mb-px group-hover:text-neutral-800 dark:group-hover:text-white transition-colors">
|
||||
{prettyNumber(post.replyCount)}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{!!post.repostCount && (
|
||||
<div className="flex items-center gap-0.5 min-[400px]:gap-1 cursor-pointer group">
|
||||
<RepostIcon className="w-5 h-5 min-[400px]:w-[22px] min-[400px]:h-[22px] text-textLight dark:text-textDimmed group-hover:text-neutral-800 dark:group-hover:text-white transition-colors" />
|
||||
<p className="text-[11px] min-[400px]:text-[15px] font-semibold text-textLight dark:text-textDimmed mb-px group-hover:text-neutral-800 dark:group-hover:text-white transition-colors">
|
||||
{prettyNumber(post.repostCount)}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<Link href={href}>
|
||||
<time
|
||||
datetime={new Date(post.indexedAt).toISOString()}
|
||||
className="text-[11px] min-[400px]:text-[15px] text-textNeutral hover:underline">
|
||||
{niceDate(post.indexedAt)}
|
||||
</time>
|
||||
</Link>
|
||||
</div>
|
||||
<Link href={href}>
|
||||
<time
|
||||
datetime={new Date(post.indexedAt).toISOString()}
|
||||
className="text-slate-500 dark:text-textDimmed text-sm hover:underline dark:text-slate-500">
|
||||
{niceDate(post.indexedAt)}
|
||||
</time>
|
||||
<Link
|
||||
href={href}
|
||||
className="transition-transform hover:scale-110 shrink-0">
|
||||
<img src={logo} className="h-5 min-[400px]:h-7" />
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center justify-end pt-2">
|
||||
<Link
|
||||
href={href}
|
||||
className="transition-transform hover:scale-110 shrink-0">
|
||||
<img src={logo} className="h-8" />
|
||||
</Link>
|
||||
</div>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
@@ -177,7 +173,7 @@ function PostContent({record}: {record: AppBskyFeedPost.Record | null}) {
|
||||
<Link
|
||||
key={counter}
|
||||
href={segment.link.uri}
|
||||
className="text-blue-500 hover:underline"
|
||||
className="text-brand hover:underline"
|
||||
disableTracking={
|
||||
!segment.link.uri.startsWith('https://bsky.app') &&
|
||||
!segment.link.uri.startsWith('https://go.bsky.app')
|
||||
@@ -193,7 +189,7 @@ function PostContent({record}: {record: AppBskyFeedPost.Record | null}) {
|
||||
<Link
|
||||
key={counter}
|
||||
href={`/profile/${segment.mention.did}`}
|
||||
className="text-blue-500 hover:underline">
|
||||
className="text-brand hover:underline">
|
||||
{segment.text}
|
||||
</Link>,
|
||||
)
|
||||
@@ -205,7 +201,7 @@ function PostContent({record}: {record: AppBskyFeedPost.Record | null}) {
|
||||
<Link
|
||||
key={counter}
|
||||
href={`/hashtag/${segment.tag.tag}`}
|
||||
className="text-blue-500 hover:underline">
|
||||
className="text-brand hover:underline">
|
||||
{segment.text}
|
||||
</Link>,
|
||||
)
|
||||
@@ -217,7 +213,7 @@ function PostContent({record}: {record: AppBskyFeedPost.Record | null}) {
|
||||
}
|
||||
|
||||
return (
|
||||
<p className="min-[300px]:text-lg leading-6 min-[300px]:leading-6 break-word break-words whitespace-pre-wrap">
|
||||
<p className="text-md min-[400px]:text-lg leading-snug min-[400px]:leading-snug break-word break-words whitespace-pre-wrap">
|
||||
{richText}
|
||||
</p>
|
||||
)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import {h} from 'preact'
|
||||
|
||||
export const Globe = ({
|
||||
size = 14,
|
||||
className,
|
||||
}: {
|
||||
size?: number
|
||||
className?: string
|
||||
}) => (
|
||||
<svg
|
||||
className={className}
|
||||
width={size}
|
||||
height={size}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24">
|
||||
<path
|
||||
fill="currentColor"
|
||||
fill-rule="evenodd"
|
||||
d="M4.4 9.493C4.14 10.28 4 11.124 4 12a8 8 0 1 0 10.899-7.459l-.953 3.81a1 1 0 0 1-.726.727l-3.444.866-.772 1.533a1 1 0 0 1-1.493.35L4.4 9.493Zm.883-1.84L7.756 9.51l.44-.874a1 1 0 0 1 .649-.52l3.306-.832.807-3.227a7.99 7.99 0 0 0-7.676 3.597ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm8.43.162a1 1 0 0 1 .77-.29l1.89.121a1 1 0 0 1 .494.168l2.869 1.928a1 1 0 0 1 .336 1.277l-.973 1.946a1 1 0 0 1-.894.553h-2.92a1 1 0 0 1-.831-.445L9.225 14.5a1 1 0 0 1 .126-1.262l1.08-1.076Zm.915 1.913.177-.177 1.171.074 1.914 1.286-.303.607h-1.766l-1.194-1.79Z"
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
@@ -2,6 +2,12 @@
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
:root {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
|
||||
.break-word {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export const EMBED_SCRIPT = `${EMBED_SERVICE}/static/embed.js`
|
||||
const root = document.getElementById('app')
|
||||
if (!root) throw new Error('No root element')
|
||||
|
||||
initSystemColorMode()
|
||||
initSystemColorMode({additionalBodyClasses: 'dark:bg-dimmedBgDarken'})
|
||||
|
||||
const agent = new AtpAgent({
|
||||
service: 'https://public.api.bsky.app',
|
||||
@@ -39,6 +39,7 @@ render(<LandingPage />, root)
|
||||
function LandingPage() {
|
||||
const [uri, setUri] = useState('')
|
||||
const [colorMode, setColorMode] = useState<ColorModeValues>('system')
|
||||
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [thread, setThread] = useState<AppBskyFeedDefs.ThreadViewPost | null>(
|
||||
@@ -118,7 +119,7 @@ function LandingPage() {
|
||||
}, [uri])
|
||||
|
||||
return (
|
||||
<main className="w-full min-h-screen flex flex-col items-center gap-8 py-14 px-4 md:pt-32 dark:bg-dimmedBgDarken dark:text-slate-200">
|
||||
<main className="w-full min-h-dvh flex flex-col items-center gap-8 py-14 px-4 md:pt-32 dark:text-slate-200">
|
||||
<Link
|
||||
href="https://bsky.social/about"
|
||||
className="transition-transform hover:scale-110">
|
||||
@@ -185,7 +186,7 @@ function LandingPage() {
|
||||
function Skeleton() {
|
||||
return (
|
||||
<Container>
|
||||
<div className="flex-1 flex-col flex gap-2 pb-8">
|
||||
<div className="flex-1 flex-col flex gap-2 p-5 pb-8">
|
||||
<div className="flex gap-2.5 items-center">
|
||||
<div className="w-10 h-10 overflow-hidden rounded-full bg-neutral-100 dark:bg-slate-700 shrink-0 animate-pulse" />
|
||||
<div className="flex-1">
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
export function niceDate(date: number | string | Date) {
|
||||
const d = new Date(date)
|
||||
return `${d.toLocaleDateString('en-us', {
|
||||
return `${d.toLocaleTimeString(undefined, {
|
||||
hour: 'numeric',
|
||||
minute: '2-digit',
|
||||
})} · ${d.toLocaleDateString('en-us', {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
})} at ${d.toLocaleTimeString(undefined, {
|
||||
hour: 'numeric',
|
||||
minute: '2-digit',
|
||||
})}`
|
||||
}
|
||||
|
||||
@@ -5,10 +5,13 @@ module.exports = {
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
brand: 'rgb(10,122,255)',
|
||||
brand: 'rgb(0,106,255)',
|
||||
brandHover: 'rgb(245,249,255)',
|
||||
brandHoverDark: 'rgb(17,24,34)',
|
||||
brandLighten: 'rgb(32,139,254)',
|
||||
textLight: 'rgb(66,87,108)',
|
||||
textDimmed: 'rgb(174,187,201)',
|
||||
textLight: 'rgb(63,82,104)',
|
||||
textDimmed: 'rgb(164,179,197)',
|
||||
textNeutral: 'rgb(102,123,153)',
|
||||
dimmedBgLighten: 'rgb(30,41,54)',
|
||||
dimmedBg: 'rgb(22,30,39)',
|
||||
dimmedBgDarken: 'rgb(18,25,32)',
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
"type": "module",
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
"test": "./tests/infra/with-test-db.sh node --loader ts-node/esm --test ./tests/index.ts",
|
||||
"test": "npm run test:unit && npm run test:e2e",
|
||||
"test:e2e": "./tests/infra/with-test-db.sh node --loader ts-node/esm --test ./tests/index.ts",
|
||||
"test:unit": "node --loader ts-node/esm --test ./src/*.test.ts",
|
||||
"build": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -15,6 +15,7 @@ export type ServiceConfig = {
|
||||
safelinkPdsUrl?: string
|
||||
safelinkAgentIdentifier?: string
|
||||
safelinkAgentPass?: string
|
||||
metricsApiHost?: string
|
||||
}
|
||||
|
||||
export type DbConfig = {
|
||||
@@ -45,6 +46,7 @@ export type Environment = {
|
||||
safelinkPdsUrl?: string
|
||||
safelinkAgentIdentifier?: string
|
||||
safelinkAgentPass?: string
|
||||
metricsApiHost?: string
|
||||
}
|
||||
|
||||
export const readEnv = (): Environment => {
|
||||
@@ -65,6 +67,7 @@ export const readEnv = (): Environment => {
|
||||
safelinkPdsUrl: envStr('LINK_SAFELINK_PDS_URL'),
|
||||
safelinkAgentIdentifier: envStr('LINK_SAFELINK_AGENT_IDENTIFIER'),
|
||||
safelinkAgentPass: envStr('LINK_SAFELINK_AGENT_PASS'),
|
||||
metricsApiHost: envStr('LINK_METRICS_API_HOST'),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +82,7 @@ export const envToCfg = (env: Environment): Config => {
|
||||
safelinkPdsUrl: env.safelinkPdsUrl,
|
||||
safelinkAgentIdentifier: env.safelinkAgentIdentifier,
|
||||
safelinkAgentPass: env.safelinkAgentPass,
|
||||
metricsApiHost: env.metricsApiHost,
|
||||
}
|
||||
if (!env.dbPostgresUrl) {
|
||||
throw new Error('Must configure postgres url (LINK_DB_POSTGRES_URL)')
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {SafelinkClient} from './cache/safelinkClient.js'
|
||||
import {type Config} from './config.js'
|
||||
import Database from './db/index.js'
|
||||
import {MetricsClient} from './metrics.js'
|
||||
|
||||
export type AppContextOptions = {
|
||||
cfg: Config
|
||||
@@ -12,6 +13,7 @@ export class AppContext {
|
||||
db: Database
|
||||
safelinkClient: SafelinkClient
|
||||
abortController = new AbortController()
|
||||
metrics: MetricsClient
|
||||
|
||||
constructor(private opts: AppContextOptions) {
|
||||
this.cfg = this.opts.cfg
|
||||
@@ -20,6 +22,9 @@ export class AppContext {
|
||||
cfg: this.opts.cfg.service,
|
||||
db: this.opts.db,
|
||||
})
|
||||
this.metrics = new MetricsClient({
|
||||
trackingEndpoint: this.opts.cfg.service.metricsApiHost,
|
||||
})
|
||||
}
|
||||
|
||||
static async fromConfig(cfg: Config, overrides?: Partial<AppContextOptions>) {
|
||||
|
||||
@@ -36,6 +36,7 @@ export class LinkService {
|
||||
}
|
||||
|
||||
async start() {
|
||||
this.ctx.metrics.start()
|
||||
this.server = this.app.listen(this.ctx.cfg.service.port)
|
||||
this.server.keepAliveTimeout = 90000
|
||||
this.terminator = createHttpTerminator({server: this.server})
|
||||
@@ -46,5 +47,6 @@ export class LinkService {
|
||||
this.ctx.abortController.abort()
|
||||
await this.terminator?.terminate()
|
||||
await this.ctx.db.close()
|
||||
this.ctx.metrics.stop()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
import assert from 'node:assert'
|
||||
import {afterEach, beforeEach, describe, it, mock} from 'node:test'
|
||||
|
||||
import {httpLogger} from './logger.js'
|
||||
import {MetricsClient} from './metrics.js'
|
||||
|
||||
type TestEvents = {
|
||||
click: {button: string}
|
||||
view: {screen: string}
|
||||
}
|
||||
|
||||
describe('MetricsClient', () => {
|
||||
let fetchMock: ReturnType<typeof mock.fn>
|
||||
let fetchRequests: {body: any}[]
|
||||
let client: MetricsClient<TestEvents>
|
||||
let loggerErrorMock: ReturnType<typeof mock.fn>
|
||||
|
||||
beforeEach(() => {
|
||||
mock.timers.enable({apis: ['setInterval', 'setTimeout']})
|
||||
fetchRequests = []
|
||||
fetchMock = mock.fn(async (_url: any, options: any) => {
|
||||
const body = JSON.parse(options.body)
|
||||
fetchRequests.push({body})
|
||||
return {ok: true, status: 200, text: async () => ''}
|
||||
})
|
||||
;(globalThis as any).fetch = fetchMock
|
||||
loggerErrorMock = mock.fn()
|
||||
httpLogger.error = loggerErrorMock as any
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
client?.stop()
|
||||
mock.timers.reset()
|
||||
mock.restoreAll()
|
||||
})
|
||||
|
||||
it('flushes events on interval', async () => {
|
||||
client = new MetricsClient<TestEvents>({
|
||||
trackingEndpoint: 'https://test.metrics.api',
|
||||
})
|
||||
client.track('click', {button: 'submit'})
|
||||
client.track('view', {screen: 'home'})
|
||||
|
||||
assert.strictEqual(fetchRequests.length, 0)
|
||||
|
||||
mock.timers.tick(10_000)
|
||||
await flush()
|
||||
|
||||
assert.strictEqual(fetchRequests.length, 1)
|
||||
assert.strictEqual(fetchRequests[0].body.events.length, 2)
|
||||
assert.strictEqual(fetchRequests[0].body.events[0].event, 'click')
|
||||
assert.strictEqual(fetchRequests[0].body.events[1].event, 'view')
|
||||
})
|
||||
|
||||
it('flushes when maxBatchSize is exceeded', async () => {
|
||||
client = new MetricsClient<TestEvents>({
|
||||
trackingEndpoint: 'https://test.metrics.api',
|
||||
})
|
||||
client.maxBatchSize = 5
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
client.track('click', {button: `btn-${i}`})
|
||||
}
|
||||
|
||||
assert.strictEqual(fetchRequests.length, 0)
|
||||
|
||||
client.track('click', {button: 'btn-trigger'})
|
||||
await flush()
|
||||
|
||||
assert.strictEqual(fetchRequests.length, 1)
|
||||
assert.strictEqual(fetchRequests[0].body.events.length, 6)
|
||||
})
|
||||
|
||||
it('logs error on failed request', async () => {
|
||||
fetchMock.mock.mockImplementation(async () => {
|
||||
return {
|
||||
ok: false,
|
||||
status: 500,
|
||||
text: async () => 'Internal Server Error',
|
||||
}
|
||||
})
|
||||
|
||||
client = new MetricsClient<TestEvents>({
|
||||
trackingEndpoint: 'https://test.metrics.api',
|
||||
})
|
||||
client.track('click', {button: 'submit'})
|
||||
|
||||
mock.timers.tick(10_000)
|
||||
await flush()
|
||||
|
||||
assert.strictEqual(fetchMock.mock.callCount(), 1)
|
||||
assert.strictEqual(loggerErrorMock.mock.callCount(), 1)
|
||||
const call = loggerErrorMock.mock.calls[0]
|
||||
const arg = call.arguments[0] as {err: Error}
|
||||
assert.ok(arg.err instanceof Error)
|
||||
assert.strictEqual(call.arguments[1], 'Failed to send metrics')
|
||||
})
|
||||
|
||||
it('handles fetch text() error gracefully', async () => {
|
||||
fetchMock.mock.mockImplementation(async () => {
|
||||
return {
|
||||
ok: false,
|
||||
status: 500,
|
||||
text: async () => {
|
||||
throw new Error('Failed to read response')
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
client = new MetricsClient<TestEvents>({
|
||||
trackingEndpoint: 'https://test.metrics.api',
|
||||
})
|
||||
client.track('click', {button: 'submit'})
|
||||
|
||||
mock.timers.tick(10_000)
|
||||
await flush()
|
||||
|
||||
assert.strictEqual(fetchMock.mock.callCount(), 1)
|
||||
assert.strictEqual(loggerErrorMock.mock.callCount(), 1)
|
||||
const call = loggerErrorMock.mock.calls[0]
|
||||
const arg = call.arguments[0] as {err: Error}
|
||||
assert.ok(arg.err instanceof Error)
|
||||
assert.match(arg.err.message, /Unknown error/)
|
||||
assert.strictEqual(call.arguments[1], 'Failed to send metrics')
|
||||
})
|
||||
|
||||
it('flushes when stop() is called', async () => {
|
||||
client = new MetricsClient<TestEvents>({
|
||||
trackingEndpoint: 'https://test.metrics.api',
|
||||
})
|
||||
client.track('click', {button: 'submit'})
|
||||
|
||||
assert.strictEqual(fetchRequests.length, 0)
|
||||
|
||||
client.stop()
|
||||
await flush()
|
||||
|
||||
assert.strictEqual(fetchRequests.length, 1)
|
||||
assert.strictEqual(fetchRequests[0].body.events.length, 1)
|
||||
assert.strictEqual(fetchRequests[0].body.events[0].event, 'click')
|
||||
})
|
||||
|
||||
it('does not send if trackingEndpoint is not configured', async () => {
|
||||
client = new MetricsClient<TestEvents>({})
|
||||
client.track('click', {button: 'submit'})
|
||||
|
||||
mock.timers.tick(10_000)
|
||||
await flush()
|
||||
|
||||
assert.strictEqual(fetchMock.mock.callCount(), 0)
|
||||
})
|
||||
|
||||
it('start() is idempotent', async () => {
|
||||
client = new MetricsClient<TestEvents>({
|
||||
trackingEndpoint: 'https://test.metrics.api',
|
||||
})
|
||||
|
||||
client.track('click', {button: 'submit'})
|
||||
client.start()
|
||||
client.start()
|
||||
|
||||
mock.timers.tick(10_000)
|
||||
await flush()
|
||||
|
||||
assert.strictEqual(fetchRequests.length, 1)
|
||||
})
|
||||
|
||||
it('does not flush if queue is empty', async () => {
|
||||
client = new MetricsClient<TestEvents>({
|
||||
trackingEndpoint: 'https://test.metrics.api',
|
||||
})
|
||||
client.start()
|
||||
|
||||
mock.timers.tick(10_000)
|
||||
await flush()
|
||||
|
||||
assert.strictEqual(fetchMock.mock.callCount(), 0)
|
||||
})
|
||||
})
|
||||
|
||||
function flush() {
|
||||
return new Promise(r => setImmediate(r))
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
import crypto from 'node:crypto'
|
||||
|
||||
import {httpLogger} from './logger.js'
|
||||
|
||||
/**
|
||||
* New metrics events should be added here
|
||||
*/
|
||||
type Events = {
|
||||
redirect: {
|
||||
link: string
|
||||
whitelisted: 'unknown' | 'yes'
|
||||
blocked: boolean
|
||||
warned: boolean
|
||||
utm_source?: string
|
||||
utm_medium?: string
|
||||
utm_campaign?: string
|
||||
utm_content?: string
|
||||
utm_term?: string
|
||||
}
|
||||
invalid_redirect: {
|
||||
link: string
|
||||
}
|
||||
}
|
||||
|
||||
type Event<M extends Record<string, any>> = {
|
||||
time: number
|
||||
event: keyof M
|
||||
payload: M[keyof M]
|
||||
metadata: Record<string, any>
|
||||
}
|
||||
|
||||
export type Config = {
|
||||
trackingEndpoint?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* This MetricsClient is duplicated from both `social-app` and `atproto`
|
||||
* codebases.
|
||||
*/
|
||||
export class MetricsClient<M extends Record<string, any> = Events> {
|
||||
maxBatchSize = 100
|
||||
|
||||
private disabled: boolean = false
|
||||
private started: boolean = false
|
||||
private queue: Event<M>[] = []
|
||||
private flushInterval: NodeJS.Timeout | null = null
|
||||
constructor(private config: Config) {
|
||||
this.disabled = !config.trackingEndpoint
|
||||
}
|
||||
|
||||
start() {
|
||||
if (this.disabled) return
|
||||
if (this.started) return
|
||||
this.started = true
|
||||
this.flushInterval = setInterval(() => {
|
||||
this.flush()
|
||||
}, 10_000)
|
||||
}
|
||||
|
||||
stop() {
|
||||
if (this.flushInterval) {
|
||||
clearInterval(this.flushInterval)
|
||||
this.flushInterval = null
|
||||
}
|
||||
this.flush()
|
||||
}
|
||||
|
||||
track<E extends keyof M>(event: E, payload: M[E]) {
|
||||
if (this.disabled) return
|
||||
|
||||
this.start()
|
||||
|
||||
/**
|
||||
* deviceId is required for sharding events in Middleman. To avoid a hot
|
||||
* shard, we generate a random anonymous IDs for this client.
|
||||
*
|
||||
* @see https://github.com/bluesky-social/tango/blob/d5819cde419d13e0d2cf837f4b30d48529d64060/middleman/handlers_tracking.go#L195
|
||||
*/
|
||||
const anonId = `anon-${crypto.randomUUID()}`
|
||||
|
||||
/**
|
||||
* Event structure is like this to ensure compat with Middleman, which
|
||||
* receives events like this from other codebases, including `social-app`.
|
||||
*/
|
||||
const e = {
|
||||
source: 'blink',
|
||||
time: Date.now(),
|
||||
event,
|
||||
payload,
|
||||
metadata: {
|
||||
base: {
|
||||
deviceId: anonId,
|
||||
sessionId: anonId,
|
||||
},
|
||||
session: {
|
||||
did: undefined,
|
||||
},
|
||||
},
|
||||
}
|
||||
this.queue.push(e)
|
||||
|
||||
if (this.queue.length > this.maxBatchSize) {
|
||||
this.flush()
|
||||
}
|
||||
}
|
||||
|
||||
flush() {
|
||||
if (this.disabled) return
|
||||
if (!this.queue.length) return
|
||||
const events = this.queue.splice(0, this.queue.length)
|
||||
this.sendBatch(events)
|
||||
}
|
||||
|
||||
private async sendBatch(events: Event<M>[]) {
|
||||
if (this.disabled || !this.config.trackingEndpoint) return
|
||||
|
||||
try {
|
||||
const res = await fetch(this.config.trackingEndpoint, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({events}),
|
||||
keepalive: true,
|
||||
})
|
||||
|
||||
if (!res.ok) {
|
||||
const errorText = await res.text().catch(() => 'Unknown error')
|
||||
httpLogger.error(
|
||||
{err: new Error(`${res.status} Failed to fetch - ${errorText}`)},
|
||||
'Failed to send metrics',
|
||||
)
|
||||
} else {
|
||||
// Drain response body to allow connection reuse.
|
||||
await res.text().catch(() => {})
|
||||
}
|
||||
} catch (err) {
|
||||
httpLogger.error({err}, 'Failed to send metrics')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ export default function (ctx: AppContext, app: Express) {
|
||||
url.pathname === '/redirect') || // is a redirect loop
|
||||
INTERNAL_IP_REGEX.test(url.hostname) // isn't directing to an internal location
|
||||
) {
|
||||
ctx.metrics.track('invalid_redirect', {link})
|
||||
res.setHeader('Cache-Control', 'no-store')
|
||||
res.setHeader('Location', `https://${ctx.cfg.service.appHostname}`)
|
||||
return res.status(302).end()
|
||||
@@ -48,6 +49,9 @@ export default function (ctx: AppContext, app: Express) {
|
||||
res.type('html')
|
||||
|
||||
let html: string | undefined
|
||||
let whitelisted: 'unknown' | 'yes' = 'unknown'
|
||||
let blocked: boolean = false
|
||||
let warned: boolean = false
|
||||
|
||||
if (ctx.cfg.service.safelinkEnabled) {
|
||||
const rule = await ctx.safelinkClient.tryFindRule(link)
|
||||
@@ -55,6 +59,7 @@ export default function (ctx: AppContext, app: Express) {
|
||||
switch (rule.action) {
|
||||
case 'whitelist':
|
||||
redirectLogger.info({rule}, 'Whitelist rule matched')
|
||||
whitelisted = 'yes'
|
||||
break
|
||||
case 'block':
|
||||
html = linkWarningLayout(
|
||||
@@ -66,6 +71,7 @@ export default function (ctx: AppContext, app: Express) {
|
||||
)
|
||||
res.setHeader('Cache-Control', 'no-store')
|
||||
redirectLogger.info({rule}, 'Block rule matched')
|
||||
blocked = true
|
||||
break
|
||||
case 'warn':
|
||||
html = linkWarningLayout(
|
||||
@@ -77,6 +83,7 @@ export default function (ctx: AppContext, app: Express) {
|
||||
)
|
||||
res.setHeader('Cache-Control', 'no-store')
|
||||
redirectLogger.info({rule}, 'Warn rule matched')
|
||||
warned = true
|
||||
break
|
||||
default:
|
||||
redirectLogger.warn({rule}, 'Unknown rule matched')
|
||||
@@ -89,6 +96,18 @@ export default function (ctx: AppContext, app: Express) {
|
||||
html = linkRedirectContents(url.href)
|
||||
}
|
||||
|
||||
ctx.metrics.track('redirect', {
|
||||
link,
|
||||
whitelisted,
|
||||
blocked,
|
||||
warned,
|
||||
utm_source: req.query.utm_source?.toString(),
|
||||
utm_medium: req.query.utm_medium?.toString(),
|
||||
utm_campaign: req.query.utm_campaign?.toString(),
|
||||
utm_content: req.query.utm_content?.toString(),
|
||||
utm_term: req.query.utm_term?.toString(),
|
||||
})
|
||||
|
||||
return res.end(html)
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -2,11 +2,9 @@ import assert from 'node:assert'
|
||||
import {type AddressInfo} from 'node:net'
|
||||
import {after, before, describe, it} from 'node:test'
|
||||
|
||||
import {ToolsOzoneSafelinkDefs} from '@atproto/api'
|
||||
|
||||
import {Database, envToCfg, LinkService, readEnv} from '../src/index.js'
|
||||
|
||||
describe('link service', async () => {
|
||||
describe.skip('link service', async () => {
|
||||
let linkService: LinkService
|
||||
let baseUrl: string
|
||||
before(async () => {
|
||||
@@ -18,9 +16,9 @@ describe('link service', async () => {
|
||||
dbPostgresSchema: 'link_test',
|
||||
dbPostgresUrl: process.env.DB_POSTGRES_URL,
|
||||
safelinkEnabled: true,
|
||||
ozoneUrl: 'http://localhost:2583',
|
||||
ozoneAgentHandle: 'mod-authority.test',
|
||||
ozoneAgentPass: 'hunter2',
|
||||
safelinkPdsUrl: 'http://localhost:2583',
|
||||
safelinkAgentIdentifier: 'mod-authority.test',
|
||||
safelinkAgentPass: 'hunter2',
|
||||
})
|
||||
const migrateDb = Database.postgres({
|
||||
url: cfg.db.url,
|
||||
@@ -33,6 +31,7 @@ describe('link service', async () => {
|
||||
const {port} = linkService.server?.address() as AddressInfo
|
||||
baseUrl = `http://localhost:${port}`
|
||||
|
||||
/*
|
||||
// Ensure blocklist, whitelist, and safelink rules are set up
|
||||
const now = new Date().toISOString()
|
||||
linkService.ctx.cfg.eventCache.smartUpdate({
|
||||
@@ -110,6 +109,7 @@ describe('link service', async () => {
|
||||
comment:
|
||||
'Could be quite the mistake to get into this addicting game, but we will warn instead of block',
|
||||
})
|
||||
*/
|
||||
})
|
||||
after(async () => {
|
||||
await linkService?.destroy()
|
||||
@@ -213,6 +213,7 @@ describe('link service', async () => {
|
||||
)
|
||||
})
|
||||
|
||||
/*
|
||||
it('Rule adjustment, safe redirect, 200 response for Instagram Account of teamsesh Bones', async () => {
|
||||
// Retrieve the latest event after all updates
|
||||
const result = linkService.ctx.cfg.eventCache.smartGet(
|
||||
@@ -232,6 +233,7 @@ describe('link service', async () => {
|
||||
new RegExp(urlToRedirect.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')),
|
||||
)
|
||||
})
|
||||
*/
|
||||
|
||||
async function getRedirect(link: string): Promise<[number, string]> {
|
||||
const url = new URL(link)
|
||||
@@ -291,9 +293,10 @@ describe('link service no safelink', async () => {
|
||||
dbPostgresSchema: 'link_test',
|
||||
dbPostgresUrl: process.env.DB_POSTGRES_URL,
|
||||
safelinkEnabled: false,
|
||||
ozoneUrl: 'http://localhost:2583',
|
||||
ozoneAgentHandle: 'mod-authority.test',
|
||||
ozoneAgentPass: 'hunter2',
|
||||
safelinkPdsUrl: 'http://localhost:2583',
|
||||
safelinkAgentIdentifier: 'mod-authority.test',
|
||||
safelinkAgentPass: 'hunter2',
|
||||
metricsApiHost: 'http://localhost:2584',
|
||||
})
|
||||
const migrateDb = Database.postgres({
|
||||
url: cfg.db.url,
|
||||
@@ -357,4 +360,21 @@ describe('link service no safelink', async () => {
|
||||
// No blocked-site div, always safe
|
||||
assert.doesNotMatch(html, /"blocked-site"/)
|
||||
})
|
||||
|
||||
it('normal redirect with query params', async () => {
|
||||
const urlToRedirect = 'https://bsky.app/settings'
|
||||
const url = new URL(`${baseUrl}/redirect`)
|
||||
url.searchParams.set('u', urlToRedirect)
|
||||
url.searchParams.set('utm_source', 'test')
|
||||
const res = await fetch(url, {redirect: 'manual'})
|
||||
assert.strictEqual(res.status, 200)
|
||||
const html = await res.text()
|
||||
assert.match(html, /meta http-equiv="refresh"/)
|
||||
assert.match(
|
||||
html,
|
||||
new RegExp(urlToRedirect.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')),
|
||||
)
|
||||
// No blocked-site div, always safe
|
||||
assert.doesNotMatch(html, /"blocked-site"/)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
"sourceMap": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
"exclude": ["node_modules", "dist"],
|
||||
"ts-node": {
|
||||
"logError": true,
|
||||
"pretty": true /* <= technically not required */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ func NewRenderer(prefix string, fs *embed.FS, debug bool) *Renderer {
|
||||
}
|
||||
}
|
||||
|
||||
func (r Renderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
|
||||
func (r Renderer) Render(w io.Writer, name string, data any, c echo.Context) error {
|
||||
var ctx pongo2.Context
|
||||
|
||||
if data != nil {
|
||||
|
||||
@@ -11,6 +11,6 @@ type Template struct {
|
||||
templates *template.Template
|
||||
}
|
||||
|
||||
func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
|
||||
func (t *Template) Render(w io.Writer, name string, data any, c echo.Context) error {
|
||||
return t.templates.ExecuteTemplate(w, name, data)
|
||||
}
|
||||
|
||||
@@ -180,9 +180,9 @@ func serve(cctx *cli.Context) error {
|
||||
|
||||
// Create CORS middleware for oembed
|
||||
oembedCORS := middleware.CORSWithConfig(middleware.CORSConfig{
|
||||
AllowOrigins: []string{"*"},
|
||||
AllowMethods: []string{http.MethodGet, http.MethodHead, http.MethodOptions},
|
||||
AllowHeaders: []string{"Origin", "Content-Type", "Accept"},
|
||||
AllowOrigins: []string{"*"},
|
||||
AllowMethods: []string{http.MethodGet, http.MethodHead, http.MethodOptions},
|
||||
AllowHeaders: []string{"Origin", "Content-Type", "Accept"},
|
||||
})
|
||||
|
||||
e.GET("/robots.txt", echo.WrapHandler(staticHandler))
|
||||
@@ -271,7 +271,7 @@ func (srv *Server) errorHandler(err error, c echo.Context) {
|
||||
code = he.Code
|
||||
}
|
||||
c.Logger().Error(err)
|
||||
data := map[string]interface{}{
|
||||
data := map[string]any{
|
||||
"statusCode": code,
|
||||
}
|
||||
c.Render(code, "error.html", data)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/bluesky-social/social-app/bskyweb
|
||||
|
||||
go 1.25
|
||||
go 1.26
|
||||
|
||||
require (
|
||||
github.com/bluesky-social/indigo v0.0.0-20250729223159-573ae927246a
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"start": "NODE_ENV=development ./dev-infra/with-test-redis-and-db.sh ts-node ./mock-server.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@atproto/dev-env": "^0.3.213",
|
||||
"@atproto/dev-env": "^0.3.215",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.9.3"
|
||||
"typescript": "^6.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"forceConsistentCasingInFileNames": false,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"paths": {
|
||||
"#/*": ["./src/*"],
|
||||
"lib/*": ["./src/lib/*"],
|
||||
@@ -43,4 +44,4 @@
|
||||
"metro.config.js",
|
||||
"jest.config.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,14 +64,14 @@
|
||||
"@atproto/xrpc" "^0.7.6"
|
||||
"@atproto/xrpc-server" "^0.10.0"
|
||||
|
||||
"@atproto/api@^0.19.2":
|
||||
version "0.19.3"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.19.3.tgz#61de8d2e31abe9eb2b4c8f4ad124ed79d4a77e89"
|
||||
integrity sha512-G8YpBpRouHdTAIagi/QQIUZOhGd1jfBQWkJy9QfxAzjjEpPvaVOSk4e1S85QzGLm/xbzVONzGkmdtiOSfP6wVg==
|
||||
"@atproto/api@^0.19.4":
|
||||
version "0.19.4"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.19.4.tgz#f3ff850baf4d85538c082fb91aa0982737eb68be"
|
||||
integrity sha512-fYNM62vdXxer0h8a9Jzl4/ag9uFIe0nTO+LkC6KTlx1yUDigrAoQMMbllIiCWj62GhUMxAkHabk/BZjjVAfKng==
|
||||
dependencies:
|
||||
"@atproto/common-web" "^0.4.18"
|
||||
"@atproto/lexicon" "^0.6.2"
|
||||
"@atproto/syntax" "^0.5.0"
|
||||
"@atproto/syntax" "^0.5.1"
|
||||
"@atproto/xrpc" "^0.7.7"
|
||||
await-lock "^2.2.2"
|
||||
multiformats "^9.9.0"
|
||||
@@ -96,23 +96,23 @@
|
||||
multiformats "^9.9.0"
|
||||
uint8arrays "3.0.0"
|
||||
|
||||
"@atproto/bsky@^0.0.219":
|
||||
version "0.0.219"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/bsky/-/bsky-0.0.219.tgz#6a9f82eb4ab999e121d04ad2b3f08ff60cc75fba"
|
||||
integrity sha512-Vm7JpIyCqd7sHzHsXqppGSaKkXKUhvdZ/UOldc247Bgmx+L/U+E6IeR028hzMr1YyDvU+bkO1hlqT8uUovOCdA==
|
||||
"@atproto/bsky@^0.0.221":
|
||||
version "0.0.221"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/bsky/-/bsky-0.0.221.tgz#b574456225db66c866848526947473d60bb4d0e7"
|
||||
integrity sha512-feNR6xkJ9HCJbQdJU3ytsnAfaSBXJdaXIMi0tNPrsLfoqCWWbTfXIcMczXeY4SOhKGFR5oMYxE9zrRC/TTAssw==
|
||||
dependencies:
|
||||
"@atproto-labs/fetch-node" "^0.2.0"
|
||||
"@atproto-labs/xrpc-utils" "^0.0.24"
|
||||
"@atproto/api" "^0.19.2"
|
||||
"@atproto/common" "^0.5.14"
|
||||
"@atproto/api" "^0.19.4"
|
||||
"@atproto/common" "^0.5.15"
|
||||
"@atproto/crypto" "^0.4.5"
|
||||
"@atproto/did" "^0.3.0"
|
||||
"@atproto/identity" "^0.4.12"
|
||||
"@atproto/lexicon" "^0.6.2"
|
||||
"@atproto/repo" "^0.8.12"
|
||||
"@atproto/repo" "^0.8.13"
|
||||
"@atproto/sync" "^0.1.40"
|
||||
"@atproto/syntax" "^0.5.0"
|
||||
"@atproto/xrpc-server" "^0.10.15"
|
||||
"@atproto/syntax" "^0.5.1"
|
||||
"@atproto/xrpc-server" "^0.10.17"
|
||||
"@bufbuild/protobuf" "^1.5.0"
|
||||
"@connectrpc/connect" "^1.1.4"
|
||||
"@connectrpc/connect-express" "^1.1.4"
|
||||
@@ -146,13 +146,13 @@
|
||||
undici "^6.19.8"
|
||||
zod "3.23.8"
|
||||
|
||||
"@atproto/bsync@^0.0.24":
|
||||
version "0.0.24"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/bsync/-/bsync-0.0.24.tgz#6b0d4b02c0c0241687456ab817471d36ee81ae61"
|
||||
integrity sha512-JN+oncaPBNRjzjTPGR7Q1fkKF3cqOQ6oLRrAh9kVU04ZS3FhWUG8cQvnr8wb1PUhFb/XYpWkwDw5+GIhdb7Lfw==
|
||||
"@atproto/bsync@^0.0.25":
|
||||
version "0.0.25"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/bsync/-/bsync-0.0.25.tgz#0d6056f844c0b2579d9dfc04b6727974dc03fcd6"
|
||||
integrity sha512-5tjP5QbUcNtMBw7FJeyRfA0OHQRKrg97Jva6Q26cKqLMICGYNbx0fpD7nZhGTP2/s1gd6UZkG9Zdh4GRZpbxWg==
|
||||
dependencies:
|
||||
"@atproto/common" "^0.5.14"
|
||||
"@atproto/syntax" "^0.5.0"
|
||||
"@atproto/syntax" "^0.5.1"
|
||||
"@bufbuild/protobuf" "^1.5.0"
|
||||
"@connectrpc/connect" "^1.1.4"
|
||||
"@connectrpc/connect-node" "^1.1.4"
|
||||
@@ -172,6 +172,16 @@
|
||||
"@atproto/syntax" "^0.5.0"
|
||||
zod "^3.23.8"
|
||||
|
||||
"@atproto/common-web@^0.4.19":
|
||||
version "0.4.19"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/common-web/-/common-web-0.4.19.tgz#bbd7f84f545ebe73ca3bc00314ccf4ee66e7069e"
|
||||
integrity sha512-3BTi58p5WpT+9/zb6UZrdsXcfPo5P45UJm0E4iwHLILr+jc37CuBj9JReDSZ4U0i9RTrI3ZkfySyZ9bd+LnMsw==
|
||||
dependencies:
|
||||
"@atproto/lex-data" "^0.0.14"
|
||||
"@atproto/lex-json" "^0.0.14"
|
||||
"@atproto/syntax" "^0.5.1"
|
||||
zod "^3.23.8"
|
||||
|
||||
"@atproto/common@0.1.0":
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/common/-/common-0.1.0.tgz#4216a8fef5b985ab62ac21252a0f8ca0f4a0f210"
|
||||
@@ -203,6 +213,17 @@
|
||||
multiformats "^9.9.0"
|
||||
pino "^8.21.0"
|
||||
|
||||
"@atproto/common@^0.5.15":
|
||||
version "0.5.15"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/common/-/common-0.5.15.tgz#3c43c25d3493d868cc4281d6ac2f923b00644463"
|
||||
integrity sha512-+cdfdMPAIbH9zQGLfH1gNY2KEZsMxj0EelVQL5uJUFL+UkkAXiiqWj7J5mbax8sf02cC/afJnfkWzERNAheKoA==
|
||||
dependencies:
|
||||
"@atproto/common-web" "^0.4.19"
|
||||
"@atproto/lex-cbor" "^0.0.15"
|
||||
"@atproto/lex-data" "^0.0.14"
|
||||
multiformats "^9.9.0"
|
||||
pino "^8.21.0"
|
||||
|
||||
"@atproto/crypto@0.1.0":
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/crypto/-/crypto-0.1.0.tgz#bc73a479f9dbe06fa025301c182d7f7ab01bc568"
|
||||
@@ -223,23 +244,23 @@
|
||||
"@noble/hashes" "^1.6.1"
|
||||
uint8arrays "3.0.0"
|
||||
|
||||
"@atproto/dev-env@^0.3.213":
|
||||
version "0.3.213"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/dev-env/-/dev-env-0.3.213.tgz#30ca66f827d44ccabb02b359119f68549fa3edf0"
|
||||
integrity sha512-Bjhv+zzcQxhwV4I7si+yDls8sSetksILeiBemfRe3cvE4GOgs7KfsYI5+pqNmBZ5rrFPt3KUeN9vIo31LCgZOw==
|
||||
"@atproto/dev-env@^0.3.215":
|
||||
version "0.3.215"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/dev-env/-/dev-env-0.3.215.tgz#9da8c4a73abb4501ac72c73da9536e2ec86cb46f"
|
||||
integrity sha512-zwZwGWYLgP2Zdie6/gMtxuDbSs7/UV/gPJYfOlXln1ZDoMkfFbgCTq44PWRnJpUKTzrq7gt19E0GsL7DMkppjA==
|
||||
dependencies:
|
||||
"@atproto/api" "^0.19.2"
|
||||
"@atproto/bsky" "^0.0.219"
|
||||
"@atproto/bsync" "^0.0.24"
|
||||
"@atproto/common-web" "^0.4.18"
|
||||
"@atproto/api" "^0.19.4"
|
||||
"@atproto/bsky" "^0.0.221"
|
||||
"@atproto/bsync" "^0.0.25"
|
||||
"@atproto/common-web" "^0.4.19"
|
||||
"@atproto/crypto" "^0.4.5"
|
||||
"@atproto/identity" "^0.4.12"
|
||||
"@atproto/lexicon" "^0.6.2"
|
||||
"@atproto/ozone" "^0.1.166"
|
||||
"@atproto/pds" "^0.4.214"
|
||||
"@atproto/ozone" "^0.1.167"
|
||||
"@atproto/pds" "^0.4.216"
|
||||
"@atproto/sync" "^0.1.40"
|
||||
"@atproto/syntax" "^0.5.0"
|
||||
"@atproto/xrpc-server" "^0.10.15"
|
||||
"@atproto/syntax" "^0.5.1"
|
||||
"@atproto/xrpc-server" "^0.10.17"
|
||||
"@did-plc/lib" "^0.0.1"
|
||||
"@did-plc/server" "^0.0.1"
|
||||
dotenv "^16.0.3"
|
||||
@@ -288,6 +309,14 @@
|
||||
"@atproto/lex-data" "^0.0.13"
|
||||
tslib "^2.8.1"
|
||||
|
||||
"@atproto/lex-cbor@^0.0.15":
|
||||
version "0.0.15"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/lex-cbor/-/lex-cbor-0.0.15.tgz#ae4558d8ce22119710ad22feb458d22774b3ca3b"
|
||||
integrity sha512-3osDicK9bAMXJlKjLKqwYrhLQ60bOguWBNjE+fuNjMuizNzC0aqaClE3d+qMsFuFq9bjEHFw+4Vr9Qmd/m6VYg==
|
||||
dependencies:
|
||||
"@atproto/lex-data" "^0.0.14"
|
||||
tslib "^2.8.1"
|
||||
|
||||
"@atproto/lex-client@^0.0.15":
|
||||
version "0.0.15"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/lex-client/-/lex-client-0.0.15.tgz#c647d14e91ca3f52feebf4b34f80abb7e93b3bee"
|
||||
@@ -298,6 +327,16 @@
|
||||
"@atproto/lex-schema" "^0.0.14"
|
||||
tslib "^2.8.1"
|
||||
|
||||
"@atproto/lex-client@^0.0.17":
|
||||
version "0.0.17"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/lex-client/-/lex-client-0.0.17.tgz#566689a288f8b2af31f4a0fa081496dfaaef7278"
|
||||
integrity sha512-lZ9clUjWgpno1XhSawQP+1/JeIYA9qBh759b/NSU0OiypQqgq7IxDvmzaBsiHK1sqjo0tyEkmG4X5Ym7YXjv0Q==
|
||||
dependencies:
|
||||
"@atproto/lex-data" "^0.0.14"
|
||||
"@atproto/lex-json" "^0.0.14"
|
||||
"@atproto/lex-schema" "^0.0.16"
|
||||
tslib "^2.8.1"
|
||||
|
||||
"@atproto/lex-data@^0.0.13":
|
||||
version "0.0.13"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/lex-data/-/lex-data-0.0.13.tgz#db1bcfa12d5056210f6eb7f3b8bac909909d6b9c"
|
||||
@@ -308,12 +347,22 @@
|
||||
uint8arrays "3.0.0"
|
||||
unicode-segmenter "^0.14.0"
|
||||
|
||||
"@atproto/lex-document@^0.0.15":
|
||||
version "0.0.15"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/lex-document/-/lex-document-0.0.15.tgz#b2f19756291a0d259cd99f5ebe4872e9133069b6"
|
||||
integrity sha512-QT2MbICG4cTFrrA19SIHpZJ33WRLdzjhDsEhSknQ4dE5CjqPf4BP9LaC4pOeW8NE5Kn92hgIm3JWNjoak8blXw==
|
||||
"@atproto/lex-data@^0.0.14":
|
||||
version "0.0.14"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/lex-data/-/lex-data-0.0.14.tgz#2f2f3c64699925a0d4785e5afd0e7731ba1d46c0"
|
||||
integrity sha512-53DUa9664SS76nGAMYopWsO10OH0AAdf7P/HSKB6Wzx3iqe6lk/K61QZnKxOG1LreYl5CfvIJU6eNf4txI6GlQ==
|
||||
dependencies:
|
||||
"@atproto/lex-schema" "^0.0.14"
|
||||
multiformats "^9.9.0"
|
||||
tslib "^2.8.1"
|
||||
uint8arrays "3.0.0"
|
||||
unicode-segmenter "^0.14.0"
|
||||
|
||||
"@atproto/lex-document@^0.0.17":
|
||||
version "0.0.17"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/lex-document/-/lex-document-0.0.17.tgz#8460096235910bf5ec8305f03a8da6bab8d8a12b"
|
||||
integrity sha512-rQiDCSYQwze4+kaArUtmp4bjZ9rV3vYUMhjdDwmZCKodpppNEYrP5AQzyKlxBtKO+MRdLYwHDDwwvakU8atRww==
|
||||
dependencies:
|
||||
"@atproto/lex-schema" "^0.0.16"
|
||||
core-js "^3"
|
||||
tslib "^2.8.1"
|
||||
|
||||
@@ -325,19 +374,27 @@
|
||||
"@atproto/lex-data" "^0.0.13"
|
||||
tslib "^2.8.1"
|
||||
|
||||
"@atproto/lex-resolver@^0.0.17":
|
||||
version "0.0.17"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/lex-resolver/-/lex-resolver-0.0.17.tgz#2c474f6babeb54665656bf28b8d27a98de69deae"
|
||||
integrity sha512-6nI5bYZUYh50ZI8r4erLRP9EbNcW226VShpVN3vHyOSgTje4VP1RTcvBhROBAPj4rL3vc+Oa8OiL6IQXkYrQBg==
|
||||
"@atproto/lex-json@^0.0.14":
|
||||
version "0.0.14"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/lex-json/-/lex-json-0.0.14.tgz#717e533ab583aa5f580acb2a77d9aa3e7eddaa17"
|
||||
integrity sha512-6lPkDKqe7teEu4WrN5q7400cvZKgYS3uwUMvzG3F9XkgVYhOwSDCtouV/nSLBbpvo3l9OP0kiigtclcNcyekww==
|
||||
dependencies:
|
||||
"@atproto/lex-data" "^0.0.14"
|
||||
tslib "^2.8.1"
|
||||
|
||||
"@atproto/lex-resolver@^0.0.19":
|
||||
version "0.0.19"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/lex-resolver/-/lex-resolver-0.0.19.tgz#806fcb71e72d0db51e2eb29c594eddb8c4087414"
|
||||
integrity sha512-oATn4RpZNLh5rp9doN5/UOYS/Cd25GOD90ohB5jnnmeoF8jTupqIYTVhntbnx1EFn+5tTlgkyXEBV+XESBUcdQ==
|
||||
dependencies:
|
||||
"@atproto-labs/did-resolver" "^0.2.6"
|
||||
"@atproto/crypto" "^0.4.5"
|
||||
"@atproto/lex-client" "^0.0.15"
|
||||
"@atproto/lex-data" "^0.0.13"
|
||||
"@atproto/lex-document" "^0.0.15"
|
||||
"@atproto/lex-schema" "^0.0.14"
|
||||
"@atproto/repo" "^0.8.12"
|
||||
"@atproto/syntax" "^0.5.0"
|
||||
"@atproto/lex-client" "^0.0.17"
|
||||
"@atproto/lex-data" "^0.0.14"
|
||||
"@atproto/lex-document" "^0.0.17"
|
||||
"@atproto/lex-schema" "^0.0.16"
|
||||
"@atproto/repo" "^0.8.13"
|
||||
"@atproto/syntax" "^0.5.1"
|
||||
tslib "^2.8.1"
|
||||
|
||||
"@atproto/lex-schema@^0.0.14":
|
||||
@@ -349,6 +406,17 @@
|
||||
"@atproto/syntax" "^0.5.0"
|
||||
tslib "^2.8.1"
|
||||
|
||||
"@atproto/lex-schema@^0.0.16":
|
||||
version "0.0.16"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/lex-schema/-/lex-schema-0.0.16.tgz#8362932e239b7eaa7c5d6982d06c3147e3afd138"
|
||||
integrity sha512-O+IorivZHJPeV3kU3NDD2yI8ATfckOphgvDfeiyKHRTxRUKS+lHMCpGUiSTC3fJrfMvYITrruUVViUHVEScrbA==
|
||||
dependencies:
|
||||
"@atproto/lex-data" "^0.0.14"
|
||||
"@atproto/syntax" "^0.5.1"
|
||||
"@standard-schema/spec" "^1.1.0"
|
||||
iso-datestring-validator "^2.2.2"
|
||||
tslib "^2.8.1"
|
||||
|
||||
"@atproto/lexicon@^0.6.0", "@atproto/lexicon@^0.6.2":
|
||||
version "0.6.2"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/lexicon/-/lexicon-0.6.2.tgz#f6152a2119df953236ca127c4b30e332265e81e7"
|
||||
@@ -382,28 +450,28 @@
|
||||
optionalDependencies:
|
||||
"@atproto/oauth-provider-api" "0.3.7"
|
||||
|
||||
"@atproto/oauth-provider@^0.15.12":
|
||||
version "0.15.12"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/oauth-provider/-/oauth-provider-0.15.12.tgz#9dbbfdd6808399d9d7ff8993ac888938fbf4c515"
|
||||
integrity sha512-Ri4aVx2I4lOKxViB92jwPhAs/NctWEwV0tgYSHcaRpvqr2SVlC2LxTVjUq14ohdbVfv4VFRzj0vZypEX+mclHg==
|
||||
"@atproto/oauth-provider@^0.15.14":
|
||||
version "0.15.14"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/oauth-provider/-/oauth-provider-0.15.14.tgz#d969018b4ad5c0dd5863150cb8c1b65458738589"
|
||||
integrity sha512-arA3O+Ye1YBhoIUnZtn8wfatnVnwiZrGyNkxhH0nqGbh/RRfwA5W0tgnSDq0VMclLkrPY/OnZ4v3oo9N81yWGg==
|
||||
dependencies:
|
||||
"@atproto-labs/fetch" "^0.2.3"
|
||||
"@atproto-labs/fetch-node" "^0.2.0"
|
||||
"@atproto-labs/pipe" "^0.1.1"
|
||||
"@atproto-labs/simple-store" "^0.3.0"
|
||||
"@atproto-labs/simple-store-memory" "^0.1.4"
|
||||
"@atproto/common" "^0.5.14"
|
||||
"@atproto/common" "^0.5.15"
|
||||
"@atproto/did" "^0.3.0"
|
||||
"@atproto/jwk" "^0.6.0"
|
||||
"@atproto/jwk-jose" "^0.1.11"
|
||||
"@atproto/lex-document" "^0.0.15"
|
||||
"@atproto/lex-resolver" "^0.0.17"
|
||||
"@atproto/lex-document" "^0.0.17"
|
||||
"@atproto/lex-resolver" "^0.0.19"
|
||||
"@atproto/oauth-provider-api" "0.3.7"
|
||||
"@atproto/oauth-provider-frontend" "0.2.9"
|
||||
"@atproto/oauth-provider-ui" "0.4.3"
|
||||
"@atproto/oauth-scopes" "^0.3.2"
|
||||
"@atproto/oauth-types" "^0.6.3"
|
||||
"@atproto/syntax" "^0.5.0"
|
||||
"@atproto/syntax" "^0.5.1"
|
||||
"@hapi/accept" "^6.0.3"
|
||||
"@hapi/address" "^5.1.1"
|
||||
"@hapi/bourne" "^3.0.0"
|
||||
@@ -442,20 +510,20 @@
|
||||
"@atproto/jwk" "^0.6.0"
|
||||
zod "^3.23.8"
|
||||
|
||||
"@atproto/ozone@^0.1.166":
|
||||
version "0.1.166"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/ozone/-/ozone-0.1.166.tgz#9e65d6f67ef1fe285d0880e5f5a1b282dc63bd70"
|
||||
integrity sha512-XZ77P/V/tt3SqTQYRsi5nM3P2h+QaNT7Nz3GTf+TMLVolACufRHPoDgp/PoTuS2FaLj1ndHnGyIPvZi/o8he6g==
|
||||
"@atproto/ozone@^0.1.167":
|
||||
version "0.1.167"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/ozone/-/ozone-0.1.167.tgz#c3974bbe06f0926f165f90d5ba51ba9ce2032fff"
|
||||
integrity sha512-AFquyND8zsskjkDc3WrQObUnZlEky05pFo0YYLy5JoqQN0WXIePLgGY0SC0EIokfF8iYXJE1ZM1u/dgA7DHqGQ==
|
||||
dependencies:
|
||||
"@atproto/api" "^0.19.2"
|
||||
"@atproto/api" "^0.19.4"
|
||||
"@atproto/common" "^0.5.14"
|
||||
"@atproto/crypto" "^0.4.5"
|
||||
"@atproto/identity" "^0.4.12"
|
||||
"@atproto/lexicon" "^0.6.2"
|
||||
"@atproto/syntax" "^0.5.0"
|
||||
"@atproto/syntax" "^0.5.1"
|
||||
"@atproto/ws-client" "^0.0.4"
|
||||
"@atproto/xrpc" "^0.7.7"
|
||||
"@atproto/xrpc-server" "^0.10.15"
|
||||
"@atproto/xrpc-server" "^0.10.16"
|
||||
"@did-plc/lib" "^0.0.1"
|
||||
compression "^1.7.4"
|
||||
cors "^2.8.5"
|
||||
@@ -473,30 +541,30 @@
|
||||
undici "^6.14.1"
|
||||
ws "^8.12.0"
|
||||
|
||||
"@atproto/pds@^0.4.214":
|
||||
version "0.4.214"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/pds/-/pds-0.4.214.tgz#c68d55ec0b00a4e35f4801c826d44b65cd62f984"
|
||||
integrity sha512-bTWeWg3H0TlELfE2eI2ySQuC6ojsCBSSmPtCXBh3Td9TFNpIoZQ/tYLUJMtMXaiVUi6HxzXQL1/iuYfC4Y+ZYQ==
|
||||
"@atproto/pds@^0.4.216":
|
||||
version "0.4.216"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/pds/-/pds-0.4.216.tgz#4d9c73a529bd00893753aba1e7bb33f99b9aaaf4"
|
||||
integrity sha512-yPNatCb2kvudRp5DMbPemN1+uMsLOJDydw2PCBMxuzdimOf10PsekOhhZxtfGGRvk2NbvKoyfUvkROoFmTr+ew==
|
||||
dependencies:
|
||||
"@atproto-labs/fetch-node" "^0.2.0"
|
||||
"@atproto-labs/simple-store" "^0.3.0"
|
||||
"@atproto-labs/simple-store-memory" "^0.1.4"
|
||||
"@atproto-labs/simple-store-redis" "^0.0.1"
|
||||
"@atproto-labs/xrpc-utils" "^0.0.24"
|
||||
"@atproto/api" "^0.19.2"
|
||||
"@atproto/api" "^0.19.4"
|
||||
"@atproto/aws" "^0.2.31"
|
||||
"@atproto/common" "^0.5.14"
|
||||
"@atproto/common" "^0.5.15"
|
||||
"@atproto/crypto" "^0.4.5"
|
||||
"@atproto/identity" "^0.4.12"
|
||||
"@atproto/lex-cbor" "^0.0.14"
|
||||
"@atproto/lex-data" "^0.0.13"
|
||||
"@atproto/lex-cbor" "^0.0.15"
|
||||
"@atproto/lex-data" "^0.0.14"
|
||||
"@atproto/lexicon" "^0.6.2"
|
||||
"@atproto/oauth-provider" "^0.15.12"
|
||||
"@atproto/oauth-provider" "^0.15.14"
|
||||
"@atproto/oauth-scopes" "^0.3.2"
|
||||
"@atproto/repo" "^0.8.12"
|
||||
"@atproto/syntax" "^0.5.0"
|
||||
"@atproto/repo" "^0.8.13"
|
||||
"@atproto/syntax" "^0.5.1"
|
||||
"@atproto/xrpc" "^0.7.7"
|
||||
"@atproto/xrpc-server" "^0.10.15"
|
||||
"@atproto/xrpc-server" "^0.10.17"
|
||||
"@did-plc/lib" "^0.0.4"
|
||||
"@hapi/address" "^5.1.1"
|
||||
better-sqlite3 "^10.0.0"
|
||||
@@ -540,6 +608,21 @@
|
||||
varint "^6.0.0"
|
||||
zod "^3.23.8"
|
||||
|
||||
"@atproto/repo@^0.8.13":
|
||||
version "0.8.13"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/repo/-/repo-0.8.13.tgz#70160b8b3f78b6addcba7cf3e3ae06306e6b6641"
|
||||
integrity sha512-VS8XHaBMGdq60xwRI5zQmXzsMF1hU7NKPjmkdr65tJdrv2z0VW77mG01Ui19Xh9O0mUc/LG6GEhwVrabB9Txow==
|
||||
dependencies:
|
||||
"@atproto/common" "^0.5.14"
|
||||
"@atproto/common-web" "^0.4.18"
|
||||
"@atproto/crypto" "^0.4.5"
|
||||
"@atproto/lexicon" "^0.6.2"
|
||||
"@ipld/dag-cbor" "^7.0.0"
|
||||
multiformats "^9.9.0"
|
||||
uint8arrays "3.0.0"
|
||||
varint "^6.0.0"
|
||||
zod "^3.23.8"
|
||||
|
||||
"@atproto/sync@^0.1.40":
|
||||
version "0.1.40"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/sync/-/sync-0.1.40.tgz#b8b467ac4fbf2e682d36cd5697508f993e9e645a"
|
||||
@@ -562,6 +645,13 @@
|
||||
dependencies:
|
||||
tslib "^2.8.1"
|
||||
|
||||
"@atproto/syntax@^0.5.1":
|
||||
version "0.5.1"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/syntax/-/syntax-0.5.1.tgz#78257b903a0723720dca32110379208791ac3c24"
|
||||
integrity sha512-J8DJjgKgACIyCTbpfvoTnf7+ofTx1kxTGO7KAftkC+jczaMdQhKdgIBAg2DaYy+80cvYGTHy5q/HI9qMAwGbWw==
|
||||
dependencies:
|
||||
tslib "^2.8.1"
|
||||
|
||||
"@atproto/ws-client@^0.0.4":
|
||||
version "0.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/ws-client/-/ws-client-0.0.4.tgz#9e436c0e72abea5da0d5a7e8ec862cec0fdb10cd"
|
||||
@@ -591,6 +681,27 @@
|
||||
rate-limiter-flexible "^2.4.1"
|
||||
ws "^8.12.0"
|
||||
|
||||
"@atproto/xrpc-server@^0.10.16", "@atproto/xrpc-server@^0.10.17":
|
||||
version "0.10.17"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/xrpc-server/-/xrpc-server-0.10.17.tgz#1016d4a6d97966a3f80e8785e5d5cba7b68c1c60"
|
||||
integrity sha512-FjexO6P/LRTx6/FdiWTzycFF4TgACW9npsFOitnocydTCOLYouP0OvUwdkxkreFC7qerT4+ARKpqrxRzyj0MNA==
|
||||
dependencies:
|
||||
"@atproto/common" "^0.5.15"
|
||||
"@atproto/crypto" "^0.4.5"
|
||||
"@atproto/lex-cbor" "^0.0.15"
|
||||
"@atproto/lex-client" "^0.0.17"
|
||||
"@atproto/lex-data" "^0.0.14"
|
||||
"@atproto/lex-json" "^0.0.14"
|
||||
"@atproto/lex-schema" "^0.0.16"
|
||||
"@atproto/lexicon" "^0.6.2"
|
||||
"@atproto/ws-client" "^0.0.4"
|
||||
"@atproto/xrpc" "^0.7.7"
|
||||
express "^4.17.2"
|
||||
http-errors "^2.0.0"
|
||||
mime-types "^2.1.35"
|
||||
rate-limiter-flexible "^2.4.1"
|
||||
ws "^8.12.0"
|
||||
|
||||
"@atproto/xrpc@^0.7.6", "@atproto/xrpc@^0.7.7":
|
||||
version "0.7.7"
|
||||
resolved "https://registry.yarnpkg.com/@atproto/xrpc/-/xrpc-0.7.7.tgz#c0e3106c854cb9bc7d3129de2f31b8256eb0ed11"
|
||||
@@ -2146,6 +2257,11 @@
|
||||
dependencies:
|
||||
tslib "^2.6.2"
|
||||
|
||||
"@standard-schema/spec@^1.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@standard-schema/spec/-/spec-1.1.0.tgz#a79b55dbaf8604812f52d140b2c9ab41bc150bb8"
|
||||
integrity sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==
|
||||
|
||||
"@tokenizer/token@^0.3.0":
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@tokenizer/token/-/token-0.3.0.tgz#fe98a93fe789247e998c75e74e9c7c63217aa276"
|
||||
@@ -4146,10 +4262,10 @@ typed-emitter@^2.1.0:
|
||||
optionalDependencies:
|
||||
rxjs "^7.5.2"
|
||||
|
||||
typescript@^5.9.3:
|
||||
version "5.9.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f"
|
||||
integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==
|
||||
typescript@^6.0.2:
|
||||
version "6.0.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-6.0.2.tgz#0b1bfb15f68c64b97032f3d78abbf98bdbba501f"
|
||||
integrity sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==
|
||||
|
||||
uglify-js@^3.1.4:
|
||||
version "3.19.3"
|
||||
|
||||
@@ -47,7 +47,6 @@ export default defineConfig(
|
||||
js.configs.recommended,
|
||||
tseslint.configs.recommendedTypeChecked,
|
||||
reactHooks.configs.flat.recommended,
|
||||
// @ts-expect-error https://github.com/un-ts/eslint-plugin-import-x/issues/439
|
||||
importX.flatConfigs.recommended,
|
||||
importX.flatConfigs.typescript,
|
||||
importX.flatConfigs['react-native'],
|
||||
@@ -62,6 +61,7 @@ export default defineConfig(
|
||||
'react-native': reactNative,
|
||||
'react-native-a11y': reactNativeA11y,
|
||||
'simple-import-sort': simpleImportSort,
|
||||
// @ts-expect-error - not sure why
|
||||
lingui,
|
||||
'react-compiler': reactCompiler,
|
||||
'bsky-internal': bskyInternal,
|
||||
@@ -127,6 +127,7 @@ export default defineConfig(
|
||||
*/
|
||||
...react.configs.recommended.rules,
|
||||
...react.configs['jsx-runtime'].rules,
|
||||
'react/hook-use-state': 'warn',
|
||||
'react/no-unescaped-entities': 'off',
|
||||
'react/prop-types': 'off',
|
||||
'react-native/no-inline-styles': 'off',
|
||||
@@ -189,6 +190,18 @@ export default defineConfig(
|
||||
*/
|
||||
ignore: ['^#\/locale\/locales\/.+\/messages'],
|
||||
}],
|
||||
'import-x/no-extraneous-dependencies': ['error', {
|
||||
'whitelist': [
|
||||
// test files only
|
||||
'@jest/globals',
|
||||
// we only use a really simple util from this, and we know it will be present
|
||||
'expo-modules-core',
|
||||
// this is a dep for @atproto/api, but we absolutely need them in sync, so just
|
||||
// rely on the transient version
|
||||
'@atproto/common-web',
|
||||
]
|
||||
}],
|
||||
'import-x/no-nodejs-modules': 'error',
|
||||
|
||||
/**
|
||||
* TypeScript-specific rules
|
||||
@@ -237,6 +250,14 @@ export default defineConfig(
|
||||
'@typescript-eslint/prefer-promise-reject-errors': 'warn',
|
||||
'@typescript-eslint/await-thenable': 'warn',
|
||||
|
||||
"no-restricted-imports": ["error", {
|
||||
"paths": [{
|
||||
"name": "react",
|
||||
"importNames": ["React", "default"],
|
||||
"message": "React is already in the global type namespace. Use named imports for runtime modules."
|
||||
}]
|
||||
}],
|
||||
|
||||
/**
|
||||
* Turn off rules that we haven't enforced thus far
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,7 @@ function getTagName(node) {
|
||||
return reversedIdentifiers.reverse().join('.')
|
||||
}
|
||||
|
||||
/** @type {import('eslint').Rule.RuleModule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
|
||||
@@ -3,6 +3,7 @@ const BANNED_IMPORTS = [
|
||||
'@fortawesome/free-solid-svg-icons',
|
||||
]
|
||||
|
||||
/** @type {import('eslint').Rule.RuleModule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
|
||||
@@ -10,6 +10,7 @@ const BANNED_IMPORT_PREFIXES = [
|
||||
'view/',
|
||||
]
|
||||
|
||||
/** @type {import('eslint').Rule.RuleModule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
|
||||
@@ -9,6 +9,7 @@ jest.mock('@react-native-async-storage/async-storage', () =>
|
||||
require('@react-native-async-storage/async-storage/jest/async-storage-mock'),
|
||||
)
|
||||
jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter', () => {
|
||||
// eslint-disable-next-line import-x/no-nodejs-modules
|
||||
const {EventEmitter} = require('events')
|
||||
return {
|
||||
__esModule: true,
|
||||
@@ -60,9 +61,13 @@ jest.mock('expo-media-library', () => ({
|
||||
usePermissions: jest.fn(() => [true]),
|
||||
}))
|
||||
|
||||
jest.mock('lande', () => ({
|
||||
__esModule: true, // this property makes it work
|
||||
default: jest.fn().mockReturnValue([['eng']]),
|
||||
jest.mock('@bsky.app/expo-guess-language', () => ({
|
||||
guessLanguageSync: jest
|
||||
.fn()
|
||||
.mockReturnValue([{language: 'en', confidence: 1}]),
|
||||
guessLanguageAsync: jest
|
||||
.fn()
|
||||
.mockResolvedValue([{language: 'en', confidence: 1}]),
|
||||
}))
|
||||
|
||||
jest.mock('sentry-expo', () => ({
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import {GestureHandlerRootView} from 'react-native-gesture-handler'
|
||||
import {SafeAreaProvider} from 'react-native-safe-area-context'
|
||||
import {render} from '@testing-library/react-native'
|
||||
|
||||
import {ThemeProvider} from '../src/lib/ThemeContext'
|
||||
import {type RootStoreModel, RootStoreProvider} from '../src/state'
|
||||
|
||||
const customRender = (ui: any, rootStore: RootStoreModel) =>
|
||||
render(
|
||||
<GestureHandlerRootView style={{flex: 1}}>
|
||||
<RootStoreProvider value={rootStore}>
|
||||
<ThemeProvider theme="light">
|
||||
<SafeAreaProvider>{ui}</SafeAreaProvider>
|
||||
</ThemeProvider>
|
||||
</RootStoreProvider>
|
||||
</GestureHandlerRootView>,
|
||||
)
|
||||
|
||||
// re-export everything
|
||||
export * from '@testing-library/react-native'
|
||||
|
||||
// override render method
|
||||
export {customRender as render}
|
||||
@@ -0,0 +1,134 @@
|
||||
# BlueskyClip
|
||||
|
||||
An iOS App Clip implementation for Bluesky starter packs. App Clips are lightweight app experiences that allow users to preview and join Bluesky through starter packs without installing the full app.
|
||||
|
||||
## What It Does
|
||||
|
||||
BlueskyClip provides a minimal, on-demand iOS app experience for viewing and joining Bluesky starter packs. When a user encounters a starter pack link (e.g., `bsky.app/start/...` or `go.bsky.app/...`), iOS can present the App Clip instead of requiring a full app install. The App Clip:
|
||||
|
||||
1. Loads the starter pack web page in a WKWebView
|
||||
2. Allows users to browse the starter pack content
|
||||
3. Presents the App Store overlay when the user decides to join
|
||||
4. Passes the starter pack URI to the main app via shared UserDefaults
|
||||
|
||||
## Architecture
|
||||
|
||||
### Native iOS Implementation
|
||||
|
||||
The App Clip is a standalone iOS target with its own minimal Swift implementation:
|
||||
|
||||
- **AppDelegate.swift**: Standard app delegate that sets up the view controller and handles URL routing (both direct URL opens and universal links)
|
||||
- **ViewController.swift**: Main view controller that manages the WKWebView, detects starter pack URLs, and communicates with the web layer
|
||||
|
||||
### Communication Flow
|
||||
|
||||
```
|
||||
User taps starter pack link
|
||||
↓
|
||||
iOS presents BlueskyClip App Clip
|
||||
↓
|
||||
WKWebView loads bsky.app with ?clip=true parameter
|
||||
↓
|
||||
Web app detects clip mode and sends actions via postMessage
|
||||
↓
|
||||
ViewController receives messages and:
|
||||
- Presents App Store overlay (action: "present")
|
||||
- Stores starter pack URI in shared UserDefaults (action: "store")
|
||||
↓
|
||||
User downloads main app
|
||||
↓
|
||||
Main app reads starterPackUri from shared UserDefaults
|
||||
↓
|
||||
Main app displays starter pack onboarding flow
|
||||
```
|
||||
|
||||
### Key Implementation Details
|
||||
|
||||
**URL Detection** (`isStarterPackUrl`):
|
||||
- Matches `bsky.app/start/*` and `bsky.app/starter-pack/*` paths (4 path components)
|
||||
- Matches short links `go.bsky.app/*` (2 path components)
|
||||
|
||||
**WebView Communication** (`WKScriptMessageHandler`):
|
||||
- Listens for messages on the "onMessage" channel
|
||||
- Handles two action types:
|
||||
- `present`: Shows the App Store overlay using `SKOverlay`
|
||||
- `store`: Writes JSON data to shared UserDefaults with the specified key
|
||||
|
||||
**Data Sharing**:
|
||||
- Uses UserDefaults suite `group.app.bsky` (App Group)
|
||||
- Primary key: `starterPackUri` - stores the starter pack URL
|
||||
- The main app reads this value on launch via `SharedPrefs.getString('starterPackUri')` (see `src/components/hooks/useStarterPackEntry.native.ts`)
|
||||
|
||||
## Configuration
|
||||
|
||||
### Build Configuration
|
||||
|
||||
The App Clip target is automatically configured via Expo config plugins located in `/plugins/starterPackAppClipExtension/`:
|
||||
|
||||
- **withStarterPackAppClip.js**: Main plugin that orchestrates all configuration
|
||||
- **withXcodeTarget.js**: Creates the App Clip target in Xcode with proper build settings
|
||||
- **withAppEntitlements.js**: Configures main app entitlements for App Clip association
|
||||
- **withClipEntitlements.js**: Sets up App Clip entitlements (App Groups, parent app identifier, associated domains)
|
||||
- **withClipInfoPlist.js**: Generates the Info.plist for the App Clip target
|
||||
- **withFiles.js**: Copies Swift source files and assets from `modules/BlueskyClip/` to the iOS build directory
|
||||
|
||||
### Entitlements
|
||||
|
||||
**Main App** (`app.entitlements`):
|
||||
- `com.apple.security.application-groups`: `group.app.bsky`
|
||||
- `com.apple.developer.associated-appclip-app-identifiers`: Links to the App Clip bundle ID
|
||||
|
||||
**App Clip** (`BlueskyClip.entitlements`):
|
||||
- `com.apple.security.application-groups`: `group.app.bsky` (for data sharing)
|
||||
- `com.apple.developer.parent-application-identifiers`: Links to the main app bundle ID
|
||||
- `com.apple.developer.associated-domains`: Inherits from main app config (for universal links)
|
||||
|
||||
### Build Settings
|
||||
|
||||
- Deployment target: iOS 15.1+
|
||||
- Bundle ID: `[main-app-bundle-id].AppClip`
|
||||
- Product type: `com.apple.product-type.application.on-demand-install-capable`
|
||||
- Development team: `B3LX46C5HS`
|
||||
- Device family: iPhone only (1)
|
||||
|
||||
## Platform Support
|
||||
|
||||
- **iOS**: Full support via native App Clip
|
||||
- **Android**: Not applicable (no App Clip equivalent)
|
||||
- **Web**: Not applicable (web uses standard starter pack landing pages)
|
||||
|
||||
## Integration with Main App
|
||||
|
||||
The main app detects App Clip-originated starter packs through `useStarterPackEntry` hook:
|
||||
|
||||
**Native** (`src/components/hooks/useStarterPackEntry.native.ts`):
|
||||
- Reads `starterPackUri` from `SharedPrefs` (App Group)
|
||||
- Clears the value after reading to prevent re-use
|
||||
- Sets active starter pack in app state
|
||||
|
||||
**Web** (`src/components/hooks/useStarterPackEntry.ts`):
|
||||
- Detects `?clip=true` URL parameter
|
||||
- Extracts starter pack URI from URL
|
||||
- Sets active starter pack with `isClip: true` flag
|
||||
|
||||
## Files
|
||||
|
||||
```
|
||||
modules/BlueskyClip/
|
||||
├── AppDelegate.swift # App lifecycle and URL handling
|
||||
├── ViewController.swift # WebView management and message handling
|
||||
└── Images.xcassets/ # App Clip icon assets
|
||||
├── AppIcon.appiconset/
|
||||
│ ├── App-Icon-1024x1024@1x.png
|
||||
│ └── Contents.json
|
||||
└── Contents.json
|
||||
```
|
||||
|
||||
## Development Notes
|
||||
|
||||
- The App Clip is built as part of the main Xcode project when running `yarn prebuild`
|
||||
- Source files are copied during the prebuild process, not directly referenced
|
||||
- Changes to Swift files require running `yarn prebuild` to take effect
|
||||
- The App Clip shares the same version number as the main app
|
||||
- App Clips have a 15MB size limit (enforced by Apple)
|
||||
- Users can convert an App Clip session into a full app install without losing data (via shared App Group)
|
||||
@@ -8,6 +8,13 @@
|
||||
<string>com.apple.usernotifications.service</string>
|
||||
<key>NSExtensionPrincipalClass</key>
|
||||
<string>$(PRODUCT_MODULE_NAME).NotificationService</string>
|
||||
<key>NSExtensionAttributes</key>
|
||||
<dict>
|
||||
<key>IntentsSupported</key>
|
||||
<array>
|
||||
<string>INSendMessageIntent</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>MainAppScheme</key>
|
||||
<string>bluesky</string>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import UserNotifications
|
||||
import UIKit
|
||||
import Intents
|
||||
|
||||
let APP_GROUP = "group.app.bsky"
|
||||
typealias ContentHandler = (UNNotificationContent) -> Void
|
||||
@@ -40,17 +41,18 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
}
|
||||
|
||||
self.bestAttempt = bestAttempt
|
||||
if reason == "chat-message" {
|
||||
|
||||
if reason == "chat-message" || reason == "chat-reaction" {
|
||||
mutateWithChatMessage(bestAttempt)
|
||||
let finalContent = createCommunicationNotification(
|
||||
from: bestAttempt,
|
||||
userInfo: request.content.userInfo
|
||||
)
|
||||
contentHandler(finalContent)
|
||||
} else {
|
||||
mutateWithBadge(bestAttempt)
|
||||
contentHandler(bestAttempt)
|
||||
}
|
||||
|
||||
// Any image downloading (or other network tasks) should be handled at the end
|
||||
// of this block. Otherwise, if there is a timeout and serviceExtensionTimeWillExpire
|
||||
// gets called, we might not have all the needed mutations completed in time.
|
||||
|
||||
contentHandler(bestAttempt)
|
||||
}
|
||||
|
||||
override func serviceExtensionTimeWillExpire() {
|
||||
@@ -61,6 +63,81 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
contentHandler(bestAttempt)
|
||||
}
|
||||
|
||||
// MARK: Communication Notification
|
||||
|
||||
func createCommunicationNotification(
|
||||
from content: UNMutableNotificationContent,
|
||||
userInfo: [AnyHashable: Any]
|
||||
) -> UNNotificationContent {
|
||||
let senderDisplayName = userInfo["senderDisplayName"] as? String ?? "Unknown"
|
||||
let convoId = userInfo["convoId"] as? String
|
||||
var avatarImage: INImage? = nil
|
||||
if let avatarUrlString = userInfo["senderAvatarUrl"] as? String {
|
||||
avatarImage = downloadAvatarImage(from: avatarUrlString)
|
||||
}
|
||||
|
||||
let senderHandleValue = userInfo["senderHandle"] as? String
|
||||
let senderHandle = INPersonHandle(value: senderHandleValue, type: .unknown)
|
||||
let sender = INPerson(
|
||||
personHandle: senderHandle,
|
||||
nameComponents: nil,
|
||||
displayName: senderDisplayName,
|
||||
image: avatarImage,
|
||||
contactIdentifier: nil,
|
||||
customIdentifier: nil
|
||||
)
|
||||
|
||||
let intent = INSendMessageIntent(
|
||||
recipients: nil,
|
||||
outgoingMessageType: .outgoingMessageText,
|
||||
content: content.body,
|
||||
speakableGroupName: nil,
|
||||
conversationIdentifier: convoId,
|
||||
serviceName: nil,
|
||||
sender: sender,
|
||||
attachments: nil
|
||||
)
|
||||
|
||||
let interaction = INInteraction(intent: intent, response: nil)
|
||||
interaction.direction = .incoming
|
||||
interaction.donate(completion: nil)
|
||||
|
||||
do {
|
||||
return try content.updating(from: intent)
|
||||
} catch {
|
||||
return content
|
||||
}
|
||||
}
|
||||
|
||||
func downloadAvatarImage(from urlString: String) -> INImage? {
|
||||
let thumbnailUrlString = urlString.replacingOccurrences(
|
||||
of: "/img/avatar/",
|
||||
with: "/img/avatar_thumbnail/"
|
||||
)
|
||||
|
||||
guard let url = URL(string: thumbnailUrlString) else { return nil }
|
||||
|
||||
var request = URLRequest(url: url)
|
||||
request.timeoutInterval = 5
|
||||
|
||||
var imageData: Data? = nil
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
|
||||
let task = URLSession.shared.dataTask(with: request) { data, response, error in
|
||||
if let data = data,
|
||||
let httpResponse = response as? HTTPURLResponse,
|
||||
httpResponse.statusCode == 200 {
|
||||
imageData = data
|
||||
}
|
||||
semaphore.signal()
|
||||
}
|
||||
task.resume()
|
||||
semaphore.wait()
|
||||
|
||||
guard let data = imageData else { return nil }
|
||||
return INImage(imageData: data)
|
||||
}
|
||||
|
||||
// MARK: Mutations
|
||||
|
||||
func mutateWithBadge(_ content: UNMutableNotificationContent) {
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
# BlueskyNSE
|
||||
|
||||
BlueskyNSE is an iOS Notification Service Extension that processes push notifications before they are displayed to the user. NSE stands for "Notification Service Extension", a native iOS app extension type.
|
||||
|
||||
## What It Does
|
||||
|
||||
This extension intercepts incoming push notifications and performs processing before displaying them:
|
||||
|
||||
1. Manages badge counts for app icon
|
||||
2. Applies custom notification sounds based on user preferences
|
||||
3. Enables notification customization without requiring the main app to be running
|
||||
|
||||
## How It Works
|
||||
|
||||
When a push notification arrives on iOS, the system can invoke this extension to modify the notification content before displaying it. The extension runs in a separate process from the main app and has strict time limits (approximately 30 seconds) to complete its work.
|
||||
|
||||
### Architecture
|
||||
|
||||
The extension uses shared UserDefaults (via App Groups) to access preferences set by the main app:
|
||||
|
||||
- **App Group**: `group.app.bsky` allows data sharing between the main app and the extension
|
||||
- **Shared Preferences**: Stored in UserDefaults suite accessible by both processes
|
||||
- **Thread Safety**: Uses a dedicated serial DispatchQueue (`NSEPrefsQueue`) to prevent race conditions when multiple notifications arrive simultaneously
|
||||
|
||||
### Notification Processing Flow
|
||||
|
||||
1. System receives push notification
|
||||
2. `NotificationService.didReceive()` is called
|
||||
3. Extension creates mutable copy of notification content
|
||||
4. Based on notification type (determined by `reason` field):
|
||||
- **Chat messages** (`reason == "chat-message"`): Applies custom DM sound if user preference `playSoundChat` is enabled
|
||||
- **Other notifications**: Increments and applies badge count
|
||||
5. Extension delivers modified notification to system via `contentHandler`
|
||||
|
||||
### Badge Count Management
|
||||
|
||||
Badge counts are managed centrally by the extension:
|
||||
- Each non-chat notification increments the badge count
|
||||
- Count is synchronized across notification instances using the serial queue
|
||||
- Main app can reset the count via the `expo-background-notification-handler` module
|
||||
|
||||
### Notification Sounds
|
||||
|
||||
Two sound types are supported:
|
||||
- **Default system sound**: Standard iOS notification sound
|
||||
- **DM sound**: Custom `dm.aiff` sound file for chat messages
|
||||
|
||||
DM sound only plays if the user has enabled the `playSoundChat` preference in the main app's chat settings.
|
||||
|
||||
## Key Files
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `NotificationService.swift` | Main service extension implementation |
|
||||
| `BlueskyNSE.entitlements` | iOS entitlements configuration for App Group access |
|
||||
| `Info.plist` | Extension metadata and configuration |
|
||||
|
||||
### NotificationService.swift
|
||||
|
||||
Contains two main classes:
|
||||
|
||||
**NotificationService**: The main extension class that implements `UNNotificationServiceExtension`
|
||||
- `didReceive(_:withContentHandler:)`: Processes incoming notifications
|
||||
- `serviceExtensionTimeWillExpire()`: Handles timeout scenarios
|
||||
- Mutation methods for modifying notification content
|
||||
|
||||
**NSEUtil**: Singleton utility class for shared state management
|
||||
- Provides shared `UserDefaults` instance for the App Group
|
||||
- Manages serial queue for thread-safe preference access
|
||||
- Helper methods for notification content manipulation
|
||||
|
||||
## Configuration
|
||||
|
||||
### App Group Setup
|
||||
|
||||
The extension requires the `group.app.bsky` App Group to be configured in:
|
||||
1. Main app target capabilities
|
||||
2. Extension target capabilities (defined in `BlueskyNSE.entitlements`)
|
||||
|
||||
### Shared Preferences
|
||||
|
||||
The following preferences are shared between the main app and extension:
|
||||
|
||||
| Preference Key | Type | Purpose |
|
||||
|----------------|------|---------|
|
||||
| `badgeCount` | Int | Current badge count for app icon |
|
||||
| `playSoundChat` | Bool | Whether to play sound for chat notifications |
|
||||
|
||||
These are managed by the `expo-background-notification-handler` module in the main app.
|
||||
|
||||
### Sound Files
|
||||
|
||||
The custom DM sound file (`dm.aiff`) must be included in the extension's bundle. The iOS project configuration handles copying this resource during the build.
|
||||
|
||||
## Platform Support
|
||||
|
||||
- **iOS**: Fully supported (primary platform for this extension)
|
||||
- **Android**: Not applicable (Android uses different notification handling mechanisms)
|
||||
- **Web**: Not applicable (web notifications are handled by browser APIs)
|
||||
|
||||
## Integration with Main App
|
||||
|
||||
The extension coordinates with the main app through:
|
||||
|
||||
1. **expo-background-notification-handler** module: Provides JavaScript API for managing shared preferences
|
||||
2. **App Group shared storage**: Enables data synchronization between processes
|
||||
3. **Push notification payload**: Must include `reason` field to determine notification type
|
||||
|
||||
### Setting User Preferences
|
||||
|
||||
Users can control notification sounds via the Chat Settings screen (`src/screens/Messages/Settings.tsx`):
|
||||
|
||||
```typescript
|
||||
import {useBackgroundNotificationPreferences} from '../../../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
|
||||
|
||||
const {preferences, setPref} = useBackgroundNotificationPreferences()
|
||||
setPref('playSoundChat', true) // Enable DM sounds
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
1. **Time constraints**: Extension must complete processing within ~30 seconds or the system will terminate it
|
||||
2. **Process isolation**: Runs in separate process with limited memory and resources
|
||||
3. **iOS only**: Notification Service Extensions are an iOS-specific feature
|
||||
4. **Concurrent processing**: Multiple notifications may arrive simultaneously, requiring careful state management
|
||||
|
||||
## Best Practices
|
||||
|
||||
When modifying this extension:
|
||||
|
||||
1. Keep processing fast and synchronous when possible
|
||||
2. Use the shared serial queue for any UserDefaults mutations
|
||||
3. Avoid network requests that could cause timeouts
|
||||
4. Always call `contentHandler` with modified content, even on errors
|
||||
5. Test with multiple concurrent notifications to verify thread safety
|
||||
@@ -0,0 +1,140 @@
|
||||
# Share-with-Bluesky
|
||||
|
||||
iOS Share Extension for the Bluesky Social app that enables users to share content from other apps directly to Bluesky.
|
||||
|
||||
## Overview
|
||||
|
||||
This module implements an iOS Share Extension (Action Extension) that appears in the system share sheet when users tap the share button in other iOS apps. It allows sharing text, URLs, images, and videos to create a new Bluesky post.
|
||||
|
||||
## Features
|
||||
|
||||
- Share plain text
|
||||
- Share URLs (web links)
|
||||
- Share images (up to 4 images, supports PNG, JPG, JPEG, GIF, HEIC)
|
||||
- Share videos (single video, supports MOV, MP4, M4V)
|
||||
- Automatic image dimension extraction
|
||||
- Automatic video dimension extraction
|
||||
- App group file sharing for media access
|
||||
|
||||
## Architecture
|
||||
|
||||
### iOS Share Extension
|
||||
|
||||
The extension is implemented as a native iOS Share Extension using Swift. When a user shares content:
|
||||
|
||||
1. The `ShareViewController` receives the shared content from the extension context
|
||||
2. Content is processed based on its type (text, URL, image, or video)
|
||||
3. Media files are copied to a shared App Group container (`group.app.bsky`) for access by the main app
|
||||
4. Image and video dimensions are extracted and encoded into the URI
|
||||
5. The extension constructs a deep link URL with the content encoded in query parameters
|
||||
6. The main Bluesky app is opened with the deep link
|
||||
7. The extension completes and dismisses
|
||||
|
||||
### Deep Link Format
|
||||
|
||||
The extension communicates with the main app using deep links with the `bluesky://` scheme:
|
||||
|
||||
```
|
||||
bluesky://intent/compose?text=<encoded-text>
|
||||
bluesky://intent/compose?imageUris=<uri1>|<width>|<height>,<uri2>|<width>|<height>
|
||||
bluesky://intent/compose?videoUri=<uri>|<width>|<height>
|
||||
```
|
||||
|
||||
The scheme can be customized by setting the `MainAppScheme` key in `Info.plist` to support forks.
|
||||
|
||||
### Main App Integration
|
||||
|
||||
The main app handles these deep links in `src/lib/hooks/useIntentHandler.ts`:
|
||||
|
||||
- Parses the deep link parameters
|
||||
- Validates image/video URIs for security (filters out external URLs)
|
||||
- Opens the composer with the pre-populated content
|
||||
- Supports up to 4 images or 1 video per share
|
||||
|
||||
## Key Files
|
||||
|
||||
### Module Files
|
||||
|
||||
- `ShareViewController.swift` - Main view controller that handles share requests and processes content
|
||||
- `Info.plist` - Extension configuration (activation rules, supported content types)
|
||||
- `Share-with-Bluesky.entitlements` - App group entitlements for shared file access
|
||||
|
||||
### App Integration
|
||||
|
||||
- `src/lib/hooks/useIntentHandler.ts` - Main app hook that handles incoming deep links
|
||||
- `android/app/src/main/AndroidManifest.xml` - Android share intent configuration (lines 57-76)
|
||||
|
||||
## Configuration
|
||||
|
||||
### Supported Content Types
|
||||
|
||||
Defined in `Info.plist` under `NSExtensionActivationRule`:
|
||||
|
||||
- Text: Plain text strings
|
||||
- Web URLs: Up to 1 URL
|
||||
- Images: Up to 10 images
|
||||
- Videos: Up to 1 video
|
||||
|
||||
### App Group
|
||||
|
||||
The extension uses the `group.app.bsky` App Group identifier to share files with the main app. This is configured in:
|
||||
|
||||
- `Share-with-Bluesky.entitlements`
|
||||
- Main app's entitlements file
|
||||
|
||||
### Custom Scheme
|
||||
|
||||
The `MainAppScheme` in `Info.plist` defaults to `bluesky` but can be changed for forks to use a custom URL scheme.
|
||||
|
||||
## Platform Support
|
||||
|
||||
- iOS: Native Share Extension (this module)
|
||||
- Android: Native share intents handled via MainActivity intent filters in AndroidManifest.xml
|
||||
- Web: Not applicable (browser share APIs use different mechanisms)
|
||||
|
||||
## Implementation Details
|
||||
|
||||
### Image Processing
|
||||
|
||||
When images are shared:
|
||||
|
||||
1. Images are loaded from the extension's temporary directory or as UIImage objects
|
||||
2. Images are converted to JPEG format at maximum quality
|
||||
3. Dimensions are extracted from the UIImage
|
||||
4. Files are saved to the App Group container with unique names
|
||||
5. URIs are formatted as `<file-url>|<width>|<height>`
|
||||
|
||||
### Video Processing
|
||||
|
||||
When videos are shared:
|
||||
|
||||
1. Videos are copied from the source URL to the App Group container
|
||||
2. AVURLAsset is used to extract video track dimensions
|
||||
3. Track dimensions are adjusted for video rotation using preferredTransform
|
||||
4. URI is formatted as `<file-url>|<width>|<height>`
|
||||
|
||||
### Security
|
||||
|
||||
- External URLs in image URIs are filtered out in the main app to prevent potential security issues
|
||||
- Only file:// URLs from the App Group container are accepted
|
||||
- URI format is validated with a regex pattern before processing
|
||||
|
||||
## Development
|
||||
|
||||
This module is built as part of the main Xcode project. The extension target is included in the iOS build configuration.
|
||||
|
||||
To modify the extension:
|
||||
|
||||
1. Open the Xcode project in `/ios`
|
||||
2. Navigate to the Share-with-Bluesky target
|
||||
3. Edit `ShareViewController.swift` for logic changes
|
||||
4. Edit `Info.plist` for configuration changes
|
||||
5. Rebuild the iOS app
|
||||
|
||||
## Limitations
|
||||
|
||||
- Images: Maximum of 4 images per share (limited in main app handler)
|
||||
- Videos: Only 1 video per share
|
||||
- Mixed media: Cannot share images and videos together
|
||||
- File size: No explicit limits, but large files may cause issues
|
||||
- Formats: Only supports common image/video formats listed in constants
|
||||
@@ -0,0 +1,248 @@
|
||||
# Bottom Sheet Expo Module
|
||||
|
||||
A custom Expo module that provides native bottom sheet functionality for iOS and Android, using platform-specific native bottom sheet implementations (UISheetPresentationController on iOS, Material BottomSheetDialog on Android).
|
||||
|
||||
## Overview
|
||||
|
||||
This module wraps native bottom sheet components to provide a React Native interface with cross-platform consistency. It uses native presentation APIs rather than JavaScript-based animations for better performance and native behavior.
|
||||
|
||||
Key features:
|
||||
- Native bottom sheet presentation on iOS and Android
|
||||
- Automatic content height detection (no JS bridge round-trip)
|
||||
- Configurable snap points (hidden, partial, full)
|
||||
- Drag-to-dismiss with prevention controls
|
||||
- Portal-based rendering for proper z-index layering
|
||||
- Edge-to-edge support on modern Android versions
|
||||
- iOS 26+ zoom transition support
|
||||
|
||||
## Platform Support
|
||||
|
||||
- **iOS**: Uses `UISheetPresentationController` (iOS 15+)
|
||||
- **Android**: Uses Material Design `BottomSheetDialog` with `BottomSheetBehavior`
|
||||
- **Web**: Not supported (throws error)
|
||||
|
||||
## Architecture
|
||||
|
||||
### TypeScript Layer
|
||||
|
||||
The module exposes a React component that handles rendering and state management:
|
||||
|
||||
- **BottomSheet.tsx** (Native): Main component wrapping the native view
|
||||
- **BottomSheet.web.tsx** (Web): Stub that throws an error
|
||||
- **BottomSheetNativeComponent.tsx**: React wrapper with portal integration
|
||||
- **BottomSheetPortal.tsx**: Portal system for rendering sheets above app content
|
||||
- **Portal.tsx**: Generic portal implementation for managing component hierarchy
|
||||
|
||||
The component uses a class-based approach to expose imperative methods (`present()`, `dismiss()`, `dismissAll()`).
|
||||
|
||||
### Native Layer
|
||||
|
||||
#### iOS Implementation
|
||||
|
||||
- **BottomSheetModule.swift**: Expo module definition with event handlers and prop bindings
|
||||
- **SheetView.swift**: Main view component that creates and manages `SheetViewController`
|
||||
- Observes content height via KVO (Key-Value Observing) on bounds
|
||||
- Manages sheet lifecycle and state transitions
|
||||
- Implements `UISheetPresentationControllerDelegate` for drag events
|
||||
- **SheetViewController.swift**: UIViewController subclass with sheet presentation
|
||||
- Configures detents (snap points) based on content height
|
||||
- Handles iOS 26+ safe area adjustments for floating sheet style
|
||||
- Animates detent changes when content resizes
|
||||
- **SheetManager.swift**: Singleton that tracks all active sheets with weak references
|
||||
- **Util.swift**: Helper for calculating screen height minus safe area insets
|
||||
|
||||
#### Android Implementation
|
||||
|
||||
- **BottomSheetModule.kt**: Expo module definition mirroring iOS functionality
|
||||
- **BottomSheetView.kt**: Main view component managing Material BottomSheetDialog
|
||||
- Uses `OnLayoutChangeListener` to observe content height natively
|
||||
- Configures `BottomSheetBehavior` for drag and snap behavior
|
||||
- Handles edge-to-edge display across Android versions (API 29-35+)
|
||||
- Preserves status/nav bar appearance from host activity
|
||||
- **DialogRootViewGroup.kt**: Custom ViewGroup acting as RootView for the dialog
|
||||
- Forwards touch events to React Native event system
|
||||
- Updates shadow node size to match window dimensions
|
||||
- Based on React Native's ReactModalHostView pattern
|
||||
- **SheetManager.kt**: Singleton for tracking sheets (same pattern as iOS)
|
||||
|
||||
### Content Height Detection
|
||||
|
||||
Both platforms detect content height changes natively without JS bridge round-trips:
|
||||
|
||||
- **iOS**: KVO observation on the content view's `bounds` property
|
||||
- **Android**: `OnLayoutChangeListener` on child views (catches React Native's direct `layout()` calls)
|
||||
|
||||
This eliminates layout jank when content changes (e.g., keyboard appearance, dynamic content loading).
|
||||
|
||||
## Props
|
||||
|
||||
```typescript
|
||||
interface BottomSheetViewProps {
|
||||
children: React.ReactNode
|
||||
|
||||
// Appearance
|
||||
cornerRadius?: number
|
||||
backgroundColor?: ColorValue
|
||||
containerBackgroundColor?: ColorValue
|
||||
|
||||
// Behavior
|
||||
preventDismiss?: boolean // Disable swipe-to-dismiss
|
||||
preventExpansion?: boolean // Lock to initial height (no full-screen)
|
||||
disableDrag?: boolean // Disable drag handle (Android only)
|
||||
fullHeight?: boolean // Start at full screen height
|
||||
|
||||
// Height constraints
|
||||
minHeight?: number // Minimum height in dp
|
||||
maxHeight?: number // Maximum height in dp
|
||||
|
||||
// iOS 26+ transition
|
||||
sourceViewTag?: number // View tag for zoom transition origin
|
||||
|
||||
// Events
|
||||
onAttemptDismiss?: (event: BottomSheetAttemptDismissEvent) => void
|
||||
onSnapPointChange?: (event: BottomSheetSnapPointChangeEvent) => void
|
||||
onStateChange?: (event: BottomSheetStateChangeEvent) => void
|
||||
}
|
||||
```
|
||||
|
||||
## States and Snap Points
|
||||
|
||||
### States
|
||||
- `closed`: Sheet is dismissed
|
||||
- `closing`: Sheet is animating closed
|
||||
- `open`: Sheet is fully visible
|
||||
- `opening`: Sheet is animating open
|
||||
|
||||
### Snap Points
|
||||
- `Hidden` (0): Dismissed
|
||||
- `Partial` (1): Half-expanded / content height
|
||||
- `Full` (2): Expanded to screen height
|
||||
|
||||
## Usage
|
||||
|
||||
### Basic Example
|
||||
|
||||
```tsx
|
||||
import {BottomSheet, BottomSheetProvider, BottomSheetOutlet} from '@modules/bottom-sheet'
|
||||
|
||||
// In your app root:
|
||||
function App() {
|
||||
return (
|
||||
<BottomSheetProvider>
|
||||
<YourApp />
|
||||
<BottomSheetOutlet />
|
||||
</BottomSheetProvider>
|
||||
)
|
||||
}
|
||||
|
||||
// In a component:
|
||||
function MyComponent() {
|
||||
const sheetRef = useRef<BottomSheet>(null)
|
||||
|
||||
const openSheet = () => {
|
||||
sheetRef.current?.present()
|
||||
}
|
||||
|
||||
const closeSheet = () => {
|
||||
sheetRef.current?.dismiss()
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button onPress={openSheet} title="Open Sheet" />
|
||||
|
||||
<BottomSheet
|
||||
ref={sheetRef}
|
||||
cornerRadius={16}
|
||||
backgroundColor="white"
|
||||
onStateChange={(e) => console.log(e.nativeEvent.state)}
|
||||
>
|
||||
<View style={{padding: 20}}>
|
||||
<Text>Sheet content</Text>
|
||||
<Button onPress={closeSheet} title="Close" />
|
||||
</View>
|
||||
</BottomSheet>
|
||||
</>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### Nested Sheets
|
||||
|
||||
The module supports nesting sheets by using `BottomSheetPortalProvider` within sheet content:
|
||||
|
||||
```tsx
|
||||
<BottomSheet ref={outerSheetRef}>
|
||||
<BottomSheetPortalProvider>
|
||||
<Button onPress={() => innerSheetRef.current?.present()} />
|
||||
<BottomSheet ref={innerSheetRef}>
|
||||
<Text>Inner sheet content</Text>
|
||||
</BottomSheet>
|
||||
</BottomSheetPortalProvider>
|
||||
</BottomSheet>
|
||||
```
|
||||
|
||||
### Dismiss All Sheets
|
||||
|
||||
```tsx
|
||||
import {BottomSheetNativeComponent} from '@modules/bottom-sheet'
|
||||
|
||||
BottomSheetNativeComponent.dismissAll()
|
||||
```
|
||||
|
||||
## Key Implementation Details
|
||||
|
||||
### iOS Specific
|
||||
|
||||
1. **iOS 15 Compatibility**: On iOS 15, custom detents are not available, so the module uses `.medium()` detent and applies extra styling to prevent visual issues.
|
||||
|
||||
2. **iOS 26+ Zoom Transitions**: When `sourceViewTag` is provided on iOS 26+, the sheet zooms from the specified view.
|
||||
|
||||
3. **Detent Selection**: The module automatically chooses between custom detents, `.medium()`, and `.large()` based on content height and screen size.
|
||||
|
||||
### Android Specific
|
||||
|
||||
1. **Edge-to-Edge**: The module handles edge-to-edge display correctly across API levels:
|
||||
- API 35+: Mandatory edge-to-edge
|
||||
- API 30-34: Uses `currentWindowMetrics`
|
||||
- API <30: Uses deprecated `getRealSize()`
|
||||
|
||||
2. **Status/Nav Bar Appearance**: Preserves light/dark appearance from the host activity and reapplies it to the sheet dialog.
|
||||
|
||||
3. **Drag Handling**: On full-height sheets with `preventDismiss`, dragging is disabled to prevent accidental dismissal (since there's no half-expanded snap point to land on).
|
||||
|
||||
4. **Layout Updates During Gestures**: Content height changes are deferred during drag gestures to prevent fighting the user's input.
|
||||
|
||||
### Platform Differences
|
||||
|
||||
- **cornerRadius**: Applied to sheet on iOS, to content wrapper on Android (Android clips with `overflow: hidden`)
|
||||
- **disableDrag**: Android-only prop (iOS drag behavior is controlled via `preventDismiss` + `preventExpansion`)
|
||||
- **sourceViewTag**: iOS 26+ only (ignored on Android)
|
||||
|
||||
## Files Reference
|
||||
|
||||
### TypeScript
|
||||
- `index.ts` - Public API exports
|
||||
- `src/BottomSheet.types.ts` - TypeScript type definitions
|
||||
- `src/BottomSheet.tsx` - Native component (re-export)
|
||||
- `src/BottomSheet.web.tsx` - Web stub
|
||||
- `src/BottomSheetNativeComponent.tsx` - Native wrapper with portal integration
|
||||
- `src/BottomSheetNativeComponent.web.tsx` - Web stub for native component
|
||||
- `src/BottomSheetPortal.tsx` - Portal context and providers
|
||||
- `src/lib/Portal.tsx` - Generic portal implementation
|
||||
|
||||
### iOS
|
||||
- `ios/BottomSheetModule.swift` - Module definition
|
||||
- `ios/SheetView.swift` - Main view implementation
|
||||
- `ios/SheetViewController.swift` - View controller for sheet presentation
|
||||
- `ios/SheetManager.swift` - Singleton for tracking active sheets
|
||||
- `ios/Util.swift` - Screen height utility
|
||||
|
||||
### Android
|
||||
- `android/src/main/java/expo/modules/bottomsheet/BottomSheetModule.kt` - Module definition
|
||||
- `android/src/main/java/expo/modules/bottomsheet/BottomSheetView.kt` - Main view implementation
|
||||
- `android/src/main/java/expo/modules/bottomsheet/DialogRootViewGroup.kt` - Dialog root view group
|
||||
- `android/src/main/java/expo/modules/bottomsheet/SheetManager.kt` - Sheet tracking singleton
|
||||
|
||||
### Configuration
|
||||
- `expo-module.config.json` - Expo module configuration
|
||||
@@ -33,17 +33,27 @@ class BottomSheetView(
|
||||
private var eventDispatcher: EventDispatcher? = null
|
||||
|
||||
// Native content height observation (eliminates JS bridge round-trip)
|
||||
private var contentLayoutListener: View.OnLayoutChangeListener? = null
|
||||
private var contentLayoutListener: OnLayoutChangeListener? = null
|
||||
private var observedChildren: List<View> = emptyList()
|
||||
private var lastObservedContentHeight: Float = 0f
|
||||
private var pendingLayoutUpdate: Boolean = false
|
||||
|
||||
private val screenHeight: Float =
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
||||
// API 35+: edge-to-edge is mandatory, heightPixels is the full display
|
||||
context.resources.displayMetrics.heightPixels.toFloat()
|
||||
} else {
|
||||
} else if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) {
|
||||
// API 30-34: heightPixels may exclude nav bar, use currentWindowMetrics
|
||||
val wm = context.getSystemService(Context.WINDOW_SERVICE) as android.view.WindowManager
|
||||
wm.currentWindowMetrics.bounds.height().toFloat()
|
||||
} else {
|
||||
// API < 30: currentWindowMetrics not available, use getRealSize
|
||||
// which includes system bars (heightPixels may exclude them)
|
||||
val wm = context.getSystemService(Context.WINDOW_SERVICE) as android.view.WindowManager
|
||||
val size = android.graphics.Point()
|
||||
@Suppress("DEPRECATION")
|
||||
wm.defaultDisplay.getRealSize(size)
|
||||
size.y.toFloat()
|
||||
}
|
||||
|
||||
private fun getNavigationBarHeight(): Int {
|
||||
@@ -355,7 +365,7 @@ class BottomSheetView(
|
||||
|
||||
val innerViewGroup = this.innerView as? ViewGroup ?: return
|
||||
|
||||
val listener = View.OnLayoutChangeListener { _, _, top, _, bottom, _, _, oldTop, oldBottom ->
|
||||
val listener = OnLayoutChangeListener { _, _, top, _, bottom, _, _, oldTop, oldBottom ->
|
||||
val newHeight = bottom - top
|
||||
val oldHeight = oldBottom - oldTop
|
||||
if (newHeight != oldHeight) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from 'react'
|
||||
import {Component, createRef} from 'react'
|
||||
import {
|
||||
Dimensions,
|
||||
type LayoutChangeEvent,
|
||||
@@ -39,14 +39,14 @@ const IS_IOS15 =
|
||||
const IS_NON_E2E_ANDROID =
|
||||
Platform.OS === 'android' && Number(Platform.Version) < 35
|
||||
|
||||
export class BottomSheetNativeComponent extends React.Component<
|
||||
export class BottomSheetNativeComponent extends Component<
|
||||
BottomSheetViewProps,
|
||||
{
|
||||
open: boolean
|
||||
viewHeight?: number
|
||||
}
|
||||
> {
|
||||
ref = React.createRef<any>()
|
||||
ref = createRef<any>()
|
||||
|
||||
static contextType = PortalContext
|
||||
|
||||
@@ -129,6 +129,7 @@ export class BottomSheetNativeComponent extends React.Component<
|
||||
function BottomSheetNativeComponentInner({
|
||||
children,
|
||||
backgroundColor,
|
||||
maxHeight,
|
||||
onLayout,
|
||||
onStateChange,
|
||||
nativeViewRef,
|
||||
@@ -156,6 +157,7 @@ function BottomSheetNativeComponentInner({
|
||||
return (
|
||||
<NativeView
|
||||
{...rest}
|
||||
maxHeight={maxHeight}
|
||||
onStateChange={onStateChange}
|
||||
ref={nativeViewRef}
|
||||
style={{
|
||||
@@ -170,6 +172,7 @@ function BottomSheetNativeComponentInner({
|
||||
flex: 1,
|
||||
backgroundColor,
|
||||
},
|
||||
maxHeight != null && {maxHeight},
|
||||
Platform.OS === 'android' && {
|
||||
borderTopLeftRadius: cornerRadius,
|
||||
borderTopRightRadius: cornerRadius,
|
||||
@@ -177,7 +180,9 @@ function BottomSheetNativeComponentInner({
|
||||
},
|
||||
extraStyles,
|
||||
]}>
|
||||
<View onLayout={onLayout}>
|
||||
<View
|
||||
onLayout={onLayout}
|
||||
style={maxHeight == null ? undefined : {flex: 1}}>
|
||||
<BottomSheetPortalProvider>{children}</BottomSheetPortalProvider>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
# expo-background-notification-handler
|
||||
|
||||
A custom Expo module for managing shared notification preferences and handling background notifications in the Bluesky Social app. This module enables communication between the main app and notification service extensions through shared storage.
|
||||
|
||||
## Purpose
|
||||
|
||||
This module solves a critical problem in native notification handling: notification service extensions run in a separate process from the main app and cannot directly access React Native state or APIs. The module provides a bridge by storing notification preferences in shared storage that both the main app and notification service extension can access.
|
||||
|
||||
The primary use case is storing user preferences (like notification sound settings) while the app is foregrounded or backgrounded, minimizing the need for background fetches when processing notifications.
|
||||
|
||||
## Platform Support
|
||||
|
||||
- **iOS**: Full support via UserDefaults with App Groups
|
||||
- **Android**: Full support via SharedPreferences
|
||||
- **Web**: Stub implementation (no-op)
|
||||
|
||||
## Architecture
|
||||
|
||||
### iOS Implementation
|
||||
|
||||
Uses iOS App Groups (`group.app.bsky`) to share UserDefaults between the main app and the notification service extension. This allows the notification service extension to read preferences set by the main app without launching the app.
|
||||
|
||||
**Key Files:**
|
||||
- `ios/ExpoBackgroundNotificationHandlerModule.swift` - Native module implementation
|
||||
- `ios/ExpoBackgroundNotificationHandler.podspec` - CocoaPods specification
|
||||
|
||||
### Android Implementation
|
||||
|
||||
Uses SharedPreferences with Firebase Cloud Messaging (FCM) to handle background notifications. The module tracks app foreground/background state and conditionally processes notifications based on whether the app is foregrounded.
|
||||
|
||||
**Key Files:**
|
||||
- `android/src/main/java/expo/modules/backgroundnotificationhandler/ExpoBackgroundNotificationHandlerModule.kt` - Expo module definition
|
||||
- `android/src/main/java/expo/modules/backgroundnotificationhandler/NotificationPrefs.kt` - SharedPreferences wrapper
|
||||
- `android/src/main/java/expo/modules/backgroundnotificationhandler/BackgroundNotificationHandler.kt` - Notification processing logic
|
||||
- `android/src/main/java/expo/modules/backgroundnotificationhandler/BackgroundNotificationHandlerInterface.kt` - Interface for showing notifications
|
||||
- `android/build.gradle` - Build configuration
|
||||
|
||||
### TypeScript/React API
|
||||
|
||||
**Key Files:**
|
||||
- `index.ts` - Module entry point
|
||||
- `src/ExpoBackgroundNotificationHandlerModule.ts` - Native module binding (iOS/Android)
|
||||
- `src/ExpoBackgroundNotificationHandlerModule.web.ts` - Web stub
|
||||
- `src/ExpoBackgroundNotificationHandler.types.ts` - TypeScript type definitions
|
||||
- `src/BackgroundNotificationHandlerProvider.tsx` - React Context provider for preferences
|
||||
|
||||
## Stored Preferences
|
||||
|
||||
The module manages the following notification preferences:
|
||||
|
||||
```typescript
|
||||
{
|
||||
playSoundChat: boolean, // Currently exposed to TypeScript
|
||||
playSoundFollow: boolean, // Native only (not yet exposed)
|
||||
playSoundLike: boolean, // Native only (not yet exposed)
|
||||
playSoundMention: boolean, // Native only (not yet exposed)
|
||||
playSoundQuote: boolean, // Native only (not yet exposed)
|
||||
playSoundReply: boolean, // Native only (not yet exposed)
|
||||
playSoundRepost: boolean, // Native only (not yet exposed)
|
||||
mutedThreads: [String: [String]], // iOS only
|
||||
badgeCount: number // iOS only
|
||||
}
|
||||
```
|
||||
|
||||
Default values are initialized when the module is created, with most sound preferences defaulting to `false` except `playSoundChat` which defaults to `true`.
|
||||
|
||||
## API
|
||||
|
||||
### Core Methods
|
||||
|
||||
```typescript
|
||||
// Get all preferences
|
||||
getAllPrefsAsync(): Promise<BackgroundNotificationHandlerPreferences>
|
||||
|
||||
// Get individual values
|
||||
getBoolAsync(forKey: string): Promise<boolean>
|
||||
getStringAsync(forKey: string): Promise<string>
|
||||
getStringArrayAsync(forKey: string): Promise<string[]>
|
||||
|
||||
// Set individual values
|
||||
setBoolAsync(forKey: string, value: boolean): Promise<void>
|
||||
setStringAsync(forKey: string, value: string): Promise<void>
|
||||
setStringArrayAsync(forKey: string, value: string[]): Promise<void>
|
||||
|
||||
// Array manipulation
|
||||
addToStringArrayAsync(forKey: string, value: string): Promise<void>
|
||||
removeFromStringArrayAsync(forKey: string, value: string): Promise<void>
|
||||
addManyToStringArrayAsync(forKey: string, value: string[]): Promise<void>
|
||||
removeManyFromStringArrayAsync(forKey: string, value: string[]): Promise<void>
|
||||
|
||||
// Badge count (iOS only)
|
||||
setBadgeCountAsync(count: number): Promise<void>
|
||||
```
|
||||
|
||||
### React Context API
|
||||
|
||||
The module provides a React Context provider for managing preferences in the app:
|
||||
|
||||
```typescript
|
||||
import {
|
||||
BackgroundNotificationPreferencesProvider,
|
||||
useBackgroundNotificationPreferences,
|
||||
} from 'expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<BackgroundNotificationPreferencesProvider>
|
||||
<YourApp />
|
||||
</BackgroundNotificationPreferencesProvider>
|
||||
)
|
||||
}
|
||||
|
||||
function SettingsScreen() {
|
||||
const {preferences, setPref} = useBackgroundNotificationPreferences()
|
||||
|
||||
return (
|
||||
<Toggle
|
||||
value={preferences.playSoundChat}
|
||||
onValueChange={(value) => setPref('playSoundChat', value)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Android Notification Handling
|
||||
|
||||
The Android implementation includes logic for processing notifications while the app is backgrounded:
|
||||
|
||||
- **Chat messages**: Applies custom notification channels based on `playSoundChat` preference
|
||||
- Sound enabled: Uses `chat-messages` channel (or `dm.mp3` sound on older Android)
|
||||
- Sound disabled: Uses `chat-messages-muted` channel
|
||||
|
||||
- **Other notification types**: On Android Oreo+ (API 26+), assigns notifications to channels based on reason:
|
||||
- Supported reasons: `like`, `repost`, `follow`, `mention`, `reply`, `quote`, `like-via-repost`, `repost-via-repost`, `subscribed-post`
|
||||
- Each reason maps to its corresponding notification channel
|
||||
|
||||
When the app is foregrounded, the module defers to `expo-notifications` for notification handling.
|
||||
|
||||
## Configuration
|
||||
|
||||
### iOS
|
||||
|
||||
Requires App Group entitlement configured in Xcode:
|
||||
- App Group ID: `group.app.bsky`
|
||||
|
||||
### Android
|
||||
|
||||
Requires Firebase Cloud Messaging (FCM) integration:
|
||||
- Dependency: `com.google.firebase:firebase-messaging-ktx:24.0.0`
|
||||
- SharedPreferences name: `xyz.blueskyweb.app`
|
||||
|
||||
## Usage in the App
|
||||
|
||||
The module is used to:
|
||||
|
||||
1. Store notification preferences that need to be accessed by notification service extensions
|
||||
2. Track app foreground/background state on Android
|
||||
3. Process and mutate notification payloads based on user preferences before display
|
||||
4. Manage notification badge counts on iOS
|
||||
5. Handle thread muting and other notification filtering logic
|
||||
|
||||
By keeping preferences in shared storage, the notification service extension can make intelligent decisions about notification presentation without waking up the React Native runtime or making network requests.
|
||||
@@ -13,7 +13,7 @@ class BackgroundNotificationHandler(
|
||||
return
|
||||
}
|
||||
|
||||
if (remoteMessage.data["reason"] == "chat-message") {
|
||||
if (remoteMessage.data["reason"] == "chat-message" || remoteMessage.data["reason"] == "chat-reaction") {
|
||||
mutateWithChatMessage(remoteMessage)
|
||||
} else {
|
||||
mutateWithOtherReason(remoteMessage)
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
# expo-bluesky-gif-view
|
||||
|
||||
An Expo module for displaying animated GIFs and WebP images with optimized performance and playback controls.
|
||||
|
||||
## Overview
|
||||
|
||||
This module provides a custom view component for rendering animated GIFs with support for:
|
||||
|
||||
- Autoplay control
|
||||
- Placeholder images while loading
|
||||
- Programmatic playback control (play/pause/toggle)
|
||||
- Image prefetching
|
||||
- Efficient memory management
|
||||
- Player state change events
|
||||
|
||||
## Platform Support
|
||||
|
||||
- iOS (13.4+)
|
||||
- Android (API 21+)
|
||||
- Web
|
||||
|
||||
## Architecture
|
||||
|
||||
The module uses native platform libraries for optimal GIF rendering performance:
|
||||
|
||||
### iOS Implementation
|
||||
|
||||
- **Library**: SDWebImage with SDWebImageWebPCoder
|
||||
- **Key Files**:
|
||||
- `ios/GifView.swift` - Main view implementation using `SDAnimatedImageView`
|
||||
- `ios/ExpoBlueskyGifViewModule.swift` - Module definition and prop bindings
|
||||
- `ios/Util.swift` - Cache configuration utilities
|
||||
|
||||
**Approach**: Uses `SDAnimatedImageView` for hardware-accelerated GIF rendering. Images are cached to disk only (not memory) to avoid performance issues with `SDAnimatedImage` when loaded from memory. The view automatically cancels pending requests when scrolled off-screen and resumes loading when visible.
|
||||
|
||||
### Android Implementation
|
||||
|
||||
- **Library**: Glide
|
||||
- **Key Files**:
|
||||
- `android/src/main/java/expo/modules/blueskygifview/GifView.kt` - Main view implementation
|
||||
- `android/src/main/java/expo/modules/blueskygifview/ExpoBlueskyGifViewModule.kt` - Module definition
|
||||
- `android/src/main/java/expo/modules/blueskygifview/AppCompatImageViewExtended.kt` - Custom ImageView with playback control
|
||||
|
||||
**Approach**: Uses Glide's disk cache strategy for loading animated GIFs. Placeholders are loaded with `skipMemoryCache(true)` to avoid cache bloat. The custom `AppCompatImageViewExtended` detects when animations are loaded via `onDraw` and manages the `Animatable` drawable lifecycle.
|
||||
|
||||
### Web Implementation
|
||||
|
||||
- **Library**: Native HTML5 `<video>` element
|
||||
- **Key File**: `src/GifView.web.tsx`
|
||||
|
||||
**Approach**: Uses a looping, muted video element to display GIFs. This provides better performance than image-based approaches on the web. The implementation tracks load state to fire the `onPlayerStateChange` event only once (since `onCanPlay` fires on every loop).
|
||||
|
||||
## Usage
|
||||
|
||||
```tsx
|
||||
import {GifView} from 'expo-bluesky-gif-view'
|
||||
|
||||
function MyComponent() {
|
||||
const gifRef = React.useRef<GifView>(null)
|
||||
|
||||
return (
|
||||
<GifView
|
||||
source="https://example.com/animated.gif"
|
||||
placeholderSource="https://example.com/thumbnail.jpg"
|
||||
autoplay={true}
|
||||
onPlayerStateChange={(event) => {
|
||||
console.log('Playing:', event.nativeEvent.isPlaying)
|
||||
console.log('Loaded:', event.nativeEvent.isLoaded)
|
||||
}}
|
||||
ref={gifRef}
|
||||
/>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### Props
|
||||
|
||||
- `source?: string` - URL of the animated GIF/WebP
|
||||
- `placeholderSource?: string` - URL of a static placeholder image to show while loading
|
||||
- `autoplay?: boolean` - Whether to start playing automatically (default: true)
|
||||
- `onPlayerStateChange?: (event: GifViewStateChangeEvent) => void` - Callback fired when playback state changes
|
||||
|
||||
### Methods
|
||||
|
||||
All methods are async and return a Promise:
|
||||
|
||||
```tsx
|
||||
await gifRef.current?.playAsync()
|
||||
await gifRef.current?.pauseAsync()
|
||||
await gifRef.current?.toggleAsync()
|
||||
```
|
||||
|
||||
### Static Methods
|
||||
|
||||
```tsx
|
||||
// Prefetch GIFs into the cache (not supported on web)
|
||||
await GifView.prefetchAsync([
|
||||
'https://example.com/gif1.gif',
|
||||
'https://example.com/gif2.gif'
|
||||
])
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### iOS Dependencies
|
||||
|
||||
The module requires SDWebImage and SDWebImageWebPCoder:
|
||||
|
||||
```ruby
|
||||
# ios/ExpoBlueskyGifView.podspec
|
||||
s.dependency 'SDWebImage', '~> 5.21.0'
|
||||
s.dependency 'SDWebImageWebPCoder', '~> 0.14.6'
|
||||
```
|
||||
|
||||
### Android Dependencies
|
||||
|
||||
The module uses Glide, kept in sync with expo-image version:
|
||||
|
||||
```gradle
|
||||
# android/build.gradle
|
||||
implementation 'com.github.bumptech.glide:glide:4.13.2'
|
||||
```
|
||||
|
||||
## Key Implementation Details
|
||||
|
||||
### Lifecycle Management
|
||||
|
||||
- **iOS**: Cancels pending requests in `willMove(toWindow:)` when scrolled off-screen
|
||||
- **Android**: Pauses playback in `onDetachedFromWindow()`, resumes in `onAttachedToWindow()`
|
||||
- **Web**: Uses React lifecycle methods to manage video element state
|
||||
|
||||
### Cache Strategy
|
||||
|
||||
- **iOS**: Disk-only caching to work around `SDAnimatedImage` memory issues
|
||||
- **Android**: DATA disk cache for main images, skips memory cache for placeholders
|
||||
- **Web**: Relies on browser cache
|
||||
|
||||
### Animation Control
|
||||
|
||||
- **iOS**: `SDAnimatedImageView.autoPlayAnimatedImage` is explicitly set to false to prevent automatic animation on viewport entry
|
||||
- **Android**: Custom `AppCompatImageViewExtended` manages `Animatable` drawable state
|
||||
- **Web**: Uses HTMLMediaElement play/pause APIs
|
||||
|
||||
## Files Overview
|
||||
|
||||
```
|
||||
expo-bluesky-gif-view/
|
||||
├── index.ts # Module entry point
|
||||
├── expo-module.config.json # Expo module configuration
|
||||
├── src/
|
||||
│ ├── GifView.types.ts # TypeScript type definitions
|
||||
│ ├── GifView.tsx # Native implementation (iOS/Android)
|
||||
│ └── GifView.web.tsx # Web implementation
|
||||
├── ios/
|
||||
│ ├── ExpoBlueskyGifView.podspec # CocoaPods spec
|
||||
│ ├── ExpoBlueskyGifViewModule.swift # Module and prop definitions
|
||||
│ ├── GifView.swift # iOS view implementation
|
||||
│ └── Util.swift # Cache configuration
|
||||
└── android/
|
||||
├── build.gradle # Gradle build configuration
|
||||
└── src/main/java/expo/modules/blueskygifview/
|
||||
├── ExpoBlueskyGifViewModule.kt # Module and prop definitions
|
||||
├── GifView.kt # Android view implementation
|
||||
└── AppCompatImageViewExtended.kt # Custom ImageView for playback
|
||||
```
|
||||
@@ -0,0 +1,231 @@
|
||||
# expo-bluesky-swiss-army
|
||||
|
||||
A collection of native utilities for the Bluesky Social app. This Expo module provides platform-specific functionality that is not available through standard React Native APIs.
|
||||
|
||||
## Overview
|
||||
|
||||
This module consolidates several native features into a single Expo module:
|
||||
|
||||
- **PlatformInfo**: Platform-specific accessibility and audio session management
|
||||
- **Referrer**: Tracking how users arrive at the app (web referrers, app referrers, Google Play install referrer)
|
||||
- **SharedPrefs**: Shared preferences storage using native platform APIs (UserDefaults on iOS, SharedPreferences on Android)
|
||||
- **VisibilityView**: A native view component that tracks which view is currently visible on screen
|
||||
|
||||
## Modules
|
||||
|
||||
### PlatformInfo
|
||||
|
||||
Provides platform-specific information and audio session control.
|
||||
|
||||
**Functions:**
|
||||
|
||||
- `getIsReducedMotionEnabled(): boolean` - Returns whether the user has enabled reduced motion in system settings. Works on all platforms (iOS uses UIAccessibility, Android checks transition animation scale, Web checks CSS media query).
|
||||
|
||||
- `setAudioActive(active: boolean): void` - iOS only. Controls whether the app's audio session is active. When deactivated with `false`, it notifies other apps to resume their audio playback.
|
||||
|
||||
- `setAudioCategory(category: AudioCategory): void` - iOS only. Sets the AVAudioSession category. Use `AudioCategory.Playback` for video/music playback and `AudioCategory.Ambient` for audio that mixes with other apps.
|
||||
|
||||
**Platform Support:**
|
||||
- iOS: Full support for all functions
|
||||
- Android: `getIsReducedMotionEnabled()` only
|
||||
- Web: `getIsReducedMotionEnabled()` only
|
||||
|
||||
### Referrer
|
||||
|
||||
Tracks how users arrive at the app from external sources.
|
||||
|
||||
**Functions:**
|
||||
|
||||
- `getReferrerInfo(): ReferrerInfo | null` - Returns information about the source that launched the app. Returns `{referrer: string, hostname: string}` or `null`.
|
||||
- **iOS**: Reads from SharedPrefs (set by app extensions or deep link handlers)
|
||||
- **Android**: Extracts referrer from Intent extras or activity referrer
|
||||
- **Web**: Parses `document.referrer` (excludes bsky.app domain)
|
||||
|
||||
- `getGooglePlayReferrerInfoAsync(): Promise<GooglePlayReferrerInfo>` - Android only. Retrieves Google Play install referrer information including install timestamp and click timestamp. Uses the Google Play Install Referrer API.
|
||||
|
||||
**Platform Support:**
|
||||
- iOS: `getReferrerInfo()` only (reads from SharedPrefs)
|
||||
- Android: Both functions
|
||||
- Web: `getReferrerInfo()` only
|
||||
|
||||
### SharedPrefs
|
||||
|
||||
Native key-value storage that persists across app restarts. Uses iOS App Groups (`group.app.bsky`) for sharing data with extensions, and Android SharedPreferences.
|
||||
|
||||
**Functions:**
|
||||
|
||||
- `setValue(key: string, value: string | number | boolean | null | undefined): void` - Store a value
|
||||
- `removeValue(key: string): void` - Remove a value
|
||||
- `getString(key: string): string | undefined` - Get a string value
|
||||
- `getNumber(key: string): number | undefined` - Get a number value
|
||||
- `getBool(key: string): boolean | undefined` - Get a boolean value
|
||||
- `addToSet(key: string, value: string): void` - Add a value to a set
|
||||
- `removeFromSet(key: string, value: string): void` - Remove a value from a set
|
||||
- `setContains(key: string, value: string): boolean` - Check if a set contains a value
|
||||
|
||||
**Default Values (Android only):**
|
||||
The Android implementation initializes certain keys with default values on first access:
|
||||
- `playSoundChat`: true
|
||||
- `playSoundFollow`: false
|
||||
- `playSoundLike`: false
|
||||
- `playSoundMention`: false
|
||||
- `playSoundQuote`: false
|
||||
- `playSoundReply`: false
|
||||
- `playSoundRepost`: false
|
||||
- `badgeCount`: 0
|
||||
|
||||
**Platform Support:**
|
||||
- iOS: Full support (uses UserDefaults with App Group)
|
||||
- Android: Full support (uses SharedPreferences)
|
||||
- Web: Not implemented
|
||||
|
||||
**Implementation Notes:**
|
||||
- iOS uses App Group suite `group.app.bsky` to share preferences with app extensions
|
||||
- Android stores preferences in `xyz.blueskyweb.app`
|
||||
- Both platforms work around a bug where `JavaScriptValue.isString()` can cause crashes, so there's a separate `setString` function internally
|
||||
|
||||
### VisibilityView
|
||||
|
||||
A React Native view component that detects which view is currently "active" based on visibility and position on screen. Only one view can be active at a time across the entire app.
|
||||
|
||||
**Component:**
|
||||
|
||||
```tsx
|
||||
<VisibilityView
|
||||
enabled={boolean}
|
||||
onChangeStatus={(isActive: boolean) => void}
|
||||
>
|
||||
{children}
|
||||
</VisibilityView>
|
||||
```
|
||||
|
||||
**Props:**
|
||||
- `enabled: boolean` - Whether this view participates in visibility tracking
|
||||
- `onChangeStatus: (isActive: boolean) => void` - Callback fired when the view becomes active or inactive
|
||||
- `children: React.ReactNode` - Child components
|
||||
|
||||
**Functions:**
|
||||
|
||||
- `updateActiveViewAsync(): Promise<void>` - Manually trigger recalculation of the active view
|
||||
|
||||
**How It Works:**
|
||||
|
||||
The module maintains a global registry of all VisibilityView instances. When views are added/removed or when explicitly updated, it calculates which view is "most visible":
|
||||
|
||||
1. A view must be at least 50% visible on screen
|
||||
2. If multiple views meet this threshold, the one closest to the top of the screen wins (specifically, the one with the lowest Y position, but must be at least 150px from the top)
|
||||
3. Only one view can be active at a time - when a new view becomes active, the previous one is deactivated
|
||||
|
||||
This is useful for features like video autoplay, where you want to know which video is currently the "primary" one the user is viewing.
|
||||
|
||||
**Platform Support:**
|
||||
- iOS: Full support using UIView position tracking
|
||||
- Android: Full support using View position tracking
|
||||
- Web: Passthrough component (renders children without tracking)
|
||||
|
||||
## Architecture
|
||||
|
||||
### TypeScript Layer
|
||||
|
||||
The module uses platform-specific file extensions to provide appropriate implementations:
|
||||
|
||||
- `index.ts` - Throws NotImplementedError (base/fallback)
|
||||
- `index.native.ts` - Calls native modules via Expo Modules Core
|
||||
- `index.web.ts` - Web-specific implementations or stubs
|
||||
- `index.ios.ts` / `index.android.ts` - Platform-specific implementations when behavior differs
|
||||
|
||||
### Native Layer
|
||||
|
||||
**iOS:**
|
||||
- Swift implementation using Expo Modules Core
|
||||
- Files organized by feature in subdirectories (PlatformInfo/, Referrer/, SharedPrefs/, Visibility/)
|
||||
- Uses standard iOS APIs: UIAccessibility, AVAudioSession, UserDefaults, UIView
|
||||
|
||||
**Android:**
|
||||
- Kotlin implementation using Expo Modules Core
|
||||
- Package structure: `expo.modules.blueskyswissarmy.[feature]`
|
||||
- Uses standard Android APIs: Settings.Global, InstallReferrerClient, SharedPreferences, View
|
||||
|
||||
## Key Files
|
||||
|
||||
### TypeScript
|
||||
- `index.ts` - Main module exports
|
||||
- `src/NotImplemented.ts` - Error thrown when functionality is not available on current platform
|
||||
- `src/[Feature]/types.ts` - TypeScript type definitions for each feature
|
||||
- `src/[Feature]/index.*.ts` - Platform-specific implementations
|
||||
|
||||
### iOS
|
||||
- `ios/ExpoBlueskySwissArmy.podspec` - CocoaPods specification
|
||||
- `ios/[Feature]/Expo*Module.swift` - Expo module definitions
|
||||
- `ios/SharedPrefs/SharedPrefs.swift` - Shared preference manager (usable from other native code)
|
||||
- `ios/Visibility/VisibilityViewManager.swift` - Global view tracking manager
|
||||
|
||||
### Android
|
||||
- `android/build.gradle` - Gradle build configuration (includes installreferrer dependency)
|
||||
- `android/src/main/java/expo/modules/blueskyswissarmy/[feature]/Expo*Module.kt` - Expo module definitions
|
||||
- `android/src/main/java/expo/modules/blueskyswissarmy/sharedprefs/SharedPrefs.kt` - Shared preference manager
|
||||
- `android/src/main/java/expo/modules/blueskyswissarmy/visibilityview/VisibilityViewManager.kt` - Global view tracking manager
|
||||
|
||||
## Configuration
|
||||
|
||||
### Expo Module Config
|
||||
|
||||
The module is registered in `expo-module.config.json` with all four sub-modules for both iOS and Android.
|
||||
|
||||
### iOS
|
||||
|
||||
Requires iOS 13.4 or later. Uses the App Group `group.app.bsky` for SharedPrefs - ensure this is configured in your app's entitlements.
|
||||
|
||||
### Android
|
||||
|
||||
- Minimum SDK: 21
|
||||
- Target SDK: 34
|
||||
- Requires `com.android.installreferrer:installreferrer:2.2` dependency for Google Play referrer tracking
|
||||
|
||||
## Usage Example
|
||||
|
||||
```typescript
|
||||
import {
|
||||
PlatformInfo,
|
||||
AudioCategory,
|
||||
Referrer,
|
||||
SharedPrefs,
|
||||
VisibilityView
|
||||
} from 'expo-bluesky-swiss-army'
|
||||
|
||||
// Check for reduced motion
|
||||
const isReducedMotion = PlatformInfo.getIsReducedMotionEnabled()
|
||||
|
||||
// Set audio category for video playback (iOS)
|
||||
PlatformInfo.setAudioCategory(AudioCategory.Playback)
|
||||
PlatformInfo.setAudioActive(true)
|
||||
|
||||
// Check how user arrived at the app
|
||||
const referrer = Referrer.getReferrerInfo()
|
||||
if (referrer) {
|
||||
console.log('User came from:', referrer.hostname)
|
||||
}
|
||||
|
||||
// Store a preference
|
||||
SharedPrefs.setValue('lastOpenedAt', Date.now())
|
||||
SharedPrefs.setValue('hasSeenOnboarding', true)
|
||||
|
||||
// Track visible view
|
||||
<VisibilityView
|
||||
enabled={true}
|
||||
onChangeStatus={(isActive) => {
|
||||
if (isActive) {
|
||||
// This view is now the primary visible view
|
||||
video.play()
|
||||
} else {
|
||||
video.pause()
|
||||
}
|
||||
}}
|
||||
>
|
||||
<VideoPlayer />
|
||||
</VisibilityView>
|
||||
```
|
||||
|
||||
## Version
|
||||
|
||||
Current version: 0.6.0
|
||||
@@ -1,3 +1,115 @@
|
||||
# expo-emoji-picker
|
||||
|
||||
Based on [react-native-emoji-popup](https://github.com/okwasniewski/react-native-emoji-popup) and [expo-emoji-picker](https://github.com/alanjhughes/expo-emoji-picker)
|
||||
A native emoji picker module for React Native applications built with Expo. This module provides platform-specific emoji selection interfaces using native system components.
|
||||
|
||||
Based on [react-native-emoji-popup](https://github.com/okwasniewski/react-native-emoji-popup) and [expo-emoji-picker](https://github.com/alanjhughes/expo-emoji-picker).
|
||||
|
||||
## What It Does
|
||||
|
||||
The module exposes a React component that presents native emoji picker UI on iOS and Android. When a user selects an emoji, it fires a callback with the selected emoji string.
|
||||
|
||||
## Platform Support
|
||||
|
||||
- **iOS**: Uses [MCEmojiPicker](https://github.com/izyumkin/MCEmojiPicker) presented as a modal picker
|
||||
- **Android**: Uses the system `androidx.emoji2.emojipicker.EmojiPickerView` component
|
||||
- **Web**: Not supported (native platforms only)
|
||||
|
||||
## How It Works
|
||||
|
||||
### Architecture
|
||||
|
||||
The module follows Expo's module architecture with three layers:
|
||||
|
||||
1. **JavaScript/TypeScript Layer** (`src/`): React components and type definitions
|
||||
2. **Native iOS Layer** (`ios/`): Swift implementation using MCEmojiPicker
|
||||
3. **Native Android Layer** (`android/`): Kotlin implementation using AndroidX emoji picker
|
||||
|
||||
### iOS Implementation
|
||||
|
||||
On iOS, the module creates an invisible tap target view. When tapped, it presents MCEmojiPicker as a modal view controller:
|
||||
|
||||
- `EmojiPickerView.swift`: Custom view that handles tap gestures and presents the picker
|
||||
- `EmojiPickerModule.swift`: Module definition that registers the view with Expo
|
||||
- Uses MCEmojiPicker dependency for the native picker UI
|
||||
|
||||
The picker is presented from the current React view controller and returns the selected emoji via an event dispatcher.
|
||||
|
||||
### Android Implementation
|
||||
|
||||
On Android, the module embeds the AndroidX EmojiPickerView directly as a full-screen component:
|
||||
|
||||
- `EmojiPickerModuleView.kt`: Wraps the system EmojiPickerView in an ExpoView
|
||||
- `EmojiPickerModule.kt`: Module definition that registers the view with Expo
|
||||
- Handles configuration changes (dark mode, orientation) by recreating the view
|
||||
|
||||
The AndroidX emoji picker provides a grid-based interface with category tabs and search.
|
||||
|
||||
### Platform-Specific React Components
|
||||
|
||||
The module uses platform-specific file extensions for different behaviors:
|
||||
|
||||
- `EmojiPicker.tsx` (iOS): Renders an invisible tap target that accepts children
|
||||
- `EmojiPicker.android.tsx` (Android): Renders the full emoji picker view with flex: 1 layout
|
||||
|
||||
Both components normalize the native event structure to provide a consistent `onEmojiSelected` callback.
|
||||
|
||||
## Key Files
|
||||
|
||||
### Configuration
|
||||
- `expo-module.config.json`: Defines the module name and native class mappings for iOS and Android
|
||||
|
||||
### TypeScript/React
|
||||
- `index.ts`: Public exports for the module
|
||||
- `src/EmojiPickerModule.ts`: Native module registration
|
||||
- `src/EmojiPickerModule.types.ts`: TypeScript type definitions
|
||||
- `src/EmojiPickerView.tsx`: Base native view component
|
||||
- `src/EmojiPicker.tsx`: iOS-specific implementation
|
||||
- `src/EmojiPicker.android.tsx`: Android-specific implementation
|
||||
|
||||
### iOS (Swift)
|
||||
- `ios/EmojiPickerModule.swift`: Module definition (11 lines)
|
||||
- `ios/EmojiPickerView.swift`: View implementation with tap handling and picker presentation
|
||||
- `ios/EmojiPickerModule.podspec`: CocoaPods specification with MCEmojiPicker dependency
|
||||
|
||||
### Android (Kotlin)
|
||||
- `android/src/main/java/expo/community/modules/emojipicker/EmojiPickerModule.kt`: Module definition
|
||||
- `android/src/main/java/expo/community/modules/emojipicker/EmojiPickerModuleView.kt`: View implementation
|
||||
- `android/build.gradle`: Gradle configuration with androidx.emoji2:emoji2-emojipicker dependency
|
||||
|
||||
## Usage
|
||||
|
||||
```tsx
|
||||
import { EmojiPicker } from 'expo-emoji-picker'
|
||||
|
||||
function MyComponent() {
|
||||
const handleEmojiSelected = (emoji: string) => {
|
||||
console.log('Selected emoji:', emoji)
|
||||
}
|
||||
|
||||
return (
|
||||
<EmojiPicker onEmojiSelected={handleEmojiSelected}>
|
||||
{/* On iOS, children render as the tap target */}
|
||||
{/* On Android, children are ignored - picker is shown directly */}
|
||||
</EmojiPicker>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
### iOS
|
||||
- ExpoModulesCore
|
||||
- MCEmojiPicker (external CocoaPods dependency)
|
||||
- Minimum iOS version: 15.1
|
||||
|
||||
### Android
|
||||
- expo-modules-core
|
||||
- androidx.emoji2:emoji2-emojipicker:1.5.0
|
||||
- Minimum SDK: 21
|
||||
- Target SDK: 34
|
||||
|
||||
## Configuration
|
||||
|
||||
No additional configuration is required. The module is automatically linked through Expo's autolinking system when the app is built.
|
||||
|
||||
The module definition in `expo-module.config.json` specifies the native class names for each platform, which Expo uses to register the module at runtime.
|
||||
|
||||
@@ -1,8 +1,121 @@
|
||||
# Expo Receive Android Intents
|
||||
|
||||
This module handles incoming intents on Android. Handled intents are `text/plain` and `image/*` (single or multiple).
|
||||
The module handles saving images to the app's filesystem for access within the app, limiting the selection of images
|
||||
to a max of four, and handling intent types. No JS code is required for this module, and it is no-op on non-android
|
||||
platforms.
|
||||
An Expo module that handles incoming Android intents for sharing text, images, and videos into the Bluesky app.
|
||||
|
||||
No installation is required. Gradle will automatically add this module on build.
|
||||
## What It Does
|
||||
|
||||
This module intercepts Android share intents (when a user shares content from another app to Bluesky) and converts them into deep links that the app can handle. It supports:
|
||||
|
||||
- **Text sharing** - Share plain text to compose a post
|
||||
- **Image sharing** - Share single or multiple images (up to 4) to attach to a post
|
||||
- **Video sharing** - Share a single video to attach to a post
|
||||
|
||||
The module operates entirely in native Android code and requires no JavaScript API calls. It automatically registers itself with Expo's module system and handles intents when the app is launched or receives new intents.
|
||||
|
||||
## Platform Support
|
||||
|
||||
- **Android**: Fully supported
|
||||
- **iOS**: No-op (iOS handles share intents differently)
|
||||
- **Web**: No-op
|
||||
|
||||
## How It Works
|
||||
|
||||
### Architecture
|
||||
|
||||
The module uses Expo's module lifecycle hooks to intercept Android intents at two key moments:
|
||||
|
||||
1. **OnCreate** - When the app is first launched from an intent
|
||||
2. **OnNewIntent** - When the app receives a new intent while already running
|
||||
|
||||
### Intent Processing Flow
|
||||
|
||||
1. **Intent Reception**: Android sends an `ACTION_SEND` or `ACTION_SEND_MULTIPLE` intent
|
||||
2. **Type Detection**: Module determines content type (text, image, or video)
|
||||
3. **Content Processing**:
|
||||
- **Text**: URL-encodes the text
|
||||
- **Images**: Saves to app cache, extracts dimensions (limited to 4 images max)
|
||||
- **Video**: Copies to app cache with extension detection, extracts dimensions
|
||||
4. **Deep Link Generation**: Creates a `bluesky://intent/compose` URL with encoded parameters
|
||||
5. **App Launch**: Starts a new activity with the deep link, which is handled by `useIntentHandler`
|
||||
|
||||
### Deep Link Format
|
||||
|
||||
The module generates deep links in the following formats:
|
||||
|
||||
```
|
||||
# Text only
|
||||
bluesky://intent/compose?text=<encoded-text>
|
||||
|
||||
# Images (single or multiple)
|
||||
bluesky://intent/compose?imageUris=<uri1>|<width>|<height>,<uri2>|<width>|<height>&text=<encoded-text>
|
||||
|
||||
# Video (single only)
|
||||
bluesky://intent/compose?videoUri=<uri>|<width>|<height>&text=<encoded-text>
|
||||
```
|
||||
|
||||
All URIs use the `file://` scheme pointing to files in the app's cache directory. Dimensions are included to avoid expensive measurement operations in JavaScript.
|
||||
|
||||
### Security Considerations
|
||||
|
||||
- Images and videos are copied to the app's private cache directory before being passed to the app
|
||||
- The JavaScript handler (`useIntentHandler.ts`) validates image URIs with a regex to prevent external URLs
|
||||
- Image URIs containing `http://` or `https://` are filtered out
|
||||
- Multiple image sharing is limited to 4 images maximum
|
||||
|
||||
## Key Files
|
||||
|
||||
### Module Configuration
|
||||
|
||||
- **expo-module.config.json** - Declares the module and registers it with Expo (Android-only)
|
||||
|
||||
### Native Implementation
|
||||
|
||||
- **ExpoReceiveAndroidIntentsModule.kt** - Main module class with intent handling logic
|
||||
- `handleIntent()` - Routes intents based on type
|
||||
- `handleTextIntent()` - Processes text sharing
|
||||
- `handleAttachmentIntent()` - Processes single image/video
|
||||
- `handleAttachmentsIntent()` - Processes multiple images
|
||||
- `getImageInfo()` - Saves images to cache and extracts dimensions
|
||||
- `getVideoInfo()` - Extracts video dimensions using MediaMetadataRetriever
|
||||
|
||||
- **android/build.gradle** - Gradle build configuration
|
||||
- Version: 0.4.1
|
||||
- Requires: Kotlin, expo-modules-core
|
||||
- Compile SDK: 33, Min SDK: 21, Target SDK: 34
|
||||
|
||||
- **android/src/main/AndroidManifest.xml** - Empty manifest (intent filters configured in main app)
|
||||
|
||||
### JavaScript Integration
|
||||
|
||||
The deep links generated by this module are handled by:
|
||||
|
||||
- **src/lib/hooks/useIntentHandler.ts** - `useComposeIntent()` parses the deep link parameters and opens the composer with pre-populated content
|
||||
|
||||
## Installation
|
||||
|
||||
No manual installation is required. Gradle automatically includes this module during the Android build process. The module is auto-linked through Expo's module system.
|
||||
|
||||
## Configuration
|
||||
|
||||
Intent filters must be configured in the main app's `AndroidManifest.xml` to declare which MIME types the app accepts. The module itself has an empty manifest.
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
### Android Version Compatibility
|
||||
|
||||
The module uses version-specific APIs for Android 13+ (API 33):
|
||||
- `getParcelableExtra()` with type parameter on Android 13+
|
||||
- Legacy `getParcelableExtra()` on older versions
|
||||
|
||||
### File Handling
|
||||
|
||||
- Temporary files are created using `File.createTempFile()` in the app's cache directory
|
||||
- Image files use `.jpeg` extension and are compressed at 100% quality
|
||||
- Video files preserve their original extension, defaulting to `.mp4` if none is detected
|
||||
|
||||
### Limitations
|
||||
|
||||
- Video sharing only supports a single video
|
||||
- Multiple video sharing is not implemented
|
||||
- Images are always converted to JPEG format
|
||||
- Maximum of 4 images can be shared at once
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
# expo-scroll-forwarder
|
||||
|
||||
An Expo native module that forwards scroll gestures from a UIView to a UIScrollView on iOS. This enables custom scroll behaviors by allowing a non-scrollable view to control a scrollable view's scroll position.
|
||||
|
||||
## What It Does
|
||||
|
||||
This module solves a specific interaction problem: allowing a fixed header or overlay view to respond to scroll gestures and forward them to an underlying scroll view. The primary use case in the Bluesky app is the profile screen, where the profile header sits above a scrollable content area and can be dragged to scroll the content below it.
|
||||
|
||||
Key behaviors:
|
||||
- Captures pan gestures on a wrapper view and translates them to scroll offsets on a target scroll view
|
||||
- Implements physics-based deceleration animations that match native scroll behavior
|
||||
- Supports pull-to-refresh interactions with haptic feedback
|
||||
- Prevents gesture conflicts with iOS swipe-back navigation by only activating on vertical pans
|
||||
- Provides rubber-band damping when scrolling past content bounds
|
||||
|
||||
## Architecture
|
||||
|
||||
The module consists of three main parts:
|
||||
|
||||
### 1. Native iOS Implementation (Swift)
|
||||
|
||||
**ExpoScrollForwarderView.swift** - The core native view component that:
|
||||
- Attaches a UIPanGestureRecognizer to intercept scroll gestures
|
||||
- Finds and references the target RCTScrollView using its React Native tag
|
||||
- Implements custom scroll physics including velocity-based decay animation
|
||||
- Manages gesture recognizer delegation to prevent conflicts with system gestures
|
||||
- Handles pull-to-refresh activation at -130pt scroll offset with haptic feedback
|
||||
|
||||
**ExpoScrollForwarderModule.swift** - The Expo module definition that:
|
||||
- Registers the view component with Expo
|
||||
- Exposes the `scrollViewTag` prop to specify which scroll view to control
|
||||
|
||||
### 2. TypeScript Interface
|
||||
|
||||
**ExpoScrollForwarderView.tsx** - Platform-specific implementations:
|
||||
- **iOS (.ios.tsx)**: Wraps the native view manager from expo-modules-core
|
||||
- **Default (.tsx)**: No-op wrapper that just renders children (for Android/Web compatibility)
|
||||
|
||||
**ExpoScrollForwarder.types.ts** - TypeScript type definitions:
|
||||
- `scrollViewTag`: The React Native tag of the scroll view to control
|
||||
- `children`: The content to render (typically a header component)
|
||||
|
||||
### 3. Module Configuration
|
||||
|
||||
**expo-module.config.json** - Declares iOS-only platform support
|
||||
|
||||
**ExpoScrollForwarder.podspec** - CocoaPods specification for iOS dependency management
|
||||
|
||||
## Usage
|
||||
|
||||
```tsx
|
||||
import {ExpoScrollForwarderView} from 'expo-scroll-forwarder'
|
||||
|
||||
function ProfileScreen() {
|
||||
const scrollViewTag = useRef(null)
|
||||
|
||||
return (
|
||||
<View>
|
||||
<ExpoScrollForwarderView scrollViewTag={scrollViewTag.current}>
|
||||
<ProfileHeader />
|
||||
</ExpoScrollForwarderView>
|
||||
|
||||
<ScrollView ref={scrollViewTag}>
|
||||
{/* Scrollable content */}
|
||||
</ScrollView>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
The `scrollViewTag` prop must be the React Native tag (numeric identifier) of the target scroll view. The module uses this to locate the native UIScrollView instance.
|
||||
|
||||
## Platform Support
|
||||
|
||||
- **iOS**: Full native implementation with custom scroll physics
|
||||
- **Android**: No-op wrapper (renders children without scroll forwarding)
|
||||
- **Web**: No-op wrapper (renders children without scroll forwarding)
|
||||
|
||||
The module is designed to enhance iOS UX while gracefully degrading on other platforms.
|
||||
|
||||
## Key Implementation Details
|
||||
|
||||
### Gesture Recognition
|
||||
- Only activates when pan velocity is more vertical than horizontal (`abs(velocity.y) > abs(velocity.x)`)
|
||||
- Delegates to UIGestureRecognizerDelegate to prevent simultaneous recognition with navigation swipe-back
|
||||
- Adds tap/long-press recognizers to the scroll view to cancel ongoing animations
|
||||
|
||||
### Scroll Physics
|
||||
- Implements custom decay animation at 120fps using a Timer
|
||||
- Velocity decay factor: 0.9875 per frame
|
||||
- Velocity clamped to +/- 5000 points/second
|
||||
- Rubber-band damping: offsets below 0 are reduced by 55%
|
||||
- Animation stops when velocity drops below 5 points/second
|
||||
|
||||
### Pull-to-Refresh
|
||||
- Triggers at -130pt scroll offset
|
||||
- Provides haptic feedback (UIImpactFeedbackGenerator, light style)
|
||||
- Calls refresh control via `RCTRefreshControl.forwarderBeginRefreshing()`
|
||||
|
||||
### Scroll View Management
|
||||
- Dynamically finds scroll view using `AppContext.findView(withTag:ofType:)`
|
||||
- Properly cleans up gesture recognizers when switching between scroll views
|
||||
- Maintains references to both the scroll view and its refresh control
|
||||
|
||||
## Files Overview
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `ios/ExpoScrollForwarderView.swift` | Native iOS view implementation with gesture handling and scroll physics |
|
||||
| `ios/ExpoScrollForwarderModule.swift` | Expo module registration and prop definitions |
|
||||
| `ios/ExpoScrollForwarder.podspec` | CocoaPods dependency specification |
|
||||
| `src/ExpoScrollForwarderView.ios.tsx` | TypeScript wrapper for iOS native view |
|
||||
| `src/ExpoScrollForwarderView.tsx` | Default no-op implementation for other platforms |
|
||||
| `src/ExpoScrollForwarder.types.ts` | TypeScript type definitions |
|
||||
| `index.ts` | Module entry point |
|
||||
| `expo-module.config.json` | Expo module configuration |
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bsky.app",
|
||||
"version": "1.119.0",
|
||||
"version": "1.122.0",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
@@ -81,13 +81,19 @@
|
||||
"icons:optimize": "svgo -f ./assets/icons"
|
||||
},
|
||||
"dependencies": {
|
||||
"@atproto/api": "^0.19.3",
|
||||
"@atproto/api": "^0.19.11",
|
||||
"@atproto/syntax": "0.5.2",
|
||||
"@bitdrift/react-native": "^0.6.8",
|
||||
"@braintree/sanitize-url": "^6.0.2",
|
||||
"@bsky.app/alf": "^0.1.7",
|
||||
"@bsky.app/expo-guess-language": "^0.2.8",
|
||||
"@bsky.app/expo-image-crop-tool": "^0.5.0",
|
||||
"@bsky.app/expo-scroll-edge-effect": "^0.1.4",
|
||||
"@bsky.app/expo-translate-text": "^0.2.9",
|
||||
"@bsky.app/react-native-mmkv": "2.12.5",
|
||||
"@bsky.app/sift": "^0.3.3",
|
||||
"@bsky.app/tapper": "^0.5.1",
|
||||
"@bsky.app/video": "0.3.4",
|
||||
"@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet",
|
||||
"@emoji-mart/data": "^1.2.1",
|
||||
"@emoji-mart/react": "^1.1.1",
|
||||
@@ -105,11 +111,9 @@
|
||||
"@fortawesome/react-native-fontawesome": "^0.3.2",
|
||||
"@growthbook/growthbook": "^1.6.5",
|
||||
"@growthbook/growthbook-react": "^1.6.5",
|
||||
"@haileyok/bluesky-video": "0.3.2",
|
||||
"@ipld/dag-cbor": "^9.2.0",
|
||||
"@lingui/core": "^5.9.2",
|
||||
"@lingui/react": "^5.9.2",
|
||||
"@mattermost/react-native-paste-input": "mattermost/react-native-paste-input",
|
||||
"@miblanchard/react-native-slider": "^2.6.0",
|
||||
"@mozzius/expo-dynamic-app-icon": "^1.8.0",
|
||||
"@react-native-async-storage/async-storage": "2.2.0",
|
||||
@@ -117,9 +121,9 @@
|
||||
"@react-navigation/native": "^7.1.33",
|
||||
"@react-navigation/native-stack": "^7.14.4",
|
||||
"@sentry/react-native": "~6.20.0",
|
||||
"@tanstack/query-async-storage-persister": "^5.25.0",
|
||||
"@tanstack/react-query": "5.25.0",
|
||||
"@tanstack/react-query-persist-client": "^5.25.0",
|
||||
"@tanstack/query-async-storage-persister": "^5.96.2",
|
||||
"@tanstack/react-query": "^5.96.2",
|
||||
"@tanstack/react-query-persist-client": "^5.96.2",
|
||||
"@tiptap/core": "^2.9.1",
|
||||
"@tiptap/extension-document": "^2.9.1",
|
||||
"@tiptap/extension-hard-break": "^2.9.1",
|
||||
@@ -155,6 +159,7 @@
|
||||
"expo-device": "~8.0.10",
|
||||
"expo-file-system": "~19.0.21",
|
||||
"expo-font": "~14.0.11",
|
||||
"expo-glass-effect": "55.0.8",
|
||||
"expo-haptics": "~15.0.8",
|
||||
"expo-image": "~3.0.11",
|
||||
"expo-image-manipulator": "~14.0.8",
|
||||
@@ -167,6 +172,7 @@
|
||||
"expo-location": "~19.0.8",
|
||||
"expo-media-library": "~18.2.1",
|
||||
"expo-notifications": "~0.32.16",
|
||||
"expo-paste-input": "^0.1.15",
|
||||
"expo-privacy-sensitive": "^0.1.0",
|
||||
"expo-screen-orientation": "~9.0.8",
|
||||
"expo-sharing": "~14.0.8",
|
||||
@@ -179,6 +185,7 @@
|
||||
"expo-web-browser": "~15.0.10",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"fast-text-encoding": "^1.0.6",
|
||||
"fuse.js": "^7.1.0",
|
||||
"hls.js": "^1.6.2",
|
||||
"idb-keyval": "^6.2.2",
|
||||
"js-sha256": "^0.9.0",
|
||||
@@ -199,6 +206,7 @@
|
||||
"react": "19.1.0",
|
||||
"react-compiler-runtime": "^19.1.0-rc.1",
|
||||
"react-dom": "19.1.0",
|
||||
"react-hotkeys-hook": "5.2.4",
|
||||
"react-image-crop": "^11.0.7",
|
||||
"react-is": "19",
|
||||
"react-keyed-flatten-children": "^5.0.0",
|
||||
@@ -209,7 +217,7 @@
|
||||
"react-native-drawer-layout": "^4.2.2",
|
||||
"react-native-edge-to-edge": "^1.6.0",
|
||||
"react-native-gesture-handler": "~2.28.0",
|
||||
"react-native-keyboard-controller": "^1.21.0",
|
||||
"react-native-keyboard-controller": "^1.21.5",
|
||||
"react-native-pager-view": "6.8.0",
|
||||
"react-native-progress": "bluesky-social/react-native-progress",
|
||||
"react-native-qrcode-styled": "^0.3.3",
|
||||
@@ -241,12 +249,10 @@
|
||||
"@babel/runtime": "^7.26.0",
|
||||
"@crowdin/cli": "^4.14.1",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@expo/config-plugins": "~54.0.4",
|
||||
"@lingui/babel-plugin-lingui-macro": "^5.9.2",
|
||||
"@lingui/cli": "^5.9.2",
|
||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
|
||||
"@react-native/babel-preset": "0.81.5",
|
||||
"@react-native/eslint-config": "^0.81.5",
|
||||
"@react-native/typescript-config": "^0.81.5",
|
||||
"@sentry/webpack-plugin": "^3.2.2",
|
||||
"@testing-library/react-native": "^13.2.0",
|
||||
@@ -264,14 +270,14 @@
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-import-resolver-typescript": "^4.4.4",
|
||||
"eslint-plugin-bsky-internal": "link:./eslint",
|
||||
"eslint-plugin-import-x": "^4.16.1",
|
||||
"eslint-plugin-lingui": "^0.11.0",
|
||||
"eslint-plugin-import-x": "^4.16.2",
|
||||
"eslint-plugin-lingui": "^0.12.0",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-native": "^5.0.0",
|
||||
"eslint-plugin-react-native-a11y": "^3.5.1",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"eslint-plugin-simple-import-sort": "^13.0.0",
|
||||
"file-loader": "6.2.0",
|
||||
"globals": "^17.0.0",
|
||||
"husky": "^8.0.3",
|
||||
@@ -286,8 +292,8 @@
|
||||
"react-refresh": "^0.14.0",
|
||||
"svgo": "^3.3.2",
|
||||
"ts-plugin-sort-import-suggestions": "^1.0.4",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.56.0",
|
||||
"typescript": "^6.0.2",
|
||||
"typescript-eslint": "^8.58.0",
|
||||
"webpack-bundle-analyzer": "^4.10.1"
|
||||
},
|
||||
"resolutions": {
|
||||
@@ -324,7 +330,8 @@
|
||||
],
|
||||
"modulePathIgnorePatterns": [
|
||||
"__tests__/.*/__mocks__",
|
||||
"__e2e__/.*"
|
||||
"__e2e__/.*",
|
||||
"bskylink/.*"
|
||||
],
|
||||
"coveragePathIgnorePatterns": [
|
||||
"<rootDir>/node_modules/",
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
diff --git a/node_modules/@haileyok/bluesky-video/android/build.gradle b/node_modules/@haileyok/bluesky-video/android/build.gradle
|
||||
index b988d3f..7743421 100644
|
||||
--- a/node_modules/@haileyok/bluesky-video/android/build.gradle
|
||||
+++ b/node_modules/@haileyok/bluesky-video/android/build.gradle
|
||||
@@ -36,6 +36,7 @@ android {
|
||||
defaultConfig {
|
||||
versionCode 1
|
||||
versionName "0.1.0"
|
||||
+ consumerProguardFiles 'proguard-rules.pro'
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
diff --git a/node_modules/@haileyok/bluesky-video/android/proguard-rules.pro b/node_modules/@haileyok/bluesky-video/android/proguard-rules.pro
|
||||
new file mode 100644
|
||||
index 0000000..3b5b864
|
||||
--- /dev/null
|
||||
+++ b/node_modules/@haileyok/bluesky-video/android/proguard-rules.pro
|
||||
@@ -0,0 +1,2 @@
|
||||
+# Keep FullscreenActivity from being stripped by R8/ProGuard
|
||||
+-keep class expo.modules.blueskyvideo.FullscreenActivity { *; }
|
||||
diff --git a/node_modules/@haileyok/bluesky-video/android/src/main/java/expo/modules/blueskyvideo/BlueskyVideoView.kt b/node_modules/@haileyok/bluesky-video/android/src/main/java/expo/modules/blueskyvideo/BlueskyVideoView.kt
|
||||
index fdabd84..eda8c7c 100644
|
||||
--- a/node_modules/@haileyok/bluesky-video/android/src/main/java/expo/modules/blueskyvideo/BlueskyVideoView.kt
|
||||
+++ b/node_modules/@haileyok/bluesky-video/android/src/main/java/expo/modules/blueskyvideo/BlueskyVideoView.kt
|
||||
@@ -1,8 +1,11 @@
|
||||
package expo.modules.blueskyvideo
|
||||
|
||||
+import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
+import android.os.Build
|
||||
+import android.util.Log
|
||||
import android.graphics.Rect
|
||||
import android.net.Uri
|
||||
import android.view.ViewGroup
|
||||
@@ -237,9 +240,44 @@ class BlueskyVideoView(
|
||||
// Fullscreen handling
|
||||
|
||||
fun enterFullscreen(keepDisplayOn: Boolean) {
|
||||
- val currentActivity = this.appContext.currentActivity ?: return
|
||||
+ val tag = "BlueskyVideo"
|
||||
+
|
||||
+ Log.d(tag, "enterFullscreen() called - keepDisplayOn=$keepDisplayOn")
|
||||
+ Log.d(tag, " isFullscreen=$isFullscreen, isPlaying=$isPlaying, isMuted=$isMuted")
|
||||
+ Log.d(tag, " player=${player != null}, url=$url")
|
||||
+ Log.d(tag, " isAttachedToWindow=$isAttachedToWindow, isShown=$isShown")
|
||||
+ Log.d(tag, " Android SDK: ${Build.VERSION.SDK_INT}, Device: ${Build.MANUFACTURER} ${Build.MODEL}")
|
||||
+
|
||||
+ val currentActivity = this.appContext.currentActivity
|
||||
+ if (currentActivity == null) {
|
||||
+ Log.e(tag, "enterFullscreen() FAILED: currentActivity is null")
|
||||
+ Log.e(tag, " appContext=$appContext")
|
||||
+ onError(mapOf("error" to "Cannot enter fullscreen: no current activity"))
|
||||
+ return
|
||||
+ }
|
||||
+
|
||||
+ Log.d(tag, " currentActivity=$currentActivity")
|
||||
+ Log.d(tag, " activity.isFinishing=${currentActivity.isFinishing}")
|
||||
+ Log.d(tag, " activity.isDestroyed=${currentActivity.isDestroyed}")
|
||||
+ Log.d(tag, " activity.lifecycle=${(currentActivity as? androidx.lifecycle.LifecycleOwner)?.lifecycle?.currentState}")
|
||||
+ Log.d(tag, " activity.hasWindowFocus=${currentActivity.hasWindowFocus()}")
|
||||
+ Log.d(tag, " activity.window.isActive=${currentActivity.window?.isActive}")
|
||||
+
|
||||
+ // Check if activity is in a valid state to start another activity
|
||||
+ if (currentActivity.isFinishing) {
|
||||
+ Log.e(tag, "enterFullscreen() FAILED: currentActivity is finishing")
|
||||
+ onError(mapOf("error" to "Cannot enter fullscreen: activity is finishing"))
|
||||
+ return
|
||||
+ }
|
||||
+
|
||||
+ if (currentActivity.isDestroyed) {
|
||||
+ Log.e(tag, "enterFullscreen() FAILED: currentActivity is destroyed")
|
||||
+ onError(mapOf("error" to "Cannot enter fullscreen: activity is destroyed"))
|
||||
+ return
|
||||
+ }
|
||||
|
||||
this.enteredFullscreenMuteState = this.isMuted
|
||||
+ Log.d(tag, " saved enteredFullscreenMuteState=$enteredFullscreenMuteState")
|
||||
|
||||
// We always want to start with unmuted state and playing. Fire those from here so the
|
||||
// event dispatcher gets called
|
||||
@@ -247,18 +285,51 @@ class BlueskyVideoView(
|
||||
if (!this.isPlaying) {
|
||||
this.play()
|
||||
}
|
||||
+ Log.d(tag, " after unmute/play: isPlaying=$isPlaying, isMuted=$isMuted")
|
||||
|
||||
// Remove the player from this view, but don't null the player!
|
||||
this.playerView.player = null
|
||||
+ Log.d(tag, " detached player from playerView")
|
||||
|
||||
// create the intent and give it a view
|
||||
val intent = Intent(context, FullscreenActivity::class.java)
|
||||
intent.putExtra("keepDisplayOn", keepDisplayOn)
|
||||
FullscreenActivity.asscVideoView = WeakReference(this)
|
||||
|
||||
+ Log.d(tag, " intent created: $intent")
|
||||
+ Log.d(tag, " intent.component=${intent.component}")
|
||||
+ Log.d(tag, " intent.flags=${intent.flags} (0x${Integer.toHexString(intent.flags)})")
|
||||
+ Log.d(tag, " context for intent=$context")
|
||||
+ Log.d(tag, " FullscreenActivity.asscVideoView set to WeakReference(this)")
|
||||
+
|
||||
// fire the fullscreen event and launch the intent
|
||||
- this.isFullscreen = true
|
||||
- currentActivity.startActivity(intent)
|
||||
+ try {
|
||||
+ Log.d(tag, " calling startActivity()...")
|
||||
+ currentActivity.startActivity(intent)
|
||||
+ this.isFullscreen = true
|
||||
+ Log.d(tag, " startActivity() SUCCESS - isFullscreen set to true")
|
||||
+ } catch (e: Exception) {
|
||||
+ Log.e(tag, "enterFullscreen() FAILED: startActivity() threw exception", e)
|
||||
+ Log.e(tag, " exception class: ${e.javaClass.name}")
|
||||
+ Log.e(tag, " exception message: ${e.message}")
|
||||
+ Log.e(tag, " exception cause: ${e.cause}")
|
||||
+ e.printStackTrace()
|
||||
+
|
||||
+ // Restore state since fullscreen failed
|
||||
+ this.playerView.player = this.player
|
||||
+ Log.d(tag, " restored player to playerView after failure")
|
||||
+
|
||||
+ if (this.enteredFullscreenMuteState) {
|
||||
+ this.mute()
|
||||
+ Log.d(tag, " restored mute state after failure")
|
||||
+ }
|
||||
+
|
||||
+ onError(mapOf(
|
||||
+ "error" to "Failed to enter fullscreen: ${e.message}",
|
||||
+ "exceptionClass" to e.javaClass.name,
|
||||
+ "exceptionMessage" to (e.message ?: "unknown")
|
||||
+ ))
|
||||
+ }
|
||||
}
|
||||
|
||||
fun onExitFullscreen() {
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/node_modules/@mattermost/react-native-paste-input/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputManager.kt b/node_modules/@mattermost/react-native-paste-input/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputManager.kt
|
||||
index 4ed2307..ede1181 100644
|
||||
--- a/node_modules/@mattermost/react-native-paste-input/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputManager.kt
|
||||
+++ b/node_modules/@mattermost/react-native-paste-input/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputManager.kt
|
||||
@@ -54,7 +54,7 @@ class PasteTextInputManager(context: ReactApplicationContext) : ReactTextInputMa
|
||||
}
|
||||
|
||||
override fun getExportedCustomBubblingEventTypeConstants(): MutableMap<String, Any> {
|
||||
- val map = super.getExportedCustomBubblingEventTypeConstants()!!
|
||||
+ val map = super.getExportedCustomBubblingEventTypeConstants().toMutableMap()
|
||||
map["onPaste"] = MapBuilder.of(
|
||||
"phasedRegistrationNames",
|
||||
MapBuilder.of("bubbled", "onPaste")
|
||||
@@ -1,264 +0,0 @@
|
||||
diff --git a/node_modules/@mattermost/react-native-paste-input/ios/PasteInputView.m b/node_modules/@mattermost/react-native-paste-input/ios/PasteInputView.m
|
||||
index e916023..5049c33 100644
|
||||
--- a/node_modules/@mattermost/react-native-paste-input/ios/PasteInputView.m
|
||||
+++ b/node_modules/@mattermost/react-native-paste-input/ios/PasteInputView.m
|
||||
@@ -4,6 +4,7 @@
|
||||
//
|
||||
// Created by Elias Nahum on 04-11-20.
|
||||
// Copyright © 2020 Facebook. All rights reserved.
|
||||
+// Updated to remove parent’s default text view
|
||||
//
|
||||
|
||||
#import "PasteInputView.h"
|
||||
@@ -12,49 +13,78 @@
|
||||
|
||||
@implementation PasteInputView
|
||||
{
|
||||
- PasteInputTextView *_backedTextInputView;
|
||||
+ // We'll store the custom text view in this ivar
|
||||
+ PasteInputTextView *_customBackedTextView;
|
||||
}
|
||||
|
||||
- (instancetype)initWithBridge:(RCTBridge *)bridge
|
||||
{
|
||||
+ // Must call the super’s designated initializer
|
||||
if (self = [super initWithBridge:bridge]) {
|
||||
- _backedTextInputView = [[PasteInputTextView alloc] initWithFrame:self.bounds];
|
||||
- _backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
- _backedTextInputView.textInputDelegate = self;
|
||||
+ // 1. The parent (RCTMultilineTextInputView) has already created
|
||||
+ // its own _backedTextInputView = [RCTUITextView new] in super init.
|
||||
+ // We can remove that subview:
|
||||
|
||||
- [self addSubview:_backedTextInputView];
|
||||
- }
|
||||
+ id<RCTBackedTextInputViewProtocol> parentInputView = super.backedTextInputView;
|
||||
+ if ([parentInputView isKindOfClass:[UIView class]]) {
|
||||
+ UIView *parentSubview = (UIView *)parentInputView;
|
||||
+ if (parentSubview.superview == self) {
|
||||
+ [parentSubview removeFromSuperview];
|
||||
+ }
|
||||
+ }
|
||||
|
||||
+ // 2. Now create our custom PasteInputTextView
|
||||
+ _customBackedTextView = [[PasteInputTextView alloc] initWithFrame:self.bounds];
|
||||
+ _customBackedTextView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
+ _customBackedTextView.textInputDelegate = self;
|
||||
+
|
||||
+ // Optional: disable inline predictions for iOS 17+
|
||||
+ if (@available(iOS 17.0, *)) {
|
||||
+ _customBackedTextView.inlinePredictionType = UITextInlinePredictionTypeNo;
|
||||
+ }
|
||||
+
|
||||
+ // 3. Add your custom text view as the only subview
|
||||
+ [self addSubview:_customBackedTextView];
|
||||
+ }
|
||||
return self;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * Override the parent's accessor so that anywhere in RN that calls
|
||||
+ * `self.backedTextInputView` will get the custom PasteInputTextView.
|
||||
+ */
|
||||
- (id<RCTBackedTextInputViewProtocol>)backedTextInputView
|
||||
{
|
||||
- return _backedTextInputView;
|
||||
+ return _customBackedTextView;
|
||||
}
|
||||
|
||||
-- (void)setDisableCopyPaste:(BOOL)disableCopyPaste {
|
||||
- _backedTextInputView.disableCopyPaste = disableCopyPaste;
|
||||
+#pragma mark - Setters for React Props
|
||||
+
|
||||
+- (void)setDisableCopyPaste:(BOOL)disableCopyPaste
|
||||
+{
|
||||
+ _customBackedTextView.disableCopyPaste = disableCopyPaste;
|
||||
}
|
||||
|
||||
-- (void)setOnPaste:(RCTDirectEventBlock)onPaste {
|
||||
- _backedTextInputView.onPaste = onPaste;
|
||||
+- (void)setOnPaste:(RCTDirectEventBlock)onPaste
|
||||
+{
|
||||
+ _customBackedTextView.onPaste = onPaste;
|
||||
}
|
||||
|
||||
-- (void)setSmartPunctuation:(NSString *)smartPunctuation {
|
||||
- if ([smartPunctuation isEqualToString:@"enable"]) {
|
||||
- [_backedTextInputView setSmartDashesType:UITextSmartDashesTypeYes];
|
||||
- [_backedTextInputView setSmartQuotesType:UITextSmartQuotesTypeYes];
|
||||
- [_backedTextInputView setSmartInsertDeleteType:UITextSmartInsertDeleteTypeYes];
|
||||
- } else if ([smartPunctuation isEqualToString:@"disable"]) {
|
||||
- [_backedTextInputView setSmartDashesType:UITextSmartDashesTypeNo];
|
||||
- [_backedTextInputView setSmartQuotesType:UITextSmartQuotesTypeNo];
|
||||
- [_backedTextInputView setSmartInsertDeleteType:UITextSmartInsertDeleteTypeNo];
|
||||
- } else {
|
||||
- [_backedTextInputView setSmartDashesType:UITextSmartDashesTypeDefault];
|
||||
- [_backedTextInputView setSmartQuotesType:UITextSmartQuotesTypeDefault];
|
||||
- [_backedTextInputView setSmartInsertDeleteType:UITextSmartInsertDeleteTypeDefault];
|
||||
- }
|
||||
+- (void)setSmartPunctuation:(NSString *)smartPunctuation
|
||||
+{
|
||||
+ if ([smartPunctuation isEqualToString:@"enable"]) {
|
||||
+ [_customBackedTextView setSmartDashesType:UITextSmartDashesTypeYes];
|
||||
+ [_customBackedTextView setSmartQuotesType:UITextSmartQuotesTypeYes];
|
||||
+ [_customBackedTextView setSmartInsertDeleteType:UITextSmartInsertDeleteTypeYes];
|
||||
+ } else if ([smartPunctuation isEqualToString:@"disable"]) {
|
||||
+ [_customBackedTextView setSmartDashesType:UITextSmartDashesTypeNo];
|
||||
+ [_customBackedTextView setSmartQuotesType:UITextSmartQuotesTypeNo];
|
||||
+ [_customBackedTextView setSmartInsertDeleteType:UITextSmartInsertDeleteTypeNo];
|
||||
+ } else {
|
||||
+ [_customBackedTextView setSmartDashesType:UITextSmartDashesTypeDefault];
|
||||
+ [_customBackedTextView setSmartQuotesType:UITextSmartQuotesTypeDefault];
|
||||
+ [_customBackedTextView setSmartInsertDeleteType:UITextSmartInsertDeleteTypeDefault];
|
||||
+ }
|
||||
}
|
||||
|
||||
#pragma mark - UIScrollViewDelegate
|
||||
@@ -62,7 +92,6 @@ - (void)setSmartPunctuation:(NSString *)smartPunctuation {
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
|
||||
{
|
||||
RCTDirectEventBlock onScroll = self.onScroll;
|
||||
-
|
||||
if (onScroll) {
|
||||
CGPoint contentOffset = scrollView.contentOffset;
|
||||
CGSize contentSize = scrollView.contentSize;
|
||||
@@ -71,22 +100,22 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
|
||||
|
||||
onScroll(@{
|
||||
@"contentOffset": @{
|
||||
- @"x": @(contentOffset.x),
|
||||
- @"y": @(contentOffset.y)
|
||||
+ @"x": @(contentOffset.x),
|
||||
+ @"y": @(contentOffset.y)
|
||||
},
|
||||
@"contentInset": @{
|
||||
- @"top": @(contentInset.top),
|
||||
- @"left": @(contentInset.left),
|
||||
- @"bottom": @(contentInset.bottom),
|
||||
- @"right": @(contentInset.right)
|
||||
+ @"top": @(contentInset.top),
|
||||
+ @"left": @(contentInset.left),
|
||||
+ @"bottom": @(contentInset.bottom),
|
||||
+ @"right": @(contentInset.right)
|
||||
},
|
||||
@"contentSize": @{
|
||||
- @"width": @(contentSize.width),
|
||||
- @"height": @(contentSize.height)
|
||||
+ @"width": @(contentSize.width),
|
||||
+ @"height": @(contentSize.height)
|
||||
},
|
||||
@"layoutMeasurement": @{
|
||||
- @"width": @(size.width),
|
||||
- @"height": @(size.height)
|
||||
+ @"width": @(size.width),
|
||||
+ @"height": @(size.height)
|
||||
},
|
||||
@"zoomScale": @(scrollView.zoomScale ?: 1),
|
||||
});
|
||||
diff --git a/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInput.mm b/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInput.mm
|
||||
index dd50053..2ed7017 100644
|
||||
--- a/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInput.mm
|
||||
+++ b/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInput.mm
|
||||
@@ -122,8 +122,8 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
|
||||
const auto &newTextInputProps = static_cast<const PasteTextInputProps &>(*props);
|
||||
|
||||
// Traits:
|
||||
- if (newTextInputProps.traits.multiline != oldTextInputProps.traits.multiline) {
|
||||
- [self _setMultiline:newTextInputProps.traits.multiline];
|
||||
+ if (newTextInputProps.multiline != oldTextInputProps.multiline) {
|
||||
+ [self _setMultiline:newTextInputProps.multiline];
|
||||
}
|
||||
|
||||
if (newTextInputProps.traits.autocapitalizationType != oldTextInputProps.traits.autocapitalizationType) {
|
||||
@@ -421,7 +421,7 @@ - (void)textInputDidChangeSelection
|
||||
return;
|
||||
}
|
||||
const auto &props = static_cast<const PasteTextInputProps &>(*_props);
|
||||
- if (props.traits.multiline && ![_lastStringStateWasUpdatedWith isEqual:_backedTextInputView.attributedText]) {
|
||||
+ if (props.multiline && ![_lastStringStateWasUpdatedWith isEqual:_backedTextInputView.attributedText]) {
|
||||
[self textInputDidChange];
|
||||
_ignoreNextTextInputCall = YES;
|
||||
}
|
||||
@@ -708,11 +708,11 @@ - (BOOL)_textOf:(NSAttributedString *)newText equals:(NSAttributedString *)oldTe
|
||||
- (SubmitBehavior)getSubmitBehavior
|
||||
{
|
||||
const auto &props = static_cast<const PasteTextInputProps &>(*_props);
|
||||
- const SubmitBehavior submitBehaviorDefaultable = props.traits.submitBehavior;
|
||||
+ const SubmitBehavior submitBehaviorDefaultable = props.submitBehavior;
|
||||
|
||||
// We should always have a non-default `submitBehavior`, but in case we don't, set it based on multiline.
|
||||
if (submitBehaviorDefaultable == SubmitBehavior::Default) {
|
||||
- return props.traits.multiline ? SubmitBehavior::Newline : SubmitBehavior::BlurAndSubmit;
|
||||
+ return props.multiline ? SubmitBehavior::Newline : SubmitBehavior::BlurAndSubmit;
|
||||
}
|
||||
|
||||
return submitBehaviorDefaultable;
|
||||
diff --git a/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInputSpecs/Props.cpp b/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInputSpecs/Props.cpp
|
||||
index 29e094f..7ef519a 100644
|
||||
--- a/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInputSpecs/Props.cpp
|
||||
+++ b/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInputSpecs/Props.cpp
|
||||
@@ -22,8 +22,7 @@ PasteTextInputProps::PasteTextInputProps(
|
||||
const PropsParserContext &context,
|
||||
const PasteTextInputProps &sourceProps,
|
||||
const RawProps& rawProps)
|
||||
- : ViewProps(context, sourceProps, rawProps),
|
||||
- BaseTextProps(context, sourceProps, rawProps),
|
||||
+ : BaseTextInputProps(context, sourceProps, rawProps),
|
||||
traits(convertRawProp(context, rawProps, sourceProps.traits, {})),
|
||||
smartPunctuation(convertRawProp(context, rawProps, "smartPunctuation", sourceProps.smartPunctuation, {})),
|
||||
disableCopyPaste(convertRawProp(context, rawProps, "disableCopyPaste", sourceProps.disableCopyPaste, {false})),
|
||||
@@ -133,7 +132,7 @@ TextAttributes PasteTextInputProps::getEffectiveTextAttributes(Float fontSizeMul
|
||||
ParagraphAttributes PasteTextInputProps::getEffectiveParagraphAttributes() const {
|
||||
auto result = paragraphAttributes;
|
||||
|
||||
- if (!traits.multiline) {
|
||||
+ if (!multiline) {
|
||||
result.maximumNumberOfLines = 1;
|
||||
}
|
||||
|
||||
diff --git a/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInputSpecs/Props.h b/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInputSpecs/Props.h
|
||||
index 723d00c..31cfe66 100644
|
||||
--- a/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInputSpecs/Props.h
|
||||
+++ b/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInputSpecs/Props.h
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <react/renderer/components/iostextinput/conversions.h>
|
||||
#include <react/renderer/components/iostextinput/primitives.h>
|
||||
#include <react/renderer/components/text/BaseTextProps.h>
|
||||
+#include <react/renderer/components/textinput/BaseTextInputProps.h>
|
||||
#include <react/renderer/components/view/ViewProps.h>
|
||||
#include <react/renderer/core/Props.h>
|
||||
#include <react/renderer/core/PropsParserContext.h>
|
||||
@@ -25,7 +26,7 @@
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
-class PasteTextInputProps final : public ViewProps, public BaseTextProps {
|
||||
+class PasteTextInputProps final : public BaseTextInputProps {
|
||||
public:
|
||||
PasteTextInputProps() = default;
|
||||
PasteTextInputProps(const PropsParserContext& context, const PasteTextInputProps& sourceProps, const RawProps& rawProps);
|
||||
diff --git a/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInputSpecs/ShadowNodes.cpp b/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInputSpecs/ShadowNodes.cpp
|
||||
index 31e07e3..7f0ebfb 100644
|
||||
--- a/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInputSpecs/ShadowNodes.cpp
|
||||
+++ b/node_modules/@mattermost/react-native-paste-input/ios/PasteTextInputSpecs/ShadowNodes.cpp
|
||||
@@ -91,20 +91,11 @@ void PasteTextInputShadowNode::updateStateIfNeeded(
|
||||
const auto& state = getStateData();
|
||||
|
||||
react_native_assert(textLayoutManager_);
|
||||
- react_native_assert(
|
||||
- (!state.layoutManager || state.layoutManager == textLayoutManager_) &&
|
||||
- "`StateData` refers to a different `TextLayoutManager`");
|
||||
-
|
||||
- if (state.reactTreeAttributedString == reactTreeAttributedString &&
|
||||
- state.layoutManager == textLayoutManager_) {
|
||||
- return;
|
||||
- }
|
||||
|
||||
auto newState = TextInputState{};
|
||||
newState.attributedStringBox = AttributedStringBox{reactTreeAttributedString};
|
||||
newState.paragraphAttributes = getConcreteProps().paragraphAttributes;
|
||||
newState.reactTreeAttributedString = reactTreeAttributedString;
|
||||
- newState.layoutManager = textLayoutManager_;
|
||||
newState.mostRecentEventCount = getConcreteProps().mostRecentEventCount;
|
||||
setStateData(std::move(newState));
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
diff --git a/node_modules/expo-glass-effect/ios/GlassContainer.swift b/node_modules/expo-glass-effect/ios/GlassContainer.swift
|
||||
index 61fb67c..b2d111e 100644
|
||||
--- a/node_modules/expo-glass-effect/ios/GlassContainer.swift
|
||||
+++ b/node_modules/expo-glass-effect/ios/GlassContainer.swift
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2022-present 650 Industries. All rights reserved.
|
||||
|
||||
import ExpoModulesCore
|
||||
+import React
|
||||
|
||||
public final class GlassContainer: ExpoView {
|
||||
private var containerEffect: Any?
|
||||
@@ -46,11 +47,19 @@ public final class GlassContainer: ExpoView {
|
||||
}
|
||||
}
|
||||
|
||||
- public override func mountChildComponentView(_ childComponentView: UIView, index: Int) {
|
||||
+ // Paper: redirect children into the container effect's contentView
|
||||
+ public override func didUpdateReactSubviews() {
|
||||
+ for subview in self.reactSubviews() {
|
||||
+ containerEffectView.contentView.addSubview(subview)
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Fabric: redirect children into the container effect's contentView
|
||||
+ @objc public func mountChildComponentView(_ childComponentView: UIView, index: Int) {
|
||||
containerEffectView.contentView.insertSubview(childComponentView, at: index)
|
||||
}
|
||||
|
||||
- public override func unmountChildComponentView(_ childComponentView: UIView, index: Int) {
|
||||
+ @objc public func unmountChildComponentView(_ childComponentView: UIView, index: Int) {
|
||||
childComponentView.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
diff --git a/node_modules/expo-glass-effect/ios/GlassView.swift b/node_modules/expo-glass-effect/ios/GlassView.swift
|
||||
index 35cd8f3..9587306 100644
|
||||
--- a/node_modules/expo-glass-effect/ios/GlassView.swift
|
||||
+++ b/node_modules/expo-glass-effect/ios/GlassView.swift
|
||||
@@ -271,11 +271,19 @@ public final class GlassView: ExpoView {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
- public override func mountChildComponentView(_ childComponentView: UIView, index: Int) {
|
||||
+ // Paper: redirect children into the glass effect's contentView
|
||||
+ public override func didUpdateReactSubviews() {
|
||||
+ for subview in self.reactSubviews() {
|
||||
+ glassEffectView.contentView.addSubview(subview)
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Fabric: redirect children into the glass effect's contentView
|
||||
+ @objc public func mountChildComponentView(_ childComponentView: UIView, index: Int) {
|
||||
glassEffectView.contentView.insertSubview(childComponentView, at: index)
|
||||
}
|
||||
|
||||
- public override func unmountChildComponentView(_ childComponentView: UIView, index: Int) {
|
||||
+ @objc public func unmountChildComponentView(_ childComponentView: UIView, index: Int) {
|
||||
childComponentView.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# expo-glass-effect patch
|
||||
|
||||
Patches in support for Expo SDK 54. Please delete when we update Expo
|
||||
@@ -0,0 +1,136 @@
|
||||
diff --git a/node_modules/expo-paste-input/ios/ExpoPasteInputView.swift b/node_modules/expo-paste-input/ios/ExpoPasteInputView.swift
|
||||
index 2164aec4ec1d..d216db6d2927 100644
|
||||
--- a/node_modules/expo-paste-input/ios/ExpoPasteInputView.swift
|
||||
+++ b/node_modules/expo-paste-input/ios/ExpoPasteInputView.swift
|
||||
@@ -511,14 +511,17 @@ class ExpoPasteInputView: ExpoView {
|
||||
var attachmentRanges: [NSRange] = []
|
||||
var mediaPayloads: [MediaPayload] = []
|
||||
|
||||
+ // Only track ranges for attachments we successfully extract a real payload
|
||||
+ // from. Attachments without a payload (e.g. iOS dictation placeholders)
|
||||
+ // are left alone — sanitizing them would delete characters the system
|
||||
+ // manages itself, and emitting "unsupported" would raise a spurious error.
|
||||
attributedText.enumerateAttribute(.attachment, in: NSRange(location: 0, length: attributedText.length), options: []) { value, range, _ in
|
||||
guard let attachment = value as? NSTextAttachment else {
|
||||
return
|
||||
}
|
||||
|
||||
- attachmentRanges.append(range)
|
||||
-
|
||||
if let payload = self.extractMediaPayload(from: attachment, textView: textView, range: range) {
|
||||
+ attachmentRanges.append(range)
|
||||
mediaPayloads.append(payload)
|
||||
}
|
||||
}
|
||||
@@ -529,9 +532,8 @@ class ExpoPasteInputView: ExpoView {
|
||||
return
|
||||
}
|
||||
|
||||
- attachmentRanges.append(range)
|
||||
-
|
||||
if let payload = self.extractMediaPayload(from: adaptiveGlyph) {
|
||||
+ attachmentRanges.append(range)
|
||||
mediaPayloads.append(payload)
|
||||
}
|
||||
}
|
||||
@@ -539,17 +541,12 @@ class ExpoPasteInputView: ExpoView {
|
||||
|
||||
attachmentRanges = uniqueRanges(attachmentRanges)
|
||||
|
||||
- guard !attachmentRanges.isEmpty else {
|
||||
- return
|
||||
- }
|
||||
-
|
||||
- sanitizeAttachments(in: textView, ranges: attachmentRanges)
|
||||
-
|
||||
guard !mediaPayloads.isEmpty else {
|
||||
- handleUnsupportedPaste()
|
||||
return
|
||||
}
|
||||
|
||||
+ sanitizeAttachments(in: textView, ranges: attachmentRanges)
|
||||
+
|
||||
emitImagesAsync(for: mediaPayloads)
|
||||
}
|
||||
|
||||
@@ -651,6 +648,11 @@ class ExpoPasteInputView: ExpoView {
|
||||
}
|
||||
|
||||
private func extractMediaPayload(from attachment: NSTextAttachment, textView: UITextView, range: NSRange) -> MediaPayload? {
|
||||
+ // Only accept attachments that carry real image payloads. We intentionally
|
||||
+ // do not fall back to `image(forBounds:)` or rendering the text view's
|
||||
+ // hierarchy, because system-inserted attachments (e.g. the iOS dictation
|
||||
+ // placeholder) draw themselves via those paths and would cause us to
|
||||
+ // emit a screenshot of the composer as a "pasted image".
|
||||
if let fileWrapperData = attachment.fileWrapper?.regularFileContents,
|
||||
let payload = extractMediaPayload(fromData: fileWrapperData) {
|
||||
return payload
|
||||
@@ -667,20 +669,6 @@ class ExpoPasteInputView: ExpoView {
|
||||
return .image(image)
|
||||
}
|
||||
|
||||
- let attachmentBounds = attachment.bounds.size.width > 0 && attachment.bounds.size.height > 0
|
||||
- ? attachment.bounds
|
||||
- : CGRect(origin: .zero, size: CGSize(width: 128, height: 128))
|
||||
-
|
||||
- if let image = attachment.image(forBounds: attachmentBounds, textContainer: textView.textContainer, characterIndex: range.location),
|
||||
- image.size.width > 0,
|
||||
- image.size.height > 0 {
|
||||
- return .image(image)
|
||||
- }
|
||||
-
|
||||
- if let renderedImage = renderTextAttachment(in: textView, range: range) {
|
||||
- return .image(renderedImage)
|
||||
- }
|
||||
-
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -701,47 +689,6 @@ class ExpoPasteInputView: ExpoView {
|
||||
return .imageData(data)
|
||||
}
|
||||
|
||||
- private func renderTextAttachment(in textView: UITextView, range: NSRange) -> UIImage? {
|
||||
- let glyphRange = textView.layoutManager.glyphRange(forCharacterRange: range, actualCharacterRange: nil)
|
||||
- var rect = textView.layoutManager.boundingRect(forGlyphRange: glyphRange, in: textView.textContainer)
|
||||
-
|
||||
- rect.origin.x += textView.textContainerInset.left - textView.contentOffset.x
|
||||
- rect.origin.y += textView.textContainerInset.top - textView.contentOffset.y
|
||||
- rect = rect.integral
|
||||
-
|
||||
- guard rect.width > 1, rect.height > 1 else {
|
||||
- return nil
|
||||
- }
|
||||
-
|
||||
- let format = UIGraphicsImageRendererFormat.default()
|
||||
- format.scale = textView.window?.screen.scale ?? UIScreen.main.scale
|
||||
- format.opaque = false
|
||||
-
|
||||
- let image = UIGraphicsImageRenderer(size: rect.size, format: format).image { _ in
|
||||
- let drawRect = CGRect(
|
||||
- origin: CGPoint(x: -rect.origin.x, y: -rect.origin.y),
|
||||
- size: textView.bounds.size
|
||||
- )
|
||||
-
|
||||
- if textView.window != nil {
|
||||
- textView.drawHierarchy(in: drawRect, afterScreenUpdates: false)
|
||||
- } else {
|
||||
- guard let context = UIGraphicsGetCurrentContext() else {
|
||||
- return
|
||||
- }
|
||||
-
|
||||
- context.translateBy(x: -rect.origin.x, y: -rect.origin.y)
|
||||
- textView.layer.render(in: context)
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- guard image.size.width > 0, image.size.height > 0 else {
|
||||
- return nil
|
||||
- }
|
||||
-
|
||||
- return image
|
||||
- }
|
||||
-
|
||||
@available(iOS 18.0, *)
|
||||
private func handleAdaptiveImageGlyphInsertion(_ adaptiveGlyph: NSAdaptiveImageGlyph) -> Bool {
|
||||
guard let payload = extractMediaPayload(from: adaptiveGlyph) else {
|
||||
@@ -0,0 +1,22 @@
|
||||
# Expo Paste Input Patch
|
||||
|
||||
`expo-paste-input` observes `UITextView.textDidChangeNotification` and treats any
|
||||
`NSTextAttachment` in the text view's `attributedText` as a pasted image. When
|
||||
it can't find a real image payload on an attachment, it falls back to
|
||||
`image(forBounds:)` and, failing that, to a `drawHierarchy` screenshot of the
|
||||
text view at the attachment's glyph rect.
|
||||
|
||||
iOS Dictation inserts its own `NSTextAttachment` (the shimmer/cursor indicator)
|
||||
into the text view during dictation. Those attachments don't carry real image
|
||||
data, so the fallbacks would fire — emitting a zoomed-in screenshot of the
|
||||
composer as if the user had pasted an image at the end of dictation.
|
||||
|
||||
This patch:
|
||||
|
||||
- Removes the `image(forBounds:)` and `renderTextAttachment` fallbacks in
|
||||
`extractMediaPayload` so the library only accepts attachments carrying a real
|
||||
payload (`fileWrapper`, `contents`, or `image`).
|
||||
- Only sanitizes (deletes) attachment ranges that produced a payload, and
|
||||
skips the "unsupported" toast when an attachment has no payload. Unknown
|
||||
system attachments like the dictation placeholder are left alone rather
|
||||
than being ripped out from under iOS.
|
||||
@@ -0,0 +1,16 @@
|
||||
diff --git a/node_modules/react-native/third-party-podspecs/fmt.podspec b/node_modules/react-native/third-party-podspecs/fmt.podspec
|
||||
index 2f38990..9b02e48 100644
|
||||
--- a/node_modules/react-native/third-party-podspecs/fmt.podspec
|
||||
+++ b/node_modules/react-native/third-party-podspecs/fmt.podspec
|
||||
@@ -26,4 +26,11 @@ Pod::Spec.new do |spec|
|
||||
spec.public_header_files = "include/fmt/*.h"
|
||||
spec.header_mappings_dir = "include"
|
||||
spec.source_files = ["include/fmt/*.h", "src/format.cc"]
|
||||
+
|
||||
+ # TODO: Remove after upgrading React Native past 0.83.x
|
||||
+ # Fix fmt 11.0.2 consteval build error with Xcode 26.4 (facebook/react-native#55601)
|
||||
+ # Fixed in RN 0.84+ which bumps fmt to a compatible version.
|
||||
+ spec.prepare_command = <<~SCRIPT
|
||||
+ perl -i -pe 's/^# define FMT_USE_CONSTEVAL 1$/# define FMT_USE_CONSTEVAL 0/' include/fmt/base.h
|
||||
+ SCRIPT
|
||||
end
|
||||
@@ -0,0 +1,48 @@
|
||||
diff --git a/node_modules/react-native-keyboard-controller/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts b/node_modules/react-native-keyboard-controller/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts
|
||||
index 24a25ae..2c5ff6d 100644
|
||||
--- a/node_modules/react-native-keyboard-controller/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts
|
||||
+++ b/node_modules/react-native-keyboard-controller/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts
|
||||
@@ -1,8 +1,6 @@
|
||||
import { useCallback } from "react";
|
||||
-import { Platform } from "react-native";
|
||||
import { scrollTo, useAnimatedReaction } from "react-native-reanimated";
|
||||
|
||||
-import { IS_FABRIC } from "../../../architecture";
|
||||
import { isScrollAtEnd, shouldShiftContent } from "../useChatKeyboard/helpers";
|
||||
|
||||
import type { KeyboardLiftBehavior } from "../useChatKeyboard/types";
|
||||
@@ -52,7 +50,6 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
|
||||
scroll,
|
||||
layout,
|
||||
size,
|
||||
- contentOffsetY,
|
||||
inverted,
|
||||
keyboardLiftBehavior,
|
||||
freeze,
|
||||
@@ -62,20 +59,14 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
|
||||
(target: number) => {
|
||||
"worklet";
|
||||
|
||||
- if (contentOffsetY && IS_FABRIC) {
|
||||
- // eslint-disable-next-line react-compiler/react-compiler
|
||||
- contentOffsetY.value = target;
|
||||
- } else if (Platform.OS === "android") {
|
||||
- // Defer scrollTo so the animatedProps inset commit lands first;
|
||||
- // otherwise the native ScrollView clamps to the old range.
|
||||
- requestAnimationFrame(() => {
|
||||
- scrollTo(scrollViewRef, 0, target, false);
|
||||
- });
|
||||
- } else {
|
||||
+ // Always defer scrollTo so the animatedProps inset commit lands first;
|
||||
+ // otherwise the native ScrollView clamps contentOffset to the old
|
||||
+ // contentInset range (iOS Fabric) or the old contentInsetBottom (Android).
|
||||
+ requestAnimationFrame(() => {
|
||||
scrollTo(scrollViewRef, 0, target, false);
|
||||
- }
|
||||
+ });
|
||||
},
|
||||
- [scrollViewRef, contentOffsetY],
|
||||
+ [scrollViewRef],
|
||||
);
|
||||
|
||||
useAnimatedReaction(
|
||||
@@ -1,7 +1,6 @@
|
||||
const {withEntitlementsPlist} = require('@expo/config-plugins')
|
||||
const {withEntitlementsPlist} = require('expo/config-plugins')
|
||||
|
||||
const withAppEntitlements = config => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withEntitlementsPlist(config, async config => {
|
||||
config.modResults['com.apple.security.application-groups'] = [
|
||||
`group.app.bsky`,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
const {withInfoPlist} = require('@expo/config-plugins')
|
||||
const {withInfoPlist} = require('expo/config-plugins')
|
||||
const plist = require('@expo/plist')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const withExtensionEntitlements = (config, {extensionName}) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withInfoPlist(config, config => {
|
||||
const extensionEntitlementsPath = path.join(
|
||||
config.modRequest.platformProjectRoot,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
const {withInfoPlist} = require('@expo/config-plugins')
|
||||
const {withInfoPlist} = require('expo/config-plugins')
|
||||
const plist = require('@expo/plist')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const withExtensionInfoPlist = (config, {extensionName}) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withInfoPlist(config, config => {
|
||||
const plistPath = path.join(
|
||||
config.modRequest.projectRoot,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const {withXcodeProject} = require('@expo/config-plugins')
|
||||
const {withXcodeProject} = require('expo/config-plugins')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
@@ -6,7 +6,6 @@ const withExtensionViewController = (
|
||||
config,
|
||||
{controllerName, extensionName},
|
||||
) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withXcodeProject(config, config => {
|
||||
const controllerPath = path.join(
|
||||
config.modRequest.projectRoot,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const {withPlugins} = require('@expo/config-plugins')
|
||||
const {withPlugins} = require('expo/config-plugins')
|
||||
const {withAppEntitlements} = require('./withAppEntitlements')
|
||||
const {withXcodeTarget} = require('./withXcodeTarget')
|
||||
const {withExtensionEntitlements} = require('./withExtensionEntitlements')
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
const {withXcodeProject} = require('@expo/config-plugins')
|
||||
const {withXcodeProject} = require('expo/config-plugins')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const withSounds = (config, {extensionName, soundFiles}) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withXcodeProject(config, config => {
|
||||
for (const file of soundFiles) {
|
||||
const soundPath = path.join(config.modRequest.projectRoot, 'assets', file)
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
const {withXcodeProject, IOSConfig} = require('@expo/config-plugins')
|
||||
const path = require('path')
|
||||
const PBXFile = require('xcode/lib/pbxFile')
|
||||
const {withXcodeProject} = require('expo/config-plugins')
|
||||
|
||||
const withXcodeTarget = (
|
||||
config,
|
||||
{extensionName, controllerName, soundFiles},
|
||||
) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withXcodeProject(config, config => {
|
||||
let pbxProject = config.modResults
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const {withEntitlementsPlist} = require('@expo/config-plugins')
|
||||
const {withEntitlementsPlist} = require('expo/config-plugins')
|
||||
|
||||
const withAppEntitlements = config => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withEntitlementsPlist(config, async config => {
|
||||
config.modResults['com.apple.security.application-groups'] = [
|
||||
`group.app.bsky`,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
const {withInfoPlist} = require('@expo/config-plugins')
|
||||
const {withInfoPlist} = require('expo/config-plugins')
|
||||
const plist = require('@expo/plist')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const withExtensionEntitlements = (config, {extensionName}) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withInfoPlist(config, config => {
|
||||
const extensionEntitlementsPath = path.join(
|
||||
config.modRequest.platformProjectRoot,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
const {withInfoPlist} = require('@expo/config-plugins')
|
||||
const {withInfoPlist} = require('expo/config-plugins')
|
||||
const plist = require('@expo/plist')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const withExtensionInfoPlist = (config, {extensionName}) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withInfoPlist(config, config => {
|
||||
const plistPath = path.join(
|
||||
config.modRequest.projectRoot,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const {withXcodeProject} = require('@expo/config-plugins')
|
||||
const {withXcodeProject} = require('expo/config-plugins')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
@@ -6,7 +6,6 @@ const withExtensionViewController = (
|
||||
config,
|
||||
{controllerName, extensionName},
|
||||
) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withXcodeProject(config, config => {
|
||||
const controllerPath = path.join(
|
||||
config.modRequest.projectRoot,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const {withAndroidManifest} = require('@expo/config-plugins')
|
||||
const {withAndroidManifest} = require('expo/config-plugins')
|
||||
|
||||
const withIntentFilters = config => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withAndroidManifest(config, config => {
|
||||
const intents = [
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const {withPlugins} = require('@expo/config-plugins')
|
||||
const {withPlugins} = require('expo/config-plugins')
|
||||
const {withAppEntitlements} = require('./withAppEntitlements')
|
||||
const {withXcodeTarget} = require('./withXcodeTarget')
|
||||
const {withExtensionEntitlements} = require('./withExtensionEntitlements')
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const {withXcodeProject} = require('@expo/config-plugins')
|
||||
const {withXcodeProject} = require('expo/config-plugins')
|
||||
|
||||
const withXcodeTarget = (config, {extensionName, controllerName}) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withXcodeProject(config, config => {
|
||||
const pbxProject = config.modResults
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const {withEntitlementsPlist} = require('@expo/config-plugins')
|
||||
const {withEntitlementsPlist} = require('expo/config-plugins')
|
||||
|
||||
const withAppEntitlements = config => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withEntitlementsPlist(config, async config => {
|
||||
config.modResults['com.apple.security.application-groups'] = [
|
||||
`group.app.bsky`,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
const {withInfoPlist} = require('@expo/config-plugins')
|
||||
const {withInfoPlist} = require('expo/config-plugins')
|
||||
const plist = require('@expo/plist')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const withClipEntitlements = (config, {targetName}) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withInfoPlist(config, config => {
|
||||
const entitlementsPath = path.join(
|
||||
config.modRequest.platformProjectRoot,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
const {withInfoPlist} = require('@expo/config-plugins')
|
||||
const {withInfoPlist} = require('expo/config-plugins')
|
||||
const plist = require('@expo/plist')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const withClipInfoPlist = (config, {targetName}) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withInfoPlist(config, config => {
|
||||
const targetPath = path.join(
|
||||
config.modRequest.platformProjectRoot,
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
const {withXcodeProject} = require('@expo/config-plugins')
|
||||
const {withXcodeProject} = require('expo/config-plugins')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const FILES = ['AppDelegate.swift', 'ViewController.swift']
|
||||
|
||||
const withFiles = (config, {targetName}) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withXcodeProject(config, config => {
|
||||
const basePath = path.join(
|
||||
config.modRequest.projectRoot,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const {withPlugins} = require('@expo/config-plugins')
|
||||
const {withPlugins} = require('expo/config-plugins')
|
||||
const {withAppEntitlements} = require('./withAppEntitlements')
|
||||
const {withClipEntitlements} = require('./withClipEntitlements')
|
||||
const {withClipInfoPlist} = require('./withClipInfoPlist')
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
const {withXcodeProject} = require('@expo/config-plugins')
|
||||
const {withXcodeProject} = require('expo/config-plugins')
|
||||
|
||||
const BUILD_PHASE_FILES = ['AppDelegate.swift', 'ViewController.swift']
|
||||
|
||||
const withXcodeTarget = (config, {targetName}) => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
return withXcodeProject(config, config => {
|
||||
const pbxProject = config.modResults
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// Based on https://github.com/expo/expo/pull/33957
|
||||
// Could be removed once the app has been updated to Expo 53
|
||||
const {withAndroidStyles} = require('@expo/config-plugins')
|
||||
|
||||
module.exports = function withAndroidDayNightThemePlugin(appConfig) {
|
||||
const cleanupList = new Set([
|
||||
'colorPrimary',
|
||||
'android:editTextBackground',
|
||||
'android:textColor',
|
||||
'android:editTextStyle',
|
||||
])
|
||||
|
||||
return withAndroidStyles(appConfig, config => {
|
||||
config.modResults.resources.style = config.modResults.resources.style
|
||||
?.map(style => {
|
||||
if (style.$.name === 'AppTheme' && style.item != null) {
|
||||
style.item = style.item.filter(item => !cleanupList.has(item.$.name))
|
||||
}
|
||||
return style
|
||||
})
|
||||
.filter(style => {
|
||||
return style.$.name !== 'ResetEditText'
|
||||
})
|
||||
|
||||
return config
|
||||
})
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
const {withAndroidManifest} = require('@expo/config-plugins')
|
||||
const {withAndroidManifest} = require('expo/config-plugins')
|
||||
|
||||
const withProcessTextQuery = config =>
|
||||
// eslint-disable-next-line no-shadow
|
||||
withAndroidManifest(config, config => {
|
||||
const manifest = config.modResults.manifest
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const {withProjectBuildGradle} = require('@expo/config-plugins')
|
||||
const {withProjectBuildGradle} = require('expo/config-plugins')
|
||||
|
||||
const jitpackRepository = "maven { url 'https://www.jitpack.io' }"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This way we get a sane default color for spinners, text inputs, etc.
|
||||
*/
|
||||
|
||||
const {withAndroidStyles, AndroidConfig} = require('@expo/config-plugins')
|
||||
const {withAndroidStyles, AndroidConfig} = require('expo/config-plugins')
|
||||
|
||||
module.exports = function withAndroidStylesAccentColorPlugin(appConfig) {
|
||||
return withAndroidStyles(appConfig, function (decoratedAppConfig) {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
const {withAppDelegate} = require('@expo/config-plugins')
|
||||
const {mergeContents} = require('@expo/config-plugins/build/utils/generateCode')
|
||||
const {withAppDelegate, CodeGenerator} = require('expo/config-plugins')
|
||||
|
||||
module.exports = config =>
|
||||
withAppDelegate(config, config => {
|
||||
let contents = config.modResults.contents
|
||||
|
||||
contents = mergeContents({
|
||||
contents = CodeGenerator.mergeContents({
|
||||
src: contents,
|
||||
anchor: '// Linking API',
|
||||
newSrc: `
|
||||
@@ -22,7 +21,7 @@ module.exports = config =>
|
||||
comment: '//',
|
||||
}).contents
|
||||
|
||||
contents = mergeContents({
|
||||
contents = CodeGenerator.mergeContents({
|
||||
src: contents,
|
||||
anchor: '// Universal Links',
|
||||
newSrc: `
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# push-notification
|
||||
|
||||
Sends sample APNS payloads to a booted iOS simulator via `xcrun simctl push`.
|
||||
Useful for exercising `useNotificationsHandler` (`src/lib/hooks/useNotificationHandler.ts`)
|
||||
without a real APNS round-trip — foreground display behavior, tap responses,
|
||||
and notification-driven navigation.
|
||||
|
||||
## What this does and doesn't cover
|
||||
|
||||
**Covers** — anything in `useNotificationsHandler`:
|
||||
|
||||
- `setNotificationHandler` foreground behavior (banner, list, badge, sound flags)
|
||||
- `addNotificationResponseReceivedListener` tap handling
|
||||
- Account-switch flow when `recipientDid` differs from the signed-in account
|
||||
- Navigation routing for each `reason` (post threads, profiles, conversations)
|
||||
|
||||
**Does not cover** — `BlueskyNSE` (the iOS Notification Service Extension):
|
||||
|
||||
- Communication Notification styling for chat messages
|
||||
- Badge increment via `mutateWithBadge`
|
||||
- Custom `dm.aiff` sound for chat messages
|
||||
|
||||
The simulator does not reliably invoke NSEs for `simctl push` on recent iOS
|
||||
versions (verified bypassed on iOS 26.4). To test NSE behavior, run on a real
|
||||
device with a real APNS push, or unit-test `NotificationService.didReceive`
|
||||
directly in Xcode.
|
||||
|
||||
## Setup
|
||||
|
||||
1. Boot an iOS simulator and install the app:
|
||||
```
|
||||
yarn ios
|
||||
```
|
||||
2. Sign in to the account you'll be testing against. The `recipientDid` in
|
||||
each payload is substituted at send time and must match the signed-in DID,
|
||||
otherwise:
|
||||
- Chat notifications trigger the account-switch flow
|
||||
- Other reasons are silently dropped by the handler
|
||||
3. Find your DID. Easiest: visit your profile in a web browser and copy it
|
||||
from the URL, or grep dev logs for `currentAccount`.
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
./send.sh <payload-name> [--did <did>] [--device <udid>] [--bundle <id>]
|
||||
```
|
||||
|
||||
Pass the DID once via env var to avoid repeating it:
|
||||
|
||||
```
|
||||
export BLUESKY_TEST_DID=did:plc:yourdidhere
|
||||
|
||||
./send.sh like
|
||||
./send.sh chat-message
|
||||
./send.sh follow
|
||||
```
|
||||
|
||||
Defaults: `--device booted`, `--bundle xyz.blueskyweb.app`. Run `./send.sh --help`
|
||||
for the full list of available payloads.
|
||||
|
||||
## Foreground vs background
|
||||
|
||||
`useNotificationsHandler` behaves differently depending on app state:
|
||||
|
||||
- **Foreground** — `setNotificationHandler.handleNotification` decides whether
|
||||
to show a banner, play a sound, etc. For chat reasons, the banner is
|
||||
suppressed if `payload.convoId === currentConvoId` (you're already viewing
|
||||
that conversation).
|
||||
- **Background or tapped** — `addNotificationResponseReceivedListener` fires
|
||||
on tap and runs the navigation routing in `notificationToURL`.
|
||||
|
||||
To test the response listener, background the app first (`cmd+shift+H` in the
|
||||
sim), send the push, then tap the banner.
|
||||
|
||||
## Available payloads
|
||||
|
||||
| Payload | Reason | Navigation target |
|
||||
|---|---|---|
|
||||
| `like.apns` | `like` | post thread (from `subject`) |
|
||||
| `reply.apns` | `reply` | post thread (from `uri`) |
|
||||
| `follow.apns` | `follow` | sender's profile (from `uri.host`) |
|
||||
| `chat-message.apns` | `chat-message` | `MessagesConversation` with `convoId` |
|
||||
| `chat-reaction.apns` | `chat-reaction` | `MessagesConversation` with `convoId` |
|
||||
|
||||
The `subject` AT URIs reference fake post rkeys, so the destination screens
|
||||
will fail to load real content — that's expected. Routing exercises the
|
||||
navigation path, not the data fetch.
|
||||
|
||||
## Adding a new payload
|
||||
|
||||
1. Copy an existing `.apns` file in `payloads/` whose shape matches.
|
||||
2. Set `aps.mutable-content: 1` and a real `aps.alert.{title,body}`.
|
||||
3. Match the payload shape to `NotificationPayload` in
|
||||
`src/lib/hooks/useNotificationHandler.ts` for the `reason` you're testing.
|
||||
4. Use `__RECIPIENT_DID__` as the placeholder for the recipient — `send.sh`
|
||||
substitutes it at send time. Use it anywhere a DID needs to belong to the
|
||||
logged-in user (typically `recipientDid`, and post `subject` for likes/replies).
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"aps": {
|
||||
"alert": {
|
||||
"title": "Ian",
|
||||
"body": "Beep beep mfer"
|
||||
},
|
||||
"mutable-content": 1
|
||||
},
|
||||
"reason": "chat-message",
|
||||
"convoId": "3mkb6y3tjzu2r",
|
||||
"messageId": "3mkdjhe6sd227",
|
||||
"recipientDid": "did:plc:3jpt2mvvsumj2r7eqk4gzzjz",
|
||||
"senderDisplayName": "Ian",
|
||||
"senderHandle": "iwsmith.bsky.social"
|
||||
}
|
||||