diff --git a/src/analytics/features/types.ts b/src/analytics/features/types.ts
index bca196c70..c20303e83 100644
--- a/src/analytics/features/types.ts
+++ b/src/analytics/features/types.ts
@@ -14,6 +14,8 @@ export enum Features {
ComposerLanguageDetectionEnable = 'composer:language_detection:enable',
PostGalleryEmbedEnable = 'post_gallery_embed:enable',
NotificationsExpandedProfileCardEnable = 'notifications:expanded_profile_card:enable',
+ AppviewFallbackMode = 'appview_fallback:mode',
+ AppviewFallbackThresholds = 'appview_fallback:thresholds',
AATest = 'aa-test',
}
diff --git a/src/analytics/metrics/types.ts b/src/analytics/metrics/types.ts
index 4d1b68be5..794908e50 100644
--- a/src/analytics/metrics/types.ts
+++ b/src/analytics/metrics/types.ts
@@ -27,6 +27,19 @@ export type Events = {
variationId?: string
}
+ 'appviewFallback:changed': {
+ active: boolean
+ trigger: 'auto' | 'force-fallback' | 'force-primary'
+ }
+ 'appviewFallback:probe': {
+ result: 'eligible' | 'ineligible' | 'unknown'
+ errorName?: string
+ status?: number
+ }
+ 'appviewFallback:outage': {
+ active: boolean
+ }
+
'account:loggedIn': {
logContext:
| 'LoginForm'
diff --git a/src/components/HomeAppviewOutageNotice.tsx b/src/components/HomeAppviewOutageNotice.tsx
new file mode 100644
index 000000000..53cb7ff45
--- /dev/null
+++ b/src/components/HomeAppviewOutageNotice.tsx
@@ -0,0 +1,34 @@
+import {View} from 'react-native'
+import {Trans} from '@lingui/react/macro'
+
+import {useHomeAppviewOutage} from '#/state/appview-health'
+import {atoms as a, useTheme} from '#/alf'
+import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
+import {Text} from '#/components/Typography'
+
+export function HomeAppviewOutageNotice() {
+ const t = useTheme()
+ const outage = useHomeAppviewOutage()
+
+ if (!outage) return null
+
+ return (
+
+
+
+
+ Community features are temporarily unavailable. We're working on it —
+ the rest of the app still works.
+
+
+
+ )
+}
diff --git a/src/components/activity-notifications/SubscribeProfileDialog.tsx b/src/components/activity-notifications/SubscribeProfileDialog.tsx
index 8a6b8314c..6a5341351 100644
--- a/src/components/activity-notifications/SubscribeProfileDialog.tsx
+++ b/src/components/activity-notifications/SubscribeProfileDialog.tsx
@@ -15,6 +15,7 @@ import {
useQueryClient,
} from '@tanstack/react-query'
+import {HOME_APPVIEW_PINNED_OPTS} from '#/lib/constants'
import {createSanitizedDisplayName} from '#/lib/moderation/create-sanitized-display-name'
import {cleanError} from '#/lib/strings/errors'
import {sanitizeHandle} from '#/lib/strings/handles'
@@ -122,10 +123,13 @@ function DialogInner({
mutationFn: async (
activitySubscription: Un$Typed,
) => {
- await agent.app.bsky.notification.putActivitySubscription({
- subject: profile.did,
- activitySubscription,
- })
+ await agent.app.bsky.notification.putActivitySubscription(
+ {
+ subject: profile.did,
+ activitySubscription,
+ },
+ HOME_APPVIEW_PINNED_OPTS,
+ )
},
onSuccess: (_data, activitySubscription) => {
control.close(() => {
diff --git a/src/lib/api/__tests__/community.test.ts b/src/lib/api/__tests__/community.test.ts
new file mode 100644
index 000000000..28b2539f1
--- /dev/null
+++ b/src/lib/api/__tests__/community.test.ts
@@ -0,0 +1,37 @@
+import {type BskyAgent} from '@atproto/api'
+
+import {
+ BLUESKY_FALLBACK_PROXY_HEADER,
+ BLUESKY_PROXY_HEADER,
+ HOME_PROXY_HEADER,
+} from '#/lib/constants'
+import {communityXrpc} from '../community'
+
+describe('communityXrpc', () => {
+ const originalHeader = BLUESKY_PROXY_HEADER.get()
+
+ afterEach(() => {
+ BLUESKY_PROXY_HEADER.set(originalHeader)
+ })
+
+ function mockAgent() {
+ const fetchHandler = jest.fn, [string, RequestInit]>()
+ fetchHandler.mockResolvedValue(new Response('{}'))
+ return {agent: {fetchHandler} as unknown as BskyAgent, fetchHandler}
+ }
+
+ it('always targets the home appview, even when the global proxy header is flipped', async () => {
+ BLUESKY_PROXY_HEADER.set(BLUESKY_FALLBACK_PROXY_HEADER)
+ const {agent, fetchHandler} = mockAgent()
+
+ await communityXrpc(agent, 'community.blacksky.feed.getCommunityTimeline')
+
+ const init = fetchHandler.mock.calls[0][1] as {
+ headers: Record
+ }
+ expect(init.headers['atproto-proxy']).toBe(HOME_PROXY_HEADER)
+ expect(init.headers['atproto-proxy']).not.toBe(
+ BLUESKY_FALLBACK_PROXY_HEADER,
+ )
+ })
+})
diff --git a/src/lib/api/community.ts b/src/lib/api/community.ts
index 112a69bb3..cd0aa72f2 100644
--- a/src/lib/api/community.ts
+++ b/src/lib/api/community.ts
@@ -1,6 +1,6 @@
import {type BskyAgent} from '@atproto/api'
-import {BLUESKY_PROXY_HEADER} from '#/lib/constants'
+import {HOME_PROXY_HEADER} from '#/lib/constants'
/**
* Make an XRPC call to a community.blacksky.feed.* endpoint.
@@ -8,6 +8,8 @@ import {BLUESKY_PROXY_HEADER} from '#/lib/constants'
* Calls through the PDS using the agent's session auth and atproto-proxy
* header. The PDS validates the user's credentials, creates a service auth
* JWT signed by the user's keypair, and forwards the request to the appview.
+ *
+ * Pinned: community.blacksky.* endpoints only exist on the home appview.
*/
export async function communityXrpc(
agent: BskyAgent,
@@ -23,7 +25,7 @@ export async function communityXrpc(
const path = `/xrpc/${method}${qs}`
const headers: Record = {
- 'atproto-proxy': BLUESKY_PROXY_HEADER.get(),
+ 'atproto-proxy': HOME_PROXY_HEADER,
}
const init: RequestInit = {
method: opts?.body ? 'POST' : 'GET',
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index c75e7e8fc..b7fe021b5 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -215,6 +215,21 @@ export const PUBLIC_APPVIEW = 'https://api.blacksky.community'
export const PUBLIC_APPVIEW_DID = 'did:web:api.blacksky.community'
export const PUBLIC_STAGING_APPVIEW_DID = 'did:web:api.staging.bsky.dev'
+export const APPVIEW_STATUS_URL = `${PUBLIC_APPVIEW}/status/indexer`
+
+export const BLUESKY_FALLBACK_PROXY_DID = 'did:web:api.bsky.app'
+export const BLUESKY_FALLBACK_PROXY_HEADER =
+ `${BLUESKY_FALLBACK_PROXY_DID}#bsky_appview` as ProxyHeaderValue
+
+// Immutable, unlike BLUESKY_PROXY_HEADER below — use for calls that must not
+// follow that mutable header.
+export const HOME_PROXY_HEADER =
+ `${BLUESKY_PROXY_DID}#bsky_appview` as ProxyHeaderValue
+
+export const HOME_APPVIEW_PINNED_OPTS = {
+ headers: {'atproto-proxy': HOME_PROXY_HEADER},
+}
+
export const DEV_ENV_APPVIEW = `http://localhost:2584` // always the same
// temp hack for e2e - esb
diff --git a/src/locale/locales/en/messages.po b/src/locale/locales/en/messages.po
index 5c0b867c4..1029049cf 100644
--- a/src/locale/locales/en/messages.po
+++ b/src/locale/locales/en/messages.po
@@ -195,7 +195,7 @@ msgid "{0} added to chat"
msgstr "{0} added to chat"
#. placeholder {0}: brand.messages.postButtonLabel
-#: src/view/com/composer/Composer.tsx:1843
+#: src/view/com/composer/Composer.tsx:1844
msgctxt "action"
msgid "{0} All"
msgstr "{0} All"
@@ -1167,11 +1167,11 @@ msgstr ""
msgid "Add another account"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1556
+#: src/view/com/composer/Composer.tsx:1557
msgid "Add another post"
msgstr ""
-#: src/view/com/composer/Composer.tsx:2251
+#: src/view/com/composer/Composer.tsx:2257
msgid "Add another post to thread"
msgstr ""
@@ -1855,7 +1855,7 @@ msgstr ""
msgid "Are you sure you want to rescind your request to join {0}?"
msgstr "Are you sure you want to rescind your request to join {0}?"
-#: src/view/com/composer/Composer.tsx:1692
+#: src/view/com/composer/Composer.tsx:1693
msgid "Are you sure you'd like to discard this post?"
msgstr ""
@@ -2025,11 +2025,15 @@ msgid "Blacksky needs camera access to scan QR codes from other profiles."
msgstr "Blacksky needs camera access to scan QR codes from other profiles."
#: src/components/CommunityOnlyBadge.tsx:57
-#: src/view/com/composer/Composer.tsx:2040
-#: src/view/com/composer/Composer.tsx:2050
+#: src/view/com/composer/Composer.tsx:2042
+#: src/view/com/composer/Composer.tsx:2055
msgid "Blacksky Only"
msgstr "Blacksky Only"
+#: src/view/com/composer/Composer.tsx:2053
+msgid "Blacksky Only (temporarily unavailable)"
+msgstr "Blacksky Only (temporarily unavailable)"
+
#: src/components/StarterPack/ProfileStarterPacks.tsx:340
msgid "Blacksky will choose a set of recommended accounts from people in your network."
msgstr "Blacksky will choose a set of recommended accounts from people in your network."
@@ -2302,7 +2306,7 @@ msgstr ""
msgid "Camera access needed"
msgstr "Camera access needed"
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:213
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:217
#: src/components/contacts/screens/GetContacts.tsx:292
#: src/components/contacts/screens/GetContacts.tsx:297
#: src/components/dialogs/EmailDialog/screens/Manage2FA/Enable.tsx:122
@@ -2346,8 +2350,8 @@ msgstr "Camera access needed"
#: src/screens/Settings/Settings.tsx:302
#: src/screens/Takendown.tsx:104
#: src/screens/Takendown.tsx:107
-#: src/view/com/composer/Composer.tsx:1771
-#: src/view/com/composer/Composer.tsx:1781
+#: src/view/com/composer/Composer.tsx:1772
+#: src/view/com/composer/Composer.tsx:1782
#: src/view/com/composer/photos/EditImageDialog.web.tsx:44
#: src/view/com/composer/photos/EditImageDialog.web.tsx:53
#: src/view/shell/desktop/LeftNav.tsx:232
@@ -2465,7 +2469,7 @@ msgstr ""
msgid "Changes hosting provider"
msgstr ""
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:179
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:183
msgid "Changes saved"
msgstr ""
@@ -2776,7 +2780,7 @@ msgstr "Close banner"
msgid "Close dialog"
msgstr ""
-#: src/view/shell/index.web.tsx:100
+#: src/view/shell/index.web.tsx:102
msgid "Close drawer menu"
msgstr ""
@@ -2820,7 +2824,7 @@ msgstr ""
msgid "Closes password update alert"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1779
+#: src/view/com/composer/Composer.tsx:1780
msgid "Closes post composer and discards post draft"
msgstr ""
@@ -2863,6 +2867,10 @@ msgstr "Community"
msgid "Community Builder"
msgstr "Community Builder"
+#: src/components/HomeAppviewOutageNotice.tsx:27
+msgid "Community features are temporarily unavailable. We're working on it — the rest of the app still works."
+msgstr "Community features are temporarily unavailable. We're working on it — the rest of the app still works."
+
#: src/Navigation.tsx:365
#: src/view/screens/CommunityGuidelines.tsx:28
msgid "Community Guidelines"
@@ -2883,7 +2891,7 @@ msgid "Compose new post"
msgstr ""
#. placeholder {0}: MAX_GRAPHEME_LENGTH || 0
-#: src/view/com/composer/Composer.tsx:1654
+#: src/view/com/composer/Composer.tsx:1655
msgid "Compose posts up to {0, plural, other {# characters}} in length"
msgstr ""
@@ -2891,11 +2899,11 @@ msgstr ""
msgid "Compose reply"
msgstr ""
-#: src/view/com/composer/Composer.tsx:2648
+#: src/view/com/composer/Composer.tsx:2654
msgid "Compressing GIF..."
msgstr ""
-#: src/view/com/composer/Composer.tsx:2650
+#: src/view/com/composer/Composer.tsx:2656
msgid "Compressing video..."
msgstr ""
@@ -3269,7 +3277,7 @@ msgid "Could not remove member."
msgstr "Could not remove member."
#. placeholder {0}: cleanError(error)
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:295
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:299
msgid "Could not save changes: {0}"
msgstr ""
@@ -3277,7 +3285,7 @@ msgstr ""
msgid "Could not share – please try again"
msgstr "Could not share – please try again"
-#: src/state/queries/notifications/settings.ts:49
+#: src/state/queries/notifications/settings.ts:55
msgid "Could not update notification settings"
msgstr ""
@@ -3613,7 +3621,7 @@ msgstr ""
#: src/components/PostControls/PostMenu/PostMenuItems.tsx:767
#: src/components/PostControls/PostMenu/PostMenuItems.tsx:769
-#: src/view/com/composer/Composer.tsx:1666
+#: src/view/com/composer/Composer.tsx:1667
msgid "Delete post"
msgstr ""
@@ -3772,9 +3780,9 @@ msgstr ""
#: src/components/dialogs/lists/CreateOrEditListDialog.tsx:101
#: src/screens/Profile/Header/EditProfileDialog.tsx:82
-#: src/view/com/composer/Composer.tsx:1448
-#: src/view/com/composer/Composer.tsx:1492
-#: src/view/com/composer/Composer.tsx:1699
+#: src/view/com/composer/Composer.tsx:1449
+#: src/view/com/composer/Composer.tsx:1493
+#: src/view/com/composer/Composer.tsx:1700
#: src/view/com/composer/drafts/DraftItem.tsx:242
#: src/view/com/composer/drafts/DraftsButton.tsx:131
msgid "Discard"
@@ -3785,14 +3793,14 @@ msgstr ""
msgid "Discard changes?"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1446
+#: src/view/com/composer/Composer.tsx:1447
#: src/view/com/composer/drafts/DraftItem.tsx:239
#: src/view/com/composer/drafts/DraftsButton.tsx:98
msgid "Discard draft?"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1463
-#: src/view/com/composer/Composer.tsx:1691
+#: src/view/com/composer/Composer.tsx:1464
+#: src/view/com/composer/Composer.tsx:1692
msgid "Discard post?"
msgstr ""
@@ -3832,7 +3840,7 @@ msgstr ""
msgid "Dismiss banner"
msgstr ""
-#: src/view/com/composer/Composer.tsx:2569
+#: src/view/com/composer/Composer.tsx:2575
msgid "Dismiss error"
msgstr ""
@@ -4303,7 +4311,7 @@ msgstr ""
#: src/screens/Profile/Sections/CommunityFeed.tsx:156
#: src/screens/Profile/Sections/Feed.tsx:131
-#: src/view/com/feeds/CommunityFeedPage.tsx:277
+#: src/view/com/feeds/CommunityFeedPage.tsx:278
msgid "End of feed"
msgstr ""
@@ -4381,7 +4389,7 @@ msgstr ""
msgid "Entertainment"
msgstr ""
-#: src/view/com/composer/Composer.tsx:2668
+#: src/view/com/composer/Composer.tsx:2674
#: src/view/com/util/error/ErrorScreen.tsx:40
msgid "Error"
msgstr ""
@@ -4706,7 +4714,7 @@ msgstr "Failed to leave group chat"
#: src/components/CommunityFeed.tsx:39
#: src/screens/Profile/Sections/CommunityFeed.tsx:123
-#: src/view/com/feeds/CommunityFeedPage.tsx:245
+#: src/view/com/feeds/CommunityFeedPage.tsx:246
msgid "Failed to load community posts"
msgstr "Failed to load community posts"
@@ -4795,7 +4803,7 @@ msgstr ""
msgid "Failed to rescind your request. Please try again."
msgstr "Failed to rescind your request. Please try again."
-#: src/view/com/composer/Composer.tsx:670
+#: src/view/com/composer/Composer.tsx:671
msgid "Failed to save draft"
msgstr ""
@@ -4863,7 +4871,7 @@ msgstr ""
msgid "Failed to update feeds"
msgstr ""
-#: src/state/queries/activity-subscriptions.ts:101
+#: src/state/queries/activity-subscriptions.ts:105
msgid "Failed to update notification declaration"
msgstr ""
@@ -5398,11 +5406,11 @@ msgstr "Get notifications when there's activity on posts you're subscribed to."
msgid "Get notified about new posts"
msgstr ""
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:226
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:230
msgid "Get notified of new posts from {name}"
msgstr ""
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:233
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:237
msgid "Get notified of this account’s activity"
msgstr ""
@@ -5422,7 +5430,7 @@ msgstr ""
msgid "GIF"
msgstr ""
-#: src/view/com/composer/Composer.tsx:2673
+#: src/view/com/composer/Composer.tsx:2679
msgid "GIF uploaded"
msgstr ""
@@ -6297,7 +6305,7 @@ msgid "It's just you right now! Add more people to your starter pack by searchin
msgstr ""
#. placeholder {0}: videoState.jobId
-#: src/view/com/composer/Composer.tsx:2588
+#: src/view/com/composer/Composer.tsx:2594
msgid "Job ID: {0}"
msgstr ""
@@ -6327,13 +6335,13 @@ msgstr "Join request rescinded."
msgid "Journalism"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1496
-#: src/view/com/composer/Composer.tsx:1506
+#: src/view/com/composer/Composer.tsx:1497
+#: src/view/com/composer/Composer.tsx:1507
#: src/view/com/composer/drafts/DraftsButton.tsx:135
msgid "Keep editing"
msgstr ""
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:230
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:234
msgid "Keep me posted"
msgstr ""
@@ -6764,7 +6772,7 @@ msgstr ""
#: src/screens/Profile/ProfileFeed/index.tsx:206
#: src/screens/Profile/Sections/Feed.tsx:117
#: src/screens/ProfileList/FeedSection.tsx:113
-#: src/view/com/feeds/CommunityFeedPage.tsx:308
+#: src/view/com/feeds/CommunityFeedPage.tsx:310
#: src/view/com/feeds/FeedPage.tsx:168
msgid "Load new posts"
msgstr ""
@@ -7432,7 +7440,7 @@ msgstr ""
#: src/screens/Profile/ProfileFeed/index.tsx:217
#: src/screens/ProfileList/index.tsx:237
#: src/screens/ProfileList/index.tsx:280
-#: src/view/com/feeds/CommunityFeedPage.tsx:318
+#: src/view/com/feeds/CommunityFeedPage.tsx:320
#: src/view/screens/Feeds.tsx:545
#: src/view/screens/Notifications.tsx:165
#: src/view/screens/Profile.tsx:643
@@ -7511,7 +7519,7 @@ msgstr ""
#: src/components/CommunityFeed.tsx:51
#: src/screens/Profile/Sections/CommunityFeed.tsx:133
-#: src/view/com/feeds/CommunityFeedPage.tsx:253
+#: src/view/com/feeds/CommunityFeedPage.tsx:254
msgid "No community posts yet"
msgstr "No community posts yet"
@@ -7873,11 +7881,11 @@ msgstr "One of the selected recipients does not allow group chats."
msgid "One of the selected recipients has blocked you and cannot be messaged."
msgstr "One of the selected recipients has blocked you and cannot be messaged."
-#: src/view/com/composer/Composer.tsx:886
+#: src/view/com/composer/Composer.tsx:887
msgid "One or more GIFs is missing alt text."
msgstr ""
-#: src/view/com/composer/Composer.tsx:883
+#: src/view/com/composer/Composer.tsx:884
msgid "One or more images is missing alt text."
msgstr ""
@@ -7889,11 +7897,11 @@ msgstr ""
msgid "One or more of your selected files are too large. Maximum size is {VIDEO_MAX_SIZE_MB} MB."
msgstr "One or more of your selected files are too large. Maximum size is {VIDEO_MAX_SIZE_MB} MB."
-#: src/view/com/composer/Composer.tsx:681
+#: src/view/com/composer/Composer.tsx:682
msgid "One or more posts are too long to save as a draft. {MAX_DRAFT_GRAPHEME_LENGTH, plural, one {The maximum number of characters is # character.} other {The maximum number of characters is # characters.}}"
msgstr ""
-#: src/view/com/composer/Composer.tsx:893
+#: src/view/com/composer/Composer.tsx:894
msgid "One or more videos is missing alt text."
msgstr ""
@@ -7911,7 +7919,7 @@ msgstr ""
#. placeholder {0}: result.accepted.length
#. placeholder {1}: next.length
#. placeholder {2}: next.length
-#: src/view/com/composer/Composer.tsx:241
+#: src/view/com/composer/Composer.tsx:242
msgid "Only {0} of {1} {2, plural, one {image} other {images}} added; limit is {MAX_GALLERY_IMAGES}"
msgstr "Only {0} of {1} {2, plural, one {image} other {images}} added; limit is {MAX_GALLERY_IMAGES}"
@@ -8004,7 +8012,7 @@ msgstr ""
#: src/screens/Messages/components/MessageComposer.tsx:204
#: src/screens/Messages/components/MessageInput.web.tsx:174
-#: src/view/com/composer/Composer.tsx:2228
+#: src/view/com/composer/Composer.tsx:2234
msgid "Open emoji picker"
msgstr ""
@@ -8715,7 +8723,7 @@ msgstr ""
msgid "Post a video"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1505
+#: src/view/com/composer/Composer.tsx:1506
msgid "Post anyway"
msgstr "Post anyway"
@@ -8800,8 +8808,8 @@ msgctxt "toast"
msgid "Post unpinned"
msgstr ""
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:257
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:269
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:261
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:273
#: src/screens/ProfileList/index.tsx:167
#: src/screens/StarterPack/StarterPackScreen.tsx:197
#: src/view/screens/Profile.tsx:264
@@ -8892,11 +8900,11 @@ msgstr ""
msgid "Privacy violation of a minor"
msgstr ""
-#: src/view/com/composer/Composer.tsx:2662
+#: src/view/com/composer/Composer.tsx:2668
msgid "Processing GIF..."
msgstr ""
-#: src/view/com/composer/Composer.tsx:2664
+#: src/view/com/composer/Composer.tsx:2670
msgid "Processing video..."
msgstr ""
@@ -8950,22 +8958,22 @@ msgid "Public, sharable lists of users to mute or block in bulk."
msgstr ""
#. Accessibility label for button to publish a single post
-#: src/view/com/composer/Composer.tsx:1829
+#: src/view/com/composer/Composer.tsx:1830
msgid "Publish post"
msgstr ""
#. Accessibility label for button to publish multiple posts in a thread
-#: src/view/com/composer/Composer.tsx:1824
+#: src/view/com/composer/Composer.tsx:1825
msgid "Publish posts"
msgstr ""
#. Accessibility label for button to publish multiple replies in a thread
-#: src/view/com/composer/Composer.tsx:1813
+#: src/view/com/composer/Composer.tsx:1814
msgid "Publish replies"
msgstr ""
#. Accessibility label for button to publish a single reply
-#: src/view/com/composer/Composer.tsx:1818
+#: src/view/com/composer/Composer.tsx:1819
msgid "Publish reply"
msgstr ""
@@ -9420,8 +9428,8 @@ msgstr "Replied-to message from {senderName}, tap to scroll to it"
msgid "Replied-to message, tap to scroll to it"
msgstr "Replied-to message, tap to scroll to it"
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:274
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:286
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:278
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:290
#: src/lib/hooks/useNotificationHandler.ts:174
#: src/screens/Settings/NotificationSettings/index.tsx:161
#: src/screens/Settings/NotificationSettings/index.tsx:276
@@ -9442,7 +9450,7 @@ msgstr ""
msgid "Reply"
msgstr "Reply"
-#: src/view/com/composer/Composer.tsx:1841
+#: src/view/com/composer/Composer.tsx:1842
msgctxt "action"
msgid "Reply"
msgstr ""
@@ -9839,28 +9847,28 @@ msgstr ""
msgid "Save birthdate"
msgstr "Save birthdate"
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:198
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:207
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:202
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:211
#: src/screens/SavedFeeds.tsx:122
#: src/screens/SavedFeeds.tsx:126
#: src/screens/SavedFeeds.tsx:314
#: src/screens/SavedFeeds.tsx:318
-#: src/view/com/composer/Composer.tsx:1486
+#: src/view/com/composer/Composer.tsx:1487
#: src/view/com/composer/drafts/DraftsButton.tsx:125
msgid "Save changes"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1458
+#: src/view/com/composer/Composer.tsx:1459
#: src/view/com/composer/drafts/DraftsButton.tsx:93
msgid "Save changes?"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1486
+#: src/view/com/composer/Composer.tsx:1487
#: src/view/com/composer/drafts/DraftsButton.tsx:125
msgid "Save draft"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1460
+#: src/view/com/composer/Composer.tsx:1461
#: src/view/com/composer/drafts/DraftsButton.tsx:95
msgid "Save draft?"
msgstr ""
@@ -10818,7 +10826,7 @@ msgstr ""
msgid "Skip contact sharing and continue to the app"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1503
+#: src/view/com/composer/Composer.tsx:1504
msgid "Skip empty posts?"
msgstr "Skip empty posts?"
@@ -11143,7 +11151,7 @@ msgstr "Subscribe to {publicationTitle} on {0}"
msgid "Subscribe to @{0} to use these labels:"
msgstr ""
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:252
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:256
msgid "Subscribe to account activity"
msgstr ""
@@ -12003,7 +12011,7 @@ msgstr ""
msgid "This post will be hidden from feeds and threads. This cannot be undone."
msgstr ""
-#: src/view/com/composer/Composer.tsx:1065
+#: src/view/com/composer/Composer.tsx:1066
msgid "This post's author has disabled quote posts."
msgstr ""
@@ -12574,7 +12582,7 @@ msgstr ""
msgid "Unsupported clipboard content"
msgstr "Unsupported clipboard content"
-#: src/view/com/composer/Composer.tsx:1593
+#: src/view/com/composer/Composer.tsx:1594
msgid "Unsupported video type: {mimeType}"
msgstr ""
@@ -12659,7 +12667,7 @@ msgstr ""
msgid "Upload from Library"
msgstr ""
-#: src/view/com/composer/Composer.tsx:2655
+#: src/view/com/composer/Composer.tsx:2661
msgid "Uploading GIF..."
msgstr ""
@@ -12673,7 +12681,7 @@ msgstr ""
msgid "Uploading link thumbnail..."
msgstr ""
-#: src/view/com/composer/Composer.tsx:2657
+#: src/view/com/composer/Composer.tsx:2663
msgid "Uploading video..."
msgstr ""
@@ -12935,7 +12943,7 @@ msgstr ""
msgid "Video settings"
msgstr ""
-#: src/view/com/composer/Composer.tsx:2675
+#: src/view/com/composer/Composer.tsx:2681
msgid "Video uploaded"
msgstr ""
@@ -12952,7 +12960,7 @@ msgstr ""
msgid "Videos must be less than 3 minutes long."
msgstr ""
-#: src/view/com/composer/Composer.tsx:1183
+#: src/view/com/composer/Composer.tsx:1184
msgctxt "Action to view the post the user just created"
msgid "View"
msgstr ""
@@ -13037,7 +13045,7 @@ msgstr ""
msgid "View more trending videos"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1167
+#: src/view/com/composer/Composer.tsx:1168
msgid "View post"
msgstr ""
@@ -13307,7 +13315,7 @@ msgstr ""
msgid "We’re sorry, but your search could not be completed. Please try again in a few minutes."
msgstr "We’re sorry, but your search could not be completed. Please try again in a few minutes."
-#: src/view/com/composer/Composer.tsx:1063
+#: src/view/com/composer/Composer.tsx:1064
msgid "We're sorry! The post you are replying to has been deleted."
msgstr ""
@@ -13409,7 +13417,7 @@ msgstr "Would you like to block this user and/or leave this conversation?"
msgid "Would you like to save this as a draft before viewing your drafts?"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1474
+#: src/view/com/composer/Composer.tsx:1475
msgid "Would you like to save this as a draft to edit later?"
msgstr ""
@@ -13418,12 +13426,12 @@ msgstr ""
msgid "Write a post"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1653
+#: src/view/com/composer/Composer.tsx:1654
msgid "Write post"
msgstr ""
#: src/screens/PostThread/components/ThreadComposePrompt.tsx:91
-#: src/view/com/composer/Composer.tsx:1555
+#: src/view/com/composer/Composer.tsx:1556
msgid "Write your reply"
msgstr ""
@@ -13578,11 +13586,11 @@ msgid "You can now sign in with your new password."
msgstr ""
#. Toast shown when the user tries to add more images but the post gallery is already at the cap
-#: src/view/com/composer/Composer.tsx:228
+#: src/view/com/composer/Composer.tsx:229
msgid "You can only add up to {MAX_GALLERY_IMAGES, plural, other {# images}} per post"
msgstr "You can only add up to {MAX_GALLERY_IMAGES, plural, other {# images}} per post"
-#: src/view/com/composer/Composer.tsx:1479
+#: src/view/com/composer/Composer.tsx:1480
msgid "You can only save drafts up to 1000 characters."
msgstr ""
@@ -13719,7 +13727,7 @@ msgstr ""
msgid "You have temporarily reached the limit for video uploads. Please try again later."
msgstr ""
-#: src/view/com/composer/Composer.tsx:1469
+#: src/view/com/composer/Composer.tsx:1470
msgid "You have unsaved changes to this draft, would you like to save them?"
msgstr ""
@@ -13847,7 +13855,7 @@ msgid "You will be signed out of all your accounts."
msgstr ""
#. placeholder {0}: sanitizeHandle(profile.handle, '@')
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:140
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:144
msgid "You will no longer receive notifications for {0}"
msgstr ""
@@ -13894,7 +13902,7 @@ msgid "You'll need to go to the System Settings for Bluesky and give permission
msgstr ""
#. placeholder {0}: sanitizeHandle(profile.handle, '@')
-#: src/components/activity-notifications/SubscribeProfileDialog.tsx:172
+#: src/components/activity-notifications/SubscribeProfileDialog.tsx:176
msgid "You'll start receiving notifications for {0}!"
msgstr ""
@@ -13935,7 +13943,7 @@ msgstr ""
msgid "You've reached the end of your feed! Find some more accounts to follow."
msgstr ""
-#: src/view/com/composer/Composer.tsx:668
+#: src/view/com/composer/Composer.tsx:669
msgid "You've reached the maximum number of drafts"
msgstr ""
@@ -14112,11 +14120,11 @@ msgstr ""
msgid "Your payment is still being processed. Please check back later."
msgstr "Your payment is still being processed. Please check back later."
-#: src/view/com/composer/Composer.tsx:1163
+#: src/view/com/composer/Composer.tsx:1164
msgid "Your post was sent"
msgstr ""
-#: src/view/com/composer/Composer.tsx:1160
+#: src/view/com/composer/Composer.tsx:1161
msgid "Your posts were sent"
msgstr ""
@@ -14134,7 +14142,7 @@ msgstr ""
msgid "Your profile, posts, feeds, and lists will no longer be visible to other {0} users. You can reactivate your account at any time by logging in."
msgstr "Your profile, posts, feeds, and lists will no longer be visible to other {0} users. You can reactivate your account at any time by logging in."
-#: src/view/com/composer/Composer.tsx:1162
+#: src/view/com/composer/Composer.tsx:1163
msgid "Your reply was sent"
msgstr ""
@@ -14155,7 +14163,7 @@ msgstr "Your session has expired. Please sign in again."
msgid "Your support helps us maintain and improve the Blacksky community."
msgstr "Your support helps us maintain and improve the Blacksky community."
-#: src/view/com/composer/Composer.tsx:1504
+#: src/view/com/composer/Composer.tsx:1505
msgid "Your thread has empty posts that will be skipped. The remaining posts will be published as a thread."
msgstr "Your thread has empty posts that will be skipped. The remaining posts will be published as a thread."
diff --git a/src/state/__tests__/appview-fallback-probe.test.ts b/src/state/__tests__/appview-fallback-probe.test.ts
new file mode 100644
index 000000000..fe74069a8
--- /dev/null
+++ b/src/state/__tests__/appview-fallback-probe.test.ts
@@ -0,0 +1,96 @@
+import {type AtpAgent} from '@atproto/api'
+
+import {
+ probeFallbackEligibility,
+ resetProbeCacheForTesting,
+} from '../appview-fallback-probe'
+
+jest.mock('#/analytics/metrics', () => ({
+ metrics: {track: jest.fn()},
+}))
+
+function agentWith(getProfile: jest.Mock, did = 'did:plc:test123'): AtpAgent {
+ return {
+ session: {did},
+ app: {bsky: {actor: {getProfile}}},
+ } as unknown as AtpAgent
+}
+
+describe('probeFallbackEligibility', () => {
+ beforeEach(() => {
+ resetProbeCacheForTesting()
+ })
+
+ it('eligible when the fallback appview serves the profile', async () => {
+ const getProfile = jest.fn().mockResolvedValue({data: {}})
+ expect(await probeFallbackEligibility(agentWith(getProfile))).toBe(
+ 'eligible',
+ )
+ })
+
+ it.each([
+ ['AccountTakedown error name', {error: 'AccountTakedown', status: 400}],
+ ['AccountDeactivated error name', {error: 'AccountDeactivated'}],
+ ['401 status', {status: 401}],
+ ['403 status', {status: 403}],
+ ['suspended message', {message: 'Account has been suspended'}],
+ ['taken down message', {message: 'this account was taken down'}],
+ ])('ineligible on %s', async (_name, errShape) => {
+ const getProfile = jest
+ .fn()
+ .mockRejectedValue(Object.assign(new Error(), errShape))
+ expect(await probeFallbackEligibility(agentWith(getProfile))).toBe(
+ 'ineligible',
+ )
+ })
+
+ it('unknown on network/transient errors, and not cached', async () => {
+ const getProfile = jest
+ .fn()
+ .mockRejectedValueOnce(new Error('Network request failed'))
+ .mockResolvedValueOnce({data: {}})
+ const agent = agentWith(getProfile)
+
+ expect(await probeFallbackEligibility(agent)).toBe('unknown')
+ expect(await probeFallbackEligibility(agent)).toBe('eligible')
+ })
+
+ it('caches a definitive result per DID', async () => {
+ const getProfile = jest.fn().mockResolvedValue({data: {}})
+ const agent = agentWith(getProfile)
+
+ await probeFallbackEligibility(agent)
+ await probeFallbackEligibility(agent)
+ expect(getProfile).toHaveBeenCalledTimes(1)
+ })
+
+ it('re-probes after the cache TTL expires', async () => {
+ const getProfile = jest
+ .fn()
+ .mockResolvedValueOnce({data: {}})
+ .mockRejectedValueOnce(
+ Object.assign(new Error(), {error: 'AccountTakedown', status: 400}),
+ )
+ const agent = agentWith(getProfile)
+ const nowSpy = jest.spyOn(Date, 'now')
+
+ nowSpy.mockReturnValue(1_000_000)
+ expect(await probeFallbackEligibility(agent)).toBe('eligible')
+
+ nowSpy.mockReturnValue(1_000_000 + 61 * 60e3)
+ expect(await probeFallbackEligibility(agent)).toBe('ineligible')
+ expect(getProfile).toHaveBeenCalledTimes(2)
+
+ nowSpy.mockRestore()
+ })
+
+ it('unknown without a session', async () => {
+ const getProfile = jest.fn()
+ const agent = {
+ session: undefined,
+ app: {bsky: {actor: {getProfile}}},
+ } as unknown as AtpAgent
+ expect(await probeFallbackEligibility(agent)).toBe('unknown')
+ expect(getProfile).not.toHaveBeenCalled()
+ })
+})
diff --git a/src/state/__tests__/appview-fallback.test.ts b/src/state/__tests__/appview-fallback.test.ts
new file mode 100644
index 000000000..ba19499f6
--- /dev/null
+++ b/src/state/__tests__/appview-fallback.test.ts
@@ -0,0 +1,90 @@
+import {type BskyAgent} from '@atproto/api'
+import {type QueryClient} from '@tanstack/react-query'
+
+import {
+ BLUESKY_FALLBACK_PROXY_HEADER,
+ BLUESKY_PROXY_HEADER,
+ HOME_PROXY_HEADER,
+} from '#/lib/constants'
+import {
+ isFallbackActive,
+ setFallbackActive,
+ subscribe,
+} from '../appview-fallback'
+
+function mocks() {
+ const configureProxy = jest.fn()
+ const resetQueries = jest.fn().mockResolvedValue(undefined)
+ return {
+ agent: {configureProxy} as unknown as BskyAgent,
+ queryClient: {resetQueries} as unknown as QueryClient,
+ configureProxy,
+ resetQueries,
+ }
+}
+
+describe('appview fallback state', () => {
+ afterEach(() => {
+ const {agent, queryClient} = mocks()
+ setFallbackActive(false, agent, queryClient)
+ BLUESKY_PROXY_HEADER.set(HOME_PROXY_HEADER)
+ })
+
+ it('activating flips the global header, live agent, and resets the cache', () => {
+ const {agent, queryClient, configureProxy, resetQueries} = mocks()
+
+ setFallbackActive(true, agent, queryClient)
+
+ expect(isFallbackActive()).toBe(true)
+ expect(BLUESKY_PROXY_HEADER.get()).toBe(BLUESKY_FALLBACK_PROXY_HEADER)
+ expect(configureProxy).toHaveBeenCalledWith(BLUESKY_FALLBACK_PROXY_HEADER)
+ expect(resetQueries).toHaveBeenCalledTimes(1)
+ })
+
+ it('deactivating restores the home appview header', () => {
+ const first = mocks()
+ setFallbackActive(true, first.agent, first.queryClient)
+
+ const second = mocks()
+ setFallbackActive(false, second.agent, second.queryClient)
+
+ expect(isFallbackActive()).toBe(false)
+ expect(BLUESKY_PROXY_HEADER.get()).toBe(HOME_PROXY_HEADER)
+ expect(second.configureProxy).toHaveBeenCalledWith(HOME_PROXY_HEADER)
+ })
+
+ it('setting the same value skips the reset but still aligns the agent', () => {
+ const {agent, queryClient, configureProxy, resetQueries} = mocks()
+
+ setFallbackActive(false, agent, queryClient)
+
+ expect(configureProxy).toHaveBeenCalledWith(HOME_PROXY_HEADER)
+ expect(resetQueries).not.toHaveBeenCalled()
+ })
+
+ it('a fresh agent passed after activation gets the fallback header', () => {
+ const first = mocks()
+ setFallbackActive(true, first.agent, first.queryClient)
+
+ const second = mocks()
+ setFallbackActive(true, second.agent, second.queryClient)
+
+ expect(second.configureProxy).toHaveBeenCalledWith(
+ BLUESKY_FALLBACK_PROXY_HEADER,
+ )
+ expect(second.resetQueries).not.toHaveBeenCalled()
+ })
+
+ it('notifies subscribers on change and stops after unsubscribe', () => {
+ const {agent, queryClient} = mocks()
+ const fn = jest.fn()
+ const unsub = subscribe(fn)
+
+ setFallbackActive(true, agent, queryClient)
+ expect(fn).toHaveBeenCalledTimes(1)
+
+ unsub()
+ setFallbackActive(false, agent, queryClient)
+ expect(fn).toHaveBeenCalledTimes(1)
+ })
+})
diff --git a/src/state/__tests__/appview-health.test.ts b/src/state/__tests__/appview-health.test.ts
new file mode 100644
index 000000000..d43f72bb4
--- /dev/null
+++ b/src/state/__tests__/appview-health.test.ts
@@ -0,0 +1,64 @@
+import {BLUESKY_FALLBACK_PROXY_HEADER, HOME_PROXY_HEADER} from '#/lib/constants'
+import {
+ isHomeAppviewOutage,
+ reportProxiedFetch,
+ resetForTesting,
+} from '../appview-health'
+
+jest.mock('#/analytics/metrics', () => ({
+ metrics: {track: jest.fn()},
+}))
+
+const HOME = {headers: {'atproto-proxy': HOME_PROXY_HEADER}}
+const FALLBACK = {headers: {'atproto-proxy': BLUESKY_FALLBACK_PROXY_HEADER}}
+
+function fail(init: RequestInit, times: number, status: number | null = 503) {
+ for (let i = 0; i < times; i++) reportProxiedFetch(init, status)
+}
+
+describe('home appview circuit breaker', () => {
+ beforeEach(() => {
+ resetForTesting()
+ })
+
+ it('trips after 8 consecutive home-bound failures', () => {
+ fail(HOME, 7)
+ expect(isHomeAppviewOutage()).toBe(false)
+ fail(HOME, 1)
+ expect(isHomeAppviewOutage()).toBe(true)
+ })
+
+ it('network errors (null status) count as failures', () => {
+ fail(HOME, 8, null)
+ expect(isHomeAppviewOutage()).toBe(true)
+ })
+
+ it('4xx responses mean the appview answered — no trip', () => {
+ fail(HOME, 20, 400)
+ expect(isHomeAppviewOutage()).toBe(false)
+ })
+
+ it('a success resets the streak and clears an active outage', () => {
+ fail(HOME, 7)
+ reportProxiedFetch(HOME, 200)
+ fail(HOME, 7)
+ expect(isHomeAppviewOutage()).toBe(false)
+
+ fail(HOME, 8)
+ expect(isHomeAppviewOutage()).toBe(true)
+ reportProxiedFetch(HOME, 200)
+ expect(isHomeAppviewOutage()).toBe(false)
+ })
+
+ it('ignores fallback-bound and unproxied requests', () => {
+ fail(FALLBACK, 20)
+ fail({}, 20)
+ expect(isHomeAppviewOutage()).toBe(false)
+ })
+
+ it('reads the header from Headers instances too', () => {
+ const headers = new Headers({'atproto-proxy': HOME_PROXY_HEADER})
+ fail({headers}, 8)
+ expect(isHomeAppviewOutage()).toBe(true)
+ })
+})
diff --git a/src/state/__tests__/appview-status.test.ts b/src/state/__tests__/appview-status.test.ts
new file mode 100644
index 000000000..48b17ba12
--- /dev/null
+++ b/src/state/__tests__/appview-status.test.ts
@@ -0,0 +1,65 @@
+import {
+ decide,
+ type DeciderState,
+ DEFAULT_THRESHOLDS,
+ INITIAL_DECIDER_STATE,
+ type StatusSample,
+} from '../appview-status'
+
+const T = DEFAULT_THRESHOLDS
+
+function run(samples: Array, from?: DeciderState) {
+ let state = from ?? INITIAL_DECIDER_STATE
+ for (const s of samples) state = decide(state, s, T)
+ return state
+}
+
+const LAGGING: StatusSample = {lagSeconds: 600, queueLength: 0}
+const HEALTHY: StatusSample = {lagSeconds: 5, queueLength: 100}
+const BACKLOGGED: StatusSample = {lagSeconds: 5, queueLength: 500_000}
+const MIDDLING: StatusSample = {lagSeconds: 120, queueLength: 0}
+
+describe('fallback decider', () => {
+ it('enters after consecutive lagging samples, not one', () => {
+ expect(run([LAGGING]).active).toBe(false)
+ expect(run([LAGGING, LAGGING]).active).toBe(true)
+ })
+
+ it('a healthy sample resets the enter streak', () => {
+ expect(run([LAGGING, HEALTHY, LAGGING]).active).toBe(false)
+ })
+
+ it('queue backlog alone triggers entry even with low lag', () => {
+ expect(run([BACKLOGGED, BACKLOGGED]).active).toBe(true)
+ })
+
+ it('exits only after sustained health', () => {
+ const active = run([LAGGING, LAGGING])
+ expect(run([HEALTHY, HEALTHY], active).active).toBe(true)
+ expect(run([HEALTHY, HEALTHY, HEALTHY], active).active).toBe(false)
+ })
+
+ it('middling lag holds the current state in both directions', () => {
+ expect(run([MIDDLING, MIDDLING, MIDDLING]).active).toBe(false)
+ const active = run([LAGGING, LAGGING])
+ expect(run([MIDDLING, MIDDLING, MIDDLING, MIDDLING], active).active).toBe(
+ true,
+ )
+ })
+
+ it('failed or empty polls never move the counters', () => {
+ expect(run([LAGGING, null, LAGGING]).active).toBe(true)
+ const active = run([LAGGING, LAGGING])
+ expect(
+ run([null, null, null, {lagSeconds: null, queueLength: null}], active)
+ .active,
+ ).toBe(true)
+ })
+
+ it('a good streak broken by a bad sample starts over', () => {
+ const active = run([LAGGING, LAGGING])
+ expect(
+ run([HEALTHY, HEALTHY, LAGGING, HEALTHY, HEALTHY], active).active,
+ ).toBe(true)
+ })
+})
diff --git a/src/state/appview-fallback-controller.tsx b/src/state/appview-fallback-controller.tsx
new file mode 100644
index 000000000..30a928642
--- /dev/null
+++ b/src/state/appview-fallback-controller.tsx
@@ -0,0 +1,98 @@
+import {useCallback, useEffect, useRef} from 'react'
+import {AppState} from 'react-native'
+import {useQueryClient} from '@tanstack/react-query'
+
+import {type FallbackMode, setFallbackActive} from '#/state/appview-fallback'
+import {probeFallbackEligibility} from '#/state/appview-fallback-probe'
+import {
+ isHomeAppviewOutage,
+ subscribe as subscribeOutage,
+} from '#/state/appview-health'
+import {
+ decide,
+ type DeciderState,
+ fetchStatusSample,
+ getThresholds,
+ INITIAL_DECIDER_STATE,
+} from '#/state/appview-status'
+import {useAgent, useSession} from '#/state/session'
+import {Features, features, init as featuresInit} from '#/analytics/features'
+
+const RECHECK_INTERVAL = 3 * 60e3
+
+function getMode(): FallbackMode {
+ const value = features.getFeatureValue(Features.AppviewFallbackMode, 'auto')
+ if (value === 'force-fallback' || value === 'force-primary') return value
+ return 'auto'
+}
+
+export function AppviewFallbackController() {
+ const agent = useAgent()
+ const queryClient = useQueryClient()
+ const {hasSession} = useSession()
+ const deciderRef = useRef(INITIAL_DECIDER_STATE)
+ const epochRef = useRef(0)
+
+ const evaluate = useCallback(async () => {
+ // Evaluations await network (status poll, eligibility probe) and can fire
+ // concurrently from the interval, foregrounding, and outage transitions.
+ // Only the newest run may apply a result: a stale run resolving late would
+ // otherwise overwrite a fresher decision with an outdated one.
+ const epoch = ++epochRef.current
+ const apply = (next: boolean, trigger?: FallbackMode) => {
+ if (epoch !== epochRef.current) return
+ setFallbackActive(next, agent, queryClient, trigger)
+ }
+
+ // The flag defaults to 'auto' until GrowthBook has loaded; acting on that
+ // default would override an operator-set force-* mode during launch.
+ await featuresInit
+
+ if (!hasSession) {
+ apply(false)
+ return
+ }
+
+ const mode = getMode()
+ if (mode === 'force-primary') {
+ apply(false)
+ return
+ }
+
+ let wantsFallback: boolean
+ if (mode === 'force-fallback') {
+ wantsFallback = true
+ } else if (isHomeAppviewOutage()) {
+ wantsFallback = true
+ } else {
+ const sample = await fetchStatusSample()
+ deciderRef.current = decide(deciderRef.current, sample, getThresholds())
+ wantsFallback = deciderRef.current.active
+ }
+
+ if (!wantsFallback) {
+ apply(false)
+ return
+ }
+
+ const eligibility = await probeFallbackEligibility(agent)
+ apply(eligibility === 'eligible', mode)
+ }, [agent, queryClient, hasSession])
+
+ useEffect(() => {
+ void evaluate()
+
+ const interval = setInterval(() => void evaluate(), RECHECK_INTERVAL)
+ const sub = AppState.addEventListener('change', state => {
+ if (state === 'active') void evaluate()
+ })
+ const unsubOutage = subscribeOutage(() => void evaluate())
+ return () => {
+ clearInterval(interval)
+ sub.remove()
+ unsubOutage()
+ }
+ }, [evaluate])
+
+ return null
+}
diff --git a/src/state/appview-fallback-probe.ts b/src/state/appview-fallback-probe.ts
new file mode 100644
index 000000000..aa25d84ef
--- /dev/null
+++ b/src/state/appview-fallback-probe.ts
@@ -0,0 +1,78 @@
+import {type AtpAgent} from '@atproto/api'
+
+import {BLUESKY_FALLBACK_PROXY_HEADER} from '#/lib/constants'
+import {metrics} from '#/analytics/metrics'
+
+export type ProbeResult = 'eligible' | 'ineligible' | 'unknown'
+
+const PROBE_TTL_MS = 60 * 60e3
+
+const cache = new Map()
+const lastTracked = new Map()
+
+const INELIGIBLE_ERROR_NAMES = ['AccountTakedown', 'AccountDeactivated']
+const INELIGIBLE_MESSAGE_FRAGMENTS = ['suspended', 'taken down', 'deactivated']
+
+// Matches broadly — any auth rejection or takedown signal counts, mirroring
+// isAuthorModerated in microcosm-fallback. Definitive results expire after
+// PROBE_TTL_MS so a status change is picked up within the hour.
+export async function probeFallbackEligibility(
+ agent: AtpAgent,
+): Promise {
+ const did = agent.session?.did
+ if (!did) return 'unknown'
+
+ const cached = cache.get(did)
+ if (
+ cached &&
+ cached.result !== 'unknown' &&
+ Date.now() - cached.at < PROBE_TTL_MS
+ ) {
+ return cached.result
+ }
+
+ let result: ProbeResult
+ let errorName: string | undefined
+ let status: number | undefined
+ try {
+ await agent.app.bsky.actor.getProfile(
+ {actor: did},
+ {headers: {'atproto-proxy': BLUESKY_FALLBACK_PROXY_HEADER}},
+ )
+ result = 'eligible'
+ } catch (e) {
+ const err = e as {status?: number; error?: string}
+ errorName = typeof err?.error === 'string' ? err.error : undefined
+ status = typeof err?.status === 'number' ? err.status : undefined
+ result = classifyProbeError(e)
+ }
+
+ cache.set(did, {result, at: Date.now()})
+ if (lastTracked.get(did) !== result) {
+ lastTracked.set(did, result)
+ metrics.track('appviewFallback:probe', {result, errorName, status})
+ }
+ return result
+}
+
+function classifyProbeError(e: unknown): ProbeResult {
+ const err = e as {status?: number; error?: string; message?: string}
+ const status = typeof err?.status === 'number' ? err.status : undefined
+ const name = typeof err?.error === 'string' ? err.error : ''
+ const message = typeof err?.message === 'string' ? err.message : ''
+
+ if (status === 401 || status === 403) return 'ineligible'
+ if (INELIGIBLE_ERROR_NAMES.includes(name)) return 'ineligible'
+ const lower = message.toLowerCase()
+ if (INELIGIBLE_MESSAGE_FRAGMENTS.some(f => lower.includes(f))) {
+ return 'ineligible'
+ }
+ // Anything else (network failure, transient 5xx) leaves eligibility
+ // undetermined; don't activate fallback on it.
+ return 'unknown'
+}
+
+export function resetProbeCacheForTesting() {
+ cache.clear()
+ lastTracked.clear()
+}
diff --git a/src/state/appview-fallback.ts b/src/state/appview-fallback.ts
new file mode 100644
index 000000000..fbb753f5e
--- /dev/null
+++ b/src/state/appview-fallback.ts
@@ -0,0 +1,56 @@
+import {useSyncExternalStore} from 'react'
+import {type AtpAgent} from '@atproto/api'
+import {type QueryClient} from '@tanstack/react-query'
+
+import {
+ BLUESKY_FALLBACK_PROXY_HEADER,
+ BLUESKY_PROXY_HEADER,
+ HOME_PROXY_HEADER,
+} from '#/lib/constants'
+import {logger} from '#/logger'
+import {metrics} from '#/analytics/metrics'
+
+export type FallbackMode = 'auto' | 'force-fallback' | 'force-primary'
+
+let active = false
+const listeners = new Set<() => void>()
+
+export function isFallbackActive(): boolean {
+ return active
+}
+
+export function subscribe(fn: () => void): () => void {
+ listeners.add(fn)
+ return () => {
+ listeners.delete(fn)
+ }
+}
+
+// Pagination cursors are appview-specific: a cached page from one appview
+// must never be continued against the other, hence the cache reset on flip.
+export function setFallbackActive(
+ next: boolean,
+ agent: AtpAgent,
+ queryClient: QueryClient,
+ trigger: FallbackMode = 'auto',
+): void {
+ const header = next ? BLUESKY_FALLBACK_PROXY_HEADER : HOME_PROXY_HEADER
+ if (next === active) {
+ // The agent instance may be newer than the last transition (session
+ // restore and account switches swap agents); keep it coherent even
+ // when the state itself is unchanged.
+ agent.configureProxy(header)
+ return
+ }
+ active = next
+ BLUESKY_PROXY_HEADER.set(header)
+ agent.configureProxy(header)
+ void queryClient.resetQueries()
+ logger.info('appview fallback changed', {active: next, trigger})
+ metrics.track('appviewFallback:changed', {active: next, trigger})
+ listeners.forEach(fn => fn())
+}
+
+export function useAppviewFallback(): boolean {
+ return useSyncExternalStore(subscribe, isFallbackActive, isFallbackActive)
+}
diff --git a/src/state/appview-health.ts b/src/state/appview-health.ts
new file mode 100644
index 000000000..f575e3f1c
--- /dev/null
+++ b/src/state/appview-health.ts
@@ -0,0 +1,85 @@
+import {useSyncExternalStore} from 'react'
+
+import {HOME_PROXY_HEADER} from '#/lib/constants'
+import {logger} from '#/logger'
+import {metrics} from '#/analytics/metrics'
+
+const OUTAGE_CONSECUTIVE_FAILURES = 8
+
+let consecutiveFailures = 0
+let outage = false
+const listeners = new Set<() => void>()
+
+export function isHomeAppviewOutage(): boolean {
+ return outage
+}
+
+export function subscribe(fn: () => void): () => void {
+ listeners.add(fn)
+ return () => {
+ listeners.delete(fn)
+ }
+}
+
+export function useHomeAppviewOutage(): boolean {
+ return useSyncExternalStore(
+ subscribe,
+ isHomeAppviewOutage,
+ isHomeAppviewOutage,
+ )
+}
+
+function getProxyHeader(init: RequestInit | undefined): string | null {
+ if (!init?.headers) return null
+ if (init.headers instanceof Headers) {
+ return init.headers.get('atproto-proxy')
+ }
+ if (Array.isArray(init.headers)) {
+ const entry = init.headers.find(
+ ([k]) => k.toLowerCase() === 'atproto-proxy',
+ )
+ return entry?.[1] ?? null
+ }
+ const record = init.headers
+ return record['atproto-proxy'] ?? record['Atproto-Proxy'] ?? null
+}
+
+/**
+ * Circuit breaker over home-appview-bound requests. Only 5xx and network
+ * failures count — 4xx means the appview answered. Only requests whose
+ * proxy header targets the home appview are relevant; during fallback,
+ * pinned calls (community, notifications) keep feeding this, and the
+ * 30-second notifications unread poll gives it a steady heartbeat.
+ */
+export function reportProxiedFetch(
+ init: RequestInit | undefined,
+ status: number | null,
+): void {
+ if (getProxyHeader(init) !== HOME_PROXY_HEADER) return
+
+ const failed = status === null || status >= 500
+ if (!failed) {
+ consecutiveFailures = 0
+ setOutage(false)
+ return
+ }
+
+ consecutiveFailures++
+ if (consecutiveFailures >= OUTAGE_CONSECUTIVE_FAILURES) {
+ setOutage(true)
+ }
+}
+
+function setOutage(next: boolean): void {
+ if (next === outage) return
+ outage = next
+ logger.info('home appview outage state changed', {outage: next})
+ metrics.track('appviewFallback:outage', {active: next})
+ listeners.forEach(fn => fn())
+}
+
+export function resetForTesting(): void {
+ consecutiveFailures = 0
+ outage = false
+ listeners.clear()
+}
diff --git a/src/state/appview-status.ts b/src/state/appview-status.ts
new file mode 100644
index 000000000..808746737
--- /dev/null
+++ b/src/state/appview-status.ts
@@ -0,0 +1,105 @@
+import {APPVIEW_STATUS_URL} from '#/lib/constants'
+import {Features, features} from '#/analytics/features'
+
+export type StatusSample = {
+ lagSeconds: number | null
+ queueLength: number | null
+}
+
+export type FallbackThresholds = {
+ enterLagSeconds: number
+ exitLagSeconds: number
+ enterQueueLength: number
+ exitQueueLength: number
+ enterConsecutive: number
+ exitConsecutive: number
+}
+
+export const DEFAULT_THRESHOLDS: FallbackThresholds = {
+ enterLagSeconds: 300,
+ exitLagSeconds: 60,
+ enterQueueLength: 300_000,
+ exitQueueLength: 60_000,
+ enterConsecutive: 2,
+ exitConsecutive: 3,
+}
+
+export function getThresholds(): FallbackThresholds {
+ const value = features.getFeatureValue(
+ Features.AppviewFallbackThresholds,
+ {},
+ ) as Partial
+ return {...DEFAULT_THRESHOLDS, ...value}
+}
+
+export async function fetchStatusSample(): Promise {
+ try {
+ const res = await fetch(APPVIEW_STATUS_URL)
+ if (!res.ok) return null
+ const body = (await res.json()) as {
+ ingestLagSeconds?: unknown
+ indexerQueueLength?: unknown
+ }
+ return {
+ lagSeconds:
+ typeof body.ingestLagSeconds === 'number'
+ ? body.ingestLagSeconds
+ : null,
+ queueLength:
+ typeof body.indexerQueueLength === 'number'
+ ? body.indexerQueueLength
+ : null,
+ }
+ } catch {
+ return null
+ }
+}
+
+export type DeciderState = {
+ active: boolean
+ badCount: number
+ goodCount: number
+}
+
+export const INITIAL_DECIDER_STATE: DeciderState = {
+ active: false,
+ badCount: 0,
+ goodCount: 0,
+}
+
+/**
+ * Asymmetric enter/exit: harder to leave a state than to enter it, so lag
+ * hovering at a threshold can't flip the app back and forth on every poll.
+ * A failed poll (null sample) is uninformative and never moves the counters:
+ * an unreachable status endpoint is usually the user's own network.
+ */
+export function decide(
+ state: DeciderState,
+ sample: StatusSample | null,
+ t: FallbackThresholds,
+): DeciderState {
+ if (!sample || (sample.lagSeconds === null && sample.queueLength === null)) {
+ return state
+ }
+
+ const bad =
+ (sample.lagSeconds !== null && sample.lagSeconds > t.enterLagSeconds) ||
+ (sample.queueLength !== null && sample.queueLength > t.enterQueueLength)
+ const good =
+ (sample.lagSeconds === null || sample.lagSeconds < t.exitLagSeconds) &&
+ (sample.queueLength === null || sample.queueLength < t.exitQueueLength)
+
+ if (!state.active) {
+ const badCount = bad ? state.badCount + 1 : 0
+ if (badCount >= t.enterConsecutive) {
+ return {active: true, badCount: 0, goodCount: 0}
+ }
+ return {...state, badCount}
+ }
+
+ const goodCount = good ? state.goodCount + 1 : 0
+ if (goodCount >= t.exitConsecutive) {
+ return {active: false, badCount: 0, goodCount: 0}
+ }
+ return {...state, goodCount}
+}
diff --git a/src/state/queries/activity-subscriptions.ts b/src/state/queries/activity-subscriptions.ts
index 30964fe7d..7f290353b 100644
--- a/src/state/queries/activity-subscriptions.ts
+++ b/src/state/queries/activity-subscriptions.ts
@@ -13,6 +13,7 @@ import {
useQueryClient,
} from '@tanstack/react-query'
+import {HOME_APPVIEW_PINNED_OPTS} from '#/lib/constants'
import {useAgent, useSession} from '#/state/session'
import * as Toast from '#/components/Toast'
@@ -26,9 +27,12 @@ export function useActivitySubscriptionsQuery() {
queryKey: RQKEY_getActivitySubscriptions,
queryFn: async ({pageParam}) => {
const response =
- await agent.app.bsky.notification.listActivitySubscriptions({
- cursor: pageParam,
- })
+ await agent.app.bsky.notification.listActivitySubscriptions(
+ {
+ cursor: pageParam,
+ },
+ HOME_APPVIEW_PINNED_OPTS,
+ )
return response.data
},
initialPageParam: undefined as string | undefined,
diff --git a/src/state/queries/notifications/settings.ts b/src/state/queries/notifications/settings.ts
index 7c2649160..52d39e9e2 100644
--- a/src/state/queries/notifications/settings.ts
+++ b/src/state/queries/notifications/settings.ts
@@ -7,6 +7,7 @@ import {
useQueryClient,
} from '@tanstack/react-query'
+import {HOME_APPVIEW_PINNED_OPTS} from '#/lib/constants'
import {logger} from '#/logger'
import {useAgent} from '#/state/session'
import * as Toast from '#/components/Toast'
@@ -22,7 +23,10 @@ export function useNotificationSettingsQuery({
return useQuery({
queryKey: RQKEY,
queryFn: async () => {
- const response = await agent.app.bsky.notification.getPreferences()
+ const response = await agent.app.bsky.notification.getPreferences(
+ {},
+ HOME_APPVIEW_PINNED_OPTS,
+ )
return response.data.preferences
},
enabled,
@@ -36,8 +40,10 @@ export function useNotificationSettingsUpdateMutation() {
mutationFn: async (
update: Partial,
) => {
- const response =
- await agent.app.bsky.notification.putPreferencesV2(update)
+ const response = await agent.app.bsky.notification.putPreferencesV2(
+ update,
+ HOME_APPVIEW_PINNED_OPTS,
+ )
return response.data.preferences
},
onMutate: update => {
diff --git a/src/state/queries/notifications/unread.tsx b/src/state/queries/notifications/unread.tsx
index e02c51014..a3c4426f6 100644
--- a/src/state/queries/notifications/unread.tsx
+++ b/src/state/queries/notifications/unread.tsx
@@ -15,6 +15,7 @@ import {useQueryClient} from '@tanstack/react-query'
import {EventEmitter} from 'eventemitter3'
import BroadcastChannel from '#/lib/broadcast'
+import {HOME_APPVIEW_PINNED_OPTS} from '#/lib/constants'
import {resetBadgeCount} from '#/lib/notifications/notifications'
import {useModerationOpts} from '#/state/preferences/moderation-opts'
import {truncateAndInvalidate} from '#/state/queries/util'
@@ -120,8 +121,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
return {
async markAllRead() {
// update server
- await agent.updateSeenNotifications(
- cacheRef.current.syncedAt.toISOString(),
+ await agent.app.bsky.notification.updateSeen(
+ {seenAt: cacheRef.current.syncedAt.toISOString()},
+ HOME_APPVIEW_PINNED_OPTS,
)
// update & broadcast
diff --git a/src/state/queries/notifications/util.ts b/src/state/queries/notifications/util.ts
index d56c87b31..e9264d9ff 100644
--- a/src/state/queries/notifications/util.ts
+++ b/src/state/queries/notifications/util.ts
@@ -16,6 +16,7 @@ import {type QueryClient} from '@tanstack/react-query'
import chunk from 'lodash.chunk'
import {communityXrpc} from '#/lib/api/community'
+import {HOME_APPVIEW_PINNED_OPTS} from '#/lib/constants'
import {labelIsHideableOffense} from '#/lib/moderation'
import * as bsky from '#/types/bsky'
import {precacheProfile} from '../profile'
@@ -61,11 +62,14 @@ export async function fetchPage({
page: FeedPage
indexedAt: string | undefined
}> {
- const res = await agent.listNotifications({
- limit,
- cursor,
- reasons,
- })
+ const res = await agent.app.bsky.notification.listNotifications(
+ {
+ limit,
+ cursor,
+ reasons,
+ },
+ HOME_APPVIEW_PINNED_OPTS,
+ )
const indexedAt = res.data.notifications[0]?.indexedAt
diff --git a/src/state/session/agent.ts b/src/state/session/agent.ts
index 17c36892b..f21750f8b 100644
--- a/src/state/session/agent.ts
+++ b/src/state/session/agent.ts
@@ -30,6 +30,7 @@ import {
} from '#/lib/constants'
import {getAge} from '#/lib/strings/time'
import {logger} from '#/logger'
+import {reportProxiedFetch} from '#/state/appview-health'
import {snoozeEmailConfirmationPrompt} from '#/state/shell/reminders'
import {features} from '#/analytics'
import {emitNetworkConfirmed, emitNetworkLost} from '../events'
@@ -500,9 +501,11 @@ class BskyAppAgent extends BskyAgent {
try {
const result = await realFetch(input, init)
success = true
+ reportProxiedFetch(init, result.status)
return result
} catch (e) {
success = false
+ reportProxiedFetch(init, null)
throw e
} finally {
if (success) {
diff --git a/src/state/session/oauth-agent.ts b/src/state/session/oauth-agent.ts
index 0bbb2f854..3b0ddeb6c 100644
--- a/src/state/session/oauth-agent.ts
+++ b/src/state/session/oauth-agent.ts
@@ -8,6 +8,7 @@ import {type OAuthSession} from '@atproto/oauth-client'
import {BLUESKY_PROXY_HEADER, BSKY_SERVICE} from '#/lib/constants'
import {logger} from '#/logger'
+import {reportProxiedFetch} from '#/state/appview-health'
import {
sessionAccountToSession,
stripAppviewProxyForPdsLocalMethods,
@@ -128,9 +129,16 @@ export class OauthBskyAppAgent extends Agent {
return session.did
},
fetchHandler(url, init) {
- return session.fetchHandler(
- url,
- stripAppviewProxyForPdsLocalMethods(url, init) ?? init,
+ const finalInit = stripAppviewProxyForPdsLocalMethods(url, init) ?? init
+ return session.fetchHandler(url, finalInit).then(
+ res => {
+ reportProxiedFetch(finalInit, res.status)
+ return res
+ },
+ err => {
+ reportProxiedFetch(finalInit, null)
+ throw err
+ },
)
},
})
diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx
index 67b9df53e..e83db8211 100644
--- a/src/view/com/composer/Composer.tsx
+++ b/src/view/com/composer/Composer.tsx
@@ -80,6 +80,7 @@ import {type NavigationProp} from '#/lib/routes/types'
import {cleanError} from '#/lib/strings/errors'
import {colors} from '#/lib/styles'
import {logger} from '#/logger'
+import {useHomeAppviewOutage} from '#/state/appview-health'
import {useDialogStateControlContext} from '#/state/dialogs'
import {emitPostCreated} from '#/state/events'
import {
@@ -1996,6 +1997,7 @@ function ComposerPills({
const t = useTheme()
const {t: l} = useLingui()
const {data: isCommunityMember = false} = useCommunityMembership()
+ const homeAppviewOutage = useHomeAppviewOutage()
const media = post.embed.media
const hasMedia =
media?.type === 'images' ||
@@ -2039,7 +2041,7 @@ function ComposerPills({
name="blacksky_only"
label={l`Blacksky Only`}
value={thread.blackskyOnly}
- disabled={isForcedBlackskyOnly}
+ disabled={isForcedBlackskyOnly || homeAppviewOutage}
onChange={() => {
const next = !thread.blackskyOnly
dispatch({type: 'toggle_blacksky_only'})
@@ -2047,7 +2049,11 @@ function ComposerPills({
}}
style={[a.flex_row, a.align_center, a.gap_xs]}>
- Blacksky Only
+ {homeAppviewOutage ? (
+ Blacksky Only (temporarily unavailable)
+ ) : (
+ Blacksky Only
+ )}
diff --git a/src/view/com/feeds/CommunityFeedPage.tsx b/src/view/com/feeds/CommunityFeedPage.tsx
index 0926e1569..4bed7e57e 100644
--- a/src/view/com/feeds/CommunityFeedPage.tsx
+++ b/src/view/com/feeds/CommunityFeedPage.tsx
@@ -29,6 +29,7 @@ import {List, type ListMethods} from '#/view/com/util/List'
import {LoadLatestBtn} from '#/view/com/util/load-latest/LoadLatestBtn'
import {MainScrollProvider} from '#/view/com/util/MainScrollProvider'
import {atoms as a, useTheme} from '#/alf'
+import {HomeAppviewOutageNotice} from '#/components/HomeAppviewOutageNotice'
import {useHeaderOffset} from '#/components/hooks/useHeaderOffset'
import {EditBig_Stroke2_Corner2_Rounded as EditBigIcon} from '#/components/icons/EditBig'
import {Text} from '#/components/Typography'
@@ -291,6 +292,7 @@ export function CommunityFeedPage({isPageFocused}: {isPageFocused: boolean}) {
data={rows}
renderItem={renderItem}
keyExtractor={keyExtractor}
+ ListHeaderComponent={HomeAppviewOutageNotice}
ListEmptyComponent={renderEmpty}
ListFooterComponent={renderFooter}
onEndReached={onEndReached}
diff --git a/src/view/shell/index.tsx b/src/view/shell/index.tsx
index a6473f5f6..e240df080 100644
--- a/src/view/shell/index.tsx
+++ b/src/view/shell/index.tsx
@@ -11,6 +11,7 @@ import {useIntentHandler} from '#/lib/hooks/useIntentHandler'
import {useNotificationsHandler} from '#/lib/hooks/useNotificationHandler'
import {useNotificationsRegistration} from '#/lib/notifications/notifications'
import {isStateAtTabRoot} from '#/lib/routes/helpers'
+import {AppviewFallbackController} from '#/state/appview-fallback-controller'
import {useDialogFullyExpandedCountContext} from '#/state/dialogs'
import {useProfileEnrichment} from '#/state/queries/profile-enrichment'
import {useSession} from '#/state/session'
@@ -98,6 +99,7 @@ function ShellInner() {
+
diff --git a/src/view/shell/index.web.tsx b/src/view/shell/index.web.tsx
index d4db6034b..b2b4688cd 100644
--- a/src/view/shell/index.web.tsx
+++ b/src/view/shell/index.web.tsx
@@ -7,6 +7,7 @@ import {RemoveScrollBar} from 'react-remove-scroll-bar'
import {useIntentHandler} from '#/lib/hooks/useIntentHandler'
import {type NavigationProp} from '#/lib/routes/types'
+import {AppviewFallbackController} from '#/state/appview-fallback-controller'
import {useSession} from '#/state/session'
import {useIsDrawerOpen, useSetDrawerOpen} from '#/state/shell'
import {useCloseAllActiveElements} from '#/state/util'
@@ -50,6 +51,7 @@ function ShellInner() {
+