177bdcd2b7807c9980dab32e7a5664fc006df40b
10 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d13df6c7e6 |
Drafts (#9691)
* Add drafts functionality to composer - Add local storage layer for drafts (filesystem on native, IndexedDB on web) - Add "Drafts" button to composer top bar showing badge with draft count - Modify discard prompt to offer "Save Draft" option - Add `restore_from_draft` action to composer reducer - Support saving/restoring: text, facets, images, labels, threadgate, quote/link embeds - Add placeholder hooks for future server API integration - Add unit tests for draft serialization Note: Video/GIF restoration marked as TODO for future implementation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix drafts button: always visible, adjacent to post button - Make drafts button always visible (not just when drafts exist) - Move button to be adjacent to the publish button - If composer is empty: opens drafts list directly - If composer has content: shows prompt to save/discard before viewing drafts - Add badge showing draft count when drafts exist Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update drafts button: text-only, ghost/primary style - Show "Drafts" or "Drafts (N)" as text, no icon - Use ghost variant with primary color - Match Cancel button styling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Remove draft count from button, just show "Drafts" Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Increase drafts button horizontal padding and gap Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Use InnerFlatList and Dialog.Header for drafts dialog - Switch from ScrollableInner to InnerFlatList - Add Dialog.Header with back button in left slot - Use sticky header Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Track draft ID in composer state machine Adds draftId to ComposerState so that editing an existing draft and saving it again updates the draft rather than creating a new one. - Add draftId?: string to ComposerState type - Set draftId when restoring from draft via restore_from_draft action - Pass existingDraftId to save functions from composerState.draftId - Add PageX icon for empty drafts state Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add clear action to discard composer content When pressing the Drafts button with content in the composer, the user can choose to discard. This now properly clears the composer by dispatching a 'clear' action that resets to an empty state. - Add 'clear' action type to ComposerAction - Implement clear case in composerReducer (resets to single empty post) - Add handleClearComposer callback in Composer.tsx - Pass onDiscard prop through ComposerTopBar to DraftsButton - Call onDiscard before opening drafts dialog on discard Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Track dirty state to skip discard prompt for unchanged drafts When a draft is loaded and the user hasn't made any changes, closing the composer should not show the discard prompt since nothing would be lost. - Add isDirty field to ComposerState - Set isDirty: true on all content-modifying actions - Set isDirty: false on restore_from_draft, clear, and initial state - Update onPressCancel to only show prompt if no draft or isDirty Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Redesign drafts list to show full thread preview - Display all posts in a draft thread, not just the first - First post uses larger avatar (42px), subsequent posts nested with smaller avatar (32px) and thread connector line - Show author avatar, display name, handle, and relative timestamp - Add overflow menu button (placeholder) on first post - Display full text instead of truncated preview - Add media preview component for images, GIFs, and videos - Card layout with rounded corners and proper spacing - Add gap separators between draft cards in list Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix draft item styling based on feedback - Add border and shadow to draft cards - Remove trash button, move delete to overflow menu prompt - Remove size differences for thread posts (same avatar/text size) - Add spacing between header and first draft item - Change prompt wording to "Discard draft" Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Use real image embed components for draft preview Replace custom image preview with AutoSizedImage for single images and ImageLayoutGrid for multiple images. This gives drafts the same polished image display as regular posts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Improve drafts dialog platform handling - Render header outside FlatList on native, inside on web - Use web() helper for conditional web-only props - Replace ItemSeparatorComponent with mt_lg margin on items - Add minHeight on web for better dialog sizing - Simplify header structure Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Mark composer as clean after saving draft Add mark_saved action that resets isDirty to false and updates the draftId. This is dispatched after successfully saving a draft, allowing the user to close the composer without a discard prompt since their changes have been saved. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Apply dirty tracking to Drafts button prompt Only show the save/discard prompt when pressing the Drafts button if the composer has unsaved changes (isDirty). If the content is unchanged from a loaded draft or was just saved, go directly to the drafts list. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix re-saving drafts with existing media When re-saving a draft, the code was trying to copy media files that were already in drafts storage to new locations, causing copy errors. Changes: - Add extractLocalIdFromPath() to detect if a path is already in drafts - Track loadedMediaMap in ComposerState for identifying reusable media - Only delete old media that wasn't reused during re-save - Pass loadedMediaMap when saving to enable media reuse detection - Disable pointer events on draft media preview Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * add vertical option to prompt, change copy * fix import * fix import * Migrate drafts from local storage to server API Replace local-only draft storage with the new `app.bsky.draft.*` server API: - getDrafts, createDraft, updateDraft, deleteDraft endpoints Key changes: - Add api.ts with type converters (ComposerState <-> server Draft) - Update hooks.ts to use server API instead of local storage - Simplify storage.ts/storage.web.ts for local media caching only - Media stored locally via localRef pattern (filepath in server draft) - GIFs stored as external embeds with Tenor URL + dimensions - Hide drafts button when replying (reply drafts not supported) - Show "different device" note when media is missing locally Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * attempt to fix blob mangement * Migrate storage.ts from expo-file-system/legacy to expo-file-system Use the new object-based expo-file-system API (SDK 54+) with Directory and File classes instead of the legacy function-based API. The new API provides synchronous operations for file/directory existence checks, creation, copying, deletion, and listing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat: add drafts-specific logger Add a Drafts context to the logger system for better log categorization and debugging of draft-related operations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: use drafts-specific logger in hooks and storage Switch from the generic logger to the new drafts-specific logger for better log categorization. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: ensure media cache is populated before checking exists On iOS (and web), the media cache wasn't populated before the drafts query ran, causing drafts with local media to incorrectly show as "missing media" on app restart. The issue would resolve itself after closing and reopening the composer because by then the cache was ready. This fix adds ensureMediaCachePopulated() and awaits it in useDrafts before checking which media exists locally. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: complete Gif object reconstruction for draft rehydration Fix "Cannot read property 'url' of undefined" error when rehydrating drafts with GIFs. The Gif object was missing required properties like url, content_description, and media_formats.preview that are needed by useResolveGifQuery and other components. Also preserve alt text through serialization by storing it in URL query params alongside dimensions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: load draft preview images and get dimensions Fix draft preview images not showing on web and add proper aspect ratio support: 1. Try to load all images regardless of the exists cache flag, which may be stale due to async cache population timing 2. Use Image.loadAsync() from expo-image to get image dimensions 3. Pass dimensions to viewImages for proper aspect ratio in previews Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: update save prompt copy when editing existing draft When editing an existing draft (vs creating a new one), use "Save changes" instead of "Save draft" in the save/discard prompts. This provides clearer context to the user about what action they're taking. Add isEditingDraft prop to DraftsButton and ComposerTopBar, and update both prompts (in DraftsButton and Composer) with conditional copy based on whether we're editing an existing draft. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * style: add bottom padding to drafts list Add pb_xl padding to the drafts list content container for better visual spacing at the bottom of the list. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: use typed error check for draft limit Replace manual error object inspection with the proper AppBskyDraftCreateDraft.DraftLimitReachedError type check for cleaner and more reliable error handling. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * make storage functions async to match web * log unknown errors * delete left-over file * move state to colo with composer * fix: handle invalid GIF dimensions gracefully Fix NaN aspectRatio when rehydrating GIFs from drafts by: 1. Adding validation in parseTenorGif to reject invalid dimensions (NaN, zero, or negative values) 2. Adding defensive checks in GifEmbed to fallback to 1:1 aspect ratio if dimensions are invalid 3. Adding defensive checks in composer ExternalEmbedGif to fallback to 16:9 if gif.media_formats.gif.dims is missing or invalid Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: prevent double query string in GIF draft hydration When loading a GIF from a draft, the URL was being corrupted with double query strings like: `?ww=498&hh=498?hh=498&ww=498` This happened because: 1. serializeGif() adds ?ww=X&hh=Y&alt=Z to the Tenor URL 2. parseGifFromUrl() returned the full URL including our params 3. resolveGif() in resolve.ts then appends MORE params via string concatenation, creating a second ? Fix: Strip our custom params (ww, hh, alt) from the URL in parseGifFromUrl() before returning it, so the reconstructed GIF has a clean base URL. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix draft button behaviour when publishing, tweak buttons * ensure media unavaiable message is contrasty enough * infinite query, rename file to queries * simplify threadgate/postgate handling * refactor: pass full draft data instead of re-fetching The useLoadDraft and useDeleteDraftMutation hooks were fetching drafts via getDrafts() to look up a draft by ID. This was problematic because getDrafts is paginated, so drafts not on the first page wouldn't be found. Changes: - Add full Draft object to DraftSummary type - useLoadDraft now takes Draft directly (only loads local media) - useDeleteDraftMutation now takes {draftId, draft} to avoid re-fetch - Update DraftItem and DraftsListDialog to pass full draft data Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix type errors * docs: add notes on platform files and paginated APIs - Platform-specific files (.web.ts, .native.ts) are resolved by the bundler automatically - just import normally, don't use require() - Paginated APIs should use useInfiniteQuery, not useQuery Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * More CLAUDE.md updates * Delete PLAN.md * Use minimal media mode for draft display - REVERT IF NEEDED * Enable pagination * Add comment about headers * remove extraneous comments * Prevent runaway pagination * fix detection rebase change * use border_transparent * Replace idb with idb-keyval for draft media storage Simplifies web IndexedDB storage by using idb-keyval instead of the full idb library. This reduces bundle size and aligns with the pattern used in src/storage/archive/db/index.web.ts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix native draft media filename encoding The previous approach replaced both / and : with _, but the reverse transformation couldn't distinguish between them. This caused cache misses for paths containing both characters. Use encodeURIComponent/decodeURIComponent for a proper reversible encoding. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * convert useLoadDraft() hook to regular async function Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * update atproto api * clean up orphaned media * restore videos * save/restore captions * restore postgates * Copy updates from Darrin * Ope fix missed vertical props * get image aspect ratio when restoring * get videos working on native * get video restoration working on native * sanitize handles properly in draftitem * fix yarn.lock * Swap console logs --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Eric Bailey <git@esb.lol> |
||
|
|
25a1ed1209 |
[APP-1782] Analytics migration (#9734)
* WIP * Clean up growthbook code, integrate into init and sessions * Move everything out of React * Add metrics client * Move to separate file * Shared metadata cache * Ensure we update metadata when session ID changes * Ensure userMetadata is cleared when logging out * WIP revamp * Integrate feature gates into analytics context * Clean up old code * Fix useMeta util * Some comments and cleanup * Add logger to base analytics context * Refactor current route handling * Rip out LogEvent from navigation * Update tracking endpoint * Migrate toClout * Clear out statsig client * Add todo, reset logger readme * Ope fix statsig noop * Refactor logging in feed-feedback, add debug logging to metrics client * Remove LogEvents alias for Metrics * Prefer root package export * Remove Metrics alias from logger * [APP-1782] Migrate to new analytics APIs (#9735) * Migrate logEvent to useAnalytics * Migrate logger.metric to useAnalytics * Migrate tricky spot, fix types * Migrate remaining tricky spot * Missed one * Remove metric() from logger * Migrate useGate to useAnalytics * Remove all other StatSig mentions * Update event payload * Update logger tests * Mock expo method * Fix session ID bug * Add session ID test * Add test for metrics client * Clarify intent * Clean up core analytics file * Clean up the call once utils * Fix TODO * Fix TODO * Fix TODO * Fix TODO * Fix TODO * Remove debug code * Fix navigation context * OK nav context is not working, todo * Checkpoint: works but feels hacky * Fix navigation context issue * Improve feature API * Improve metric logging * Update logger tests |
||
|
|
f8ae0540a0 | Provide geo-gated users optional GPS fallback for precise location data (#8973) | ||
|
|
328aa2be94 |
[APP-1356] Policy update dialog (#8782)
* Add blocking announcement dialog feature * WIP custom dialog * Rework dialog and add native FocusScope * Lock scroll on web, fix backdrop * Add web FocusScope * Create custom Outlet for these announcements * Clean up FocusScope native impl * Comments * Some styling fixes * Handle screen reader specifically * Clean up state, remove Portal edits * Reorg, rename * Add syncing, tests * Revert dialog updates * Revert formatting * Delete unused file * Format * Add FullWindowOverlay * remove mmkv storage in debug btn * Add debug code * fix taps passing through on iOS * Reorg * Reorg, rename everything * Complete policy update after signup * Add logger * Move context around, unmount portals on native * Move a11y prop into FocusScope * Remove useMemo * Update dates * Move debug to dev settings * Unmount web portals until policy update completed * UPdate dates --------- Co-authored-by: Samuel Newman <mozzius@protonmail.com> |
||
|
|
1dbc331314 |
UI for age assurance compliance (#8652)
* Add geo prop * Add prelim fetch * Add geo debug * Pass in assurance state to notifications registration * Comments * Bump git index * Add some component utils, no design, gate chat * Disable mod prefs buttons, does not yet edit mod prefs * Add initial prompt component * Refine logic for showing prompt * Add send email dialog * Hook up dialog to fake mutation * Fix geo debug bug * Move provider inside query provider * Slightly better screen gater * Ok decent fallback with isExempt * Reorg * Wrap prompt in new logic * Override mod prefs * Use real endpoints, optimistic state * Add persistent card, add time-ago, warning to dialog * Add comment * No undefined query values * Fix case in import * Wait for AA to load before registering push * Override prefs in all locations * Small refactor of notifications registration * Register push after aa state * Add retries * Update blocked screens UI * Strengthen email validation * Add intent dialog * Do service auth for init * Rug refreshJwt * Update copy * Some mobile styles, add dev mode option * Fix links on native * Clean up intent dialog on native * Don't mutate existing session, only copy * Handle email validation error from server * Clarity is better * Moar clear * Fixes * Tweaks * Add country code * Gate it * Refresh state after redirect * Re-check on window focus * Remove todo * Enable in dev * Check for did match on redirect * Add blocked state * Add appeal dialog * Copy tweaks * Inset in blue well * Nux the prompt * Copy updates * Refetch just in case * Uppercase country code * Align copy, add notice to chat screens * Tweak copy * Add test code * Add debug code * Refactor AccountCard * Big refactor * Delay post-feed queries instead * Debug code * Clean up state * Reorg * Clean up copy * Comments * Reorg * UPdate URL * Cleanup * Remove todo * Update debug code * revert unneeded changes * UPdate nux name * Revert unneeded change * Updaet storage schema * Checkpoint: cleanup * Checkpoint: almost there * isLoaded -> isReady * Rename useAgeAssurance * isUnderage -> isDeclaredUnderage * Decompose, add docblocks * Refactor * UPdate debug * Apply suggestion from @surfdude29 Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * Apply suggestion from @surfdude29 Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * Apply suggestion from @surfdude29 Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * Apply suggestion from @surfdude29 Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * Apply suggestion from @surfdude29 Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * Apply suggestion from @surfdude29 Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * Drop including Bluesky * Apply suggestion from @surfdude29 Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * Apply suggestion from @surfdude29 Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * Remove todo * Gate debug * Revert unneeded change * Fail closed * Comments * Comment * Comment * fix prettier * rm viewheader * bump sdk * prevent overlap in admonition * add age assurance intent route * Just meow Co-authored-by: Samuel Newman <mozzius@protonmail.com> * Nix callback * Fix spelling of dismissible lol * Don't compare translated string * Better KWS link labels * Hide DMs send options in menu * Add button * Fix order * Use only supported languages * Rm button * best-effort language mapping * improve typing --------- Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> Co-authored-by: Samuel Newman <mozzius@protonmail.com> |
||
|
|
143d5f3b81 |
Post source handling updates (#8472)
* Add debugs * Key post-source using URI with handle * Enhance * EnHANCE * ENHANCE * ENHANCEEEECEE * ᵉⁿʰᵃⁿᶜᵉ * enhance |
||
|
|
07dd57d1ea |
Add metrics to reporting flow (#7871)
* Add metrics to reporting flow * Remove vestigial state |
||
|
|
96f4f6359a |
Logger metrics (#7867)
* Adjust datalake abstraction (cherry picked from commit 8ba6a8d45b1bd5698afbd06d9e858a91789f0ea6) * Just be really really specific (cherry picked from commit 920198959659329a7f7f7282a1293aaad198d8e3) * Add metric method to logger, replace datalake calls with new method (cherry picked from commit 7a026bbeae75514b64f928d7ff59707c518fd5e5) * Clarify types (cherry picked from commit 422b150deb158a70ef37e8a456d91bf26cd0b1bc) |
||
|
|
7c36ea1158 |
Logger improvements (#7729)
* Remove enablement * Refactor context and filtering * Fix imports, simplify transports config * Migrate usages of debug context * Re-org, add colors and grouping to console logging * Remove temp default context * Remove manual prefix * Move colorizing out of console transport body * Reduce reuse * Pass through context * Ensure bitdrift is enabled in dev * Enable Sentry on web only * Clean up types * Docs * Format * Update tests * Clean up tests * No positional args * Revert Sentry changes * Clean up context, use it, pass metadata through to Bitdrift * Fix up debugging * Clean up metadata before passing to Bitdrift * Correct transports * Reserve context prop on metadata and include in transports * Update tests |
||
|
|
704e36c280 |
Fix web build (#7069)
* Fix web build * Fix circular deps * Hoist log functions |