From 624267e2b5c6c5fd90645161b127d8001e499c82 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 15 Nov 2026 22:55:09 +0000 Subject: [PATCH 01/46] Put the Remotes composer in one box on a blurred bar The field now sits across the top of a rounded box with the + and a round Push button under it, like the Claude app's composer. That settles the old height mismatch between the field and the Push button, and Push takes less room. On iOS the bar is Liquid Glass tinted with the surface, so messages scrolling behind it blur instead of showing through. Android keeps its solid surface bar. The box is a shared partial (composer-box, with send-button) so the commit reply bar can move to it later. body-counter gains a text form of the fold hint for that box, and the Remotes length counter moves into its own partial. Empty slots above the box now take 0.1pt: on iOS an empty one took 10pt of the bar, which showed as a gap once the bar had a backdrop. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Display.php | 21 +++++++ app/NativeComponents/Conversation.php | 10 ++-- resources/views/native/conversation.blade.php | 51 ++++++++-------- .../native/partials/body-counter.blade.php | 14 ++++- .../native/partials/composer-box.blade.php | 29 +++++++++ .../native/partials/message-field.blade.php | 8 +-- .../native/partials/message-length.blade.php | 8 +++ .../native/partials/send-button.blade.php | 23 +++++++ .../native/partials/voice-recorder.blade.php | 6 +- tests/Feature/Screens/RemotesComposerTest.php | 60 +++++++++++++------ .../Feature/Screens/RemotesVoiceNotesTest.php | 15 ++--- tests/Pest.php | 9 +++ tests/Unit/Devnull/DisplayTest.php | 10 ++++ 13 files changed, 200 insertions(+), 64 deletions(-) create mode 100644 resources/views/native/partials/composer-box.blade.php create mode 100644 resources/views/native/partials/message-length.blade.php create mode 100644 resources/views/native/partials/send-button.blade.php diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index 09d43f94..d8da90be 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -28,6 +28,18 @@ final class Display */ public const int ReplyBarStashLabelHeight = 28; + /** + * A bar holding partials/composer-box with one line of draft, as drawn on an iPhone: the bar's hairline and + * padding, then the box with its field over the row of tools and the send button. + */ + public const int ComposerBoxBarHeight = 97; + + /** + * About how many characters fit on a line of the box's field. It runs the width of the box, so more fit than + * beside the reply bar's tools and button. + */ + public const int ComposerBoxCharactersPerLine = 46; + /** * The strip under the home indicator on Face ID iPhones. EDGE doesn't * hand pushed screens the real inset (it's 0 inside a tab), so this errs @@ -230,6 +242,15 @@ public static function replyBarClearance(string $draft, bool $draftRow = false): + self::HomeIndicatorHeight; } + /** + * How much taller a composer-box bar is than with one line, as the draft grows to its five lines. A screen pads + * its end by this on top of ComposerBoxBarHeight to keep its last row clear of the bar. + */ + public static function composerBoxGrowth(string $draft): int + { + return (min(self::ReplyBarMaxLines, self::lineCount($draft, self::ComposerBoxCharactersPerLine)) - 1) * self::ReplyBarLineHeight; + } + /** * About how many lines some text wraps to where $perLine characters fit on one, counting each of its own lines. */ diff --git a/app/NativeComponents/Conversation.php b/app/NativeComponents/Conversation.php index ef23ac67..1ed3abdb 100644 --- a/app/NativeComponents/Conversation.php +++ b/app/NativeComponents/Conversation.php @@ -243,10 +243,10 @@ class Conversation extends NativeComponent public bool $composing = false; /** - * The composer bar's height with one line in its field, the same as the reply bar on a commit's page: its top - * line, then the field, its tools and Push with 8 points above and below. + * The composer bar's height with one line in its field: its top line, then the box holding the field over the + + * and Push (see partials/composer-box), with 8 points above and below. */ - public const int ComposerBarHeight = Display::ReplyBarHeight; + public const int ComposerBarHeight = Display::ComposerBoxBarHeight; /** * The "Replying to …" bar above the field. @@ -1836,9 +1836,7 @@ private function longPins(): array */ private static function composerClearance(string $draft, bool $replying, bool $hasPhotos, bool $describing): int { - $grownBy = Display::replyBarClearance($draft) - Display::ReplyBarHeight - Display::HomeIndicatorHeight; - - return self::ComposerBarHeight + $grownBy + return self::ComposerBarHeight + Display::composerBoxGrowth($draft) + ($replying ? self::ReplyingBarHeight : 0) + ($hasPhotos ? self::PhotosHeight : 0) + ($hasPhotos && $describing ? self::DescriptionHeight : 0) diff --git a/resources/views/native/conversation.blade.php b/resources/views/native/conversation.blade.php index c01b14b7..18da1ed8 100644 --- a/resources/views/native/conversation.blade.php +++ b/resources/views/native/conversation.blade.php @@ -73,25 +73,28 @@ @if ($loaded) {{-- - The composer, drawn as the reply bar on a commit's page is (see partials/composer-plate): on iOS the bar is - bare and the field is a Liquid Glass plate with the tools inside it, on Android the bar is the surface with - a hairline and the tools lead it. The web's tools, photos, the microphone and Ping, open from one + here. Above the field - sit what you're replying to and the photos on the draft, on glass of their own on iOS. While the thread - can't take a message, the bar is solid on both, with why in the field's place. + The composer: one rounded box with the field over a row holding the + and the round send button (see + partials/composer-box), on a bar that is Liquid Glass on iOS, tinted with the surface so the thread + scrolling under it is blurred out of the way, and the solid surface with a hairline on Android. The web's + tools, photos, the microphone and Ping, open from the one +. Above the box sit the people to mention, what + you're replying to and the photos on the draft. While the thread can't take a message, the bar is solid + on both, with why in the box's place. --}} - + @if ($canPush) {{-- The members to mention, what you're replying to and the photos on the draft each keep a slot, empty and no height when there's nothing in it, so the field's row never moves. Android rebuilds - a row that moves among its siblings, field and all, which drops the keyboard. + a row that moves among its siblings, field and all, which drops the keyboard. An empty slot is + h-[0.1]: on iOS an empty one otherwise takes 10 points of the bar, and EDGE drops a height of 0. --}} - + @php($mentioning = ($mention['field'] ?? null) === 'draft' && ($mentionPeople !== [] || $mentionOrganizations !== [])) + @include('native.partials.mention-suggestions', ['field' => 'draft', 'heading' => ($mention['query'] ?? null) === '' ? 'Members' : null]) - + @if ($replyTo) @@ -105,30 +108,28 @@ @endif - + @include('native.partials.composer-photos', ['photos' => $photos, 'photoRef' => 'photo', 'describeClass' => 'ios:glass']) - {{-- The same room above and below the field, so the bar sits evenly on the keyboard. --}} - - {{-- - The web's tools, photos, a voice note and Ping, are one + here, which opens them in a menu (see - ComposerMenu), so the field keeps its room. A voice note takes the field's place, and the +'s, - while it's recorded and waits to be pushed. - --}} - @include('native.partials.composer-plate', [ + {{-- + The box keeps its row, and the row its place among the bar's, so the field inside never moves. + A voice note takes the field's place, and the +'s, while it's recorded and waits to be pushed. + --}} + + @include('native.partials.composer-box', [ 'ref' => 'message', 'field' => $recorder === null ? 'native.partials.message-field' : 'native.partials.voice-recorder', 'tools' => $recorder !== null ? [] : [ ['ref' => 'composer-tools', 'icon' => \App\Icons\Lucide::Plus, 'label' => 'Photos, a voice note or a ping', 'menu' => \App\Devnull\ComposerMenu::items(count($photos) >= \App\Devnull\DraftImages::MaxImages, trim($draft) !== '' || $photos !== [], $pingLabel)], ], + 'counter' => ['native.partials.message-length'], + 'send' => [ + 'ref' => 'push', + 'label' => 'Push', + 'press' => 'send', + 'disabled' => $recorder === null ? trim($draft) === '' && $photos === [] : $recorder === 'stopping' || ($recorder === 'recording' && ! $recordingStarted), + ], ]) - @php($length = mb_strlen($draft)) - @if ($length >= 1600) - {{ number_format($length) }}/2,000 - @endif - - Push - @else diff --git a/resources/views/native/partials/body-counter.blade.php b/resources/views/native/partials/body-counter.blade.php index 0c50a5c2..6bdd9736 100644 --- a/resources/views/native/partials/body-counter.blade.php +++ b/resources/views/native/partials/body-counter.blade.php @@ -1,11 +1,21 @@ {{-- The web's BodyCounter, next to Commit or Reply: nothing until 200 characters are left, then the count in mono, amber - from 20 and Rm Red at none. Before that, a body long enough to be folded in lists shows the fold icon instead. + from 20 and Rm Red at none. Before that, a body long enough to be folded in lists says so. + + The composer sheet and the reply bar show the fold icon. In partials/composer-box ($foldHint), where the row has + room for words, it says "folded in feeds" in small muted text instead: people read the icon alone as a button they + couldn't work out, and text that isn't a button can't be mistaken for one. --}} +@php($foldHint ??= false) @php($remaining = \App\Devnull\Data\Commit::MaxLength - (($literal ?? false) ? mb_strlen(\App\Devnull\Data\CommitBody::normalize($body)) : \App\Devnull\Data\CommitBody::characterCount($body))) @php($isCounting = $remaining <= \App\Devnull\Data\Commit::CountFrom) +@php($foldExplained = 'Feeds show the first '.\App\Devnull\Data\Commit::PreviewLength.' characters or '.\App\Devnull\Data\Commit::PreviewLines.' lines, then Show more.') @if ($isCounting) {{ $remaining }} @elseif (\App\Devnull\Data\Commit::isFoldedInLists($body)) - + @if ($foldHint) + folded in feeds + @else + + @endif @endif diff --git a/resources/views/native/partials/composer-box.blade.php b/resources/views/native/partials/composer-box.blade.php new file mode 100644 index 00000000..5ffec607 --- /dev/null +++ b/resources/views/native/partials/composer-box.blade.php @@ -0,0 +1,29 @@ +{{-- + A composer bar's field, tools and send button in one rounded box, the way the Claude and Messages apps draw theirs: + the field across the top, growing to its five lines, and under it a row with the tools on the left and a round + send button in your colour on the right, with anything that counts the draft beside it. The same on both + platforms. The bar around it is the backdrop: Liquid Glass tinted with the surface on iOS, so the thread + scrolling under it blurs instead of showing through, and the solid surface with a hairline on Android. + + $ref names the box ("{$ref}-box", also its key, so the field keeps its place as rows above it come and go) and its + rows ("{$ref}-field-row", "{$ref}-actions"). $field is the partial that draws the field, keyed itself, so it stays + the same view while the tools and the counter under it change. $tools are composer-tool's, in the web's order. + $counter, when there is one, is a partial and its data ([view, data]) for the count left of the send button. + $send is send-button's: its ref, label, method, and whether it can send yet. +--}} +@php($counter ??= null) + + + @include($field) + + + @foreach ($tools as $tool) + @include('native.partials.composer-tool', $tool) + @endforeach + + @if ($counter !== null) + @include($counter[0], $counter[1] ?? []) + @endif + @include('native.partials.send-button', $send) + + diff --git a/resources/views/native/partials/message-field.blade.php b/resources/views/native/partials/message-field.blade.php index 339424b9..f990d826 100644 --- a/resources/views/native/partials/message-field.blade.php +++ b/resources/views/native/partials/message-field.blade.php @@ -1,12 +1,12 @@ {{-- - A Remotes thread's message field (see partials/composer-plate). It keeps the keyboard up through presses elsewhere - in the thread (keep-focus), as the web keeps its field focused through Reply and Push, and its column is keyed, so - the reply strip or photos coming and going above it never rebuild it. It mounts afresh only to take focus + A Remotes thread's message field, across the top of partials/composer-box. It keeps the keyboard up through presses + elsewhere in the thread (keep-focus), as the web keeps its field focused through Reply and Push, and its column is + keyed, so the reply strip or photos coming and going above it never rebuild it. It mounts afresh only to take focus ($composerKey): replying while the field is idle, or attaching photos. EDGE sends no focus event, so a press into the field tells the thread it's in use. Where the caret is goes to the thread as it moves, for the "@" suggestions in an org (see SuggestsMentions), and a picked mention comes back with where the caret goes, after it. --}} - + = 1600) + {{ number_format($length) }}/{{ number_format(\App\Devnull\Data\Message::MaxLength) }} +@endif diff --git a/resources/views/native/partials/send-button.blade.php b/resources/views/native/partials/send-button.blade.php new file mode 100644 index 00000000..00123656 --- /dev/null +++ b/resources/views/native/partials/send-button.blade.php @@ -0,0 +1,23 @@ +{{-- + A composer's send button: a 32pt circle in your colour with an up arrow, as the Claude and Messages apps send. + It names what it does for screen readers ($label: Push, Reply). While there's nothing to send ($disabled) it's a + muted circle, and not a button, as a disabled button would be. Its 36pt tap target fits the composer-tool row. +--}} +@php($disabled ??= false) +@php($circle = 'rounded-full '.($disabled ? 'bg-theme-surface-variant' : 'bg-theme-'.$myColour)) +@php($arrow = $disabled ? 'text-theme-ink-muted' : 'text-theme-on-'.$myColour) +@if ($disabled) + + + + + +@else + + + + + + + +@endif diff --git a/resources/views/native/partials/voice-recorder.blade.php b/resources/views/native/partials/voice-recorder.blade.php index 3c19a267..989ecc54 100644 --- a/resources/views/native/partials/voice-recorder.blade.php +++ b/resources/views/native/partials/voice-recorder.blade.php @@ -1,5 +1,5 @@ {{-- - The voice note in the composer, in the field's place (see partials/composer-plate), as the web's recorder draws + The voice note in the composer, in the field's place (see partials/composer-box), as the web's recorder draws it: the trash, then "opening microphone…" until it records, then a pulsing dot, the microphone's level coming in on the right, and the clock counting to the minute, amber in the last ten seconds, with Stop; then the recording itself, to listen to before Push sends it. The same height as the field with one line, so the bar doesn't move. @@ -7,9 +7,9 @@ While it records, the thread renders five times a second for the meter (RecordsVoiceNotes::MeterInterval). --}} @if ($recorder === 'recording') - + @else - + @endif diff --git a/tests/Feature/Screens/RemotesComposerTest.php b/tests/Feature/Screens/RemotesComposerTest.php index b06a389a..67c20610 100644 --- a/tests/Feature/Screens/RemotesComposerTest.php +++ b/tests/Feature/Screens/RemotesComposerTest.php @@ -129,11 +129,11 @@ function threadWithAda(string $platform = 'ios'): TestableComponent $screen = threadWithAda(); - expect(nodeByRef($screen, 'push')['props']['disabled'] ?? false)->toBeTrue(); + expect(canSend($screen, 'push'))->toBeFalse(); photosPicked($screen, [testPhoto(), testPhoto()])->tap('photo-0-alt')->input('photo-description-input', 'A terminal.'); - expect(nodeByRef($screen, 'push')['props']['disabled'] ?? false)->toBeFalse(); + expect(canSend($screen, 'push'))->toBeTrue(); finishRefreshes($screen->tap('push'))->assertSet('pending', []); @@ -252,31 +252,57 @@ function threadWithAda(string $platform = 'ios'): TestableComponent ->and(childRefs($screen, 'composer-bar'))->toBe($rows); }); -it('puts a + for photos, a voice note and Ping inside the Liquid Glass field on iOS', function () { +it('draws one box with the field over the + and a round Push, on both platforms', function (string $platform) { serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); - $screen = threadWithAda('ios'); - $bar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); + $screen = threadWithAda($platform); + $actions = childRefs($screen, 'message-actions'); - expect(childRefs($screen, 'message-plate'))->toBe(['message-field', 'composer-tools']) + expect(childRefs($screen, 'message-row'))->toBe(['message-box']) + ->and(childRefs($screen, 'message-box'))->toBe(['message-field-row', 'message-actions']) + ->and(childRefs($screen, 'message-field-row'))->toBe(['message-field']) + ->and($actions[0])->toBe('composer-tools') + ->and(end($actions))->toBe('push') ->and(array_slice(childRefs($screen, 'composer-tools'), 0, 3))->toBe(['attach-photos', 'record-voice-note', 'ping']) - ->and(nodeByRef($screen, 'message-plate')['props']['glass'] ?? null)->toBe(1) - ->and($bar['children'][0]['ref'] ?? null)->toBe('composer-bar') - ->and($bar['children'][0]['style']['bg_color'] ?? null)->toBeNull() - ->and(nodeByRef($screen, 'ping')['props']['label'])->toBe('Ping @ada'); -}); + ->and(nodeByRef($screen, 'ping')['props']['label'])->toBe('Ping @ada') + ->and(nodeByRef($screen, 'push')['props']['a11y_label'] ?? nodeByRef($screen, 'push')['a11y_label'] ?? null)->toBe('Push'); +})->with(['ios', 'android']); -it('leads the bar with the + on Android, on a solid bar', function () { +it('puts the bar on Liquid Glass tinted with the surface on iOS, and on the solid surface on Android', function () { serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); - $screen = threadWithAda('android'); + $ios = nodeByRef(threadWithAda('ios'), 'composer-bar'); + $android = nodeByRef(threadWithAda('android'), 'composer-bar'); - expect(array_slice(childRefs($screen, 'message-row'), 0, 2))->toBe(['composer-tools', 'message-plate']) - ->and(childRefs($screen, 'message-plate'))->toBe(['message-field']) - ->and(nodeByRef($screen, 'message-plate')['props']['glass'] ?? null)->toBeNull() - ->and(nodeByRef($screen, 'composer-bar')['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')); + expect($ios['props']['glass'] ?? null)->toBe(1) + ->and($ios['style']['bg_color'] ?? null)->not->toBeNull() + ->and($android['props']['glass'] ?? null)->toBeNull() + ->and($android['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')); }); +it('counts a long message beside Push from 1,600 characters, amber from 1,900 and red at 2,000', function (int $length, ?string $colour) { + serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); + + $screen = threadWithAda()->input('message-input', str_repeat('a', $length)); + + if ($colour === null) { + expect(rendersRef($screen, 'message-length'))->toBeFalse(); + + return; + } + + $actions = childRefs($screen, 'message-actions'); + + expect(nodeByRef($screen, 'message-length')['props']['text'])->toBe(number_format($length).'/2,000') + ->and(strtolower(nodeByRef($screen, 'message-length')['props']['color'] ?? ''))->toBe(strtolower(config("native-ui.theme.light.{$colour}"))) + ->and(array_slice($actions, -2))->toBe(['message-length', 'push']); +})->with([ + 'short' => [1599, null], + 'long' => [1600, 'ink-muted'], + 'nearly full' => [1900, 'pending'], + 'full' => [2000, 'destructive'], +]); + it('pings Ada, logging it in the thread as the web does and buzzing the phone', function () { serveThreadWithAda([remoteMessageJson(['id' => 1, 'body' => 'you there?'])], ['read_through_id' => 1]); diff --git a/tests/Feature/Screens/RemotesVoiceNotesTest.php b/tests/Feature/Screens/RemotesVoiceNotesTest.php index 7dee858e..01a2038a 100644 --- a/tests/Feature/Screens/RemotesVoiceNotesTest.php +++ b/tests/Feature/Screens/RemotesVoiceNotesTest.php @@ -184,10 +184,11 @@ function playedBars(TestableComponent $screen, string $ref): int && $params['maxDuration'] == 60 && $params['id'] === $screen->instance()->recordingId); - expect(childRefs($screen, 'message-plate'))->toBe(['voice-recorder']) + expect(childRefs($screen, 'message-field-row'))->toBe(['voice-recorder']) + ->and(childRefs($screen, 'message-actions'))->not->toContain('composer-tools') ->and(nodeByRef($screen, 'voice-elapsed')['props']['text'] ?? null)->toBe('0:00/1:00') ->and(rendersEvery($screen))->toBe([200]) - ->and(nodeByRef($screen, 'push')['props']['disabled'] ?? false)->toBeFalse(); + ->and(canSend($screen, 'push'))->toBeTrue(); // The level is the loudest sample since the last look, square-rooted as the web draws it, and the clock turns amber // in the last ten seconds. @@ -207,7 +208,7 @@ function playedBars(TestableComponent $screen, string $ref): int $screen = voiceThread()->tap('record-voice-note')->assertSee('opening microphone…'); - expect(nodeByRef($screen, 'push')['props']['disabled'] ?? false)->toBeTrue(); + expect(canSend($screen, 'push'))->toBeFalse(); // The clock counts from when the microphone starts, not from the tap. $this->travel(5)->seconds(); @@ -217,7 +218,7 @@ function playedBars(TestableComponent $screen, string $ref): int $screen->call('poll'); expect(nodeByRef($screen, 'voice-elapsed')['props']['text'])->toBe('0:02/1:00') - ->and(nodeByRef($screen, 'push')['props']['disabled'] ?? false)->toBeFalse(); + ->and(canSend($screen, 'push'))->toBeTrue(); }); it('stops to listen to the recording first, then pushes it staged at once and pushed once devnull has it', function () { @@ -228,7 +229,7 @@ function playedBars(TestableComponent $screen, string $ref): int $screen = voiceThread()->tap('record-voice-note')->tap('stop-voice-note'); $screen->assertNativeCalled('Microphone.Stop')->assertSee('encoding…'); - expect(nodeByRef($screen, 'push')['props']['disabled'] ?? false)->toBeTrue(); + expect(canSend($screen, 'push'))->toBeFalse(); voiceRecorded($screen, $recording); $kept = $screen->instance()->recorded->url; @@ -245,7 +246,7 @@ function playedBars(TestableComponent $screen, string $ref): int $screen->tap('push')->assertSee('staged')->assertSet('recorder', null)->assertNativeCalled('MediaPlayer.Stop'); $clientId = $screen->instance()->pending[0]->clientId; - expect(childRefs($screen, 'message-plate'))->toBe(['message-field', 'composer-tools']) + expect(childRefs($screen, 'message-field-row'))->toBe(['message-field']) ->and(nodeByRef($screen, 'voice-'.$clientId.'-clock')['props']['text'])->toBe('0:02'); finishRefreshes($screen)->assertSee('pushed')->assertSet('pending', []); @@ -321,7 +322,7 @@ function playedBars(TestableComponent $screen, string $ref): int } expect(file_exists($recording))->toBeFalse() - ->and(childRefs($screen, 'message-plate'))->toBe(['message-field', 'composer-tools']) + ->and(childRefs($screen, 'message-field-row'))->toBe(['message-field']) ->and(voiceUploads())->toBe([]); })->with(['while recording' => [true], 'once recorded' => [false]]); diff --git a/tests/Pest.php b/tests/Pest.php index 41e32e2e..d1bf556c 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -771,6 +771,15 @@ function sheetButtonEnabled(TestableComponent $screen, string $ref): bool return nodeByRef($screen, $ref)['type'] === 'pressable'; } +/** + * Whether a composer's round send button (partials/send-button) can be tapped. A disabled one is drawn as a plain + * circle, not a pressable. + */ +function canSend(TestableComponent $screen, string $ref): bool +{ + return nodeByRef($screen, $ref)['type'] === 'pressable'; +} + /** * The circle of a round button in a sheet's bar, whether it can be tapped or not. * diff --git a/tests/Unit/Devnull/DisplayTest.php b/tests/Unit/Devnull/DisplayTest.php index fe38524f..e7c8ed64 100644 --- a/tests/Unit/Devnull/DisplayTest.php +++ b/tests/Unit/Devnull/DisplayTest.php @@ -8,6 +8,16 @@ expect(Display::replyBarClearance($url))->toBe(Display::replyBarClearance(str_repeat('a', mb_strlen($url))) + 3 * Display::ReplyBarLineHeight); }); +it('grows a composer box by a line height for each line the draft wraps to, up to five lines', function (string $draft, int $lines) { + expect(Display::composerBoxGrowth($draft))->toBe(($lines - 1) * Display::ReplyBarLineHeight); +})->with([ + 'empty' => ['', 1], + 'one line' => [str_repeat('a', Display::ComposerBoxCharactersPerLine), 1], + 'wraps once' => [str_repeat('a', Display::ComposerBoxCharactersPerLine + 1), 2], + 'its own lines' => ["one\ntwo\nthree", 3], + 'past five' => [str_repeat("line\n", 9), 5], +]); + it('prints compact counts from a thousand as the web does', function (int $count, string $expected) { expect(Display::compactCount($count))->toBe($expected); })->with([ From f6c54e27e789c786b15d633fe993d03450d02d65 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Mon, 16 Nov 2026 02:00:07 +0000 Subject: [PATCH 02/46] Move the commit reply bar onto the Remotes composer box The reply bar is now the same rounded box as the Remotes composer: the field across the top, and under it the expand button on the left and a round send button in your colour on the right. The bar is Liquid Glass on iOS and the solid surface on Android. The text Reply button is gone. The expand button no longer opens the composer sheet. Presenting a sheet takes the keyboard down and puts it back up on both platforms, however early its field asks for focus, so the box grows in place instead (8 lines, up to 12) and the keyboard stays where it is. Grown, the box gets a photos and preview button that opens the sheet as before. Photos attached there show as a count in the box. A restored draft's stash@{0} and drop sit under the box, since the grown row has no room for them. A reply long enough to be folded in feeds now says "folded in feeds" in small muted text, here and in the sheet. The FoldVertical icon read as a button that did nothing, so it's gone. Related commits start closed under a header with their count. Tapping it fades them in one after another and turns the chevron; tapping again fades them out, then takes them out. It uses the Beat task from the Log threads work (PR 179), copied as is so the two branches merge cleanly. The old composer-plate partial had no users left, so it's deleted. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Beat.php | 34 +++++ app/Devnull/Display.php | 40 +++--- app/Icons/Lucide.php | 4 +- app/NativeComponents/CommitDetail.php | 91 ++++++++++++- resources/icons/fold-vertical.svg | 1 - resources/icons/minimize-2.svg | 1 + .../views/native/commit-detail.blade.php | 85 ++++++------ .../native/partials/body-counter.blade.php | 15 +-- .../native/partials/composer-plate.blade.php | 24 ---- .../native/partials/composer-tool.blade.php | 11 +- .../native/partials/related-commits.blade.php | 50 ++++--- .../native/partials/reply-field.blade.php | 12 +- tests/Feature/Screens/CommitDetailTest.php | 124 +++++++++++++----- tests/Feature/Screens/ComposerPhotosTest.php | 12 +- tests/Feature/Screens/DraftStashTest.php | 5 +- tests/Feature/Screens/LaneButtonsTest.php | 29 ++-- tests/Feature/Screens/RelatedCommitsTest.php | 119 +++++++++++++++-- 17 files changed, 482 insertions(+), 175 deletions(-) create mode 100644 app/Devnull/Beat.php delete mode 100644 resources/icons/fold-vertical.svg create mode 100644 resources/icons/minimize-2.svg delete mode 100644 resources/views/native/partials/composer-plate.blade.php diff --git a/app/Devnull/Beat.php b/app/Devnull/Beat.php new file mode 100644 index 00000000..c6598cfe --- /dev/null +++ b/app/Devnull/Beat.php @@ -0,0 +1,34 @@ +runningUnitTests()) { + usleep(max(0, $milliseconds) * 1000); + } + + return true; + } +} diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index d8da90be..fbe4a1bd 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -12,19 +12,22 @@ final class Display { /** - * The commit page's reply bar with one line of draft: its hairline, the - * field and the padding around them, as drawn on an iPhone. + * How much a line of draft adds to a composer bar's field. */ - public const int ReplyBarHeight = 53; - public const int ReplyBarLineHeight = 21; public const int ReplyBarMaxLines = 5; - public const int ReplyBarCharactersPerLine = 34; + /** + * The reply box on a commit's page grown by its expand button: it starts this many lines tall, and grows to + * ExpandedReplyMaxLines. + */ + public const int ExpandedReplyMinLines = 8; + + public const int ExpandedReplyMaxLines = 12; /** - * The row under the reply bar's field that marks a restored draft (see partials/stash-label) and counts its photos. + * The row under the reply box that marks a restored draft (see partials/stash-label). */ public const int ReplyBarStashLabelHeight = 28; @@ -35,8 +38,7 @@ final class Display public const int ComposerBoxBarHeight = 97; /** - * About how many characters fit on a line of the box's field. It runs the width of the box, so more fit than - * beside the reply bar's tools and button. + * About how many characters fit on a line of the box's field, which runs the width of the box. */ public const int ComposerBoxCharactersPerLine = 46; @@ -228,16 +230,22 @@ public static function maskedKey(string $openSsh): string * How far a commit page has to scroll past its last reply to clear the * reply bar. A pushed screen is drawn under its bottom bar and the home * indicator, with no inset for either, so the page pads its own end: the - * bar as the draft grows to its five lines, and the indicator below it. - * With the keyboard up the bar sits on the keyboard instead, which only - * leaves a little more room. A restored draft, or one with photos, adds - * the row under the field ($draftRow). + * bar (partials/composer-box) as the draft grows to its five lines, and + * the indicator below it. With the keyboard up the bar sits on the + * keyboard instead, which only leaves a little more room. Grown by its + * expand button ($expanded), the box is ExpandedReplyMinLines tall to + * start with. A restored draft adds the row under the box that marks it + * ($restored), and a link too long for devnull the line that says so. */ - public static function replyBarClearance(string $draft, bool $draftRow = false): int + public static function replyBarClearance(string $draft, bool $expanded = false, bool $restored = false): int { - return self::ReplyBarHeight - + (min(self::ReplyBarMaxLines, self::lineCount($draft, self::ReplyBarCharactersPerLine)) - 1) * self::ReplyBarLineHeight - + ($draftRow ? self::ReplyBarStashLabelHeight : 0) + $lines = $expanded + ? max(self::ExpandedReplyMinLines, min(self::ExpandedReplyMaxLines, self::lineCount($draft, self::ComposerBoxCharactersPerLine))) + : null; + + return self::ComposerBoxBarHeight + + ($lines === null ? self::composerBoxGrowth($draft) : ($lines - 1) * self::ReplyBarLineHeight) + + ($restored ? self::ReplyBarStashLabelHeight : 0) + (CommitBody::hasOversizedUrl($draft) ? 3 * self::ReplyBarLineHeight : 0) + self::HomeIndicatorHeight; } diff --git a/app/Icons/Lucide.php b/app/Icons/Lucide.php index b6ea5bb9..b6e5c0e1 100644 --- a/app/Icons/Lucide.php +++ b/app/Icons/Lucide.php @@ -49,7 +49,6 @@ enum Lucide case UserPlus; case UserCheck; case AtSign; - case FoldVertical; case Award; case Ellipsis; case Flag; @@ -75,6 +74,7 @@ enum Lucide case EyeOff; case Plus; case Maximize2; + case Minimize2; case Vibrate; // The achievement badges, named as devnull names their icons (see forBadge()). @@ -189,7 +189,6 @@ public function custom(bool $filled = false): string self::UserPlus => 'user-plus', self::UserCheck => 'user-check', self::AtSign => 'at-sign', - self::FoldVertical => 'fold-vertical', self::Award => 'award', self::Ellipsis => 'ellipsis', self::Flag => 'flag', @@ -216,6 +215,7 @@ public function custom(bool $filled = false): string self::EyeOff => 'eye-off', self::Plus => 'plus', self::Maximize2 => 'maximize-2', + self::Minimize2 => 'minimize-2', self::Vibrate => 'vibrate', self::Terminal => 'terminal', self::FileCode => 'file-code', diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index f20c88a3..0647820f 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -3,6 +3,7 @@ namespace App\NativeComponents; use App\Devnull\Account; +use App\Devnull\Beat; use App\Devnull\Client; use App\Devnull\Data\Commit; use App\Devnull\Data\CommitThread; @@ -50,11 +51,18 @@ * leaving the page keeps it, and it's in the reply bar again, marked as * restored, when you come back to the commit. * - * The reply bar has no room for photos or a preview, so its expand button - * opens the reply in the composer sheet, which has them (see replyInSheet()). + * The reply bar's expand button gives the reply more room where it is: the + * box grows taller over the page, with the same field in it, so the keyboard + * stays up (see toggleReplyExpanded()). A sheet can't do that: presenting + * one takes the keyboard down and puts it back up on both platforms, however + * soon its field takes focus. Grown, the box has the photos and preview + * button, which opens the reply in the composer sheet (see replyInSheet()). * The draft goes with it, and back to the bar if the sheet closes unsent. - * Photos left in it show as a count under the bar's field, which opens the - * sheet on them, and Reply in the bar sends them with the text. + * Photos left in it show as a count in the box, which opens the sheet on + * them, and Reply in the bar sends them with the text. + * + * Related commits wait under a header with their count, closed, and open + * in place when it's tapped (see toggleRelated()). * * A reply goes at once: the bar empties and the reply shows staged under the * commit while it goes to devnull from the outbox (see SyncsOutbox), then the @@ -101,6 +109,36 @@ class CommitDetail extends NativeComponent */ public array $related = []; + /** + * Whether the reply box has grown to give the reply more room. + */ + public bool $replyExpanded = false; + + /** + * Whether the related commits show under their header. + */ + public bool $relatedShown = false; + + /** + * Whether the related commits are drawn see-through: about to fade in, or fading out on their way to closing. + */ + public bool $relatedFaded = false; + + /** + * Whether the related commits are fading out, still drawn until they have. + */ + public bool $relatedClosing = false; + + /** + * How long the related commits take to fade in or out, in milliseconds, as a Log thread's replies do. + */ + public const int RelatedFade = 220; + + /** + * How much later each related commit starts fading in than the one above it, in milliseconds. + */ + public const int RelatedStagger = 40; + /** * Whether the replies have been kept or fetched. Until then they show as loading. */ @@ -278,6 +316,50 @@ public function toggleReplies(): void $this->repliesShown = ! $this->repliesShown; } + /** + * The expand button in the reply box: the box grows taller where it is, + * the same field in it, so the keyboard stays where it was, and again it + * shrinks back. + */ + public function toggleReplyExpanded(): void + { + $this->replyExpanded = ! $this->replyExpanded; + } + + /** + * The related commits' header opens them, and closes them again. EDGE + * can't animate a node coming into the page or leaving it, so they're + * drawn see-through first and shown once a Beat comes back, which each + * row fades and slides to, a little after the one above. Closing fades + * them out the same way, then takes them out. + */ + public function toggleRelated(): void + { + if ($this->relatedClosing) { + return; + } + + if (! $this->relatedShown) { + $this->relatedShown = true; + $this->relatedFaded = true; + $shown = fn () => $this->relatedFaded = false; + + Beat::dispatch(Beat::Step)->finished($shown)->failed($shown); + + return; + } + + $this->relatedFaded = true; + $this->relatedClosing = true; + $closed = function (): void { + $this->relatedShown = false; + $this->relatedFaded = false; + $this->relatedClosing = false; + }; + + Beat::dispatch(self::RelatedFade)->finished($closed)->failed($closed); + } + /** * A deleted reply has no page of its own, so its replies open in place below it. */ @@ -357,6 +439,7 @@ public function sendReply(): void $this->reply = ''; $this->replyImages = []; + $this->replyExpanded = false; $this->forgetMention('reply'); $this->updatedReply(); $this->repliesShown = true; diff --git a/resources/icons/fold-vertical.svg b/resources/icons/fold-vertical.svg deleted file mode 100644 index f24194ca..00000000 --- a/resources/icons/fold-vertical.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/resources/icons/minimize-2.svg b/resources/icons/minimize-2.svg new file mode 100644 index 00000000..f3cb0e4b --- /dev/null +++ b/resources/icons/minimize-2.svg @@ -0,0 +1 @@ + diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index c633a3d0..54930e8e 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -108,68 +108,73 @@ Display::replyBarClearance): the last reply and its actions end above the bar, keyboard up or down. --}} @if ($commit) - + @endif @if ($commit) {{-- - The bar is painted from its first child's background: native:bottom-bar takes no classes of its own, so - the surface and the hairline above it belong to this column, or the replies show through. On iOS the bar - is bare and the field is a Liquid Glass plate instead, the way the HIG floats controls over content; the - hairline stays as a clear 1pt so the bar keeps the height Display::ReplyBarHeight counts on. + The reply bar, drawn as the Remotes composer is: one rounded box with the field across the top and a row + under it with the tools on the left and the round send button on the right (see partials/composer-box). The + bar is Liquid Glass tinted with the surface on iOS, so the thread scrolling under it blurs, and the solid + surface with a hairline on Android. native:bottom-bar takes no classes of its own, so the bar is painted + from this column. - The expand button opens the reply in the composer sheet, which has the photos and preview the bar has no - room for. It sits where partials/composer-plate puts a composer's tools: inside the plate on iOS, ahead of - the field on Android. + The expand button grows the box where it is, the same field in it, so the keyboard stays up, and shrinks + it back. A sheet can't take the reply over with the keyboard up: presenting one takes the keyboard down + and back up on both platforms. Grown, the box also has the button for photos and a preview, which opens + the reply in the composer sheet, and once the sheet has put photos on the draft, their count opens the + sheet on them. Beside the send button, how long the reply is. A reply that came back when you returned to + the commit has the web's stash@{0} and drop under the box, on a row of its own, since the box's row has no + room left for it once it has grown. --}} - + {{-- - The people to mention keep a slot above the field, empty and no height when there's no one, so the - field's row never moves. Android rebuilds a row that moves among its siblings, field and all, which - drops the keyboard. + The people to mention keep a slot above the box, empty and 0.1pt tall when there's no one, so the + box's row never moves. Android rebuilds a row that moves among its siblings, field and all, which + drops the keyboard. On iOS an empty slot would otherwise take 10pt of the bar, and EDGE drops a + height of 0. --}} @php($mentioning = ($mention['field'] ?? null) === 'reply' && ($mentionPeople !== [] || $mentionOrganizations !== [])) - + @include('native.partials.mention-suggestions', ['field' => 'reply', 'label' => 'Mention a developer']) - - @include('native.partials.composer-plate', [ + + @php($photoCount = $replyImages === [] ? null : \App\Devnull\Display::count(count($replyImages), 'photo', 'photos')) + @include('native.partials.composer-box', [ 'ref' => 'reply', 'field' => 'native.partials.reply-field', - 'tools' => [['ref' => 'reply-expand', 'icon' => \App\Icons\Lucide::Maximize2, 'label' => 'Reply with photos or a preview', 'press' => "replyInSheet('{$commit->id}')"]], + 'tools' => [ + $replyExpanded + ? ['ref' => 'reply-expand', 'icon' => \App\Icons\Lucide::Minimize2, 'label' => 'Give the reply less room', 'press' => 'toggleReplyExpanded'] + : ['ref' => 'reply-expand', 'icon' => \App\Icons\Lucide::Maximize2, 'label' => 'Give the reply more room', 'press' => 'toggleReplyExpanded'], + ...($replyExpanded ? [ + ['ref' => 'reply-attach', 'icon' => \App\Icons\Lucide::ImagePlus, 'label' => 'Reply with photos or a preview', 'press' => "replyInSheet('{$commit->id}')"], + ] : []), + ...($photoCount === null ? [] : [ + ['ref' => 'reply-photos', 'icon' => \App\Icons\Lucide::ImagePlus, 'text' => $photoCount, 'label' => $photoCount.' attached', 'hint' => 'Opens the reply with its photos', 'press' => "replyInSheet('{$commit->id}')"], + ]), + ], + 'counter' => ['native.partials.body-counter', ['body' => $reply, 'ref' => 'reply-budget']], + 'send' => [ + 'ref' => 'send-reply', + 'label' => 'Reply', + 'press' => 'sendReply', + 'disabled' => ! \App\Devnull\Data\Draft::canCommit($reply, $replyImages), + ], ]) - @include('native.partials.body-counter', ['body' => $reply, 'ref' => 'reply-budget']) - Reply + @if ($replyRestored) + + @include('native.partials.stash-label', ['ref' => 'reply-stash', 'drop' => 'dropReplyStash', 'size' => 'text-xs']) + + @endif @if (\App\Devnull\Data\CommitBody::hasOversizedUrl($reply)) Each link must not be greater than {{ \App\Devnull\Data\BodyLink::MaxLength }} characters. @endif - {{-- - A reply stashed when you left the commit comes back with the web's stash@{0} and drop under it. - Photos attached in the sheet show as a count on the left, which opens the sheet on them, and Reply - sends them. - --}} - @if ($replyRestored || $replyImages !== []) - - @if ($replyImages !== []) - @php($photoCount = \App\Devnull\Display::count(count($replyImages), 'photo', 'photos')) - - - - {{ $photoCount }} - - - - @endif - @if ($replyRestored) - @include('native.partials.stash-label', ['ref' => 'reply-stash', 'drop' => 'dropReplyStash', 'size' => 'text-xs']) - @endif - - @endif @endif diff --git a/resources/views/native/partials/body-counter.blade.php b/resources/views/native/partials/body-counter.blade.php index 6bdd9736..86f4db9f 100644 --- a/resources/views/native/partials/body-counter.blade.php +++ b/resources/views/native/partials/body-counter.blade.php @@ -1,21 +1,14 @@ {{-- The web's BodyCounter, next to Commit or Reply: nothing until 200 characters are left, then the count in mono, amber - from 20 and Rm Red at none. Before that, a body long enough to be folded in lists says so. - - The composer sheet and the reply bar show the fold icon. In partials/composer-box ($foldHint), where the row has - room for words, it says "folded in feeds" in small muted text instead: people read the icon alone as a button they - couldn't work out, and text that isn't a button can't be mistaken for one. + from 20 and Rm Red at none. Before that, a body long enough to be folded in lists says "folded in feeds" in small + muted text. It used to be the FoldVertical icon, which people read as a button they couldn't work out, and text + that isn't a button can't be mistaken for one. --}} -@php($foldHint ??= false) @php($remaining = \App\Devnull\Data\Commit::MaxLength - (($literal ?? false) ? mb_strlen(\App\Devnull\Data\CommitBody::normalize($body)) : \App\Devnull\Data\CommitBody::characterCount($body))) @php($isCounting = $remaining <= \App\Devnull\Data\Commit::CountFrom) @php($foldExplained = 'Feeds show the first '.\App\Devnull\Data\Commit::PreviewLength.' characters or '.\App\Devnull\Data\Commit::PreviewLines.' lines, then Show more.') @if ($isCounting) {{ $remaining }} @elseif (\App\Devnull\Data\Commit::isFoldedInLists($body)) - @if ($foldHint) - folded in feeds - @else - - @endif + folded in feeds @endif diff --git a/resources/views/native/partials/composer-plate.blade.php b/resources/views/native/partials/composer-plate.blade.php deleted file mode 100644 index d5ec3f0f..00000000 --- a/resources/views/native/partials/composer-plate.blade.php +++ /dev/null @@ -1,24 +0,0 @@ -{{-- - A composer bar's field and its tools, as the reply bar on a commit's page and a Remotes thread's message bar draw - them, for the row that holds them with what follows (a counter, the send button). On iOS the field is a Liquid - Glass plate and the tools sit inside it at its trailing edge, where iOS puts a field's own controls, staying at the - bottom as the draft grows. On Android the tools lead the row, ahead of the field, and the row starts closer to the - edge for them (ios:pl-4 android:pl-2). - - $ref names the plate ("{$ref}-plate", also its key, so the field keeps its place as rows above it come and go), - $field is the partial that draws the field, and $tools are composer-tool's, in the web's order. ---}} -@php($toolsInField = \Native\Mobile\Platform::isIos()) -@unless ($toolsInField) - @foreach ($tools as $tool) - @include('native.partials.composer-tool', $tool) - @endforeach -@endunless - - @include($field) - @if ($toolsInField) - @foreach ($tools as $tool) - @include('native.partials.composer-tool', $tool) - @endforeach - @endif - diff --git a/resources/views/native/partials/composer-tool.blade.php b/resources/views/native/partials/composer-tool.blade.php index 92027763..6ae256f4 100644 --- a/resources/views/native/partials/composer-tool.blade.php +++ b/resources/views/native/partials/composer-tool.blade.php @@ -1,11 +1,13 @@ {{-- One of the composer's tools, as the web's ghost icon buttons: a 44pt target with the icon in muted ink, on Blue Wash in Commit Blue while it's on ($active). While it can't be used ($disabled), it's faded, with nothing to press. - With $menu (TopBarAction items), a tap opens that menu instead of pressing. + With $menu (TopBarAction items), a tap opens that menu instead of pressing. With $text, the icon is smaller and the + words follow it in muted ink, as the reply box counts the photos on its draft. --}} @php($active ??= false) @php($disabled ??= false) @php($menu ??= null) +@php($text ??= null) @if ($menu !== null) {{-- iOS's menu reads its icon to VoiceOver rather than the pressable's label, so the icon carries it too. --}} @@ -17,6 +19,13 @@ +@elseif ($text !== null) + + + + {{ $text }} + + @else diff --git a/resources/views/native/partials/related-commits.blade.php b/resources/views/native/partials/related-commits.blade.php index a7398456..452eaedf 100644 --- a/resources/views/native/partials/related-commits.blade.php +++ b/resources/views/native/partials/related-commits.blade.php @@ -1,19 +1,35 @@ -{{-- Other threads, in relevance order, on a fresh rail below this thread as on the web. --}} +{{-- + Other threads, in relevance order, on a fresh rail below this thread as on the web. They start closed under a + header with their count, which opens them in place and closes them again, its chevron turning as they do (see + CommitDetail::toggleRelated()). Each commit fades and slides into place a little after the one above it, and fades + out together as they close. The header is the whole row, so it's an easy target at the foot of the page. +--}} +@php($relatedOpen = $relatedShown && ! $relatedClosing) +@php($relatedLabel = \App\Devnull\Display::count(count($relatedRows), 'related commit', 'related commits')) - - Related commits - - @foreach ($relatedRows as $relatedRow) - @include('native.partials.commit-row', [ - 'commit' => $relatedRow->commit, - 'previousLane' => $relatedRow->previousLane, - 'continuesRun' => $relatedRow->continuesRun, - 'continuesNext' => null, - 'focused' => false, - 'muted' => false, - 'seriesExpanded' => false, - 'threadBelow' => false, - 'withTail' => ! $loop->last, - ]) - @endforeach + + + Related commits + {{ count($relatedRows) }} + + + + + @if ($relatedShown) + @foreach ($relatedRows as $relatedRow) + + @include('native.partials.commit-row', [ + 'commit' => $relatedRow->commit, + 'previousLane' => $relatedRow->previousLane, + 'continuesRun' => $relatedRow->continuesRun, + 'continuesNext' => null, + 'focused' => false, + 'muted' => false, + 'seriesExpanded' => false, + 'threadBelow' => false, + 'withTail' => ! $loop->last, + ]) + + @endforeach + @endif diff --git a/resources/views/native/partials/reply-field.blade.php b/resources/views/native/partials/reply-field.blade.php index 04f37457..6400973d 100644 --- a/resources/views/native/partials/reply-field.blade.php +++ b/resources/views/native/partials/reply-field.blade.php @@ -1,11 +1,12 @@ {{-- - The reply bar's field on a commit's page (see partials/composer-plate). EDGE sends no focus event, so a press on the - field is how the page learns you're replying. The expand button is beside it rather than in it, so pressing it + The reply bar's field on a commit's page, across the top of partials/composer-box. EDGE sends no focus event, so a + press on the field is how the page learns you're replying. The expand button is in the row under it, so pressing it doesn't count. Where the caret is goes to the page as it moves, for the "@" suggestions above the bar (see SuggestsMentions). It keeps the keyboard up through presses elsewhere on the page (keep-focus), as the Remotes - field does, so picking someone to mention leaves you typing after them. + field does, so picking someone to mention leaves you typing after them. The expand button grows it to + Display::ExpandedReplyMinLines tall: the same field, only taller, so the keyboard doesn't move. --}} - + diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index fc0da284..9716ce8c 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -105,17 +105,88 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): ->and(idsDownTo($screen->tree(), 'reply-input'))->toBe($field); }); -it('puts the expand button inside the reply field on iOS, and ahead of it on Android', function (string $platform, array $row, array $plate) { +it('draws the reply bar as one box, the field over the expand button and a round Reply, on both platforms', function (string $platform) { fakeThread(); $screen = Native::visit('/log/commits/c2', platform: $platform); + $actions = childRefs($screen, 'reply-actions'); - expect(childRefs($screen, 'reply-row'))->toBe($row) - ->and(childRefs($screen, 'reply-plate'))->toBe($plate); -})->with([ - 'iOS' => ['ios', ['reply-plate', 'send-reply'], ['reply-field', 'reply-expand']], - 'Android' => ['android', ['reply-expand', 'reply-plate', 'send-reply'], ['reply-field']], -]); + expect(childRefs($screen, 'reply-row'))->toBe(['reply-box']) + ->and(childRefs($screen, 'reply-box'))->toBe(['reply-field-row', 'reply-actions']) + ->and(childRefs($screen, 'reply-field-row'))->toBe(['reply-field']) + ->and($actions[0])->toBe('reply-expand') + ->and(end($actions))->toBe('send-reply') + ->and(nodeByRef($screen, 'send-reply')['props']['a11y_label'] ?? nodeByRef($screen, 'send-reply')['a11y_label'] ?? null)->toBe('Reply') + ->and(canSend($screen, 'send-reply'))->toBeFalse(); + + $screen->input('reply-input', 'Ready'); + + expect(canSend($screen, 'send-reply'))->toBeTrue(); +})->with(['ios', 'android']); + +it('grows the reply box where it is for more room, keeping the same field so the keyboard stays up', function (string $platform) { + fakeThread(); + + $screen = Native::visit('/log/commits/c2', platform: $platform)->input('reply-input', 'A long one'); + $field = idsDownTo($screen->tree(), 'reply-input'); + $clearance = nodeByRef($screen, 'reply-bar-clearance')['layout']['height']; + + expect(nodeByRef($screen, 'reply-input')['props']['max_lines'])->toBe(5) + ->and(rendersRef($screen, 'reply-attach'))->toBeFalse(); + + $screen->tap('reply-expand'); + + expect(idsDownTo($screen->tree(), 'reply-input'))->toBe($field) + ->and(nodeByRef($screen, 'reply-input')['props']['min_lines'])->toBe(8) + ->and(nodeByRef($screen, 'reply-input')['props']['max_lines'])->toBe(12) + ->and(nodeByRef($screen, 'reply-expand')['props']['a11y_label'] ?? null)->toBe('Give the reply less room') + ->and(childRefs($screen, 'reply-actions')[1])->toBe('reply-attach') + ->and(nodeByRef($screen, 'sheet')['props']['visible'] ?? false)->toBeFalse() + ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual($clearance + 7 * 21); + + // Photos and a preview are a tap further, in the composer sheet, with the draft. + $screen->tap('reply-attach'); + + expect(nodeByRef($screen, 'sheet')['props']['visible'])->toBeTrue() + ->and($screen->instance()->sheetBody)->toBe('A long one'); + + $screen->dismissSheet('sheet')->tap('reply-expand'); + + expect(idsDownTo($screen->tree(), 'reply-input'))->toBe($field) + ->and(nodeByRef($screen, 'reply-input')['props']['max_lines'])->toBe(5) + ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual($clearance); +})->with(['ios', 'android']); + +it('shrinks the grown reply box back once the reply is sent', function () { + fakeThread(extra: ['POST /api/v1/commits' => [['data' => replyJson(['id' => 'r9', 'parent_id' => 'c2', 'body' => 'Sent'])], 201]]); + + $screen = Native::visit('/log/commits/c2')->tap('reply-expand')->input('reply-input', 'Sent')->tap('send-reply'); + + expect($screen->instance()->replyExpanded)->toBeFalse() + ->and(nodeByRef($screen, 'reply-input')['props']['max_lines'])->toBe(5); +}); + +it('says a reply long enough to be folded in feeds is, in words beside Reply and in the sheet, rather than an icon', function () { + fakeThread(); + + $screen = Native::visit('/log/commits/c2')->input('reply-input', 'Short'); + + expect(rendersRef($screen, 'reply-budget-fold'))->toBeFalse(); + + $screen->input('reply-input', str_repeat('a', 281)); + $hint = nodeByRef($screen, 'reply-budget-fold'); + + expect($hint['type'])->toBe('text') + ->and($hint['props']['text'])->toBe('folded in feeds') + ->and($hint['props']['a11y_label'] ?? $hint['a11y_label'] ?? null)->toBe('Feeds show the first 280 characters or 8 lines, then Show more.') + ->and(array_slice(childRefs($screen, 'reply-actions'), -2))->toBe(['reply-budget-fold', 'send-reply']) + ->and(findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'icon' && ($node['ref'] ?? null) === 'reply-budget-fold'))->toBeNull(); + + $screen->tap('reply-expand')->tap('reply-attach'); + + expect(nodeByRef($screen, 'sheet-budget-fold')['type'])->toBe('text') + ->and(nodeByRef($screen, 'sheet-budget-fold')['props']['text'])->toBe('folded in feeds'); +}); it('runs the rail from the folded ancestors into the parent, which shows its avatar', function () { $ada = userJson(['id' => 'u2', 'handle' => 'ada', 'name' => 'Ada', 'lane' => 1]); @@ -320,7 +391,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): Native::visit('/log/commits/c2') ->input('reply-input', ' ') - ->tap('send-reply') + ->call('sendReply') ->input('reply-input', str_repeat('a', 4000)) ->assertElement('text', fn (array $node): bool => ($node['ref'] ?? null) === 'reply-budget' && ($node['text'] ?? $node['props']['text'] ?? null) === '0' @@ -333,7 +404,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): fakeThread(extra: ['POST /api/v1/commits' => [['data' => replyJson(['id' => 'r9', 'parent_id' => 'c2', 'body' => $body])], 201]]); $screen = Native::visit('/log/commits/c2')->input('reply-input', $body); - expect(nodeByRef($screen, 'send-reply')['props']['disabled'] ?? false)->toBeFalse() + expect(canSend($screen, 'send-reply'))->toBeTrue() ->and(nodeByRef($screen, 'reply-input')['props']['max_length'])->toBe(40000); $screen->tap('send-reply')->assertSet('reply', ''); @@ -344,7 +415,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): fakeThread(); $screen = Native::visit('/log/commits/c2')->input('reply-input', 'https://example.com/'.str_repeat('x', 2030)) ->assertSee('Each link must not be greater than 2048 characters.'); - expect(nodeByRef($screen, 'send-reply')['props']['disabled'])->toBeTrue(); + expect(canSend($screen, 'send-reply'))->toBeFalse(); $screen->call('sendReply'); Http::assertNotSent(fn (Request $request): bool => $request->method() === 'POST'); }); @@ -766,29 +837,20 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): expect(pressFeedbackInScroller($screen))->toBe([]); }); -it('paints the reply bar solid on Android, with its hairline, so the replies never show through', function () { +it('puts the reply bar on Liquid Glass tinted with the surface on iOS, and on the solid surface on Android', function () { fakeThread(); - $screen = Native::visit('/log/commits/c2', platform: 'android'); - $bar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); + $ios = Native::visit('/log/commits/c2', platform: 'ios'); + $android = Native::visit('/log/commits/c2', platform: 'android'); + $bar = findNode($android->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); - expect($bar['children'][0]['ref'] ?? null)->toBe('reply-bar') + expect(nodeByRef($ios, 'reply-bar')['props']['glass'] ?? null)->toBe(1) + ->and(nodeByRef($ios, 'reply-bar')['style']['bg_color'] ?? null)->not->toBeNull() + ->and($bar['children'][0]['ref'] ?? null)->toBe('reply-bar') + ->and($bar['children'][0]['props']['glass'] ?? null)->toBeNull() ->and($bar['children'][0]['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) ->and($bar['children'][0]['props']['dark_bg_color'] ?? null)->toBe(config('native-ui.theme.dark.surface')) - ->and($bar['children'][0]['children'][0]['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.hairline')) - ->and(nodeByRef($screen, 'reply-plate')['props']['glass'] ?? null)->toBeNull(); -}); - -it('leaves the reply bar bare on iOS and floats the field on Liquid Glass', function () { - fakeThread(); - - $screen = Native::visit('/log/commits/c2', platform: 'ios'); - $bar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); - - expect($bar['children'][0]['ref'] ?? null)->toBe('reply-bar') - ->and($bar['children'][0]['style']['bg_color'] ?? null)->toBeNull() - ->and($bar['children'][0]['children'][0]['style']['bg_color'] ?? null)->toBeNull() - ->and(nodeByRef($screen, 'reply-plate')['props']['glass'] ?? null)->toBe(1); + ->and($bar['children'][0]['children'][0]['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.hairline')); }); it('ends the page above the reply bar, and further as the draft grows', function () { @@ -800,13 +862,13 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): // The clearance is the last thing on the page, under the last reply: the bar's line and the home indicator. expect(end($page)['ref'] ?? null)->toBe('reply-bar-clearance') - ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual(24 + 53 + 34); + ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual(24 + 97 + 34); $screen->input('reply-input', "Three lines\nof a\ndraft"); - expect(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual(24 + 53 + 2 * 21 + 34); + expect(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual(24 + 97 + 2 * 21 + 34); $screen->input('reply-input', str_repeat("A line\n", 12)); - expect(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual(24 + 53 + 4 * 21 + 34); + expect(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual(24 + 97 + 4 * 21 + 34); }); diff --git a/tests/Feature/Screens/ComposerPhotosTest.php b/tests/Feature/Screens/ComposerPhotosTest.php index 9338fce8..81d2bd8a 100644 --- a/tests/Feature/Screens/ComposerPhotosTest.php +++ b/tests/Feature/Screens/ComposerPhotosTest.php @@ -237,7 +237,7 @@ function isTool(TestableComponent $screen, string $ref): bool $screen = Native::visit('/log/commits/c2') ->input('reply-input', 'Here it') - ->tap('reply-expand') + ->tap('reply-expand')->tap('reply-attach') ->assertSee('Reply to @ada'); expect(nodeByRef($screen, 'sheet-body')['props'])->toMatchArray(['value' => 'Here it', 'placeholder' => 'Reply to @ada']) @@ -267,7 +267,7 @@ function isTool(TestableComponent $screen, string $ref): bool $screen = Native::visit('/log/commits/c2') ->input('reply-input', 'Half') - ->tap('reply-expand') + ->tap('reply-expand')->tap('reply-attach') ->input('sheet-body', 'Half a reply') ->dismissSheet('sheet'); @@ -284,12 +284,14 @@ function isTool(TestableComponent $screen, string $ref): bool 'POST /api/v1/commits' => [['data' => replyJson(['id' => 'r9', 'parent_id' => 'c2', 'body' => 'Look'])], 201], ]); - $screen = photosPicked(Native::visit('/log/commits/c2')->input('reply-input', 'Look')->tap('reply-expand'), [testPhoto()]) + $screen = photosPicked(Native::visit('/log/commits/c2')->input('reply-input', 'Look')->tap('reply-expand')->tap('reply-attach'), [testPhoto()]) ->dismissSheet('sheet'); $path = $screen->instance()->replyImages[0]->path; expect(treeShows(nodeByRef($screen, 'reply-photos'), '1 photo'))->toBeTrue() - ->and(nodeByRef($screen, 'reply-photos')['props']['a11y_label'] ?? null)->toBe('1 photo attached'); + ->and(nodeByRef($screen, 'reply-photos')['props']['a11y_label'] ?? null)->toBe('1 photo attached') + // In the box, after its other tools. + ->and(array_slice(childRefs($screen, 'reply-actions'), 0, 3))->toBe(['reply-expand', 'reply-attach', 'reply-photos']); // Coming back to the commit, the bar has them still. $screen = Native::visit('/log/commits/c2'); @@ -322,7 +324,7 @@ function isTool(TestableComponent $screen, string $ref): bool 'GET /api/v1/commits/c2/replies' => [pageJson([])], ]); - $screen = photosPicked(Native::visit('/log/commits/c2', platform: 'android')->input('reply-input', 'Half')->tap('reply-expand'), [testPhoto()]) + $screen = photosPicked(Native::visit('/log/commits/c2', platform: 'android')->input('reply-input', 'Half')->tap('reply-expand')->tap('reply-attach'), [testPhoto()]) ->input('sheet-body', 'Half a reply') ->tap('sheet-cancel') ->input('reply-input', 'Half a reply, and more'); diff --git a/tests/Feature/Screens/DraftStashTest.php b/tests/Feature/Screens/DraftStashTest.php index 46baedf4..139954a7 100644 --- a/tests/Feature/Screens/DraftStashTest.php +++ b/tests/Feature/Screens/DraftStashTest.php @@ -206,8 +206,9 @@ function stashLabel(TestableComponent $screen, string $ref): array expect(nodeByRef($screen, 'reply-input')['props']['value'])->toBe('A reply in progress') ->and(stashLabel($screen, 'reply-stash'))->toBe(['stash@{0}', 'Discard the restored draft']) - ->and(nodeByRef($screen, 'send-reply')['props']['disabled'] ?? false)->toBeFalse() - // The page ends above the row that marks it, too. + ->and(canSend($screen, 'send-reply'))->toBeTrue() + // It's marked on a row under the box, and the page ends above that too. + ->and(childRefs($screen, 'reply-stash-row'))->toBe(['reply-stash']) ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual($clearance + Display::ReplyBarStashLabelHeight); }); diff --git a/tests/Feature/Screens/LaneButtonsTest.php b/tests/Feature/Screens/LaneButtonsTest.php index 3e966d04..40689705 100644 --- a/tests/Feature/Screens/LaneButtonsTest.php +++ b/tests/Feature/Screens/LaneButtonsTest.php @@ -72,14 +72,6 @@ function laneLog(): TestableComponent return Native::visit('/log/users/ada/followers'); }, 'follow-grace'], - 'Reply' => [function (): TestableComponent { - serveApi([ - 'GET /api/v1/commits/c2' => [commitPageJson(commitJson(['id' => 'c2']))], - 'GET /api/v1/commits/c2/replies' => [pageJson([])], - ]); - - return Native::visit('/log/commits/c2'); - }, 'send-reply'], 'Edit on GitHub, on the Account screen' => [function (): TestableComponent { serveApi(['GET /api/v1/me' => [currentUserJson(['lane' => app(Account::class)->user()?->lane()])]]); @@ -115,6 +107,27 @@ function laneLog(): TestableComponent 'rose, checked in white' => 4, ]); +it("fills the reply bar's round Reply with your lane, with an arrow that reads on it", function (int $lane) { + signIn(['lane' => $lane]); + serveApi([ + 'GET /api/v1/commits/c2' => [commitPageJson(commitJson(['id' => 'c2']))], + 'GET /api/v1/commits/c2/replies' => [pageJson([])], + ]); + + $circle = nodeByRef(Native::visit('/log/commits/c2')->input('reply-input', 'Agreed'), 'send-reply-circle'); + $icon = findNode($circle, fn (array $node): bool => $node['type'] === 'icon')['props']; + + expect(array_map(strtolower(...), [$circle['style']['bg_color'], $circle['props']['dark_bg_color'], $icon['color'], $icon['dark_color']]))->toBe(array_map(strtolower(...), [ + config("native-ui.theme.light.lane-{$lane}"), + config("native-ui.theme.dark.lane-{$lane}"), + config("native-ui.theme.light.on-lane-{$lane}"), + config("native-ui.theme.dark.on-lane-{$lane}"), + ])); +})->with([ + 'green, an arrow in ink' => 1, + 'rose, a white arrow' => 4, +]); + it('draws the tab underline in your lane, in its light and dark shades', function (string $path, int $lane) { signIn(['lane' => $lane]); Http::fake(['devnull.test/*' => Http::response(pageJson([]))]); diff --git a/tests/Feature/Screens/RelatedCommitsTest.php b/tests/Feature/Screens/RelatedCommitsTest.php index a6265735..9e8f15b6 100644 --- a/tests/Feature/Screens/RelatedCommitsTest.php +++ b/tests/Feature/Screens/RelatedCommitsTest.php @@ -1,9 +1,13 @@ 'http://devnull.test']); @@ -25,6 +29,45 @@ function serveRelatedThread(array $related = [], array $extra = []): void ]); } +/** + * Lets every Beat the screen has dispatched come back, as the phone would once it had drawn the step before, and + * leaves any other task (a held refresh) where it is. Like finishBeats() in LogThreadTest, except that it opens a + * task's sealed payload without reading it through AsyncTaskTransport::readPayload(), which deletes it, so a held + * refresh would have nothing left for finishRefreshes() to run. + */ +function landBeats(TestableComponent $screen): TestableComponent +{ + $done = []; + + while (true) { + $beats = array_filter($screen->bridge()->callsTo('AsyncTask.Dispatch'), function (array $call) use (&$done): bool { + $id = $call['params']['id']; + $path = AsyncTaskTransport::directory('payload').DIRECTORY_SEPARATOR.$id.'.task'; + $unseal = Closure::bind(fn (string $id, string $sealed): ?string => static::unseal($id, $sealed), null, AsyncTaskTransport::class); + + return ! isset($done[$id]) && is_file($path) && str_contains((string) $unseal($id, (string) file_get_contents($path)), serialize(Beat::class)); + }); + + if ($beats === []) { + return $screen; + } + + foreach ($beats as $call) { + $done[$call['params']['id']] = true; + AsyncTaskTransport::forgetPayload($call['params']['id']); + $screen->emitNative(AsyncTaskFinished::class, ['id' => $call['params']['id'], 'result' => true]); + } + } +} + +/** + * Opens the related commits under their header, and lets them fade in. + */ +function openRelated(TestableComponent $screen): TestableComponent +{ + return landBeats($screen->tap('related-commits-toggle')); +} + it('shows related commits below the thread in relevance order on their own rail', function (string $platform) { serveRelatedThread([ commitJson(['id' => 'c9', 'body' => 'Closest match', 'author' => userJson(['id' => 'u2', 'handle' => 'ada', 'name' => 'Ada'])]), @@ -34,7 +77,7 @@ function serveRelatedThread(array $related = [], array $extra = []): void 'GET /api/v1/commits/c1/replies' => [pageJson([replyJson(['id' => 'r1', 'parent_id' => 'c1', 'body' => 'A reply'])])], ]); - $screen = Native::visit('/log/commits/c1', ['replies' => true], platform: $platform) + $screen = openRelated(Native::visit('/log/commits/c1', ['replies' => true], platform: $platform)) ->assertSee('The focused commit') ->assertSee('A reply') ->assertSee('Related commits') @@ -43,7 +86,8 @@ function serveRelatedThread(array $related = [], array $extra = []): void ->assertSee('Third match'); expect(childRefs($screen, 'thread-page'))->toBe(['focused-commit', 'thread-reply-r1', 'related-commits', 'reply-bar-clearance']) - ->and(childRefs($screen, 'related-commits'))->toBe(['related-commits-heading', 'commit-c9', 'commit-c3', 'commit-c7']) + ->and(childRefs($screen, 'related-commits'))->toBe(['related-commits-toggle', 'related-c9', 'related-c3', 'related-c7']) + ->and(childRefs($screen, 'related-c9'))->toBe(['commit-c9']) ->and(railNode($screen, 'commit-c9'))->toBe('avatar') ->and(pressFeedbackInScroller($screen))->toBe([]); @@ -73,7 +117,7 @@ function serveRelatedThread(array $related = [], array $extra = []): void Http::assertNothingSent(); - finishRefreshes($screen)->assertSee('Closest match')->input('reply-input', 'A draft'); + openRelated(finishRefreshes($screen))->assertSee('Closest match')->input('reply-input', 'A draft'); expect(collect(Http::recorded())->filter(fn (array $sent): bool => str_ends_with($sent[0]->url(), '/related')))->toHaveCount(1); }); @@ -84,7 +128,7 @@ function serveRelatedThread(array $related = [], array $extra = []): void keep('commits/c1/related', ['data' => [commitJson(['id' => 'c9', 'body' => 'Old match'])]]); serveRelatedThread([commitJson(['id' => 'c3', 'body' => 'Fresh match'])]); - $screen = Native::visit('/log/commits/c1')->assertSee('Old match'); + $screen = openRelated(Native::visit('/log/commits/c1'))->assertSee('Old match'); finishRefreshes($screen)->assertSee('Fresh match')->assertDontSee('Old match'); @@ -128,7 +172,7 @@ function serveRelatedThread(array $related = [], array $extra = []): void 'GET /api/v1/commits/c9/replies' => [pageJson([replyJson(['id' => 'r9', 'parent_id' => 'c9', 'body' => 'Answer to the match'])])], ]); - Native::visit("/{$tab}/commits/c1") + openRelated(Native::visit("/{$tab}/commits/c1")) ->tap($ref) ->assertNavigatedTo("/{$tab}/commits/c9") ->follow() @@ -146,7 +190,7 @@ function serveRelatedThread(array $related = [], array $extra = []): void 'POST /api/v1/commits/c9/star' => [['data' => [...$related, 'starred' => true, 'stars_count' => 1]]], ]); - $screen = Native::visit('/log/commits/c1')->tap('star-c9'); + $screen = openRelated(Native::visit('/log/commits/c1'))->tap('star-c9'); expect($screen->instance()->related[0]->starred)->toBeTrue() ->and(kept('commits/c1/related')['data'][0]['starred'])->toBeTrue() @@ -158,7 +202,7 @@ function serveRelatedThread(array $related = [], array $extra = []): void 'POST /api/v1/commits/c9/star' => [['message' => 'Cannot star now.'], 422], ]); - $screen = Native::visit('/log/commits/c1')->tap('star-c9'); + $screen = openRelated(Native::visit('/log/commits/c1'))->tap('star-c9'); expect($screen->instance()->related[0]->starred)->toBeFalse() ->and(kept('commits/c1/related')['data'][0]['starred'])->toBeFalse(); @@ -169,8 +213,67 @@ function serveRelatedThread(array $related = [], array $extra = []): void keep('commits/c1', commitPageJson(commitJson(['id' => 'c1', 'body' => 'The focused commit']))); keep('commits/c1/related', ['data' => [commitJson(['id' => 'c9', 'body' => 'Closest match'])]]); - $screen = Native::visit('/log/commits/c1')->assertSee('Closest match'); + $screen = openRelated(Native::visit('/log/commits/c1'))->assertSee('Closest match'); app(ResponseCache::class)->commitDeleted('c9'); $screen->call('onResume')->assertDontSee('Closest match')->assertDontSee('Related commits'); }); + +it('keeps related commits closed under a header with their count until it is tapped', function (string $platform) { + serveRelatedThread([ + commitJson(['id' => 'c9', 'body' => 'Closest match']), + commitJson(['id' => 'c3', 'body' => 'Next match']), + ]); + + $screen = Native::visit('/log/commits/c1', platform: $platform) + ->assertSee('Related commits') + ->assertDontSee('Closest match') + ->assertDontSee('Next match'); + + expect(childRefs($screen, 'related-commits'))->toBe(['related-commits-toggle']) + ->and(nodeByRef($screen, 'related-commits-count')['props']['text'])->toBe('2') + ->and(nodeByRef($screen, 'related-commits-toggle')['props']['a11y_label'] ?? null)->toBe('2 related commits') + ->and(nodeByRef($screen, 'related-commits-chevron')['props']['rotate'] ?? 0.0)->toEqual(0.0); + + openRelated($screen)->assertSee('Closest match')->assertSee('Next match'); + + expect(nodeByRef($screen, 'related-commits-chevron')['props']['rotate'])->toEqual(90.0); + + landBeats($screen->tap('related-commits-toggle'))->assertDontSee('Closest match')->assertSee('Related commits'); + + expect(nodeByRef($screen, 'related-commits-chevron')['props']['rotate'] ?? 0.0)->toEqual(0.0); +})->with(['ios', 'android']); + +it('fades related commits in one after another as they open, and out together as they close', function () { + holdRefreshes(); + serveRelatedThread([ + commitJson(['id' => 'c9', 'body' => 'Closest match']), + commitJson(['id' => 'c3', 'body' => 'Next match']), + ]); + + $screen = finishRefreshes(Native::visit('/log/commits/c1', platform: 'ios')); + + // Drawn see-through and nudged up first, with the animation each eases in by, the second a beat later. + $screen->tap('related-commits-toggle'); + expect(nodeByRef($screen, 'related-c9')['style']['opacity'] ?? null)->toBe(0.0) + ->and(nodeByRef($screen, 'related-c9')['props']['translate-y'] ?? null)->toBe(-8.0) + ->and(nodeByRef($screen, 'related-c9')['props']['animate-duration'] ?? null)->toBe(220.0) + ->and(nodeByRef($screen, 'related-c9')['props']['animate-delay'] ?? 0.0)->toEqual(0.0) + ->and(nodeByRef($screen, 'related-c3')['props']['animate-delay'] ?? null)->toEqual(40.0) + ->and(nodeByRef($screen, 'related-commits-chevron')['props']['rotate'])->toEqual(90.0) + ->and(nodeByRef($screen, 'related-commits-chevron')['props']['animate-duration'] ?? null)->toBe(220.0); + + landBeats($screen); + expect(nodeByRef($screen, 'related-c9')['style']['opacity'] ?? 1.0)->toBe(1.0) + ->and(nodeByRef($screen, 'related-c9')['props']['translate-y'] ?? null)->toBe(0.0); + + // Closing fades them out together, chevron back first, and they go once that's done. A tap meanwhile does nothing. + $screen->tap('related-commits-toggle')->tap('related-commits-toggle')->assertSee('Closest match'); + expect(nodeByRef($screen, 'related-c9')['style']['opacity'] ?? null)->toBe(0.0) + ->and(nodeByRef($screen, 'related-c3')['props']['animate-delay'] ?? 0.0)->toEqual(0.0) + ->and(nodeByRef($screen, 'related-commits-chevron')['props']['rotate'] ?? 0.0)->toEqual(0.0); + + landBeats($screen)->assertDontSee('Closest match'); + expect($screen->instance()->relatedShown)->toBeFalse() + ->and($screen->instance()->relatedFaded)->toBeFalse(); +}); From e082ad509ab65df393b040cf3f37ca3e1d89cea1 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 17 Nov 2026 00:57:13 +0000 Subject: [PATCH 03/46] Post as an organization you're in, as the web does The web lets a member of a GitHub organization post a commit, a quote or a reply as that organization. The app now does too. - GET /me's organizations are kept on the phone (Account), and refreshed whenever /me is. - The composer sheet shows who the commit goes out as above the field. A tap opens a menu of you and your organizations. The reply bar on a commit's page has the same avatar at its start, and hands its choice to the reply sheet and back. - The choice goes to devnull as `author`, which the API already takes, and rides in the outbox, so a staged commit shows the organization as its author. Commit and Reply use the organization's lane. - A scheduled commit goes out as the organization too, and the Scheduled list says "As @handle" as the web's does. - If devnull turns a commit down (you left the organization, or it's rate limited), the usual toast says why and the draft comes back with the organization still picked. The app asks /me again, and a composer whose organization is gone posts as you. - Tapping an organization in Notifications opens its page. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Account.php | 29 +- app/Devnull/Client.php | 26 +- app/Devnull/Data/CurrentUser.php | 22 ++ app/Devnull/Data/ScheduledCommit.php | 5 +- app/Devnull/PostAs.php | 106 ++++++ app/Models/PendingWrite.php | 43 ++- app/NativeComponents/CommitDetail.php | 38 +++ .../Concerns/OpensCommitSheet.php | 56 +++- .../Concerns/RefreshesInBackground.php | 1 + app/NativeComponents/Concerns/SyncsOutbox.php | 27 +- app/NativeComponents/Notifications.php | 15 +- app/NativeComponents/Onboarding.php | 1 + app/NativeComponents/ThisDevice.php | 1 + .../views/native/commit-detail.blade.php | 9 +- .../native/partials/commit-sheet.blade.php | 14 +- .../native/partials/dashed-ring.blade.php | 6 +- .../views/native/partials/post-as.blade.php | 28 ++ .../native/partials/rail-avatar.blade.php | 4 +- .../partials/sheet-bar-button.blade.php | 8 +- .../views/native/scheduled-commits.blade.php | 7 + tests/Feature/Screens/NotificationsTest.php | 7 + tests/Feature/Screens/PostAsTest.php | 312 ++++++++++++++++++ 22 files changed, 721 insertions(+), 44 deletions(-) create mode 100644 app/Devnull/PostAs.php create mode 100644 resources/views/native/partials/post-as.blade.php create mode 100644 tests/Feature/Screens/PostAsTest.php diff --git a/app/Devnull/Account.php b/app/Devnull/Account.php index 22917423..2163391d 100644 --- a/app/Devnull/Account.php +++ b/app/Devnull/Account.php @@ -36,6 +36,8 @@ final class Account private const string TermsKey = 'devnull.terms-to-accept'; + private const string OrganizationsKey = 'devnull.organizations'; + public function user(): ?User { $attributes = Cache::get(self::CacheKey); @@ -215,7 +217,31 @@ public function rememberTermsToAccept(?string $version): void } /** - * Signs this phone out: who it was, the badges, its pastéis and Remotes, your timezone, the terms you owe, every + * The GitHub organizations you can post as, as devnull last said, oldest membership first. None until it has. + * + * @return list + */ + public function organizations(): array + { + $kept = Cache::get(self::OrganizationsKey); + + return is_array($kept) ? array_values(array_map(User::fromArray(...), array_filter($kept, is_array(...)))) : []; + } + + /** + * Remembers the organizations you can post as. With null, from a devnull too old to say, it keeps what it had. + * + * @param list|null $organizations + */ + public function rememberOrganizations(?array $organizations): void + { + if ($organizations !== null) { + Cache::forever(self::OrganizationsKey, array_map(fn (User $organization): array => $organization->toArray(), $organizations)); + } + } + + /** + * Signs this phone out: who it was, the badges, its pastéis and Remotes, your organizations, your timezone, the terms you owe, every * answer, image and voice note kept for a quick start, and your unsent drafts and recordings. */ public function forget(): void @@ -234,5 +260,6 @@ public function forget(): void Cache::forget(self::PinWarningKey); Cache::forget(self::TimezoneKey); Cache::forget(self::TermsKey); + Cache::forget(self::OrganizationsKey); } } diff --git a/app/Devnull/Client.php b/app/Devnull/Client.php index b6538ae5..a2b74bea 100644 --- a/app/Devnull/Client.php +++ b/app/Devnull/Client.php @@ -301,13 +301,15 @@ public function replies(string $id, ?string $cursor = null): Page /** * Commits, as a reply to $parentId or quoting $quotedCommitId, as the web's * composer, reply box and Quote do. devnull takes one or the other, not both. - * A new commit or a quote may start a poll (see PollDraft::payload()). + * A new commit or a quote may start a poll (see PollDraft::payload()). With + * $author, the handle of an organization you're a member of, it goes out as + * that organization, as the web's Post as picks (see PostAs). * * @param array{options: list, duration: int}|null $poll */ - public function createCommit(string $body, ?string $parentId = null, ?string $quotedCommitId = null, ?array $poll = null): Commit + public function createCommit(string $body, ?string $parentId = null, ?string $quotedCommitId = null, ?array $poll = null, ?string $author = null): Commit { - $commit = $this->data($this->send('POST', 'commits', payload: self::commitPayload($body, $parentId, $quotedCommitId, poll: $poll))); + $commit = $this->data($this->send('POST', 'commits', payload: self::commitPayload($body, $parentId, $quotedCommitId, $poll, $author))); $this->cache->commitAdded($commit); return Commit::fromArray($commit); @@ -319,9 +321,9 @@ public function createCommit(string $body, ?string $parentId = null, ?string $qu * * @param array{options: list, duration: int}|null $poll */ - public function signedCommit(string $body, ?string $parentId = null, ?string $quotedCommitId = null, ?array $poll = null): SignedRequest + public function signedCommit(string $body, ?string $parentId = null, ?string $quotedCommitId = null, ?array $poll = null, ?string $author = null): SignedRequest { - return $this->signedWrite('POST', 'commits', self::commitPayload($body, $parentId, $quotedCommitId, poll: $poll)); + return $this->signedWrite('POST', 'commits', self::commitPayload($body, $parentId, $quotedCommitId, $poll, $author)); } /** @@ -331,9 +333,9 @@ public function signedCommit(string $body, ?string $parentId = null, ?string $qu * * @param list $images */ - public function signedCommitWithImages(string $body, array $images, ?string $parentId = null, ?string $quotedCommitId = null): SignedRequest + public function signedCommitWithImages(string $body, array $images, ?string $parentId = null, ?string $quotedCommitId = null, ?string $author = null): SignedRequest { - return $this->signedWithImages('commits', self::commitPayload($body, $parentId, $quotedCommitId), $images); + return $this->signedWithImages('commits', self::commitPayload($body, $parentId, $quotedCommitId, author: $author), $images); } /** @@ -360,14 +362,15 @@ public function signedMessage(string $threadPath, string $body, string $clientId * Signs a commit to be submitted at $at, as the web's Schedule commit * does, for the background to send. Only you see it until then. With * photos it goes as multipart, as a commit with photos does, and a poll - * goes in its JSON. + * goes in its JSON. With $author it goes out as that organization when it's + * due, as long as you're still in it then. * * @param list $images * @param array|null $poll */ - public function signedScheduledCommit(string $body, CarbonInterface $at, array $images = [], ?array $poll = null): SignedRequest + public function signedScheduledCommit(string $body, CarbonInterface $at, array $images = [], ?array $poll = null, ?string $author = null): SignedRequest { - $payload = array_filter(['body' => $body, 'scheduled_at' => self::scheduleTime($at), 'poll' => $poll], fn (mixed $value): bool => $value !== null); + $payload = array_filter(['body' => $body, 'scheduled_at' => self::scheduleTime($at), 'poll' => $poll, 'author' => $author], fn (mixed $value): bool => $value !== null); return $images === [] ? $this->signedWrite('POST', self::ScheduledCommitsPath, $payload) @@ -976,13 +979,14 @@ private function send(string $method, string $path, array $query = [], ?array $p * @param array{options: list, duration: int}|null $poll * @return array */ - private static function commitPayload(string $body, ?string $parentId, ?string $quotedCommitId, ?array $poll = null): array + private static function commitPayload(string $body, ?string $parentId, ?string $quotedCommitId, ?array $poll = null, ?string $author = null): array { return array_filter([ 'body' => $body, 'parent_id' => $parentId, 'quoted_commit_id' => $quotedCommitId, 'poll' => $poll, + 'author' => $author, ], fn (mixed $value): bool => $value !== null); } diff --git a/app/Devnull/Data/CurrentUser.php b/app/Devnull/Data/CurrentUser.php index 9fead8f8..32b1701d 100644 --- a/app/Devnull/Data/CurrentUser.php +++ b/app/Devnull/Data/CurrentUser.php @@ -19,9 +19,16 @@ * And the terms: the version in force, which is the moment it took effect, when * you last accepted them, and whether that was this version. A devnull too old * to say leaves all three null. + * + * And the GitHub organizations you're a member of, admin or not, oldest + * membership first, which you can post as, as the web's Post as menu lists + * them. A devnull too old to say leaves it null. */ final readonly class CurrentUser { + /** + * @param list|null $organizations + */ public function __construct( public User $user, public int $unreadNotificationsCount = 0, @@ -37,6 +44,7 @@ public function __construct( public ?string $termsVersion = null, public ?CarbonImmutable $termsAcceptedAt = null, public ?bool $termsAccepted = null, + public ?array $organizations = null, ) {} /** @@ -69,9 +77,23 @@ public static function fromArray(array $json): self termsVersion: is_string($data['terms_version'] ?? null) && $data['terms_version'] !== '' ? $data['terms_version'] : null, termsAcceptedAt: Commit::date($data['terms_accepted_at'] ?? null), termsAccepted: is_bool($data['terms_accepted'] ?? null) ? $data['terms_accepted'] : null, + organizations: is_array($data['organizations'] ?? null) ? self::organizations($data['organizations']) : null, ); } + /** + * The organizations you can post as, each drawn as an organization whatever the answer said. + * + * @param array $organizations + * @return list + */ + private static function organizations(array $organizations): array + { + $users = array_map(fn (array $organization): User => User::fromArray([...$organization, 'type' => 'organization']), array_values(array_filter($organizations, is_array(...)))); + + return array_values(array_filter($users, fn (User $organization): bool => $organization->username !== '')); + } + /** * The version of the terms devnull is waiting for you to accept, exactly as it sent it, or null when you have. */ diff --git a/app/Devnull/Data/ScheduledCommit.php b/app/Devnull/Data/ScheduledCommit.php index 31280b98..dcdf0b0e 100644 --- a/app/Devnull/Data/ScheduledCommit.php +++ b/app/Devnull/Data/ScheduledCommit.php @@ -10,7 +10,8 @@ * page, which only you see. Until it's submitted it has its body, the options * of its poll, and how many images it carries. Once submitted, those are its * commit's, and its status is that commit's: pending review, approved, - * rejected, or deleted. + * rejected, or deleted. $author is the organization it goes out as, or null + * when it goes out as you. */ final readonly class ScheduledCommit { @@ -39,6 +40,7 @@ public function __construct( public CarbonImmutable $scheduledAt, public ?CarbonImmutable $submittedAt, public string $status, + public ?User $author = null, ) {} /** @@ -62,6 +64,7 @@ public static function fromArray(array $data): self scheduledAt: Commit::date($data['scheduled_at'] ?? null) ?? CarbonImmutable::now(), submittedAt: Commit::date($data['submitted_at'] ?? null), status: is_string($status) && ($status === 'scheduled' || array_key_exists($status, self::Labels)) ? $status : 'scheduled', + author: is_array($data['author'] ?? null) ? User::fromArray([...$data['author'], 'type' => 'organization']) : null, ); } diff --git a/app/Devnull/PostAs.php b/app/Devnull/PostAs.php new file mode 100644 index 00000000..03902d77 --- /dev/null +++ b/app/Devnull/PostAs.php @@ -0,0 +1,106 @@ + + */ + public static function organizations(): array + { + return app(Account::class)->organizations(); + } + + /** + * The organization the commit goes out as, or null when it goes out as you. + */ + public static function author(?string $picked): ?User + { + if ($picked === null || $picked === '') { + return null; + } + + foreach (self::organizations() as $organization) { + if (strcasecmp($organization->username, $picked) === 0) { + return $organization; + } + } + + return null; + } + + /** + * Whether the composer shows whom it posts as: you're in an organization, or picked one you've left since. + */ + public static function offered(?string $picked): bool + { + return self::organizations() !== [] || ($picked !== null && $picked !== ''); + } + + /** + * The menu: you first, then your organizations, the one posting now ticked. $method is called with the handle + * picked, or '' for you. + * + * @return list + */ + public static function menu(User $me, ?User $author, string $method): array + { + return array_map(fn (User $identity): TopBarAction => NavAction::make('post-as-'.$identity->username) + ->label($identity->name.' (@'.$identity->username.')') + ->icon(...self::icon($identity, $author)) + ->press($method."('".($identity->isOrganization ? $identity->username : '')."')") + ->toElement() + ->ref('post-as-'.$identity->username), [$me, ...self::organizations()]); + } + + /** + * What the composer's avatar says to a screen reader. + */ + public static function label(User $me, ?User $author): string + { + return 'Posting as @'.($author ?? $me)->username.'. Choose who to post as'; + } + + /** + * The lane the composer's main button is drawn in: yours, or the organization's. + */ + public static function colour(User $me, ?User $author): string + { + return Lane::token(($author ?? $me)->lane()); + } + + /** + * A tick beside whoever posts now, and what each is beside the rest, as the menu has no room for avatars. + * + * @return array{ios: string, android: string} + */ + private static function icon(User $identity, ?User $author): array + { + $posting = $author === null ? ! $identity->isOrganization : $identity->isOrganization && $identity->username === $author->username; + $icon = match (true) { + $posting => Lucide::Check, + $identity->isOrganization => Lucide::Building2, + default => Lucide::UserRound, + }; + + return ['ios' => $icon->ios(), 'android' => $icon->android()]; + } +} diff --git a/app/Models/PendingWrite.php b/app/Models/PendingWrite.php index 917bc654..74fb060b 100644 --- a/app/Models/PendingWrite.php +++ b/app/Models/PendingWrite.php @@ -19,8 +19,8 @@ * $target is what it's about: the commit starred, or the Remotes thread a * message goes to. $payload is what's sent, and for a commit what the * composer needs to have it back: its body, what it replies to or quotes, - * its poll, its photos with their descriptions, and the draft it was - * stashed under. + * its poll, its photos with their descriptions, the draft it was stashed + * under, and the organization it goes out as, if not as you. * * It's queued until it goes, sending while it's on its way, and failed once * devnull turned it down, when a commit stays for you to edit and a message @@ -132,6 +132,34 @@ public function quotedCommitId(): ?string return is_string($this->payload['quoted_commit_id'] ?? null) ? $this->payload['quoted_commit_id'] : null; } + /** + * The handle of the organization a commit goes out as, or null when it goes out as you. + */ + public function author(): ?string + { + return is_string($this->payload['author'] ?? null) && $this->payload['author'] !== '' ? $this->payload['author'] : null; + } + + /** + * The organization a commit goes out as, as the composer knew it, for the staged commit to show it, or null. + */ + public function authorProfile(): ?User + { + $profile = $this->payload['author_profile'] ?? null; + + return $this->author() !== null && is_array($profile) ? User::fromArray([...$profile, 'type' => 'organization']) : null; + } + + /** + * The payload's part for who a commit goes out as: nothing for you, and an organization's handle and profile. + * + * @return array{author?: string, author_profile?: array} + */ + public static function authorPayload(?User $organization): array + { + return $organization === null ? [] : ['author' => $organization->username, 'author_profile' => $organization->toArray()]; + } + /** * The commit's poll as devnull takes it, or null with none. * @@ -200,12 +228,15 @@ public static function imagePayload(array $images): array } /** - * The commit a commit on its way stands in as, by you, at once: what you - * wrote and its photos, marked staged, as the web's git words go, until - * devnull has it and the real one takes its place. + * The commit a commit on its way stands in as, at once: by you, or by the + * organization it goes out as, with what you wrote and its photos, marked + * staged, as the web's git words go, until devnull has it and the real one + * takes its place. */ - public function stagedCommit(User $author): Commit + public function stagedCommit(User $me): Commit { + $author = $this->authorProfile() ?? $me; + return new Commit( id: self::StagedPrefix.$this->client_id, body: $this->body(), diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index f20c88a3..322153b7 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -13,6 +13,7 @@ use App\Devnull\Display; use App\Devnull\DraftImages; use App\Devnull\Outbox; +use App\Devnull\PostAs; use App\Devnull\ResponseCache; use App\Devnull\RowCache; use App\Devnull\Stash; @@ -62,6 +63,10 @@ * wrote is back in the bar, or in the sheet with its photos. Edit, on the * toast of a reply or a quote turned down after you'd left, opens its commit * here with it ($data['edit']). + * + * A member of a GitHub organization can reply as it, from the avatar at the + * start of the bar, as the web's reply composer does (see PostAs). The sheet + * takes the choice with the draft, and gives it back. */ class CommitDetail extends NativeComponent { @@ -129,6 +134,11 @@ class CommitDetail extends NativeComponent */ public array $replyImages = []; + /** + * The handle of the organization the reply bar posts as, or null for you (see PostAs). + */ + public ?string $replyAuthor = null; + /** * Whether the reply was stashed when the page opened, which the bar marks until you empty it or drop it. */ @@ -349,6 +359,7 @@ public function sendReply(): void 'images' => PendingWrite::imagePayload($this->replyImages), 'stash' => $this->replyStashName(), 'composer' => 'bar', + ...PendingWrite::authorPayload(PostAs::author($this->replyAuthor)), ]); if ($write === null) { @@ -364,6 +375,32 @@ public function sendReply(): void $this->sendFromOutbox($write); } + /** + * Post as, from the reply bar's avatar: an organization's handle, or '' for you. + */ + public function postAsInReply(string $handle = ''): void + { + $this->replyAuthor = PostAs::author($handle)?->username; + } + + /** + * The reply in the sheet starts as whoever the bar posts as. + */ + protected function sheetAuthorFor(string $view): ?string + { + return $view === 'reply' && $this->sheetCommit?->id === $this->id ? $this->replyAuthor : null; + } + + /** + * A choice made in the reply's sheet goes back to the bar with the draft. + */ + protected function sheetAuthorChanged(): void + { + if ($this->sheetView === 'reply' && $this->sheetCommit?->id === $this->id) { + $this->replyAuthor = $this->sheetAuthor; + } + } + /** * The reply bar suggests whom devnull suggests for a reply to this commit, the people in its thread first, as * the web's reply composer asks, and so does the composer sheet over it (see SuggestsMentions). @@ -535,6 +572,7 @@ private function takeFailedReply(PendingWrite $write): void { $this->reply = $write->body(); $this->replyImages = $write->images(); + $this->replyAuthor = $write->author(); $this->replyRestored = true; $this->focusReply = true; $this->updatedReply(); diff --git a/app/NativeComponents/Concerns/OpensCommitSheet.php b/app/NativeComponents/Concerns/OpensCommitSheet.php index 19ac3922..cae605a7 100644 --- a/app/NativeComponents/Concerns/OpensCommitSheet.php +++ b/app/NativeComponents/Concerns/OpensCommitSheet.php @@ -9,6 +9,7 @@ use App\Devnull\Data\StashedDraft; use App\Devnull\DraftImages; use App\Devnull\Outbox; +use App\Devnull\PostAs; use App\Devnull\ReportReason; use App\Devnull\ResponseCache; use App\Devnull\SignedRequest; @@ -56,6 +57,11 @@ * web's does: devnull's people for a new commit, a reply or a quote (see * SuggestsMentions). * + * A member of a GitHub organization can post as it instead, from the avatar + * over the field, as the web's Post as menu does, in a new commit, a quote or + * a reply (see PostAs). It starts as you each time, as the web's does, and + * the commit shows staged as the organization while it goes. + * * The sheet keeps its commit while it slides away, so it doesn't empty on the * way down, and lets go of it once iOS says it's gone, however it was closed. */ @@ -104,6 +110,11 @@ trait OpensCommitSheet */ public string $sheetBody = ''; + /** + * The handle of the organization the sheet posts as, or null for you (see PostAs). + */ + public ?string $sheetAuthor = null; + /** * Whether the sheet opened on a stashed draft, which it marks until you empty it or drop it. */ @@ -249,6 +260,24 @@ public function composeInSheet(): void $this->restoreSheetDraft(); } + /** + * Post as, from the sheet's avatar: an organization's handle, or '' for you. + */ + public function postAsInSheet(string $handle = ''): void + { + $this->sheetAuthor = PostAs::author($handle)?->username; + $this->sheetError = null; + $this->sheetAuthorChanged(); + } + + /** + * The sheet's author changed. A screen whose own composer handed it the draft keeps the choice too. + */ + protected function sheetAuthorChanged(): void + { + // + } + /** * The web's clock button, in a new commit's composer: it opens "Submit at" under the field, with no time picked, * or closes it, and the commit goes now again. Its photos or its poll go with it either way, as on the web. @@ -335,6 +364,7 @@ public function commitFromSheet(): void 'images' => PendingWrite::imagePayload($this->sheetImages), 'stash' => $stashName, 'composer' => $this->sheetView, + ...PendingWrite::authorPayload(PostAs::author($this->sheetAuthor)), ]); if ($write === null) { @@ -549,10 +579,11 @@ private function scheduleFromSheet(string $body, string $stashName): void $images = $this->sheetImages; $poll = $this->sheetPollPayload(); + $author = PostAs::author($this->sheetAuthor)?->username; $this->sendingSchedule = true; $this->sheetError = null; - $this->sendInBackground(fn (Client $devnull): SignedRequest => $devnull->signedScheduledCommit($body, $at, $images, $poll), function () use ($me, $stashName, $images): void { + $this->sendInBackground(fn (Client $devnull): SignedRequest => $devnull->signedScheduledCommit($body, $at, $images, $poll, $author), function () use ($me, $stashName, $images): void { $this->sendingSchedule = false; app(ResponseCache::class)->forget(Client::ScheduledCommitsPath); app(Stash::class)->put($me->id, $stashName, new StashedDraft); @@ -560,9 +591,13 @@ private function scheduleFromSheet(string $body, string $stashName): void $this->sheetImages = []; $this->closeCommitSheet(); Toasts::say(self::Scheduled); - }, function (string $message): void { + }, function (string $message) use ($author): void { $this->sendingSchedule = false; $this->sheetError = $message; + + if ($author !== null && method_exists($this, 'refreshUnreadNotifications')) { + $this->refreshUnreadNotifications(); + } }, timeout: $images === [] ? 30 : 120); } @@ -574,6 +609,7 @@ private function forgetCommitSheet(): void $this->reportReason = ''; $this->reportDetails = ''; $this->sheetBody = ''; + $this->sheetAuthor = null; $this->sheetRestored = false; $this->sheetError = null; $this->forgetMention('sheetBody'); @@ -621,16 +657,20 @@ protected function stashSheetDraft(): void } /** - * The sheet starts from its stashed draft, with its photos and poll. A + * The sheet starts from its stashed draft, with its photos and poll, as + * you, or as the screen's own composer had it (see sheetAuthorFor()). A * commit devnull turned down that was written under it comes back whole, - * and leaves the outbox: from here it's a draft again. + * as the organization it was to go out as, and leaves the outbox: from + * here it's a draft again. */ private function restoreSheetDraft(): void { $name = $this->sheetStashName(); $failed = $name === null ? null : app(Outbox::class)->failedDraft($name); + $this->sheetAuthor = $this->sheetAuthorFor($this->sheetView); if ($failed !== null) { + $this->sheetAuthor = $failed->author(); $this->takeFailedCommit($failed); } @@ -643,6 +683,14 @@ private function restoreSheetDraft(): void $this->sheetRestored = ! $draft->isEmpty(); } + /** + * Who the sheet starts out posting as for $view: you, unless the screen's own composer handed it a choice. + */ + protected function sheetAuthorFor(string $view): ?string + { + return null; + } + private function takeFailedCommit(PendingWrite $write): void { $poll = $write->poll(); diff --git a/app/NativeComponents/Concerns/RefreshesInBackground.php b/app/NativeComponents/Concerns/RefreshesInBackground.php index 600f5c37..a64a3a82 100644 --- a/app/NativeComponents/Concerns/RefreshesInBackground.php +++ b/app/NativeComponents/Concerns/RefreshesInBackground.php @@ -155,6 +155,7 @@ protected function refreshUnreadNotifications(): void app(Account::class)->remember($current->user); app(Account::class)->rememberPasteis($current->pasteis()); app(Account::class)->rememberRemotes($current->remotes); + app(Account::class)->rememberOrganizations($current->organizations); $this->takeTerms($current); } diff --git a/app/NativeComponents/Concerns/SyncsOutbox.php b/app/NativeComponents/Concerns/SyncsOutbox.php index 52b9a63e..eeb43c7a 100644 --- a/app/NativeComponents/Concerns/SyncsOutbox.php +++ b/app/NativeComponents/Concerns/SyncsOutbox.php @@ -42,11 +42,11 @@ * - A star comes back off the commit, here and in every kept copy, and the * toast offers Retry. * - A commit or a reply leaves the screen, and its draft goes back where you - * wrote it: the text in its stash, and the photos and poll with the failed - * write in the outbox, for the composer to take when it opens. The screen - * that owns the composer opens it again with the lot. Anywhere else the - * toast offers Edit, which opens it here when it can, or the commit the - * reply or quote was for. + * wrote it: the text in its stash, and the photos, poll and organization + * it was to go out as with the failed write in the outbox, for the + * composer to take when it opens. The screen that owns the composer opens + * it again with the lot. Anywhere else the toast offers Edit, which opens + * it here when it can, or the commit the reply or quote was for. * - A message stays in its thread as rejected, with its Retry, and the toast * offers Retry too. Its photos or voice note stay on the phone with it * until it goes. @@ -310,6 +310,7 @@ private function turnDownCommit(PendingWrite $write, string $error, bool $reopen } $this->showCommitTurnedDown($write); + $this->checkOrganizations($write); if ($reopen && $this->reopenFailedCommit($write)) { Toasts::failed($error); @@ -320,6 +321,18 @@ private function turnDownCommit(PendingWrite $write, string $error, bool $reopen Toasts::failed($error, ['label' => 'Edit', 'id' => 'edit', 'data' => ['write' => $write->id]]); } + /** + * A commit that was to go out as an organization asks devnull which ones + * you're still in, since leaving it is a reason devnull turns one down. Its + * composer then posts as you, as the web's does (see PostAs). + */ + private function checkOrganizations(PendingWrite $write): void + { + if ($write->author() !== null && method_exists($this, 'refreshUnreadNotifications')) { + $this->refreshUnreadNotifications(); + } + } + /** * Signs a write as devnull takes it, here on the UI thread. */ @@ -333,8 +346,8 @@ private function signWrite(PendingWrite $write): SignedRequest PendingWrite::Unstar => $devnull->signedWrite('DELETE', $commit), PendingWrite::Message => $devnull->signedMessage((string) $write->target, $write->body(), $write->client_id, $write->replyToId(), $write->images(), $write->voice()), default => $write->images() === [] - ? $devnull->signedCommit($write->body(), $write->parentId(), $write->quotedCommitId(), $write->poll()) - : $devnull->signedCommitWithImages($write->body(), $write->images(), $write->parentId(), $write->quotedCommitId()), + ? $devnull->signedCommit($write->body(), $write->parentId(), $write->quotedCommitId(), $write->poll(), $write->author()) + : $devnull->signedCommitWithImages($write->body(), $write->images(), $write->parentId(), $write->quotedCommitId(), $write->author()), }; } diff --git a/app/NativeComponents/Notifications.php b/app/NativeComponents/Notifications.php index 58b7dd7b..f22944de 100644 --- a/app/NativeComponents/Notifications.php +++ b/app/NativeComponents/Notifications.php @@ -270,13 +270,16 @@ public function open(string $id): void $commitId = $notification->commitToOpen(); - $this->openInTab($commitId !== null - ? '/commits/'.$commitId - : '/users/'.$notification->actor->username); + $this->openInTab(match (true) { + $commitId !== null => '/commits/'.$commitId, + $notification->actor->isOrganization => '/organizations/'.rawurlencode($notification->actor->username), + default => '/users/'.$notification->actor->username, + }); } /** - * Names and avatars open their profile independently of the notification's commit. + * Names and avatars open their profile independently of the notification's commit: an organization's page for + * one that replied, quoted or mentioned you. */ public function openActor(string $username): void { @@ -287,7 +290,9 @@ public function openActor(string $username): void foreach ([$notification->actor, ...$notification->actors] as $actor) { if ($username !== '' && $actor->username === $username) { - $this->openInTab('/users/'.$actor->username, ['user' => $actor]); + $actor->isOrganization + ? $this->openInTab('/organizations/'.rawurlencode($actor->username)) + : $this->openInTab('/users/'.$actor->username, ['user' => $actor]); return; } diff --git a/app/NativeComponents/Onboarding.php b/app/NativeComponents/Onboarding.php index 2b3cef0a..77914150 100644 --- a/app/NativeComponents/Onboarding.php +++ b/app/NativeComponents/Onboarding.php @@ -272,6 +272,7 @@ private function signInWithExistingKey(): void app(Account::class)->rememberUnreadNotifications($current->unreadNotificationsCount); app(Account::class)->rememberPasteis($current->pasteis()); app(Account::class)->rememberRemotes($current->remotes); + app(Account::class)->rememberOrganizations($current->organizations); app(Account::class)->rememberTermsToAccept($current->termsToAccept()); $this->keepProfile($current->user); $this->replace($current->termsToAccept() === null ? '/log' : AcceptTerms::Path); diff --git a/app/NativeComponents/ThisDevice.php b/app/NativeComponents/ThisDevice.php index 25c2c46c..dd17af64 100644 --- a/app/NativeComponents/ThisDevice.php +++ b/app/NativeComponents/ThisDevice.php @@ -989,6 +989,7 @@ private function takeMe(array $json): void app(Account::class)->rememberUnreadNotifications($current->unreadNotificationsCount); app(Account::class)->rememberPasteis($current->pasteis()); app(Account::class)->rememberRemotes($current->remotes); + app(Account::class)->rememberOrganizations($current->organizations); app(ResponseCache::class)->meChanged($json); $this->takeTerms($current); } diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index c633a3d0..d73c27f8 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -120,10 +120,14 @@ is bare and the field is a Liquid Glass plate instead, the way the HIG floats controls over content; the hairline stays as a clear 1pt so the bar keeps the height Display::ReplyBarHeight counts on. + A member of a GitHub organization has the web's Post as at the start of the row: the avatar of whoever the + reply goes out as, which opens the menu (see PostAs), and Reply in that one's lane. + The expand button opens the reply in the composer sheet, which has the photos and preview the bar has no room for. It sits where partials/composer-plate puts a composer's tools: inside the plate on iOS, ahead of the field on Android. --}} + @php($replyPostingMe = app(\App\Devnull\Account::class)->user()) @@ -137,13 +141,16 @@ @include('native.partials.mention-suggestions', ['field' => 'reply', 'label' => 'Mention a developer']) + @if ($replyPostingMe !== null && \App\Devnull\PostAs::offered($replyAuthor)) + @include('native.partials.post-as', ['ref' => 'reply-post-as', 'me' => $replyPostingMe, 'picked' => $replyAuthor, 'method' => 'postAsInReply', 'size' => 32]) + @endif @include('native.partials.composer-plate', [ 'ref' => 'reply', 'field' => 'native.partials.reply-field', 'tools' => [['ref' => 'reply-expand', 'icon' => \App\Icons\Lucide::Maximize2, 'label' => 'Reply with photos or a preview', 'press' => "replyInSheet('{$commit->id}')"]], ]) @include('native.partials.body-counter', ['body' => $reply, 'ref' => 'reply-budget']) - Reply + Reply @if (\App\Devnull\Data\CommitBody::hasOversizedUrl($reply)) Each link must not be greater than {{ \App\Devnull\Data\BodyLink::MaxLength }} characters. diff --git a/resources/views/native/partials/commit-sheet.blade.php b/resources/views/native/partials/commit-sheet.blade.php index 97a5b0b1..9a3cb463 100644 --- a/resources/views/native/partials/commit-sheet.blade.php +++ b/resources/views/native/partials/commit-sheet.blade.php @@ -19,6 +19,10 @@ field, its placeholder in it, and Open issue (the same check) in Commit's place in the bar. Opened, the sheet says so, with View issue and Done. + A member of a GitHub organization sees who the commit goes out as above the field, as the web's composer shows its + avatar: theirs, or the organization's, with its name and handle. A tap opens Post as (see PostAs). Commit is then + filled with the organization's lane. An issue always comes from you, so it hides there. + A commit's page opens its reply here too, as "Reply to @handle", with the commit being answered as a static card over the field, for the photos and the preview its reply bar has no room for. Commit says Reply there. @@ -51,6 +55,8 @@ @php($quoting = $sheetView === 'quote') @php($replying = $sheetView === 'reply') @php($issueCommand = $sheetIssue === null ? null : \App\Devnull\IssueCommand::from($sheetIssue)) + @php($postingMe = app(\App\Devnull\Account::class)->user()) + @php($postsAs = $postingMe !== null && ! $issueCommand && \App\Devnull\PostAs::offered($sheetAuthor)) @php($canCommit = \App\Devnull\Data\Draft::canCommit($sheetBody, $sheetImages, $replying ? null : $sheetPoll)) @@ -60,12 +66,18 @@ @include('native.partials.sheet-bar-button', ['ref' => 'sheet-open-issue', 'icon' => \App\Icons\Lucide::Check, 'label' => 'Open issue', 'main' => true, 'loading' => $openingIssue, 'press' => $openingIssue || ! \App\Devnull\IssueCommand::fits($sheetBody) ? null : 'openIssueFromSheet']) @else @php($schedulingThis = $scheduling && $sheetView === 'compose') - @include('native.partials.sheet-bar-button', ['ref' => 'sheet-commit', 'icon' => \App\Icons\Lucide::Check, 'label' => match (true) { $schedulingThis => 'Schedule commit', $replying => 'Reply', default => 'Commit' }, 'main' => true, 'loading' => $sendingSchedule, 'press' => $sendingSchedule || ! $canCommit || ($schedulingThis && ! $hasScheduledTime) ? null : 'commitFromSheet']) + @include('native.partials.sheet-bar-button', ['ref' => 'sheet-commit', 'icon' => \App\Icons\Lucide::Check, 'label' => match (true) { $schedulingThis => 'Schedule commit', $replying => 'Reply', default => 'Commit' }, 'main' => true, 'mainColour' => $postingMe === null ? $myColour : \App\Devnull\PostAs::colour($postingMe, \App\Devnull\PostAs::author($sheetAuthor)), 'loading' => $sendingSchedule, 'press' => $sendingSchedule || ! $canCommit || ($schedulingThis && ! $hasScheduledTime) ? null : 'commitFromSheet']) @endif + @if ($postsAs) + + @include('native.partials.post-as', ['ref' => 'sheet-post-as', 'me' => $postingMe, 'picked' => $sheetAuthor, 'method' => 'postAsInSheet', 'size' => 36, 'withName' => true]) + + @endif + @if ($sheetError) {{ $sheetError }} @endif diff --git a/resources/views/native/partials/dashed-ring.blade.php b/resources/views/native/partials/dashed-ring.blade.php index 97d43a19..67e9bf36 100644 --- a/resources/views/native/partials/dashed-ring.blade.php +++ b/resources/views/native/partials/dashed-ring.blade.php @@ -1,4 +1,6 @@ {{-- - A 2pt ring in dashes of $lane's colour, as the web's `border-2 border-dashed rounded-full`, $size across. + A 2pt ring in dashes of $lane's colour, as the web's `border-2 border-dashed rounded-full`, $size across. $rounded + makes it a rounded square instead, around an organization. --}} - +@php($rounded ??= 'rounded-full') + diff --git a/resources/views/native/partials/post-as.blade.php b/resources/views/native/partials/post-as.blade.php new file mode 100644 index 00000000..64f9d176 --- /dev/null +++ b/resources/views/native/partials/post-as.blade.php @@ -0,0 +1,28 @@ +{{-- + Who a composer posts as (see PostAs): the avatar of whoever it is now, round for you and a rounded square for an + organization, with a small chevron on its corner, as the web's Post as button draws it. A tap opens the menu of you + and your organizations, which calls $method with the handle picked, or '' for you. With $withName, their name and + handle follow the avatar, for the sheet, which has the room. + + $picked is the handle the composer holds. An organization you've left since posts as you, so your avatar shows. +--}} +@php($size ??= 32) +@php($withName ??= false) +@php($author = \App\Devnull\PostAs::author($picked)) +@php($identity = $author ?? $me) + + + + @include('native.partials.avatar', ['user' => $identity, 'size' => $size]) + + + + + @if ($withName) + + {{ $identity->name }} + {{ $identity->handle() }} + + @endif + + diff --git a/resources/views/native/partials/rail-avatar.blade.php b/resources/views/native/partials/rail-avatar.blade.php index e5055af0..d000bc54 100644 --- a/resources/views/native/partials/rail-avatar.blade.php +++ b/resources/views/native/partials/rail-avatar.blade.php @@ -13,8 +13,8 @@ @php($position ??= '') @php($live = ! $staged && $user->isLive()) @if ($staged) - - @include('native.partials.dashed-ring', ['size' => 48, 'lane' => $lane]) + + @include('native.partials.dashed-ring', ['size' => 48, 'lane' => $lane, 'rounded' => $user->isOrganization ? 'rounded-lg' : 'rounded-full']) @include('native.partials.avatar', ['user' => $user, 'size' => 40]) diff --git a/resources/views/native/partials/sheet-bar-button.blade.php b/resources/views/native/partials/sheet-bar-button.blade.php index a554285b..1dac031a 100644 --- a/resources/views/native/partials/sheet-bar-button.blade.php +++ b/resources/views/native/partials/sheet-bar-button.blade.php @@ -1,16 +1,18 @@ {{-- A round button in a sheet's bar, as Apple draws a sheet's cross and check: the same 44pt circle on both platforms. - It's glass on iOS and a tonal circle on Android, or filled with your colour as the bar's main button ($main). + It's glass on iOS and a tonal circle on Android, or filled with your colour as the bar's main button ($main), or + with $mainColour's, the lane of the organization a composer posts as. Without $press it's drawn muted, and not as a button, as a disabled button would be. Its action checks again anyway. $loading swaps the icon for a spinner in the same circle. --}} @php($main ??= false) +@php($mainColour ??= $myColour) @php($loading ??= false) @php($hint ??= null) @php($filled = $main && ($press !== null || $loading)) -@php($circle = 'rounded-full '.($filled ? 'bg-theme-'.$myColour : 'android:bg-theme-surface-variant ios:glass'.($press === null ? '' : ':interactive'))) -@php($iconColour = $filled ? 'text-theme-on-'.$myColour : ($press === null ? 'text-theme-ink-muted' : 'text-theme-ink')) +@php($circle = 'rounded-full '.($filled ? 'bg-theme-'.$mainColour : 'android:bg-theme-surface-variant ios:glass'.($press === null ? '' : ':interactive'))) +@php($iconColour = $filled ? 'text-theme-on-'.$mainColour : ($press === null ? 'text-theme-ink-muted' : 'text-theme-ink')) @if ($press !== null) diff --git a/resources/views/native/scheduled-commits.blade.php b/resources/views/native/scheduled-commits.blade.php index 06f07ac1..3dbf2dda 100644 --- a/resources/views/native/scheduled-commits.blade.php +++ b/resources/views/native/scheduled-commits.blade.php @@ -47,6 +47,13 @@ {{ $item->label($now) }} {{ Display::scheduleTime($item->scheduledAt, $timezone) }} + @if ($item->author) + {{-- The organization it goes out as, as the web's list shows it under the time. --}} + + @include('native.partials.avatar', ['user' => $item->author, 'size' => 16]) + As {{ $item->author->handle() }} + + @endif @if ($item->isWaiting()) @php($when = Display::scheduleTime($item->scheduledAt, $timezone)) diff --git a/tests/Feature/Screens/NotificationsTest.php b/tests/Feature/Screens/NotificationsTest.php index b160b4ef..06cef232 100644 --- a/tests/Feature/Screens/NotificationsTest.php +++ b/tests/Feature/Screens/NotificationsTest.php @@ -84,6 +84,13 @@ function ringColour(TestableComponent $screen, string $id): ?string Native::visit('/notifications')->tap('group-n-starred')->tap('group-actor-older')->assertNavigatedTo('/notifications/users/linus'); }); +it('opens the page of an organization that replied to you, from its name', function () { + $organization = [...personJson('dev-null-sh', '/dev/null'), 'type' => 'organization']; + fakeApi(['GET /api/v1/notifications' => [inboxJson([notificationJson('replied', ['actor' => $organization, 'actors' => [$organization]])])]]); + + Native::visit('/notifications')->tap('actor-name-n-replied')->assertNavigatedTo('/notifications/organizations/dev-null-sh'); +}); + it('does not navigate to an actor absent from the displayed notifications', function () { fakeApi(['GET /api/v1/notifications' => [inboxJson([])]]); Native::visit('/notifications')->call('openActor', 'nobody')->assertNoNavigation(); diff --git a/tests/Feature/Screens/PostAsTest.php b/tests/Feature/Screens/PostAsTest.php new file mode 100644 index 00000000..ed22582f --- /dev/null +++ b/tests/Feature/Screens/PostAsTest.php @@ -0,0 +1,312 @@ + 'http://devnull.test']); + signIn(); +}); + +/** + * An organization as `GET /me` lists one you're a member of. + * + * @param array $overrides + * @return array + */ +function memberOrganizationJson(array $overrides = []): array +{ + return [ + 'type' => 'organization', + 'id' => '0199e5c4-0000-7000-8000-0000000000aa', + 'role' => 'admin', + 'handle' => 'dev-null-sh', + 'name' => '/dev/null', + 'avatar_url' => 'https://avatars.githubusercontent.com/u/9?v=4', + 'bio' => null, + 'location' => null, + 'website' => null, + 'github_url' => 'https://github.com/dev-null-sh', + 'html_url' => 'http://devnull.test/@dev-null-sh', + 'lane' => null, + ...$overrides, + ]; +} + +/** + * Makes you a member of these organizations, as the last `GET /me` said. + * + * @param list> $organizations + */ +function memberOf(array $organizations): void +{ + app(Account::class)->rememberOrganizations(CurrentUser::fromArray(currentUserJson(['organizations' => $organizations]))->organizations); +} + +/** + * The Log with its composer open in the sheet, devnull answering a new commit with $answer. + * + * @param array{0: mixed, 1?: int}|null $answer + * @param array $extra + */ +function composeOnLogAs(?array $answer = null, array $extra = []): TestableComponent +{ + fakeApi([ + 'GET /api/v1/log/following' => [pageJson([commitJson(['id' => 'c1', 'body' => 'An older commit', 'author' => userJson(['id' => 'u2', 'handle' => 'ada'])])])], + 'POST /api/v1/commits' => $answer ?? [['data' => commitJson(['id' => '0199e5c4-2222-7000-8000-00000000cafe', 'body' => 'From the org.', 'author' => memberOrganizationJson()])], 201], + ...$extra, + ]); + + return Native::visit('/log', platform: 'ios')->press('composeInSheet'); +} + +/** + * The JSON of the commits sent to devnull. + * + * @return list> + */ +function commitsSent(): array +{ + return collect(Http::recorded()) + ->filter(fn (array $sent): bool => $sent[0]->method() === 'POST' && str_ends_with(parse_url($sent[0]->url(), PHP_URL_PATH), '/commits')) + ->map(fn (array $sent): array => json_decode($sent[0]->body(), true)) + ->values() + ->all(); +} + +it('reads the organizations you can post as from GET /me, oldest membership first', function () { + $current = CurrentUser::fromArray(currentUserJson(['organizations' => [ + memberOrganizationJson(), + memberOrganizationJson(['id' => 'o2', 'handle' => 'nativephp', 'name' => 'NativePHP', 'role' => 'member', 'lane' => 5, 'type' => 'user']), + ['handle' => ''], + ]])); + + expect(array_map(fn (User $organization): array => [$organization->username, $organization->isOrganization, $organization->lane()], $current->organizations)) + ->toBe([['dev-null-sh', true, 'primary'], ['nativephp', true, 5]]) + ->and(CurrentUser::fromArray(currentUserJson())->organizations)->toBeNull(); +}); + +it('keeps the organizations GET /me lists, and what it had when devnull is too old to say', function () { + fakeApi([ + 'GET /api/v1/log/following' => [pageJson([])], + 'GET /api/v1/me' => [currentUserJson(['organizations' => [memberOrganizationJson()]])], + ]); + + Native::visit('/log'); + + expect(array_map(fn (User $organization): string => $organization->username, app(Account::class)->organizations()))->toBe(['dev-null-sh']); + + app(Account::class)->rememberOrganizations(null); + + expect(app(Account::class)->organizations())->toHaveCount(1); + + app(Account::class)->forget(); + + expect(app(Account::class)->organizations())->toBe([]); +}); + +it('shows no Post as to someone in no organization, as the web hides it', function () { + composeOnLogAs() + ->assertSee('New commit') + ->assertMissingElement('pressable', fn (array $node): bool => ($node['ref'] ?? null) === 'sheet-post-as'); +}); + +it('starts the composer as you, and lists you and your organizations under Post as', function () { + memberOf([memberOrganizationJson(), memberOrganizationJson(['id' => 'o2', 'handle' => 'nativephp', 'name' => 'NativePHP', 'role' => 'member', 'lane' => 5])]); + + $screen = composeOnLogAs(); + + expect(nodeByRef($screen, 'sheet-post-as-name')['props']['text'])->toBe('Local Dev') + ->and(nodeByRef($screen, 'sheet-post-as-handle')['props']['text'])->toBe('@local_dev') + ->and(nodeByRef($screen, 'sheet-post-as')['props']['a11y_label'])->toBe('Posting as @local_dev. Choose who to post as') + ->and(array_map(fn (array $item): array => [$item[0], $item[1]], menuItems($screen, 'sheet-post-as')))->toBe([ + ['post-as-local_dev', 'Local Dev (@local_dev)'], + ['post-as-dev-null-sh', '/dev/null (@dev-null-sh)'], + ['post-as-nativephp', 'NativePHP (@nativephp)'], + ]); + + $screen->call('postAsInSheet', 'nativephp'); + + expect(nodeByRef($screen, 'sheet-post-as-name')['props']['text'])->toBe('NativePHP') + ->and(nodeByRef($screen, 'sheet-post-as-handle')['props']['text'])->toBe('@nativephp') + ->and(nodeByRef($screen, 'sheet-post-as')['props']['a11y_label'])->toBe('Posting as @nativephp. Choose who to post as'); + + $screen->input('sheet-body', 'a'); + $organizationFill = sheetButtonCircle($screen, 'sheet-commit')['style']['bg_color']; + + // Commit is filled with the organization's lane rather than yours. + $screen->call('postAsInSheet', ''); + + expect(sheetButtonCircle($screen, 'sheet-commit')['style']['bg_color'])->not->toBe($organizationFill); +}); + +it('commits as the organization picked, and shows it staged as the organization', function () { + memberOf([memberOrganizationJson()]); + holdRefreshes(); + + $screen = composeOnLogAs() + ->call('postAsInSheet', 'dev-null-sh') + ->input('sheet-body', 'From the org.') + ->tap('sheet-commit'); + + $staged = $screen->instance()->commits[0]; + + expect($staged->isStaged())->toBeTrue() + ->and($staged->author->username)->toBe('dev-null-sh') + ->and($staged->author->isOrganization)->toBeTrue() + ->and(PendingWrite::query()->sole()->author())->toBe('dev-null-sh'); + + finishRefreshes($screen); + + expect(commitsSent())->toBe([['body' => 'From the org.', 'author' => 'dev-null-sh']]) + ->and($screen->instance()->commits[0]->author->username)->toBe('dev-null-sh'); +}); + +it('commits as you again once you pick yourself, and ignores an organization you are not in', function () { + memberOf([memberOrganizationJson()]); + + composeOnLogAs() + ->call('postAsInSheet', 'laravel') + ->assertSet('sheetAuthor', null) + ->call('postAsInSheet', 'dev-null-sh') + ->call('postAsInSheet', '') + ->input('sheet-body', 'From me.') + ->tap('sheet-commit'); + + expect(commitsSent())->toBe([['body' => 'From me.']]); +}); + +it('quotes as the organization picked', function () { + memberOf([memberOrganizationJson()]); + fakeApi([ + 'GET /api/v1/log/following' => [pageJson([commitJson(['id' => 'c1', 'body' => 'Quote me', 'author' => userJson(['id' => 'u2', 'handle' => 'ada'])])])], + 'POST /api/v1/commits' => [['data' => commitJson(['id' => 'q1', 'body' => 'Our take', 'quoted_commit_id' => 'c1', 'author' => memberOrganizationJson()])], 201], + ]); + + $screen = Native::visit('/log', platform: 'ios')->call('quoteCommit', 'c1'); + + expect(rendersRef($screen, 'sheet-post-as'))->toBeTrue(); + + $screen->call('postAsInSheet', 'dev-null-sh')->input('sheet-body', 'Our take')->tap('sheet-commit'); + + expect(commitsSent())->toBe([['body' => 'Our take', 'quoted_commit_id' => 'c1', 'author' => 'dev-null-sh']]); +}); + +it('replies from the commit page as the organization picked in the bar', function () { + memberOf([memberOrganizationJson()]); + fakeApi([ + 'GET /api/v1/commits/c2' => [commitPageJson(commitJson(['id' => 'c2', 'body' => 'The focused commit']))], + 'GET /api/v1/commits/c2/replies' => [pageJson([])], + 'GET /api/v1/commits/c2/related' => [['data' => []]], + 'POST /api/v1/commits' => [['data' => replyJson(['id' => 'r9', 'parent_id' => 'c2', 'body' => 'From the org', 'author' => memberOrganizationJson()])], 201], + ]); + + $screen = Native::visit('/log/commits/c2'); + + expect(childRefs($screen, 'reply-row')[0])->toBe('reply-post-as') + ->and(array_column(menuItems($screen, 'reply-post-as'), 0))->toBe(['post-as-local_dev', 'post-as-dev-null-sh']); + + $screen->call('postAsInReply', 'dev-null-sh') + ->input('reply-input', 'From the org') + ->tap('send-reply') + ->assertSee('From the org'); + + expect(commitsSent())->toBe([['body' => 'From the org', 'parent_id' => 'c2', 'author' => 'dev-null-sh']]) + ->and($screen->instance()->replies[0]->author->username)->toBe('dev-null-sh'); +}); + +it('hands the bar\'s choice to the reply sheet and takes the sheet\'s back', function () { + memberOf([memberOrganizationJson()]); + fakeApi([ + 'GET /api/v1/commits/c2' => [commitPageJson(commitJson(['id' => 'c2', 'body' => 'The focused commit']))], + 'GET /api/v1/commits/c2/replies' => [pageJson([])], + 'GET /api/v1/commits/c2/related' => [['data' => []]], + 'POST /api/v1/commits' => [['data' => replyJson(['id' => 'r9', 'parent_id' => 'c2', 'body' => 'Sheet reply'])], 201], + ]); + + $screen = Native::visit('/log/commits/c2', platform: 'ios') + ->call('postAsInReply', 'dev-null-sh') + ->call('replyInSheet', 'c2') + ->assertSet('sheetAuthor', 'dev-null-sh'); + + $screen->call('postAsInSheet', '')->assertSet('replyAuthor', null); + $screen->call('postAsInSheet', 'dev-null-sh')->input('sheet-body', 'Sheet reply')->tap('sheet-commit'); + + expect(commitsSent())->toBe([['body' => 'Sheet reply', 'parent_id' => 'c2', 'author' => 'dev-null-sh']]); +}); + +it('puts a commit turned down for leaving the organization back in the sheet, asks devnull again, and then posts as you', function () { + memberOf([memberOrganizationJson()]); + $refused = 'You can only post as an organization you are a member of.'; + $routes = [ + 'GET /api/v1/log/following' => [pageJson([commitJson(['id' => 'c1'])])], + 'GET /api/v1/me' => [currentUserJson(['organizations' => [memberOrganizationJson()]])], + ]; + serveApi($routes); + + $screen = Native::visit('/log', platform: 'ios') + ->press('composeInSheet') + ->call('postAsInSheet', 'dev-null-sh') + ->input('sheet-body', 'From the org.'); + + // You were taken out of the organization since the app last asked. + serveApi([ + ...$routes, + 'POST /api/v1/commits' => [['message' => $refused, 'errors' => ['author' => [$refused]]], 422], + 'GET /api/v1/me' => [currentUserJson(['organizations' => []])], + ]); + + $screen->tap('sheet-commit') + ->assertNativeCalled('ToastKit.Show', fn (array $params): bool => $params['message'] === $refused && $params['variant'] === 'error'); + + expect(commitsSent())->toBe([['body' => 'From the org.', 'author' => 'dev-null-sh']]) + ->and(app(Account::class)->organizations())->toBe([]); + + // The sheet opens on the draft again, as the organization picked, which now posts as you. + $screen->dismissSheet('sheet'); + + expect($screen->instance()) + ->sheetOpen->toBeTrue() + ->sheetBody->toBe('From the org.') + ->sheetAuthor->toBe('dev-null-sh'); + expect(nodeByRef($screen, 'sheet-post-as-handle')['props']['text'])->toBe('@local_dev') + ->and(menuItems($screen, 'sheet-post-as'))->toHaveCount(1); + + serveApi([...$routes, 'POST /api/v1/commits' => [['data' => commitJson(['id' => 'c9', 'body' => 'From the org.'])], 201]]); + $screen->tap('sheet-commit'); + + expect(commitsSent())->toBe([['body' => 'From the org.', 'author' => 'dev-null-sh'], ['body' => 'From the org.']]); +}); + +it('schedules a commit as the organization picked, and lists it as the organization', function () { + phoneIn('Europe/Lisbon'); + $this->travelTo(CarbonImmutable::parse('2026-10-19 15:30:00', 'UTC')); + memberOf([memberOrganizationJson()]); + + composeOnLogAs(extra: [ + 'POST /api/v1/scheduled-commits' => [['data' => scheduledCommitJson(['author' => memberOrganizationJson()])], 201], + 'GET /api/v1/scheduled-commits' => [scheduledPageJson([scheduledCommitJson(['author' => memberOrganizationJson()]), scheduledCommitJson(['id' => 's2'])])], + ]) + ->call('postAsInSheet', 'dev-null-sh') + ->input('sheet-body', 'Shipping this tomorrow.') + ->tap('sheet-schedule') + ->pickDateTime('scheduled-at', '2026-10-20T09:00') + ->tap('sheet-commit'); + + Http::assertSent(fn (Request $request): bool => $request->method() === 'POST' + && str_ends_with($request->url(), '/scheduled-commits') + && $request['author'] === 'dev-null-sh'); + + $list = Native::visit('/log/scheduled'); + + expect(rendersRef($list, 'scheduled-author-0199e5c4-3333-7000-8000-00000000da7e'))->toBeTrue() + ->and(rendersRef($list, 'scheduled-author-s2'))->toBeFalse(); + $list->assertSee('As @dev-null-sh'); +}); From 259fc2142ef024a4afe27f986b98a0c90e727be3 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Wed, 18 Nov 2026 00:13:30 +0000 Subject: [PATCH 04/46] Fade the thread out above the composer, drop the box and the fold hint The composer bar was a bordered box on Liquid Glass tinted at 70%, which looked heavy, with a hard top edge. Now the field and its row sit straight on the surface, and a 28pt gradient over the foot of the thread fades it out above the bar on both platforms. Android gets the same fade, since it lies over the scroll view rather than relying on a blur. EDGE's gradient stops have no dark companion, so the stops come from theme('surface') and the screen draws again on AppearanceChanged. "folded in feeds" (and the FoldVertical icon before it) is gone from body-counter, so nothing in the composers says a long commit gets folded. The countdown near the limit stays. composer-box takes $lead and $trail partials for the start and end of its row, in place of $counter, so the commit page can put the drop and a "post as" avatar there. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Data/Commit.php | 19 -------- app/Devnull/Display.php | 25 ++++++++-- app/Icons/Lucide.php | 2 - .../Concerns/RedrawsOnAppearanceChange.php | 19 ++++++++ app/NativeComponents/Conversation.php | 15 +++--- resources/icons/fold-vertical.svg | 1 - resources/views/native/conversation.blade.php | 21 +++++---- .../native/partials/body-counter.blade.php | 17 +------ .../native/partials/composer-box.blade.php | 34 ++++++++------ .../native/partials/composer-fade.blade.php | 8 ++++ tests/Feature/Screens/ConversationTest.php | 11 +++-- tests/Feature/Screens/RemotesComposerTest.php | 47 +++++++++++++++---- 12 files changed, 136 insertions(+), 83 deletions(-) create mode 100644 app/NativeComponents/Concerns/RedrawsOnAppearanceChange.php delete mode 100644 resources/icons/fold-vertical.svg create mode 100644 resources/views/native/partials/composer-fade.blade.php diff --git a/app/Devnull/Data/Commit.php b/app/Devnull/Data/Commit.php index 6d19fdde..941f4ce3 100644 --- a/app/Devnull/Data/Commit.php +++ b/app/Devnull/Data/Commit.php @@ -34,13 +34,6 @@ */ public const int CountFrom = 200; - /** - * A list shows a body longer than this, or longer than PreviewLines lines, as its start and "Show more". - */ - public const int PreviewLength = 280; - - public const int PreviewLines = 8; - /** * The status of a commit you made that devnull doesn't have yet, which * stands in for it on the screen (see PendingWrite::stagedCommit()). @@ -211,18 +204,6 @@ public static function fits(string $body): bool && ! CommitBody::hasOversizedUrl($body); } - /** - * Whether a list would show only the start of a body, as the web's composer - * works it out: more than PreviewLength characters or PreviewLines lines, - * once blank lines in a run are counted as one. - */ - public static function isFoldedInLists(string $body): bool - { - $normalized = CommitBody::normalize($body); - - return mb_strlen($normalized) > self::PreviewLength || count(explode("\n", $normalized)) > self::PreviewLines; - } - /** * This commit with $update applied to the replies under it, as a feed draws them. * diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index d8da90be..d9b611a3 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -29,10 +29,15 @@ final class Display public const int ReplyBarStashLabelHeight = 28; /** - * A bar holding partials/composer-box with one line of draft, as drawn on an iPhone: the bar's hairline and - * padding, then the box with its field over the row of tools and the send button. + * A bar holding partials/composer-box with one line of draft, as drawn on an iPhone: the bar's padding, then the + * field over the row of tools and the send button. */ - public const int ComposerBoxBarHeight = 97; + public const int ComposerBoxBarHeight = 94; + + /** + * The fade over the foot of a screen, just above its composer bar (see partials/composer-fade). + */ + public const int ComposerFadeHeight = 28; /** * About how many characters fit on a line of the box's field. It runs the width of the box, so more fit than @@ -251,6 +256,20 @@ public static function composerBoxGrowth(string $draft): int return (min(self::ReplyBarMaxLines, self::lineCount($draft, self::ComposerBoxCharactersPerLine)) - 1) * self::ReplyBarLineHeight; } + /** + * The fade's classes (see partials/composer-fade): a gradient down from see-through to the surface, where the bar + * starts. EDGE takes a gradient's stops as they are, without the dark companion a theme colour gets, so the stops + * are the surface of the appearance the phone is in now, and a screen with the fade draws again when that + * changes (see RedrawsOnAppearanceChange). It climbs to 70% of the surface by halfway, so what's under it has + * mostly faded before it reaches the bar. + */ + public static function composerFade(): string + { + $surface = strtolower((string) theme('surface', '#ffffff')); + + return "bg-gradient-to-b from-{$surface}/0 via-{$surface}/70 to-{$surface}"; + } + /** * About how many lines some text wraps to where $perLine characters fit on one, counting each of its own lines. */ diff --git a/app/Icons/Lucide.php b/app/Icons/Lucide.php index b6ea5bb9..06a56187 100644 --- a/app/Icons/Lucide.php +++ b/app/Icons/Lucide.php @@ -49,7 +49,6 @@ enum Lucide case UserPlus; case UserCheck; case AtSign; - case FoldVertical; case Award; case Ellipsis; case Flag; @@ -189,7 +188,6 @@ public function custom(bool $filled = false): string self::UserPlus => 'user-plus', self::UserCheck => 'user-check', self::AtSign => 'at-sign', - self::FoldVertical => 'fold-vertical', self::Award => 'award', self::Ellipsis => 'ellipsis', self::Flag => 'flag', diff --git a/app/NativeComponents/Concerns/RedrawsOnAppearanceChange.php b/app/NativeComponents/Concerns/RedrawsOnAppearanceChange.php new file mode 100644 index 00000000..0a003add --- /dev/null +++ b/app/NativeComponents/Concerns/RedrawsOnAppearanceChange.php @@ -0,0 +1,19 @@ + diff --git a/resources/views/native/conversation.blade.php b/resources/views/native/conversation.blade.php index 18da1ed8..7e833e2f 100644 --- a/resources/views/native/conversation.blade.php +++ b/resources/views/native/conversation.blade.php @@ -69,20 +69,23 @@ @if ($pinned !== []) @include('native.partials.pinned-bar') @endif + + {{-- The thread fades out above the composer instead of meeting it at a hard edge. --}} + @if ($loaded) + @include('native.partials.composer-fade', ['ref' => 'composer-fade']) + @endif @if ($loaded) {{-- - The composer: one rounded box with the field over a row holding the + and the round send button (see - partials/composer-box), on a bar that is Liquid Glass on iOS, tinted with the surface so the thread - scrolling under it is blurred out of the way, and the solid surface with a hairline on Android. The web's - tools, photos, the microphone and Ping, open from the one +. Above the box sit the people to mention, what - you're replying to and the photos on the draft. While the thread can't take a message, the bar is solid - on both, with why in the box's place. + The composer: the field over a row holding the + and the round send button (see partials/composer-box), on + the surface, with the thread fading out above it (see partials/composer-fade) rather than a line or a + blur. The surface also fills the strip under the home indicator. The web's tools, photos, the microphone + and Ping, open from the one +. Above the field sit the people to mention, what you're replying to and the + photos on the draft. While the thread can't take a message, why goes in the field's place. --}} - - + @if ($canPush) {{-- The members to mention, what you're replying to and the photos on the draft each keep a slot, @@ -122,7 +125,7 @@ 'tools' => $recorder !== null ? [] : [ ['ref' => 'composer-tools', 'icon' => \App\Icons\Lucide::Plus, 'label' => 'Photos, a voice note or a ping', 'menu' => \App\Devnull\ComposerMenu::items(count($photos) >= \App\Devnull\DraftImages::MaxImages, trim($draft) !== '' || $photos !== [], $pingLabel)], ], - 'counter' => ['native.partials.message-length'], + 'trail' => [['native.partials.message-length']], 'send' => [ 'ref' => 'push', 'label' => 'Push', diff --git a/resources/views/native/partials/body-counter.blade.php b/resources/views/native/partials/body-counter.blade.php index 6bdd9736..327a2a86 100644 --- a/resources/views/native/partials/body-counter.blade.php +++ b/resources/views/native/partials/body-counter.blade.php @@ -1,21 +1,8 @@ {{-- The web's BodyCounter, next to Commit or Reply: nothing until 200 characters are left, then the count in mono, amber - from 20 and Rm Red at none. Before that, a body long enough to be folded in lists says so. - - The composer sheet and the reply bar show the fold icon. In partials/composer-box ($foldHint), where the row has - room for words, it says "folded in feeds" in small muted text instead: people read the icon alone as a button they - couldn't work out, and text that isn't a button can't be mistaken for one. + from 20 and Rm Red at none. --}} -@php($foldHint ??= false) @php($remaining = \App\Devnull\Data\Commit::MaxLength - (($literal ?? false) ? mb_strlen(\App\Devnull\Data\CommitBody::normalize($body)) : \App\Devnull\Data\CommitBody::characterCount($body))) -@php($isCounting = $remaining <= \App\Devnull\Data\Commit::CountFrom) -@php($foldExplained = 'Feeds show the first '.\App\Devnull\Data\Commit::PreviewLength.' characters or '.\App\Devnull\Data\Commit::PreviewLines.' lines, then Show more.') -@if ($isCounting) +@if ($remaining <= \App\Devnull\Data\Commit::CountFrom) {{ $remaining }} -@elseif (\App\Devnull\Data\Commit::isFoldedInLists($body)) - @if ($foldHint) - folded in feeds - @else - - @endif @endif diff --git a/resources/views/native/partials/composer-box.blade.php b/resources/views/native/partials/composer-box.blade.php index 5ffec607..4976653f 100644 --- a/resources/views/native/partials/composer-box.blade.php +++ b/resources/views/native/partials/composer-box.blade.php @@ -1,29 +1,35 @@ {{-- - A composer bar's field, tools and send button in one rounded box, the way the Claude and Messages apps draw theirs: - the field across the top, growing to its five lines, and under it a row with the tools on the left and a round - send button in your colour on the right, with anything that counts the draft beside it. The same on both - platforms. The bar around it is the backdrop: Liquid Glass tinted with the surface on iOS, so the thread - scrolling under it blurs instead of showing through, and the solid surface with a hairline on Android. + A composer bar's field, tools and send button, laid out the way the Claude and Messages apps lay theirs out: the + field across the top, growing to its five lines, and under it a row with the tools on the left and a round send + button in your colour on the right. The same on both platforms. Nothing is drawn around them: they sit straight on + the bar, which is the surface, under the fade the screen lays over its foot (see partials/composer-fade). $ref names the box ("{$ref}-box", also its key, so the field keeps its place as rows above it come and go) and its rows ("{$ref}-field-row", "{$ref}-actions"). $field is the partial that draws the field, keyed itself, so it stays - the same view while the tools and the counter under it change. $tools are composer-tool's, in the web's order. - $counter, when there is one, is a partial and its data ([view, data]) for the count left of the send button. - $send is send-button's: its ref, label, method, and whether it can send yet. + the same view while the tools and everything else in the row under it change. $tools are composer-tool's, in the + web's order. $lead and $trail, when there are any, are partials with their data ([view, data]) for the start of the + row, ahead of the tools, and for the end, left of the send button, such as the count of a long draft. $send is + send-button's: its ref, label, method, and whether it can send yet. + + The field's text lines up with the tools' icons under it. --}} -@php($counter ??= null) - - +@php($lead ??= []) +@php($trail ??= []) + + @include($field) + @foreach ($lead as $part) + @include($part[0], $part[1] ?? []) + @endforeach @foreach ($tools as $tool) @include('native.partials.composer-tool', $tool) @endforeach - @if ($counter !== null) - @include($counter[0], $counter[1] ?? []) - @endif + @foreach ($trail as $part) + @include($part[0], $part[1] ?? []) + @endforeach @include('native.partials.send-button', $send) diff --git a/resources/views/native/partials/composer-fade.blade.php b/resources/views/native/partials/composer-fade.blade.php new file mode 100644 index 00000000..6caefabd --- /dev/null +++ b/resources/views/native/partials/composer-fade.blade.php @@ -0,0 +1,8 @@ +{{-- + The soft edge over the foot of a screen, just above its composer bar: a gradient from see-through at the top to + the surface at the bottom, where the bar starts, so whatever scrolls down to the bar fades out instead of meeting a + hard line. It lies over the screen's scroll view, at the bottom of the stack around it, on both platforms: on iOS + the thread runs on under the bar, which hides it, and on Android it stops at the bar. Its colours come from + Display::composerFade(). $ref names it. +--}} + diff --git a/tests/Feature/Screens/ConversationTest.php b/tests/Feature/Screens/ConversationTest.php index 5e0634ef..ede1ed9c 100644 --- a/tests/Feature/Screens/ConversationTest.php +++ b/tests/Feature/Screens/ConversationTest.php @@ -2,6 +2,7 @@ use App\Devnull\Account; use App\Devnull\Data\Remotes; +use App\Devnull\Display; use App\NativeComponents\Conversation; use Illuminate\Http\Client\Request; use Illuminate\Support\Facades\Http; @@ -760,18 +761,18 @@ function pulledAvatars(TestableComponent $screen, int $id): array ->assertNativeNotCalled('Browser.OpenInApp'); }); -it('pads the end of the thread for the composer bar alone, and for the reply bar while replying', function () { +it('pads the end of the thread for the fade and the composer bar alone, and for the reply bar while replying', function () { serveRemoteThread(threadJson([remoteMessageJson(['id' => 1])], ['read_through_id' => 1])); $screen = finishRefreshes(Native::visit('/remotes/conversations/ada')); $clearance = fn (): mixed => nodeByRef($screen, 'composer-clearance')['layout']['height'] ?? null; // The scroll view adds the home indicator itself while the keyboard is down, so it isn't counted here. - expect($clearance())->toEqual(Conversation::ComposerBarHeight + 8); + expect($clearance())->toEqual(Display::ComposerFadeHeight + Conversation::ComposerBarHeight + 8); $screen->trigger('swipe-1'); - expect($clearance())->toEqual(Conversation::ComposerBarHeight + Conversation::ReplyingBarHeight + 8); + expect($clearance())->toEqual(Display::ComposerFadeHeight + Conversation::ComposerBarHeight + Conversation::ReplyingBarHeight + 8); }); // ── Pins ──────────────────────────────── @@ -1025,8 +1026,8 @@ function serveOrgThread(array $thread, ?array $poll = null, ?Closure $pins = nul ->assertSee('pinned · 2') ->assertSee(' release checklist'); - // It lies over the thread, which clears it at the top. - expect(childRefs($screen, 'thread-stack'))->toBe(['thread', 'pinned-bar']) + // It lies over the thread, which clears it at the top, under the fade over the thread's foot. + expect(childRefs($screen, 'thread-stack'))->toBe(['thread', 'pinned-bar', 'composer-fade']) ->and(childRefs($screen, 'thread')[0])->toBe('pinned-clearance') ->and(nodeByRef($screen, 'pinned-bar')['props']['a11y_label'] ?? null)->toBe('2 pinned messages. Latest from Ada Lovelace: release checklist'); diff --git a/tests/Feature/Screens/RemotesComposerTest.php b/tests/Feature/Screens/RemotesComposerTest.php index 67c20610..7dff8702 100644 --- a/tests/Feature/Screens/RemotesComposerTest.php +++ b/tests/Feature/Screens/RemotesComposerTest.php @@ -1,10 +1,13 @@ toEqual(Conversation::ComposerBarHeight + Conversation::PhotosHeight + 8); + expect($clearance())->toEqual(Display::ComposerFadeHeight + Conversation::ComposerBarHeight + Conversation::PhotosHeight + 8); $screen->tap('photo-0-alt'); - expect($clearance())->toEqual(Conversation::ComposerBarHeight + Conversation::PhotosHeight + Conversation::DescriptionHeight + 8); + expect($clearance())->toEqual(Display::ComposerFadeHeight + Conversation::ComposerBarHeight + Conversation::PhotosHeight + Conversation::DescriptionHeight + 8); }); it('keeps the keyboard up through presses in the thread, and the field in place as the reply strip and photos come and go', function () { @@ -268,16 +271,42 @@ function threadWithAda(string $platform = 'ios'): TestableComponent ->and(nodeByRef($screen, 'push')['props']['a11y_label'] ?? nodeByRef($screen, 'push')['a11y_label'] ?? null)->toBe('Push'); })->with(['ios', 'android']); -it('puts the bar on Liquid Glass tinted with the surface on iOS, and on the solid surface on Android', function () { +it('puts the bar on the surface with no glass or line, and fades the thread out above it, on both platforms', function (string $platform) { serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); - $ios = nodeByRef(threadWithAda('ios'), 'composer-bar'); - $android = nodeByRef(threadWithAda('android'), 'composer-bar'); + $screen = threadWithAda($platform); + $bar = nodeByRef($screen, 'composer-bar'); + $fade = nodeByRef($screen, 'composer-fade'); + $surface = strtoupper(config('native-ui.theme.light.surface')); + + expect($bar['props']['glass'] ?? null)->toBeNull() + ->and($bar['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) + ->and(childRefs($screen, 'composer-bar')[0])->toBe('mention-slot') + ->and(nodeByRef($screen, 'message-box')['style']['border_width'] ?? 0)->toEqual(0) + ->and(nodeByRef($screen, 'message-box')['style']['bg_color'] ?? null)->toBeNull() + ->and(array_slice(childRefs($screen, 'thread-stack'), -1))->toBe(['composer-fade']) + ->and($fade['props']['gradient_stops'] ?? null)->toBe('#00'.substr($surface, 1).',#B3'.substr($surface, 1).','.$surface) + ->and($fade['layout']['height'] ?? null)->toEqual(Display::ComposerFadeHeight); +})->with(['ios', 'android']); + +it('fades to the dark surface in dark mode, and draws again when the phone switches', function () { + serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); + + $screen = threadWithAda(); + $light = strtoupper(config('native-ui.theme.light.surface')); + $dark = strtoupper(config('native-ui.theme.dark.surface')); + + expect(str_ends_with(nodeByRef($screen, 'composer-fade')['props']['gradient_stops'], $light))->toBeTrue(); + + System::rememberAppearance('dark'); - expect($ios['props']['glass'] ?? null)->toBe(1) - ->and($ios['style']['bg_color'] ?? null)->not->toBeNull() - ->and($android['props']['glass'] ?? null)->toBeNull() - ->and($android['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')); + try { + $screen->emitNative(AppearanceChanged::class, ['mode' => 'dark']); + + expect(str_ends_with(nodeByRef($screen, 'composer-fade')['props']['gradient_stops'], $dark))->toBeTrue(); + } finally { + System::rememberAppearance('light'); + } }); it('counts a long message beside Push from 1,600 characters, amber from 1,900 and red at 2,000', function (int $length, ?string $colour) { From a5d112cd2d80a03502def696c5aa6adef3f173b6 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Wed, 18 Nov 2026 00:34:38 +0000 Subject: [PATCH 05/46] Reply with photos and a preview from the bar, and drop any time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The reply bar no longer has the expand button or grows in place, and it never opens the composer sheet. Its row has a photo button (a menu with the library and the camera) and Preview. Photos show above the field with their ✕ and ALT, go in the reply's stash, and send with it. Preview shows the reply as it will look in the field's place, with the body devnull keeps, and pressed again brings the field back with the keyboard. The field grows with the reply to five lines and then scrolls. Nothing in PHP changes its line limits any more. Drop shows beside Reply as soon as the reply has anything in it, so a draft can be thrown away at any time. stash@{0} still marks a draft that came back from the stash. Both moved into the row, so the bar no longer gets taller for them. The page fades out above the bar, as Remotes does, from the stack now around its scroll view. composer-preview takes its draft as parameters so the sheet and the bar share it. The expand icons are gone. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/ComposerMenu.php | 14 ++ app/Devnull/Display.php | 40 +++-- app/Icons/Lucide.php | 4 - app/NativeComponents/CommitDetail.php | 128 +++++++++++++--- resources/icons/maximize-2.svg | 1 - resources/icons/minimize-2.svg | 1 - .../views/native/commit-detail.blade.php | 82 ++++++----- .../native/partials/commit-sheet.blade.php | 10 +- .../partials/composer-preview.blade.php | 20 ++- .../native/partials/reply-field.blade.php | 9 +- .../native/partials/reply-preview.blade.php | 19 +++ .../native/partials/stash-label.blade.php | 10 +- tests/Feature/Screens/CommitDetailTest.php | 116 +++++++++------ tests/Feature/Screens/ComposerPhotosTest.php | 139 +++++++++--------- tests/Feature/Screens/DraftStashTest.php | 10 +- 15 files changed, 383 insertions(+), 220 deletions(-) delete mode 100644 resources/icons/maximize-2.svg delete mode 100644 resources/icons/minimize-2.svg create mode 100644 resources/views/native/partials/reply-preview.blade.php diff --git a/app/Devnull/ComposerMenu.php b/app/Devnull/ComposerMenu.php index 71e5716e..533a0303 100644 --- a/app/Devnull/ComposerMenu.php +++ b/app/Devnull/ComposerMenu.php @@ -28,6 +28,20 @@ public static function items(bool $photosFull, bool $voiceNotesGoAlone, string $ ]; } + /** + * What the photo button in the reply bar on a commit's page opens: the photo library, or the camera, as the + * composer sheet's two photo buttons do. + * + * @return list + */ + public static function photoItems(): array + { + return [ + self::item('reply-pick-photos', 'Choose photos', Lucide::ImagePlus, 'pickPhotos'), + self::item('reply-take-photo', 'Take a photo', Lucide::Camera, 'takePhoto'), + ]; + } + private static function item(string $ref, string $label, Lucide $icon, string $method, bool $disabled = false): TopBarAction { return NavAction::make($ref) diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index 2c3515d9..42b339ef 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -19,17 +19,12 @@ final class Display public const int ReplyBarMaxLines = 5; /** - * The reply box on a commit's page grown by its expand button: it starts this many lines tall, and grows to - * ExpandedReplyMaxLines. + * The photos on a reply's draft, above the field in the reply bar (see partials/composer-photos), and the + * description of one under them while it's open. */ - public const int ExpandedReplyMinLines = 8; + public const int ReplyBarPhotosHeight = 88; - public const int ExpandedReplyMaxLines = 12; - - /** - * The row under the reply box that marks a restored draft (see partials/stash-label). - */ - public const int ReplyBarStashLabelHeight = 28; + public const int ReplyBarDescriptionHeight = 100; /** * A bar holding partials/composer-box with one line of draft, as drawn on an iPhone: the bar's padding, then the @@ -235,22 +230,21 @@ public static function maskedKey(string $openSsh): string * How far a commit page has to scroll past its last reply to clear the * reply bar. A pushed screen is drawn under its bottom bar and the home * indicator, with no inset for either, so the page pads its own end: the - * bar (partials/composer-box) as the draft grows to its five lines, and - * the indicator below it. With the keyboard up the bar sits on the - * keyboard instead, which only leaves a little more room. Grown by its - * expand button ($expanded), the box is ExpandedReplyMinLines tall to - * start with. A restored draft adds the row under the box that marks it - * ($restored), and a link too long for devnull the line that says so. + * fade over its foot (partials/composer-fade), the bar + * (partials/composer-box) as the draft grows to its five lines, and the + * indicator below it. With the keyboard up the bar sits on the keyboard + * instead, which only leaves a little more room. Photos on the draft add + * their row above the field ($hasPhotos), and an open description of one + * its box under them ($describing). A link too long for devnull adds the + * line that says so. */ - public static function replyBarClearance(string $draft, bool $expanded = false, bool $restored = false): int + public static function replyBarClearance(string $draft, bool $hasPhotos = false, bool $describing = false): int { - $lines = $expanded - ? max(self::ExpandedReplyMinLines, min(self::ExpandedReplyMaxLines, self::lineCount($draft, self::ComposerBoxCharactersPerLine))) - : null; - - return self::ComposerBoxBarHeight - + ($lines === null ? self::composerBoxGrowth($draft) : ($lines - 1) * self::ReplyBarLineHeight) - + ($restored ? self::ReplyBarStashLabelHeight : 0) + return self::ComposerFadeHeight + + self::ComposerBoxBarHeight + + self::composerBoxGrowth($draft) + + ($hasPhotos ? self::ReplyBarPhotosHeight : 0) + + ($hasPhotos && $describing ? self::ReplyBarDescriptionHeight : 0) + (CommitBody::hasOversizedUrl($draft) ? 3 * self::ReplyBarLineHeight : 0) + self::HomeIndicatorHeight; } diff --git a/app/Icons/Lucide.php b/app/Icons/Lucide.php index b6e5c0e1..3df5fa55 100644 --- a/app/Icons/Lucide.php +++ b/app/Icons/Lucide.php @@ -73,8 +73,6 @@ enum Lucide case Eye; case EyeOff; case Plus; - case Maximize2; - case Minimize2; case Vibrate; // The achievement badges, named as devnull names their icons (see forBadge()). @@ -214,8 +212,6 @@ public function custom(bool $filled = false): string self::Eye => 'eye', self::EyeOff => 'eye-off', self::Plus => 'plus', - self::Maximize2 => 'maximize-2', - self::Minimize2 => 'minimize-2', self::Vibrate => 'vibrate', self::Terminal => 'terminal', self::FileCode => 'file-code', diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index 0647820f..169606fd 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -18,10 +18,12 @@ use App\Devnull\RowCache; use App\Devnull\Stash; use App\Devnull\Timeline; +use App\Devnull\Toasts; use App\Icons\Lucide; use App\Models\PendingWrite; use App\NativeComponents\Concerns\OpensInTab; use App\NativeComponents\Concerns\OpensLiveStream; +use App\NativeComponents\Concerns\RedrawsOnAppearanceChange; use App\NativeComponents\Concerns\RefreshesInBackground; use App\NativeComponents\Concerns\ShowsCommits; use App\NativeComponents\Concerns\TalksToDevnull; @@ -49,17 +51,16 @@ * * The reply is stashed as you type, per commit, as on the web (see Stash), so * leaving the page keeps it, and it's in the reply bar again, marked as - * restored, when you come back to the commit. + * restored, when you come back to the commit. Drop throws it away whenever + * there's anything in it. * - * The reply bar's expand button gives the reply more room where it is: the - * box grows taller over the page, with the same field in it, so the keyboard - * stays up (see toggleReplyExpanded()). A sheet can't do that: presenting - * one takes the keyboard down and puts it back up on both platforms, however - * soon its field takes focus. Grown, the box has the photos and preview - * button, which opens the reply in the composer sheet (see replyInSheet()). - * The draft goes with it, and back to the bar if the sheet closes unsent. - * Photos left in it show as a count in the box, which opens the sheet on - * them, and Reply in the bar sends them with the text. + * The reply bar does everything the composer sheet did for a reply, so a + * reply never needs the sheet: presenting one takes the keyboard down and + * puts it back up on both platforms, however soon its field takes focus. + * Photos come from the library or the camera into the bar, above the field, + * each with its ✕ and ALT (see AttachesPhotos), and Preview shows the reply + * as it will look in the field's place (see toggleReplyPreview()). Reply in + * the bar sends them all. * * Related commits wait under a header with their count, closed, and open * in place when it's tapped (see toggleRelated()). @@ -75,11 +76,16 @@ class CommitDetail extends NativeComponent { use OpensInTab; use OpensLiveStream; + use RedrawsOnAppearanceChange; use RefreshesInBackground; use ShowsCommits { reopenFailedCommit as private reopenFailedCommitInSheet; editFailedCommit as private editFailedCommitInSheet; mentionFields as private sheetMentionFields; + attachedPhotos as private sheetPhotos; + photosChanged as private sheetPhotosChanged; + takesPhotos as private sheetTakesPhotos; + photoFailed as private sheetPhotoFailed; } use TalksToDevnull; @@ -110,9 +116,16 @@ class CommitDetail extends NativeComponent public array $related = []; /** - * Whether the reply box has grown to give the reply more room. + * Whether the reply bar shows the reply as it will look, in the field's place. */ - public bool $replyExpanded = false; + public bool $replyPreviewing = false; + + /** + * What devnull sent back for the reply's body, with the body it was for under `draft`. + * + * @var array|null + */ + public ?array $replyPreview = null; /** * Whether the related commits show under their header. @@ -317,13 +330,34 @@ public function toggleReplies(): void } /** - * The expand button in the reply box: the box grows taller where it is, - * the same field in it, so the keyboard stays where it was, and again it - * shrinks back. + * The web's preview toggle, in the reply bar: the reply shows as it will + * look in the field's place, at once, and devnull is asked for its body, + * with its code and mentions, unless it already said for this one. The + * keyboard goes down with the field. Pressed again, the field comes back + * with the keyboard. */ - public function toggleReplyExpanded(): void + public function toggleReplyPreview(): void { - $this->replyExpanded = ! $this->replyExpanded; + $this->replyPreviewing = ! $this->replyPreviewing; + $this->describing = null; + + if (! $this->replyPreviewing) { + $this->focusReply = true; + + return; + } + + $body = trim($this->reply); + + if ($body === '' || ($this->replyPreview['draft'] ?? null) === $body) { + return; + } + + $this->writeInBackground('POST', Client::PreviewPath, ['body' => $body], function (array $json) use ($body): void { + if (is_array($json['data'] ?? null)) { + $this->replyPreview = [...$json['data'], 'draft' => $body]; + } + }, fn (): null => null); } /** @@ -439,7 +473,8 @@ public function sendReply(): void $this->reply = ''; $this->replyImages = []; - $this->replyExpanded = false; + $this->replyPreviewing = false; + $this->replyPreview = null; $this->forgetMention('reply'); $this->updatedReply(); $this->repliesShown = true; @@ -473,13 +508,17 @@ public function updatedReply(): void } /** - * The web's drop, beside a restored reply: it's thrown away, photos too, and the field starts again empty. + * The web's drop, beside the reply while there's anything in it: it's thrown away, photos too, and the field + * starts again empty. */ public function dropReplyStash(): void { app(DraftImages::class)->discard($this->replyImages); $this->reply = ''; $this->replyImages = []; + $this->replyPreviewing = false; + $this->replyPreview = null; + $this->describing = null; $this->updatedReply(); } @@ -552,6 +591,57 @@ protected function editFailedCommit(PendingWrite $write): void $this->takeFailedReply($write); } + /** + * The photos on the draft being written: the sheet's while it's up, otherwise the reply bar's. + * + * @return list + */ + protected function attachedPhotos(): array + { + return $this->sheetOpen ? $this->sheetPhotos() : $this->replyImages; + } + + /** + * Photos added in the reply bar, or taken off it, go in the reply's stash with its text. + * + * @param list $photos + */ + protected function photosChanged(array $photos): void + { + if ($this->sheetOpen) { + $this->sheetPhotosChanged($photos); + + return; + } + + $this->replyImages = $photos; + $this->updatedReply(); + } + + /** + * A reply can have photos, as on the web, unless its commit has gone. + */ + protected function takesPhotos(): bool + { + return $this->sheetOpen ? $this->sheetTakesPhotos() : $this->commit !== null && ! $this->commit->isDeleted(); + } + + /** + * Why a photo won't do comes as a toast, from the top, clear of the reply bar, as it does in Remotes. + */ + protected function photoFailed(?string $error): void + { + if ($this->sheetOpen) { + $this->sheetPhotoFailed($error); + + return; + } + + if ($error !== null) { + Toasts::failed($error); + } + } + /** * The reply bar takes back the draft it handed the sheet, as it was left there, photos too. */ diff --git a/resources/icons/maximize-2.svg b/resources/icons/maximize-2.svg deleted file mode 100644 index 12b88ce8..00000000 --- a/resources/icons/maximize-2.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/resources/icons/minimize-2.svg b/resources/icons/minimize-2.svg deleted file mode 100644 index f3cb0e4b..00000000 --- a/resources/icons/minimize-2.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index fd724368..6469c124 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -5,7 +5,9 @@ @include('native.partials.live-stream-sheet') @include('native.partials.stargazers-sheet') - + {{-- The stack around the page holds the fade over its foot, just above the reply bar (see partials/composer-fade). --}} + + @if (! $commit && $error === null) @@ -105,60 +107,69 @@ {{-- A pushed screen runs under its bottom bar, so the page clears the reply bar itself (see - Display::replyBarClearance): the last reply and its actions end above the bar, keyboard up or down. + Display::replyBarClearance): the last reply and its actions end above the fade and the bar, keyboard + up or down. --}} @if ($commit) - + @endif + @if ($commit) + @include('native.partials.composer-fade', ['ref' => 'reply-fade']) + @endif + + @if ($commit) {{-- - The reply bar, drawn as the Remotes composer is: one rounded box with the field across the top and a row - under it with the tools on the left and the round send button on the right (see partials/composer-box). The - bar is Liquid Glass tinted with the surface on iOS, so the thread scrolling under it blurs, and the solid - surface with a hairline on Android. native:bottom-bar takes no classes of its own, so the bar is painted - from this column. + The reply bar, drawn as the Remotes composer is: the field across the top and a row under it with the + tools on the left and the round send button on the right (see partials/composer-box), straight on the + surface, with the page fading out above it. native:bottom-bar takes no classes of its own, so the bar is + painted from this column, which also fills the strip under the home indicator. + + The bar does everything the composer sheet did for a reply, so a reply never needs the sheet, whose + presenting takes the keyboard down and back up on both platforms. The photo button adds photos from the + library or the camera, which show above the field with their ✕ and ALT. Preview shows the reply as it will + look in the field's place, and pressed again brings the field back. Beside the send button, drop throws + the draft away whenever there's anything in it, after the web's stash@{0} when the draft came back from + the stash, then how long the reply is near the limit. - The expand button grows the box where it is, the same field in it, so the keyboard stays up, and shrinks - it back. A sheet can't take the reply over with the keyboard up: presenting one takes the keyboard down - and back up on both platforms. Grown, the box also has the button for photos and a preview, which opens - the reply in the composer sheet, and once the sheet has put photos on the draft, their count opens the - sheet on them. Beside the send button, how long the reply is. A reply that came back when you returned to - the commit has the web's stash@{0} and drop under the box, on a row of its own, since the box's row has no - room left for it once it has grown. + A "post as" avatar, for people in a GitHub organization, goes at the start of the row as composer-box's + $lead. --}} - - + {{-- - The people to mention keep a slot above the box, empty and 0.1pt tall when there's no one, so the - box's row never moves. Android rebuilds a row that moves among its siblings, field and all, which - drops the keyboard. On iOS an empty slot would otherwise take 10pt of the bar, and EDGE drops a - height of 0. + The people to mention and the photos on the reply keep a slot each above the field, empty and + 0.1pt tall when there's nothing in it, so the field's row never moves. Android rebuilds a row that + moves among its siblings, field and all, which drops the keyboard. On iOS an empty slot would + otherwise take 10pt of the bar, and EDGE drops a height of 0. --}} @php($mentioning = ($mention['field'] ?? null) === 'reply' && ($mentionPeople !== [] || $mentionOrganizations !== [])) @include('native.partials.mention-suggestions', ['field' => 'reply', 'label' => 'Mention a developer']) + @php($showsPhotos = $replyImages !== [] && ! $replyPreviewing) + + @if ($showsPhotos) + @include('native.partials.composer-photos', ['photos' => $replyImages, 'photoRef' => 'reply-photo']) + @endif + - @php($photoCount = $replyImages === [] ? null : \App\Devnull\Display::count(count($replyImages), 'photo', 'photos')) + @php($hasDraft = trim($reply) !== '' || $replyImages !== []) + @php($photosFull = count($replyImages) >= \App\Devnull\DraftImages::MaxImages) @include('native.partials.composer-box', [ 'ref' => 'reply', - 'field' => 'native.partials.reply-field', + 'field' => $replyPreviewing ? 'native.partials.reply-preview' : 'native.partials.reply-field', 'tools' => [ - $replyExpanded - ? ['ref' => 'reply-expand', 'icon' => \App\Icons\Lucide::Minimize2, 'label' => 'Give the reply less room', 'press' => 'toggleReplyExpanded'] - : ['ref' => 'reply-expand', 'icon' => \App\Icons\Lucide::Maximize2, 'label' => 'Give the reply more room', 'press' => 'toggleReplyExpanded'], - ...($replyExpanded ? [ - ['ref' => 'reply-attach', 'icon' => \App\Icons\Lucide::ImagePlus, 'label' => 'Reply with photos or a preview', 'press' => "replyInSheet('{$commit->id}')"], - ] : []), - ...($photoCount === null ? [] : [ - ['ref' => 'reply-photos', 'icon' => \App\Icons\Lucide::ImagePlus, 'text' => $photoCount, 'label' => $photoCount.' attached', 'hint' => 'Opens the reply with its photos', 'press' => "replyInSheet('{$commit->id}')"], - ]), + ['ref' => 'reply-add-photos', 'icon' => \App\Icons\Lucide::ImagePlus, 'label' => $photosFull ? 'A reply can have up to 3 photos' : 'Add photos', 'menu' => $photosFull ? null : \App\Devnull\ComposerMenu::photoItems(), 'disabled' => $photosFull], + ['ref' => 'reply-preview', 'icon' => \App\Icons\Lucide::Eye, 'label' => $replyPreviewing ? 'Edit' : 'Preview', 'press' => 'toggleReplyPreview', 'active' => $replyPreviewing], + ], + 'trail' => [ + ...($hasDraft ? [['native.partials.stash-label', ['ref' => 'reply-stash', 'drop' => 'dropReplyStash', 'size' => 'text-xs', 'restored' => $replyRestored]]] : []), + ['native.partials.body-counter', ['body' => $reply, 'ref' => 'reply-budget']], ], - 'trail' => [['native.partials.body-counter', ['body' => $reply, 'ref' => 'reply-budget']]], 'send' => [ 'ref' => 'send-reply', 'label' => 'Reply', @@ -167,11 +178,6 @@ ], ]) - @if ($replyRestored) - - @include('native.partials.stash-label', ['ref' => 'reply-stash', 'drop' => 'dropReplyStash', 'size' => 'text-xs']) - - @endif @if (\App\Devnull\Data\CommitBody::hasOversizedUrl($reply)) Each link must not be greater than {{ \App\Devnull\Data\BodyLink::MaxLength }} characters. @endif diff --git a/resources/views/native/partials/commit-sheet.blade.php b/resources/views/native/partials/commit-sheet.blade.php index 97a5b0b1..d30a12ee 100644 --- a/resources/views/native/partials/commit-sheet.blade.php +++ b/resources/views/native/partials/commit-sheet.blade.php @@ -79,7 +79,15 @@ @endif @if ($previewing) - @include('native.partials.composer-preview') + @include('native.partials.composer-preview', [ + 'ref' => 'sheet-draft', + 'body' => $sheetBody, + 'preview' => $sheetPreview, + 'images' => $sheetImages, + 'poll' => $replying ? null : $sheetPoll, + 'pollLength' => $sheetPollLength, + 'quoted' => $quoting ? $sheetCommit : null, + ]) @else user() ?? \App\Devnull\Data\User::fromArray([]), $sheetBody, $sheetPreview, $sheetImages, $sheetView === 'reply' ? null : $sheetPoll, $sheetView === 'quote' ? $sheetCommit : null)) - - @if (trim($sheetBody) === '' && $sheetImages === [] && $sheetPoll === null) +@php($draftCommit = \App\Devnull\Data\Draft::asCommit($me ?? app(\App\Devnull\Account::class)->user() ?? \App\Devnull\Data\User::fromArray([]), $body, $preview, $images, $poll, $quoted)) + + @if (trim($body) === '' && $images === [] && $poll === null) Nothing to preview yet. @else @include('native.partials.commit-body', ['commit' => $draftCommit, 'focused' => true, 'static' => true]) @include('native.partials.commit-media', ['commit' => $draftCommit, 'withEmbeds' => false, 'scoreAction' => false]) @if ($draftCommit->poll) - + @foreach ($draftCommit->poll->options as $option) {{ $option->label }} @endforeach - {{ \App\Devnull\Data\PollDraft::runs($sheetPollLength) }} + {{ \App\Devnull\Data\PollDraft::runs($pollLength) }} @endif @if ($draftCommit->quotedCommit) diff --git a/resources/views/native/partials/reply-field.blade.php b/resources/views/native/partials/reply-field.blade.php index 6400973d..1879f43a 100644 --- a/resources/views/native/partials/reply-field.blade.php +++ b/resources/views/native/partials/reply-field.blade.php @@ -1,10 +1,10 @@ {{-- The reply bar's field on a commit's page, across the top of partials/composer-box. EDGE sends no focus event, so a - press on the field is how the page learns you're replying. The expand button is in the row under it, so pressing it + press on the field is how the page learns you're replying. The tools are in the row under it, so pressing them doesn't count. Where the caret is goes to the page as it moves, for the "@" suggestions above the bar (see SuggestsMentions). It keeps the keyboard up through presses elsewhere on the page (keep-focus), as the Remotes - field does, so picking someone to mention leaves you typing after them. The expand button grows it to - Display::ExpandedReplyMinLines tall: the same field, only taller, so the keyboard doesn't move. + field does, so picking someone to mention leaves you typing after them. It grows with the reply to five lines and + then scrolls, sized by the field itself, not by the page. --}} diff --git a/resources/views/native/partials/reply-preview.blade.php b/resources/views/native/partials/reply-preview.blade.php new file mode 100644 index 00000000..31ba70ad --- /dev/null +++ b/resources/views/native/partials/reply-preview.blade.php @@ -0,0 +1,19 @@ +{{-- + The reply as it will look, in the reply bar's field's place, while Preview is on (see CommitDetail::toggleReplyPreview()): + its body as devnull keeps it, with its photos. Held to about half a screen, and scrolls past that, so a long reply + doesn't push the commit off the top. +--}} + + + @include('native.partials.composer-preview', [ + 'ref' => 'reply-draft', + 'body' => $reply, + 'preview' => $replyPreview, + 'images' => $replyImages, + 'poll' => null, + 'pollLength' => \App\Devnull\Data\PollDraft::DefaultLength, + 'quoted' => null, + 'me' => $viewer, + ]) + + diff --git a/resources/views/native/partials/stash-label.blade.php b/resources/views/native/partials/stash-label.blade.php index b455da5c..a91815bb 100644 --- a/resources/views/native/partials/stash-label.blade.php +++ b/resources/views/native/partials/stash-label.blade.php @@ -1,11 +1,15 @@ {{-- The web's StashLabel, beside a draft that was stashed and has come back: stash@{0} in mono, then drop, which throws - the draft away. $drop is what drop presses, and drop is a full 44pt target. + the draft away. $drop is what drop presses, and drop is a full 44pt target. With $restored false, the draft is one + you're writing now, so there's no stash@{0}, only drop. --}} @php($size ??= 'text-[13px]') +@php($restored ??= true) - {{ 'stash@{0}' }} - + @if ($restored) + {{ 'stash@{0}' }} + @endif + drop diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 3c5ea1b3..45ef0fd2 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -107,7 +107,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): ->and(idsDownTo($screen->tree(), 'reply-input'))->toBe($field); }); -it('draws the reply bar as one box, the field over the expand button and a round Reply, on both platforms', function (string $platform) { +it('draws the reply bar with the field over the photo and preview buttons and a round Reply, on both platforms', function (string $platform) { fakeThread(); $screen = Native::visit('/log/commits/c2', platform: $platform); @@ -116,9 +116,11 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): expect(childRefs($screen, 'reply-row'))->toBe(['reply-box']) ->and(childRefs($screen, 'reply-box'))->toBe(['reply-field-row', 'reply-actions']) ->and(childRefs($screen, 'reply-field-row'))->toBe(['reply-field']) - ->and($actions[0])->toBe('reply-expand') + ->and(array_slice($actions, 0, 2))->toBe(['reply-add-photos', 'reply-preview']) ->and(end($actions))->toBe('send-reply') + ->and(array_column(menuItems($screen, 'reply-add-photos'), 0))->toBe(['reply-pick-photos', 'reply-take-photo']) ->and(nodeByRef($screen, 'send-reply')['props']['a11y_label'] ?? nodeByRef($screen, 'send-reply')['a11y_label'] ?? null)->toBe('Reply') + ->and(rendersRef($screen, 'reply-expand'))->toBeFalse() ->and(canSend($screen, 'send-reply'))->toBeFalse(); $screen->input('reply-input', 'Ready'); @@ -126,46 +128,74 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): expect(canSend($screen, 'send-reply'))->toBeTrue(); })->with(['ios', 'android']); -it('grows the reply box where it is for more room, keeping the same field so the keyboard stays up', function (string $platform) { +it('keeps the same field, up to five lines and then scrolling, however long the reply grows', function (string $platform) { fakeThread(); - $screen = Native::visit('/log/commits/c2', platform: $platform)->input('reply-input', 'A long one'); + $screen = Native::visit('/log/commits/c2', platform: $platform)->input('reply-input', 'A short one'); $field = idsDownTo($screen->tree(), 'reply-input'); - $clearance = nodeByRef($screen, 'reply-bar-clearance')['layout']['height']; - expect(nodeByRef($screen, 'reply-input')['props']['max_lines'])->toBe(5) - ->and(rendersRef($screen, 'reply-attach'))->toBeFalse(); - - $screen->tap('reply-expand'); + $screen->input('reply-input', str_repeat("A line of a long reply\n", 12)); + // The field sizes itself: the page only says how many lines it can take, which never changes as you type. expect(idsDownTo($screen->tree(), 'reply-input'))->toBe($field) - ->and(nodeByRef($screen, 'reply-input')['props']['min_lines'])->toBe(8) - ->and(nodeByRef($screen, 'reply-input')['props']['max_lines'])->toBe(12) - ->and(nodeByRef($screen, 'reply-expand')['props']['a11y_label'] ?? null)->toBe('Give the reply less room') - ->and(childRefs($screen, 'reply-actions')[1])->toBe('reply-attach') - ->and(nodeByRef($screen, 'sheet')['props']['visible'] ?? false)->toBeFalse() - ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual($clearance + 7 * 21); + ->and(nodeByRef($screen, 'reply-input')['props']['max_lines'])->toBe(Display::ReplyBarMaxLines) + ->and(nodeByRef($screen, 'reply-input')['props']['min_lines'] ?? null)->toBeNull() + ->and(nodeByRef($screen, 'sheet')['props']['visible'] ?? false)->toBeFalse(); +})->with(['ios', 'android']); - // Photos and a preview are a tap further, in the composer sheet, with the draft. - $screen->tap('reply-attach'); +it('previews the reply in the field\'s place, with the body devnull keeps, and brings the field back with the keyboard', function () { + fakeThread(extra: ['POST /api/v1/commits/preview' => [['data' => [ + 'body' => 'Shipped 🚀 with @ada', + 'body_segments' => [['type' => 'text', 'text' => 'Shipped 🚀 with @ada']], + 'preview_segments' => null, + 'mentions' => [['handle' => 'ada', 'offset' => 15, 'length' => 4]], + ]]]]); + $screen = Native::visit('/log/commits/c2')->input('reply-input', 'Shipped :rocket: with @ada'); + holdRefreshes(); + $screen->tap('reply-preview'); - expect(nodeByRef($screen, 'sheet')['props']['visible'])->toBeTrue() - ->and($screen->instance()->sheetBody)->toBe('A long one'); + // At once, the reply as written, in the field's place, while devnull is asked. The sheet never opens. + expect(rendersRef($screen, 'reply-input'))->toBeFalse() + ->and(childRefs($screen, 'reply-field-row'))->toBe(['reply-preview-pane']) + ->and(nodeByRef($screen, 'reply-preview')['props']['a11y_label'])->toBe('Edit') + ->and(treeShows(nodeByRef($screen, 'reply-draft-preview'), 'Shipped :rocket: with @ada'))->toBeTrue() + ->and(nodeByRef($screen, 'sheet')['props']['visible'] ?? false)->toBeFalse(); - $screen->dismissSheet('sheet')->tap('reply-expand'); + finishRefreshes($screen); - expect(idsDownTo($screen->tree(), 'reply-input'))->toBe($field) - ->and(nodeByRef($screen, 'reply-input')['props']['max_lines'])->toBe(5) - ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual($clearance); -})->with(['ios', 'android']); + expect(treeShows(nodeByRef($screen, 'reply-draft-preview'), 'Shipped 🚀 with '))->toBeTrue() + ->and(canSend($screen, 'send-reply'))->toBeTrue(); -it('shrinks the grown reply box back once the reply is sent', function () { - fakeThread(extra: ['POST /api/v1/commits' => [['data' => replyJson(['id' => 'r9', 'parent_id' => 'c2', 'body' => 'Sent'])], 201]]); + Http::assertSent(fn (Request $request): bool => str_ends_with($request->url(), '/api/v1/commits/preview') + && $request->body() === '{"body":"Shipped :rocket: with @ada"}'); - $screen = Native::visit('/log/commits/c2')->tap('reply-expand')->input('reply-input', 'Sent')->tap('send-reply'); + $screen->tap('reply-preview'); - expect($screen->instance()->replyExpanded)->toBeFalse() - ->and(nodeByRef($screen, 'reply-input')['props']['max_lines'])->toBe(5); + expect(nodeByRef($screen, 'reply-input')['props'])->toMatchArray(['value' => 'Shipped :rocket: with @ada', 'autofocus' => true]) + ->and(nodeByRef($screen, 'reply-preview')['props']['a11y_label'])->toBe('Preview'); +}); + +it('shows a drop beside Reply as soon as the reply has anything in it, which throws it away', function () { + fakeThread(); + + $screen = Native::visit('/log/commits/c2'); + + expect(rendersRef($screen, 'reply-stash'))->toBeFalse(); + + $screen->input('reply-input', 'Not this after all'); + $actions = childRefs($screen, 'reply-actions'); + + // A draft you're writing now has drop alone. Only one that came back from the stash says stash@{0}. + expect(array_slice($actions, -2))->toBe(['reply-stash', 'send-reply']) + ->and(childRefs($screen, 'reply-stash'))->toBe(['reply-stash-drop']) + ->and(nodeByRef($screen, 'reply-stash-drop')['props']['a11y_label'] ?? null)->toBe('Discard the draft'); + + $screen->tap('reply-stash-drop'); + + expect($screen->instance()->reply)->toBe('') + ->and(nodeByRef($screen, 'reply-input')['props']['value'])->toBe('') + ->and(rendersRef($screen, 'reply-stash'))->toBeFalse() + ->and(app(Stash::class)->names(app(Account::class)->user()?->id))->toBe([]); }); it('says nothing about a long reply being folded in feeds, beside Reply or in the sheet, and still counts down near the limit', function () { @@ -835,21 +865,21 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): expect(pressFeedbackInScroller($screen))->toBe([]); }); -it('puts the reply bar on Liquid Glass tinted with the surface on iOS, and on the solid surface on Android', function () { +it('puts the reply bar on the surface with no glass or line, and fades the page out above it, on both platforms', function (string $platform) { fakeThread(); - $ios = Native::visit('/log/commits/c2', platform: 'ios'); - $android = Native::visit('/log/commits/c2', platform: 'android'); - $bar = findNode($android->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); + $screen = Native::visit('/log/commits/c2', platform: $platform); + $bar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); + $surface = strtoupper(config('native-ui.theme.light.surface')); - expect(nodeByRef($ios, 'reply-bar')['props']['glass'] ?? null)->toBe(1) - ->and(nodeByRef($ios, 'reply-bar')['style']['bg_color'] ?? null)->not->toBeNull() - ->and($bar['children'][0]['ref'] ?? null)->toBe('reply-bar') + expect($bar['children'][0]['ref'] ?? null)->toBe('reply-bar') ->and($bar['children'][0]['props']['glass'] ?? null)->toBeNull() ->and($bar['children'][0]['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) ->and($bar['children'][0]['props']['dark_bg_color'] ?? null)->toBe(config('native-ui.theme.dark.surface')) - ->and($bar['children'][0]['children'][0]['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.hairline')); -}); + ->and(childRefs($screen, 'reply-bar')[0])->toBe('reply-mention-slot') + ->and(childRefs($screen, 'thread-stack'))->toBe(['thread-scroll', 'reply-fade']) + ->and(str_ends_with(nodeByRef($screen, 'reply-fade')['props']['gradient_stops'] ?? '', $surface))->toBeTrue(); +})->with(['ios', 'android']); it('ends the page above the reply bar, and further as the draft grows', function () { fakeThread(replies: [replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'The last reply'])]); @@ -858,15 +888,17 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): $scroller = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'scroll_view'); $page = $scroller['children'][0]['children']; - // The clearance is the last thing on the page, under the last reply: the bar's line and the home indicator. + // The clearance is the last thing on the page, under the last reply: the fade, the bar and the home indicator. + $bar = 24 + Display::ComposerFadeHeight + Display::ComposerBoxBarHeight + 34; + expect(end($page)['ref'] ?? null)->toBe('reply-bar-clearance') - ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual(24 + Display::ComposerBoxBarHeight + 34); + ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual($bar); $screen->input('reply-input', "Three lines\nof a\ndraft"); - expect(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual(24 + Display::ComposerBoxBarHeight + 2 * 21 + 34); + expect(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual($bar + 2 * 21); $screen->input('reply-input', str_repeat("A line\n", 12)); - expect(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual(24 + Display::ComposerBoxBarHeight + 4 * 21 + 34); + expect(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual($bar + 4 * 21); }); diff --git a/tests/Feature/Screens/ComposerPhotosTest.php b/tests/Feature/Screens/ComposerPhotosTest.php index 81d2bd8a..4ea4abd0 100644 --- a/tests/Feature/Screens/ComposerPhotosTest.php +++ b/tests/Feature/Screens/ComposerPhotosTest.php @@ -228,107 +228,106 @@ function isTool(TestableComponent $screen, string $ref): bool ->and(app(Stash::class)->names(app(Account::class)->user()?->id))->toBe([]); }); -it('opens a commit\'s reply in the sheet with what the reply bar had, and replies with photos', function () { +/** + * The commit page for c2, by Ada, which a reply can be sent to. + */ +function replyPage(string $platform = 'ios'): TestableComponent +{ serveApi([ 'GET /api/v1/commits/c2' => [commitPageJson(commitJson(['id' => 'c2', 'body' => 'The focused commit', 'author' => userJson(['id' => 'u2', 'handle' => 'ada', 'name' => 'Ada'])]))], 'GET /api/v1/commits/c2/replies' => [pageJson([])], - 'POST /api/v1/commits' => [['data' => replyJson(['id' => 'r9', 'parent_id' => 'c2', 'body' => 'Here it is'])], 201], + 'POST /api/v1/commits' => [['data' => replyJson(['id' => 'r9', 'parent_id' => 'c2', 'body' => 'Look'])], 201], ]); - $screen = Native::visit('/log/commits/c2') - ->input('reply-input', 'Here it') - ->tap('reply-expand')->tap('reply-attach') - ->assertSee('Reply to @ada'); - - expect(nodeByRef($screen, 'sheet-body')['props'])->toMatchArray(['value' => 'Here it', 'placeholder' => 'Reply to @ada']) - ->and(nodeByRef($screen, 'quote-card')['props']['a11y_label'])->toBe('Replying to Ada') - ->and(findNode($screen->tree(), fn (array $node): bool => ($node['ref'] ?? null) === 'sheet-stash'))->toBeNull() - ->and(findNode($screen->tree(), fn (array $node): bool => ($node['ref'] ?? null) === 'sheet-poll'))->toBeNull() - ->and(nodeByRef($screen, 'sheet-commit')['props']['a11y_label'] ?? null)->toBe('Reply'); - - photosPicked($screen, [testPhoto()]) - ->input('sheet-body', 'Here it is') - ->tap('sheet-commit') - ->dismissSheet('sheet') - ->assertSee('Here it is'); + return Native::visit('/log/commits/c2', platform: $platform); +} - Http::assertSent(fn (Request $request): bool => $request->method() === 'POST' && multipartParts($request)[0]['contents'] === '{"body":"Here it is","parent_id":"c2"}'); +it('adds photos to a reply from the bar, from the library or the camera, without the sheet', function () { + $screen = replyPage()->input('reply-input', 'Look')->tap('reply-pick-photos'); - expect(array_map(fn ($reply): string => $reply->id, $screen->instance()->replies))->toBe(['r9']) - ->and($screen->instance()->reply)->toBe('') - ->and(nodeByRef($screen, 'reply-input')['props']['value'])->toBe(''); -}); + $screen->assertNativeCalled('Camera.PickMedia', fn (array $params): bool => $params['mediaType'] === 'images' && $params['multiple'] === true && $params['maxItems'] === 3); -it('hands the reply back to the reply bar when the sheet goes unsent', function () { - serveApi([ - 'GET /api/v1/commits/c2' => [commitPageJson(commitJson(['id' => 'c2', 'author' => userJson(['id' => 'u2', 'handle' => 'ada'])]))], - 'GET /api/v1/commits/c2/replies' => [pageJson([])], - ]); + photosPicked($screen, [testPhoto()])->tap('reply-take-photo')->assertNativeCalled('Camera.GetPhoto'); + $screen->emitNative(PhotoTaken::class, ['path' => testPhoto('jpg', 30, 40), 'mimeType' => 'image/jpeg']); - $screen = Native::visit('/log/commits/c2') - ->input('reply-input', 'Half') - ->tap('reply-expand')->tap('reply-attach') - ->input('sheet-body', 'Half a reply') - ->dismissSheet('sheet'); + // They show above the field, which keeps its place, and go in the reply's stash with its text. + expect($screen->instance()->replyImages)->toHaveCount(2) + ->and(childRefs($screen, 'reply-bar'))->toBe(['reply-mention-slot', 'reply-photos-slot', 'reply-row']) + ->and(nodeByRef($screen, 'reply-photo-0'))->not->toBeNull() + ->and(nodeByRef($screen, 'reply-photo-1'))->not->toBeNull() + ->and(nodeByRef($screen, 'sheet')['props']['visible'] ?? false)->toBeFalse() + ->and(app(Stash::class)->get(app(Account::class)->user()?->id, 'reply-c2')->images)->toHaveCount(2); - expect(nodeByRef($screen, 'reply-input')['props']['value'])->toBe('Half a reply') - ->and(app(Stash::class)->get(app(Account::class)->user()?->id, 'reply-c2')->body)->toBe('Half a reply'); + // A third fills it, and the button can't add more. + photosPicked($screen, [testPhoto()]); - Http::assertNotSent(fn (Request $request): bool => $request->method() === 'POST'); + expect(menuItems($screen, 'reply-add-photos'))->toBe([]) + ->and(nodeByRef($screen, 'reply-add-photos')['a11y_label'] ?? nodeByRef($screen, 'reply-add-photos')['props']['a11y_label'] ?? null)->toBe('A reply can have up to 3 photos'); }); -it('hands the reply\'s photos back to the reply bar too, which counts them, keeps them and replies with them', function () { - serveApi([ - 'GET /api/v1/commits/c2' => [commitPageJson(commitJson(['id' => 'c2', 'author' => userJson(['id' => 'u2', 'handle' => 'ada'])]))], - 'GET /api/v1/commits/c2/replies' => [pageJson([])], - 'POST /api/v1/commits' => [['data' => replyJson(['id' => 'r9', 'parent_id' => 'c2', 'body' => 'Look'])], 201], - ]); +it('takes a photo off the reply in the bar with its ✕, and off the phone', function () { + $screen = photosPicked(replyPage(), [testPhoto(), testPhoto()]); + $removed = $screen->instance()->replyImages[0]->path; - $screen = photosPicked(Native::visit('/log/commits/c2')->input('reply-input', 'Look')->tap('reply-expand')->tap('reply-attach'), [testPhoto()]) - ->dismissSheet('sheet'); - $path = $screen->instance()->replyImages[0]->path; + $screen->tap('reply-photo-0-remove'); + + expect($screen->instance()->replyImages)->toHaveCount(1) + ->and(file_exists($removed))->toBeFalse() + ->and(app(Stash::class)->get(app(Account::class)->user()?->id, 'reply-c2')->images)->toHaveCount(1); +}); - expect(treeShows(nodeByRef($screen, 'reply-photos'), '1 photo'))->toBeTrue() - ->and(nodeByRef($screen, 'reply-photos')['props']['a11y_label'] ?? null)->toBe('1 photo attached') - // In the box, after its other tools. - ->and(array_slice(childRefs($screen, 'reply-actions'), 0, 3))->toBe(['reply-expand', 'reply-attach', 'reply-photos']); +it('keeps a reply\'s photos for when you come back to the commit, and replies with them', function () { + photosPicked(replyPage()->input('reply-input', 'Look'), [testPhoto()]); - // Coming back to the commit, the bar has them still. $screen = Native::visit('/log/commits/c2'); + $path = $screen->instance()->replyImages[0]->path; expect($screen->instance()->reply)->toBe('Look') - ->and($screen->instance()->replyImages)->toHaveCount(1) + ->and(nodeByRef($screen, 'reply-photo-0'))->not->toBeNull() ->and(nodeByRef($screen, 'reply-stash'))->not->toBeNull(); - // The count opens the sheet on them. - $screen->tap('reply-photos'); - - expect(nodeByRef($screen, 'sheet')['props']['visible'])->toBeTrue() - ->and($screen->instance()->sheetImages[0]->path)->toBe($path); - - $screen->dismissSheet('sheet')->tap('send-reply')->assertSee('Look'); + $screen->tap('send-reply')->assertSee('Look'); Http::assertSent(fn (Request $request): bool => $request->method() === 'POST' && multipartParts($request)[0]['contents'] === '{"body":"Look","parent_id":"c2"}' && multipartParts($request)[1]['name'] === 'images[]'); expect($screen->instance()->replyImages)->toBe([]) - ->and(findNode($screen->tree(), fn (array $node): bool => ($node['ref'] ?? null) === 'reply-photos'))->toBeNull() + ->and(rendersRef($screen, 'reply-photo-0'))->toBeFalse() ->and(file_exists($path))->toBeFalse() ->and(app(Stash::class)->names(app(Account::class)->user()?->id))->toBe([]); }); -it('hands the reply and its photos back to the reply bar when Cancel closes the sheet on Android, which never says it has gone', function () { - serveApi([ - 'GET /api/v1/commits/c2' => [commitPageJson(commitJson(['id' => 'c2', 'author' => userJson(['id' => 'u2', 'handle' => 'ada'])]))], - 'GET /api/v1/commits/c2/replies' => [pageJson([])], - ]); +it('previews a reply with its photos in the bar', function () { + $screen = photosPicked(replyPage()->input('reply-input', 'Look'), [testPhoto()])->tap('reply-preview'); - $screen = photosPicked(Native::visit('/log/commits/c2', platform: 'android')->input('reply-input', 'Half')->tap('reply-expand')->tap('reply-attach'), [testPhoto()]) - ->input('sheet-body', 'Half a reply') - ->tap('sheet-cancel') - ->input('reply-input', 'Half a reply, and more'); + // The photos move into the preview, as the reply will show them, and their row above the field goes. + expect(treeShows(nodeByRef($screen, 'reply-draft-preview'), 'Look'))->toBeTrue() + ->and(findNode(nodeByRef($screen, 'reply-draft-preview'), fn (array $node): bool => ($node['type'] ?? null) === 'image'))->not->toBeNull() + ->and(rendersRef($screen, 'reply-photo-0'))->toBeFalse(); +}); - expect($screen->instance()->replyImages)->toHaveCount(1) - ->and(app(Stash::class)->get(app(Account::class)->user()?->id, 'reply-c2')->images)->toHaveCount(1); +it('drops a reply\'s photos with it, off the phone', function () { + $screen = photosPicked(replyPage(), [testPhoto()]); + $path = $screen->instance()->replyImages[0]->path; + + $screen->tap('reply-stash-drop'); + + expect($screen->instance()->replyImages)->toBe([]) + ->and(file_exists($path))->toBeFalse() + ->and(app(Stash::class)->names(app(Account::class)->user()?->id))->toBe([]); }); + +it('hands a reply opened in the sheet back to the reply bar, photos too, when the sheet goes unsent', function (string $platform) { + $screen = replyPage($platform)->input('reply-input', 'Half')->call('replyInSheet', 'c2'); + + photosPicked($screen, [testPhoto()])->input('sheet-body', 'Half a reply'); + + $platform === 'ios' ? $screen->dismissSheet('sheet') : $screen->tap('sheet-cancel'); + + expect(nodeByRef($screen, 'reply-input')['props']['value'])->toBe('Half a reply') + ->and($screen->instance()->replyImages)->toHaveCount(1) + ->and(app(Stash::class)->get(app(Account::class)->user()?->id, 'reply-c2')->images)->toHaveCount(1); + + Http::assertNotSent(fn (Request $request): bool => $request->method() === 'POST'); +})->with(['ios', 'android']); diff --git a/tests/Feature/Screens/DraftStashTest.php b/tests/Feature/Screens/DraftStashTest.php index 139954a7..a346e29d 100644 --- a/tests/Feature/Screens/DraftStashTest.php +++ b/tests/Feature/Screens/DraftStashTest.php @@ -3,7 +3,6 @@ use App\Devnull\Account; use App\Devnull\Data\Pasteis; use App\Devnull\Data\StashedDraft; -use App\Devnull\Display; use App\Devnull\Stash; use Carbon\CarbonImmutable; use Illuminate\Http\Client\Request; @@ -199,17 +198,18 @@ function stashLabel(TestableComponent $screen, string $ref): array $screen = Native::visit('/log/commits/c2')->input('reply-input', 'A reply in progress'); $clearance = nodeByRef($screen, 'reply-bar-clearance')['layout']['height']; + // While you write it, there's only drop. expect(stashed('reply-c2'))->toBe('A reply in progress') - ->and(showsRef($screen, 'reply-stash'))->toBeFalse(); + ->and(stashLabel($screen, 'reply-stash'))->toBe(['drop', 'Discard the draft']); $screen = Native::visit('/log/commits/c2'); expect(nodeByRef($screen, 'reply-input')['props']['value'])->toBe('A reply in progress') ->and(stashLabel($screen, 'reply-stash'))->toBe(['stash@{0}', 'Discard the restored draft']) ->and(canSend($screen, 'send-reply'))->toBeTrue() - // It's marked on a row under the box, and the page ends above that too. - ->and(childRefs($screen, 'reply-stash-row'))->toBe(['reply-stash']) - ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual($clearance + Display::ReplyBarStashLabelHeight); + // It's marked in the row under the field, beside Reply, so the bar is no taller for it. + ->and(array_slice(childRefs($screen, 'reply-actions'), -2))->toBe(['reply-stash', 'send-reply']) + ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual($clearance); }); it("forgets a reply's stash once it's sent", function () { From ae2b4635487ef5ba415e73eef47cb8091245b1d3 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Wed, 18 Nov 2026 00:44:35 +0000 Subject: [PATCH 06/46] Draw the fade in the bar on iOS, where the thread runs under it On iOS the screen runs on under its bottom bar, so a fade lying over the foot of the thread sat under the bar and never showed. The bar now draws it as its first row there, and its rows (composer-rows) have the surface of their own. The bar itself has no background on iOS: mobile-air paints a bar's background colour behind the whole bar, which hid the fade. The strip under the home indicator still shows the surface, from the scroll view's background. Android keeps the fade over the foot of the thread, since its screen stops at the bar. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Display.php | 22 +++++++++++++++++ resources/views/native/conversation.blade.php | 11 ++++++--- .../native/partials/composer-fade.blade.php | 15 +++++++----- tests/Feature/Screens/ConversationTest.php | 4 ++-- tests/Feature/Screens/RemotesComposerTest.php | 24 ++++++++++++++----- 5 files changed, 59 insertions(+), 17 deletions(-) diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index d9b611a3..defd42ed 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -5,6 +5,7 @@ use App\Devnull\Data\CommitBody; use Carbon\CarbonImmutable; use Carbon\CarbonInterface; +use Native\Mobile\Platform; /** * How the machine prints things: relative times and short hashes, as the web does. @@ -270,6 +271,27 @@ public static function composerFade(): string return "bg-gradient-to-b from-{$surface}/0 via-{$surface}/70 to-{$surface}"; } + /** + * Whether the fade goes at the top of the composer bar itself, rather than over the foot of the screen above it. + * On iOS the screen runs on under its bottom bar, so a fade lying over the screen's foot would be under the bar, + * and the bar has to draw it. On Android the screen stops where the bar starts, so the fade lies over the screen. + */ + public static function fadesInBar(): bool + { + return Platform::isIos(); + } + + /** + * The composer bar's own classes. On Android it's the surface. On iOS it has no background at all: mobile-air + * paints a bar's background colour behind the whole bar, which would cover what the fade at its top should show, + * so only the bar's rows have the surface (see partials/composer-fade). The strip under the home indicator still + * comes out the surface there, from the scroll view's background running on under it. + */ + public static function composerBar(): string + { + return self::fadesInBar() ? '' : 'bg-theme-surface'; + } + /** * About how many lines some text wraps to where $perLine characters fit on one, counting each of its own lines. */ diff --git a/resources/views/native/conversation.blade.php b/resources/views/native/conversation.blade.php index 7e833e2f..f540820d 100644 --- a/resources/views/native/conversation.blade.php +++ b/resources/views/native/conversation.blade.php @@ -70,8 +70,8 @@ @include('native.partials.pinned-bar') @endif - {{-- The thread fades out above the composer instead of meeting it at a hard edge. --}} - @if ($loaded) + {{-- The thread fades out above the composer instead of meeting it at a hard edge. On iOS the bar draws the fade. --}} + @if ($loaded && ! \App\Devnull\Display::fadesInBar()) @include('native.partials.composer-fade', ['ref' => 'composer-fade']) @endif @@ -85,7 +85,11 @@ photos on the draft. While the thread can't take a message, why goes in the field's place. --}} - + + @if (\App\Devnull\Display::fadesInBar()) + @include('native.partials.composer-fade', ['ref' => 'composer-fade', 'inBar' => true]) + @endif + @if ($canPush) {{-- The members to mention, what you're replying to and the photos on the draft each keep a slot, @@ -157,6 +161,7 @@ @endif @endif + @endif diff --git a/resources/views/native/partials/composer-fade.blade.php b/resources/views/native/partials/composer-fade.blade.php index 6caefabd..b7bb3b91 100644 --- a/resources/views/native/partials/composer-fade.blade.php +++ b/resources/views/native/partials/composer-fade.blade.php @@ -1,8 +1,11 @@ {{-- - The soft edge over the foot of a screen, just above its composer bar: a gradient from see-through at the top to - the surface at the bottom, where the bar starts, so whatever scrolls down to the bar fades out instead of meeting a - hard line. It lies over the screen's scroll view, at the bottom of the stack around it, on both platforms: on iOS - the thread runs on under the bar, which hides it, and on Android it stops at the bar. Its colours come from - Display::composerFade(). $ref names it. + The soft edge between a screen and its composer bar: a gradient from see-through at the top to the surface at the + bottom, where the bar's rows start, so whatever scrolls down to the bar fades out instead of meeting a hard line. + Its colours come from Display::composerFade(). + + Where it goes depends on the platform (Display::fadesInBar()). On iOS the screen runs on under the bar, so the fade + is the bar's first row ($inBar), over what runs under it. On Android the screen stops at the bar, so the fade lies + over the foot of the screen's scroll view, at the bottom of the stack around it. $ref names it. --}} - +@php($inBar ??= false) + diff --git a/tests/Feature/Screens/ConversationTest.php b/tests/Feature/Screens/ConversationTest.php index ede1ed9c..4a22b9cc 100644 --- a/tests/Feature/Screens/ConversationTest.php +++ b/tests/Feature/Screens/ConversationTest.php @@ -1026,8 +1026,8 @@ function serveOrgThread(array $thread, ?array $poll = null, ?Closure $pins = nul ->assertSee('pinned · 2') ->assertSee(' release checklist'); - // It lies over the thread, which clears it at the top, under the fade over the thread's foot. - expect(childRefs($screen, 'thread-stack'))->toBe(['thread', 'pinned-bar', 'composer-fade']) + // It lies over the thread, which clears it at the top. + expect(array_slice(childRefs($screen, 'thread-stack'), 0, 2))->toBe(['thread', 'pinned-bar']) ->and(childRefs($screen, 'thread')[0])->toBe('pinned-clearance') ->and(nodeByRef($screen, 'pinned-bar')['props']['a11y_label'] ?? null)->toBe('2 pinned messages. Latest from Ada Lovelace: release checklist'); diff --git a/tests/Feature/Screens/RemotesComposerTest.php b/tests/Feature/Screens/RemotesComposerTest.php index 7dff8702..fcd54ee6 100644 --- a/tests/Feature/Screens/RemotesComposerTest.php +++ b/tests/Feature/Screens/RemotesComposerTest.php @@ -228,7 +228,7 @@ function threadWithAda(string $platform = 'ios'): TestableComponent $screen = threadWithAda()->input('message-input', 'on it'); $field = idsDownTo($screen->tree(), 'message-input'); - $rows = childRefs($screen, 'composer-bar'); + $rows = childRefs($screen, 'composer-rows'); expect(nodeByRef($screen, 'message-input')['props']['keep_focus_on_submit'] ?? false)->toBeTrue(); @@ -238,7 +238,7 @@ function threadWithAda(string $platform = 'ios'): TestableComponent // The strip fills a slot the bar always has, so the field's row keeps its place among the bar's rows, which // Android needs as well as the same id to keep the field. expect(idsDownTo($screen->tree(), 'message-input'))->toBe($field) - ->and(childRefs($screen, 'composer-bar'))->toBe($rows); + ->and(childRefs($screen, 'composer-rows'))->toBe($rows); $screen->tap('cancel-reply'); @@ -252,7 +252,7 @@ function threadWithAda(string $platform = 'ios'): TestableComponent expect($withPhotos)->not->toBe($field) ->and(idsDownTo($screen->tree(), 'message-input'))->toBe($withPhotos) - ->and(childRefs($screen, 'composer-bar'))->toBe($rows); + ->and(childRefs($screen, 'composer-rows'))->toBe($rows); }); it('draws one box with the field over the + and a round Push, on both platforms', function (string $platform) { @@ -280,13 +280,25 @@ function threadWithAda(string $platform = 'ios'): TestableComponent $surface = strtoupper(config('native-ui.theme.light.surface')); expect($bar['props']['glass'] ?? null)->toBeNull() - ->and($bar['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) - ->and(childRefs($screen, 'composer-bar')[0])->toBe('mention-slot') + ->and(nodeByRef($screen, 'composer-rows')['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) + ->and(childRefs($screen, 'composer-rows')[0])->toBe('mention-slot') ->and(nodeByRef($screen, 'message-box')['style']['border_width'] ?? 0)->toEqual(0) ->and(nodeByRef($screen, 'message-box')['style']['bg_color'] ?? null)->toBeNull() - ->and(array_slice(childRefs($screen, 'thread-stack'), -1))->toBe(['composer-fade']) ->and($fade['props']['gradient_stops'] ?? null)->toBe('#00'.substr($surface, 1).',#B3'.substr($surface, 1).','.$surface) ->and($fade['layout']['height'] ?? null)->toEqual(Display::ComposerFadeHeight); + + if ($platform === 'ios') { + // The thread runs on under the bar, so the bar draws the fade at its top, and has no background of its own, + // which iOS would paint behind the fade. + expect(childRefs($screen, 'composer-bar'))->toBe(['composer-fade', 'composer-rows']) + ->and($bar['style']['bg_color'] ?? null)->toBeNull() + ->and(childRefs($screen, 'thread-stack'))->not->toContain('composer-fade'); + } else { + // The thread stops at the bar, so the fade lies over its foot, and the bar is the surface. + expect(childRefs($screen, 'composer-bar'))->toBe(['composer-rows']) + ->and($bar['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) + ->and(array_slice(childRefs($screen, 'thread-stack'), -1))->toBe(['composer-fade']); + } })->with(['ios', 'android']); it('fades to the dark surface in dark mode, and draws again when the phone switches', function () { From 07e127dcaa3601838d2279e8be8b77f51229a50f Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Wed, 18 Nov 2026 00:44:52 +0000 Subject: [PATCH 07/46] Draw the reply bar's fade in the bar on iOS, as Remotes does The page runs on under the bar on iOS, so the fade is the bar's first row there, over the reply's rows, which have the surface. On Android it stays over the foot of the page. Co-Authored-By: Claude Opus 5.5 --- .../views/native/commit-detail.blade.php | 13 ++++++++---- tests/Feature/Screens/CommitDetailTest.php | 20 ++++++++++++------- tests/Feature/Screens/ComposerPhotosTest.php | 2 +- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index 6469c124..46adefdd 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -116,7 +116,7 @@ - @if ($commit) + @if ($commit && ! \App\Devnull\Display::fadesInBar()) @include('native.partials.composer-fade', ['ref' => 'reply-fade']) @endif @@ -125,8 +125,8 @@ {{-- The reply bar, drawn as the Remotes composer is: the field across the top and a row under it with the tools on the left and the round send button on the right (see partials/composer-box), straight on the - surface, with the page fading out above it. native:bottom-bar takes no classes of its own, so the bar is - painted from this column, which also fills the strip under the home indicator. + surface, with the page fading out above it (see partials/composer-fade). native:bottom-bar takes no classes + of its own, so the bar is painted from this column, which also fills the strip under the home indicator. The bar does everything the composer sheet did for a reply, so a reply never needs the sheet, whose presenting takes the keyboard down and back up on both platforms. The photo button adds photos from the @@ -139,7 +139,11 @@ $lead. --}} - + + @if (\App\Devnull\Display::fadesInBar()) + @include('native.partials.composer-fade', ['ref' => 'reply-fade', 'inBar' => true]) + @endif + {{-- The people to mention and the photos on the reply keep a slot each above the field, empty and 0.1pt tall when there's nothing in it, so the field's row never moves. Android rebuilds a row that @@ -181,6 +185,7 @@ @if (\App\Devnull\Data\CommitBody::hasOversizedUrl($reply)) Each link must not be greater than {{ \App\Devnull\Data\BodyLink::MaxLength }} characters. @endif + @endif diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 45ef0fd2..3a89d1ca 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -869,16 +869,22 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): fakeThread(); $screen = Native::visit('/log/commits/c2', platform: $platform); - $bar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); + $bar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar')['children'][0]; $surface = strtoupper(config('native-ui.theme.light.surface')); - expect($bar['children'][0]['ref'] ?? null)->toBe('reply-bar') - ->and($bar['children'][0]['props']['glass'] ?? null)->toBeNull() - ->and($bar['children'][0]['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) - ->and($bar['children'][0]['props']['dark_bg_color'] ?? null)->toBe(config('native-ui.theme.dark.surface')) - ->and(childRefs($screen, 'reply-bar')[0])->toBe('reply-mention-slot') - ->and(childRefs($screen, 'thread-stack'))->toBe(['thread-scroll', 'reply-fade']) + // The bar's rows have the surface. The bar itself has it only on Android: iOS would paint it behind the fade. + expect($bar['ref'] ?? null)->toBe('reply-bar') + ->and($bar['props']['glass'] ?? null)->toBeNull() + ->and($bar['style']['bg_color'] ?? null)->toBe($platform === 'ios' ? null : config('native-ui.theme.light.surface')) + ->and(nodeByRef($screen, 'reply-rows')['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) + ->and(nodeByRef($screen, 'reply-rows')['props']['dark_bg_color'] ?? null)->toBe(config('native-ui.theme.dark.surface')) + ->and(childRefs($screen, 'reply-rows')[0])->toBe('reply-mention-slot') ->and(str_ends_with(nodeByRef($screen, 'reply-fade')['props']['gradient_stops'] ?? '', $surface))->toBeTrue(); + + // On iOS the page runs on under the bar, which draws the fade. On Android the page stops at the bar, and the fade + // lies over its foot. + expect(childRefs($screen, 'reply-bar'))->toBe($platform === 'ios' ? ['reply-fade', 'reply-rows'] : ['reply-rows']) + ->and(childRefs($screen, 'thread-stack'))->toBe($platform === 'ios' ? ['thread-scroll'] : ['thread-scroll', 'reply-fade']); })->with(['ios', 'android']); it('ends the page above the reply bar, and further as the draft grows', function () { diff --git a/tests/Feature/Screens/ComposerPhotosTest.php b/tests/Feature/Screens/ComposerPhotosTest.php index 4ea4abd0..9a0fa6e1 100644 --- a/tests/Feature/Screens/ComposerPhotosTest.php +++ b/tests/Feature/Screens/ComposerPhotosTest.php @@ -252,7 +252,7 @@ function replyPage(string $platform = 'ios'): TestableComponent // They show above the field, which keeps its place, and go in the reply's stash with its text. expect($screen->instance()->replyImages)->toHaveCount(2) - ->and(childRefs($screen, 'reply-bar'))->toBe(['reply-mention-slot', 'reply-photos-slot', 'reply-row']) + ->and(childRefs($screen, 'reply-rows'))->toBe(['reply-mention-slot', 'reply-photos-slot', 'reply-row']) ->and(nodeByRef($screen, 'reply-photo-0'))->not->toBeNull() ->and(nodeByRef($screen, 'reply-photo-1'))->not->toBeNull() ->and(nodeByRef($screen, 'sheet')['props']['visible'] ?? false)->toBeFalse() From 18652b82498a538d2e3b25affe29637f5788797a Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Wed, 18 Nov 2026 00:54:52 +0000 Subject: [PATCH 08/46] Keep every photo picked at once, however old Picking two photos from the library kept only the last. A photo moved into the draft folder keeps its own time, often years ago, and until the draft holds it nothing does, so keeping the second one pruned the first as long forgotten. The kept file's time is now the time it was picked. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/DraftImages.php | 4 ++++ tests/Feature/Screens/RemotesComposerTest.php | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/app/Devnull/DraftImages.php b/app/Devnull/DraftImages.php index cf3b3042..852eb88b 100644 --- a/app/Devnull/DraftImages.php +++ b/app/Devnull/DraftImages.php @@ -98,6 +98,10 @@ public function keep(string $path): DraftImage throw new InvalidDraftImage(self::Unreadable); } + // A moved file keeps its own time, which for a photo from the library can be years ago. Until the draft holds + // it, nothing does, so the next photo picked with it would prune it as long forgotten. + @touch($kept); + return new DraftImage($kept, self::Types[$info[2]], $info[0], $info[1]); } diff --git a/tests/Feature/Screens/RemotesComposerTest.php b/tests/Feature/Screens/RemotesComposerTest.php index fcd54ee6..9cc246f3 100644 --- a/tests/Feature/Screens/RemotesComposerTest.php +++ b/tests/Feature/Screens/RemotesComposerTest.php @@ -196,6 +196,20 @@ function threadWithAda(string $platform = 'ios'): TestableComponent expect(nodeByRef($screen, 'attach-photos')['props']['disabled'] ?? false)->toBeTrue(); }); +it('keeps every photo picked at once, however long ago they were taken', function () { + serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); + + // The library hands photos over with the time they were taken, which a photo nothing holds yet shares with one + // forgotten a day ago. + $picked = [testPhoto(), testPhoto()]; + array_walk($picked, fn (string $path): bool => touch($path, now()->subYears(5)->getTimestamp())); + + $screen = photosPicked(threadWithAda(), $picked); + + expect($screen->instance()->photos)->toHaveCount(2) + ->and(array_filter($screen->instance()->photos, fn ($photo): bool => file_exists($photo->path)))->toHaveCount(2); +}); + it('takes a photo off the draft and the phone with its ✕', function () { serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); From 44ac045217875044fb8fdcba7480ddc4eb6e5273 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Wed, 18 Nov 2026 02:05:24 +0000 Subject: [PATCH 09/46] Put the composer bar on Liquid Glass on iOS, faded in at the top On iOS the thread now shows through the bar, blurred, instead of stopping at a solid surface. The bottom-bar carries glass, and a patched mobile-air draws the glass behind the whole bar, under the home indicator too, faded in over the bar's top 28pt so it has no hard edge. The fade row ends at the glass's tint and the rows tint the glass with the surface at 40%, so in dark mode the bar matches the screen. EDGE's glass on an element can't do this: it draws a rim and lenses the content along its top edge, and it stops above the home indicator, where the thread showed through unblurred. Android is unchanged. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Display.php | 53 +++++++++++++++---- resources/views/native/conversation.blade.php | 16 +++--- .../native/partials/composer-box.blade.php | 2 +- .../native/partials/composer-fade.blade.php | 11 ++-- tests/Feature/Screens/RemotesComposerTest.php | 30 +++++++---- 5 files changed, 79 insertions(+), 33 deletions(-) diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index defd42ed..e07528b6 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -36,10 +36,16 @@ final class Display public const int ComposerBoxBarHeight = 94; /** - * The fade over the foot of a screen, just above its composer bar (see partials/composer-fade). + * The fade over the foot of a screen, just above its composer bar (see partials/composer-fade). On iOS the glass + * under the bar fades in over the same height (see composerBarGlass()). */ public const int ComposerFadeHeight = 28; + /** + * How much of the surface, in percent, tints the glass under a composer bar on iOS (see composerSurface()). + */ + public const int ComposerGlassTint = 40; + /** * About how many characters fit on a line of the box's field. It runs the width of the box, so more fit than * beside the reply bar's tools and button. @@ -258,16 +264,23 @@ public static function composerBoxGrowth(string $draft): int } /** - * The fade's classes (see partials/composer-fade): a gradient down from see-through to the surface, where the bar - * starts. EDGE takes a gradient's stops as they are, without the dark companion a theme colour gets, so the stops - * are the surface of the appearance the phone is in now, and a screen with the fade draws again when that - * changes (see RedrawsOnAppearanceChange). It climbs to 70% of the surface by halfway, so what's under it has - * mostly faded before it reaches the bar. + * The fade's classes (see partials/composer-fade): a gradient down from see-through to the bar's surface, where + * the bar's rows start. EDGE takes a gradient's stops as they are, without the dark companion a theme colour gets, + * so the stops are the surface of the appearance the phone is in now, and a screen with the fade draws again when + * that changes (see RedrawsOnAppearanceChange). + * + * On Android it climbs to 70% of the surface by halfway and ends solid, so what's under it has mostly faded before + * it reaches the bar. On iOS it ends at the glass's tint (composerSurface()), since the bar is glass there and the + * glass fades in under it over the same height. */ public static function composerFade(): string { $surface = strtolower((string) theme('surface', '#ffffff')); + if (self::fadesInBar()) { + return "bg-gradient-to-b from-{$surface}/0 to-{$surface}/".self::ComposerGlassTint; + } + return "bg-gradient-to-b from-{$surface}/0 via-{$surface}/70 to-{$surface}"; } @@ -281,17 +294,39 @@ public static function fadesInBar(): bool return Platform::isIos(); } + /** + * The classes for a composer's native:bottom-bar. On iOS that's Liquid Glass: what scrolls under the bar shows + * through it, blurred. A patched mobile-air draws the glass behind the whole bar, under the home indicator too, + * and fades it in over the bar's top ComposerFadeHeight points, so it has no hard top edge. EDGE's own glass on + * an element can't be faded, and stops short of the home indicator. Android has no glass, so the bar stays the + * surface there. + */ + public static function composerBarGlass(): string + { + return self::fadesInBar() ? 'glass' : ''; + } + /** * The composer bar's own classes. On Android it's the surface. On iOS it has no background at all: mobile-air - * paints a bar's background colour behind the whole bar, which would cover what the fade at its top should show, - * so only the bar's rows have the surface (see partials/composer-fade). The strip under the home indicator still - * comes out the surface there, from the scroll view's background running on under it. + * paints a bar's background colour behind the whole bar, which would cover the fade at its top, so the bar's + * rows carry the tint instead (composerSurface()). */ public static function composerBar(): string { return self::fadesInBar() ? '' : 'bg-theme-surface'; } + /** + * The classes for the rows of a composer bar, under its fade. On Android it's the surface. On iOS it's the + * surface at ComposerGlassTint percent, which tints the glass behind the bar to the screen's own colour, so in + * dark mode the bar doesn't come out lighter than the screen. A fill reaches under the home indicator, so the + * tint runs on there with the glass. + */ + public static function composerSurface(): string + { + return self::fadesInBar() ? 'bg-theme-surface/'.self::ComposerGlassTint : 'bg-theme-surface'; + } + /** * About how many lines some text wraps to where $perLine characters fit on one, counting each of its own lines. */ diff --git a/resources/views/native/conversation.blade.php b/resources/views/native/conversation.blade.php index f540820d..e5642545 100644 --- a/resources/views/native/conversation.blade.php +++ b/resources/views/native/conversation.blade.php @@ -78,18 +78,20 @@ @if ($loaded) {{-- - The composer: the field over a row holding the + and the round send button (see partials/composer-box), on - the surface, with the thread fading out above it (see partials/composer-fade) rather than a line or a - blur. The surface also fills the strip under the home indicator. The web's tools, photos, the microphone - and Ping, open from the one +. Above the field sit the people to mention, what you're replying to and the - photos on the draft. While the thread can't take a message, why goes in the field's place. + The composer: the field over a row holding the + and the round send button (see partials/composer-box), + with the thread fading out above it (see partials/composer-fade) rather than meeting a line. On iOS the bar + is Liquid Glass, faded in at the top, so the thread shows through it blurred (see + Display::composerBarGlass()). On Android it's the surface. Either fills the strip under the home indicator. + The web's tools, photos, the microphone and Ping, open from the one +. Above the field sit the people to + mention, what you're replying to and the photos on the draft. While the thread can't take a message, why + goes in the field's place. --}} - + @if (\App\Devnull\Display::fadesInBar()) @include('native.partials.composer-fade', ['ref' => 'composer-fade', 'inBar' => true]) @endif - + @if ($canPush) {{-- The members to mention, what you're replying to and the photos on the draft each keep a slot, diff --git a/resources/views/native/partials/composer-box.blade.php b/resources/views/native/partials/composer-box.blade.php index 4976653f..5cb53133 100644 --- a/resources/views/native/partials/composer-box.blade.php +++ b/resources/views/native/partials/composer-box.blade.php @@ -2,7 +2,7 @@ A composer bar's field, tools and send button, laid out the way the Claude and Messages apps lay theirs out: the field across the top, growing to its five lines, and under it a row with the tools on the left and a round send button in your colour on the right. The same on both platforms. Nothing is drawn around them: they sit straight on - the bar, which is the surface, under the fade the screen lays over its foot (see partials/composer-fade). + the bar, which is glass on iOS and the surface on Android, under the fade at its top (see partials/composer-fade). $ref names the box ("{$ref}-box", also its key, so the field keeps its place as rows above it come and go) and its rows ("{$ref}-field-row", "{$ref}-actions"). $field is the partial that draws the field, keyed itself, so it stays diff --git a/resources/views/native/partials/composer-fade.blade.php b/resources/views/native/partials/composer-fade.blade.php index b7bb3b91..7a817f43 100644 --- a/resources/views/native/partials/composer-fade.blade.php +++ b/resources/views/native/partials/composer-fade.blade.php @@ -1,11 +1,12 @@ {{-- - The soft edge between a screen and its composer bar: a gradient from see-through at the top to the surface at the - bottom, where the bar's rows start, so whatever scrolls down to the bar fades out instead of meeting a hard line. - Its colours come from Display::composerFade(). + The soft edge between a screen and its composer bar: a gradient from see-through at the top to the bar's surface at + the bottom, where the bar's rows start, so whatever scrolls down to the bar fades out instead of meeting a hard + line. Its colours come from Display::composerFade(). Where it goes depends on the platform (Display::fadesInBar()). On iOS the screen runs on under the bar, so the fade - is the bar's first row ($inBar), over what runs under it. On Android the screen stops at the bar, so the fade lies - over the foot of the screen's scroll view, at the bottom of the stack around it. $ref names it. + is the bar's first row ($inBar), over what runs under it, and the bar's glass fades in under it over the same + height (see Display::composerBarGlass()). On Android the screen stops at the bar, so the fade lies over the foot of + the screen's scroll view, at the bottom of the stack around it. $ref names it. --}} @php($inBar ??= false) diff --git a/tests/Feature/Screens/RemotesComposerTest.php b/tests/Feature/Screens/RemotesComposerTest.php index 9cc246f3..637ed790 100644 --- a/tests/Feature/Screens/RemotesComposerTest.php +++ b/tests/Feature/Screens/RemotesComposerTest.php @@ -285,32 +285,40 @@ function threadWithAda(string $platform = 'ios'): TestableComponent ->and(nodeByRef($screen, 'push')['props']['a11y_label'] ?? nodeByRef($screen, 'push')['a11y_label'] ?? null)->toBe('Push'); })->with(['ios', 'android']); -it('puts the bar on the surface with no glass or line, and fades the thread out above it, on both platforms', function (string $platform) { +it('puts the bar on glass on iOS and the surface on Android, with no box or line, and fades the thread out above it', function (string $platform) { serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); $screen = threadWithAda($platform); + $bottomBar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); $bar = nodeByRef($screen, 'composer-bar'); $fade = nodeByRef($screen, 'composer-fade'); - $surface = strtoupper(config('native-ui.theme.light.surface')); + $surface = substr(strtoupper(config('native-ui.theme.light.surface')), 1); + $darkSurface = substr(strtoupper(config('native-ui.theme.dark.surface')), 1); expect($bar['props']['glass'] ?? null)->toBeNull() - ->and(nodeByRef($screen, 'composer-rows')['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) ->and(childRefs($screen, 'composer-rows')[0])->toBe('mention-slot') ->and(nodeByRef($screen, 'message-box')['style']['border_width'] ?? 0)->toEqual(0) ->and(nodeByRef($screen, 'message-box')['style']['bg_color'] ?? null)->toBeNull() - ->and($fade['props']['gradient_stops'] ?? null)->toBe('#00'.substr($surface, 1).',#B3'.substr($surface, 1).','.$surface) ->and($fade['layout']['height'] ?? null)->toEqual(Display::ComposerFadeHeight); if ($platform === 'ios') { - // The thread runs on under the bar, so the bar draws the fade at its top, and has no background of its own, - // which iOS would paint behind the fade. - expect(childRefs($screen, 'composer-bar'))->toBe(['composer-fade', 'composer-rows']) + // The thread runs on under the bar, which is glass, so it shows through blurred. The bar draws the fade at its + // top, ending at the glass's tint, and its rows carry the tint, in either appearance. The bar itself has no + // background, which iOS would paint behind the fade. + expect($bottomBar['props']['glass'] ?? null)->toBe(1) + ->and(childRefs($screen, 'composer-bar'))->toBe(['composer-fade', 'composer-rows']) ->and($bar['style']['bg_color'] ?? null)->toBeNull() + ->and(nodeByRef($screen, 'composer-rows')['style']['bg_color'] ?? null)->toBe('#66'.$surface) + ->and(nodeByRef($screen, 'composer-rows')['props']['dark_bg_color'] ?? null)->toBe('#66'.$darkSurface) + ->and($fade['props']['gradient_stops'] ?? null)->toBe('#00'.$surface.',#66'.$surface) ->and(childRefs($screen, 'thread-stack'))->not->toContain('composer-fade'); } else { - // The thread stops at the bar, so the fade lies over its foot, and the bar is the surface. - expect(childRefs($screen, 'composer-bar'))->toBe(['composer-rows']) + // No glass on Android. The thread stops at the bar, so the fade lies over its foot, and the bar is the surface. + expect($bottomBar['props']['glass'] ?? null)->toBeNull() + ->and(childRefs($screen, 'composer-bar'))->toBe(['composer-rows']) ->and($bar['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) + ->and(nodeByRef($screen, 'composer-rows')['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) + ->and($fade['props']['gradient_stops'] ?? null)->toBe('#00'.$surface.',#B3'.$surface.',#'.$surface) ->and(array_slice(childRefs($screen, 'thread-stack'), -1))->toBe(['composer-fade']); } })->with(['ios', 'android']); @@ -319,8 +327,8 @@ function threadWithAda(string $platform = 'ios'): TestableComponent serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); $screen = threadWithAda(); - $light = strtoupper(config('native-ui.theme.light.surface')); - $dark = strtoupper(config('native-ui.theme.dark.surface')); + $light = substr(strtoupper(config('native-ui.theme.light.surface')), 1); + $dark = substr(strtoupper(config('native-ui.theme.dark.surface')), 1); expect(str_ends_with(nodeByRef($screen, 'composer-fade')['props']['gradient_stops'], $light))->toBeTrue(); From a529a8731f2b39ca382f6b7ee19b81ac5a643ed9 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Wed, 18 Nov 2026 02:12:22 +0000 Subject: [PATCH 10/46] Put the reply bar on Liquid Glass on iOS, as Remotes does The commit page's reply bar takes the same glass as the Remotes composer: the page shows through it blurred, the glass fades in at the top and runs on under the home indicator, and the rows tint it with the surface. It needs the same patched mobile-air. Android is unchanged. Co-Authored-By: Claude Opus 5.5 --- .../views/native/commit-detail.blade.php | 11 ++--- tests/Feature/Screens/CommitDetailTest.php | 42 ++++++++++++------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index 46adefdd..3667a822 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -124,9 +124,10 @@ @if ($commit) {{-- The reply bar, drawn as the Remotes composer is: the field across the top and a row under it with the - tools on the left and the round send button on the right (see partials/composer-box), straight on the - surface, with the page fading out above it (see partials/composer-fade). native:bottom-bar takes no classes - of its own, so the bar is painted from this column, which also fills the strip under the home indicator. + tools on the left and the round send button on the right (see partials/composer-box), with the page fading + out above it (see partials/composer-fade). On iOS the bar is Liquid Glass, faded in at the top, so the page + shows through it blurred (see Display::composerBarGlass()). On Android it's the surface, painted from this + column. Either fills the strip under the home indicator. The bar does everything the composer sheet did for a reply, so a reply never needs the sheet, whose presenting takes the keyboard down and back up on both platforms. The photo button adds photos from the @@ -138,12 +139,12 @@ A "post as" avatar, for people in a GitHub organization, goes at the start of the row as composer-box's $lead. --}} - + @if (\App\Devnull\Display::fadesInBar()) @include('native.partials.composer-fade', ['ref' => 'reply-fade', 'inBar' => true]) @endif - + {{-- The people to mention and the photos on the reply keep a slot each above the field, empty and 0.1pt tall when there's nothing in it, so the field's row never moves. Android rebuilds a row that diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 3a89d1ca..8b692e51 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -865,26 +865,40 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): expect(pressFeedbackInScroller($screen))->toBe([]); }); -it('puts the reply bar on the surface with no glass or line, and fades the page out above it, on both platforms', function (string $platform) { +it('puts the reply bar on glass on iOS and the surface on Android, with no line, and fades the page out above it', function (string $platform) { fakeThread(); $screen = Native::visit('/log/commits/c2', platform: $platform); - $bar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar')['children'][0]; - $surface = strtoupper(config('native-ui.theme.light.surface')); + $bottomBar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); + $bar = $bottomBar['children'][0]; + $surface = substr(strtoupper(config('native-ui.theme.light.surface')), 1); + $darkSurface = substr(strtoupper(config('native-ui.theme.dark.surface')), 1); - // The bar's rows have the surface. The bar itself has it only on Android: iOS would paint it behind the fade. expect($bar['ref'] ?? null)->toBe('reply-bar') ->and($bar['props']['glass'] ?? null)->toBeNull() - ->and($bar['style']['bg_color'] ?? null)->toBe($platform === 'ios' ? null : config('native-ui.theme.light.surface')) - ->and(nodeByRef($screen, 'reply-rows')['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) - ->and(nodeByRef($screen, 'reply-rows')['props']['dark_bg_color'] ?? null)->toBe(config('native-ui.theme.dark.surface')) - ->and(childRefs($screen, 'reply-rows')[0])->toBe('reply-mention-slot') - ->and(str_ends_with(nodeByRef($screen, 'reply-fade')['props']['gradient_stops'] ?? '', $surface))->toBeTrue(); - - // On iOS the page runs on under the bar, which draws the fade. On Android the page stops at the bar, and the fade - // lies over its foot. - expect(childRefs($screen, 'reply-bar'))->toBe($platform === 'ios' ? ['reply-fade', 'reply-rows'] : ['reply-rows']) - ->and(childRefs($screen, 'thread-stack'))->toBe($platform === 'ios' ? ['thread-scroll'] : ['thread-scroll', 'reply-fade']); + ->and(childRefs($screen, 'reply-rows')[0])->toBe('reply-mention-slot'); + + if ($platform === 'ios') { + // The page runs on under the bar, which is glass, so it shows through blurred. The bar draws the fade at its + // top, ending at the glass's tint, and its rows carry the tint. The bar itself has no background, which iOS + // would paint behind the fade. + expect($bottomBar['props']['glass'] ?? null)->toBe(1) + ->and($bar['style']['bg_color'] ?? null)->toBeNull() + ->and(nodeByRef($screen, 'reply-rows')['style']['bg_color'] ?? null)->toBe('#66'.$surface) + ->and(nodeByRef($screen, 'reply-rows')['props']['dark_bg_color'] ?? null)->toBe('#66'.$darkSurface) + ->and(nodeByRef($screen, 'reply-fade')['props']['gradient_stops'] ?? null)->toBe('#00'.$surface.',#66'.$surface) + ->and(childRefs($screen, 'reply-bar'))->toBe(['reply-fade', 'reply-rows']) + ->and(childRefs($screen, 'thread-stack'))->toBe(['thread-scroll']); + } else { + // No glass on Android. The page stops at the bar, which is the surface, and the fade lies over its foot. + expect($bottomBar['props']['glass'] ?? null)->toBeNull() + ->and($bar['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) + ->and(nodeByRef($screen, 'reply-rows')['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) + ->and(nodeByRef($screen, 'reply-rows')['props']['dark_bg_color'] ?? null)->toBe(config('native-ui.theme.dark.surface')) + ->and(str_ends_with(nodeByRef($screen, 'reply-fade')['props']['gradient_stops'] ?? '', ',#'.$surface))->toBeTrue() + ->and(childRefs($screen, 'reply-bar'))->toBe(['reply-rows']) + ->and(childRefs($screen, 'thread-stack'))->toBe(['thread-scroll', 'reply-fade']); + } })->with(['ios', 'android']); it('ends the page above the reply bar, and further as the draft grows', function () { From cbd3bc480aa5bdeb02987d5421530f4f5195707b Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Wed, 18 Nov 2026 03:17:00 +0000 Subject: [PATCH 11/46] Line the reply bar's Post as avatar up with the field's text The avatar led the row at the row's own inset, 12pt left of the text above it, where the photo button's icon used to line up. post-as takes an inset now, padded inside its tap target, and the bar passes pl-3. Co-Authored-By: Claude Opus 5.5 --- resources/views/native/commit-detail.blade.php | 6 +++--- resources/views/native/partials/post-as.blade.php | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index b7bc855b..f2645514 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -137,8 +137,8 @@ the stash, then how long the reply is near the limit. A member of a GitHub organization has the web's Post as at the start of the row, as composer-box's $lead: - the avatar of whoever the reply goes out as, which opens the menu (see PostAs). The send button is then - filled with that one's lane. + the avatar of whoever the reply goes out as, lined up with the field's text, which opens the menu (see + PostAs). The send button is then filled with that one's lane. --}} @php($replyPostingMe = app(\App\Devnull\Account::class)->user()) @php($replyPostsAs = $replyPostingMe !== null && \App\Devnull\PostAs::offered($replyAuthor)) @@ -170,7 +170,7 @@ @include('native.partials.composer-box', [ 'ref' => 'reply', 'field' => $replyPreviewing ? 'native.partials.reply-preview' : 'native.partials.reply-field', - 'lead' => $replyPostsAs ? [['native.partials.post-as', ['ref' => 'reply-post-as', 'me' => $replyPostingMe, 'picked' => $replyAuthor, 'method' => 'postAsInReply', 'size' => 28]]] : [], + 'lead' => $replyPostsAs ? [['native.partials.post-as', ['ref' => 'reply-post-as', 'me' => $replyPostingMe, 'picked' => $replyAuthor, 'method' => 'postAsInReply', 'size' => 28, 'inset' => 'pl-3']]] : [], 'tools' => [ ['ref' => 'reply-add-photos', 'icon' => \App\Icons\Lucide::ImagePlus, 'label' => $photosFull ? 'A reply can have up to 3 photos' : 'Add photos', 'menu' => $photosFull ? null : \App\Devnull\ComposerMenu::photoItems(), 'disabled' => $photosFull], ['ref' => 'reply-preview', 'icon' => \App\Icons\Lucide::Eye, 'label' => $replyPreviewing ? 'Edit' : 'Preview', 'press' => 'toggleReplyPreview', 'active' => $replyPreviewing], diff --git a/resources/views/native/partials/post-as.blade.php b/resources/views/native/partials/post-as.blade.php index 64f9d176..b22f86a8 100644 --- a/resources/views/native/partials/post-as.blade.php +++ b/resources/views/native/partials/post-as.blade.php @@ -2,16 +2,18 @@ Who a composer posts as (see PostAs): the avatar of whoever it is now, round for you and a rounded square for an organization, with a small chevron on its corner, as the web's Post as button draws it. A tap opens the menu of you and your organizations, which calls $method with the handle picked, or '' for you. With $withName, their name and - handle follow the avatar, for the sheet, which has the room. + handle follow the avatar, for the sheet, which has the room. $inset pads it inside its tap target, so a bar can line + the avatar up with its field. $picked is the handle the composer holds. An organization you've left since posts as you, so your avatar shows. --}} @php($size ??= 32) @php($withName ??= false) +@php($inset ??= '') @php($author = \App\Devnull\PostAs::author($picked)) @php($identity = $author ?? $me) - + @include('native.partials.avatar', ['user' => $identity, 'size' => $size]) From eaeffdc1b582bc813b96f82ba34f3fbcafa0a87c Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Wed, 18 Nov 2026 05:05:18 +0000 Subject: [PATCH 12/46] Treat an organization's commits as yours when you're a member On the web any member of an organization owns its commits, whoever posted them (Commit::isOwnedBy on the server, useOwnsCommit on the web). The app only counted commits authored by you. Now one Ownership class decides it, from your id and the organizations GET /me last listed, and everything that asked "is this mine" asks it instead. For a member, an organization's commit now offers Delete (in More and in the commit page's nav bar), shows its star count instead of a star, can be quoted while pending, and can't be reported or have its poll voted on. Someone outside the org still gets the star and Report and never Delete. Pin stays person-only, as on the server and the web. No one gets a pastel on an organization's commit, matching the web, which hides it because it would go to whoever posted it. The API only lists who starred an organization's commit to the member who posted it, though the web shows it to every member. The stars sheet now says so on a 404 instead of offering Try again. If devnull refuses a delete because you've left the org, its message shows and the app asks /me again, so the commit stops offering Delete. Rows are cached against your organizations too, so they redraw when that changes. Deleting or posting an organization's commit no longer changes your own profile's kept commit count or list. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Account.php | 8 + app/Devnull/CommitMenu.php | 15 +- app/Devnull/Data/Commit.php | 11 +- app/Devnull/LastVisit.php | 8 +- app/Devnull/Ownership.php | 72 +++++ app/Devnull/ResponseCache.php | 35 ++- app/Devnull/RowInputs.php | 2 + app/NativeComponents/CommitDetail.php | 6 +- .../Concerns/OpensCommitSheet.php | 14 +- .../Concerns/OpensStargazers.php | 18 +- .../Concerns/RefreshesInBackground.php | 15 +- .../Concerns/ShowsCommits.php | 38 ++- .../Concerns/TalksToDevnull.php | 9 + .../Concerns/VotesOnPolls.php | 4 +- app/NativeComponents/Log.php | 12 +- app/NativeComponents/Organization.php | 1 + app/NativeComponents/Profile.php | 1 + app/NativeComponents/Search.php | 1 + app/NativeComponents/Starred.php | 1 + .../native/partials/commit-actions.blade.php | 14 +- .../native/partials/commit-poll.blade.php | 10 +- .../partials/stargazers-sheet.blade.php | 7 +- .../Screens/OrganizationCommitsTest.php | 256 ++++++++++++++++++ tests/Unit/Devnull/TimelineTest.php | 17 +- 24 files changed, 503 insertions(+), 72 deletions(-) create mode 100644 app/Devnull/Ownership.php create mode 100644 tests/Feature/Screens/OrganizationCommitsTest.php diff --git a/app/Devnull/Account.php b/app/Devnull/Account.php index 2163391d..07f3b10a 100644 --- a/app/Devnull/Account.php +++ b/app/Devnull/Account.php @@ -228,6 +228,14 @@ public function organizations(): array return is_array($kept) ? array_values(array_map(User::fromArray(...), array_filter($kept, is_array(...)))) : []; } + /** + * Which commits are yours: your own and your organizations' (see Ownership). + */ + public function ownership(): Ownership + { + return Ownership::of($this->user(), $this->organizations()); + } + /** * Remembers the organizations you can post as. With null, from a devnull too old to say, it keeps what it had. * diff --git a/app/Devnull/CommitMenu.php b/app/Devnull/CommitMenu.php index d566caf9..89a2b1e2 100644 --- a/app/Devnull/CommitMenu.php +++ b/app/Devnull/CommitMenu.php @@ -3,7 +3,6 @@ namespace App\Devnull; use App\Devnull\Data\Commit; -use App\Devnull\Data\User; use App\Icons\Lucide; use Native\Mobile\Edge\Elements\TopBarAction; use Native\Mobile\Edge\Layouts\Builders\NavAction; @@ -13,26 +12,28 @@ * partials/commit-actions): Share link on every commit; Pin to profile or * Unpin from profile on your own published commit, not a reply; then, after a * divider, Report commit on someone else's published commit, or Delete commit - * on your own. Each item names the commit, so a tap never rebuilds anything - * from an attribute (see ShowsCommits). + * on yours. An organization's commit is yours while you're a member, whoever + * posted it (see Ownership), so every member gets Delete, as on the web. Only + * a person has a profile to pin to, so it never gets Pin. Each item names the + * commit, so a tap never rebuilds anything from an attribute (see ShowsCommits). */ final class CommitMenu { /** * @return list */ - public static function items(Commit $commit, ?User $viewer): array + public static function items(Commit $commit, Ownership $ownership): array { - $isOwn = $viewer !== null && $commit->author->id === $viewer->id; + $isOwn = $ownership->owns($commit); $items = []; $items[] = self::item($commit, 'share', 'Share link', Lucide::Link, 'shareCommit'); - if ($isOwn && $commit->isApproved() && $commit->parentId === null) { + if ($ownership->isYourOwn($commit) && $commit->isApproved() && $commit->parentId === null) { $items[] = self::item($commit, 'pin', $commit->isPinned ? 'Unpin from profile' : 'Pin to profile', Lucide::Pin, 'togglePin'); } - if ($viewer !== null && ! $isOwn && $commit->isApproved()) { + if ($ownership->isSignedIn() && ! $isOwn && $commit->isApproved()) { $items[] = NavAction::divider(); $items[] = self::item($commit, 'report', 'Report commit', Lucide::Flag, 'reportCommit'); } elseif ($isOwn) { diff --git a/app/Devnull/Data/Commit.php b/app/Devnull/Data/Commit.php index 941f4ce3..1175a11e 100644 --- a/app/Devnull/Data/Commit.php +++ b/app/Devnull/Data/Commit.php @@ -4,6 +4,7 @@ use App\Devnull\Display; use App\Devnull\Lane; +use App\Devnull\Ownership; use Carbon\CarbonImmutable; use Closure; use Throwable; @@ -327,15 +328,15 @@ public function isApproved(): bool } /** - * Whether $viewer may vote on the commit's poll, as the web decides it: someone else's published commit, whose - * poll is open and hasn't had their vote yet. + * Whether you may vote on the commit's poll, as the web decides it: a published commit that isn't yours or your + * organization's (see Ownership), whose poll is open and hasn't had your vote yet. */ - public function canBeVotedOnBy(?User $viewer): bool + public function canBeVotedOnBy(Ownership $ownership): bool { - return $viewer !== null + return $ownership->isSignedIn() && $this->poll !== null && $this->isApproved() - && $this->author->id !== $viewer->id + && ! $ownership->owns($this) && $this->poll->closesAt !== null && ! $this->poll->hasVoted && ! $this->poll->showsResults() diff --git a/app/Devnull/LastVisit.php b/app/Devnull/LastVisit.php index f88e01b2..4a951c89 100644 --- a/app/Devnull/LastVisit.php +++ b/app/Devnull/LastVisit.php @@ -36,13 +36,13 @@ public function remember(string $userId, string $log, array $commits): void /** * The commit the marker goes above, or null for a first visit, when nothing is - * new, or when the only new commits are your own. + * new, or when the only new commits are yours or your organizations' (see Ownership). * * @param list $commits newest first */ - public static function firstSeenId(array $commits, ?string $seenAt, ?string $userId): ?string + public static function firstSeenId(array $commits, ?string $seenAt, Ownership $ownership): ?string { - if ($seenAt === null || $userId === null) { + if ($seenAt === null || ! $ownership->isSignedIn()) { return null; } @@ -58,7 +58,7 @@ public static function firstSeenId(array $commits, ?string $seenAt, ?string $use } foreach (array_slice($commits, 0, $index) as $newer) { - if ($newer->author->id !== $userId) { + if (! $ownership->owns($newer)) { return $commit->id; } } diff --git a/app/Devnull/Ownership.php b/app/Devnull/Ownership.php new file mode 100644 index 00000000..99f52478 --- /dev/null +++ b/app/Devnull/Ownership.php @@ -0,0 +1,72 @@ + $organizationIds + */ + public function __construct( + public ?string $userId = null, + public array $organizationIds = [], + ) {} + + /** + * @param list $organizations + */ + public static function of(?User $user, array $organizations = []): self + { + $userId = $user === null || $user->id === '' ? null : $user->id; + + if ($userId === null) { + return new self; + } + + return new self($userId, array_values(array_filter( + array_map(fn (User $organization): string => $organization->id, $organizations), + fn (string $id): bool => $id !== '' && $id !== $userId, + ))); + } + + public function isSignedIn(): bool + { + return $this->userId !== null; + } + + /** + * Whether the commit is yours: by you, or by an organization you're in. + */ + public function owns(Commit $commit): bool + { + $author = $commit->author->id; + + return $this->userId !== null && $author !== '' && ($author === $this->userId || in_array($author, $this->organizationIds, true)); + } + + /** + * Whether you made the commit as yourself, not as an organization. + */ + public function isYourOwn(Commit $commit): bool + { + return $this->userId !== null && $commit->author->id === $this->userId; + } +} diff --git a/app/Devnull/ResponseCache.php b/app/Devnull/ResponseCache.php index fadaa8a0..cc37bb14 100644 --- a/app/Devnull/ResponseCache.php +++ b/app/Devnull/ResponseCache.php @@ -396,7 +396,9 @@ public function pastelGiven(array $json): void /** * You committed. A commit goes on top of your logs and your profile; a reply - * goes under its parent and counts there, and on top of your replies. + * goes under its parent and counts there, and on top of your replies. One + * you posted as an organization is the organization's, so it stays off + * your profile and its counts, as devnull keeps it. * * @param array $commit */ @@ -409,14 +411,17 @@ public function commitAdded(array $commit): void } $parentId = is_string($commit['parent_id'] ?? null) ? $commit['parent_id'] : null; + $onYourProfile = ! self::isOrganizations($commit); if ($parentId === null) { // Trending is ranked, so a new commit has no place at the top of it. - foreach (['log/following', 'log/latest', "users/{$me}/commits"] as $path) { + foreach (['log/following', 'log/latest', ...($onYourProfile ? ["users/{$me}/commits"] : [])] as $path) { $this->patch($path, [], fn (array $json): array => self::prepend($json, $commit)); } - $this->patch("users/{$me}", [], fn (array $json): array => self::count($json, 'commits_count', 1)); + if ($onYourProfile) { + $this->patch("users/{$me}", [], fn (array $json): array => self::count($json, 'commits_count', 1)); + } return; } @@ -425,7 +430,10 @@ public function commitAdded(array $commit): void $this->patch("commits/{$parentId}/replies", [], fn (array $json): array => ($json['meta']['next_cursor'] ?? null) === null ? [...$json, 'data' => [...self::without($json['data'] ?? [], $commit['id']), $commit]] : $json); - $this->patch("users/{$me}/commits", ['replies' => '1'], fn (array $json): array => self::prepend($json, $commit)); + if ($onYourProfile) { + $this->patch("users/{$me}/commits", ['replies' => '1'], fn (array $json): array => self::prepend($json, $commit)); + } + $this->patchCommit($parentId, fn (array $parent): array => self::withNewestReply([...$parent, 'replies_count' => (int) ($parent['replies_count'] ?? 0) + 1], $commit)); } @@ -450,11 +458,14 @@ private static function withNewestReply(array $parent, array $reply): array } /** - * You deleted a commit: it leaves every list, its page goes, and its parent counts one reply fewer. + * You deleted a commit: it leaves every list, its page goes, and its parent + * counts one reply fewer. Your profile counts one commit fewer, unless it + * was an organization's you're in (see Ownership). */ public function commitDeleted(string $id): void { - $parentId = $this->findCommit($id)['parent_id'] ?? null; + $found = $this->findCommit($id); + $parentId = $found['parent_id'] ?? null; $this->rememberDeletion($id); @@ -465,11 +476,21 @@ public function commitDeleted(string $id): void if (is_string($parentId) && $parentId !== '') { $this->patchCommit($parentId, fn (array $parent): array => [...$parent, 'replies_count' => max(0, (int) ($parent['replies_count'] ?? 0) - 1)]); - } elseif (($me = $this->username()) !== null) { + } elseif (($me = $this->username()) !== null && ($found === null || ! self::isOrganizations($found))) { $this->patch("users/{$me}", [], fn (array $json): array => self::count($json, 'commits_count', -1)); } } + /** + * Whether a kept commit is an organization's. + * + * @param array $commit + */ + private static function isOrganizations(array $commit): bool + { + return is_array($commit['author'] ?? null) && ($commit['author']['type'] ?? null) === 'organization'; + } + /** * You followed or unfollowed someone: their profile and your following * count change, and every list of people kept with whether you follow them. diff --git a/app/Devnull/RowInputs.php b/app/Devnull/RowInputs.php index 0659a309..15d208c1 100644 --- a/app/Devnull/RowInputs.php +++ b/app/Devnull/RowInputs.php @@ -25,9 +25,11 @@ final class RowInputs public static function for(Commit $commit, array $scope): array { $viewer = $scope['viewer'] ?? app(Account::class)->user(); + $ownership = $scope['ownership'] ?? app(Account::class)->ownership(); return [ 'viewer' => $viewer?->id, + 'organizations' => $ownership->organizationIds, 'pasteis' => $scope['pasteis'] ?? app(Account::class)->pasteis(), 'stashed' => $scope['stashed'] ?? [], 'unfolded' => $scope['unfolded'] ?? [], diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index 23435b1b..dbc088eb 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -844,9 +844,12 @@ private function loadTombstoneReplies(string $id): void } } + /** + * Whether the commit is yours, or an organization's you're in, which puts Delete in the nav bar (see Ownership). + */ public function isOwn(): bool { - return $this->commit !== null && $this->commit->author->username === $this->me()?->username; + return $this->commit !== null && $this->ownership()->owns($this->commit); } public function render(): View @@ -861,6 +864,7 @@ public function render(): View 'replyRows' => $this->replyRows, 'myColour' => $this->myColour(), 'viewer' => $viewer, + 'ownership' => $this->ownership(), 'stashed' => app(Stash::class)->names($viewer?->id), 'pasteis' => app(Account::class)->pasteis(), 'rows' => $this->commit === null ? [] : Timeline::thread( diff --git a/app/NativeComponents/Concerns/OpensCommitSheet.php b/app/NativeComponents/Concerns/OpensCommitSheet.php index 4bcc9cf4..06df216a 100644 --- a/app/NativeComponents/Concerns/OpensCommitSheet.php +++ b/app/NativeComponents/Concerns/OpensCommitSheet.php @@ -540,18 +540,24 @@ private function openFailedCommit(PendingWrite $write): bool return $this->sheetOpen && $this->sheetStashName() === $write->stashName(); } + /** + * A published commit, or one of yours still waiting for approval, as the web's Quote shows. + */ private function canQuote(Commit $commit): bool { - $viewer = $this->me(); + $ownership = $this->ownership(); - return $viewer !== null && ! $commit->isDeleted() && ! $commit->isStaged() && ($commit->isApproved() || $commit->author->id === $viewer->id); + return $ownership->isSignedIn() && ! $commit->isDeleted() && ! $commit->isStaged() && ($commit->isApproved() || $ownership->owns($commit)); } + /** + * Someone else's published commit: never yours or an organization's you're in, which devnull won't take a report of. + */ private function canReport(Commit $commit): bool { - $viewer = $this->me(); + $ownership = $this->ownership(); - return $viewer !== null && ! $commit->isDeleted() && $commit->isApproved() && $commit->author->id !== $viewer->id; + return $ownership->isSignedIn() && ! $commit->isDeleted() && $commit->isApproved() && ! $ownership->owns($commit); } /** diff --git a/app/NativeComponents/Concerns/OpensStargazers.php b/app/NativeComponents/Concerns/OpensStargazers.php index 84024cf4..5ec6fe7f 100644 --- a/app/NativeComponents/Concerns/OpensStargazers.php +++ b/app/NativeComponents/Concerns/OpensStargazers.php @@ -12,6 +12,11 @@ * opening their profile. As on the web, only you see who starred your * commits, and it asks devnull again each time it opens, so stars given in * the meantime show. + * + * An organization's commit is every member's (see Ownership), so its star + * opens the sheet too. The web lists who starred it to any member, but the + * API only to the member who posted it, and to anyone else it says the list + * isn't there. The sheet says so then, rather than offering Try again. */ trait OpensStargazers { @@ -37,6 +42,11 @@ trait OpensStargazers */ public bool $stargazersFailed = false; + /** + * Whether devnull only shows who starred this organization's commit to the member who posted it. + */ + public bool $stargazersForPoster = false; + /** * The load the sheet is waiting for. An answer to an earlier one, sent * before the sheet closed or opened again, is left alone. @@ -47,7 +57,7 @@ public function openStargazers(string $id): void { $commit = $this->shownCommit($id); - if ($commit === null || $commit->isDeleted() || $commit->starsCount === 0 || $commit->author->id !== $this->me()?->id) { + if ($commit === null || $commit->isDeleted() || $commit->starsCount === 0 || ! $this->ownership()->owns($commit)) { return; } @@ -81,10 +91,11 @@ public function loadStargazers(): void $this->stargazers = [...$this->stargazers, ...$page->items]; $this->stargazersCursor = $page->nextCursor; $this->loadingStargazers = false; - }, again: true, quiet: true, failed: function () use ($load): void { + }, again: true, quiet: true, failed: function (int $status = 0) use ($load): void { if ($load === $this->stargazersLoad) { $this->loadingStargazers = false; - $this->stargazersFailed = true; + $this->stargazersForPoster = $status === 404 && $this->shownCommit((string) $this->stargazersOf)?->author->isOrganization === true; + $this->stargazersFailed = ! $this->stargazersForPoster; } }); } @@ -113,5 +124,6 @@ public function stargazersClosed(): void $this->stargazersCursor = null; $this->loadingStargazers = false; $this->stargazersFailed = false; + $this->stargazersForPoster = false; } } diff --git a/app/NativeComponents/Concerns/RefreshesInBackground.php b/app/NativeComponents/Concerns/RefreshesInBackground.php index a64a3a82..732d4f8a 100644 --- a/app/NativeComponents/Concerns/RefreshesInBackground.php +++ b/app/NativeComponents/Concerns/RefreshesInBackground.php @@ -84,12 +84,13 @@ protected function cached(string $path, array $query = []): ?array * lands. A refresh of the same thing already on its way isn't sent twice, * unless $again says it must be. A $quiet one never says it failed on the * screen. It only tells $failed, for a caller that has something else to - * do then. One $withImages brings the answer's images down before it - * lands, rather than after in a task of their own (see FetchInBackground). + * do then, with devnull's status code, or 0 when it never answered. One + * $withImages brings the answer's images down before it lands, rather + * than after in a task of their own (see FetchInBackground). * * @param array $query * @param Closure(array): void $apply - * @param (Closure(): void)|null $failed + * @param (Closure(int): void)|null $failed */ protected function refresh(string $path, array $query, Closure $apply, bool $again = false, bool $quiet = false, ?Closure $failed = null, bool $withImages = false, bool $retried = false): void { @@ -103,7 +104,7 @@ protected function refresh(string $path, array $query, Closure $apply, bool $aga $request = app(Client::class)->signedGet($path, $query); } catch (KeychainUnavailable $exception) { if ($quiet) { - $failed?->__invoke(); + $failed?->__invoke(0); } else { $this->couldNotRefresh($exception->getMessage()); } @@ -132,7 +133,7 @@ protected function refresh(string $path, array $query, Closure $apply, bool $aga unset($this->refreshing[$key]); if ($quiet) { - $failed?->__invoke(); + $failed?->__invoke(0); } else { $this->couldNotRefresh('fatal: '.$exception->getMessage()); } @@ -219,7 +220,7 @@ protected function forgetRefreshes(): void * @param array{status?: int, json?: mixed, retry_after?: string, from_devnull?: bool} $result * @param array $query * @param Closure(array): void $apply - * @param (Closure(): void)|null $failed + * @param (Closure(int): void)|null $failed */ private function settleRefresh(array $result, string $path, array $query, Closure $apply, bool $quiet, ?Closure $failed = null, bool $withImages = false): void { @@ -247,7 +248,7 @@ private function settleRefresh(array $result, string $path, array $query, Closur } if ($quiet) { - $failed?->__invoke(); + $failed?->__invoke($status); return; } diff --git a/app/NativeComponents/Concerns/ShowsCommits.php b/app/NativeComponents/Concerns/ShowsCommits.php index 05407927..28c9c2d8 100644 --- a/app/NativeComponents/Concerns/ShowsCommits.php +++ b/app/NativeComponents/Concerns/ShowsCommits.php @@ -39,6 +39,9 @@ * * A commit can be tapped where a row nests it too: the commit a row quotes, * and the replies a feed shows under a commit. + * + * A commit is yours when you made it or an organization you're in did, as + * devnull decides it (see Ownership). */ trait ShowsCommits { @@ -210,8 +213,8 @@ public function showTime(string $id): void * star goes to devnull from the outbox (see SyncsOutbox). The commit takes * the count devnull sends back, or the star comes back off it if devnull * says no. Like the web, only someone else's published commit can be - * starred, as devnull turns down a star on your own (whose star opens who - * starred it instead, see OpensStargazers). + * starred, as devnull turns down a star on your own or your organization's + * (whose star opens who starred it instead, see OpensStargazers). */ public function toggleStar(string $id): void { @@ -228,7 +231,8 @@ public function toggleStar(string $id): void /** * Gives the commit a pastel, as the web's pastel button does in pastéis * mode: one per tap, from the ten you get each day, on someone else's - * published commit. Its count goes up and your allowance down at once, + * published commit, never an organization's, which has no pastel at all, + * as on the web. Its count goes up and your allowance down at once, * and the pastel goes from the background, so you can keep tapping. When * devnull turns one down, it comes back, and a toast says why in the web's * words. With none left, the toast says so without asking devnull. @@ -238,7 +242,7 @@ public function givePastel(string $id): void $commit = $this->shownCommit($id); $pasteis = app(Account::class)->pasteis(); - if ($commit === null || $pasteis === null || ! $this->canReactTo($commit)) { + if ($commit === null || $pasteis === null || ! $this->canGivePastel($commit)) { return; } @@ -258,8 +262,9 @@ public function givePastel(string $id): void /** * Pin to profile or Unpin from profile, in your own published commit's - * More menu. Once devnull answers, a toast says so in the web's words, and - * a pin takes the place of the one before (see showPinned()). + * More menu. Not an organization's: devnull pins to its author's profile, + * which only a person has. Once devnull answers, a toast says so in the + * web's words, and a pin takes the place of the one before (see showPinned()). */ public function togglePin(string $id): void { @@ -398,7 +403,8 @@ public function shareCommit(string $id): void } /** - * Delete commit, in your own commit's More menu, asks first, as the web does. + * Delete commit, in the More menu of your own commit or an organization's + * you're in, asks first, as the web does. */ public function confirmDelete(string $id): void { @@ -473,6 +479,11 @@ private function pastelGiven(string $id, array $json): void /** * Deletes your commit on devnull, which takes it out of every list kept on * this phone, then the screen lets it go (see showDeleted()). + * + * An organization's commit is only yours while you're in it. When devnull + * turns its delete down, the screen says why in devnull's words, and asks + * GET /me which organizations you're still in, so the commit stops + * offering Delete if you've left. */ public function deleteCommit(string $id): void { @@ -491,6 +502,8 @@ public function deleteCommit(string $id): void if ($deleted === true) { Toasts::say('rm '.$commit->shortHash.' → /dev/null', short: true); $this->showDeleted($id); + } elseif ($this->error !== null && $commit->author->isOrganization && method_exists($this, 'refreshUnreadNotifications')) { + $this->refreshUnreadNotifications(); } } @@ -533,17 +546,22 @@ private function pastelTurnedDown(string $id, ?ApiException $exception): void private function canReactTo(Commit $commit): bool { - return ! $commit->isDeleted() && $commit->isApproved() && $commit->author->id !== $this->me()?->id; + return ! $commit->isDeleted() && $commit->isApproved() && ! $this->ownership()->owns($commit); + } + + private function canGivePastel(Commit $commit): bool + { + return $this->canReactTo($commit) && ! $commit->author->isOrganization; } private function canPin(Commit $commit): bool { - return ! $commit->isDeleted() && $commit->isApproved() && $commit->parentId === null && $commit->author->id === $this->me()?->id; + return ! $commit->isDeleted() && $commit->isApproved() && $commit->parentId === null && $this->ownership()->isYourOwn($commit); } private function canDelete(Commit $commit): bool { - return ! $commit->isDeleted() && ! $commit->isStaged() && $commit->author->id === $this->me()?->id; + return ! $commit->isDeleted() && ! $commit->isStaged() && $this->ownership()->owns($commit); } /** diff --git a/app/NativeComponents/Concerns/TalksToDevnull.php b/app/NativeComponents/Concerns/TalksToDevnull.php index 246acbde..43d3b6a5 100644 --- a/app/NativeComponents/Concerns/TalksToDevnull.php +++ b/app/NativeComponents/Concerns/TalksToDevnull.php @@ -9,6 +9,7 @@ use App\Devnull\Exceptions\KeychainUnavailable; use App\Devnull\Exceptions\Unauthenticated; use App\Devnull\Lane; +use App\Devnull\Ownership; use Closure; /** @@ -62,6 +63,14 @@ protected function me(): ?User return app(Account::class)->user(); } + /** + * Which commits are yours: your own and your organizations' (see Ownership). + */ + protected function ownership(): Ownership + { + return app(Account::class)->ownership(); + } + /** * The theme token for your lane, which the main buttons and the pager tab * underlines are drawn in. diff --git a/app/NativeComponents/Concerns/VotesOnPolls.php b/app/NativeComponents/Concerns/VotesOnPolls.php index 0d6e38a9..d9c78538 100644 --- a/app/NativeComponents/Concerns/VotesOnPolls.php +++ b/app/NativeComponents/Concerns/VotesOnPolls.php @@ -35,7 +35,7 @@ public function choosePollOption(string $id, string $optionId): void { $commit = $this->shownCommit($id); - if ($commit === null || ! $commit->canBeVotedOnBy($this->me()) || ! in_array($optionId, array_map(fn ($option): string => $option->id, $commit->poll?->options ?? []), true)) { + if ($commit === null || ! $commit->canBeVotedOnBy($this->ownership()) || ! in_array($optionId, array_map(fn ($option): string => $option->id, $commit->poll?->options ?? []), true)) { return; } @@ -47,7 +47,7 @@ public function voteOnPoll(string $id): void $commit = $this->shownCommit($id); $choice = $this->pollChoices[$id] ?? null; - if ($commit === null || $choice === null || in_array($id, $this->voting, true) || ! $commit->canBeVotedOnBy($this->me())) { + if ($commit === null || $choice === null || in_array($id, $this->voting, true) || ! $commit->canBeVotedOnBy($this->ownership())) { return; } diff --git a/app/NativeComponents/Log.php b/app/NativeComponents/Log.php index 050e79e2..b9ffff17 100644 --- a/app/NativeComponents/Log.php +++ b/app/NativeComponents/Log.php @@ -6,9 +6,9 @@ use App\Devnull\Data\Commit; use App\Devnull\Data\Page; use App\Devnull\Data\TimelineRow; -use App\Devnull\Data\User; use App\Devnull\Display; use App\Devnull\LastVisit; +use App\Devnull\Ownership; use App\Devnull\ResponseCache; use App\Devnull\RowCache; use App\Devnull\RowWindow; @@ -1169,6 +1169,7 @@ public function render(): Element private function frame(): View { $viewer = $this->me(); + $ownership = $this->ownership(); foreach (self::Logs as $log) { $this->rowCache($log)->startFrame(); @@ -1184,14 +1185,15 @@ private function frame(): View 'loaded' => $this->loaded, 'lastVisitAt' => $this->lastVisitAt, 'error' => $this->error, - ], $viewer, $this->listKey) - : $this->page($log, $this->previewState($log), $viewer, $this->listKeys[$log] ?? 0), self::Logs); + ], $ownership, $this->listKey) + : $this->page($log, $this->previewState($log), $ownership, $this->listKeys[$log] ?? 0), self::Logs); $showing = $pages[array_search($this->log, self::Logs, true)]; return view('native.log', [ 'myColour' => $this->myColour(), 'viewer' => $viewer, + 'ownership' => $ownership, 'pasteis' => app(Account::class)->pasteis(), 'stashed' => app(Stash::class)->names($viewer?->id), 'newCommitsLabel' => $this->newCommitsLabel(), @@ -1208,7 +1210,7 @@ private function frame(): View * @param array $state * @return array */ - private function page(string $log, array $state, ?User $viewer, int $listKey): array + private function page(string $log, array $state, Ownership $ownership, int $listKey): array { /** @var list $commits */ $commits = $state['commits']; @@ -1216,7 +1218,7 @@ private function page(string $log, array $state, ?User $viewer, int $listKey): a $latestCommits = $state['latestCommits']; // Only the log you're on has who to follow: the others show their first few commits. $showsWhoToFollow = $log === $this->log && $this->showsWhoToFollow(); - $rows = $this->timeline($log, $latestCommits, $commits, $log === self::Ranked ? null : LastVisit::firstSeenId($commits, $state['lastVisitAt'], $viewer?->id), $showsWhoToFollow); + $rows = $this->timeline($log, $latestCommits, $commits, $log === self::Ranked ? null : LastVisit::firstSeenId($commits, $state['lastVisitAt'], $ownership), $showsWhoToFollow); return [ 'log' => $log, diff --git a/app/NativeComponents/Organization.php b/app/NativeComponents/Organization.php index c2f3718c..7a42a8ce 100644 --- a/app/NativeComponents/Organization.php +++ b/app/NativeComponents/Organization.php @@ -254,6 +254,7 @@ public function render(): View 'myColour' => $this->myColour(), 'newCommitsLabel' => $this->newCommitsLabel(), 'viewer' => $this->me(), + 'ownership' => $this->ownership(), 'stashed' => app(Stash::class)->names($this->me()?->id), 'pages' => $pages, 'pageIndex' => array_search($this->tab, self::Tabs, true), diff --git a/app/NativeComponents/Profile.php b/app/NativeComponents/Profile.php index d4c1e690..360f48c6 100644 --- a/app/NativeComponents/Profile.php +++ b/app/NativeComponents/Profile.php @@ -899,6 +899,7 @@ public function render(): View 'canRemote' => $this->canRemote(), 'newCommitsLabel' => $this->newCommitsLabel(), 'viewer' => $this->me(), + 'ownership' => $this->ownership(), 'stashed' => app(Stash::class)->names($this->me()?->id), 'pages' => $pages, 'pageIndex' => array_search($this->tab, self::Tabs, true), diff --git a/app/NativeComponents/Search.php b/app/NativeComponents/Search.php index c82ff53d..d05cd1a9 100644 --- a/app/NativeComponents/Search.php +++ b/app/NativeComponents/Search.php @@ -289,6 +289,7 @@ public function render(): View 'searchesCommits' => $this->searchesCommits($term), 'rowCache' => $this->rowCache, 'viewer' => $viewer, + 'ownership' => $this->ownership(), 'stashed' => app(Stash::class)->names($viewer?->id), 'myColour' => $this->myColour(), 'rows' => Timeline::ranked([], $this->commits), diff --git a/app/NativeComponents/Starred.php b/app/NativeComponents/Starred.php index fb69e42c..98fd4021 100644 --- a/app/NativeComponents/Starred.php +++ b/app/NativeComponents/Starred.php @@ -265,6 +265,7 @@ public function render(): View return view('native.starred', [ 'rowCache' => $this->rowCache, 'viewer' => $viewer, + 'ownership' => $this->ownership(), 'stashed' => app(Stash::class)->names($viewer?->id), 'myColour' => $this->myColour(), 'rows' => Timeline::feed($this->commits), diff --git a/resources/views/native/partials/commit-actions.blade.php b/resources/views/native/partials/commit-actions.blade.php index 5c86cf74..690aa60f 100644 --- a/resources/views/native/partials/commit-actions.blade.php +++ b/resources/views/native/partials/commit-actions.blade.php @@ -10,12 +10,14 @@ place, as on the web; elsewhere it opens the commit with its replies showing. Like the web, someone else's commit that isn't approved gets no star or Quote. devnull doesn't let you star your own commits, so on those the star is the count, which opens who starred it (see OpensStargazers), or a faint star until there are any, as on the web. + An organization's commit is yours while you're a member of it, whoever posted it ($ownership, see Ownership). Quote opens a sheet to write the quote in, over the commit being quoted (see commit-sheet). The pastel is the web's: the pastel de nata and how many the commit was given, always, even 0. On someone else's published commit it gives one more per tap; on your own, or one that isn't published, it's just the count. It - only shows in pastéis mode ($pasteis). + only shows in pastéis mode ($pasteis), and never on an organization's commit, which takes no pastéis, as the web + leaves it off. A commit with a quote or a reply you started and didn't send marks that button, as the web does with stash@{0} beside its label. That doesn't fit the row, so here it's a dot after the icon or label, inside the button's 44pt. @@ -44,15 +46,17 @@ @php($iconSize = $compact ? 14 : 16) @php($labelSize = $compact ? 'text-xs' : 'text-[13px]') @php($viewer ??= app(\App\Devnull\Account::class)->user()) +@php($ownership ??= app(\App\Devnull\Account::class)->ownership()) @php($stashed ??= []) @php($hasQuoteStash = in_array('quote-'.$commit->id, $stashed, true)) @php($hasReplyStash = in_array('reply-'.$commit->id, $stashed, true)) -@php($isOwn = $commit->author->id === $viewer?->id) +@php($isOwn = $ownership->owns($commit)) @php($canQuote = $commit->isApproved() || $isOwn) @php($hasThread = $expandable && $commit->replyPreview !== null) @php($showsReplies = $withReplies && ! $hasThread && $repliesCount > 0) @php($pasteis ??= app(\App\Devnull\Account::class)->pasteis()) -@php($canGivePastel = $pasteis !== null && $viewer !== null && ! $isOwn && $commit->isApproved()) +@php($showsPastel = $pasteis !== null && ! $commit->author->isOrganization) +@php($canGivePastel = $showsPastel && $viewer !== null && ! $isOwn && $commit->isApproved()) @php($pastelLabel = \App\Devnull\Display::count($commit->pasteisCount, 'pastel', 'pastéis')) @php($pastelSize = $compact ? 18 : 20) @php($starLabel = ($commit->starred ? 'Unstar commit' : 'Star commit').($commit->starsCount > 0 ? ', '.\App\Devnull\Display::count($commit->starsCount, 'star', 'stars') : '')) @@ -80,7 +84,7 @@ {{ \App\Devnull\Display::compactCount($commit->pasteisCount) }} - @elseif ($pasteis !== null) + @elseif ($showsPastel) {{ \App\Devnull\Display::compactCount($commit->pasteisCount) }} @@ -122,7 +126,7 @@ - + diff --git a/resources/views/native/partials/commit-poll.blade.php b/resources/views/native/partials/commit-poll.blade.php index 9df5bc5a..ea6028ae 100644 --- a/resources/views/native/partials/commit-poll.blade.php +++ b/resources/views/native/partials/commit-poll.blade.php @@ -4,14 +4,14 @@ its percentage in mono on the right, and "4 votes · 3h left" under them all. Without results, the options are plain boxes over the time left. - On someone else's published commit whose poll is open and has no vote of yours yet, you vote as on the web: tap an - option to pick it, its box in Commit Blue on Blue Wash with its radio filled, then Vote, beside the time left, - since votes are final (see VotesOnPolls). Vote spins while it goes, and the poll then shows its results. $static - is the quote card's copy, which never votes. + On a published commit that isn't yours or your organization's, whose poll is open and has no vote of yours yet, you + vote as on the web: tap an option to pick it, its box in Commit Blue on Blue Wash with its radio filled, then Vote, + beside the time left, since votes are final (see VotesOnPolls). Vote spins while it goes, and the poll then shows + its results. $static is the quote card's copy, which never votes. --}} @php($poll = $commit->poll) @php($static ??= false) -@php($canVote = ! $static && $commit->canBeVotedOnBy($viewer ?? app(\App\Devnull\Account::class)->user())) +@php($canVote = ! $static && $commit->canBeVotedOnBy($ownership ?? app(\App\Devnull\Account::class)->ownership())) @php($choice = $pollChoices[$commit->id] ?? null) @php($isVoting = in_array($commit->id, $voting ?? [], true)) diff --git a/resources/views/native/partials/stargazers-sheet.blade.php b/resources/views/native/partials/stargazers-sheet.blade.php index f20394b8..1d3d9253 100644 --- a/resources/views/native/partials/stargazers-sheet.blade.php +++ b/resources/views/native/partials/stargazers-sheet.blade.php @@ -3,6 +3,9 @@ then each of them, newest first, with their avatar, name and handle. A tap opens them. While a page loads, skeleton rows stand in for up to three of them. When one doesn't load, the web's line says so, with Try again, and while there are more, Show more. Nothing is drawn until the sheet opens. + + On an organization's commit that a different member posted, devnull's API won't list who starred it, though the + web does, so the sheet says that instead ($stargazersForPoster). --}} @if ($stargazersOf !== null) @@ -34,7 +37,9 @@ @endif - @if ($stargazersFailed) + @if ($stargazersForPoster) + Only the member who posted this commit can see who starred it here. + @elseif ($stargazersFailed) fatal: could not load stars Try again diff --git a/tests/Feature/Screens/OrganizationCommitsTest.php b/tests/Feature/Screens/OrganizationCommitsTest.php new file mode 100644 index 00000000..d540573e --- /dev/null +++ b/tests/Feature/Screens/OrganizationCommitsTest.php @@ -0,0 +1,256 @@ + 'http://devnull.test']); + signIn(); +}); + +/** + * NativePHP as `GET /me` lists an organization you're in. + * + * @return array + */ +function nativephpMembershipJson(): array +{ + return [ + 'type' => 'organization', + 'id' => 'o-nativephp', + 'role' => 'member', + 'handle' => 'nativephp', + 'name' => 'NativePHP', + 'avatar_url' => 'https://avatars.githubusercontent.com/u/7?v=4', + 'github_url' => 'https://github.com/nativephp', + 'html_url' => 'http://devnull.test/@nativephp', + 'lane' => 5, + ]; +} + +/** + * A commit from NativePHP, posted by whichever member it was: devnull never says who. + * + * @param array $overrides + * @return array + */ +function nativephpCommitJson(array $overrides = []): array +{ + return commitJson(['author' => ['type' => 'organization', 'id' => 'o-nativephp', 'handle' => 'nativephp', 'name' => 'NativePHP', 'lane' => 5], ...$overrides]); +} + +/** + * Makes you a member of NativePHP, as the last `GET /me` said. + */ +function joinNativephp(): void +{ + app(Account::class)->rememberOrganizations(CurrentUser::fromArray(currentUserJson(['organizations' => [nativephpMembershipJson()]]))->organizations); +} + +/** + * The Log showing NativePHP's commit c1, with the API answering $routes besides. + * + * @param array $commit + * @param array $routes + */ +function nativephpCommitOnLog(array $commit = [], array $routes = []): TestableComponent +{ + serveApi([ + 'GET /api/v1/log/following' => [pageJson([nativephpCommitJson(['id' => 'c1', 'body' => 'NativePHP ships', ...$commit])])], + ...$routes, + ]); + + return Native::visit('/log', platform: 'ios'); +} + +it('treats an organization\'s commit as yours when you\'re a member, whoever posted it', function () { + joinNativephp(); + app(Account::class)->rememberPasteis(new Pasteis(Pasteis::Daily, CarbonImmutable::now()->addDay())); + + $screen = nativephpCommitOnLog(['stars_count' => 2]); + + // Delete, as for your own, but no Pin: devnull pins to a person's profile. No Report, as devnull won't take one. + expect(menuItems($screen, 'more-c1'))->toBe([ + ['share-c1', 'Share link', 'custom:link'], + 'divider', + ['delete-c1', 'Delete commit', 'custom:trash-2'], + ]) + // You can't star it, so its star is the count, as on your own. + ->and(rendersRef($screen, 'star-c1'))->toBeFalse() + ->and(nodeByRef($screen, 'star-count-c1')['props']['a11y_label'])->toBe('2 stars, show who starred') + // An organization's commit takes no pastéis from anyone, so the web shows none. + ->and(rendersRef($screen, 'pastel-c1'))->toBeFalse() + ->and(rendersRef($screen, 'pastel-count-c1'))->toBeFalse(); + + $screen->call('toggleStar', 'c1') + ->call('givePastel', 'c1') + ->call('reportCommit', 'c1') + ->call('togglePin', 'c1') + ->assertSet('sheetOpen', false); + + Http::assertNotSent(fn (Request $request): bool => $request->method() !== 'GET'); +}); + +it('lets a member delete an organization\'s commit they didn\'t post', function () { + joinNativephp(); + $deleted = false; + + serveApi(function (Request $request) use (&$deleted) { + return match ($request->method().' '.parse_url($request->url(), PHP_URL_PATH)) { + 'DELETE /api/v1/commits/c1' => tap(Http::response(null, 204), function () use (&$deleted): void { + $deleted = true; + }), + 'GET /api/v1/log/following' => Http::response(pageJson([ + ...($deleted ? [] : [nativephpCommitJson(['id' => 'c1', 'body' => 'Delete me'])]), + commitJson(['id' => 'c2', 'body' => 'Keep me']), + ])), + default => Http::response(currentUserJson(['organizations' => [nativephpMembershipJson()]])), + }; + }); + + Native::visit('/log', platform: 'ios') + ->tap('delete-c1') + ->assertNativeCalled('Dialog.Alert', fn (array $params): bool => $params['title'] === 'Delete this commit?') + ->emitNative(ButtonPressed::class, ['index' => 1, 'label' => 'Delete', 'id' => 'delete-commit']) + ->assertNativeCalled('ToastKit.Show', fn (array $params): bool => str_starts_with($params['message'], 'rm ')) + ->assertDontSee('Delete me') + ->assertSee('Keep me'); + + Http::assertSent(fn (Request $request): bool => $request->method() === 'DELETE' && $request->url() === 'http://devnull.test/api/v1/commits/c1'); +}); + +it('puts Delete in the nav bar of an organization\'s commit page for a member', function () { + joinNativephp(); + fakeApi(['GET /api/v1/commits/c1' => [commitPageJson(nativephpCommitJson(['id' => 'c1']))]]); + + Native::visit('/log/commits/c1', platform: 'ios') + ->assertElement('top_bar_action', fn (array $node): bool => ($node['props']['id'] ?? null) === 'delete'); +}); + +it('offers someone outside the organization a star, the pastel and Report, never Delete', function () { + app(Account::class)->rememberPasteis(new Pasteis(Pasteis::Daily, CarbonImmutable::now()->addDay())); + + $screen = nativephpCommitOnLog(); + + expect(menuItems($screen, 'more-c1'))->toBe([ + ['share-c1', 'Share link', 'custom:link'], + 'divider', + ['report-c1', 'Report commit', 'custom:flag'], + ]) + ->and(rendersRef($screen, 'star-c1'))->toBeTrue() + // Still no pastel: it would go to whoever posted it. + ->and(rendersRef($screen, 'pastel-c1'))->toBeFalse() + ->and(rendersRef($screen, 'pastel-count-c1'))->toBeFalse(); + + $screen->call('confirmDelete', 'c1')->call('deleteCommit', 'c1'); + + Http::assertNotSent(fn (Request $request): bool => $request->method() === 'DELETE'); +}); + +it('lets a member quote an organization\'s commit still waiting for approval, as the web does', function () { + $screen = nativephpCommitOnLog(['status' => 'pending']); + + expect(rendersRef($screen, 'quote-c1'))->toBeFalse(); + + joinNativephp(); + $screen = nativephpCommitOnLog(['status' => 'pending']); + + expect(rendersRef($screen, 'quote-c1'))->toBeTrue(); + + $screen->call('quoteCommit', 'c1')->assertSet('sheetOpen', true); +}); + +it('doesn\'t let a member vote on an organization\'s poll', function () { + $poll = [ + 'id' => 'poll1', + 'closes_at' => now()->addDay()->toIso8601ZuluString(), + 'is_closed' => false, + 'has_voted' => false, + 'total_votes' => null, + 'options' => [ + ['id' => 'o1', 'label' => 'Tabs', 'votes_count' => null, 'voted' => false, 'percentage' => null], + ['id' => 'o2', 'label' => 'Spaces', 'votes_count' => null, 'voted' => false, 'percentage' => null], + ], + ]; + + expect(rendersRef(nativephpCommitOnLog(['poll' => $poll]), 'poll-vote-c1'))->toBeTrue(); + + joinNativephp(); + $screen = nativephpCommitOnLog(['poll' => $poll]); + + expect(rendersRef($screen, 'poll-vote-c1'))->toBeFalse(); + + $screen->call('choosePollOption', 'c1', 'o1')->call('voteOnPoll', 'c1'); + + Http::assertNotSent(fn (Request $request): bool => str_ends_with($request->url(), Client::pollVotesPath('c1'))); +}); + +it('says devnull\'s no when you\'ve left the organization, and stops offering Delete once /me says so', function () { + joinNativephp(); + $left = false; + + serveApi(function (Request $request) use (&$left) { + return match ($request->method().' '.parse_url($request->url(), PHP_URL_PATH)) { + 'DELETE /api/v1/commits/c1' => tap(Http::response(['message' => 'This action is unauthorized.'], 403), function () use (&$left): void { + $left = true; + }), + 'GET /api/v1/log/following' => Http::response(pageJson([nativephpCommitJson(['id' => 'c1', 'body' => 'NativePHP ships'])])), + default => Http::response(currentUserJson(['organizations' => $left ? [] : [nativephpMembershipJson()]])), + }; + }); + + $screen = Native::visit('/log', platform: 'ios'); + $asked = count(sentTo('GET', 'me')); + + $screen->tap('delete-c1') + ->emitNative(ButtonPressed::class, ['index' => 1, 'label' => 'Delete', 'id' => 'delete-commit']) + ->assertSee('This action is unauthorized.') + ->assertSee('NativePHP ships'); + + expect(sentTo('GET', 'me'))->toHaveCount($asked + 1) + ->and(app(Account::class)->organizations())->toBe([]) + ->and(menuItems($screen, 'more-c1'))->toBe([ + ['share-c1', 'Share link', 'custom:link'], + 'divider', + ['report-c1', 'Report commit', 'custom:flag'], + ]); +}); + +it('lists who starred an organization\'s commit, or says only the member who posted it can', function () { + joinNativephp(); + + nativephpCommitOnLog(['stars_count' => 1], ['GET /api/v1/commits/c1/stars' => [pageJson([userJson(['id' => 'u-grace', 'handle' => 'grace', 'name' => 'Grace Hopper'])], path: 'http://devnull.test/api/v1/commits/c1/stars')]]) + ->tap('star-count-c1') + ->assertSee('Grace Hopper') + ->assertDontSee('Only the member who posted this commit can see who starred it here.'); + + // The API answers someone who didn't post it as though the list isn't there, where the web shows it them. + nativephpCommitOnLog(['stars_count' => 1], ['GET /api/v1/commits/c1/stars' => [['message' => 'Not found.'], 404]]) + ->tap('star-count-c1') + ->assertSee('Only the member who posted this commit can see who starred it here.') + ->assertDontSee('fatal: could not load stars') + ->assertDontSee('Try again'); +}); + +it('keeps an organization\'s commits off your profile\'s count, posted or deleted', function () { + keep('users/local_dev', ['data' => userWithCountsJson(commits: 3)]); + keep('users/local_dev/commits', pageJson([commitJson(['id' => 'c0'])])); + keep('log/following', pageJson([nativephpCommitJson(['id' => 'c1']), commitJson(['id' => 'c0'])])); + fakeApi(['DELETE /api/v1/commits/c1' => [null, 204]]); + + app(ResponseCache::class)->commitAdded(nativephpCommitJson(['id' => 'c2'])); + app(Client::class)->deleteCommit('c1'); + + expect(kept('users/local_dev')['data']['commits_count'])->toBe(3) + ->and(array_column(kept('users/local_dev/commits')['data'], 'id'))->toBe(['c0']) + ->and(array_column(kept('log/following')['data'], 'id'))->toBe(['c2', 'c0']); +}); diff --git a/tests/Unit/Devnull/TimelineTest.php b/tests/Unit/Devnull/TimelineTest.php index b21edb2a..c68a082b 100644 --- a/tests/Unit/Devnull/TimelineTest.php +++ b/tests/Unit/Devnull/TimelineTest.php @@ -3,6 +3,7 @@ use App\Devnull\Data\Commit; use App\Devnull\Data\TimelineRow; use App\Devnull\LastVisit; +use App\Devnull\Ownership; use App\Devnull\Timeline; use Carbon\CarbonImmutable; @@ -166,14 +167,18 @@ function describeRows(array $rows): array timelineCommit('c1', 'grace', '2026-10-15T09:00:00Z'), ]; - expect(LastVisit::firstSeenId($commits, '2026-10-15T10:00:00+00:00', 'ada'))->toBe('c2') - ->and(LastVisit::firstSeenId($commits, '2026-10-15T09:30:00+00:00', 'ada'))->toBe('c1') + $ada = new Ownership('ada'); + + expect(LastVisit::firstSeenId($commits, '2026-10-15T10:00:00+00:00', $ada))->toBe('c2') + ->and(LastVisit::firstSeenId($commits, '2026-10-15T09:30:00+00:00', $ada))->toBe('c1') // Nothing new. - ->and(LastVisit::firstSeenId($commits, '2026-10-15T11:00:00+00:00', 'ada'))->toBeNull() + ->and(LastVisit::firstSeenId($commits, '2026-10-15T11:00:00+00:00', $ada))->toBeNull() // Only your own commit is new. - ->and(LastVisit::firstSeenId($commits, '2026-10-15T10:00:00+00:00', 'grace'))->toBeNull() + ->and(LastVisit::firstSeenId($commits, '2026-10-15T10:00:00+00:00', new Ownership('grace')))->toBeNull() + // Only a commit from an organization you're in is new, as the web counts it. + ->and(LastVisit::firstSeenId($commits, '2026-10-15T10:00:00+00:00', new Ownership('linus', ['grace'])))->toBeNull() // Everything is new, so there's nothing to mark. - ->and(LastVisit::firstSeenId($commits, '2026-10-15T08:00:00+00:00', 'ada'))->toBeNull() + ->and(LastVisit::firstSeenId($commits, '2026-10-15T08:00:00+00:00', $ada))->toBeNull() // A first visit. - ->and(LastVisit::firstSeenId($commits, null, 'ada'))->toBeNull(); + ->and(LastVisit::firstSeenId($commits, null, $ada))->toBeNull(); }); From 61856995f9b9672941f77d24ae727fe3cf05af6b Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Wed, 18 Nov 2026 16:28:44 +0000 Subject: [PATCH 13/46] Draw one line above related commits, not the commit's hairline as well With its replies shut, the last row on a commit page kept its hairline, which starts at the text column, right on top of the related commits' full-width top border. Together they read as a stray line above "Related commits". The last row now leaves its hairline out when related commits follow it, and keeps it above "No replies yet" or at the end of the page. With the replies open the last reply already ends with no hairline, so either way only the full-width line shows. Co-Authored-By: Claude Opus 5.5 --- .../views/native/commit-detail.blade.php | 11 +++++- tests/Feature/Screens/RelatedCommitsTest.php | 36 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index 3667a822..b1c2f5f4 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -30,6 +30,14 @@ @include('native.partials.earlier-commits', ['count' => $earlierCount, 'lane' => $earlierLane]) @endif + {{-- + Related commits start with a full-width line of their own (see partials/related-commits). The last row + above them leaves out its hairline, which runs from the text's edge, so the two don't stack up into a + line and a half. Replies end with no hairline on a commit page, and "No replies yet" keeps the commit's. + --}} + @php($noReplies = $commit && $replyCount === 0 && $repliesLoaded && $series === []) + @php($relatedBelow = $commit && $related !== [] && ! $noReplies) + @foreach ($rows as $row) @php($isFocused = $row->commit->id === $commit?->id) @php($hasThread = $isFocused && $repliesShown && $replies !== []) @@ -43,6 +51,7 @@ 'muted' => ! $isFocused, 'seriesExpanded' => true, 'withTail' => ! $loop->last, + 'hairline' => ! ($loop->last && $relatedBelow), ]) @if ($isFocused && $repliesShown && $replies === [] && ! $repliesLoaded && $error === null) @@ -95,7 +104,7 @@ @endif @endforeach - @if ($commit && $replyCount === 0 && $repliesLoaded && $series === []) + @if ($noReplies) No replies yet. diff --git a/tests/Feature/Screens/RelatedCommitsTest.php b/tests/Feature/Screens/RelatedCommitsTest.php index 9e8f15b6..d493ad73 100644 --- a/tests/Feature/Screens/RelatedCommitsTest.php +++ b/tests/Feature/Screens/RelatedCommitsTest.php @@ -244,6 +244,42 @@ function openRelated(TestableComponent $screen): TestableComponent expect(nodeByRef($screen, 'related-commits-chevron')['props']['rotate'] ?? 0.0)->toEqual(0.0); })->with(['ios', 'android']); +it("draws one full-width line above related commits, with the replies shut or open, and no hairline from the commit's text", function (string $platform) { + serveRelatedThread([commitJson(['id' => 'c9', 'body' => 'Closest match'])], [ + 'GET /api/v1/commits/c1' => [commitPageJson(commitJson(['id' => 'c1', 'body' => 'The focused commit', 'replies_count' => 1]))], + 'GET /api/v1/commits/c1/replies' => [pageJson([replyJson(['id' => 'r1', 'parent_id' => 'c1', 'body' => 'A reply'])])], + ]); + + $screen = Native::visit('/log/commits/c1', platform: $platform)->assertSee('Related commits'); + $commitLine = fn (): float => (float) (nodeByRef($screen, 'focused-commit')['children'][0]['props']['border_b'] ?? 0); + $relatedLine = fn (): float => (float) (nodeByRef($screen, 'related-commits')['props']['border_t'] ?? 0); + + // Shut, the commit sits right on the section, whose line is the only one. + expect(childRefs($screen, 'thread-page'))->toBe(['focused-commit', 'related-commits', 'reply-bar-clearance']) + ->and($commitLine())->toBe(0.0) + ->and($relatedLine())->toBe(1.0); + + // Open, the last reply ends with no hairline of its own, so the section's line is still the only one. + $screen->tap('replies-c1')->assertSee('A reply'); + expect(childRefs($screen, 'thread-page'))->toBe(['focused-commit', 'thread-reply-r1', 'related-commits', 'reply-bar-clearance']) + ->and($commitLine())->toBe(0.0) + ->and(findNode($screen->tree(), fn (array $node): bool => ($node['ref'] ?? null) === 'thread-end-r1'))->toBeNull() + ->and($relatedLine())->toBe(1.0); +})->with(['ios', 'android']); + +it('keeps the hairline under the commit when nothing comes after it, or "No replies yet" does', function (array $commit, array $related) { + serveRelatedThread($related, [ + 'GET /api/v1/commits/c1' => [commitPageJson(commitJson(['id' => 'c1', 'body' => 'The focused commit', ...$commit]))], + ]); + + $screen = Native::visit('/log/commits/c1'); + + expect((float) (nodeByRef($screen, 'focused-commit')['children'][0]['props']['border_b'] ?? 0))->toBe(1.0); +})->with([ + 'no related commits' => [['replies_count' => 1], []], + 'no replies yet' => [['replies_count' => 0], [commitJson(['id' => 'c9', 'body' => 'Closest match'])]], +]); + it('fades related commits in one after another as they open, and out together as they close', function () { holdRefreshes(); serveRelatedThread([ From c8f904ebbf08d84b08a1fc2ec9891f352cca6698 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Fri, 20 Nov 2026 22:53:32 +0000 Subject: [PATCH 14/46] Show avatars in the Post as menu Each account in the menu now shows its avatar, round for you and a rounded square for an organization, as the app draws them elsewhere. The person or building icon stands in while an avatar loads or when there isn't one. Whoever posts now keeps the tick, which iOS and Android draw as their own menus do. Needs NativePHP/mobile-ui feat/menu-item-images, which teaches menu rows the image, image_shape and checked props. Without it the rows show the icons and lose the tick. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/PostAs.php | 39 ++++++++++++++-------------- tests/Feature/Screens/PostAsTest.php | 31 ++++++++++++++++++++++ 2 files changed, 50 insertions(+), 20 deletions(-) diff --git a/app/Devnull/PostAs.php b/app/Devnull/PostAs.php index 03902d77..d57f5fb7 100644 --- a/app/Devnull/PostAs.php +++ b/app/Devnull/PostAs.php @@ -56,19 +56,27 @@ public static function offered(?string $picked): bool } /** - * The menu: you first, then your organizations, the one posting now ticked. $method is called with the handle - * picked, or '' for you. + * The menu: you first, then your organizations, each with their avatar, round for you and a rounded square for + * an organization, as elsewhere in the app, and the one posting now ticked. Until an avatar loads, or if it + * can't, a person or building icon stands in. $method is called with the handle picked, or '' for you. * * @return list */ public static function menu(User $me, ?User $author, string $method): array { - return array_map(fn (User $identity): TopBarAction => NavAction::make('post-as-'.$identity->username) - ->label($identity->name.' (@'.$identity->username.')') - ->icon(...self::icon($identity, $author)) - ->press($method."('".($identity->isOrganization ? $identity->username : '')."')") - ->toElement() - ->ref('post-as-'.$identity->username), [$me, ...self::organizations()]); + return array_map(function (User $identity) use ($author, $method): TopBarAction { + $icon = $identity->isOrganization ? Lucide::Building2 : Lucide::UserRound; + + return NavAction::make('post-as-'.$identity->username) + ->label($identity->name.' (@'.$identity->username.')') + ->icon(ios: $icon->ios(), android: $icon->android()) + ->image(ImageCache::src($identity->avatarUrl)) + ->press($method."('".($identity->isOrganization ? $identity->username : '')."')") + ->toElement() + ->setProp('image_shape', $identity->isOrganization ? 'rounded' : 'circle') + ->setProp('checked', self::posting($identity, $author)) + ->ref('post-as-'.$identity->username); + }, [$me, ...self::organizations()]); } /** @@ -88,19 +96,10 @@ public static function colour(User $me, ?User $author): string } /** - * A tick beside whoever posts now, and what each is beside the rest, as the menu has no room for avatars. - * - * @return array{ios: string, android: string} + * Whether the menu ticks this one: whoever posts now. */ - private static function icon(User $identity, ?User $author): array + private static function posting(User $identity, ?User $author): bool { - $posting = $author === null ? ! $identity->isOrganization : $identity->isOrganization && $identity->username === $author->username; - $icon = match (true) { - $posting => Lucide::Check, - $identity->isOrganization => Lucide::Building2, - default => Lucide::UserRound, - }; - - return ['ios' => $icon->ios(), 'android' => $icon->android()]; + return $author === null ? ! $identity->isOrganization : $identity->isOrganization && $identity->username === $author->username; } } diff --git a/tests/Feature/Screens/PostAsTest.php b/tests/Feature/Screens/PostAsTest.php index 2b195312..21550679 100644 --- a/tests/Feature/Screens/PostAsTest.php +++ b/tests/Feature/Screens/PostAsTest.php @@ -3,6 +3,7 @@ use App\Devnull\Account; use App\Devnull\Data\CurrentUser; use App\Devnull\Data\User; +use App\Icons\Lucide; use App\Models\PendingWrite; use Carbon\CarbonImmutable; use Illuminate\Http\Client\Request; @@ -118,6 +119,36 @@ function commitsSent(): array ->assertMissingElement('pressable', fn (array $node): bool => ($node['ref'] ?? null) === 'sheet-post-as'); }); +it('draws each account in the Post as menu with its avatar, round for you, square for an organization, and ticks who posts now', function () { + memberOf([memberOrganizationJson(), memberOrganizationJson(['id' => 'o2', 'handle' => 'nativephp', 'name' => 'NativePHP', 'role' => 'member', 'avatar_url' => null])]); + + $screen = composeOnLogAs(); + + $rows = fn (): array => array_map(fn (array $item): array => [ + $item['ref'], + $item['props']['image'] ?? null, + $item['props']['image_shape'], + $item['props']['checked'], + $item['props']['icon'], + ], array_values(array_filter(nodeByRef($screen, 'sheet-post-as')['children'], fn (array $child): bool => $child['type'] === 'top_bar_action'))); + + $me = app(Account::class)->user(); + $person = Lucide::UserRound->ios(); + $building = Lucide::Building2->ios(); + + expect($me->avatarUrl)->not->toBeNull() + ->and($rows())->toBe([ + ['post-as-local_dev', $me->avatarUrl, 'circle', true, $person], + ['post-as-dev-null-sh', 'https://avatars.githubusercontent.com/u/9?v=4', 'rounded', false, $building], + // No avatar: the building stands in. + ['post-as-nativephp', null, 'rounded', false, $building], + ]); + + $screen->call('postAsInSheet', 'dev-null-sh'); + + expect(array_column($rows(), 3))->toBe([false, true, false]); +}); + it('starts the composer as you, and lists you and your organizations under Post as', function () { memberOf([memberOrganizationJson(), memberOrganizationJson(['id' => 'o2', 'handle' => 'nativephp', 'name' => 'NativePHP', 'role' => 'member', 'lane' => 5])]); From d5cf93dc149173a3103881a6399fa77c42b10d67 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 01:01:00 +0000 Subject: [PATCH 15/46] Even out the reply bar's spacing and lighten its glass The reply field sat 20pt under the fade and only 8pt above the row of tools. The reply row drops its 8pt top padding and the field row gains 8pt underneath, so the field is 12pt under the fade and 16pt above the tools. The bar is the same height as before. On iOS the bar now asks mobile-air for its glass at 0.8 opacity (glass-opacity on native:bottom-bar, NativePHP/mobile-air#735), so a little more of the page shows through. Android draws no glass and is unchanged. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Display.php | 15 +++++++++++ .../views/native/commit-detail.blade.php | 5 ++-- .../native/partials/composer-box.blade.php | 6 +++-- tests/Feature/Screens/CommitDetailTest.php | 27 +++++++++++++++++++ 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index a6aeb0bb..8e736203 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -44,6 +44,12 @@ final class Display */ public const int ComposerGlassTint = 40; + /** + * How opaque the glass under the reply bar gets on iOS once it has faded in, from 0 to 1 (see + * replyBarGlassOpacity()). mobile-air's own default is 1, which over a dark page reads as a heavy slab. + */ + public const float ReplyBarGlassOpacity = 0.8; + /** * About how many characters fit on a line of the box's field, which runs the width of the box. */ @@ -308,6 +314,15 @@ public static function composerBarGlass(): string return self::fadesInBar() ? 'glass' : ''; } + /** + * The reply bar's glass-opacity: how opaque mobile-air's glass behind the bar gets on iOS once it has faded in, + * so a little more of the page shows through. Null on Android, which draws no glass behind a bottom bar. + */ + public static function replyBarGlassOpacity(): ?float + { + return self::fadesInBar() ? self::ReplyBarGlassOpacity : null; + } + /** * The composer bar's own classes. On Android it's the surface. On iOS it has no background at all: mobile-air * paints a bar's background colour behind the whole bar, which would cover the fade at its top, so the bar's diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index bf62a9b4..ce9a027f 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -151,7 +151,7 @@ --}} @php($replyPostingMe = app(\App\Devnull\Account::class)->user()) @php($replyPostsAs = $replyPostingMe !== null && \App\Devnull\PostAs::offered($replyAuthor)) - + @if (\App\Devnull\Display::fadesInBar()) @include('native.partials.composer-fade', ['ref' => 'reply-fade', 'inBar' => true]) @@ -173,12 +173,13 @@ @include('native.partials.composer-photos', ['photos' => $replyImages, 'photoRef' => 'reply-photo']) @endif - + @php($hasDraft = trim($reply) !== '' || $replyImages !== []) @php($photosFull = count($replyImages) >= \App\Devnull\DraftImages::MaxImages) @include('native.partials.composer-box', [ 'ref' => 'reply', 'field' => $replyPreviewing ? 'native.partials.reply-preview' : 'native.partials.reply-field', + 'fieldPadding' => 'pt-1 pb-2', 'lead' => $replyPostsAs ? [['native.partials.post-as', ['ref' => 'reply-post-as', 'me' => $replyPostingMe, 'picked' => $replyAuthor, 'method' => 'postAsInReply', 'size' => 28, 'inset' => 'pl-3']]] : [], 'tools' => [ ['ref' => 'reply-add-photos', 'icon' => \App\Icons\Lucide::ImagePlus, 'label' => $photosFull ? 'A reply can have up to 3 photos' : 'Add photos', 'menu' => $photosFull ? null : \App\Devnull\ComposerMenu::photoItems(), 'disabled' => $photosFull], diff --git a/resources/views/native/partials/composer-box.blade.php b/resources/views/native/partials/composer-box.blade.php index 5cb53133..c036c99c 100644 --- a/resources/views/native/partials/composer-box.blade.php +++ b/resources/views/native/partials/composer-box.blade.php @@ -11,12 +11,14 @@ row, ahead of the tools, and for the end, left of the send button, such as the count of a long draft. $send is send-button's: its ref, label, method, and whether it can send yet. - The field's text lines up with the tools' icons under it. + The field's text lines up with the tools' icons under it. $fieldPadding is the field row's padding above and below + the field (pt-1 by default), for a bar that wants more room between the field and the row under it. --}} @php($lead ??= []) +@php($fieldPadding ??= 'pt-1') @php($trail ??= []) - + @include($field) diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 8b692e51..7e0360c4 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -7,6 +7,7 @@ use App\Models\PendingWrite; use Illuminate\Http\Client\Request; use Illuminate\Support\Facades\Http; +use Native\Mobile\Edge\Elements\BottomBar; use Native\Mobile\Events\Alert\ButtonPressed; use Native\Mobile\Testing\Native; @@ -901,6 +902,32 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): } })->with(['ios', 'android']); +it('keeps the reply field closer to the fade than to the row of tools under it', function (string $platform) { + fakeThread(); + + $screen = Native::visit('/log/commits/c2', platform: $platform); + + // [top, right, bottom, left]. The row has no top padding, so the field starts 4pt under the fade, and the field + // row leaves 8pt between the field and the tools. + expect(nodeByRef($screen, 'reply-row')['layout']['padding'])->toEqual([0, 16, 8, 16]) + ->and(nodeByRef($screen, 'reply-field-row')['layout']['padding'])->toEqual([4, 12, 8, 16]); +})->with(['ios', 'android']); + +it('asks mobile-air for a lighter glass under the reply bar on iOS only', function (string $platform, ?float $opacity) { + fakeThread(); + + $screen = Native::visit('/log/commits/c2', platform: $platform); + $bottomBar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); + + expect($bottomBar['props']['glass_opacity'] ?? null)->toBe($opacity); +})->with([ + 'ios' => ['ios', Display::ReplyBarGlassOpacity], + 'android' => ['android', null], +])->skip( + ! method_exists(BottomBar::class, 'glassOpacity'), + 'Needs a mobile-air with glass-opacity on native:bottom-bar (NativePHP/mobile-air#735)', +); + it('ends the page above the reply bar, and further as the draft grows', function () { fakeThread(replies: [replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'The last reply'])]); From 2f4d5f4ff9d0d1189e7effdc95197e50d9f6c752 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 01:22:25 +0000 Subject: [PATCH 16/46] Read an author's replies to themselves as one thread, as the web does When someone replies to their own commit, the web treats their earliest reply as the next part of a thread rather than as a reply. The commit page now does the same: the parts follow the commit on its rail, each marked with its place (2/5), ten at a time with "Show more of this thread", and the last part's replies show under it. The next part is left out of each commit's replies, and the earlier parts above a commit get their places too. devnull's API doesn't send the web's continuation_id yet, so the app works the parts out from each commit's replies (SelfThread), fetching them one after another. When the API starts sending it, the app takes its word. On the Log, profiles, search, starred and organizations, a thread opened in place leaves out the author's next part and shows "Show thread", which opens the commit's page. Without continuation_id from the API, that link can only show once the replies have been opened. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Data/Commit.php | 5 + app/Devnull/SelfThread.php | 176 +++++++++++++++++ app/Icons/Lucide.php | 2 + app/NativeComponents/CommitDetail.php | 162 +++++++++++++++- .../Concerns/ExpandsThreads.php | 37 ++++ resources/icons/list-tree.svg | 1 + .../views/native/commit-detail.blade.php | 38 +++- .../partials/commit-row-content.blade.php | 16 +- .../views/native/partials/feed.blade.php | 3 +- .../native/partials/show-thread.blade.php | 8 + .../partials/thread-continues.blade.php | 24 +++ .../native/partials/thread-position.blade.php | 4 + .../native/partials/thread-reply.blade.php | 5 + tests/Feature/Screens/CommitDetailTest.php | 2 +- tests/Feature/Screens/CommitMenuTest.php | 2 +- tests/Feature/Screens/SelfThreadTest.php | 179 ++++++++++++++++++ tests/Pest.php | 20 +- tests/Unit/Devnull/SelfThreadTest.php | 105 ++++++++++ 18 files changed, 775 insertions(+), 14 deletions(-) create mode 100644 app/Devnull/SelfThread.php create mode 100644 resources/icons/list-tree.svg create mode 100644 resources/views/native/partials/show-thread.blade.php create mode 100644 resources/views/native/partials/thread-continues.blade.php create mode 100644 resources/views/native/partials/thread-position.blade.php create mode 100644 tests/Feature/Screens/SelfThreadTest.php create mode 100644 tests/Unit/Devnull/SelfThreadTest.php diff --git a/app/Devnull/Data/Commit.php b/app/Devnull/Data/Commit.php index 1175a11e..28b52bbf 100644 --- a/app/Devnull/Data/Commit.php +++ b/app/Devnull/Data/Commit.php @@ -21,6 +21,9 @@ * * A Nata Nu//ers high score carries its signed run in a fenced block, which * shows as a card ($scoreCard) instead of as code. + * + * $continuationId is the reply that carries on a thread its author writes as + * replies to themselves, when devnull says which (see SelfThread). */ final readonly class Commit { @@ -76,6 +79,7 @@ public function __construct( public ?ReplyPreview $replyPreview = null, public int $pasteisCount = 0, public ?ScoreCard $scoreCard = null, + public ?string $continuationId = null, ) {} /** @@ -143,6 +147,7 @@ public static function fromArray(array $data): self replyPreview: is_array($data['reply_preview'] ?? null) ? ReplyPreview::fromArray($data['reply_preview']) : null, pasteisCount: max(0, (int) ($data['pasteis_count'] ?? 0)), scoreCard: $scoreCard, + continuationId: is_string($data['continuation_id'] ?? null) && $data['continuation_id'] !== '' ? $data['continuation_id'] : null, ); } diff --git a/app/Devnull/SelfThread.php b/app/Devnull/SelfThread.php new file mode 100644 index 00000000..56278e10 --- /dev/null +++ b/app/Devnull/SelfThread.php @@ -0,0 +1,176 @@ + $parts The commits carrying the thread on below the commit, in order, at most the limit. + * @param bool $hasMore Whether another part follows the last of $parts. + * @param bool $hasEnded Whether it's known that no part follows the last of $parts. + * @param string|null $waiting The commit whose replies the walk needs to go on. + */ + public function __construct( + public array $parts = [], + public bool $hasMore = false, + public bool $hasEnded = false, + public ?string $waiting = null, + ) {} + + /** + * The reply among $replies that carries $commit's thread on, if it's one of them. + * + * @param iterable $replies + */ + public static function next(Commit $commit, iterable $replies): ?Commit + { + if ($commit->isDeleted() || $commit->isStaged() || $commit->author->id === '') { + return null; + } + + $earliest = null; + + foreach ($replies as $reply) { + if ($commit->continuationId !== null) { + if ($reply->id === $commit->continuationId) { + return $reply; + } + + continue; + } + + if ($reply->parentId !== $commit->id || $reply->isDeleted() || $reply->isStaged() || $reply->author->id !== $commit->author->id) { + continue; + } + + if ($earliest === null || self::isEarlier($reply, $earliest)) { + $earliest = $reply; + } + } + + return $earliest; + } + + /** + * $replies without the one that carries $commit's thread on, which shows as the next part of it instead. + * + * @param list $replies + * @return list + */ + public static function others(Commit $commit, array $replies): array + { + $next = self::next($commit, $replies); + + return $next === null ? $replies : array_values(array_filter($replies, fn (Commit $reply): bool => $reply->id !== $next->id)); + } + + /** + * Walks down from $commit through the parts that carry its thread on, as far as $limit and the replies that + * have come allow. + * + * @param Closure(Commit): (list|null) $repliesOf A commit's first page of replies, or null until it comes. + */ + public static function below(Commit $commit, Closure $repliesOf, int $limit = self::PerPage): self + { + $parts = []; + $above = $commit; + + while (true) { + $replies = $repliesOf($above); + + if ($replies === null) { + return new self($parts, waiting: $above->id); + } + + $next = self::next($above, $replies); + + if ($next === null || in_array($next, $parts, true) || $next->id === $commit->id) { + return new self($parts, hasEnded: true); + } + + if (count($parts) >= $limit) { + return new self($parts, hasMore: true); + } + + $parts[] = $next; + $above = $next; + } + } + + /** + * How many of the commits just above $commit, of $ancestors (oldest first), are earlier parts of its thread, + * and whose replies are needed to look further up. Only the author's own commits can be; each one is a part + * when its earliest reply from them is the one below it. + * + * @param list $ancestors + * @param Closure(Commit): (list|null) $repliesOf + * @return array{0: int, 1: string|null} + */ + public static function above(array $ancestors, Commit $commit, Closure $repliesOf): array + { + $count = 0; + $below = $commit; + + foreach (array_reverse($ancestors) as $ancestor) { + if ($below->isDeleted() || $ancestor->isDeleted() || $ancestor->author->id !== $below->author->id || $below->parentId !== $ancestor->id) { + break; + } + + $replies = $repliesOf($ancestor); + + if ($replies === null) { + return [$count, $ancestor->id]; + } + + if (self::next($ancestor, $replies)?->id !== $below->id) { + break; + } + + $count++; + $below = $ancestor; + } + + return [$count, null]; + } + + /** + * The place in its thread of the commit at $position, as the web's ThreadPositionBadge writes it: "3/7", with + * a "+" when more of the thread follows than has been read. Null for a commit that isn't part of one. + */ + public static function position(int $position, int $size, bool $isOpenEnded): ?string + { + return $size > 1 && $position >= 1 ? $position.'/'.$size.($isOpenEnded ? '+' : '') : null; + } + + private static function isEarlier(Commit $reply, Commit $than): bool + { + if ($reply->createdAt === null || $than->createdAt === null || $reply->createdAt->equalTo($than->createdAt)) { + return strcmp($reply->id, $than->id) < 0; + } + + return $reply->createdAt->lessThan($than->createdAt); + } +} diff --git a/app/Icons/Lucide.php b/app/Icons/Lucide.php index 3df5fa55..24bcab8f 100644 --- a/app/Icons/Lucide.php +++ b/app/Icons/Lucide.php @@ -36,6 +36,7 @@ enum Lucide case ArrowUp; case Pin; case ListOrdered; + case ListTree; /** lucide-react 1.57 draws Building2 as building-complex, so that is the drawing in building-2.svg. */ case Building2; case MapPin; @@ -177,6 +178,7 @@ public function custom(bool $filled = false): string self::ArrowUp => 'arrow-up', self::ChevronsUp => 'chevrons-up', self::ListOrdered => 'list-ordered', + self::ListTree => 'list-tree', self::Building2 => 'building-2', self::MapPin => 'map-pin', self::CalendarDays => 'calendar-days', diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index dbc088eb..ea255221 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -17,6 +17,7 @@ use App\Devnull\PostAs; use App\Devnull\ResponseCache; use App\Devnull\RowCache; +use App\Devnull\SelfThread; use App\Devnull\Stash; use App\Devnull\Timeline; use App\Devnull\Toasts; @@ -75,6 +76,14 @@ * * A member of a GitHub organization can reply as it, from the avatar at the * start of the bar's row, as the web's reply composer does (see PostAs). + * + * A thread its author wrote as replies to themselves reads in order, as on + * the web (see SelfThread): the parts after the commit follow it on its rail, + * each with its place in the thread, ten at a time with "Show more of this + * thread", and the next part isn't among the commit's replies. The replies of + * the last part show under it. The earlier parts are the ancestors above it, + * and wear their places too. Each step needs the replies of the commit above + * it, which are asked for one after another ($partReplies). */ class CommitDetail extends NativeComponent { @@ -110,6 +119,26 @@ class CommitDetail extends NativeComponent /** @var list */ public array $replies = []; + /** + * The first page of replies of the commits around this one in its author's thread, by id, which say which + * reply carries it on (see SelfThread). + * + * @var array> + */ + public array $partReplies = []; + + /** + * The commits in $partReplies with more replies than their first page. + * + * @var list + */ + public array $partsWithMore = []; + + /** + * How many parts of the author's thread show after the commit. + */ + public int $threadLimit = SelfThread::PerPage; + public ?string $repliesCursor = null; /** @@ -291,6 +320,10 @@ protected function revalidate(): void app(ResponseCache::class)->forget($this->threadPath().'/related'); }); + foreach (array_keys($this->partReplies) as $id) { + $this->refreshPartReplies((string) $id); + } + foreach (array_keys($this->tombstoneReplies) as $id) { $id = (string) $id; @@ -338,6 +371,15 @@ public function toggleReplies(): void $this->repliesShown = ! $this->repliesShown; } + /** + * "Show more of this thread": the next ten parts of the author's thread, as on the web. + */ + public function showMoreThread(): void + { + $this->threadLimit += SelfThread::PerPage; + $this->followThread(); + } + /** * The web's preview toggle, in the reply bar: the reply shows as it will * look in the field's place, at once, and devnull is asked for its body, @@ -451,6 +493,7 @@ public function loadMoreReplies(): void $this->replies = [...array_values(array_filter($this->replies, fn (Commit $reply): bool => ! isset($loaded[$reply->id]))), ...$page->items]; $this->repliesCursor = $page->nextCursor; $this->keepStagedReplies(); + $this->followThread(); } } @@ -564,6 +607,7 @@ protected function showCommitWent(PendingWrite $write, Commit $commit): void $staged = PendingWrite::stagedId($write->client_id); $this->replies = array_map(fn (Commit $reply): Commit => $reply->id === $staged ? $commit : $reply, $this->replies); + $this->followThread(); } /** @@ -694,6 +738,7 @@ protected function updateShownCommits(Closure $update): void $this->ancestors = array_map($update, $this->ancestors); $this->series = array_map($update, $this->series); $this->replies = array_map($update, $this->replies); + $this->partReplies = array_map(fn (array $replies): array => array_map($update, $replies), $this->partReplies); $this->related = array_map($update, $this->related); $this->tombstoneReplies = array_map(fn (array $replies): array => array_map($update, $replies), $this->tombstoneReplies); } @@ -703,7 +748,7 @@ protected function updateShownCommits(Closure $update): void */ protected function shownCommits(): iterable { - return [...($this->commit === null ? [] : [$this->commit]), ...$this->ancestors, ...$this->series, ...$this->replies, ...$this->related, ...array_merge([], ...array_values($this->tombstoneReplies))]; + return [...($this->commit === null ? [] : [$this->commit]), ...$this->ancestors, ...$this->series, ...$this->replies, ...array_merge([], ...array_values($this->partReplies)), ...$this->related, ...array_merge([], ...array_values($this->tombstoneReplies))]; } /** @@ -766,6 +811,7 @@ private function showKept(): void $this->takeRelated($this->cached($this->threadPath().'/related') ?? []); $this->keepStagedReplies(); + $this->followThread(); } /** @@ -786,6 +832,7 @@ private function takeThread(array $json): void $this->commit = $thread->commit; $this->ancestors = $thread->ancestors; $this->series = $thread->series; + $this->followThread(); } /** @@ -798,6 +845,74 @@ private function takeReplies(array $json): void [$this->replies, $this->repliesCursor] = self::withFirstPage($this->replies, $this->repliesCursor, Page::fromArray($json, Commit::fromArray(...))); $this->repliesLoaded = true; $this->keepStagedReplies(); + $this->followThread(); + } + + /** + * Asks for the replies the author's thread needs next, above the commit and below it, each when the one + * before has come (see SelfThread). A page kept from before shows at once and refreshes behind. + */ + private function followThread(): void + { + if ($this->commit === null) { + return; + } + + $waiting = [ + $this->selfThread()->waiting, + SelfThread::above($this->ancestors, $this->commit, $this->repliesOf())[1], + ]; + + foreach (array_unique(array_filter($waiting, fn (?string $id): bool => $id !== null && $id !== $this->id)) as $id) { + $kept = $this->cached('commits/'.rawurlencode($id).'/replies'); + $this->refreshPartReplies($id); + + if ($kept !== null) { + $this->takePartReplies($id, $kept); + } + } + } + + private function refreshPartReplies(string $id): void + { + $this->refresh('commits/'.rawurlencode($id).'/replies', [], fn (array $json) => $this->takePartReplies($id, $json)); + } + + /** + * @param array $json + */ + private function takePartReplies(string $id, array $json): void + { + $page = Page::fromArray($json, Commit::fromArray(...)); + $this->partReplies[$id] = $page->items; + $this->partsWithMore = array_values(array_diff($this->partsWithMore, [$id])); + + if ($page->hasMore()) { + $this->partsWithMore[] = $id; + } + + $this->followThread(); + } + + /** + * The first page of a commit's replies as far as the page has them, or null until they come. The commit's + * own are the ones showing, less any still on their way. + * + * @return Closure(Commit): (list|null) + */ + private function repliesOf(): Closure + { + return fn (Commit $commit): ?array => $commit->id === $this->id + ? ($this->repliesLoaded ? array_values(array_filter($this->replies, fn (Commit $reply): bool => ! $reply->isStaged())) : null) + : ($this->partReplies[$commit->id] ?? null); + } + + /** + * The parts of the author's thread after the commit, as far as they've been read. + */ + private function selfThread(): SelfThread + { + return $this->commit === null ? new SelfThread : SelfThread::below($this->commit, $this->repliesOf(), $this->threadLimit); } /** @@ -859,6 +974,11 @@ public function render(): View $viewer = $this->me(); $this->replyRows ??= new RowCache; $this->replyRows->startFrame(); + $thread = $this->selfThread(); + $parts = $thread->parts; + $partsAbove = $this->commit === null ? 0 : SelfThread::above($this->ancestors, $this->commit, $this->repliesOf())[0]; + $lastPart = $thread->hasEnded && $parts !== [] ? end($parts) : null; + $replies = $this->commit === null ? $this->replies : SelfThread::others($this->commit, $this->replies); return view('native.commit-detail', [ 'replyRows' => $this->replyRows, @@ -868,13 +988,49 @@ public function render(): View 'stashed' => app(Stash::class)->names($viewer?->id), 'pasteis' => app(Account::class)->pasteis(), 'rows' => $this->commit === null ? [] : Timeline::thread( - [...$above, $this->commit, ...$this->series], + [...$above, $this->commit, ...$this->series, ...$parts], laneAbove: $earlier === [] ? null : end($earlier)->lane(), ), 'relatedRows' => Timeline::thread($this->related), 'earlierCount' => $this->commit === null ? 0 : count($earlier), 'earlierLane' => $earlier === [] ? null : end($earlier)->lane(), - 'replyCount' => max($this->commit->repliesCount ?? 0, count($this->replies)), + 'replyCount' => max($this->commit->repliesCount ?? 0, count($replies)), + 'replies' => $replies, + 'threadParts' => array_map(fn (Commit $part): string => $part->id, $parts), + 'threadMore' => $thread->hasMore, + 'threadPositions' => $this->threadPositions($thread, $partsAbove), + 'lastPart' => $lastPart, + 'lastPartReplies' => $lastPart === null ? [] : array_slice($this->partReplies[$lastPart->id] ?? [], 0, Client::RepliesPerPage), + 'lastPartMore' => $lastPart !== null && (count($this->partReplies[$lastPart->id] ?? []) > Client::RepliesPerPage || in_array($lastPart->id, $this->partsWithMore, true)), ]); } + + /** + * Each commit's place in its author's thread, by id, as the web marks them: the earlier parts above the + * commit, the commit, and the parts after it. None when the commit isn't part of a thread. + * + * A part known to follow the last one read counts, and a thread not read to its end gets the web's "+". + * + * @return array + */ + private function threadPositions(SelfThread $below, int $partsAbove): array + { + if ($this->commit === null) { + return []; + } + + $thread = [...array_slice($this->ancestors, count($this->ancestors) - $partsAbove, $partsAbove), $this->commit, ...$below->parts]; + $size = count($thread) + ($below->hasMore ? 1 : 0); + $positions = []; + + foreach ($thread as $index => $commit) { + $label = SelfThread::position($index + 1, $size, ! $below->hasEnded); + + if ($label !== null) { + $positions[$commit->id] = $label; + } + } + + return $positions; + } } diff --git a/app/NativeComponents/Concerns/ExpandsThreads.php b/app/NativeComponents/Concerns/ExpandsThreads.php index 2a5763ce..aed53c3c 100644 --- a/app/NativeComponents/Concerns/ExpandsThreads.php +++ b/app/NativeComponents/Concerns/ExpandsThreads.php @@ -4,6 +4,7 @@ use App\Devnull\Data\Commit; use App\Devnull\Data\Page; +use App\Devnull\SelfThread; /** * "› N replies" under a commit in a feed opens its replies in place, the way @@ -20,6 +21,11 @@ * and a thread longer than a page opens the commit's page instead. * * A thread opened before opens at once from the cache, and refreshes behind. + * + * The reply that carries on a thread its author wrote as replies to + * themselves isn't one of the replies, as on the web: it's the next part of + * that thread, which the commit's "Show thread" opens (see SelfThread). + * devnull's count of the replies already leaves it out. */ trait ExpandsThreads { @@ -44,6 +50,13 @@ trait ExpandsThreads */ public array $threadsWithMore = []; + /** + * Commits whose replies, opened, showed that their author carried them on as a thread, so they show "Show thread". + * + * @var list + */ + public array $threadsContinued = []; + public function toggleReplies(string $id): void { if (array_key_exists($id, $this->threads)) { @@ -122,6 +135,8 @@ private function takeThread(string $id, array $json): void */ private function openThread(string $id, Page $page): void { + $page = $this->withoutContinuation($id, $page); + // A thread whose last reply went closes, so its commit gets its hairline back. if ($page->items === []) { $this->closeThread($id); @@ -152,6 +167,28 @@ private function openThread(string $id, Page $page): void $this->threads[$id] = array_reverse($page->items); } + /** + * The page without the reply that carries the commit's thread on, which marks the commit as carried on instead. + * + * @param Page $page + * @return Page + */ + private function withoutContinuation(string $id, Page $page): Page + { + $commit = $this->shownCommit($id); + $next = $commit === null ? null : SelfThread::next($commit, $page->items); + + if ($next === null) { + return $page; + } + + if (! in_array($id, $this->threadsContinued, true)) { + $this->threadsContinued[] = $id; + } + + return new Page(SelfThread::others($commit, $page->items), $page->nextCursor); + } + private function closeThread(string $id): void { unset($this->threads[$id]); diff --git a/resources/icons/list-tree.svg b/resources/icons/list-tree.svg new file mode 100644 index 00000000..27294fa1 --- /dev/null +++ b/resources/icons/list-tree.svg @@ -0,0 +1 @@ + diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index ce9a027f..c3db9ecf 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -25,6 +25,10 @@ has its replies right under it, beside the rail running on, and the later parts follow. Everything around the commit is muted, and still opens its own page. A deleted reply's own replies open in place, one level in, five at a time too, since a deleted commit has no page. + + A thread its author wrote as replies to themselves carries on below the commit, on the same rail, as + the web reads it (see SelfThread): each part wears its place ("2/5"), ten show at a time with "Show + more of this thread" under them, and the replies of the last part hang under it as the commit's do. --}} @if ($earlierCount > 0) @include('native.partials.earlier-commits', ['count' => $earlierCount, 'lane' => $earlierLane]) @@ -35,23 +39,28 @@ above them leaves out its hairline, which runs from the text's edge, so the two don't stack up into a line and a half. Replies end with no hairline on a commit page, and "No replies yet" keeps the commit's. --}} - @php($noReplies = $commit && $replyCount === 0 && $repliesLoaded && $series === []) + @php($noReplies = $commit && $replyCount === 0 && $repliesLoaded && $series === [] && $threadParts === []) @php($relatedBelow = $commit && $related !== [] && ! $noReplies) @foreach ($rows as $row) @php($isFocused = $row->commit->id === $commit?->id) + @php($isLastPart = $lastPart !== null && $row->commit->id === $lastPart->id) @php($hasThread = $isFocused && $repliesShown && $replies !== []) + @php($partThread = $isLastPart && $lastPartReplies !== []) @include('native.partials.commit-row', [ 'commit' => $row->commit, 'previousLane' => $row->previousLane, 'continuesRun' => $row->continuesRun, 'continuesNext' => $isFocused ? ! $loop->last : null, - 'threadBelow' => $hasThread, + 'threadBelow' => $hasThread || $partThread, + 'repliesBelow' => $partThread, 'focused' => $isFocused, 'muted' => ! $isFocused, 'seriesExpanded' => true, - 'withTail' => ! $loop->last, - 'hairline' => ! ($loop->last && $relatedBelow), + 'withTail' => ! $loop->last || $threadMore, + 'hairline' => ! ($loop->last && $relatedBelow && ! $threadMore), + 'threadPosition' => $threadPositions[$row->commit->id] ?? null, + 'showsThread' => false, ]) @if ($isFocused && $repliesShown && $replies === [] && ! $repliesLoaded && $error === null) @@ -102,8 +111,29 @@ @endforeach @endforeach @endif + @if ($partThread) + @foreach ($lastPartReplies as $index => $threadReply) + @php($replyRow = [ + 'reply' => $threadReply, + 'lane' => $lastPart->lane(), + 'previousLane' => $index === 0 ? null : $lastPartReplies[$index - 1]->lane(), + 'hasNext' => ! $loop->last || $lastPartMore, + 'railLane' => null, + 'muted' => true, + 'thread' => $lastPart, + 'more' => $loop->last && $lastPartMore ? "openReplies('{$lastPart->id}')" : null, + 'last' => $loop->last, + ]) + @php($rowScope = array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1])) + @php($replyRows->include('reply-'.$threadReply->id, \App\Devnull\RowInputs::for($threadReply, $rowScope), 'native.partials.thread-reply', $replyRow, $rowScope)) + @endforeach + @endif @endforeach + @if ($threadMore && $threadParts !== []) + @include('native.partials.thread-continues', ['lane' => $rows[array_key_last($rows)]->commit->lane()]) + @endif + @if ($noReplies) No replies yet. diff --git a/resources/views/native/partials/commit-row-content.blade.php b/resources/views/native/partials/commit-row-content.blade.php index 553ac21e..a3af40ec 100644 --- a/resources/views/native/partials/commit-row-content.blade.php +++ b/resources/views/native/partials/commit-row-content.blade.php @@ -11,6 +11,10 @@ which tapped says when in your timezone, its hash, and its replies behind a toggle in its action row. The commits around it ($muted) step back: smaller and in muted ink, with a smaller avatar and action row. They still open their own pages. + A commit in a thread its author wrote as replies to themselves wears its place in it ($threadPosition, "2/5"), and + one its author carried on that way links to that thread ($showsThread), as the web's "Show thread" does (see + SelfThread). $repliesBelow says its replies show under the row, so its action row leaves out "› N replies". + A commit you just made that devnull doesn't have yet is staged: dimmed, with the staged chip and no actions, until the real one takes its place (see SyncsOutbox). @@ -25,6 +29,9 @@ @php($withTail ??= ! $focused) @php($continuesNext ??= null) @php($threadBelow ??= false) +@php($threadPosition ??= null) +@php($showsThread ??= $commit->continuationId !== null) +@php($repliesBelow ??= false) @php($inFeed = $continuesNext !== null) @php($endsWithDot = $inFeed && ! $continuesRun && ! $continuesNext) @php($laterParts = $seriesExpanded ? 0 : $commit->laterSeriesParts()) @@ -48,6 +55,9 @@ @if ($commit->isSeriesPart()) @include('native.partials.series-position') @endif + @if ($threadPosition !== null) + @include('native.partials.thread-position') + @endif @unless ($commit->isApproved()) @include('native.partials.status-chip', ['status' => $commit->status]) @endunless @@ -75,6 +85,10 @@ @endif + @if ($showsThread && ! $focused) + @include('native.partials.show-thread') + @endif + @if ($focused) {{ $commit->shortHash }} @endif @@ -88,7 +102,7 @@ 'repliesCount' => $replyCount ?? $commit->repliesCount, ]) @else - @include('native.partials.commit-actions', ['compact' => $muted]) + @include('native.partials.commit-actions', ['compact' => $muted, 'withReplies' => ! $repliesBelow]) @endif diff --git a/resources/views/native/partials/feed.blade.php b/resources/views/native/partials/feed.blade.php index c85258e0..17298118 100644 --- a/resources/views/native/partials/feed.blade.php +++ b/resources/views/native/partials/feed.blade.php @@ -3,7 +3,7 @@ partials/who-to-follow) and commits on the rail. Under a commit hangs its thread, inside its row's hairline, as on the web: the newest reply devnull previews, with "Show more" when there are others, or the replies opened in place, with "Show more" to the commit's page when there are more than they show. The commit's rail runs on past them when - its author's run goes on below. + its author's run goes on below. A commit its author carried on in replies to themselves shows "Show thread". Given a $rowCache (see App\Devnull\RowCache), commits and replies that haven't changed since the last frame are drawn from it rather than built again. Given a $rowWindow (see App\Devnull\RowWindow), rows far from the screen @@ -56,6 +56,7 @@ 'continuesRun' => $row->continuesRun, 'continuesNext' => $row->continuesNext, 'threadBelow' => $threadReplies !== [], + 'showsThread' => $feedCommit->continuationId !== null || in_array($feedCommit->id, $threadsContinued ?? [], true), ]; @endphp @if (! $feedDraws) diff --git a/resources/views/native/partials/show-thread.blade.php b/resources/views/native/partials/show-thread.blade.php new file mode 100644 index 00000000..6a3e4aa6 --- /dev/null +++ b/resources/views/native/partials/show-thread.blade.php @@ -0,0 +1,8 @@ +{{-- + "Show thread" under a commit its author carried on in replies to themselves, as the web's ShowThreadLink: it opens + the commit's page, where the thread reads in order (see SelfThread). +--}} + + + Show thread + diff --git a/resources/views/native/partials/thread-continues.blade.php b/resources/views/native/partials/thread-continues.blade.php new file mode 100644 index 00000000..efe83068 --- /dev/null +++ b/resources/views/native/partials/thread-continues.blade.php @@ -0,0 +1,24 @@ +{{-- + "Show more of this thread" under the last part of an author's thread a commit page shows, as the web's: a tap shows + the next ten parts (see SelfThread). It mirrors "↑ N earlier commits" above the commit: the last part's rail comes + down solid to a hollow node in its lane, and a dashed Rail Gray line runs on below it to what's still to come. +--}} +@php($colour = 'bg-theme-'.\App\Devnull\Lane::token($lane)) + + + + + + + Show more of this thread + + + + + + + @include('native.partials.rail-node', ['lane' => $lane, 'filled' => false]) + + @include('native.partials.dashed-line', ['position' => 'top-[31] bottom-0', 'left' => 31.5, 'lane' => \App\Devnull\Lane::Rail]) + + diff --git a/resources/views/native/partials/thread-position.blade.php b/resources/views/native/partials/thread-position.blade.php new file mode 100644 index 00000000..0a9bb7dd --- /dev/null +++ b/resources/views/native/partials/thread-position.blade.php @@ -0,0 +1,4 @@ +{{-- A commit's place in its author's thread, like the web's ThreadPositionBadge: "2/5" in mono on a muted wash. --}} + + {{ $threadPosition }} + diff --git a/resources/views/native/partials/thread-reply.blade.php b/resources/views/native/partials/thread-reply.blade.php index 6a1d0a7c..29f95d96 100644 --- a/resources/views/native/partials/thread-reply.blade.php +++ b/resources/views/native/partials/thread-reply.blade.php @@ -16,6 +16,8 @@ A commit page draws its replies $muted, smaller and in muted ink, so the commit they answer stays the main thing. + A reply its author carried on in replies to themselves links to that thread, as on the web (see show-thread). + A reply you just sent that devnull doesn't have yet is staged: dimmed, with the staged chip and no actions. --}} @php($previousLane ??= null) @@ -83,6 +85,9 @@ @include('native.partials.commit-body', ['size' => $muted ? 'text-sm' : 'text-[15px]']) @include('native.partials.commit-media', ['withEmbeds' => false]) + @if ($reply->continuationId !== null) + @include('native.partials.show-thread') + @endif @unless ($reply->isStaged()) @include('native.partials.commit-actions', ['expandable' => false, 'withQuote' => false, 'compact' => $muted]) @endunless diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 7e0360c4..ad9ef4b2 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -843,7 +843,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): it('stars the focused commit and its replies in place', function () { $grace = userJson(['id' => 'u3', 'handle' => 'grace', 'name' => 'Grace']); - fakeThread(['author' => $grace], replies: [replyJson(['id' => 'r1', 'parent_id' => 'c2', 'author' => $grace])], extra: [ + fakeThread(['author' => $grace], replies: [replyJson(['id' => 'r1', 'parent_id' => 'c2'])], extra: [ 'POST /api/v1/commits/c2/star' => [['data' => commitJson(['id' => 'c2', 'stars_count' => 1, 'starred' => true])]], 'POST /api/v1/commits/r1/star' => [['data' => commitJson(['id' => 'r1', 'starred' => true])]], ]); diff --git a/tests/Feature/Screens/CommitMenuTest.php b/tests/Feature/Screens/CommitMenuTest.php index c07a7170..53ba2936 100644 --- a/tests/Feature/Screens/CommitMenuTest.php +++ b/tests/Feature/Screens/CommitMenuTest.php @@ -130,7 +130,7 @@ $deleted = true; }), 'GET /api/v1/commits/c2' => Http::response(commitPageJson(commitJson(['id' => 'c2', 'body' => 'Ada asks', 'replies_count' => $deleted ? 0 : 1, 'author' => userJson(['id' => 'u2', 'handle' => 'ada'])]))), - 'GET /api/v1/commits/c2/replies' => Http::response(pageJson($deleted ? [] : [replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'Soon gone'])])), + 'GET /api/v1/commits/c2/replies' => Http::response(pageJson($deleted ? [] : [replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'Soon gone', 'author' => userJson()])])), default => Http::response(['message' => 'No fake.'], 404), }; }); diff --git a/tests/Feature/Screens/SelfThreadTest.php b/tests/Feature/Screens/SelfThreadTest.php new file mode 100644 index 00000000..47a445e5 --- /dev/null +++ b/tests/Feature/Screens/SelfThreadTest.php @@ -0,0 +1,179 @@ + 'http://devnull.test']); + signIn(); +}); + +/** + * One of Ada's commits, $minutes ago, replying to $parent. + * + * @param array $overrides + * @return array + */ +function adaJson(string $id, ?string $parent = null, int $minutes = 30, array $overrides = []): array +{ + return commitJson([ + 'id' => $id, + 'parent_id' => $parent, + 'body' => "Ada's {$id}", + 'author' => userJson(['handle' => 'ada', 'name' => 'Ada', 'lane' => 2]), + 'created_at' => now()->subMinutes($minutes)->toIso8601ZuluString(), + ...$overrides, + ]); +} + +/** + * Serves a commit page and the replies of every commit in $replies, by id, and 404s anything else. + * + * @param array $commit + * @param list> $ancestors + * @param array>> $replies + */ +function serveSelfThread(array $commit, array $ancestors, array $replies): void +{ + Http::fake(function (Request $request) use ($commit, $ancestors, $replies) { + $path = (string) parse_url($request->url(), PHP_URL_PATH); + + if ($path === '/api/v1/commits/'.$commit['id']) { + return Http::response(commitPageJson($commit, $ancestors)); + } + + if (preg_match('#^/api/v1/commits/([^/]+)/replies$#', $path, $match) === 1 && array_key_exists($match[1], $replies)) { + return Http::response(pageJson($replies[$match[1]])); + } + + if (str_ends_with($path, '/related')) { + return Http::response(['data' => []]); + } + + return Http::response(['message' => 'No fake.'], 404); + }); +} + +/** + * The refs of the rows down a commit page, top to bottom. + * + * @return list + */ +function selfThreadRows(TestableComponent $screen): array +{ + return array_values(array_filter(childRefs($screen, 'thread-page'), fn (?string $ref): bool => $ref !== 'reply-bar-clearance')); +} + +/** + * The text of a commit's place in its thread. + */ +function threadPositionOf(TestableComponent $screen, string $id): string +{ + $text = findNode(nodeByRef($screen, 'thread-position-'.$id), fn (array $node): bool => ($node['type'] ?? null) === 'text'); + + return $text['props']['text'] ?? ''; +} + +it("reads an author's replies to themselves in order under the commit, as the web's thread", function () { + serveSelfThread(adaJson('c1', overrides: ['replies_count' => 2]), [], [ + 'c1' => [ + replyJson(['id' => 'r1', 'parent_id' => 'c1', 'body' => 'Grace answers', 'created_at' => now()->subMinutes(28)->toIso8601ZuluString()]), + adaJson('p2', 'c1', 25), + adaJson('later', 'c1', 5, ['body' => 'Ada again, later']), + ], + 'p2' => [replyJson(['id' => 'x1', 'parent_id' => 'p2', 'body' => 'Under part two']), adaJson('p3', 'p2', 20)], + 'p3' => [replyJson(['id' => 'y1', 'parent_id' => 'p3', 'body' => 'Under the last part'])], + ]); + + $screen = Native::visit('/log/commits/c1') + ->assertSee("Ada's p2") + ->assertSee("Ada's p3") + ->assertSee('Under the last part') + ->assertDontSee('Under part two') + ->assertDontSee('Grace answers') + ->assertDontSee('No replies yet.'); + + expect(selfThreadRows($screen))->toBe(['focused-commit', 'commit-p2', 'commit-p3', 'thread-reply-y1']) + ->and(threadPositionOf($screen, 'c1'))->toBe('1/3') + ->and(threadPositionOf($screen, 'p2'))->toBe('2/3') + ->and(threadPositionOf($screen, 'p3'))->toBe('3/3') + ->and(railNode($screen, 'commit-p2'))->toBe('dot') + // The last part's replies show under it, so its action row doesn't offer them again. + ->and(findNode(nodeByRef($screen, 'commit-p3'), fn (array $node): bool => ($node['ref'] ?? null) === 'replies-p3'))->toBeNull(); + + // The commit's own replies leave out the part that carries it on, and keep its later replies to itself. + $screen->tap('replies-c1')->assertSee('Grace answers')->assertSee('Ada again, later'); + + expect(selfThreadRows($screen))->toBe(['focused-commit', 'thread-reply-r1', 'thread-reply-later', 'commit-p2', 'commit-p3', 'thread-reply-y1']); +}); + +it('marks the earlier parts above a commit in the middle of its thread', function () { + serveSelfThread(adaJson('p2', 'c1', 20), [adaJson('c1', minutes: 30)], [ + 'c1' => [adaJson('p2', 'c1', 20)], + 'p2' => [], + ]); + + $screen = Native::visit('/log/commits/p2'); + + expect(threadPositionOf($screen, 'c1'))->toBe('1/2') + ->and(threadPositionOf($screen, 'p2'))->toBe('2/2'); +}); + +it("doesn't mark a commit its author replied to some other way first", function () { + serveSelfThread(adaJson('p2', 'c1', 10), [adaJson('c1', minutes: 30)], [ + 'c1' => [adaJson('first', 'c1', 20), adaJson('p2', 'c1', 10)], + 'p2' => [], + ]); + + $screen = Native::visit('/log/commits/p2')->assertSee("Ada's c1"); + + expect(findNode($screen->tree(), fn (array $node): bool => str_starts_with((string) ($node['ref'] ?? ''), 'thread-position-')))->toBeNull(); +}); + +it('shows ten parts at a time, and the rest from Show more of this thread', function () { + $replies = ['c1' => [adaJson('p2', 'c1', 29)]]; + + foreach (range(2, 11) as $part) { + $replies['p'.$part] = [adaJson('p'.($part + 1), 'p'.$part, 29 - $part)]; + } + + $replies['p12'] = []; + serveSelfThread(adaJson('c1', minutes: 30), [], $replies); + + $screen = Native::visit('/log/commits/c1') + ->assertSee("Ada's p11") + ->assertDontSee("Ada's p12"); + + expect(threadPositionOf($screen, 'c1'))->toBe('1/12+'); + + $screen->tap('more-thread')->assertSee("Ada's p12"); + + expect(threadPositionOf($screen, 'c1'))->toBe('1/12') + ->and(threadPositionOf($screen, 'p12'))->toBe('12/12') + ->and(findNode($screen->tree(), fn (array $node): bool => ($node['ref'] ?? null) === 'more-thread'))->toBeNull(); +}); + +it("leaves the author's next part out of a thread opened on the Log, and links to the thread instead", function () { + Http::fake(fn (Request $request) => match (parse_url($request->url(), PHP_URL_PATH)) { + '/api/v1/log/following' => Http::response(pageJson([adaJson('c1', overrides: ['replies_count' => 1])])), + '/api/v1/commits/c1/replies' => Http::response(pageJson([adaJson('p2', 'c1', 25), replyJson(['id' => 'r1', 'parent_id' => 'c1', 'body' => 'Grace answers'])])), + default => Http::response(['message' => 'No fake.'], 404), + }); + + $screen = Native::visit('/log')->assertDontSee('Show thread')->tap('replies-c1') + ->assertSee('Grace answers') + ->assertDontSee("Ada's p2") + ->assertSee('Show thread'); + + expect(array_map(fn ($reply): string => $reply->id, $screen->instance()->threads['c1']))->toBe(['r1']); + + $screen->tap('show-thread-c1')->assertNavigatedTo('/log/commits/c1'); +}); + +it('links to the thread when devnull says which reply carries it on', function () { + Http::fake(['devnull.test/api/v1/log/following*' => Http::response(pageJson([adaJson('c1', overrides: ['continuation_id' => 'p2'])]))]); + + Native::visit('/log')->assertSee('Show thread')->tap('show-thread-c1')->assertNavigatedTo('/log/commits/c1'); +}); diff --git a/tests/Pest.php b/tests/Pest.php index d1bf556c..42366d00 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -409,7 +409,8 @@ function userJson(array $overrides = []): array $username = $overrides['handle'] ?? 'local_dev'; return [ - 'id' => '0199e5c4-0000-7000-8000-000000000001', + // Someone else, named by a handle of their own, is someone else to the app too. + 'id' => $username === 'local_dev' ? '0199e5c4-0000-7000-8000-000000000001' : 'user-'.$username, 'handle' => $username, 'name' => 'Local Dev', 'avatar_url' => 'https://avatars.githubusercontent.com/u/1?v=4', @@ -426,6 +427,17 @@ function userJson(array $overrides = []): array ]; } +/** + * Someone replying to a commit, who isn't its author. + * + * @param array $overrides + * @return array + */ +function replierJson(array $overrides = []): array +{ + return userJson(['id' => '0199e5c4-0000-7000-8000-0000000000aa', 'handle' => 'replier', 'name' => 'Re Plier', 'lane' => 5, ...$overrides]); +} + /** * A user with their counts, as `/me`, a profile and a key sync send them. * @@ -525,14 +537,16 @@ function commitPageJson(array $commit, array $ancestors = [], array $series = [] /** * A reply as `GET /commits/{id}/replies` sends it: like any commit, but without - * stars_count or starred, which that list doesn't load. + * stars_count or starred, which that list doesn't load. It comes from someone + * other than the commit's author unless a test says who, since a reply of + * theirs carries their own thread on (see SelfThread). * * @param array $overrides * @return array */ function replyJson(array $overrides = []): array { - return array_diff_key(commitJson($overrides), array_flip(['stars_count', 'starred'])); + return array_diff_key(commitJson(['author' => replierJson(), ...$overrides]), array_flip(['stars_count', 'starred'])); } /** diff --git a/tests/Unit/Devnull/SelfThreadTest.php b/tests/Unit/Devnull/SelfThreadTest.php new file mode 100644 index 00000000..5f9cc7e6 --- /dev/null +++ b/tests/Unit/Devnull/SelfThreadTest.php @@ -0,0 +1,105 @@ + $overrides + */ +function threadCommit(string $id, string $handle = 'ada', ?string $parent = null, int $minutes = 10, array $overrides = []): Commit +{ + return Commit::fromArray(commitJson([ + 'id' => $id, + 'parent_id' => $parent, + 'author' => userJson(['handle' => $handle]), + 'created_at' => now()->subMinutes($minutes)->toIso8601ZuluString(), + ...$overrides, + ])); +} + +/** + * @param array> $replies + * @return Closure(Commit): (list|null) + */ +function repliesFrom(array $replies): Closure +{ + return fn (Commit $commit): ?array => $replies[$commit->id] ?? null; +} + +it("carries a commit on with its author's earliest reply to it", function () { + $commit = threadCommit('c1', minutes: 30); + $replies = [ + threadCommit('r1', 'grace', 'c1', 25), + threadCommit('p3', 'ada', 'c1', 10), + threadCommit('p2', 'ada', 'c1', 20), + ]; + + expect(SelfThread::next($commit, $replies)?->id)->toBe('p2') + ->and(array_map(fn (Commit $reply): string => $reply->id, SelfThread::others($commit, $replies)))->toBe(['r1', 'p3']); +}); + +it('never carries a commit on with a deleted reply, a quote, or a reply still on its way', function () { + $commit = threadCommit('c1', minutes: 30); + + expect(SelfThread::next($commit, [ + Commit::fromArray(['id' => 'gone', 'parent_id' => 'c1', 'deleted_at' => now()->toIso8601ZuluString()]), + threadCommit('quote', 'ada', null, 20, ['quoted_commit_id' => 'c1']), + threadCommit('staged', 'ada', 'c1', 1, ['status' => Commit::Staged]), + threadCommit('r1', 'grace', 'c1', 15), + ]))->toBeNull(); +}); + +it("takes devnull's word for which reply carries the thread on", function () { + $commit = threadCommit('c1', minutes: 30, overrides: ['continuation_id' => 'p3']); + + expect(SelfThread::next($commit, [threadCommit('p2', 'ada', 'c1', 20), threadCommit('p3', 'ada', 'c1', 10)])?->id)->toBe('p3'); +}); + +it('walks down the parts as far as their replies have come', function () { + $c1 = threadCommit('c1', minutes: 30); + $p2 = threadCommit('p2', 'ada', 'c1', 20); + $p3 = threadCommit('p3', 'ada', 'p2', 10); + + $waiting = SelfThread::below($c1, repliesFrom(['c1' => [$p2]])); + $ended = SelfThread::below($c1, repliesFrom(['c1' => [$p2], 'p2' => [$p3], 'p3' => [threadCommit('r1', 'grace', 'p3', 5)]])); + + expect(array_map(fn (Commit $part): string => $part->id, $waiting->parts))->toBe(['p2']) + ->and($waiting->waiting)->toBe('p2') + ->and($waiting->hasEnded)->toBeFalse() + ->and(array_map(fn (Commit $part): string => $part->id, $ended->parts))->toBe(['p2', 'p3']) + ->and($ended->hasEnded)->toBeTrue() + ->and($ended->waiting)->toBeNull(); +}); + +it('stops at the limit and says another part follows', function () { + $c1 = threadCommit('c1', minutes: 30); + $p2 = threadCommit('p2', 'ada', 'c1', 20); + $p3 = threadCommit('p3', 'ada', 'p2', 10); + + $thread = SelfThread::below($c1, repliesFrom(['c1' => [$p2], 'p2' => [$p3]]), limit: 1); + + expect(array_map(fn (Commit $part): string => $part->id, $thread->parts))->toBe(['p2']) + ->and($thread->hasMore)->toBeTrue() + ->and($thread->hasEnded)->toBeFalse(); +}); + +it('counts the earlier parts above a commit, only while each is the one its author carried on', function () { + $c1 = threadCommit('c1', minutes: 30); + $p2 = threadCommit('p2', 'ada', 'c1', 20); + $p3 = threadCommit('p3', 'ada', 'p2', 10); + $other = threadCommit('o1', 'ada', 'p2', 15); + + expect(SelfThread::above([$c1, $p2], $p3, repliesFrom(['c1' => [$p2], 'p2' => [$p3]])))->toBe([2, null]) + ->and(SelfThread::above([$c1, $p2], $p3, repliesFrom(['p2' => [$p3]])))->toBe([1, 'c1']) + // Ada's earliest reply to p2 is o1, so p3 isn't part of the thread. + ->and(SelfThread::above([$c1, $p2], $p3, repliesFrom(['p2' => [$other, $p3]])))->toBe([0, null]) + ->and(SelfThread::above([threadCommit('g1', 'grace')], threadCommit('p9', 'ada', 'g1'), repliesFrom([])))->toBe([0, null]); +}); + +it("writes a commit's place in its thread as the web does", function () { + expect(SelfThread::position(2, 5, false))->toBe('2/5') + ->and(SelfThread::position(1, 12, true))->toBe('1/12+') + ->and(SelfThread::position(1, 1, false))->toBeNull(); +}); From 4f0ed672b28477313e499f69886907a66cc9a47d Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 01:31:16 +0000 Subject: [PATCH 17/46] Use glass/80 for both composer bars and even out the Messages bar The lighter glass is now mobile-air's glass/N suffix rather than a separate attribute, and it's on Display::composerBarGlass(), so the Messages composer gets it too. Messages had the same uneven gaps as the reply bar, so the spacing moves into composer-box for both: no top padding on the row around the box, and 8pt between the field and the row of tools. Both bars keep their height. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Display.php | 22 ++++++------------- .../views/native/commit-detail.blade.php | 3 +-- resources/views/native/conversation.blade.php | 2 +- .../native/partials/composer-box.blade.php | 7 +++--- tests/Feature/Screens/CommitDetailTest.php | 18 +++++++-------- tests/Feature/Screens/RemotesComposerTest.php | 17 ++++++++++++++ tests/Pest.php | 12 ++++++++++ 7 files changed, 49 insertions(+), 32 deletions(-) diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index 8e736203..6648e4e7 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -45,10 +45,10 @@ final class Display public const int ComposerGlassTint = 40; /** - * How opaque the glass under the reply bar gets on iOS once it has faded in, from 0 to 1 (see - * replyBarGlassOpacity()). mobile-air's own default is 1, which over a dark page reads as a heavy slab. + * How opaque, in percent, the glass under a composer bar gets on iOS once it has faded in (glass/N, see + * composerBarGlass()). Full glass over a dark screen reads as a heavy slab. */ - public const float ReplyBarGlassOpacity = 0.8; + public const int ComposerGlassOpacity = 80; /** * About how many characters fit on a line of the box's field, which runs the width of the box. @@ -306,21 +306,13 @@ public static function fadesInBar(): bool * The classes for a composer's native:bottom-bar. On iOS that's Liquid Glass: what scrolls under the bar shows * through it, blurred. A patched mobile-air draws the glass behind the whole bar, under the home indicator too, * and fades it in over the bar's top ComposerFadeHeight points, so it has no hard top edge. EDGE's own glass on - * an element can't be faded, and stops short of the home indicator. Android has no glass, so the bar stays the - * surface there. + * an element can't be faded, and stops short of the home indicator. The glass stops at ComposerGlassOpacity + * percent (glass/N), so a little of the screen under the bar shows through. Android has no glass, so the bar + * stays the surface there. */ public static function composerBarGlass(): string { - return self::fadesInBar() ? 'glass' : ''; - } - - /** - * The reply bar's glass-opacity: how opaque mobile-air's glass behind the bar gets on iOS once it has faded in, - * so a little more of the page shows through. Null on Android, which draws no glass behind a bottom bar. - */ - public static function replyBarGlassOpacity(): ?float - { - return self::fadesInBar() ? self::ReplyBarGlassOpacity : null; + return self::fadesInBar() ? 'glass/'.self::ComposerGlassOpacity : ''; } /** diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index ce9a027f..5d26c304 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -151,7 +151,7 @@ --}} @php($replyPostingMe = app(\App\Devnull\Account::class)->user()) @php($replyPostsAs = $replyPostingMe !== null && \App\Devnull\PostAs::offered($replyAuthor)) - + @if (\App\Devnull\Display::fadesInBar()) @include('native.partials.composer-fade', ['ref' => 'reply-fade', 'inBar' => true]) @@ -179,7 +179,6 @@ @include('native.partials.composer-box', [ 'ref' => 'reply', 'field' => $replyPreviewing ? 'native.partials.reply-preview' : 'native.partials.reply-field', - 'fieldPadding' => 'pt-1 pb-2', 'lead' => $replyPostsAs ? [['native.partials.post-as', ['ref' => 'reply-post-as', 'me' => $replyPostingMe, 'picked' => $replyAuthor, 'method' => 'postAsInReply', 'size' => 28, 'inset' => 'pl-3']]] : [], 'tools' => [ ['ref' => 'reply-add-photos', 'icon' => \App\Icons\Lucide::ImagePlus, 'label' => $photosFull ? 'A reply can have up to 3 photos' : 'Add photos', 'menu' => $photosFull ? null : \App\Devnull\ComposerMenu::photoItems(), 'disabled' => $photosFull], diff --git a/resources/views/native/conversation.blade.php b/resources/views/native/conversation.blade.php index e5642545..5191385f 100644 --- a/resources/views/native/conversation.blade.php +++ b/resources/views/native/conversation.blade.php @@ -124,7 +124,7 @@ The box keeps its row, and the row its place among the bar's, so the field inside never moves. A voice note takes the field's place, and the +'s, while it's recorded and waits to be pushed. --}} - + @include('native.partials.composer-box', [ 'ref' => 'message', 'field' => $recorder === null ? 'native.partials.message-field' : 'native.partials.voice-recorder', diff --git a/resources/views/native/partials/composer-box.blade.php b/resources/views/native/partials/composer-box.blade.php index c036c99c..c706afc0 100644 --- a/resources/views/native/partials/composer-box.blade.php +++ b/resources/views/native/partials/composer-box.blade.php @@ -11,14 +11,13 @@ row, ahead of the tools, and for the end, left of the send button, such as the count of a long draft. $send is send-button's: its ref, label, method, and whether it can send yet. - The field's text lines up with the tools' icons under it. $fieldPadding is the field row's padding above and below - the field (pt-1 by default), for a bar that wants more room between the field and the row under it. + The field's text lines up with the tools' icons under it. The field sits a little nearer the fade above it than + the row under it: the row around the box has no top padding, and the field row leaves 8pt under the field. --}} @php($lead ??= []) -@php($fieldPadding ??= 'pt-1') @php($trail ??= []) - + @include($field) diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 7e0360c4..5e7d4c55 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -7,7 +7,6 @@ use App\Models\PendingWrite; use Illuminate\Http\Client\Request; use Illuminate\Support\Facades\Http; -use Native\Mobile\Edge\Elements\BottomBar; use Native\Mobile\Events\Alert\ButtonPressed; use Native\Mobile\Testing\Native; @@ -869,6 +868,10 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): it('puts the reply bar on glass on iOS and the surface on Android, with no line, and fades the page out above it', function (string $platform) { fakeThread(); + if ($platform === 'ios') { + skipWithoutGlassOpacity(); + } + $screen = Native::visit('/log/commits/c2', platform: $platform); $bottomBar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); $bar = $bottomBar['children'][0]; @@ -913,20 +916,15 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): ->and(nodeByRef($screen, 'reply-field-row')['layout']['padding'])->toEqual([4, 12, 8, 16]); })->with(['ios', 'android']); -it('asks mobile-air for a lighter glass under the reply bar on iOS only', function (string $platform, ?float $opacity) { +it('fades the glass under the reply bar to 80% on iOS only', function (string $platform) { + skipWithoutGlassOpacity(); fakeThread(); $screen = Native::visit('/log/commits/c2', platform: $platform); $bottomBar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); - expect($bottomBar['props']['glass_opacity'] ?? null)->toBe($opacity); -})->with([ - 'ios' => ['ios', Display::ReplyBarGlassOpacity], - 'android' => ['android', null], -])->skip( - ! method_exists(BottomBar::class, 'glassOpacity'), - 'Needs a mobile-air with glass-opacity on native:bottom-bar (NativePHP/mobile-air#735)', -); + expect($bottomBar['props']['glass_opacity'] ?? null)->toBe($platform === 'ios' ? Display::ComposerGlassOpacity / 100 : null); +})->with(['ios', 'android']); it('ends the page above the reply bar, and further as the draft grows', function () { fakeThread(replies: [replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'The last reply'])]); diff --git a/tests/Feature/Screens/RemotesComposerTest.php b/tests/Feature/Screens/RemotesComposerTest.php index 637ed790..a6c567cb 100644 --- a/tests/Feature/Screens/RemotesComposerTest.php +++ b/tests/Feature/Screens/RemotesComposerTest.php @@ -285,7 +285,22 @@ function threadWithAda(string $platform = 'ios'): TestableComponent ->and(nodeByRef($screen, 'push')['props']['a11y_label'] ?? nodeByRef($screen, 'push')['a11y_label'] ?? null)->toBe('Push'); })->with(['ios', 'android']); +it('keeps the field closer to the fade than to the + and Push under it', function (string $platform) { + serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); + + $screen = threadWithAda($platform); + + // [top, right, bottom, left]. As on a commit's reply bar: no top padding on the row, so the field starts 4pt + // under the fade, and 8pt between the field and the row under it. + expect(nodeByRef($screen, 'message-row')['layout']['padding'])->toEqual([0, 16, 8, 16]) + ->and(nodeByRef($screen, 'message-field-row')['layout']['padding'])->toEqual([4, 12, 8, 16]); +})->with(['ios', 'android']); + it('puts the bar on glass on iOS and the surface on Android, with no box or line, and fades the thread out above it', function (string $platform) { + if ($platform === 'ios') { + skipWithoutGlassOpacity(); + } + serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); $screen = threadWithAda($platform); @@ -306,6 +321,7 @@ function threadWithAda(string $platform = 'ios'): TestableComponent // top, ending at the glass's tint, and its rows carry the tint, in either appearance. The bar itself has no // background, which iOS would paint behind the fade. expect($bottomBar['props']['glass'] ?? null)->toBe(1) + ->and($bottomBar['props']['glass_opacity'] ?? null)->toBe(Display::ComposerGlassOpacity / 100) ->and(childRefs($screen, 'composer-bar'))->toBe(['composer-fade', 'composer-rows']) ->and($bar['style']['bg_color'] ?? null)->toBeNull() ->and(nodeByRef($screen, 'composer-rows')['style']['bg_color'] ?? null)->toBe('#66'.$surface) @@ -315,6 +331,7 @@ function threadWithAda(string $platform = 'ios'): TestableComponent } else { // No glass on Android. The thread stops at the bar, so the fade lies over its foot, and the bar is the surface. expect($bottomBar['props']['glass'] ?? null)->toBeNull() + ->and($bottomBar['props']['glass_opacity'] ?? null)->toBeNull() ->and(childRefs($screen, 'composer-bar'))->toBe(['composer-rows']) ->and($bar['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) ->and(nodeByRef($screen, 'composer-rows')['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) diff --git a/tests/Pest.php b/tests/Pest.php index d1bf556c..4fd27341 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -15,6 +15,7 @@ use Illuminate\Http\Client\Request; use Illuminate\Support\Facades\Http; use Native\Mobile\AsyncTask; +use Native\Mobile\Edge\TailwindParser; use Native\Mobile\Events\Async\AsyncTaskFailed; use Native\Mobile\Events\Async\AsyncTaskFinished; use Native\Mobile\Events\Gallery\MediaSelected; @@ -1124,3 +1125,14 @@ function skipWithoutSkia(): void test()->markTestSkipped('needs the Skia plugin installed'); } } + +/** + * Skips the test unless the installed mobile-air reads an opacity suffix on the glass class (glass/80, from + * NativePHP/mobile-air#735). Without it the composer bars' glass/N isn't parsed at all. + */ +function skipWithoutGlassOpacity(): void +{ + if (! array_key_exists('glassOpacity', TailwindParser::parse('glass/80'))) { + test()->markTestSkipped('Needs a mobile-air that reads glass/N (NativePHP/mobile-air#735)'); + } +} From c5180c652338026861e3b61026827b1010e45cd5 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 01:33:24 +0000 Subject: [PATCH 18/46] Move the glass/N test guard out of Pest.php It sat at the end of tests/Pest.php, where the build branch's partial frames helpers also land, so the two clashed on merge. It's a small class in tests/Support now. Co-Authored-By: Claude Opus 5.5 --- tests/Feature/Screens/CommitDetailTest.php | 5 ++-- tests/Feature/Screens/RemotesComposerTest.php | 3 ++- tests/Pest.php | 12 ---------- tests/Support/GlassOpacity.php | 24 +++++++++++++++++++ 4 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 tests/Support/GlassOpacity.php diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 5e7d4c55..591eb7f1 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Http; use Native\Mobile\Events\Alert\ButtonPressed; use Native\Mobile\Testing\Native; +use Tests\Support\GlassOpacity; beforeEach(function () { config(['devnull.url' => 'http://devnull.test']); @@ -869,7 +870,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): fakeThread(); if ($platform === 'ios') { - skipWithoutGlassOpacity(); + GlassOpacity::skipUnlessSupported(); } $screen = Native::visit('/log/commits/c2', platform: $platform); @@ -917,7 +918,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): })->with(['ios', 'android']); it('fades the glass under the reply bar to 80% on iOS only', function (string $platform) { - skipWithoutGlassOpacity(); + GlassOpacity::skipUnlessSupported(); fakeThread(); $screen = Native::visit('/log/commits/c2', platform: $platform); diff --git a/tests/Feature/Screens/RemotesComposerTest.php b/tests/Feature/Screens/RemotesComposerTest.php index a6c567cb..6e3e0079 100644 --- a/tests/Feature/Screens/RemotesComposerTest.php +++ b/tests/Feature/Screens/RemotesComposerTest.php @@ -10,6 +10,7 @@ use Native\Mobile\Facades\System; use Native\Mobile\Testing\Native; use Native\Mobile\Testing\TestableComponent; +use Tests\Support\GlassOpacity; const ComposerViewerId = '0199e5c4-0000-7000-8000-000000000001'; @@ -298,7 +299,7 @@ function threadWithAda(string $platform = 'ios'): TestableComponent it('puts the bar on glass on iOS and the surface on Android, with no box or line, and fades the thread out above it', function (string $platform) { if ($platform === 'ios') { - skipWithoutGlassOpacity(); + GlassOpacity::skipUnlessSupported(); } serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); diff --git a/tests/Pest.php b/tests/Pest.php index 4fd27341..d1bf556c 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -15,7 +15,6 @@ use Illuminate\Http\Client\Request; use Illuminate\Support\Facades\Http; use Native\Mobile\AsyncTask; -use Native\Mobile\Edge\TailwindParser; use Native\Mobile\Events\Async\AsyncTaskFailed; use Native\Mobile\Events\Async\AsyncTaskFinished; use Native\Mobile\Events\Gallery\MediaSelected; @@ -1125,14 +1124,3 @@ function skipWithoutSkia(): void test()->markTestSkipped('needs the Skia plugin installed'); } } - -/** - * Skips the test unless the installed mobile-air reads an opacity suffix on the glass class (glass/80, from - * NativePHP/mobile-air#735). Without it the composer bars' glass/N isn't parsed at all. - */ -function skipWithoutGlassOpacity(): void -{ - if (! array_key_exists('glassOpacity', TailwindParser::parse('glass/80'))) { - test()->markTestSkipped('Needs a mobile-air that reads glass/N (NativePHP/mobile-air#735)'); - } -} diff --git a/tests/Support/GlassOpacity.php b/tests/Support/GlassOpacity.php new file mode 100644 index 00000000..4acf0dac --- /dev/null +++ b/tests/Support/GlassOpacity.php @@ -0,0 +1,24 @@ +markTestSkipped('Needs a mobile-air that reads glass/N (NativePHP/mobile-air#735)'); + } + } +} From f03090c4b6512f0ff509bc0419f83b5ea6a0042d Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 02:14:29 +0000 Subject: [PATCH 19/46] Open every level of replies in place on the commit page, as the web does A reply's "N replies" on the commit page used to open that reply's own page. Now it opens its replies under it, and theirs under them, as deep as they go, the way the web's commit page does. Tapping a reply still opens its page. The rows come from #179's ThreadRows, now recursive, and the threads from ExpandsThreads, which replaces the page's separate mechanism for a deleted reply's replies. Indentation stops at the web's depth of three (maxIndentDepth in commit-thread.tsx). Replies at the third step hang on their own elbow off the line of the reply they answer, and deeper ones line up under them with no lines and a "replying to @handle" line. "Show more" is a row of its own on the page too, as on the Log, and says "to @handle" past that depth. The Log keeps opening only the commit's replies in place. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/RowInputs.php | 1 - app/Devnull/ThreadRows.php | 193 +++++++++++++----- app/NativeComponents/CommitDetail.php | 119 ++++------- .../Concerns/ExpandsThreads.php | 8 +- .../views/native/commit-detail.blade.php | 75 ++----- .../native/partials/related-commits.blade.php | 1 + .../native/partials/thread-links.blade.php | 33 +-- .../native/partials/thread-more-row.blade.php | 40 +++- .../native/partials/thread-more.blade.php | 17 -- .../native/partials/thread-reply.blade.php | 62 +++--- .../Feature/Screens/CommitDetailCacheTest.php | 2 +- tests/Feature/Screens/CommitDetailTest.php | 15 +- tests/Feature/Screens/NestedRepliesTest.php | 77 +++++++ tests/Feature/Screens/RowCacheScreensTest.php | 6 +- tests/Unit/Devnull/ThreadRowsTest.php | 86 ++++++++ 15 files changed, 457 insertions(+), 278 deletions(-) delete mode 100644 resources/views/native/partials/thread-more.blade.php create mode 100644 tests/Feature/Screens/NestedRepliesTest.php create mode 100644 tests/Unit/Devnull/ThreadRowsTest.php diff --git a/app/Devnull/RowInputs.php b/app/Devnull/RowInputs.php index 33d2f741..323d2265 100644 --- a/app/Devnull/RowInputs.php +++ b/app/Devnull/RowInputs.php @@ -40,7 +40,6 @@ public static function for(Commit $commit, array $scope): array 'continued' => in_array($commit->id, $scope['threadsContinued'] ?? [], true), 'popping' => [$scope['popping']['star-'.$commit->id] ?? null, $scope['popping']['pastel-'.$commit->id] ?? null], 'tombstones' => $scope['tombstones'] ?? false, - 'tombstoneReplies' => array_key_exists($commit->id, $scope['tombstoneReplies'] ?? []), 'shown' => [self::changing($commit), $commit->quotedCommit === null ? null : self::changing($commit->quotedCommit)], 'poll' => [$scope['pollChoices'][$commit->id] ?? null, in_array($commit->id, $scope['voting'] ?? [], true)], ]; diff --git a/app/Devnull/ThreadRows.php b/app/Devnull/ThreadRows.php index 337766d9..61e7042f 100644 --- a/app/Devnull/ThreadRows.php +++ b/app/Devnull/ThreadRows.php @@ -3,21 +3,35 @@ namespace App\Devnull; use App\Devnull\Data\Commit; +use Closure; /** - * The list rows of a commit's thread opened in a feed (see - * Concerns\ExpandsThreads), in order, each with what its partial draws. + * The rows of a commit's thread opened in place (see + * Concerns\ExpandsThreads), in order, each with what its partial draws: in a + * feed, and on a commit page under the commit and under the last part of its + * author's thread. * * Under the commit come its replies, each followed by its own replies when - * they're open, one step in, and "Show more" after the replies of a thread - * with more. Every row is a list row of its own, and the last one closes the - * commit's row with its hairline. + * they're open, and theirs, as deep as they go, with "Show more" after the + * replies of a thread with more. Every row is a row of its own, and in a feed + * the last one closes the commit's row with its hairline. * * The thread hangs off the rail in dashes, as on the web: the first reply on * an elbow from the commit's rail, each later one on a short link from the * line down from the reply above, which is in that reply's lane. A reply's - * own replies hang the same way off the line down from its avatar, which runs - * on past them ($spine) when another reply of the commit follows. + * own replies hang the same way off the line down from its avatar, one step + * in, and that line runs on past them ($spines) when another reply follows. + * + * The steps in stop at the web's depth (MaxIndentDepth). Replies at that + * depth each hang on an elbow of their own from the line of the reply they + * answer, as the web draws every reply, since their replies line up under + * them and a line down from one avatar to the next would run through those. + * Deeper replies are flattened: in the same column, with no lines, and a + * "↳ replying to @handle" line saying who they answer. + * + * In a feed only the commit's replies open theirs in place ($opensInPlace), + * and a reply's replies open their page. On a commit page every reply opens + * its replies in place. */ final class ThreadRows { @@ -35,67 +49,151 @@ final class ThreadRows */ public const int FirstReplyTop = 3; + /** + * How deep replies step in, as the web's maxIndentDepth: the commit's + * replies are 1, and deeper replies line up under those at this depth. + */ + public const int MaxIndentDepth = 3; + + /** + * How far in each step is, in points. + */ + public const int Step = 32; + /** * @param array> $threads Open threads, by the id of the commit or reply they answer. * @param array $cursors Where each open thread with more carries on. * @param array $shown How many of each open thread's replies show. * @param int|string|null $railLane The commit's rail running on past its thread, when its author's run carries on below. + * @param int $opensInPlace How deep a reply's replies button opens its replies in place rather than its page. + * @param bool $onPage On a commit page: replies muted, deleted ones open theirs in place, and no hairline under them. + * @param string|null $morePress What the commit's own "Show more" presses, when it isn't showMoreReplies. * @return list, reply: Commit|null}> */ - public static function under(Commit $commit, array $threads, array $cursors, array $shown, int|string|null $railLane = null): array - { + public static function under( + Commit $commit, + array $threads, + array $cursors, + array $shown, + int|string|null $railLane = null, + int $opensInPlace = 1, + bool $onPage = false, + ?string $morePress = null, + ): array { $thread = fn (string $id): array => array_slice($threads[$id] ?? [], 0, $shown[$id] ?? null); $hasMore = fn (string $id): bool => isset($cursors[$id]) || count($thread($id)) < count($threads[$id] ?? []); - $replies = $thread($commit->id); - if ($replies === []) { + $rows = []; + self::branch($rows, $commit, 1, [], $thread, $hasMore, [ + 'railLane' => $railLane, + 'opensInPlace' => $opensInPlace, + 'onPage' => $onPage, + 'morePress' => $morePress, + ]); + + if ($rows === []) { return []; } - $rows = []; - $more = $hasMore($commit->id); + $last = array_key_last($rows); + $rows[$last]['data']['last'] = true; + + return $rows; + } + + /** + * How far in replies at $depth start, past the commit's text. + */ + public static function indent(int $depth): int + { + return (min($depth, self::MaxIndentDepth) - 1) * self::Step; + } + + /** + * The x of the line down from the avatars of replies at $depth, or the commit's rail above them all. + */ + private static function lineAt(int $depth): float + { + return $depth === 0 ? 31.5 : 75.5 + self::indent($depth); + } + + /** + * The rows of $parent's replies at $depth, and theirs under each. + * + * @param list> $rows + * @param list $spines Lines from further up running on past these rows. + * @param Closure(string): list $thread + * @param Closure(string): bool $hasMore + * @param array{railLane: int|string|null, opensInPlace: int, onPage: bool, morePress: string|null} $options + */ + private static function branch(array &$rows, Commit $parent, int $depth, array $spines, Closure $thread, Closure $hasMore, array $options): void + { + $replies = $thread($parent->id); + + if ($replies === []) { + return; + } + + $more = $hasMore($parent->id); + $indent = self::indent($depth); + $hangs = $depth === self::MaxIndentDepth; + $flattened = $depth > self::MaxIndentDepth; + $parentLine = self::lineAt($depth - 1); + $onPage = $options['onPage']; foreach ($replies as $index => $reply) { - $nested = $reply->isDeleted() ? [] : $thread($reply->id); - $nestedMore = $nested !== [] && $hasMore($reply->id); + $nested = $reply->isDeleted() && ! $onPage ? [] : $thread($reply->id); $followed = $index < count($replies) - 1 || $more; + $top = ! $onPage && $depth === 1 && $index === 0 ? self::FirstReplyTop : 10; $rows[] = self::reply($reply, [ - 'lane' => $commit->lane(), - 'previousLane' => $index === 0 ? null : $replies[$index - 1]->lane(), - 'hasNext' => $followed || $nested !== [], - 'railLane' => $railLane, - 'thread' => $commit, - 'repliesInPlace' => true, - ...($index === 0 ? ['top' => self::FirstReplyTop] : []), + 'lane' => $parent->lane(), + 'previousLane' => $index === 0 || $hangs ? null : $replies[$index - 1]->lane(), + 'hasNext' => ! $hangs && ! $flattened && ($followed || $nested !== []), + 'links' => ! $flattened, + 'railLane' => $options['railLane'], + 'indent' => $indent, + 'top' => $top, + // At the deepest step the line of the reply answered runs on under the elbow to the next one. + 'spines' => [...$spines, ...($hangs && $followed ? [['left' => $parentLine, 'lane' => $parent->lane(), 'top' => $top + 12]] : [])], + 'replyingTo' => $flattened ? self::replyingTo($reply, $parent) : null, + 'repliesInPlace' => $depth <= $options['opensInPlace'], + 'muted' => $onPage, + 'tombstones' => $onPage, ]); - foreach ($nested as $nestedIndex => $nestedReply) { - $rows[] = self::reply($nestedReply, [ - 'lane' => $reply->lane(), - 'previousLane' => $nestedIndex === 0 ? null : $nested[$nestedIndex - 1]->lane(), - 'hasNext' => $nestedIndex < count($nested) - 1 || $nestedMore, - 'railLane' => $railLane, - 'indent' => 32, - 'spine' => $followed ? $reply->lane() : null, - 'thread' => $reply, - 'repliesInPlace' => false, - ]); - } - - if ($nestedMore) { - $rows[] = self::more($reply->id, $nested[array_key_last($nested)]->lane(), $railLane, 32, $followed ? $reply->lane() : null); - } + // The line that has to run on past this reply's own replies, to the next reply at this depth. + $through = match (true) { + ! $followed || $flattened => [], + $hangs => [['left' => $parentLine, 'lane' => $parent->lane()]], + default => [['left' => self::lineAt($depth), 'lane' => $reply->lane()]], + }; + + self::branch($rows, $reply, $depth + 1, [...$spines, ...$through], $thread, $hasMore, $options); } if ($more) { - $rows[] = self::more($commit->id, $replies[array_key_last($replies)]->lane(), $railLane); + $rows[] = self::more($parent, [ + 'lane' => $replies[array_key_last($replies)]->lane(), + 'parentLane' => $parent->lane(), + 'hangs' => $hangs, + 'links' => ! $flattened, + 'railLane' => $options['railLane'], + 'indent' => $indent, + 'spines' => $spines, + 'to' => $flattened && ! $parent->isDeleted() ? $parent->author->handle() : null, + 'hairline' => ! $onPage, + ...($depth === 1 && $options['morePress'] !== null ? ['press' => $options['morePress']] : []), + ]); } + } - $last = array_key_last($rows); - $rows[$last]['data']['last'] = true; - - return $rows; + /** + * "replying to @handle", or "quoting" when the reply quotes what it answers, as the web marks a flattened reply. + */ + private static function replyingTo(Commit $reply, Commit $parent): string + { + return ($reply->quotedCommitId === $parent->id ? 'quoting ' : 'replying to ').($parent->isDeleted() ? '[deleted]' : $parent->author->handle()); } /** @@ -107,7 +205,7 @@ private static function reply(Commit $reply, array $data): array return [ 'key' => 'thread-reply-'.$reply->id, 'partial' => 'native.partials.thread-reply', - 'data' => ['reply' => $reply, 'indent' => 0, 'spine' => null, 'last' => false, 'fades' => true, ...$data], + 'data' => ['reply' => $reply, 'last' => false, 'fades' => true, ...$data], 'reply' => $reply, ]; } @@ -115,14 +213,15 @@ private static function reply(Commit $reply, array $data): array /** * "Show more" at the foot of a thread, on a line down in the lane of the reply above it. * + * @param array $data * @return array{key: string, partial: string, data: array, reply: null} */ - private static function more(string $threadId, int|string $lane, int|string|null $railLane, int $indent = 0, int|string|null $spine = null): array + private static function more(Commit $parent, array $data): array { return [ - 'key' => 'thread-more-'.$threadId, + 'key' => 'thread-more-'.$parent->id, 'partial' => 'native.partials.thread-more-row', - 'data' => ['threadId' => $threadId, 'lane' => $lane, 'railLane' => $railLane, 'indent' => $indent, 'spine' => $spine, 'last' => false], + 'data' => ['threadId' => $parent->id, 'last' => false, ...$data], 'reply' => null, ]; } diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index b2d1a490..d7dd120f 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -23,6 +23,7 @@ use App\Devnull\Toasts; use App\Icons\Lucide; use App\Models\PendingWrite; +use App\NativeComponents\Concerns\ExpandsThreads; use App\NativeComponents\Concerns\OpensInTab; use App\NativeComponents\Concerns\OpensLiveStream; use App\NativeComponents\Concerns\RedrawsOnAppearanceChange; @@ -46,7 +47,11 @@ * "› N replies", each opened in place. Opened from a "› N replies" button * ($data['replies']), its replies already show. They come ten at a time * (see Client::RepliesPerPage), and "Show more" under the last asks for the - * next ten, as it does under a deleted reply's replies opened in place. + * next ten. + * + * Each reply's own replies open in place under it, and theirs under them, as + * deep as they go, as the web's commit page does (see ExpandsThreads and + * App\Devnull\ThreadRows). Tapping a reply still opens its page. * * It opens on the commit as it was last time, or opened from a row, on what * the row knew of it, then asks devnull for the rest behind it and fills it in. @@ -87,6 +92,10 @@ */ class CommitDetail extends NativeComponent { + use ExpandsThreads { + toggleReplies as private toggleThread; + showMoreReplies as private showMoreThreadReplies; + } use OpensInTab; use OpensLiveStream; use RedrawsOnAppearanceChange; @@ -190,20 +199,6 @@ class CommitDetail extends NativeComponent */ public bool $repliesLoaded = false; - /** - * The replies of deleted replies that were opened in place, by the deleted reply's id. - * - * @var array> - */ - public array $tombstoneReplies = []; - - /** - * Where the next page of each deleted reply's replies starts, by the deleted reply's id, or null when they're all shown. - * - * @var array - */ - public array $tombstoneCursors = []; - public string $reply = ''; /** @@ -313,7 +308,7 @@ public function load(): void protected function revalidate(): void { - $this->refresh($this->threadPath(), [], fn (array $json) => $this->takeThread($json)); + $this->refresh($this->threadPath(), [], fn (array $json) => $this->takeCommitThread($json)); $this->refresh($this->threadPath().'/replies', [], fn (array $json) => $this->takeReplies($json)); $this->refresh($this->threadPath().'/related', [], fn (array $json) => $this->takeRelated($json), quiet: true, failed: function (): void { $this->related = []; @@ -324,19 +319,7 @@ protected function revalidate(): void $this->refreshPartReplies((string) $id); } - foreach (array_keys($this->tombstoneReplies) as $id) { - $id = (string) $id; - - $this->refresh('commits/'.rawurlencode($id).'/replies', [], function (array $json) use ($id): void { - if (array_key_exists($id, $this->tombstoneReplies)) { - [$this->tombstoneReplies[$id], $this->tombstoneCursors[$id]] = self::withFirstPage( - $this->tombstoneReplies[$id], - $this->tombstoneCursors[$id] ?? null, - Page::fromArray($json, Commit::fromArray(...)), - ); - } - }); - } + $this->refreshThreads(); } protected function showsContent(): bool @@ -364,11 +347,32 @@ public function replyTapped(): void } /** - * "› N replies" under the commit opens them in place, and "Hide replies" folds them away. + * "› N replies" under the commit opens them in place, and "Hide replies" folds them away. Under a reply, at any + * depth, it opens that reply's replies in place under it (see ExpandsThreads). + */ + public function toggleReplies(string $id = ''): void + { + if ($id === '' || $id === $this->id) { + $this->repliesShown = ! $this->repliesShown; + + return; + } + + $this->toggleThread($id); + } + + /** + * "Show more" under a reply's replies opened in place. The commit's own go on from loadMoreReplies(). */ - public function toggleReplies(): void + public function showMoreReplies(string $id): void { - $this->repliesShown = ! $this->repliesShown; + if ($id === $this->id) { + $this->loadMoreReplies(); + + return; + } + + $this->showMoreThreadReplies($id); } /** @@ -445,39 +449,6 @@ public function toggleRelated(): void Beat::dispatch(self::RelatedFade)->finished($closed)->failed($closed); } - /** - * A deleted reply has no page of its own, so its replies open in place below it. - */ - public function toggleTombstone(string $id): void - { - if (array_key_exists($id, $this->tombstoneReplies)) { - unset($this->tombstoneReplies[$id], $this->tombstoneCursors[$id]); - - return; - } - - $this->loadTombstoneReplies($id); - } - - /** - * "Show more" under a deleted reply's replies: its next five, in place. - */ - public function loadMoreTombstoneReplies(string $id): void - { - $cursor = $this->tombstoneCursors[$id] ?? null; - - if ($cursor === null) { - return; - } - - $page = $this->attempt(fn ($devnull) => $devnull->replies($id, $cursor)); - - if ($page !== null && array_key_exists($id, $this->tombstoneReplies)) { - $this->tombstoneReplies[$id] = [...$this->tombstoneReplies[$id], ...$page->items]; - $this->tombstoneCursors[$id] = $page->nextCursor; - } - } - public function loadMoreReplies(): void { if ($this->repliesCursor === null) { @@ -740,7 +711,7 @@ protected function updateShownCommits(Closure $update): void $this->replies = array_map($update, $this->replies); $this->partReplies = array_map(fn (array $replies): array => array_map($update, $replies), $this->partReplies); $this->related = array_map($update, $this->related); - $this->tombstoneReplies = array_map(fn (array $replies): array => array_map($update, $replies), $this->tombstoneReplies); + $this->threads = array_map(fn (array $replies): array => array_map($update, $replies), $this->threads); } /** @@ -748,7 +719,7 @@ protected function updateShownCommits(Closure $update): void */ protected function shownCommits(): iterable { - return [...($this->commit === null ? [] : [$this->commit]), ...$this->ancestors, ...$this->series, ...$this->replies, ...array_merge([], ...array_values($this->partReplies)), ...$this->related, ...array_merge([], ...array_values($this->tombstoneReplies))]; + return [...($this->commit === null ? [] : [$this->commit]), ...$this->ancestors, ...$this->series, ...$this->replies, ...array_merge([], ...array_values($this->partReplies)), ...$this->related, ...$this->threadCommits()]; } /** @@ -799,7 +770,7 @@ private function keepStagedReplies(): void private function showKept(): void { if (($thread = $this->cached($this->threadPath())) !== null) { - $this->takeThread($thread); + $this->takeCommitThread($thread); } elseif ($this->commit === null && ($commit = $this->data('commit')) instanceof Commit && $commit->id === $this->id) { $this->commit = $commit; $this->ancestors = $commit->parent === null ? [] : [$commit->parent]; @@ -825,7 +796,7 @@ private function takeRelated(array $json): void /** * @param array $json */ - private function takeThread(array $json): void + private function takeCommitThread(array $json): void { $thread = CommitThread::fromArray($json); @@ -949,16 +920,6 @@ private function threadPath(): string return 'commits/'.rawurlencode($this->id); } - private function loadTombstoneReplies(string $id): void - { - $page = $this->attempt(fn ($devnull) => $devnull->replies($id)); - - if ($page !== null) { - $this->tombstoneReplies[$id] = $page->items; - $this->tombstoneCursors[$id] = $page->nextCursor; - } - } - /** * Whether the commit is yours, or an organization's you're in, which puts Delete in the nav bar (see Ownership). */ diff --git a/app/NativeComponents/Concerns/ExpandsThreads.php b/app/NativeComponents/Concerns/ExpandsThreads.php index 3be3d314..8a31f599 100644 --- a/app/NativeComponents/Concerns/ExpandsThreads.php +++ b/app/NativeComponents/Concerns/ExpandsThreads.php @@ -19,9 +19,11 @@ * asked for once they're all showing. * * A reply opened in place has the same button under its own actions, which - * opens its replies in place too, one step in. A reply that deep opens its - * replies on its page. Every thread is kept by the id of the commit or reply - * it answers, so a reply's replies sit in $threads beside its commit's. + * opens its replies in place too, one step in. In a feed a reply that deep + * opens its replies on its page. On a commit page every reply opens its + * replies in place, as deep as they go (see CommitDetail and + * App\Devnull\ThreadRows). Every thread is kept by the id of the commit or + * reply it answers, so a reply's replies sit in $threads beside its commit's. * * EDGE can't animate a row coming into a list or going out of it, so replies * fade: a page that opens is drawn see-through ($fadedRows) and drawn again diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index 278706ea..df6150b2 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -23,8 +23,9 @@ their avatar once. The replies hang under it on the thread's dashed lines, with the rail ending in a dot above them, ten at a time with "Show more" under the last. A part of a series with more parts after it has its replies right under it, beside the rail running on, and the later parts follow. Everything - around the commit is muted, and still opens its own page. A deleted reply's own replies open in place, - one level in, ten at a time too, since a deleted commit has no page. + around the commit is muted, and still opens its own page. Every reply's own replies open in place under + it, ten at a time too, as deep as they go, as on the web: they step in up to the web's depth and line up + under the deepest step past it, saying who they answer (see App\Devnull\ThreadRows). A thread its author wrote as replies to themselves carries on below the commit, on the same rail, as the web reads it (see SelfThread): each part wears its place ("2/5"), ten show at a time with "Show @@ -61,73 +62,23 @@ 'hairline' => ! ($loop->last && $relatedBelow && ! $threadMore), 'threadPosition' => $threadPositions[$row->commit->id] ?? null, 'showsThread' => false, + 'expandable' => false, ]) @if ($isFocused && $repliesShown && $replies === [] && ! $repliesLoaded && $error === null) @endif - @if ($hasThread) - @php($railLane = $loop->last ? null : $commit->lane()) - @foreach ($replies as $index => $threadReply) - @php($nested = $tombstoneReplies[$threadReply->id] ?? []) - @php($nestedMore = ($tombstoneCursors[$threadReply->id] ?? null) !== null) - @php($hasNext = ! $loop->last || $repliesCursor !== null) - @php($replyRow = [ - 'reply' => $threadReply, - 'lane' => $commit->lane(), - 'previousLane' => $index === 0 ? null : $replies[$index - 1]->lane(), - 'hasNext' => $hasNext, - 'railLane' => $railLane, - 'tombstones' => true, - 'muted' => true, - 'thread' => $commit, - 'more' => $loop->last && $nested === [] && $repliesCursor !== null ? 'loadMoreReplies' : null, - 'last' => $loop->last && $nested === [], - ]) + {{-- The replies, and theirs opened in place under them as deep as they go (see App\Devnull\ThreadRows). --}} + @php($pageThread = match (true) { $hasThread => \App\Devnull\ThreadRows::under($commit, [...$threads, $commit->id => $replies], array_filter([...$threadCursors, $commit->id => $repliesCursor]), $threadShown, $loop->last ? null : $commit->lane(), opensInPlace: PHP_INT_MAX, onPage: true, morePress: 'loadMoreReplies'), $partThread => \App\Devnull\ThreadRows::under($lastPart, [...$threads, $lastPart->id => $lastPartReplies], array_filter([...$threadCursors, $lastPart->id => $lastPartMore ? 'more' : null]), $threadShown, opensInPlace: PHP_INT_MAX, onPage: true, morePress: "openReplies('{$lastPart->id}')"), default => [] }) + @foreach ($pageThread as $threadRow) + @if ($threadRow['reply'] === null) + @include($threadRow['partial'], $threadRow['data']) + @else @php($rowScope = array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1])) - @php($replyRows->include('reply-'.$threadReply->id, \App\Devnull\RowInputs::for($threadReply, $rowScope), 'native.partials.thread-reply', $replyRow, $rowScope)) - @foreach ($nested as $nestedIndex => $nestedReply) - @php($nestedRow = [ - 'reply' => $nestedReply, - 'lane' => \App\Devnull\Lane::Rail, - 'previousLane' => $nestedIndex === 0 ? null : $nested[$nestedIndex - 1]->lane(), - 'hasNext' => ! $loop->last || $nestedMore, - 'railLane' => $railLane, - 'indent' => 32, - 'spine' => $hasNext ? $threadReply->lane() : null, - 'muted' => true, - 'thread' => $nestedMore ? $threadReply : $commit, - 'more' => match (true) { - ! $loop->last => null, - $nestedMore => "loadMoreTombstoneReplies('{$threadReply->id}')", - $loop->parent->last && $repliesCursor !== null => 'loadMoreReplies', - default => null, - }, - 'last' => $loop->last && $loop->parent->last, - ]) - @php($rowScope = array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1])) - @php($replyRows->include('reply-'.$nestedReply->id, \App\Devnull\RowInputs::for($nestedReply, $rowScope), 'native.partials.thread-reply', $nestedRow, $rowScope)) - @endforeach - @endforeach - @endif - @if ($partThread) - @foreach ($lastPartReplies as $index => $threadReply) - @php($replyRow = [ - 'reply' => $threadReply, - 'lane' => $lastPart->lane(), - 'previousLane' => $index === 0 ? null : $lastPartReplies[$index - 1]->lane(), - 'hasNext' => ! $loop->last || $lastPartMore, - 'railLane' => null, - 'muted' => true, - 'thread' => $lastPart, - 'more' => $loop->last && $lastPartMore ? "openReplies('{$lastPart->id}')" : null, - 'last' => $loop->last, - ]) - @php($rowScope = array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1])) - @php($replyRows->include('reply-'.$threadReply->id, \App\Devnull\RowInputs::for($threadReply, $rowScope), 'native.partials.thread-reply', $replyRow, $rowScope)) - @endforeach - @endif + @php($replyRows->include('reply-'.$threadRow['reply']->id, \App\Devnull\RowInputs::for($threadRow['reply'], $rowScope), $threadRow['partial'], $threadRow['data'], $rowScope)) + @endif + @endforeach @endforeach @if ($threadMore && $threadParts !== []) diff --git a/resources/views/native/partials/related-commits.blade.php b/resources/views/native/partials/related-commits.blade.php index 452eaedf..af215186 100644 --- a/resources/views/native/partials/related-commits.blade.php +++ b/resources/views/native/partials/related-commits.blade.php @@ -28,6 +28,7 @@ 'seriesExpanded' => false, 'threadBelow' => false, 'withTail' => ! $loop->last, + 'expandable' => false, ]) @endforeach diff --git a/resources/views/native/partials/thread-links.blade.php b/resources/views/native/partials/thread-links.blade.php index 8f2c9084..9f547262 100644 --- a/resources/views/native/partials/thread-links.blade.php +++ b/resources/views/native/partials/thread-links.blade.php @@ -1,23 +1,28 @@ {{-- - The lines beside a reply in a feed's thread (see thread-reply), drawn last in its row so they sit on top: the - commit's rail running on past, the elbow or the link from the reply above, and the line on down to the next one. + The lines beside a reply in a thread (see thread-reply and App\Devnull\ThreadRows), drawn last in its row so they + sit on top: the commit's rail running on past, the lines from further up running on past ($spines, each from its + `top` or the row's top), the elbow or the link from the reply above, and the line on down to the next one. A + flattened reply, past the web's depth, has no links of its own ($links). --}} +@php($spines ??= []) +@php($links ??= true) @if ($railLane !== null) @include('native.partials.rail', ['previous' => $railLane]) @endif -@if ($spine !== null) - @include('native.partials.dashed-line', ['position' => 'top-0 bottom-0', 'left' => 75.5, 'lane' => $spine]) -@endif +@foreach ($spines as $spineLine) + @include('native.partials.dashed-line', ['position' => (isset($spineLine['top']) ? 'top-['.$spineLine['top'].']' : 'top-0').' bottom-0', 'left' => $spineLine['left'], 'lane' => $spineLine['lane']]) +@endforeach -@if ($previousLane === null) - @include('native.partials.thread-elbow', ['lane' => $lane, 'from' => $indent > 0 ? 75.5 : 31.5, 'to' => 64 + $indent, 'level' => $top + 12]) -@else - @include('native.partials.dashed-line', ['position' => 'top-0 h-['.($top - 4).']', 'left' => $avatarLine - 0.5, 'lane' => $previousLane]) -@endif +@if ($links) + @if ($previousLane === null) + @include('native.partials.thread-elbow', ['lane' => $lane, 'from' => $indent > 0 ? 43.5 + $indent : 31.5, 'to' => 64 + $indent, 'level' => $top + 12]) + @else + @include('native.partials.dashed-line', ['position' => 'top-0 h-['.($top - 4).']', 'left' => $avatarLine - 0.5, 'lane' => $previousLane]) + @endif -@if ($hasNext) - {{-- From 4pt under the avatar down to the next reply, or to the top of Show more's dot: 12pt under it, its padding - and the hairline below. --}} - @include('native.partials.dashed-line', ['position' => 'top-['.($top + 28).'] '.($more !== null ? 'bottom-[34]' : 'bottom-0'), 'left' => $avatarLine - 0.5, 'lane' => $reply->lane()]) + @if ($hasNext) + {{-- From 4pt under the avatar down to the next row, which carries it on. --}} + @include('native.partials.dashed-line', ['position' => 'top-['.($top + 28).'] bottom-0', 'left' => $avatarLine - 0.5, 'lane' => $reply->lane()]) + @endif @endif diff --git a/resources/views/native/partials/thread-more-row.blade.php b/resources/views/native/partials/thread-more-row.blade.php index d35dc8f2..4b77ced3 100644 --- a/resources/views/native/partials/thread-more-row.blade.php +++ b/resources/views/native/partials/thread-more-row.blade.php @@ -1,18 +1,28 @@ {{-- - "Show more" at the foot of a thread opened in a feed (see App\Devnull\ThreadRows), as a list row of its own: a muted - rail dot where the next avatar would be, on the dashed line down from the reply above ($lane), and the words. - Tapped, the thread's next page opens under what's showing. $indent puts it one step in, under a reply's own replies. + "Show more" at the foot of a thread opened in place (see App\Devnull\ThreadRows), as a row of its own: a muted rail + dot where the next avatar would be, on the dashed line down from the reply above ($lane), and the words. Tapped, + the thread's next page opens under what's showing, or whatever $press says. $indent puts it as far in as the + replies above it, and $spines carry the lines from further up on past it. + + At the web's deepest step the dot hangs on an elbow from the line of the reply the thread answers ($hangs, in + $parentLane), as those replies do. Past it there are no lines ($links), and it says whose replies these are ($to). It's 44pt tall, as tall as the list's shortest row, so the list never pads it out under its hairline. The dot sits - in its middle, so the line from above stops at the top of the dot, 13pt down. + in its middle, so the line from above stops at the top of the dot, 13pt down. In a feed the $last closes the + commit's row with its hairline; on a commit page ($hairline false) nothing does. --}} @php($indent ??= 0) -@php($spine ??= null) +@php($spines ??= []) @php($railLane ??= null) +@php($hangs ??= false) +@php($links ??= true) +@php($to ??= null) +@php($hairline ??= true) +@php($press ??= "showMoreReplies('{$threadId}')") @php($faded = in_array('more-'.$threadId, $fadedRows ?? [], true)) - + - + @@ -20,14 +30,22 @@ - Show more + @if ($to === null) + Show more + @else + Show more to {{ $to }} + @endif @if ($railLane !== null) @include('native.partials.rail', ['previous' => $railLane]) @endif - @if ($spine !== null) - @include('native.partials.dashed-line', ['position' => 'top-0 bottom-0', 'left' => 75.5, 'lane' => $spine]) + @foreach ($spines as $spineLine) + @include('native.partials.dashed-line', ['position' => (isset($spineLine['top']) ? 'top-['.$spineLine['top'].']' : 'top-0').' bottom-0', 'left' => $spineLine['left'], 'lane' => $spineLine['lane']]) + @endforeach + @if ($links && $hangs) + @include('native.partials.thread-elbow', ['lane' => $parentLane, 'from' => 43.5 + $indent, 'to' => 64 + $indent, 'level' => 22]) + @elseif ($links) + @include('native.partials.dashed-line', ['position' => 'top-0 h-[13]', 'left' => 75.5 + $indent, 'lane' => $lane]) @endif - @include('native.partials.dashed-line', ['position' => 'top-0 h-[13]', 'left' => 75.5 + $indent, 'lane' => $lane]) diff --git a/resources/views/native/partials/thread-more.blade.php b/resources/views/native/partials/thread-more.blade.php deleted file mode 100644 index 6ed4afba..00000000 --- a/resources/views/native/partials/thread-more.blade.php +++ /dev/null @@ -1,17 +0,0 @@ -{{-- - "Show more" at the foot of a thread, as the web's: a muted rail dot where the next avatar would be, and the words. - It sits inside the last reply's row, under the reply, so the rail beside it never breaks: a row of its own is - shorter than the list's shortest, and the list pads it out under its hairline. ---}} - - - - - - - - - - Show more - - diff --git a/resources/views/native/partials/thread-reply.blade.php b/resources/views/native/partials/thread-reply.blade.php index ff5bea8c..aba96aec 100644 --- a/resources/views/native/partials/thread-reply.blade.php +++ b/resources/views/native/partials/thread-reply.blade.php @@ -1,18 +1,18 @@ {{-- - A reply in the thread under a commit in a feed, like a reply in the web's thread: a 24pt avatar lined up with the - commit's text, the name and time, the body and its actions. The thread hangs off the rail in dashes of each - author's lane, as upstream's #121 draws it: the first reply on an elbow from the rail ($lane is the commit's), each - later one on a short link from the reply above ($previousLane), and a line on down from its avatar when another - reply, or "Show more", follows ($hasNext). $railLane runs the commit's own rail on past, solid, when its author's - run goes on below the thread. A deleted reply keeps its place with a dashed ring. In a feed the $last closes the - commit's row with its hairline. On a commit page nothing follows the thread, so there's no hairline. + A reply in a thread opened in place (see App\Devnull\ThreadRows), like a reply in the web's thread: a 24pt avatar + lined up with the commit's text, or $indent further in, the name and time, the body and its actions. The thread + hangs off the rail in dashes of each author's lane, as upstream's #121 draws it: the first reply on an elbow from + the line of what it answers ($lane is that one's), each later one on a short link from the reply above + ($previousLane), and a line on down from its avatar when another reply, its own replies, or "Show more", follows + ($hasNext). $spines carry lines from further up on past it, and $railLane runs the commit's own rail on past, + solid, when its author's run goes on below the thread (see thread-links). A deleted reply keeps its place with a + dashed ring. In a feed the $last closes the commit's row with its hairline. On a commit page nothing follows the + thread, so there's no hairline. - On a commit page a deleted reply's own replies open in place ($tombstones), since it has no page of their own, - one level in ($indent 32), hanging off a dashed spine from its ring as the web nests them. $spine carries the - thread's line on past a nested reply when the deleted one has another reply after it. + Past the web's depth a reply is flattened: it lines up under the reply it answers, with no lines of its own + ($links), and says who it answers on a line under its name ($replyingTo), as the web does. - The last reply carries the thread's "Show more" when there's more ($more, what it presses), with the line from its - avatar running down to it. + On a commit page a deleted reply's own replies open in place too ($tombstones), with "N replies" under its ring. $top is the space above the avatar, 10pt, less for the first reply in a feed, which sits under the commit row's bottom padding (see ThreadRows::FirstReplyTop). The lines beside it are placed from the avatar, so they move with it. @@ -24,29 +24,31 @@ A reply you just sent that devnull doesn't have yet is staged: dimmed, with the staged chip and no actions. - In a feed a reply's replies button opens them under it ($repliesInPlace, see App\Devnull\ThreadRows); deeper in, - or on a commit page, it opens the reply's page. A feed's thread rows fade in as they open and out as they close - ($fades): drawn see-through and nudged up while they're in $fadedRows (see Concerns\ExpandsThreads), and eased - to where they belong. Only what's beside the rail fades, so the commit's rail running past never blinks. + A reply's replies button opens them under it ($repliesInPlace): on a commit page at every depth, in a feed only for + the commit's own replies, and a reply's replies there open its page. Tapping the reply itself opens its page. The + rows fade in as they open and out as they close ($fades): drawn see-through and nudged up while they're in + $fadedRows (see Concerns\ExpandsThreads), and eased to where they belong. Only what's beside the rail fades, so + the commit's rail running past never blinks. --}} @php($previousLane ??= null) @php($muted ??= false) @php($railLane ??= null) @php($indent ??= 0) -@php($spine ??= null) +@php($spines ??= []) +@php($links ??= true) +@php($replyingTo ??= null) @php($tombstones ??= false) -@php($more ??= null) @php($avatarLine = 76 + $indent) @php($repliesInPlace ??= false) @php($fades ??= false) @php($top ??= 10) @php($faded = $fades && in_array($reply->id, $fadedRows ?? [], true)) @if ($reply->isDeleted()) - @php($opened = $tombstones && array_key_exists($reply->id, $tombstoneReplies ?? [])) + @php($opened = $tombstones && array_key_exists($reply->id, $threads ?? []) && ! in_array($reply->id, $closingThreads ?? [], true)) - + @include('native.partials.dashed-ring', ['size' => 24, 'lane' => \App\Devnull\Lane::Rail]) @@ -55,7 +57,7 @@ [deleted] This commit was deleted. @if ($tombstones && $reply->repliesCount > 0) - + {{ $opened ? 'Hide replies' : \App\Devnull\Display::count($reply->repliesCount, 'reply', 'replies') }} @@ -64,18 +66,11 @@ @endif - @if ($more !== null) - @include('native.partials.thread-more', ['commit' => $thread ?? $reply]) - @endif @if ($last && ! $muted) @endif @include('native.partials.thread-links') - @if ($opened && ($tombstoneReplies[$reply->id] ?? []) !== []) - {{-- The spine its own replies hang off, down from its ring. --}} - @include('native.partials.dashed-line', ['position' => 'top-['.($top + 28).'] bottom-0', 'left' => $avatarLine - 0.5, 'lane' => \App\Devnull\Lane::Rail]) - @endif @else @php($commit = $reply) @@ -83,7 +78,7 @@ - + @include('native.partials.rail-avatar', ['user' => $reply->author, 'lane' => $reply->lane(), 'size' => 24, 'staged' => false]) @@ -96,6 +91,12 @@ @include('native.partials.status-chip', ['status' => $reply->status]) @endunless + @if ($replyingTo !== null) + + + {{ $replyingTo }} + + @endif @include('native.partials.commit-body', ['size' => $muted ? 'text-sm' : 'text-[15px]']) @include('native.partials.commit-media', ['withEmbeds' => false]) @if ($reply->continuationId !== null || in_array($reply->id, $threadsContinued ?? [], true)) @@ -106,9 +107,6 @@ @endunless - @if ($more !== null) - @include('native.partials.thread-more', ['commit' => $thread ?? $reply]) - @endif @if ($last && ! $muted) @endif diff --git a/tests/Feature/Screens/CommitDetailCacheTest.php b/tests/Feature/Screens/CommitDetailCacheTest.php index 145eaedf..1694cf61 100644 --- a/tests/Feature/Screens/CommitDetailCacheTest.php +++ b/tests/Feature/Screens/CommitDetailCacheTest.php @@ -140,7 +140,7 @@ function serveThread(): void 'GET /api/v1/commits/d1/replies' => [pageJson([replyJson(['id' => 'r9', 'parent_id' => 'd1', 'body' => 'Under a deleted reply'])])], ]); - $screen = Native::visit('/log/commits/c1')->tap('replies-c1')->call('toggleTombstone', 'd1')->assertSee('Under a deleted reply'); + $screen = Native::visit('/log/commits/c1')->tap('replies-c1')->call('toggleReplies', 'd1')->assertSee('Under a deleted reply'); $screen->call('load'); diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 4da73df3..c25d0645 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -526,29 +526,28 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): $screen->tap('replies-c2')->assertDontSee('First reply')->assertSee('1 reply'); expect($chevron('replies-c2')['props'])->toMatchArray(['name' => 'custom:chevron-right', 'rotate' => 0.0, 'animate-duration' => 220.0]); - // A reply's button opens its page rather than its replies in place, so its chevron stays put. + // A reply's button opens its replies in place too, so its chevron turns the same way. $screen->tap('replies-c2'); - expect($chevron('replies-r1')['props'])->not->toHaveKey('rotate'); + expect($chevron('replies-r1')['props'])->toMatchArray(['rotate' => 0.0, 'animate-duration' => 220.0]); })->with(['ios', 'android']); it('opens with its replies showing from a replies button', function () { fakeThread(['replies_count' => 1], replies: [replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'First reply', 'replies_count' => 1])], extra: [ 'GET /api/v1/commits/r1' => [commitPageJson(replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'First reply', 'replies_count' => 1]))], - 'GET /api/v1/commits/r1/replies' => [pageJson([replyJson(['id' => 'r2', 'parent_id' => 'r1', 'body' => 'Answering the reply'])])], + // Someone other than r1's author, whose reply to themselves would carry r1 on as a thread instead. + 'GET /api/v1/commits/r1/replies' => [pageJson([replyJson(['id' => 'r2', 'parent_id' => 'r1', 'body' => 'Answering the reply', 'author' => userJson(['id' => 'u3', 'handle' => 'grace', 'name' => 'Grace'])])])], ]); Native::visit('/log/commits/c2', ['replies' => true]) ->assertSee('First reply') ->assertSee('Hide replies'); - // A reply's replies don't open in place on a commit page, so its button opens its page with them showing. + // A reply's replies open in place under it, as on the web, rather than on its page. Native::visit('/log/commits/c2') ->tap('replies-c2') ->tap('replies-r1') - ->assertNavigatedTo('/log/commits/r1') - ->follow() - ->assertSee('Answering the reply') - ->assertSee('Hide replies'); + ->assertNoNavigation() + ->assertSee('Answering the reply'); }); it('asks for the replies a page at a time, and the next page from Show more', function () { diff --git a/tests/Feature/Screens/NestedRepliesTest.php b/tests/Feature/Screens/NestedRepliesTest.php new file mode 100644 index 00000000..9d208b7a --- /dev/null +++ b/tests/Feature/Screens/NestedRepliesTest.php @@ -0,0 +1,77 @@ + 'http://devnull.test']); + signIn(); +}); + +/** + * A commit page for c2 whose replies chain five deep: r1 answers c2, r2 answers r1, and so on, each from someone + * other than the one they answer, so none of them carries a thread on. + */ +function fakeDeepThread(): void +{ + $handles = ['grace', 'linus', 'alan', 'edsger', 'ken']; + $reply = fn (int $depth): array => replyJson([ + 'id' => "r{$depth}", + 'parent_id' => $depth === 1 ? 'c2' : 'r'.($depth - 1), + 'body' => "Reply at depth {$depth}", + 'replies_count' => $depth < 5 ? 1 : 0, + 'author' => userJson(['handle' => $handles[$depth - 1], 'name' => ucfirst($handles[$depth - 1]), 'lane' => $depth]), + ]); + + Http::fake(function (Request $request) use ($reply) { + $path = parse_url($request->url(), PHP_URL_PATH); + + return match (true) { + $path === '/api/v1/commits/c2' => Http::response(commitPageJson(commitJson(['id' => 'c2', 'body' => 'The focused commit', 'replies_count' => 1]))), + $path === '/api/v1/commits/c2/related' => Http::response(['data' => []]), + $path === '/api/v1/commits/c2/replies' => Http::response(pageJson([$reply(1)])), + (bool) preg_match('#^/api/v1/commits/r(\d)/replies$#', $path, $match) => Http::response(pageJson((int) $match[1] < 5 ? [$reply((int) $match[1] + 1)] : [])), + default => Http::response(['message' => 'No fake.'], 404), + }; + }); +} + +it('opens replies of replies in place on a commit page, as deep as they go, without leaving the page', function () { + fakeDeepThread(); + + $screen = Native::visit('/log/commits/c2', ['replies' => true])->assertSee('Reply at depth 1'); + + foreach (range(1, 4) as $depth) { + $screen->tap("replies-r{$depth}")->assertSee('Reply at depth '.($depth + 1)); + } + + $screen->assertNoNavigation()->assertSee('Reply at depth 5'); + + // Hiding a reply's replies takes the ones opened under them away too. + $screen->tap('replies-r2')->assertDontSee('Reply at depth 3'); + finishRefreshes($screen)->assertDontSee('Reply at depth 5'); + + // Tapping a reply itself still opens its page. + $screen->tap('thread-reply-r2')->assertNavigatedTo('/log/commits/r2'); +}); + +it('steps replies in up to the third level, and lines deeper ones up under it saying who they answer', function () { + fakeDeepThread(); + + $screen = Native::visit('/log/commits/c2', ['replies' => true]); + + foreach (range(1, 4) as $depth) { + $screen->tap("replies-r{$depth}"); + } + + // The left padding of the row the reply's avatar sits in, past the commit's 64pt gutter. + $indent = fn (string $id): float => (float) (findNode(nodeByRef($screen, "thread-reply-{$id}"), fn (array $node): bool => ($node['type'] ?? null) === 'row' && isset($node['layout']['padding']))['layout']['padding'][3] ?? 0); + $elbow = fn (string $id): bool => findNode(nodeByRef($screen, "thread-reply-{$id}"), fn (array $node): bool => ($node['ref'] ?? null) === 'thread-elbow') !== null; + + expect([$indent('r1'), $indent('r2'), $indent('r3'), $indent('r4'), $indent('r5')])->toEqual([0, 32, 64, 64, 64]) + ->and([$elbow('r1'), $elbow('r2'), $elbow('r3'), $elbow('r4'), $elbow('r5')])->toBe([true, true, true, false, false]) + ->and(rendersRef($screen, 'replying-to-r3'))->toBeFalse(); + + $screen->assertSee('replying to @alan')->assertSee('replying to @edsger'); +}); diff --git a/tests/Feature/Screens/RowCacheScreensTest.php b/tests/Feature/Screens/RowCacheScreensTest.php index 902cbd0d..d7c547cd 100644 --- a/tests/Feature/Screens/RowCacheScreensTest.php +++ b/tests/Feature/Screens/RowCacheScreensTest.php @@ -88,10 +88,10 @@ function expectKeptRowsMatchFreshOnes(TestableComponent $screen, string $class, }); $screen = Native::visit('/log/commits/c2')->tap('replies-c2')->assertSee('Second reply'); - // The commits above the replies read what the screen shows of the thread, so they're built every time. The last - // reply of a page changes when the next page comes, since it no longer carries "more". + // The commits above the replies read what the screen shows of the thread, so they're built every time. "Show + // more" is a row of its own, so the last reply of a page stays as it was when the next page comes. expect(rowsBuiltBy(fn () => $screen->call('navTitle')))->toBe(['c2']) - ->and(rowsBuiltBy(fn () => $screen->call('loadMoreReplies')->assertSee('Third reply')))->toBe(['c2', 'r2', 'r3']); + ->and(rowsBuiltBy(fn () => $screen->call('loadMoreReplies')->assertSee('Third reply')))->toBe(['c2', 'r3']); expectKeptRowsMatchFreshOnes($screen, CommitDetail::class, 'replyRows', null); }); diff --git a/tests/Unit/Devnull/ThreadRowsTest.php b/tests/Unit/Devnull/ThreadRowsTest.php new file mode 100644 index 00000000..dfad7144 --- /dev/null +++ b/tests/Unit/Devnull/ThreadRowsTest.php @@ -0,0 +1,86 @@ + $id, 'parent_id' => $parent, 'author' => userJson(['handle' => $handle, 'lane' => strlen($handle)]), ...$overrides])); +} + +/** + * The rows of a chain five replies deep under c1, with a second reply at the deepest step (r3b), each opened. + * + * @return array> + */ +function deepRows(int $opensInPlace = PHP_INT_MAX): array +{ + $commit = Commit::fromArray(commitJson(['id' => 'c1', 'author' => userJson(['handle' => 'ada'])])); + $threads = [ + 'c1' => [nestedReply('r1', 'c1', 'grace')], + 'r1' => [nestedReply('r2', 'r1', 'linus')], + 'r2' => [nestedReply('r3', 'r2', 'alan'), nestedReply('r3b', 'r2', 'barbara')], + 'r3' => [nestedReply('r4', 'r3', 'edsger', ['quoted_commit_id' => 'r3'])], + 'r4' => [nestedReply('r5', 'r4', 'ken')], + ]; + + $rows = ThreadRows::under($commit, $threads, ['r4' => 'next'], [], opensInPlace: $opensInPlace, onPage: true); + + return array_column(array_map(fn (array $row): array => [$row['key'], $row['data']], $rows), 1, 0); +} + +it('steps replies in up to the web\'s depth of three, and lines deeper ones up under the third', function () { + $rows = deepRows(); + + expect(array_keys($rows))->toBe(['thread-reply-r1', 'thread-reply-r2', 'thread-reply-r3', 'thread-reply-r4', 'thread-reply-r5', 'thread-more-r4', 'thread-reply-r3b']) + ->and(array_map(fn (array $row): int => $row['indent'], $rows))->toBe([ + 'thread-reply-r1' => 0, + 'thread-reply-r2' => 32, + 'thread-reply-r3' => 64, + 'thread-reply-r4' => 64, + 'thread-reply-r5' => 64, + 'thread-more-r4' => 64, + 'thread-reply-r3b' => 64, + ]); +}); + +it('says who a flattened reply answers, and draws it no lines of its own', function () { + $rows = deepRows(); + + expect($rows['thread-reply-r3']['replyingTo'])->toBeNull() + ->and($rows['thread-reply-r3']['links'])->toBeTrue() + ->and($rows['thread-reply-r4']['replyingTo'])->toBe('quoting @alan') + ->and($rows['thread-reply-r5']['replyingTo'])->toBe('replying to @edsger') + ->and($rows['thread-reply-r4']['links'])->toBeFalse() + ->and($rows['thread-reply-r4']['hasNext'])->toBeFalse() + ->and($rows['thread-more-r4']['links'])->toBeFalse() + ->and($rows['thread-more-r4']['to'])->toBe('@edsger'); +}); + +it('hangs each reply at the deepest step on its own elbow, with the line of the reply it answers running on past', function () { + $rows = deepRows(); + $lane = $rows['thread-reply-r3b']['lane']; + + // r3 and r3b both answer r2, so both hang on elbows off r2's line, which runs past r3's own replies to r3b. + expect($rows['thread-reply-r3']['previousLane'])->toBeNull() + ->and($rows['thread-reply-r3b']['previousLane'])->toBeNull() + ->and($rows['thread-reply-r3']['hasNext'])->toBeFalse() + ->and($rows['thread-reply-r3']['spines'])->toBe([['left' => 107.5, 'lane' => $lane, 'top' => 22]]) + ->and($rows['thread-reply-r4']['spines'])->toBe([['left' => 107.5, 'lane' => $lane]]) + ->and($rows['thread-more-r4']['spines'])->toBe([['left' => 107.5, 'lane' => $lane]]) + ->and($rows['thread-reply-r3b']['spines'])->toBe([]) + // Above that the replies chain from avatar to avatar as before. + ->and($rows['thread-reply-r2']['hasNext'])->toBeTrue() + ->and($rows['thread-reply-r3b']['last'])->toBeTrue(); +}); + +it('opens replies in place as deep as the caller allows', function () { + $inPlace = fn (array $rows): array => array_map(fn (array $row): bool => $row['repliesInPlace'], array_filter($rows, fn (array $row): bool => isset($row['repliesInPlace']))); + + expect($inPlace(deepRows()))->each->toBeTrue() + ->and($inPlace(deepRows(opensInPlace: 1))) + ->toBe(['thread-reply-r1' => true, 'thread-reply-r2' => false, 'thread-reply-r3' => false, 'thread-reply-r4' => false, 'thread-reply-r5' => false, 'thread-reply-r3b' => false]); +}); From a0032d3abd580323af32e536bd4ff1eb9f5a842d Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 02:21:57 +0000 Subject: [PATCH 20/46] Move the commit page to a commit in its tree instead of pushing another Tapping an ancestor, a part of the series or the author's thread, or a reply at any depth used to push a new commit screen. Now the same page moves to it: the commit becomes the one the page is about, with what's above it as its ancestors and its replies showing below, built from what the page already has so nothing goes blank. The commit it was on keeps its replies opened, so going back up shows where you came from. Reply on a commit in the tree retargets the reply bar the same way. Commits outside the tree still push. Back still leaves the screen, as Simon asked. There's no history of the commits the page moved through. The scroll view's rows are its own children now, so auto-scroll-to can bring the commit into view. Both platforms jump on the first request and animate later ones. Deleting a commit the page moved to takes the page back to its parent. Co-Authored-By: Claude Opus 5.5 --- app/NativeComponents/CommitDetail.php | 259 +++++++++++++++++- .../views/native/commit-detail.blade.php | 12 +- tests/Feature/Screens/CommitDetailTest.php | 37 +-- tests/Feature/Screens/NestedRepliesTest.php | 58 +++- tests/Feature/Screens/RelatedCommitsTest.php | 6 +- tests/Feature/Screens/SelfThreadTest.php | 2 +- tests/Feature/Screens/SeriesTest.php | 3 +- 7 files changed, 347 insertions(+), 30 deletions(-) diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index d7dd120f..2eb2380f 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -51,7 +51,11 @@ * * Each reply's own replies open in place under it, and theirs under them, as * deep as they go, as the web's commit page does (see ExpandsThreads and - * App\Devnull\ThreadRows). Tapping a reply still opens its page. + * App\Devnull\ThreadRows). + * + * Tapping a commit in the tree, above the commit, below it or among the + * replies at any depth, moves this page to it rather than pushing another + * (see refocus()). Back still leaves the page. * * It opens on the commit as it was last time, or opened from a row, on what * the row knew of it, then asks devnull for the rest behind it and fills it in. @@ -101,6 +105,9 @@ class CommitDetail extends NativeComponent use RedrawsOnAppearanceChange; use RefreshesInBackground; use ShowsCommits { + openCommit as private openCommitPage; + openReplies as private openRepliesPage; + replyTo as private replyOnPage; reopenFailedCommit as private reopenFailedCommitInSheet; editFailedCommit as private editFailedCommitInSheet; mentionFields as private sheetMentionFields; @@ -239,6 +246,17 @@ class CommitDetail extends NativeComponent */ public int $scrollKey = 0; + /** + * Which of the scroll view's rows it brings into view, the commit's, once tapping another commit in the tree + * moved the page to it (see refocus()). Null until then, so the page opens at the top as it always has. + */ + public ?int $scrollTarget = null; + + /** + * The commit the page opened on, before tapping others in its tree moved it (see refocus()). + */ + public string $openedId = ''; + /** * The replies from the last frame, so a render only builds the replies that changed, as the Log does its rows. */ @@ -255,6 +273,7 @@ class CommitDetail extends NativeComponent public function mount(): void { + $this->openedId = $this->id; $this->focusReply = $this->data('reply', false) === true; $this->repliesShown = $this->data('replies', false) === true; $draft = app(Stash::class)->get($this->me()?->id, $this->replyStashName()); @@ -343,9 +362,237 @@ public function showEarlier(): void public function replyTapped(): void { $this->earlierShown = false; + $this->scrollTarget = null; $this->scrollKey++; } + /** + * A commit in the tree this page shows moves the page to it, rather than + * pushing another commit page (see refocus()). Anything else opens its page. + */ + public function openCommit(string $id): void + { + if (! $this->refocus($id)) { + $this->openCommitPage($id); + } + } + + /** + * "Show more" under the last part of a thread, or "› N replies" on a commit in the tree: the page moves to it with + * its replies showing. + */ + public function openReplies(string $id): void + { + if (! $this->refocus($id)) { + $this->openRepliesPage($id); + } + } + + /** + * Reply on a commit in the tree moves the page to it, with the reply bar answering it and its keyboard up. + */ + public function replyTo(string $id): void + { + if ($id === $this->id) { + $this->focusReply = true; + + return; + } + + if ($this->refocus($id)) { + $this->focusReply = true; + + return; + } + + $this->replyOnPage($id); + } + + /** + * Moves the page to a commit already in its tree: an ancestor, a part of + * the author's thread or series, or a reply at any depth. It becomes the + * commit the page is about, with what's above it as its ancestors and its + * replies showing below, all from what the page already has, so nothing + * goes blank, and devnull is asked for the rest behind it. Replies opened + * in place stay open, and the commit the page was on keeps its replies, so + * moving up shows where you came from opened under its parent. + * + * The page stays one screen: Back still leaves it, as Simon asked, rather + * than stepping back through the commits it moved to. The scroll view + * brings the commit into view, with every ancestor showing above it. + * + * False, changing nothing, for a commit that isn't in the tree, or one + * that's staged or deleted, which has no page of its own. + */ + private function refocus(string $id): bool + { + if ($this->commit === null || $id === $this->id) { + return false; + } + + $target = $this->treeCommit($id); + $ancestors = $target === null || $target->isStaged() || $target->isDeleted() ? null : $this->ancestorsInTree($target); + + if ($ancestors === null) { + return false; + } + + $line = [...$this->ancestors, $this->commit]; + $below = array_slice($line, count($ancestors) + 1); + + // What the page was on keeps its replies, opened in place, for when it's back in the tree. + if ($this->repliesShown && $this->repliesLoaded && $this->replies !== []) { + $this->threads[$this->id] = array_values(array_filter($this->replies, fn (Commit $reply): bool => ! $reply->isStaged())); + $this->keepCursor($this->id, $this->repliesCursor); + unset($this->threadShown[$this->id]); + } + + // Moving up, the commits between keep their replies open, so the one the page was on shows under them. + foreach ($below as $between) { + if ($between->id !== $this->id && ! array_key_exists($between->id, $this->threads) && ($kept = $this->cached('commits/'.rawurlencode($between->id).'/replies')) !== null) { + $this->takeThread($between->id, $kept); + } + } + + $this->id = $id; + $this->commit = $target; + $this->ancestors = $ancestors; + $this->series = []; + $this->related = []; + $this->relatedShown = false; + $this->threadLimit = SelfThread::PerPage; + $this->takeOwnReplies($id); + + if (($thread = $this->cached($this->threadPath())) !== null) { + $this->takeCommitThread($thread); + } + + $this->takeRelated($this->cached($this->threadPath().'/related') ?? []); + $this->repliesShown = true; + $this->earlierShown = true; + $this->takeReplyDraft(); + $this->error = null; + + // The commit's row is the one after its ancestors. A request the scroll view already went to does nothing, + // so going back to the top a second time mounts it again, at the top. + $target = count($this->ancestors); + + if ($target === $this->scrollTarget) { + $this->scrollKey++; + } + + $this->scrollTarget = $target; + $this->forgetRefreshes(); + $this->revalidate(); + $this->followThread(); + + return true; + } + + /** + * The commit's own replies, as the page knows them: opened in place, read for its author's thread, or kept from + * before. Until one of those, they show as loading. + */ + private function takeOwnReplies(string $id): void + { + $this->replies = []; + $this->repliesCursor = null; + $this->repliesLoaded = false; + + if (array_key_exists($id, $this->threads)) { + $this->replies = $this->threads[$id]; + $this->repliesCursor = $this->threadCursors[$id] ?? null; + $this->repliesLoaded = true; + unset($this->threads[$id], $this->threadCursors[$id], $this->threadShown[$id]); + $this->pagedThreads = array_values(array_diff($this->pagedThreads, [$id])); + } elseif (($kept = $this->cached($this->threadPath().'/replies')) !== null) { + $this->takeReplies($kept); + + return; + } elseif (array_key_exists($id, $this->partReplies)) { + $this->replies = $this->partReplies[$id]; + $this->repliesLoaded = true; + } + + $this->keepStagedReplies(); + } + + /** + * The reply bar takes up the draft kept for the commit the page is on now. + */ + private function takeReplyDraft(): void + { + $draft = app(Stash::class)->get($this->me()?->id, $this->replyStashName()); + $this->reply = $draft->body; + $this->replyImages = $draft->images; + $this->replyRestored = ! $draft->isEmpty(); + $this->replyAuthor = null; + $this->replyPreviewing = false; + $this->replyPreview = null; + $this->focusReply = false; + } + + /** + * A commit the page draws in its tree, by id: around the commit, in its author's thread, or among the replies. + */ + private function treeCommit(string $id): ?Commit + { + $lastPart = $this->commit === null ? null : $this->selfThread()->parts; + $tree = [ + ...$this->ancestors, + ...$this->series, + ...($lastPart ?? []), + ...$this->replies, + ...$this->threadCommits(), + ...array_merge([], ...array_values($this->partReplies)), + ]; + + foreach ($tree as $commit) { + if ($commit->id === $id) { + return $commit; + } + } + + return null; + } + + /** + * What's above $target in the tree, in order: the page's line of ancestors as far as the one it hangs from, then + * the replies, parts or series between. Null when it doesn't hang from that line. + * + * @return list|null + */ + private function ancestorsInTree(Commit $target): ?array + { + $line = [...$this->ancestors, ...($this->commit === null ? [] : [$this->commit])]; + $lineIds = array_map(fn (Commit $commit): string => $commit->id, $line); + $at = array_search($target->id, $lineIds, true); + + if ($at !== false) { + return array_slice($line, 0, $at); + } + + $between = []; + $parentId = $target->parentId; + + while ($parentId !== null && ! in_array($parentId, $lineIds, true)) { + $parent = $this->treeCommit($parentId); + + if ($parent === null || in_array($parent, $between, true)) { + return null; + } + + array_unshift($between, $parent); + $parentId = $parent->parentId; + } + + if ($parentId === null) { + return null; + } + + return [...array_slice($line, 0, array_search($parentId, $lineIds, true) + 1), ...$between]; + } + /** * "› N replies" under the commit opens them in place, and "Hide replies" folds them away. Under a reply, at any * depth, it opens that reply's replies in place under it (see ExpandsThreads). @@ -694,6 +941,16 @@ protected function commitSheetGone(string $view): void */ protected function showDeleted(string $id): void { + // The page moved here from a commit above it, so it goes back there rather than leaving. + $parent = $this->ancestors === [] ? null : end($this->ancestors); + + if ($id === $this->id && $id !== $this->openedId && $parent !== null && $this->refocus($parent->id)) { + $this->threads = array_map(fn (array $replies): array => array_values(array_filter($replies, fn (Commit $reply): bool => $reply->id !== $id)), $this->threads); + $this->replies = array_values(array_filter($this->replies, fn (Commit $reply): bool => $reply->id !== $id)); + + return; + } + if ($id === $this->id) { $this->back(); diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index df6150b2..fd7b2a75 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -7,8 +7,12 @@ {{-- The stack around the page holds the fade over its foot, just above the reply bar (see partials/composer-fade). --}} - - + {{-- + Each row is a child of the scroll view itself, so it can bring one into view: the commit the page is on, after + tapping another commit in the tree moves the page to it (see CommitDetail::refocus() and $scrollTarget). The + first move jumps and later ones animate, as auto-scroll-to does on both platforms. + --}} + @if (! $commit && $error === null) @@ -23,7 +27,8 @@ their avatar once. The replies hang under it on the thread's dashed lines, with the rail ending in a dot above them, ten at a time with "Show more" under the last. A part of a series with more parts after it has its replies right under it, beside the rail running on, and the later parts follow. Everything - around the commit is muted, and still opens its own page. Every reply's own replies open in place under + around the commit is muted. Tapping any commit in the tree moves the page to it rather than pushing + another (see CommitDetail::refocus()). Every reply's own replies open in place under it, ten at a time too, as deep as they go, as on the web: they step in up to the web's depth and line up under the deepest step past it, saying who they answer (see App\Devnull\ThreadRows). @@ -103,7 +108,6 @@ @if ($commit) @endif - @if ($commit && ! \App\Devnull\Display::fadesInBar()) diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index c25d0645..cf451876 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -51,19 +51,19 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): ->assertSee('Reply to @local_dev'); // The commit comes after the one it replies to, and the row standing in for what that replies to. - expect(childRefs($screen, 'thread-page'))->toBe(['earlier-commits', 'commit-c1', 'focused-commit', 'reply-bar-clearance']); + expect(childRefs($screen, 'thread-scroll'))->toBe(['earlier-commits', 'commit-c1', 'focused-commit', 'reply-bar-clearance']); $screen->tap('earlier-commits') ->assertSee('The root commit') ->assertDontSee('1 earlier commit'); - expect(childRefs($screen, 'thread-page'))->toBe(['commit-c0', 'commit-c1', 'focused-commit', 'reply-bar-clearance']); + expect(childRefs($screen, 'thread-scroll'))->toBe(['commit-c0', 'commit-c1', 'focused-commit', 'reply-bar-clearance']); $screen->tap('replies-c2') ->assertSee('First reply') ->assertSee('Hide replies'); - expect(childRefs($screen, 'thread-page'))->toBe(['commit-c0', 'commit-c1', 'focused-commit', 'thread-reply-r1', 'reply-bar-clearance']); + expect(childRefs($screen, 'thread-scroll'))->toBe(['commit-c0', 'commit-c1', 'focused-commit', 'thread-reply-r1', 'reply-bar-clearance']); $screen->tap('replies-c2') ->assertDontSee('First reply') @@ -84,7 +84,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): ->assertSee('The parent commit') ->assertDontSee('The root commit'); - expect(childRefs($screen, 'thread-page'))->toBe(['earlier-commits', 'commit-c1', 'focused-commit', 'reply-bar-clearance']) + expect(childRefs($screen, 'thread-scroll'))->toBe(['earlier-commits', 'commit-c1', 'focused-commit', 'reply-bar-clearance']) ->and(nodeByRef($screen, 'thread-scroll')['id'])->not->toBe($before); }); @@ -347,7 +347,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): $staged = $screen->instance()->replies[1]->id; - expect(childRefs($screen, 'thread-page'))->toBe(['focused-commit', 'thread-reply-r1', "thread-reply-{$staged}", 'reply-bar-clearance']) + expect(childRefs($screen, 'thread-scroll'))->toBe(['focused-commit', 'thread-reply-r1', "thread-reply-{$staged}", 'reply-bar-clearance']) ->and(PendingWrite::query()->count())->toBe(1); finishRefreshes($screen) @@ -355,7 +355,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): ->assertSee('pending') ->assertDontSee('staged'); - expect(childRefs($screen, 'thread-page'))->toBe(['focused-commit', 'thread-reply-r1', 'thread-reply-r9', 'reply-bar-clearance']) + expect(childRefs($screen, 'thread-scroll'))->toBe(['focused-commit', 'thread-reply-r1', 'thread-reply-r9', 'reply-bar-clearance']) ->and(PendingWrite::query()->count())->toBe(0) ->and(collect(Http::recorded())->filter(fn (array $sent): bool => $sent[0]->method() === 'POST'))->toHaveCount(1); }); @@ -383,7 +383,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): ->call('loadMoreReplies') ->assertSet('repliesCursor', null); - expect(childRefs($screen, 'thread-page'))->toBe(['focused-commit', 'thread-reply-r1', 'thread-reply-r2', 'thread-reply-r9', 'reply-bar-clearance']); + expect(childRefs($screen, 'thread-scroll'))->toBe(['focused-commit', 'thread-reply-r1', 'thread-reply-r2', 'thread-reply-r9', 'reply-bar-clearance']); }); it('marks a reply waiting for approval as pending on its row', function () { @@ -504,10 +504,11 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): }); it('opens ancestors, replies and profiles', function () { - fakeThread(replies: [replyJson(['id' => 'r1'])]); + fakeThread(replies: [replyJson(['id' => 'r1', 'parent_id' => 'c2'])]); - Native::visit('/log/commits/c2')->tap('earlier-commits')->tap('commit-c1')->assertNavigatedTo('/log/commits/c1'); - Native::visit('/log/commits/c2')->tap('replies-c2')->tap('thread-reply-r1')->assertNavigatedTo('/log/commits/r1'); + // Commits in the tree move the page to them, and anything else opens its own page. + Native::visit('/log/commits/c2')->tap('earlier-commits')->tap('commit-c1')->assertNoNavigation()->assertSet('id', 'c1'); + Native::visit('/log/commits/c2')->tap('replies-c2')->tap('thread-reply-r1')->assertNoNavigation()->assertSet('id', 'r1'); Native::visit('/log/commits/c2')->call('openProfile', 'ada')->assertNavigatedTo('/log/users/ada'); }); @@ -664,7 +665,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): // One level in, on an elbow off the deleted reply's spine. expect(findNode(nodeByRef($screen, 'thread-reply-r3'), fn (array $node): bool => ($node['ref'] ?? null) === 'thread-elbow'))->not->toBeNull(); - $screen->tap('thread-reply-r3')->assertNavigatedTo('/log/commits/r3'); + $screen->tap('thread-reply-r3')->assertNoNavigation()->assertSet('id', 'r3'); Native::visit('/log/commits/c2') ->tap('replies-c2') @@ -792,7 +793,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): expect(app(Account::class)->user())->toBeNull(); }); -it('reloads when you come back from a reply you deleted', function () { +it('moves back to the parent when you delete a reply the page moved to', function () { $replyDeleted = false; Http::fake(function (Request $request) use (&$replyDeleted) { @@ -809,15 +810,15 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): }; }); - $reply = Native::visit('/log/commits/c2') + // The page moved to the reply, so deleting it moves the page back to its parent, asked for again. + Native::visit('/log/commits/c2') ->tap('replies-c2') ->assertSee('Soon gone') ->tap('thread-reply-r1') - ->follow() + ->assertSet('id', 'r1') ->call('deleteCommit', 'r1') - ->assertWentBack(); - - $reply->goBack() + ->assertNoNavigation() + ->assertSet('id', 'c2') ->assertSee('Parent') ->assertDontSee('Soon gone') ->assertSee('No replies yet.'); @@ -952,7 +953,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): $screen = Native::visit('/log/commits/c2', platform: 'ios'); $scroller = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'scroll_view'); - $page = $scroller['children'][0]['children']; + $page = $scroller['children']; // The clearance is the last thing on the page, under the last reply: the fade, the bar and the home indicator. $bar = 24 + Display::ComposerFadeHeight + Display::ComposerBoxBarHeight + 34; diff --git a/tests/Feature/Screens/NestedRepliesTest.php b/tests/Feature/Screens/NestedRepliesTest.php index 9d208b7a..14a41698 100644 --- a/tests/Feature/Screens/NestedRepliesTest.php +++ b/tests/Feature/Screens/NestedRepliesTest.php @@ -52,8 +52,8 @@ function fakeDeepThread(): void $screen->tap('replies-r2')->assertDontSee('Reply at depth 3'); finishRefreshes($screen)->assertDontSee('Reply at depth 5'); - // Tapping a reply itself still opens its page. - $screen->tap('thread-reply-r2')->assertNavigatedTo('/log/commits/r2'); + // Tapping a reply itself moves the page to it. + $screen->tap('thread-reply-r2')->assertNoNavigation()->assertSet('id', 'r2'); }); it('steps replies in up to the third level, and lines deeper ones up under it saying who they answer', function () { @@ -75,3 +75,57 @@ function fakeDeepThread(): void $screen->assertSee('replying to @alan')->assertSee('replying to @edsger'); }); + +it('moves the page to a reply in its tree rather than pushing another, keeping what was open', function () { + fakeDeepThread(); + + $screen = Native::visit('/log/commits/c2', ['replies' => true]); + + foreach (range(1, 3) as $depth) { + $screen->tap("replies-r{$depth}"); + } + + $screen->tap('thread-reply-r3') + ->assertNoNavigation() + ->assertSet('id', 'r3') + ->assertSet('scrollTarget', 3); + + // The reply is the commit the page is on, under the commits above it, with its replies showing at once. + expect(childRefs($screen, 'thread-scroll'))->toBe(['commit-c2', 'commit-r1', 'commit-r2', 'focused-commit', 'thread-reply-r4', 'reply-bar-clearance']) + ->and(nodeByRef($screen, 'thread-scroll')['props']['auto_scroll_to'])->toBe(3); + + // Back up at the top, the reply the page was on is still open under its parents. + $screen->tap('commit-c2') + ->assertNoNavigation() + ->assertSet('id', 'c2') + ->assertSet('scrollTarget', 0) + ->assertSee('Reply at depth 4'); + + expect(childRefs($screen, 'thread-scroll'))->toBe(['focused-commit', 'thread-reply-r1', 'thread-reply-r2', 'thread-reply-r3', 'thread-reply-r4', 'reply-bar-clearance']); +}); + +it('answers a reply in the tree from the bar, on the same page', function () { + fakeDeepThread(); + + Native::visit('/log/commits/c2', ['replies' => true]) + ->call('replyTo', 'r1') + ->assertNoNavigation() + ->assertSet('id', 'r1') + ->assertSet('focusReply', true); +}); + +it('still pushes a page for a commit outside the tree', function () { + fakeDeepThread(); + + Native::visit('/log/commits/c2', ['replies' => true]) + ->call('openCommit', 'q9') + ->assertNavigatedTo('/log/commits/q9'); +}); + +it('opens at the top with no scroll asked for until the page moves', function () { + fakeDeepThread(); + + $screen = Native::visit('/log/commits/c2', ['replies' => true]); + + expect(nodeByRef($screen, 'thread-scroll')['props'] ?? [])->not->toHaveKey('auto_scroll_to'); +}); diff --git a/tests/Feature/Screens/RelatedCommitsTest.php b/tests/Feature/Screens/RelatedCommitsTest.php index d493ad73..b3f9a350 100644 --- a/tests/Feature/Screens/RelatedCommitsTest.php +++ b/tests/Feature/Screens/RelatedCommitsTest.php @@ -85,7 +85,7 @@ function openRelated(TestableComponent $screen): TestableComponent ->assertSee('Next match') ->assertSee('Third match'); - expect(childRefs($screen, 'thread-page'))->toBe(['focused-commit', 'thread-reply-r1', 'related-commits', 'reply-bar-clearance']) + expect(childRefs($screen, 'thread-scroll'))->toBe(['focused-commit', 'thread-reply-r1', 'related-commits', 'reply-bar-clearance']) ->and(childRefs($screen, 'related-commits'))->toBe(['related-commits-toggle', 'related-c9', 'related-c3', 'related-c7']) ->and(childRefs($screen, 'related-c9'))->toBe(['commit-c9']) ->and(railNode($screen, 'commit-c9'))->toBe('avatar') @@ -255,13 +255,13 @@ function openRelated(TestableComponent $screen): TestableComponent $relatedLine = fn (): float => (float) (nodeByRef($screen, 'related-commits')['props']['border_t'] ?? 0); // Shut, the commit sits right on the section, whose line is the only one. - expect(childRefs($screen, 'thread-page'))->toBe(['focused-commit', 'related-commits', 'reply-bar-clearance']) + expect(childRefs($screen, 'thread-scroll'))->toBe(['focused-commit', 'related-commits', 'reply-bar-clearance']) ->and($commitLine())->toBe(0.0) ->and($relatedLine())->toBe(1.0); // Open, the last reply ends with no hairline of its own, so the section's line is still the only one. $screen->tap('replies-c1')->assertSee('A reply'); - expect(childRefs($screen, 'thread-page'))->toBe(['focused-commit', 'thread-reply-r1', 'related-commits', 'reply-bar-clearance']) + expect(childRefs($screen, 'thread-scroll'))->toBe(['focused-commit', 'thread-reply-r1', 'related-commits', 'reply-bar-clearance']) ->and($commitLine())->toBe(0.0) ->and(findNode($screen->tree(), fn (array $node): bool => ($node['ref'] ?? null) === 'thread-end-r1'))->toBeNull() ->and($relatedLine())->toBe(1.0); diff --git a/tests/Feature/Screens/SelfThreadTest.php b/tests/Feature/Screens/SelfThreadTest.php index 6c3b53fd..b78153cc 100644 --- a/tests/Feature/Screens/SelfThreadTest.php +++ b/tests/Feature/Screens/SelfThreadTest.php @@ -63,7 +63,7 @@ function serveSelfThread(array $commit, array $ancestors, array $replies): void */ function selfThreadRows(TestableComponent $screen): array { - return array_values(array_filter(childRefs($screen, 'thread-page'), fn (?string $ref): bool => $ref !== 'reply-bar-clearance')); + return array_values(array_filter(childRefs($screen, 'thread-scroll'), fn (?string $ref): bool => $ref !== 'reply-bar-clearance')); } /** diff --git a/tests/Feature/Screens/SeriesTest.php b/tests/Feature/Screens/SeriesTest.php index ad0ff31a..cd6027f9 100644 --- a/tests/Feature/Screens/SeriesTest.php +++ b/tests/Feature/Screens/SeriesTest.php @@ -131,7 +131,8 @@ function railRunsOn(TestableComponent $screen, string $ref): bool ->and(railRunsOn($screen, 'focused-commit'))->toBeTrue() ->and(railRunsOn($screen, 'commit-p3'))->toBeFalse(); - $screen->tap('commit-p3')->assertNavigatedTo('/log/commits/p3'); + // A part in the tree moves the page to it rather than pushing another. + $screen->tap('commit-p3')->assertNoNavigation()->assertSet('id', 'p3'); }); it('puts a part\'s replies under it, above the later parts, as on the web', function () { From 10cca475869305352f4e9d6cd7b4c3f5e76619ef Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 03:05:46 +0000 Subject: [PATCH 21/46] Animate the commit page's move to another commit in its tree The scroll view now has animate-layout, so the rows the page keeps slide to their new places and the ones it adds or drops fade, and auto-scroll-animated, so the first move animates too. The focused commit is keyed commit-, as it is among the commits above it, so moving up the tree slides that row rather than redrawing it. Going back to a row the scroll view already went to used to mount the scroll view again, which would make every row new. It now passes a new auto-scroll-token instead. These need NativePHP/mobile-air#736 and NativePHP/mobile-ui#225. Without them the move jumps, as before, and asking for the same row twice in a row doesn't scroll. The test that reads the new props skips until vendor has them (Tests\Support\LayoutAnimation). Co-Authored-By: Claude Opus 5.5 --- app/NativeComponents/CommitDetail.php | 19 +++++---- .../views/native/commit-detail.blade.php | 10 +++-- .../native/partials/commit-row.blade.php | 2 +- tests/Feature/Screens/NestedRepliesTest.php | 41 +++++++++++++++++++ tests/Support/LayoutAnimation.php | 25 +++++++++++ 5 files changed, 84 insertions(+), 13 deletions(-) create mode 100644 tests/Support/LayoutAnimation.php diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index 2eb2380f..5f58d4c4 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -252,6 +252,12 @@ class CommitDetail extends NativeComponent */ public ?int $scrollTarget = null; + /** + * Counts the moves refocus() made. The scroll view takes it as its auto-scroll-token, so asking for the same row + * as last time (going back to the top twice) scrolls again rather than doing nothing. + */ + public int $scrollRequest = 0; + /** * The commit the page opened on, before tapping others in its tree moved it (see refocus()). */ @@ -473,15 +479,10 @@ private function refocus(string $id): bool $this->takeReplyDraft(); $this->error = null; - // The commit's row is the one after its ancestors. A request the scroll view already went to does nothing, - // so going back to the top a second time mounts it again, at the top. - $target = count($this->ancestors); - - if ($target === $this->scrollTarget) { - $this->scrollKey++; - } - - $this->scrollTarget = $target; + // The commit's row is the one after its ancestors. A new token asks again even when that's the row the + // scroll view went to last time. The scroll view keeps its key, so its rows slide to their new places. + $this->scrollTarget = count($this->ancestors); + $this->scrollRequest++; $this->forgetRefreshes(); $this->revalidate(); $this->followThread(); diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index fd7b2a75..3b111325 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -9,10 +9,14 @@ {{-- Each row is a child of the scroll view itself, so it can bring one into view: the commit the page is on, after - tapping another commit in the tree moves the page to it (see CommitDetail::refocus() and $scrollTarget). The - first move jumps and later ones animate, as auto-scroll-to does on both platforms. + tapping another commit in the tree moves the page to it (see CommitDetail::refocus() and $scrollTarget). Every + move animates (auto-scroll-animated), and $scrollRequest as the token makes asking for the same row again scroll + again. With animate-layout the rows the page keeps slide to their new places, and the ones it adds or drops + fade. That needs the scroll view's key, and each row's, to stay the same across the move: the focused commit + is keyed commit-, as the commits above it are. These need NativePHP/mobile-air#736 and + NativePHP/mobile-ui#225; without them the move jumps and a repeat of the same row doesn't scroll. --}} - + @if (! $commit && $error === null) diff --git a/resources/views/native/partials/commit-row.blade.php b/resources/views/native/partials/commit-row.blade.php index 209350f2..528a20d1 100644 --- a/resources/views/native/partials/commit-row.blade.php +++ b/resources/views/native/partials/commit-row.blade.php @@ -13,7 +13,7 @@ @if ($commit->isDeleted()) @include('native.partials.commit-tombstone') @elseif ($focused) - + @include('native.partials.commit-row-content') @else diff --git a/tests/Feature/Screens/NestedRepliesTest.php b/tests/Feature/Screens/NestedRepliesTest.php index 14a41698..d94e12a8 100644 --- a/tests/Feature/Screens/NestedRepliesTest.php +++ b/tests/Feature/Screens/NestedRepliesTest.php @@ -3,6 +3,7 @@ use Illuminate\Http\Client\Request; use Illuminate\Support\Facades\Http; use Native\Mobile\Testing\Native; +use Tests\Support\LayoutAnimation; beforeEach(function () { config(['devnull.url' => 'http://devnull.test']); @@ -129,3 +130,43 @@ function fakeDeepThread(): void expect(nodeByRef($screen, 'thread-scroll')['props'] ?? [])->not->toHaveKey('auto_scroll_to'); }); + +it('keeps the commit row and the scroll view the same nodes when the page moves', function () { + fakeDeepThread(); + + $screen = Native::visit('/log/commits/c2', ['replies' => true]); + $screen->tap('replies-r1'); + $screen->tap('thread-reply-r2'); + $scroller = nodeByRef($screen, 'thread-scroll')['id']; + $ancestor = nodeByRef($screen, 'commit-c2')['id']; + + // The commit the page moves to keeps the node it had above the focus, so its row slides into place. The scroll + // view keeps its node too: a new one would make every row in it new. + $screen->tap('commit-c2')->assertSet('id', 'c2'); + + expect(nodeByRef($screen, 'focused-commit')['id'])->toBe($ancestor) + ->and(nodeByRef($screen, 'thread-scroll')['id'])->toBe($scroller); +}); + +it('animates the move and asks again for a row it went to before', function () { + LayoutAnimation::skipUnlessSupported(); + fakeDeepThread(); + + $screen = Native::visit('/log/commits/c2', ['replies' => true]); + $props = fn (): array => nodeByRef($screen, 'thread-scroll')['props']; + + expect($props())->toHaveKey('animate_layout', true) + ->and($props())->toHaveKey('auto_scroll_animated', true) + ->and($props())->toHaveKey('auto_scroll_token', '0'); + + $screen->tap('replies-r1'); + $screen->tap('thread-reply-r1')->assertSet('scrollTarget', 1); + $screen->tap('commit-c2')->assertSet('scrollTarget', 0); + $first = $props()['auto_scroll_token']; + $screen->tap('thread-reply-r1'); + $screen->tap('commit-c2')->assertSet('scrollTarget', 0); + + // The same row as two moves ago, under a new token, so the scroll view goes back to it. + expect($props()['auto_scroll_to'])->toBe(0) + ->and($props()['auto_scroll_token'])->not->toBe($first); +}); diff --git a/tests/Support/LayoutAnimation.php b/tests/Support/LayoutAnimation.php new file mode 100644 index 00000000..155686c8 --- /dev/null +++ b/tests/Support/LayoutAnimation.php @@ -0,0 +1,25 @@ +markTestSkipped('Needs a mobile-air with layout animation (NativePHP/mobile-air#736)'); + } + } +} From 5c5d26b78fa34bdac63cc23eb8578b0f98ba3ba8 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 03:13:16 +0000 Subject: [PATCH 22/46] Move the commit page's short hash to the top right of the commit It sat under the commit's text. Now it ends the row with the name, handle and time, pushed right by a spacer, in the same size and ink. Only the focused commit shows a hash, so no other rows change. Co-Authored-By: Claude Opus 5.5 --- .../native/partials/commit-row-content.blade.php | 11 ++++++----- tests/Feature/Screens/CommitDetailTest.php | 9 +++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/resources/views/native/partials/commit-row-content.blade.php b/resources/views/native/partials/commit-row-content.blade.php index 94482f11..382e6c66 100644 --- a/resources/views/native/partials/commit-row-content.blade.php +++ b/resources/views/native/partials/commit-row-content.blade.php @@ -11,7 +11,7 @@ row is fixed here, so they meet it on both platforms. On a commit page the commit it's about ($focused) is the main thing: a larger name and body in full ink, its time, - which tapped says when in your timezone, its hash, and its replies behind a toggle in its action row. The commits around it ($muted) step back: + which tapped says when in your timezone, its hash at the top right, and its replies behind a toggle in its action row. The commits around it ($muted) step back: smaller and in muted ink, with a smaller avatar and action row. They still open their own pages. A commit in a thread its author wrote as replies to themselves wears its place in it ($threadPosition, "2/5"), and @@ -75,6 +75,11 @@ @unless ($commit->isApproved()) @include('native.partials.status-chip', ['status' => $commit->status]) @endunless + @if ($focused) + {{-- Its short hash, at the top right of the row, as the web has it at the right of the page's header. --}} + + {{ $commit->shortHash }} + @endif @if ($commit->parent?->isDeleted()) @@ -103,10 +108,6 @@ @include('native.partials.show-thread') @endif - @if ($focused) - {{ $commit->shortHash }} - @endif - @if ($commit->isStaged()) @elseif ($focused) @include('native.partials.commit-actions', [ diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index cf451876..267e1a7d 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -287,7 +287,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): ->and(findNode($screen->tree(), fn (array $node): bool => str_starts_with((string) ($node['ref'] ?? ''), 'thread-end-')))->toBeNull(); }); -it('shows the short hash under the focused commit, without the full date', function () { +it('shows the short hash at the top right of the focused commit, without the full date', function () { fakeThread(['created_at' => '2026-10-14T20:13:05Z']); $screen = Native::visit('/log/commits/c2') @@ -295,8 +295,13 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): ->assertDontSee('+0000'); $hash = nodeByRef($screen, 'focused-hash'); + // The row with the name, the handle and the time, with a spacer pushing the hash to its end. + $nameRow = findNode(nodeByRef($screen, 'focused-commit'), fn (array $node): bool => ($node['type'] ?? null) === 'row' && in_array('focused-time', array_map(fn (array $child): ?string => $child['ref'] ?? null, $node['children'] ?? []), true)); + $children = $nameRow['children'] ?? []; - expect($hash['text'] ?? $hash['props']['text'] ?? null)->toBe('c2'); + expect($hash['text'] ?? $hash['props']['text'] ?? null)->toBe('c2') + ->and($children[array_key_last($children)]['ref'] ?? null)->toBe('focused-hash') + ->and($children[count($children) - 2]['type'] ?? null)->toBe('spacer'); }); it('says when the commit was made, in your timezone, when its time is tapped, as the web does on hover', function (?string $chosen, string $toast) { From 16f38391eaae72e01148ecf7aeeec628d8ad8ed4 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 03:13:16 +0000 Subject: [PATCH 23/46] Open the replies of the commits above the commit in place The commits above the one the page is on keep their "N replies" button, and it now opens their replies in place under them, like the commit's and every reply's, instead of moving the page there. The reply on the line down to the commit is left out of the list and of the count, since it already shows below. Closing an ancestor's replies leaves the replies of the commits on the line open (drawsOnItsOwn in ExpandsThreads). After a move the scroll target counts the rows opened above the commit, and opening or closing them later doesn't scroll. Co-Authored-By: Claude Opus 5.5 --- app/NativeComponents/CommitDetail.php | 64 ++++++++++++-- .../Concerns/ExpandsThreads.php | 15 +++- .../views/native/commit-detail.blade.php | 20 +++-- tests/Feature/Screens/NestedRepliesTest.php | 85 +++++++++++++++++++ 4 files changed, 171 insertions(+), 13 deletions(-) diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index 5f58d4c4..b35ce09c 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -19,6 +19,7 @@ use App\Devnull\RowCache; use App\Devnull\SelfThread; use App\Devnull\Stash; +use App\Devnull\ThreadRows; use App\Devnull\Timeline; use App\Devnull\Toasts; use App\Icons\Lucide; @@ -51,7 +52,8 @@ * * Each reply's own replies open in place under it, and theirs under them, as * deep as they go, as the web's commit page does (see ExpandsThreads and - * App\Devnull\ThreadRows). + * App\Devnull\ThreadRows). So do the commits above the commit, less the one + * on the line down to it, which already shows (see ancestorThreads()). * * Tapping a commit in the tree, above the commit, below it or among the * replies at any depth, moves this page to it rather than pushing another @@ -479,9 +481,10 @@ private function refocus(string $id): bool $this->takeReplyDraft(); $this->error = null; - // The commit's row is the one after its ancestors. A new token asks again even when that's the row the - // scroll view went to last time. The scroll view keeps its key, so its rows slide to their new places. - $this->scrollTarget = count($this->ancestors); + // The commit's row is the one after its ancestors and the replies opened under them. A new token asks again + // even when that's the row the scroll view went to last time. The scroll view keeps its key, so its rows + // slide to their new places. Opening an ancestor's replies later leaves the target be, so it doesn't scroll. + $this->scrollTarget = count($this->ancestors) + array_sum(array_map(fn (array $thread): int => count($thread['rows']), $this->ancestorThreads($this->ancestors))); $this->scrollRequest++; $this->forgetRefreshes(); $this->revalidate(); @@ -594,9 +597,59 @@ private function ancestorsInTree(Commit $target): ?array return [...array_slice($line, 0, array_search($parentId, $lineIds, true) + 1), ...$between]; } + /** + * The replies of each commit above the commit, as its "› N replies" opens them in place under it, the same as a + * reply's (see ExpandsThreads), and how many that button counts. The commit under it on the page, when that's + * one of its replies, is left out of both: it's already showing, on the line down to the commit. The web leaves + * out only the part of a self-thread that carries it on (see SelfThread), so there the rest of the line would + * show twice. devnull's count already leaves that part out. + * + * @param list $above + * @return array, reply: Commit|null}>}> + */ + private function ancestorThreads(array $above): array + { + if ($this->commit === null) { + return []; + } + + $line = [...$above, $this->commit]; + $threads = []; + + foreach ($above as $index => $ancestor) { + $next = $line[$index + 1]; + $onLine = $next->parentId === $ancestor->id && $ancestor->continuationId !== $next->id; + $replies = array_values(array_filter($this->threads[$ancestor->id] ?? [], fn (Commit $reply): bool => $reply->id !== $next->id)); + + $threads[$ancestor->id] = [ + 'count' => max(0, $ancestor->repliesCount - ($onLine ? 1 : 0)), + 'rows' => $ancestor->isDeleted() || $replies === [] ? [] : ThreadRows::under( + $ancestor, + [...$this->threads, $ancestor->id => $replies], + $this->threadCursors, + $this->threadShown, + $ancestor->lane(), + opensInPlace: PHP_INT_MAX, + onPage: true, + ), + ]; + } + + return $threads; + } + + /** + * The commits on the page's line, above the commit and the commit itself, draw rows of their own, so closing the + * replies they're among leaves their own replies open. + */ + protected function drawsOnItsOwn(string $id): bool + { + return $id === $this->id || in_array($id, array_map(fn (Commit $ancestor): string => $ancestor->id, $this->ancestors), true); + } + /** * "› N replies" under the commit opens them in place, and "Hide replies" folds them away. Under a reply, at any - * depth, it opens that reply's replies in place under it (see ExpandsThreads). + * depth, or a commit above the commit, it opens that one's replies in place under it (see ExpandsThreads). */ public function toggleReplies(string $id = ''): void { @@ -1211,6 +1264,7 @@ public function render(): View laneAbove: $earlier === [] ? null : end($earlier)->lane(), ), 'relatedRows' => Timeline::thread($this->related), + 'ancestorThreads' => $this->ancestorThreads($above), 'earlierCount' => $this->commit === null ? 0 : count($earlier), 'earlierLane' => $earlier === [] ? null : end($earlier)->lane(), 'replyCount' => max($this->commit->repliesCount ?? 0, count($replies)), diff --git a/app/NativeComponents/Concerns/ExpandsThreads.php b/app/NativeComponents/Concerns/ExpandsThreads.php index 8a31f599..cbd8830d 100644 --- a/app/NativeComponents/Concerns/ExpandsThreads.php +++ b/app/NativeComponents/Concerns/ExpandsThreads.php @@ -267,7 +267,9 @@ private function keepCursor(string $id, ?string $cursor): void private function closeThread(string $id): void { foreach ($this->threads[$id] ?? [] as $reply) { - $this->closeThread($reply->id); + if (! $this->drawsOnItsOwn($reply->id)) { + $this->closeThread($reply->id); + } } unset($this->threads[$id], $this->threadCursors[$id], $this->threadShown[$id]); @@ -360,7 +362,7 @@ private function rowsInside(string $id): array $rows = $this->rowsOf($id, $this->shownReplies($id)); foreach ($this->shownReplies($id) as $reply) { - if (array_key_exists($reply->id, $this->threads)) { + if (array_key_exists($reply->id, $this->threads) && ! $this->drawsOnItsOwn($reply->id)) { $rows = [...$rows, ...$this->rowsInside($reply->id)]; } } @@ -368,6 +370,15 @@ private function rowsInside(string $id): array return $rows; } + /** + * Whether the screen draws a reply in a row of its own rather than in the thread it's in, so its own replies + * stay open when that thread closes. A commit page draws the commits on its line that way (see CommitDetail). + */ + protected function drawsOnItsOwn(string $id): bool + { + return false; + } + /** * @return list */ diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index 3b111325..9cbd7358 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -31,7 +31,8 @@ their avatar once. The replies hang under it on the thread's dashed lines, with the rail ending in a dot above them, ten at a time with "Show more" under the last. A part of a series with more parts after it has its replies right under it, beside the rail running on, and the later parts follow. Everything - around the commit is muted. Tapping any commit in the tree moves the page to it rather than pushing + around the commit is muted, and the commits above it open their other replies in place under them, as the + commit does. Tapping any commit in the tree moves the page to it rather than pushing another (see CommitDetail::refocus()). Every reply's own replies open in place under it, ten at a time too, as deep as they go, as on the web: they step in up to the web's depth and line up under the deepest step past it, saying who they answer (see App\Devnull\ThreadRows). @@ -57,12 +58,14 @@ @php($isLastPart = $lastPart !== null && $row->commit->id === $lastPart->id) @php($hasThread = $isFocused && $repliesShown && $replies !== []) @php($partThread = $isLastPart && $lastPartReplies !== []) + @php($aboveThread = $ancestorThreads[$row->commit->id] ?? null) + @php($aboveOpen = ($aboveThread['rows'] ?? []) !== []) @include('native.partials.commit-row', [ 'commit' => $row->commit, 'previousLane' => $row->previousLane, 'continuesRun' => $row->continuesRun, - 'continuesNext' => $isFocused ? ! $loop->last : null, - 'threadBelow' => $hasThread || $partThread, + 'continuesNext' => $isFocused || $aboveOpen ? ! $loop->last : null, + 'threadBelow' => $hasThread || $partThread || $aboveOpen, 'repliesBelow' => $partThread, 'focused' => $isFocused, 'muted' => ! $isFocused, @@ -71,15 +74,20 @@ 'hairline' => ! ($loop->last && $relatedBelow && ! $threadMore), 'threadPosition' => $threadPositions[$row->commit->id] ?? null, 'showsThread' => false, - 'expandable' => false, + 'expandable' => $aboveThread !== null, + 'repliesCount' => $aboveThread['count'] ?? null, ]) @if ($isFocused && $repliesShown && $replies === [] && ! $repliesLoaded && $error === null) @endif - {{-- The replies, and theirs opened in place under them as deep as they go (see App\Devnull\ThreadRows). --}} - @php($pageThread = match (true) { $hasThread => \App\Devnull\ThreadRows::under($commit, [...$threads, $commit->id => $replies], array_filter([...$threadCursors, $commit->id => $repliesCursor]), $threadShown, $loop->last ? null : $commit->lane(), opensInPlace: PHP_INT_MAX, onPage: true, morePress: 'loadMoreReplies'), $partThread => \App\Devnull\ThreadRows::under($lastPart, [...$threads, $lastPart->id => $lastPartReplies], array_filter([...$threadCursors, $lastPart->id => $lastPartMore ? 'more' : null]), $threadShown, opensInPlace: PHP_INT_MAX, onPage: true, morePress: "openReplies('{$lastPart->id}')"), default => [] }) + {{-- + The replies, and theirs opened in place under them as deep as they go (see App\Devnull\ThreadRows). + A commit above the commit opens its replies in place under it too, all but the one on the line down + to the commit, which already shows (see CommitDetail::ancestorThreads()). + --}} + @php($pageThread = match (true) { $aboveThread !== null => $aboveThread['rows'], $hasThread => \App\Devnull\ThreadRows::under($commit, [...$threads, $commit->id => $replies], array_filter([...$threadCursors, $commit->id => $repliesCursor]), $threadShown, $loop->last ? null : $commit->lane(), opensInPlace: PHP_INT_MAX, onPage: true, morePress: 'loadMoreReplies'), $partThread => \App\Devnull\ThreadRows::under($lastPart, [...$threads, $lastPart->id => $lastPartReplies], array_filter([...$threadCursors, $lastPart->id => $lastPartMore ? 'more' : null]), $threadShown, opensInPlace: PHP_INT_MAX, onPage: true, morePress: "openReplies('{$lastPart->id}')"), default => [] }) @foreach ($pageThread as $threadRow) @if ($threadRow['reply'] === null) @include($threadRow['partial'], $threadRow['data']) diff --git a/tests/Feature/Screens/NestedRepliesTest.php b/tests/Feature/Screens/NestedRepliesTest.php index d94e12a8..75a30403 100644 --- a/tests/Feature/Screens/NestedRepliesTest.php +++ b/tests/Feature/Screens/NestedRepliesTest.php @@ -170,3 +170,88 @@ function fakeDeepThread(): void expect($props()['auto_scroll_to'])->toBe(0) ->and($props()['auto_scroll_token'])->not->toBe($first); }); + +/** + * A commit page for c2, which answers c1. c1 has another reply, x1, and x1 has one of its own, x2. c2 has one reply, r1. + */ +function fakeAncestorThread(): void +{ + $person = fn (string $handle, int $lane): array => userJson(['handle' => $handle, 'name' => ucfirst($handle), 'lane' => $lane]); + $c1 = commitJson(['id' => 'c1', 'body' => 'The commit above', 'replies_count' => 2, 'author' => $person('ada', 1)]); + $c2 = commitJson(['id' => 'c2', 'parent_id' => 'c1', 'body' => 'The focused commit', 'replies_count' => 1, 'author' => $person('grace', 2)]); + $x1 = replyJson(['id' => 'x1', 'parent_id' => 'c1', 'body' => 'Another reply above', 'replies_count' => 1, 'author' => $person('linus', 4)]); + $x2 = replyJson(['id' => 'x2', 'parent_id' => 'x1', 'body' => 'A reply to the other reply', 'author' => $person('alan', 5)]); + $r1 = replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'A reply below', 'author' => $person('ken', 6)]); + + Http::fake(function (Request $request) use ($c1, $c2, $x1, $x2, $r1) { + $path = parse_url($request->url(), PHP_URL_PATH); + + return match ($path) { + '/api/v1/commits/c2' => Http::response(commitPageJson($c2, [$c1])), + '/api/v1/commits/c1' => Http::response(commitPageJson($c1)), + '/api/v1/commits/r1' => Http::response(commitPageJson($r1, [$c1, $c2])), + '/api/v1/commits/c1/related', '/api/v1/commits/c2/related', '/api/v1/commits/r1/related' => Http::response(['data' => []]), + '/api/v1/commits/c1/replies' => Http::response(pageJson([$c2, $x1])), + '/api/v1/commits/c2/replies' => Http::response(pageJson([$r1])), + '/api/v1/commits/x1/replies' => Http::response(pageJson([$x2])), + '/api/v1/commits/r1/replies', '/api/v1/commits/x2/replies' => Http::response(pageJson([])), + default => Http::response(['message' => 'No fake.'], 404), + }; + }); +} + +it('opens the replies of a commit above the commit in place, leaving out the one on the way down', function () { + fakeAncestorThread(); + + $screen = Native::visit('/log/commits/c2', ['replies' => true]); + + // c1 has two replies, and one of them is the commit the page is on, so its button counts the other. + expect(nodeByRef($screen, 'replies-c1')['props']['a11y_label'] ?? null)->toBe('1 reply'); + + $screen->tap('replies-c1')->assertNoNavigation()->assertSee('Another reply above'); + + // The other reply opens under c1, and the commit the page is on shows once, as the commit. + expect(childRefs($screen, 'thread-scroll'))->toBe(['commit-c1', 'thread-reply-x1', 'focused-commit', 'thread-reply-r1', 'reply-bar-clearance']); + + // Its replies open in place too, at any depth. + $screen->tap('replies-x1')->assertNoNavigation()->assertSee('A reply to the other reply'); + + $screen->tap('replies-c1'); + finishRefreshes($screen)->assertDontSee('Another reply above')->assertDontSee('A reply to the other reply'); + + expect(childRefs($screen, 'thread-scroll'))->toBe(['commit-c1', 'focused-commit', 'thread-reply-r1', 'reply-bar-clearance']); +}); + +it('counts the replies opened above the commit in the row it scrolls to after a move', function () { + fakeAncestorThread(); + + $screen = Native::visit('/log/commits/c2', ['replies' => true]); + $screen->tap('replies-c1'); + $screen->tap('thread-reply-r1')->assertSet('id', 'r1')->assertSet('scrollTarget', 3); + + // r1 has no replies, so "No replies yet" follows it. + expect(childRefs($screen, 'thread-scroll'))->toBe(['commit-c1', 'thread-reply-x1', 'commit-c2', 'focused-commit', null, 'reply-bar-clearance']) + ->and(rendersRef($screen, 'replies-c2'))->toBeFalse(); + + // Closing the replies of a commit above it later doesn't scroll the page again. + $screen->tap('replies-c1')->assertSet('scrollTarget', 3); +}); + +it('keeps the replies of the commits on the line open when the replies of one above them close', function () { + fakeDeepThread(); + + $screen = Native::visit('/log/commits/c2', ['replies' => true]); + $screen->tap('replies-r1'); + $screen->tap('replies-r2'); + $screen->tap('thread-reply-r3')->assertSet('id', 'r3'); + + // Each commit above r3 has one reply, the one on the way down, so none of them has a replies button. + expect(rendersRef($screen, 'replies-c2'))->toBeFalse() + ->and(rendersRef($screen, 'replies-r1'))->toBeFalse(); + + // Closing c2's replies, which the page kept open from when it was on c2, leaves r1's and r2's be. + $screen->call('toggleReplies', 'c2'); + finishRefreshes($screen); + + expect($screen->get('threads'))->toHaveKeys(['r1', 'r2']); +}); From 5fcb78e6963727dcd7af29d5f2c56c8c619759d1 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 03:24:55 +0000 Subject: [PATCH 24/46] Fill the composer sheet with the field, and float mentions over it The sheet's field stopped at eight lines with its own scroll bar, inside a scroll view, with empty space under it. Now nothing scrolls but the field. It gets as many lines as fit between the author row and the toolbar, less whatever sits under it: photos, the poll editor, the quoted commit or the schedule box. ComposerSheet works those heights out, since neither platform tells PHP how tall the sheet is and mobile-ui's multiline field sizes itself in lines rather than to the space it's given. The mention list is no longer in the layout. It floats over the field and the quoted commit, on Liquid Glass on iOS and a raised surface on Android, from just under the caret's line down to the toolbar, and scrolls inside. The caret's line is estimated from the text before it, wrapped at the field's width, because the field doesn't report where the caret is drawn. Each part of the sheet has a keyed slot that is always drawn, so the field keeps its id and its place among its siblings and the keyboard stays up. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/ComposerSheet.php | 190 ++++++++++++++++++ .../native/partials/commit-sheet.blade.php | 162 ++++++++++----- tests/Feature/Screens/CommitMentionsTest.php | 33 +++ tests/Feature/Screens/ComposeSheetTest.php | 40 ++++ tests/Feature/Screens/ComposerPhotosTest.php | 4 +- tests/Feature/Screens/QuoteTest.php | 12 ++ tests/Unit/Devnull/ComposerSheetTest.php | 41 ++++ 7 files changed, 428 insertions(+), 54 deletions(-) create mode 100644 app/Devnull/ComposerSheet.php create mode 100644 tests/Unit/Devnull/ComposerSheetTest.php diff --git a/app/Devnull/ComposerSheet.php b/app/Devnull/ComposerSheet.php new file mode 100644 index 00000000..b3f3dc7d --- /dev/null +++ b/app/Devnull/ComposerSheet.php @@ -0,0 +1,190 @@ + $above + * @param list $below + */ + public static function fieldLines(array $above, array $below): int + { + $parts = [...array_filter($above), ...array_filter($below)]; + $free = self::BodyHeight - self::TopPadding - self::BottomPadding - array_sum($parts) - count($parts) * self::Gap; + + return max(self::MinFieldLines, intdiv($free, self::FieldLineHeight)); + } + + /** + * The height of the space under the stack above the field: the field and what's under it, where the mention list + * floats. + * + * @param list $above + */ + public static function bodyHeight(array $above): int + { + $above = array_filter($above); + + return self::BodyHeight - array_sum($above) - count($above) * self::Gap; + } + + /** + * Which of the field's shown lines the caret is on, from the top, counting from 0: the text before it, wrapped a + * word at a time at the field's width. Past the last line shown, the field has scrolled to keep the caret in + * view, so it's on the last. + */ + public static function caretLine(string $text, int $caret, int $shownLines, bool $ios = true): int + { + $perLine = $ios ? self::IosCharactersPerLine : self::AndroidCharactersPerLine; + $lines = 0; + + foreach (explode("\n", mb_substr($text, 0, max(0, $caret))) as $paragraph) { + $lines += self::wrappedLines($paragraph, $perLine); + } + + return min(max(0, $lines - 1), max(0, $shownLines - 1)); + } + + /** + * Where the mention list's top goes in the space under the stack: just under the caret's line, or higher when + * that would leave it room for fewer than three people. + */ + public static function mentionTop(int $caretLine, int $bodyHeight): int + { + $underCaret = self::TopPadding + ($caretLine + 1) * self::FieldLineHeight + self::MentionGap; + $lowest = $bodyHeight - self::MentionInset - self::MentionMinRows * self::MentionRowHeight - 8; + + return max(0, min($underCaret, $lowest)); + } + + /** + * A commit drawn as a static card (partials/quoted-commit): its chrome, its body clamped to six lines, its poll. + */ + public static function cardHeight(Commit $commit): int + { + $lines = 0; + + foreach (explode("\n", $commit->plainText()) as $paragraph) { + $lines += self::wrappedLines($paragraph, self::CardCharactersPerLine); + } + + return self::CardChromeHeight + + min(self::CardMaxLines, max(1, $lines)) * self::CardLineHeight + + ($commit->poll === null ? 0 : 4 + count($commit->poll->options) * self::CardPollOptionHeight); + } + + /** + * The poll editor (partials/poll-editor): its padding, a field per option, Add option until there are four, then + * Poll length and Remove poll under a hairline. + * + * @param list $options + */ + public static function pollEditorHeight(array $options): int + { + $count = count($options); + + return 24 + $count * 64 + ($count < PollDraft::MaxOptions ? 44 : 0) + 9 + 56; + } + + /** + * A note in small text, such as an error, at its wrapped height. + */ + public static function noteHeight(string $note): int + { + return self::wrappedLines($note, self::NoteCharactersPerLine) * self::NoteLineHeight; + } + + /** + * How many lines a paragraph wraps to, a word at a time, at about $perLine characters. A word longer than a line + * breaks, as the fields and Text break it. + */ + private static function wrappedLines(string $paragraph, int $perLine): int + { + return $paragraph === '' ? 1 : substr_count(wordwrap($paragraph, $perLine, "\n", true), "\n") + 1; + } +} diff --git a/resources/views/native/partials/commit-sheet.blade.php b/resources/views/native/partials/commit-sheet.blade.php index 1af931c2..a9633432 100644 --- a/resources/views/native/partials/commit-sheet.blade.php +++ b/resources/views/native/partials/commit-sheet.blade.php @@ -26,11 +26,14 @@ A commit's page opens its reply here too, as "Reply to @handle", with the commit being answered as a static card over the field, for the photos and the preview its reply bar has no room for. Commit says Reply there. - While the caret is after an "@handle", the people to mention show right under the field, as the web's composer lists - them (see SuggestsMentions): for a bare "@" in a new commit, the people you follow, under that heading. The field - keeps the keyboard up through presses in the sheet (keep-focus), so picking someone leaves you typing after them. + While the caret is after an "@handle", the people to mention float over the field just under the caret's line, as + the web's composer lists them (see SuggestsMentions): for a bare "@" in a new commit, the people you follow, under + that heading. They cover a quoted commit too, and run down to the toolbar. The field keeps the keyboard up through + presses in the sheet (keep-focus), so picking someone leaves you typing after them. - Under what's being written come its photos and the poll editor. A toolbar is pinned to the bottom of the sheet, so + The sheet doesn't scroll. The field fills the space between the author row and the toolbar, less what's under it: + the photos as a strip of 80pt squares, the poll editor, the commit being quoted, or "Submit at", each at its own + height (see ComposerSheet). Only the field scrolls its text. A toolbar is pinned to the bottom of the sheet, so it stays just above the keyboard: the tools on the left, photos, the camera, a poll (not on a reply) and the preview, which shows the draft as the commit it would become in place of the field (see AttachesToCommits), and stash@{0} and the counter on the right. An issue draft has no tools, as on the web. With photos, Commit spins while @@ -70,37 +73,74 @@ @endif - - - @if ($postsAs) - - @include('native.partials.post-as', ['ref' => 'sheet-post-as', 'me' => $postingMe, 'picked' => $sheetAuthor, 'method' => 'postAsInSheet', 'size' => 36, 'withName' => true]) - - @endif - - @if ($sheetError) - {{ $sheetError }} - @endif + {{-- + Nothing here scrolls but the field (or the preview in its place). What's over the field and under + it take their own height, and the field takes the lines left between them and the toolbar (see + ComposerSheet). Each part has a keyed slot that's always drawn, empty or not, so the field never + moves among its siblings: Android rebuilds a node that does, and the keyboard goes down with it. + --}} + @php($sheetLayout = \App\Devnull\ComposerSheet::class) + @php($linkTooLong = ! $issueCommand && \App\Devnull\Data\CommitBody::hasOversizedUrl($sheetBody)) + @php($pollShown = $sheetPoll !== null && ! $replying) + @php($offersIssues = ! $quoting && ! $scheduling && ! $replying && ! $issueCommand) + @php($issueCommands = $offersIssues && $sheetTyped ? \App\Devnull\IssueCommand::suggested($sheetBody) : []) + @php($issueHint = $offersIssues && ! $issueHintsDismissed ? \App\Devnull\IssueCommand::hinted($sheetBody) : null) + @php($above = [ + $postsAs ? $sheetLayout::PostAsHeight : 0, + $sheetError ? $sheetLayout::noteHeight($sheetError) : 0, + $issueCommand ? $sheetLayout::IssueBadgeHeight : 0, + $replying ? $sheetLayout::cardHeight($sheetCommit) : 0, + ]) + @php($below = $previewing ? [] : [ + $linkTooLong ? $sheetLayout::NoteLineHeight * 2 : 0, + $sheetImages === [] ? 0 : $sheetLayout::PhotosHeight + ($describing !== null ? $sheetLayout::PhotoDescriptionHeight : 0), + $pollShown ? $sheetLayout::pollEditorHeight($sheetPoll) : 0, + match (true) { + $quoting => $sheetLayout::cardHeight($sheetCommit), + $scheduling => $sheetLayout::ScheduleHeight, + $issueCommands !== [] => count($issueCommands) * $sheetLayout::IssueCommandRowHeight + 8, + $issueHint !== null => $sheetLayout::IssueHintHeight, + default => 0, + }, + ]) + @php($fieldLines = $sheetLayout::fieldLines($above, $below)) + @php($hasAbove = array_filter($above) !== []) + + @if ($postsAs) + + @include('native.partials.post-as', ['ref' => 'sheet-post-as', 'me' => $postingMe, 'picked' => $sheetAuthor, 'method' => 'postAsInSheet', 'size' => 36, 'withName' => true]) + + @endif - @if ($issueCommand) - @include('native.partials.issue-badge', ['command' => $issueCommand]) - @endif + @if ($sheetError) + {{ $sheetError }} + @endif - @if ($replying) - @include('native.partials.quoted-commit', ['quoted' => $sheetCommit, 'static' => true, 'label' => 'Replying to']) - @endif + @if ($issueCommand) + @include('native.partials.issue-badge', ['command' => $issueCommand]) + @endif - @if ($previewing) - @include('native.partials.composer-preview', [ - 'ref' => 'sheet-draft', - 'body' => $sheetBody, - 'preview' => $sheetPreview, - 'images' => $sheetImages, - 'poll' => $replying ? null : $sheetPoll, - 'pollLength' => $sheetPollLength, - 'quoted' => $quoting ? $sheetCommit : null, - ]) - @else + @if ($replying) + @include('native.partials.quoted-commit', ['quoted' => $sheetCommit, 'static' => true, 'label' => 'Replying to']) + @endif + + + @if ($previewing) + + + @include('native.partials.composer-preview', [ + 'ref' => 'sheet-draft', + 'body' => $sheetBody, + 'preview' => $sheetPreview, + 'images' => $sheetImages, + 'poll' => $replying ? null : $sheetPoll, + 'pollLength' => $sheetPollLength, + 'quoted' => $quoting ? $sheetCommit : null, + ]) + + + @else + - - @include('native.partials.mention-suggestions', [ - 'field' => 'sheetBody', - 'heading' => ($mention['query'] ?? null) === '' && $sheetView === 'compose' ? 'People you follow' : null, - 'label' => 'Mention a developer', - 'class' => 'w-full py-1 rounded-md border border-theme-hairline bg-theme-surface', - ]) - - @if (! $issueCommand && \App\Devnull\Data\CommitBody::hasOversizedUrl($sheetBody)) + + @php($hasBelow = array_filter($below) !== []) + + @if ($linkTooLong) Each link must not be greater than {{ \App\Devnull\Data\BodyLink::MaxLength }} characters. @endif @include('native.partials.composer-photos') - @if ($sheetPoll !== null && ! $replying) + @if ($pollShown) @include('native.partials.poll-editor') @endif @@ -139,17 +176,38 @@ class="w-full text-theme-ink" @include('native.partials.quoted-commit', ['quoted' => $sheetCommit, 'static' => true]) @elseif ($scheduling) @include('native.partials.schedule-picker') - @elseif (! $replying && ! $issueCommand) - @include('native.partials.issue-suggestions', [ - 'suggestions' => $sheetTyped ? \App\Devnull\IssueCommand::suggested($sheetBody) : [], - 'hint' => $issueHintsDismissed ? null : \App\Devnull\IssueCommand::hinted($sheetBody), - ]) + @elseif ($offersIssues) + @include('native.partials.issue-suggestions', ['suggestions' => $issueCommands, 'hint' => $issueHint]) @endif - @endif + - - - {{-- Pinned under the scroll view, so it rides just above the keyboard, and above the home indicator without it. --}} + {{-- + The people to mention float over the field and whatever is under it, out of the layout, so + nothing moves when they come and go. They start just under the line the caret is on, as + near as the app can tell (see ComposerSheet::caretLine()), and run down to the toolbar, + scrolling inside when there are more than fit. On Liquid Glass on iOS, like the reply + bar's, and on a raised surface on Android. + --}} + @if (($mention['field'] ?? null) === 'sheetBody' && ($mentionPeople !== [] || $mentionOrganizations !== [])) + @php($caretLine = $sheetLayout::caretLine($mention['text'], $mention['start'] + mb_strlen($mention['query']) + 1, $fieldLines, \Native\Mobile\Platform::isIos())) + + + @include('native.partials.mention-suggestions', [ + 'field' => 'sheetBody', + 'heading' => ($mention['query'] ?? null) === '' && $sheetView === 'compose' ? 'People you follow' : null, + 'label' => 'Mention a developer', + 'class' => 'w-full py-1', + ]) + + + @endif + @endif + + {{-- Pinned under the field and what's around it, so it rides just above the keyboard, and above the home indicator without it. --}} @unless ($issueCommand) diff --git a/tests/Feature/Screens/CommitMentionsTest.php b/tests/Feature/Screens/CommitMentionsTest.php index 4d35f14f..f9b4fe2c 100644 --- a/tests/Feature/Screens/CommitMentionsTest.php +++ b/tests/Feature/Screens/CommitMentionsTest.php @@ -1,5 +1,6 @@ assertSet('mention', null) ->assertSet('mentionPeople', []); }); + +it('floats the suggestions over the quoted commit on glass, from just under the caret line down to the toolbar', function () { + $screen = mentionsComposer(quoting: true)->input('sheet-body', "see\n@a", 6); + $overlay = nodeByRef($screen, 'sheet-mentions'); + + // Out of the layout, over the field and the card under it, so neither moves. + expect($overlay['layout']['position_type'])->toBe(1) + ->and($overlay['layout']['position'])->toEqual([ + ComposerSheet::TopPadding + 2 * ComposerSheet::FieldLineHeight + ComposerSheet::MentionGap, + 12, + ComposerSheet::MentionInset, + 12, + ]) + ->and($overlay['props']['glass'])->toBe(1) + ->and(childRefs($screen, 'sheet-body-area'))->toBe(['sheet-field-slot', 'sheet-below', 'sheet-mentions']) + ->and(findNode(nodeByRef($screen, 'sheet-below'), fn (array $node): bool => ($node['ref'] ?? null) === 'quote-card'))->not->toBeNull() + // The list scrolls inside it when there are more than fit. + ->and(findNode($overlay, fn (array $node): bool => $node['type'] === 'scroll_view' && ($node['ref'] ?? null) === 'sheet-mentions-scroll'))->not->toBeNull() + ->and(childRefs($screen, 'mention-suggestions'))->toBe(['mention-ada', 'mention-adam', 'mention-adaptive']); +}); + +it('draws the floating suggestions on a raised surface on Android', function () { + fakeApi([ + 'GET /api/v1/log/following' => [pageJson([])], + 'GET /api/v1/search/mentions' => mentionsFound(), + ]); + + $overlay = nodeByRef(Native::visit('/log', platform: 'android')->press('composeInSheet')->input('sheet-body', 'hi @a', 5), 'sheet-mentions'); + + expect($overlay['props'])->not->toHaveKey('glass') + ->and(strtolower($overlay['style']['bg_color']))->toBe(strtolower(config('native-ui.theme.light.surface'))); +}); diff --git a/tests/Feature/Screens/ComposeSheetTest.php b/tests/Feature/Screens/ComposeSheetTest.php index d0f319ee..490768e6 100644 --- a/tests/Feature/Screens/ComposeSheetTest.php +++ b/tests/Feature/Screens/ComposeSheetTest.php @@ -1,5 +1,6 @@ and(idsDownTo($screen->tree(), 'sheet-body'))->toBe($field); }); +it('fills the sheet with the field, with nothing scrolling around it', function () { + $screen = composeSheetOnLog(); + $field = nodeByRef($screen, 'sheet-body')['props']; + + expect(findNodes(nodeByRef($screen, 'sheet'), fn (array $node): bool => $node['type'] === 'scroll_view'))->toBe([]) + // As many lines as the sheet has room for, so the field reaches down to the toolbar. + ->and($field['min_lines'])->toBe($field['max_lines']) + ->and($field['max_lines'])->toBe(ComposerSheet::fieldLines([], [])) + ->and($field['line_height_px'])->toEqual(ComposerSheet::FieldLineHeight); +}); + +it('gives the field fewer lines while a poll takes its room, and the poll sits under the field', function () { + $screen = composeSheetOnLog(); + $lines = nodeByRef($screen, 'sheet-body')['props']['max_lines']; + + $screen->tap('sheet-poll'); + + expect(nodeByRef($screen, 'sheet-body')['props']['max_lines'])->toBeLessThan($lines) + ->and(nodeByRef($screen, 'sheet-body')['props']['min_lines'])->toBe(nodeByRef($screen, 'sheet-body')['props']['max_lines']) + ->and(findNode(nodeByRef($screen, 'sheet-below'), fn (array $node): bool => ($node['ref'] ?? null) === 'poll-editor'))->not->toBeNull(); +}); + +it('keeps the field the same view while photos, a poll and mentions come and go around it', function () { + fakeApi([ + 'GET /api/v1/log/following' => [pageJson([])], + 'GET /api/v1/search/mentions' => [['data' => [userJson(['id' => 'u9', 'handle' => 'ada'])], 'organizations' => []]], + ]); + $screen = Native::visit('/log', platform: 'ios')->press('composeInSheet'); + $field = idsDownTo($screen->tree(), 'sheet-body'); + + $screen->input('sheet-body', 'hi @a', 5); + expect(nodeByRef($screen, 'sheet-mentions'))->not->toBeEmpty() + ->and(idsDownTo($screen->tree(), 'sheet-body'))->toBe($field); + + $screen->input('sheet-body', 'hi', 2)->tap('sheet-poll'); + expect(nodeByRef($screen, 'poll-editor'))->not->toBeEmpty() + ->and(idsDownTo($screen->tree(), 'sheet-body'))->toBe($field); +}); + it('only commits from a sheet that has a composer in it', function () { fakeApi(['GET /api/v1/log/following' => [pageJson([commitJson(['id' => 'c1', 'author' => userJson(['id' => 'u2', 'handle' => 'ada'])])])]]); diff --git a/tests/Feature/Screens/ComposerPhotosTest.php b/tests/Feature/Screens/ComposerPhotosTest.php index 9a0fa6e1..5e3bc826 100644 --- a/tests/Feature/Screens/ComposerPhotosTest.php +++ b/tests/Feature/Screens/ComposerPhotosTest.php @@ -41,11 +41,11 @@ function isTool(TestableComponent $screen, string $ref): bool return nodeByRef($screen, $ref)['type'] === 'pressable'; } -it('pins the toolbar under the scroll view, so it stays just above the keyboard', function () { +it('pins the toolbar under the field and what is around it, so it stays just above the keyboard', function () { $screen = composerOnLog(); $toolbar = nodeByRef($screen, 'sheet-toolbar'); - expect(findNode(nodeByRef($screen, 'sheet-composer'), fn (array $node): bool => ($node['ref'] ?? null) === 'sheet-toolbar'))->toBeNull() + expect(findNode(nodeByRef($screen, 'sheet-body-area'), fn (array $node): bool => ($node['ref'] ?? null) === 'sheet-toolbar'))->toBeNull() ->and(findNode($toolbar, fn (array $node): bool => ($node['ref'] ?? null) === 'sheet-tools'))->not->toBeNull() ->and(findNode($toolbar, fn (array $node): bool => ($node['ref'] ?? null) === 'sheet-preview'))->not->toBeNull(); }); diff --git a/tests/Feature/Screens/QuoteTest.php b/tests/Feature/Screens/QuoteTest.php index 3ce4a7b5..5f08c99c 100644 --- a/tests/Feature/Screens/QuoteTest.php +++ b/tests/Feature/Screens/QuoteTest.php @@ -1,5 +1,6 @@ toBeFalse() ->and($screen->instance()->commit->id)->toBe('c2'); }); + +it('puts the quoted commit right under the field, which gives up the room it takes', function () { + $screen = quoteSheetOnLog(); + $field = nodeByRef($screen, 'sheet-body')['props']; + $card = ComposerSheet::cardHeight(Commit::fromArray(commitJson(['id' => 'c1', 'body' => 'Required reading.', 'author' => quoteAda()]))); + + expect(childRefs($screen, 'sheet-below'))->toBe(['quote-card']) + ->and($field['max_lines'])->toBe(ComposerSheet::fieldLines([], [$card])) + ->and($field['max_lines'])->toBeLessThan(ComposerSheet::fieldLines([], [])) + ->and($field['min_lines'])->toBe($field['max_lines']); +}); diff --git a/tests/Unit/Devnull/ComposerSheetTest.php b/tests/Unit/Devnull/ComposerSheetTest.php new file mode 100644 index 00000000..eeb6b09c --- /dev/null +++ b/tests/Unit/Devnull/ComposerSheetTest.php @@ -0,0 +1,41 @@ +toBe(intdiv(ComposerSheet::BodyHeight - ComposerSheet::TopPadding - ComposerSheet::BottomPadding, ComposerSheet::FieldLineHeight)) + // A quoted card under the field takes its height and a gap off the field. + ->and(ComposerSheet::fieldLines([], [96]))->toBe(intdiv(ComposerSheet::BodyHeight - ComposerSheet::TopPadding - ComposerSheet::BottomPadding - 96 - ComposerSheet::Gap, ComposerSheet::FieldLineHeight)) + // Nothing there is nothing taken. + ->and(ComposerSheet::fieldLines([0], [0, 0]))->toBe($empty) + // However much is around it, the field keeps two lines. + ->and(ComposerSheet::fieldLines([200], [300]))->toBe(ComposerSheet::MinFieldLines); +}); + +it('finds the line the caret is on from the text before it, wrapped a word at a time', function () { + expect(ComposerSheet::caretLine('see @a', 6, 10))->toBe(0) + ->and(ComposerSheet::caretLine("one\ntwo\n@a", 10, 10))->toBe(2) + // A blank line still counts. + ->and(ComposerSheet::caretLine("one\n\n@a", 7, 10))->toBe(2) + // Wrapped at about 40 characters on iOS, and fewer on Android's bigger text. + ->and(ComposerSheet::caretLine(str_repeat('word ', 9).'@a', 47, 10))->toBe(1) + ->and(ComposerSheet::caretLine(str_repeat('word ', 7).'@a', 37, 10, ios: true))->toBe(0) + ->and(ComposerSheet::caretLine(str_repeat('word ', 7).'@a', 37, 10, ios: false))->toBe(1) + // Only the text before the caret moves it. + ->and(ComposerSheet::caretLine("@a\nmore\nlines", 2, 10))->toBe(0); +}); + +it('keeps the caret on the last line the field shows once the field has scrolled', function () { + expect(ComposerSheet::caretLine(str_repeat("line\n", 20).'@a', 102, 6))->toBe(5); +}); + +it('starts the mention list under the caret line, or higher when that would leave it room for fewer than three', function () { + $underFirstLine = ComposerSheet::TopPadding + ComposerSheet::FieldLineHeight + ComposerSheet::MentionGap; + $lowest = 300 - ComposerSheet::MentionInset - ComposerSheet::MentionMinRows * ComposerSheet::MentionRowHeight - 8; + + expect(ComposerSheet::mentionTop(0, 300))->toBe($underFirstLine) + ->and(ComposerSheet::mentionTop(9, 300))->toBe($lowest) + ->and(ComposerSheet::mentionTop(0, 100))->toBe(0); +}); From 12bc35d42760a8f227cf8344fe633ffbf928fd30 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 09:09:29 +0000 Subject: [PATCH 25/46] Fill the composer sheet with a field that really fills, and place mentions by its caret The sheet's field had its lines worked out from an estimate of the sheet's height and of everything under it, and the mention list's top from the text before the caret, wrapped at a guessed width. mobile-ui#227 lets a multiline field fill the height it's given (h-full) and report where its caret is drawn (@caretChange), so the field is now h-full in a flex-1 slot and the list starts just under the caret's line as the field reports it. ComposerSheet keeps only the list's placement. Its line and height estimates, and the 24pt line height set on the field for them, are gone. Tests of the fill and the caret skip on a mobile-ui without them (Tests\Support\TextFieldFill), where the field is as tall as its lines. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/ComposerSheet.php | 183 ++++-------------- .../Concerns/OpensCommitSheet.php | 20 ++ .../native/partials/commit-sheet.blade.php | 49 ++--- tests/Feature/Screens/CommitMentionsTest.php | 10 +- tests/Feature/Screens/ComposeSheetTest.php | 35 ++-- tests/Feature/Screens/QuoteTest.php | 11 +- tests/Support/TextFieldFill.php | 25 +++ tests/Unit/Devnull/ComposerSheetTest.php | 47 ++--- 8 files changed, 151 insertions(+), 229 deletions(-) create mode 100644 tests/Support/TextFieldFill.php diff --git a/app/Devnull/ComposerSheet.php b/app/Devnull/ComposerSheet.php index b3f3dc7d..226b443a 100644 --- a/app/Devnull/ComposerSheet.php +++ b/app/Devnull/ComposerSheet.php @@ -2,79 +2,24 @@ namespace App\Devnull; -use App\Devnull\Data\Commit; -use App\Devnull\Data\PollDraft; +use Native\Mobile\UI\Caret; /** - * How the composer sheet (partials/commit-sheet) shares its height out, in points. The field takes what the rest - * leaves between the author row and the toolbar, and the mention list floats under the line the caret is on. + * Where the composer sheet (partials/commit-sheet) floats its mention list: just under the line the caret is on, which + * the field reports (`@caretChange`, see OpensCommitSheet::sheetCaretMoved()), down to the toolbar. * - * Neither platform tells PHP how tall the sheet is, or where the caret is drawn, and mobile-ui's multiline field is as - * tall as its lines (min-lines to max-lines), not as tall as the space it's given. So this works both out from what - * the app knows: the sheet's height on a 6.1" iPhone with the keyboard up, how tall each thing under the field is - * drawn, and how the draft wraps at the field's width. The field's line height is set (FieldLineHeight), so a line - * is the same height on both platforms. + * The field fills the space between the author row and what's under it by itself (`h-full`), so nothing here sizes + * it. The list's top is in the sheet's body area, whose top is the field slot's top: the slot's padding, then the + * caret's line in the field's own points. */ final class ComposerSheet { - /** - * The sheet between its bar's hairline and the toolbar's hairline, keyboard up, on a 6.1" iPhone. Bigger phones - * leave a little room under the field; nothing smaller is supported for composing. - */ - public const int BodyHeight = 340; - - /** The padding above the first thing in the sheet and under the last. */ - public const int TopPadding = 12; - - public const int BottomPadding = 8; - - /** The gap between the things stacked above and under the field. */ - public const int Gap = 12; - - public const int FieldLineHeight = 24; + /** The field slot's padding above the field (pt-3). */ + public const int FieldTop = 12; + /** The least the field shows, on a phone short enough that the rest leaves it little room. */ public const int MinFieldLines = 2; - /** - * About how many characters of the field's text fit on a line across the sheet: 18pt on iOS, 20sp on Android. - */ - public const int IosCharactersPerLine = 40; - - public const int AndroidCharactersPerLine = 36; - - /** The Post as row's avatar, with its name and handle beside it. */ - public const int PostAsHeight = 36; - - public const int IssueBadgeHeight = 32; - - /** A line of small text: an error, or the link-length note. */ - public const int NoteLineHeight = 20; - - public const int NoteCharactersPerLine = 48; - - /** The photo strip's 80pt squares, and the description under them while it's open. */ - public const int PhotosHeight = 80; - - public const int PhotoDescriptionHeight = 150; - - /** The schedule box: "Submit at", the picker, the timezone and its lines, then Scheduled commits →. */ - public const int ScheduleHeight = 170; - - public const int IssueCommandRowHeight = 44; - - public const int IssueHintHeight = 32; - - /** A quoted commit's card: its margin, padding and header, then up to six lines of its body. */ - public const int CardChromeHeight = 44; - - public const int CardLineHeight = 24; - - public const int CardCharactersPerLine = 42; - - public const int CardMaxLines = 6; - - public const int CardPollOptionHeight = 36; - /** The mention list's rows, and how many of them it always has room for. */ public const int MentionRowHeight = 44; @@ -85,106 +30,52 @@ final class ComposerSheet public const int MentionInset = 8; + /** The list's own padding above and under its rows (py-1). */ + public const int MentionPadding = 8; + /** - * How many lines the field shows, after everything else in the sheet has its height: $above are the heights of - * what's stacked over the field, $below of what's under it. - * - * @param list $above - * @param list $below + * Before the field has said where its caret is (it says so as soon as it has focus, so only for a moment), the + * list goes under about one line. */ - public static function fieldLines(array $above, array $below): int - { - $parts = [...array_filter($above), ...array_filter($below)]; - $free = self::BodyHeight - self::TopPadding - self::BottomPadding - array_sum($parts) - count($parts) * self::Gap; - - return max(self::MinFieldLines, intdiv($free, self::FieldLineHeight)); - } + public const int FirstLineHeight = 24; /** - * The height of the space under the stack above the field: the field and what's under it, where the mention list - * floats. + * The caret as the sheet keeps it: the bottom of its line and the field's visible height, in points. A caret the + * field has scrolled out of view is kept to its edges. * - * @param list $above + * @return array{bottom: float, field_height: float} */ - public static function bodyHeight(array $above): int + public static function caret(Caret $caret): array { - $above = array_filter($above); + $field = max(0.0, $caret->fieldHeight); + $bottom = max(0.0, $caret->bottom()); - return self::BodyHeight - array_sum($above) - count($above) * self::Gap; + return ['bottom' => $field > 0 ? min($bottom, $field) : $bottom, 'field_height' => $field]; } /** - * Which of the field's shown lines the caret is on, from the top, counting from 0: the text before it, wrapped a - * word at a time at the field's width. Past the last line shown, the field has scrolled to keep the caret in - * view, so it's on the last. + * Where the mention list's top goes in the sheet's body area: just under the caret's line, or higher when that + * would leave it room for fewer than three people above the toolbar. The room is measured to the field's bottom, + * since the field doesn't say how tall what's under it is, so with a quoted commit under it the list can go up a + * little sooner than it has to. + * + * @param array{bottom: float, field_height: float}|null $caret */ - public static function caretLine(string $text, int $caret, int $shownLines, bool $ios = true): int + public static function mentionTop(?array $caret): int { - $perLine = $ios ? self::IosCharactersPerLine : self::AndroidCharactersPerLine; - $lines = 0; - - foreach (explode("\n", mb_substr($text, 0, max(0, $caret))) as $paragraph) { - $lines += self::wrappedLines($paragraph, $perLine); + if ($caret === null) { + return self::FieldTop + self::FirstLineHeight + self::MentionGap; } - return min(max(0, $lines - 1), max(0, $shownLines - 1)); - } - - /** - * Where the mention list's top goes in the space under the stack: just under the caret's line, or higher when - * that would leave it room for fewer than three people. - */ - public static function mentionTop(int $caretLine, int $bodyHeight): int - { - $underCaret = self::TopPadding + ($caretLine + 1) * self::FieldLineHeight + self::MentionGap; - $lowest = $bodyHeight - self::MentionInset - self::MentionMinRows * self::MentionRowHeight - 8; + $underCaret = self::FieldTop + (int) ceil($caret['bottom']) + self::MentionGap; - return max(0, min($underCaret, $lowest)); - } - - /** - * A commit drawn as a static card (partials/quoted-commit): its chrome, its body clamped to six lines, its poll. - */ - public static function cardHeight(Commit $commit): int - { - $lines = 0; - - foreach (explode("\n", $commit->plainText()) as $paragraph) { - $lines += self::wrappedLines($paragraph, self::CardCharactersPerLine); + if ($caret['field_height'] <= 0) { + return $underCaret; } - return self::CardChromeHeight - + min(self::CardMaxLines, max(1, $lines)) * self::CardLineHeight - + ($commit->poll === null ? 0 : 4 + count($commit->poll->options) * self::CardPollOptionHeight); - } - - /** - * The poll editor (partials/poll-editor): its padding, a field per option, Add option until there are four, then - * Poll length and Remove poll under a hairline. - * - * @param list $options - */ - public static function pollEditorHeight(array $options): int - { - $count = count($options); + $lowest = self::FieldTop + (int) floor($caret['field_height']) + - self::MentionInset - self::MentionMinRows * self::MentionRowHeight - self::MentionPadding; - return 24 + $count * 64 + ($count < PollDraft::MaxOptions ? 44 : 0) + 9 + 56; - } - - /** - * A note in small text, such as an error, at its wrapped height. - */ - public static function noteHeight(string $note): int - { - return self::wrappedLines($note, self::NoteCharactersPerLine) * self::NoteLineHeight; - } - - /** - * How many lines a paragraph wraps to, a word at a time, at about $perLine characters. A word longer than a line - * breaks, as the fields and Text break it. - */ - private static function wrappedLines(string $paragraph, int $perLine): int - { - return $paragraph === '' ? 1 : substr_count(wordwrap($paragraph, $perLine, "\n", true), "\n") + 1; + return max(0, min($underCaret, $lowest)); } } diff --git a/app/NativeComponents/Concerns/OpensCommitSheet.php b/app/NativeComponents/Concerns/OpensCommitSheet.php index 06df216a..b4fc25af 100644 --- a/app/NativeComponents/Concerns/OpensCommitSheet.php +++ b/app/NativeComponents/Concerns/OpensCommitSheet.php @@ -3,6 +3,7 @@ namespace App\NativeComponents\Concerns; use App\Devnull\Client; +use App\Devnull\ComposerSheet; use App\Devnull\Data\Commit; use App\Devnull\Data\Draft; use App\Devnull\Data\PollDraft; @@ -20,6 +21,7 @@ use Carbon\CarbonImmutable; use Closure; use Native\Mobile\Facades\System; +use Native\Mobile\UI\Caret; /** * The sheet under a commit (see partials/commit-sheet). Report commit, in the @@ -110,6 +112,14 @@ trait OpensCommitSheet */ public string $sheetBody = ''; + /** + * Where the sheet's field last said its caret is drawn, for the mention list to float under (see ComposerSheet). + * Null until it has said, and again once the sheet is gone. + * + * @var array{bottom: float, field_height: float}|null + */ + public ?array $sheetCaret = null; + /** * The handle of the organization the sheet posts as, or null for you (see PostAs). */ @@ -307,6 +317,14 @@ public function openScheduledCommits(): void /** * Stashes the draft as it changes (see stashSheetDraft()). */ + /** + * The sheet's field drew its caret somewhere else: it moved, the text wrapped differently, or the field scrolled. + */ + public function sheetCaretMoved(Caret $caret): void + { + $this->sheetCaret = ComposerSheet::caret($caret); + } + public function updatedSheetBody(): void { $this->typeIssueCommand(); @@ -493,6 +511,7 @@ private function closeCommitSheet(): void { $this->sheetClosing = $this->sheetClosing || ($this->sheetOpen && System::isIos()); $this->sheetOpen = false; + $this->sheetCaret = null; $this->forgetMention('sheetBody'); } @@ -606,6 +625,7 @@ private function forgetCommitSheet(): void $this->reportReason = ''; $this->reportDetails = ''; $this->sheetBody = ''; + $this->sheetCaret = null; $this->sheetAuthor = null; $this->sheetRestored = false; $this->sheetError = null; diff --git a/resources/views/native/partials/commit-sheet.blade.php b/resources/views/native/partials/commit-sheet.blade.php index a9633432..55a945c9 100644 --- a/resources/views/native/partials/commit-sheet.blade.php +++ b/resources/views/native/partials/commit-sheet.blade.php @@ -26,14 +26,14 @@ A commit's page opens its reply here too, as "Reply to @handle", with the commit being answered as a static card over the field, for the photos and the preview its reply bar has no room for. Commit says Reply there. - While the caret is after an "@handle", the people to mention float over the field just under the caret's line, as - the web's composer lists them (see SuggestsMentions): for a bare "@" in a new commit, the people you follow, under + While the caret is after an "@handle", the people to mention float over the field just under the caret's line, + which the field reports (@caretChange), as the web's composer lists them (see SuggestsMentions): for a bare "@" in a new commit, the people you follow, under that heading. They cover a quoted commit too, and run down to the toolbar. The field keeps the keyboard up through presses in the sheet (keep-focus), so picking someone leaves you typing after them. The sheet doesn't scroll. The field fills the space between the author row and the toolbar, less what's under it: the photos as a strip of 80pt squares, the poll editor, the commit being quoted, or "Submit at", each at its own - height (see ComposerSheet). Only the field scrolls its text. A toolbar is pinned to the bottom of the sheet, so + height. Only the field scrolls its text. A toolbar is pinned to the bottom of the sheet, so it stays just above the keyboard: the tools on the left, photos, the camera, a poll (not on a reply) and the preview, which shows the draft as the commit it would become in place of the field (see AttachesToCommits), and stash@{0} and the counter on the right. An issue draft has no tools, as on the web. With photos, Commit spins while @@ -75,8 +75,8 @@ {{-- Nothing here scrolls but the field (or the preview in its place). What's over the field and under - it take their own height, and the field takes the lines left between them and the toolbar (see - ComposerSheet). Each part has a keyed slot that's always drawn, empty or not, so the field never + it take their own height, and the field (h-full in a flex-1 slot) takes what's left between them + and the toolbar. Each part has a keyed slot that's always drawn, empty or not, so the field never moves among its siblings: Android rebuilds a node that does, and the keyboard goes down with it. --}} @php($sheetLayout = \App\Devnull\ComposerSheet::class) @@ -85,26 +85,7 @@ @php($offersIssues = ! $quoting && ! $scheduling && ! $replying && ! $issueCommand) @php($issueCommands = $offersIssues && $sheetTyped ? \App\Devnull\IssueCommand::suggested($sheetBody) : []) @php($issueHint = $offersIssues && ! $issueHintsDismissed ? \App\Devnull\IssueCommand::hinted($sheetBody) : null) - @php($above = [ - $postsAs ? $sheetLayout::PostAsHeight : 0, - $sheetError ? $sheetLayout::noteHeight($sheetError) : 0, - $issueCommand ? $sheetLayout::IssueBadgeHeight : 0, - $replying ? $sheetLayout::cardHeight($sheetCommit) : 0, - ]) - @php($below = $previewing ? [] : [ - $linkTooLong ? $sheetLayout::NoteLineHeight * 2 : 0, - $sheetImages === [] ? 0 : $sheetLayout::PhotosHeight + ($describing !== null ? $sheetLayout::PhotoDescriptionHeight : 0), - $pollShown ? $sheetLayout::pollEditorHeight($sheetPoll) : 0, - match (true) { - $quoting => $sheetLayout::cardHeight($sheetCommit), - $scheduling => $sheetLayout::ScheduleHeight, - $issueCommands !== [] => count($issueCommands) * $sheetLayout::IssueCommandRowHeight + 8, - $issueHint !== null => $sheetLayout::IssueHintHeight, - default => 0, - }, - ]) - @php($fieldLines = $sheetLayout::fieldLines($above, $below)) - @php($hasAbove = array_filter($above) !== []) + @php($hasAbove = $postsAs || $sheetError || $issueCommand || $replying) @if ($postsAs) @@ -140,27 +121,26 @@ @else - + - @php($hasBelow = array_filter($below) !== []) + @php($hasBelow = $linkTooLong || $sheetImages !== [] || $pollShown || $quoting || $scheduling || $issueCommands !== [] || $issueHint !== null) @if ($linkTooLong) Each link must not be greater than {{ \App\Devnull\Data\BodyLink::MaxLength }} characters. @@ -183,17 +163,16 @@ class="w-full text-theme-ink" {{-- The people to mention float over the field and whatever is under it, out of the layout, so - nothing moves when they come and go. They start just under the line the caret is on, as - near as the app can tell (see ComposerSheet::caretLine()), and run down to the toolbar, + nothing moves when they come and go. They start just under the line the caret is on, where + the field says it is (see ComposerSheet::mentionTop()), and run down to the toolbar, scrolling inside when there are more than fit. On Liquid Glass on iOS, like the reply bar's, and on a raised surface on Android. --}} @if (($mention['field'] ?? null) === 'sheetBody' && ($mentionPeople !== [] || $mentionOrganizations !== [])) - @php($caretLine = $sheetLayout::caretLine($mention['text'], $mention['start'] + mb_strlen($mention['query']) + 1, $fieldLines, \Native\Mobile\Platform::isIos())) @include('native.partials.mention-suggestions', [ diff --git a/tests/Feature/Screens/CommitMentionsTest.php b/tests/Feature/Screens/CommitMentionsTest.php index f9b4fe2c..effbc57e 100644 --- a/tests/Feature/Screens/CommitMentionsTest.php +++ b/tests/Feature/Screens/CommitMentionsTest.php @@ -5,6 +5,8 @@ use Illuminate\Support\Facades\Http; use Native\Mobile\Testing\Native; use Native\Mobile\Testing\TestableComponent; +use Native\Mobile\UI\Caret; +use Tests\Support\TextFieldFill; beforeEach(function () { config(['devnull.url' => 'http://devnull.test']); @@ -184,13 +186,17 @@ function mentionsComposer(bool $quoting = false): TestableComponent }); it('floats the suggestions over the quoted commit on glass, from just under the caret line down to the toolbar', function () { - $screen = mentionsComposer(quoting: true)->input('sheet-body', "see\n@a", 6); + TextFieldFill::skipUnlessSupported(); + + $screen = mentionsComposer(quoting: true) + ->input('sheet-body', "see\n@a", 6) + ->moveCaretTo('sheet-body', new Caret(x: 20, y: 22, width: 2, height: 22, line: 1, fieldWidth: 350, fieldHeight: 240)); $overlay = nodeByRef($screen, 'sheet-mentions'); // Out of the layout, over the field and the card under it, so neither moves. expect($overlay['layout']['position_type'])->toBe(1) ->and($overlay['layout']['position'])->toEqual([ - ComposerSheet::TopPadding + 2 * ComposerSheet::FieldLineHeight + ComposerSheet::MentionGap, + ComposerSheet::FieldTop + 44 + ComposerSheet::MentionGap, 12, ComposerSheet::MentionInset, 12, diff --git a/tests/Feature/Screens/ComposeSheetTest.php b/tests/Feature/Screens/ComposeSheetTest.php index 490768e6..100b5877 100644 --- a/tests/Feature/Screens/ComposeSheetTest.php +++ b/tests/Feature/Screens/ComposeSheetTest.php @@ -7,6 +7,8 @@ use Illuminate\Support\Facades\Http; use Native\Mobile\Testing\Native; use Native\Mobile\Testing\TestableComponent; +use Native\Mobile\UI\Caret; +use Tests\Support\TextFieldFill; beforeEach(function () { config(['devnull.url' => 'http://devnull.test']); @@ -283,27 +285,38 @@ function sheetCommitDisabled(TestableComponent $screen): bool }); it('fills the sheet with the field, with nothing scrolling around it', function () { + TextFieldFill::skipUnlessSupported(); + $screen = composeSheetOnLog(); $field = nodeByRef($screen, 'sheet-body')['props']; expect(findNodes(nodeByRef($screen, 'sheet'), fn (array $node): bool => $node['type'] === 'scroll_view'))->toBe([]) - // As many lines as the sheet has room for, so the field reaches down to the toolbar. - ->and($field['min_lines'])->toBe($field['max_lines']) - ->and($field['max_lines'])->toBe(ComposerSheet::fieldLines([], [])) - ->and($field['line_height_px'])->toEqual(ComposerSheet::FieldLineHeight); + // As tall as the space between the author row and the toolbar, scrolling its own text. + ->and($field['fills_height'] ?? null)->toBeTrue() + ->and($field['min_lines'])->toBe(ComposerSheet::MinFieldLines) + ->and($field)->not->toHaveKey('max_lines') + ->and(nodeByRef($screen, 'sheet-field-slot')['layout']['flex_grow'] ?? null)->toEqual(1) + // It says where its caret is drawn, for the mention list. + ->and($field['on_caret_change'] ?? null)->toBeInt(); }); -it('gives the field fewer lines while a poll takes its room, and the poll sits under the field', function () { - $screen = composeSheetOnLog(); - $lines = nodeByRef($screen, 'sheet-body')['props']['max_lines']; - - $screen->tap('sheet-poll'); +it('puts the poll under the field, which gives up the room it takes', function () { + $screen = composeSheetOnLog()->tap('sheet-poll'); - expect(nodeByRef($screen, 'sheet-body')['props']['max_lines'])->toBeLessThan($lines) - ->and(nodeByRef($screen, 'sheet-body')['props']['min_lines'])->toBe(nodeByRef($screen, 'sheet-body')['props']['max_lines']) + expect(childRefs($screen, 'sheet-body-area'))->toBe(['sheet-field-slot', 'sheet-below']) ->and(findNode(nodeByRef($screen, 'sheet-below'), fn (array $node): bool => ($node['ref'] ?? null) === 'poll-editor'))->not->toBeNull(); }); +it('keeps where the field says its caret is until the sheet goes', function () { + TextFieldFill::skipUnlessSupported(); + + $screen = composeSheetOnLog() + ->moveCaretTo('sheet-body', new Caret(y: 48, height: 24, line: 2, fieldWidth: 350, fieldHeight: 240)) + ->assertSet('sheetCaret', ['bottom' => 72.0, 'field_height' => 240.0]); + + $screen->press('hideCommitSheet')->assertSet('sheetCaret', null); +}); + it('keeps the field the same view while photos, a poll and mentions come and go around it', function () { fakeApi([ 'GET /api/v1/log/following' => [pageJson([])], diff --git a/tests/Feature/Screens/QuoteTest.php b/tests/Feature/Screens/QuoteTest.php index 5f08c99c..e9a1eb92 100644 --- a/tests/Feature/Screens/QuoteTest.php +++ b/tests/Feature/Screens/QuoteTest.php @@ -1,11 +1,11 @@ 'http://devnull.test']); @@ -214,12 +214,11 @@ function quoteButtonDisabled(TestableComponent $screen): bool }); it('puts the quoted commit right under the field, which gives up the room it takes', function () { + TextFieldFill::skipUnlessSupported(); + $screen = quoteSheetOnLog(); - $field = nodeByRef($screen, 'sheet-body')['props']; - $card = ComposerSheet::cardHeight(Commit::fromArray(commitJson(['id' => 'c1', 'body' => 'Required reading.', 'author' => quoteAda()]))); expect(childRefs($screen, 'sheet-below'))->toBe(['quote-card']) - ->and($field['max_lines'])->toBe(ComposerSheet::fieldLines([], [$card])) - ->and($field['max_lines'])->toBeLessThan(ComposerSheet::fieldLines([], [])) - ->and($field['min_lines'])->toBe($field['max_lines']); + ->and(childRefs($screen, 'sheet-body-area'))->toBe(['sheet-field-slot', 'sheet-below']) + ->and(nodeByRef($screen, 'sheet-body')['props']['fills_height'] ?? null)->toBeTrue(); }); diff --git a/tests/Support/TextFieldFill.php b/tests/Support/TextFieldFill.php new file mode 100644 index 00000000..d714743c --- /dev/null +++ b/tests/Support/TextFieldFill.php @@ -0,0 +1,25 @@ +markTestSkipped('Needs a mobile-ui whose multiline field fills and reports its caret (NativePHP/mobile-ui#227)'); + } + } +} diff --git a/tests/Unit/Devnull/ComposerSheetTest.php b/tests/Unit/Devnull/ComposerSheetTest.php index eeb6b09c..28ccd184 100644 --- a/tests/Unit/Devnull/ComposerSheetTest.php +++ b/tests/Unit/Devnull/ComposerSheetTest.php @@ -1,41 +1,30 @@ TextFieldFill::skipUnlessSupported()); - expect($empty)->toBe(intdiv(ComposerSheet::BodyHeight - ComposerSheet::TopPadding - ComposerSheet::BottomPadding, ComposerSheet::FieldLineHeight)) - // A quoted card under the field takes its height and a gap off the field. - ->and(ComposerSheet::fieldLines([], [96]))->toBe(intdiv(ComposerSheet::BodyHeight - ComposerSheet::TopPadding - ComposerSheet::BottomPadding - 96 - ComposerSheet::Gap, ComposerSheet::FieldLineHeight)) - // Nothing there is nothing taken. - ->and(ComposerSheet::fieldLines([0], [0, 0]))->toBe($empty) - // However much is around it, the field keeps two lines. - ->and(ComposerSheet::fieldLines([200], [300]))->toBe(ComposerSheet::MinFieldLines); -}); +it('starts the mention list just under the line the field says the caret is on', function () { + $caret = ComposerSheet::caret(new Caret(y: 48, height: 24, line: 2, fieldHeight: 300)); -it('finds the line the caret is on from the text before it, wrapped a word at a time', function () { - expect(ComposerSheet::caretLine('see @a', 6, 10))->toBe(0) - ->and(ComposerSheet::caretLine("one\ntwo\n@a", 10, 10))->toBe(2) - // A blank line still counts. - ->and(ComposerSheet::caretLine("one\n\n@a", 7, 10))->toBe(2) - // Wrapped at about 40 characters on iOS, and fewer on Android's bigger text. - ->and(ComposerSheet::caretLine(str_repeat('word ', 9).'@a', 47, 10))->toBe(1) - ->and(ComposerSheet::caretLine(str_repeat('word ', 7).'@a', 37, 10, ios: true))->toBe(0) - ->and(ComposerSheet::caretLine(str_repeat('word ', 7).'@a', 37, 10, ios: false))->toBe(1) - // Only the text before the caret moves it. - ->and(ComposerSheet::caretLine("@a\nmore\nlines", 2, 10))->toBe(0); + expect(ComposerSheet::mentionTop($caret))->toBe(ComposerSheet::FieldTop + 72 + ComposerSheet::MentionGap); }); -it('keeps the caret on the last line the field shows once the field has scrolled', function () { - expect(ComposerSheet::caretLine(str_repeat("line\n", 20).'@a', 102, 6))->toBe(5); +it('moves the list up when the caret is too near the field\'s bottom to leave room for three people', function () { + $lowest = ComposerSheet::FieldTop + 300 - ComposerSheet::MentionInset - ComposerSheet::MentionMinRows * ComposerSheet::MentionRowHeight - ComposerSheet::MentionPadding; + + expect(ComposerSheet::mentionTop(ComposerSheet::caret(new Caret(y: 264, height: 24, fieldHeight: 300))))->toBe($lowest) + // A field too short for three people puts the list at the top of it. + ->and(ComposerSheet::mentionTop(ComposerSheet::caret(new Caret(y: 24, height: 24, fieldHeight: 80))))->toBe(0); }); -it('starts the mention list under the caret line, or higher when that would leave it room for fewer than three', function () { - $underFirstLine = ComposerSheet::TopPadding + ComposerSheet::FieldLineHeight + ComposerSheet::MentionGap; - $lowest = 300 - ComposerSheet::MentionInset - ComposerSheet::MentionMinRows * ComposerSheet::MentionRowHeight - 8; +it('keeps a caret the field has scrolled out of view to the field\'s edges', function () { + expect(ComposerSheet::caret(new Caret(y: -60, height: 24, fieldHeight: 300)))->toBe(['bottom' => 0.0, 'field_height' => 300.0]) + ->and(ComposerSheet::caret(new Caret(y: 400, height: 24, fieldHeight: 300)))->toBe(['bottom' => 300.0, 'field_height' => 300.0]); +}); - expect(ComposerSheet::mentionTop(0, 300))->toBe($underFirstLine) - ->and(ComposerSheet::mentionTop(9, 300))->toBe($lowest) - ->and(ComposerSheet::mentionTop(0, 100))->toBe(0); +it('puts the list under about one line before the field has said where its caret is', function () { + expect(ComposerSheet::mentionTop(null))->toBe(ComposerSheet::FieldTop + ComposerSheet::FirstLineHeight + ComposerSheet::MentionGap); }); From d204792fdb664e8097bd3e2de6b79d53486180a5 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 09:17:13 +0000 Subject: [PATCH 26/46] Fold the replies of the commits above the commit on every move The commits above the one the page is on now start with their replies folded behind "N replies", whether the page opened on a reply or moved down to one. Before, moving down kept the replies of the commit the page left open under it, and any opened on a commit above stayed open. Moving up, the commit the page moves to shows its replies with the way back down opened, as before. The scroll target after a move is just the ancestor count again, since nothing is open above the commit then. Co-Authored-By: Claude Opus 5.5 --- app/NativeComponents/CommitDetail.php | 23 ++++++--- .../views/native/commit-detail.blade.php | 2 +- tests/Feature/Screens/NestedRepliesTest.php | 51 +++++++++++++++---- 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index b35ce09c..7e9292d5 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -421,9 +421,11 @@ public function replyTo(string $id): void * the author's thread or series, or a reply at any depth. It becomes the * commit the page is about, with what's above it as its ancestors and its * replies showing below, all from what the page already has, so nothing - * goes blank, and devnull is asked for the rest behind it. Replies opened - * in place stay open, and the commit the page was on keeps its replies, so - * moving up shows where you came from opened under its parent. + * goes blank, and devnull is asked for the rest behind it. The commits + * above it start with their replies folded, showing only "› N replies", + * as when the page opens on a reply. Moving up, the commit the page was on + * keeps its replies, and so do the commits between, so the commit you + * move to shows the way back down to where you came from opened under it. * * The page stays one screen: Back still leaves it, as Simon asked, rather * than stepping back through the commits it moved to. The scroll view @@ -448,7 +450,7 @@ private function refocus(string $id): bool $line = [...$this->ancestors, $this->commit]; $below = array_slice($line, count($ancestors) + 1); - // What the page was on keeps its replies, opened in place, for when it's back in the tree. + // What the page was on keeps its replies, opened in place, when it ends up below the commit the page moves to. if ($this->repliesShown && $this->repliesLoaded && $this->replies !== []) { $this->threads[$this->id] = array_values(array_filter($this->replies, fn (Commit $reply): bool => ! $reply->isStaged())); $this->keepCursor($this->id, $this->repliesCursor); @@ -471,6 +473,11 @@ private function refocus(string $id): bool $this->threadLimit = SelfThread::PerPage; $this->takeOwnReplies($id); + // The commits above it fold their replies, the commit the page was on among them when the page moved down. + foreach ($this->ancestors as $ancestor) { + $this->closeThread($ancestor->id); + } + if (($thread = $this->cached($this->threadPath())) !== null) { $this->takeCommitThread($thread); } @@ -481,10 +488,10 @@ private function refocus(string $id): bool $this->takeReplyDraft(); $this->error = null; - // The commit's row is the one after its ancestors and the replies opened under them. A new token asks again - // even when that's the row the scroll view went to last time. The scroll view keeps its key, so its rows - // slide to their new places. Opening an ancestor's replies later leaves the target be, so it doesn't scroll. - $this->scrollTarget = count($this->ancestors) + array_sum(array_map(fn (array $thread): int => count($thread['rows']), $this->ancestorThreads($this->ancestors))); + // The commit's row is the one after its ancestors, whose replies are folded. A new token asks again even when + // that's the row the scroll view went to last time. The scroll view keeps its key, so its rows slide to their + // new places. Opening an ancestor's replies later leaves the target be, so it doesn't scroll. + $this->scrollTarget = count($this->ancestors); $this->scrollRequest++; $this->forgetRefreshes(); $this->revalidate(); diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index 9cbd7358..7d28ab78 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -32,7 +32,7 @@ above them, ten at a time with "Show more" under the last. A part of a series with more parts after it has its replies right under it, beside the rail running on, and the later parts follow. Everything around the commit is muted, and the commits above it open their other replies in place under them, as the - commit does. Tapping any commit in the tree moves the page to it rather than pushing + commit does, from their "N replies", which starts folded, even after the page moves. Tapping any commit in the tree moves the page to it rather than pushing another (see CommitDetail::refocus()). Every reply's own replies open in place under it, ten at a time too, as deep as they go, as on the web: they step in up to the web's depth and line up under the deepest step past it, saying who they answer (see App\Devnull\ThreadRows). diff --git a/tests/Feature/Screens/NestedRepliesTest.php b/tests/Feature/Screens/NestedRepliesTest.php index 75a30403..1e9e4c79 100644 --- a/tests/Feature/Screens/NestedRepliesTest.php +++ b/tests/Feature/Screens/NestedRepliesTest.php @@ -222,19 +222,43 @@ function fakeAncestorThread(): void expect(childRefs($screen, 'thread-scroll'))->toBe(['commit-c1', 'focused-commit', 'thread-reply-r1', 'reply-bar-clearance']); }); -it('counts the replies opened above the commit in the row it scrolls to after a move', function () { +it('folds the replies of the commits above when the page moves down to a reply', function () { fakeAncestorThread(); $screen = Native::visit('/log/commits/c2', ['replies' => true]); - $screen->tap('replies-c1'); - $screen->tap('thread-reply-r1')->assertSet('id', 'r1')->assertSet('scrollTarget', 3); + $screen->tap('replies-c1')->assertSee('Another reply above'); + $screen->tap('thread-reply-r1')->assertSet('id', 'r1')->assertSet('scrollTarget', 2)->assertDontSee('Another reply above'); - // r1 has no replies, so "No replies yet" follows it. - expect(childRefs($screen, 'thread-scroll'))->toBe(['commit-c1', 'thread-reply-x1', 'commit-c2', 'focused-commit', null, 'reply-bar-clearance']) + // c1 is back to its button, still leaving out c2 on the way down. r1 has no replies, so "No replies yet" follows it. + expect(childRefs($screen, 'thread-scroll'))->toBe(['commit-c1', 'commit-c2', 'focused-commit', null, 'reply-bar-clearance']) + ->and(nodeByRef($screen, 'replies-c1')['props']['a11y_label'] ?? null)->toBe('1 reply') ->and(rendersRef($screen, 'replies-c2'))->toBeFalse(); - // Closing the replies of a commit above it later doesn't scroll the page again. - $screen->tap('replies-c1')->assertSet('scrollTarget', 3); + // Opening them again later doesn't scroll the page. + $screen->tap('replies-c1')->assertSee('Another reply above')->assertSet('scrollTarget', 2); +}); + +it('folds the replies of the commit the page was on when it moves down to one of them, and opens them again moving back up', function () { + fakeAncestorThread(); + + $screen = Native::visit('/log/commits/c1', ['replies' => true])->assertSee('Another reply above'); + $screen->tap('thread-reply-c2')->assertNoNavigation()->assertSet('id', 'c2')->assertDontSee('Another reply above'); + + expect(childRefs($screen, 'thread-scroll'))->toBe(['commit-c1', 'focused-commit', 'thread-reply-r1', 'reply-bar-clearance']) + ->and(nodeByRef($screen, 'replies-c1')['props']['a11y_label'] ?? null)->toBe('1 reply'); + + // Back up on c1, its replies show as the commit's do, with c2's still open under it. + $screen->tap('commit-c1')->assertSet('id', 'c1')->assertSee('Another reply above')->assertSee('A reply below'); +}); + +it('opens on a reply with the replies of the commits above it folded', function () { + fakeAncestorThread(); + + $screen = Native::visit('/log/commits/r1')->call('showEarlier')->assertDontSee('Another reply above'); + + expect(nodeByRef($screen, 'replies-c1')['props']['a11y_label'] ?? null)->toBe('1 reply') + ->and(rendersRef($screen, 'replies-c2'))->toBeFalse() + ->and($screen->get('threads'))->toBe([]); }); it('keeps the replies of the commits on the line open when the replies of one above them close', function () { @@ -245,13 +269,18 @@ function fakeAncestorThread(): void $screen->tap('replies-r2'); $screen->tap('thread-reply-r3')->assertSet('id', 'r3'); - // Each commit above r3 has one reply, the one on the way down, so none of them has a replies button. - expect(rendersRef($screen, 'replies-c2'))->toBeFalse() + // The commits above r3 fold their replies. Each has one, the one on the way down, so none of them has a button. + expect($screen->get('threads'))->toBe([]) + ->and(rendersRef($screen, 'replies-c2'))->toBeFalse() ->and(rendersRef($screen, 'replies-r1'))->toBeFalse(); - // Closing c2's replies, which the page kept open from when it was on c2, leaves r1's and r2's be. + // Opened again, closing c2's replies leaves r1's be, since r1 draws a row of its own. + $screen->call('toggleReplies', 'c2'); + $screen->call('toggleReplies', 'r1'); + expect($screen->get('threads'))->toHaveKeys(['c2', 'r1']); + $screen->call('toggleReplies', 'c2'); finishRefreshes($screen); - expect($screen->get('threads'))->toHaveKeys(['r1', 'r2']); + expect($screen->get('threads'))->toHaveKey('r1')->not->toHaveKey('c2'); }); From 056deb8f608883051342db1e28783eb81b24573d Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 09:17:13 +0000 Subject: [PATCH 27/46] Hold the mention suggestions to six rows and scroll the rest With more than six people and organizations to suggest, the rows sit in a scroll view six rows tall inside the suggestions, so the list can't push the field and the bar's buttons down under the keyboard. Six or fewer are drawn as before, as tall as their rows. The slot around the list keeps its place, so the field's row doesn't move among its siblings. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Display.php | 8 ++++++ .../partials/mention-suggestions.blade.php | 17 +++++++++++-- tests/Feature/Screens/CommitMentionsTest.php | 25 +++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index 3897e633..82f003d9 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -27,6 +27,14 @@ final class Display public const int ReplyBarDescriptionHeight = 100; + /** + * The people to mention above a field (see partials/mention-suggestions): a row's height, and how many rows show + * before the rest scroll inside the list. + */ + public const int MentionRowHeight = 44; + + public const int MentionRowsShown = 6; + /** * A bar holding partials/composer-box with one line of draft, as drawn on an iPhone: the bar's padding, then the * field over the row of tools and the send button. diff --git a/resources/views/native/partials/mention-suggestions.blade.php b/resources/views/native/partials/mention-suggestions.blade.php index 1f0a4e29..5ed8a646 100644 --- a/resources/views/native/partials/mention-suggestions.blade.php +++ b/resources/views/native/partials/mention-suggestions.blade.php @@ -4,15 +4,25 @@ colour. $heading, when there is one, heads them: Members for a bare "@" in an org thread. A tap puts "@handle " in the field in place of what was typed. Above a bar's field on iOS they sit on glass of their own, like the reply strip; $class says otherwise. + + At most six rows show (Display::MentionRowsShown). Past that the rows scroll inside a list that tall, so the list + never pushes the field and the bar's buttons down under the keyboard. Fewer, and it's only as tall as its rows. + Each row is then exactly a row's height (Display::MentionRowHeight), so six fill the list. The rows sit inside the + list's own column, so the slot around it, and the field's row beside that, stay where they are. --}} @if (($mention['field'] ?? null) === $field && ($mentionPeople !== [] || $mentionOrganizations !== [])) @if ($heading ?? null) {{ $heading }} @endif - @foreach ([...array_map(fn ($user) => [$user, true], $mentionPeople), ...array_map(fn ($user) => [$user, false], $mentionOrganizations)] as [$user, $person]) + @php($mentionRows = [...array_map(fn ($user) => [$user, true], $mentionPeople), ...array_map(fn ($user) => [$user, false], $mentionOrganizations)]) + @php($mentionScrolls = count($mentionRows) > \App\Devnull\Display::MentionRowsShown) + @if ($mentionScrolls) + + @endif + @foreach ($mentionRows as [$user, $person]) - + @include('native.partials.avatar', ['user' => $user, 'size' => 28]) {{ $user->name }} @@ -26,5 +36,8 @@ @endforeach + @if ($mentionScrolls) + + @endif @endif diff --git a/tests/Feature/Screens/CommitMentionsTest.php b/tests/Feature/Screens/CommitMentionsTest.php index 4d35f14f..b728402d 100644 --- a/tests/Feature/Screens/CommitMentionsTest.php +++ b/tests/Feature/Screens/CommitMentionsTest.php @@ -95,6 +95,31 @@ function mentionsComposer(bool $quoting = false): TestableComponent ->assertMissingElement('column', fn (array $node): bool => ($node['ref'] ?? null) === 'mention-suggestions'); }); +it('holds the reply bar\'s suggestions to six rows and scrolls the rest inside the list', function () { + $people = array_map(fn (int $n): array => userJson(['id' => "u{$n}", 'handle' => "ada{$n}", 'name' => "Ada {$n}"]), range(1, 7)); + $screen = mentionsCommitPage([['data' => $people, 'organizations' => [['handle' => 'adaptive', 'name' => 'Adaptive', 'avatar_url' => null]]]]) + ->input('reply-input', '@ada', 4); + + // Eight rows, so they sit in a list six rows tall, which scrolls. The slot and the field's row around it stay put. + $list = nodeByRef($screen, 'mention-scroll'); + + expect(childRefs($screen, 'mention-suggestions'))->toBe(['mention-scroll']) + ->and($list['type'])->toBe('scroll_view') + ->and($list['layout']['height'] ?? null)->toEqual(6 * 44) + ->and(childRefs($screen, 'mention-scroll'))->toBe([...array_map(fn (int $n): string => "mention-ada{$n}", range(1, 7)), 'mention-adaptive']) + ->and(childRefs($screen, 'reply-rows'))->toBe(['reply-mention-slot', 'reply-photos-slot', 'reply-row']); + + $screen->tap('mention-ada7')->assertSet('reply', '@ada7 '); +}); + +it('leaves six suggestions or fewer as tall as their rows, with no list to scroll', function () { + $people = array_map(fn (int $n): array => userJson(['id' => "u{$n}", 'handle' => "ada{$n}", 'name' => "Ada {$n}"]), range(1, 6)); + $screen = mentionsCommitPage([['data' => $people]])->input('reply-input', '@ada', 4); + + expect(childRefs($screen, 'mention-suggestions'))->toBe(array_map(fn (int $n): string => "mention-ada{$n}", range(1, 6))) + ->and(rendersRef($screen, 'mention-scroll'))->toBeFalse(); +}); + it('puts the person picked in the reply where the @ was, with the caret after them', function () { $screen = mentionsCommitPage() ->input('reply-input', 'cc @adfor review', 6) From 31567787b97c3cab73f71f2fc936b918cfa5f367 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 10:28:46 +0000 Subject: [PATCH 28/46] Shorten the sheet's field to make room for mentions under the caret When the mention list doesn't fit between the caret's line and the field's bottom, the field now gets shorter instead, ending on the caret's line, and the list goes under it down to the toolbar. Before, the list moved up to make room for three people and could cover the line being typed on. The list is as tall as its rows (up to six) when it floats, so it only scrolls when it has to. Once the list goes, the field fills again. The body area has animate-layout (mobile-air#736), so the field's height and the list coming and going are animated. The field slot keeps its key and place, so the keyboard stays up. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/ComposerSheet.php | 130 ++++++++++++++---- .../Concerns/OpensCommitSheet.php | 27 +++- .../native/partials/commit-sheet.blade.php | 39 ++++-- tests/Feature/Screens/CommitMentionsTest.php | 44 +++++- tests/Feature/Screens/ComposeSheetTest.php | 2 +- tests/Support/LayoutAnimation.php | 25 ++++ tests/Unit/Devnull/ComposerSheetTest.php | 80 +++++++++-- 7 files changed, 284 insertions(+), 63 deletions(-) create mode 100644 tests/Support/LayoutAnimation.php diff --git a/app/Devnull/ComposerSheet.php b/app/Devnull/ComposerSheet.php index 226b443a..80a3ccf7 100644 --- a/app/Devnull/ComposerSheet.php +++ b/app/Devnull/ComposerSheet.php @@ -5,12 +5,16 @@ use Native\Mobile\UI\Caret; /** - * Where the composer sheet (partials/commit-sheet) floats its mention list: just under the line the caret is on, which - * the field reports (`@caretChange`, see OpensCommitSheet::sheetCaretMoved()), down to the toolbar. + * Where the composer sheet (partials/commit-sheet) puts its mention list, and how tall its field is meanwhile. * - * The field fills the space between the author row and what's under it by itself (`h-full`), so nothing here sizes - * it. The list's top is in the sheet's body area, whose top is the field slot's top: the slot's padding, then the - * caret's line in the field's own points. + * The field fills the space between the author row and what's under it by itself (`h-full`). The list floats just + * under the line the caret is on, which the field reports (`@caretChange`, see OpensCommitSheet::sheetCaretMoved()), + * as tall as its rows, up to six of them. When there isn't room for that under the caret, the field gets shorter + * instead, just tall enough to end on the caret's line (it scrolls its text to keep the caret in view), and the list + * goes in the room that frees, under the field. Once the list is gone, the field fills again. + * + * Everything is in points from the top of the sheet's body area, whose top is the field slot's top: the slot's + * padding, then the field. */ final class ComposerSheet { @@ -20,62 +24,128 @@ final class ComposerSheet /** The least the field shows, on a phone short enough that the rest leaves it little room. */ public const int MinFieldLines = 2; - /** The mention list's rows, and how many of them it always has room for. */ + /** + * The mention list's rows, and how many show before the rest scroll inside it. The same as + * Display::MentionRowHeight and Display::MentionRowsShown, which cap the lists by the other fields. + */ public const int MentionRowHeight = 44; - public const int MentionMinRows = 3; + public const int MentionRowsShown = 6; - /** How far under the caret's line the mention list starts, and stops above the toolbar. */ + /** The list's own padding above and under its rows (py-1), and its heading's height (one line of text-xs, py-1). */ + public const int MentionPadding = 8; + + public const int MentionHeadingHeight = 24; + + /** How far under the caret's line (or the field) the mention list starts, and stops above the toolbar. */ public const int MentionGap = 4; public const int MentionInset = 8; - /** The list's own padding above and under its rows (py-1). */ - public const int MentionPadding = 8; - /** * Before the field has said where its caret is (it says so as soon as it has focus, so only for a moment), the - * list goes under about one line. + * list goes under about one line, and a line is taken to be this tall. */ public const int FirstLineHeight = 24; /** - * The caret as the sheet keeps it: the bottom of its line and the field's visible height, in points. A caret the - * field has scrolled out of view is kept to its edges. + * The caret as the sheet keeps it, as the field shows it at its full height: the bottom of its line, the line's + * height, and the field's visible height, in points. A caret the field has scrolled out of view is kept to its + * edges. * - * @return array{bottom: float, field_height: float} + * @return array{bottom: float, line_height: float, field_height: float} */ public static function caret(Caret $caret): array { $field = max(0.0, $caret->fieldHeight); $bottom = max(0.0, $caret->bottom()); - return ['bottom' => $field > 0 ? min($bottom, $field) : $bottom, 'field_height' => $field]; + return [ + 'bottom' => $field > 0 ? min($bottom, $field) : $bottom, + 'line_height' => max(0.0, $caret->height), + 'field_height' => $field, + ]; } /** - * Where the mention list's top goes in the sheet's body area: just under the caret's line, or higher when that - * would leave it room for fewer than three people above the toolbar. The room is measured to the field's bottom, - * since the field doesn't say how tall what's under it is, so with a quoted commit under it the list can go up a - * little sooner than it has to. + * The caret to keep after the field reports a new one. While the field is shorter for the list, it reports + * itself at that height, scrolled to the caret, which says nothing about where the caret is at its full height, + * so the sheet keeps what it had. Any other report is the field at its full height. * - * @param array{bottom: float, field_height: float}|null $caret + * @param array{bottom: float, line_height: float, field_height: float}|null $kept + * @param int|null $shortened how tall the sheet has made the field, or null when it fills + * @return array{bottom: float, line_height: float, field_height: float} */ - public static function mentionTop(?array $caret): int + public static function reported(Caret $caret, ?array $kept, ?int $shortened): array { - if ($caret === null) { - return self::FieldTop + self::FirstLineHeight + self::MentionGap; + if ($kept !== null && $shortened !== null && abs($caret->fieldHeight - $shortened) <= 1) { + return $kept; } - $underCaret = self::FieldTop + (int) ceil($caret['bottom']) + self::MentionGap; + return self::caret($caret); + } - if ($caret['field_height'] <= 0) { - return $underCaret; + /** The mention list's height with all its rows showing, up to six: its padding, its heading, then its rows. */ + public static function mentionHeight(int $rows, bool $heading = false): int + { + return self::MentionPadding + + ($heading ? self::MentionHeadingHeight : 0) + + min(max($rows, 1), self::MentionRowsShown) * self::MentionRowHeight; + } + + /** + * Where the mention list goes, and how tall the field is while it shows. + * + * - `field`: the field's height, or null when it fills as usual. + * - `top`: the list's top. + * - `height`: the list's height, or null when it runs down to the toolbar. + * + * With room for the whole list (up to six rows) between the caret's line and the field's bottom, it floats there + * over the field and nothing moves. Without it, the field ends on the caret's line, shortened by as much as the + * list needs but never under two lines, and the list starts under it and runs to the toolbar, over anything + * under the field (which comes up with the field's bottom). So the list never covers the caret's line. + * + * The room is measured to the field's bottom, since nothing reports how tall what's under it is. + * + * @param array{bottom: float, line_height: float, field_height: float}|null $caret + * @return array{field: int|null, top: int, height: int|null} + */ + public static function mentionLayout(?array $caret, int $rows, bool $heading = false): array + { + if ($caret === null || $caret['field_height'] <= 0) { + $line = $caret === null ? self::FirstLineHeight : (int) ceil($caret['bottom']); + + return ['field' => null, 'top' => self::FieldTop + $line + self::MentionGap, 'height' => null]; } - $lowest = self::FieldTop + (int) floor($caret['field_height']) - - self::MentionInset - self::MentionMinRows * self::MentionRowHeight - self::MentionPadding; + $list = self::mentionHeight($rows, $heading); + $field = (int) floor($caret['field_height']); + $bottom = (int) ceil($caret['bottom']); + $room = $field - $bottom - self::MentionGap - self::MentionInset; - return max(0, min($underCaret, $lowest)); + if ($room >= $list) { + return ['field' => null, 'top' => self::FieldTop + $bottom + self::MentionGap, 'height' => $list]; + } + + $line = $caret['line_height'] > 0 ? (int) ceil($caret['line_height']) : self::FirstLineHeight; + $shortened = max(self::MinFieldLines * $line, $field - self::MentionGap - self::MentionInset - $list); + + if ($shortened >= $bottom) { + // The caret is in the field's first lines already: shortening it frees nothing, so the list takes what + // room there is under the caret, at least a row. + return [ + 'field' => null, + 'top' => self::FieldTop + $bottom + self::MentionGap, + 'height' => max($room, self::MentionPadding + self::MentionRowHeight), + ]; + } + + return ['field' => $shortened, 'top' => self::FieldTop + $shortened + self::MentionGap, 'height' => null]; + } + + /** Whether the sheet's mention list has the "People you follow" heading: a bare "@" in a new commit. */ + public static function mentionHeading(?array $mention, string $view): bool + { + return ($mention['query'] ?? null) === '' && $view === 'compose'; } } diff --git a/app/NativeComponents/Concerns/OpensCommitSheet.php b/app/NativeComponents/Concerns/OpensCommitSheet.php index b4fc25af..3964a976 100644 --- a/app/NativeComponents/Concerns/OpensCommitSheet.php +++ b/app/NativeComponents/Concerns/OpensCommitSheet.php @@ -113,10 +113,10 @@ trait OpensCommitSheet public string $sheetBody = ''; /** - * Where the sheet's field last said its caret is drawn, for the mention list to float under (see ComposerSheet). - * Null until it has said, and again once the sheet is gone. + * Where the sheet's field last said its caret is drawn at its full height, for the mention list to go under (see + * ComposerSheet). Null until it has said, and again once the sheet is gone. * - * @var array{bottom: float, field_height: float}|null + * @var array{bottom: float, line_height: float, field_height: float}|null */ public ?array $sheetCaret = null; @@ -322,7 +322,26 @@ public function openScheduledCommits(): void */ public function sheetCaretMoved(Caret $caret): void { - $this->sheetCaret = ComposerSheet::caret($caret); + $this->sheetCaret = ComposerSheet::reported($caret, $this->sheetCaret, $this->sheetMentionLayout()['field'] ?? null); + } + + /** + * Where the sheet's mention list goes and how tall its field is meanwhile (see ComposerSheet::mentionLayout()), or + * null while there's no list. + * + * @return array{field: int|null, top: int, height: int|null}|null + */ + public function sheetMentionLayout(): ?array + { + if (($this->mention['field'] ?? null) !== 'sheetBody' || ($this->mentionPeople === [] && $this->mentionOrganizations === [])) { + return null; + } + + return ComposerSheet::mentionLayout( + $this->sheetCaret, + count($this->mentionPeople) + count($this->mentionOrganizations), + ComposerSheet::mentionHeading($this->mention, $this->sheetView), + ); } public function updatedSheetBody(): void diff --git a/resources/views/native/partials/commit-sheet.blade.php b/resources/views/native/partials/commit-sheet.blade.php index 55a945c9..1f21c144 100644 --- a/resources/views/native/partials/commit-sheet.blade.php +++ b/resources/views/native/partials/commit-sheet.blade.php @@ -26,10 +26,13 @@ A commit's page opens its reply here too, as "Reply to @handle", with the commit being answered as a static card over the field, for the photos and the preview its reply bar has no room for. Commit says Reply there. - While the caret is after an "@handle", the people to mention float over the field just under the caret's line, - which the field reports (@caretChange), as the web's composer lists them (see SuggestsMentions): for a bare "@" in a new commit, the people you follow, under - that heading. They cover a quoted commit too, and run down to the toolbar. The field keeps the keyboard up through - presses in the sheet (keep-focus), so picking someone leaves you typing after them. + While the caret is after an "@handle", the people to mention show as the web's composer lists them (see + SuggestsMentions): for a bare "@" in a new commit, the people you follow, under that heading. They float over the + field just under the caret's line, which the field reports (@caretChange), as tall as their rows, up to six. When + that doesn't fit above the field's bottom, the field gets shorter instead, ending on the caret's line, and the + list goes under it, down to the toolbar and over a quoted commit or poll (see ComposerSheet). The field fills + again once they're gone, and both moves are animated. The field keeps the keyboard up through presses in the sheet + (keep-focus), so picking someone leaves you typing after them. The sheet doesn't scroll. The field fills the space between the author row and the toolbar, less what's under it: the photos as a strip of 80pt squares, the poll editor, the commit being quoted, or "Submit at", each at its own @@ -105,7 +108,14 @@ @include('native.partials.quoted-commit', ['quoted' => $sheetCommit, 'static' => true, 'label' => 'Replying to']) @endif - + @php($sheetMentionsShown = ! $previewing && ($mention['field'] ?? null) === 'sheetBody' && ($mentionPeople !== [] || $mentionOrganizations !== [])) + @php($sheetMentions = $sheetMentionsShown ? $sheetLayout::mentionLayout($sheetCaret, count($mentionPeople) + count($mentionOrganizations), $sheetLayout::mentionHeading($mention, $sheetView)) : null) + {{-- + animate-layout: when the mention list comes or goes (or photos, the poll, the preview), the field + slot's new height and the parts under it slide into place rather than jump. The parts keep their + keys, so they're matched from one frame to the next. + --}} + @if ($previewing) @@ -121,7 +131,8 @@ @else - + {{-- Shorter while the mention list needs the room under it (see ComposerSheet::mentionLayout()), the slot keeps its key and place, so the field stays the same view. --}} + {{-- - The people to mention float over the field and whatever is under it, out of the layout, so - nothing moves when they come and go. They start just under the line the caret is on, where - the field says it is (see ComposerSheet::mentionTop()), and run down to the toolbar, - scrolling inside when there are more than fit. On Liquid Glass on iOS, like the reply - bar's, and on a raised surface on Android. + The people to mention, out of the layout so nothing moves when they come and go unless the + field has to make room for them: just under the caret's line, as tall as their rows, or + under the shortened field down to the toolbar (see ComposerSheet::mentionLayout()). They + scroll inside past six rows, or when even the shortened field leaves less room. On Liquid + Glass on iOS, like the reply bar's, and on a raised surface on Android. --}} - @if (($mention['field'] ?? null) === 'sheetBody' && ($mentionPeople !== [] || $mentionOrganizations !== [])) + @if ($sheetMentions !== null) @include('native.partials.mention-suggestions', [ 'field' => 'sheetBody', - 'heading' => ($mention['query'] ?? null) === '' && $sheetView === 'compose' ? 'People you follow' : null, + 'heading' => $sheetLayout::mentionHeading($mention, $sheetView) ? 'People you follow' : null, 'label' => 'Mention a developer', 'class' => 'w-full py-1', ]) diff --git a/tests/Feature/Screens/CommitMentionsTest.php b/tests/Feature/Screens/CommitMentionsTest.php index effbc57e..4ee44cb0 100644 --- a/tests/Feature/Screens/CommitMentionsTest.php +++ b/tests/Feature/Screens/CommitMentionsTest.php @@ -6,6 +6,7 @@ use Native\Mobile\Testing\Native; use Native\Mobile\Testing\TestableComponent; use Native\Mobile\UI\Caret; +use Tests\Support\LayoutAnimation; use Tests\Support\TextFieldFill; beforeEach(function () { @@ -185,7 +186,7 @@ function mentionsComposer(bool $quoting = false): TestableComponent ->assertSet('mentionPeople', []); }); -it('floats the suggestions over the quoted commit on glass, from just under the caret line down to the toolbar', function () { +it('floats the suggestions over the quoted commit on glass, just under the caret line and as tall as their rows', function () { TextFieldFill::skipUnlessSupported(); $screen = mentionsComposer(quoting: true) @@ -198,9 +199,12 @@ function mentionsComposer(bool $quoting = false): TestableComponent ->and($overlay['layout']['position'])->toEqual([ ComposerSheet::FieldTop + 44 + ComposerSheet::MentionGap, 12, - ComposerSheet::MentionInset, + null, 12, ]) + ->and($overlay['layout']['height'] ?? null)->toEqual(ComposerSheet::mentionHeight(3)) + // There's room for them under the caret, so the field still fills. + ->and(nodeByRef($screen, 'sheet-field-slot')['layout']['flex_grow'] ?? null)->toEqual(1) ->and($overlay['props']['glass'])->toBe(1) ->and(childRefs($screen, 'sheet-body-area'))->toBe(['sheet-field-slot', 'sheet-below', 'sheet-mentions']) ->and(findNode(nodeByRef($screen, 'sheet-below'), fn (array $node): bool => ($node['ref'] ?? null) === 'quote-card'))->not->toBeNull() @@ -209,6 +213,42 @@ function mentionsComposer(bool $quoting = false): TestableComponent ->and(childRefs($screen, 'mention-suggestions'))->toBe(['mention-ada', 'mention-adam', 'mention-adaptive']); }); +it('shortens the field to end on the caret line when the suggestions would not fit under it, and fills it again once they go', function () { + TextFieldFill::skipUnlessSupported(); + + $screen = mentionsComposer(quoting: true)->input('sheet-body', "see\n\n\n\n\n\n\n\n@a", 14); + $field = idsDownTo($screen->tree(), 'sheet-body'); + + // The caret's line ends 20pt above the field's bottom, where three people don't fit. + $screen->moveCaretTo('sheet-body', new Caret(x: 20, y: 196, width: 2, height: 24, line: 8, fieldWidth: 350, fieldHeight: 240)); + $shortened = 240 - ComposerSheet::MentionGap - ComposerSheet::MentionInset - ComposerSheet::mentionHeight(3); + $overlay = nodeByRef($screen, 'sheet-mentions'); + + expect(nodeByRef($screen, 'sheet-field-slot')['layout']['height'] ?? null)->toEqual(ComposerSheet::FieldTop + $shortened) + ->and(nodeByRef($screen, 'sheet-field-slot')['layout']['flex_grow'] ?? 0)->toEqual(0) + // Under the shortened field, so off the caret's line, and down to the toolbar over the quoted commit. + ->and($overlay['layout']['position'])->toEqual([ComposerSheet::FieldTop + $shortened + ComposerSheet::MentionGap, 12, ComposerSheet::MentionInset, 12]) + ->and(childRefs($screen, 'sheet-body-area'))->toBe(['sheet-field-slot', 'sheet-below', 'sheet-mentions']) + ->and(idsDownTo($screen->tree(), 'sheet-body'))->toBe($field); + + // The shortened field reports its caret at its new height, which doesn't move anything. + $screen->moveCaretTo('sheet-body', new Caret(x: 20, y: $shortened - 24, width: 2, height: 24, line: 8, fieldWidth: 350, fieldHeight: $shortened)) + ->assertSet('sheetCaret', ['bottom' => 220.0, 'line_height' => 24.0, 'field_height' => 240.0]); + + // Picked, the list goes and the field fills again, the same view. + $screen->tap('mention-ada'); + expect(findNode($screen->tree(), fn (array $node): bool => ($node['ref'] ?? null) === 'sheet-mentions'))->toBeNull() + ->and(nodeByRef($screen, 'sheet-field-slot')['layout']['flex_grow'] ?? null)->toEqual(1) + ->and(nodeByRef($screen, 'sheet-field-slot')['layout'])->not->toHaveKey('height') + ->and(idsDownTo($screen->tree(), 'sheet-body'))->toBe($field); +}); + +it('animates the field and the suggestions moving in the sheet', function () { + LayoutAnimation::skipUnlessSupported(); + + expect(nodeByRef(mentionsComposer(), 'sheet-body-area')['props'])->toHaveKey('animate_layout', true); +}); + it('draws the floating suggestions on a raised surface on Android', function () { fakeApi([ 'GET /api/v1/log/following' => [pageJson([])], diff --git a/tests/Feature/Screens/ComposeSheetTest.php b/tests/Feature/Screens/ComposeSheetTest.php index 100b5877..1bfc7e9b 100644 --- a/tests/Feature/Screens/ComposeSheetTest.php +++ b/tests/Feature/Screens/ComposeSheetTest.php @@ -312,7 +312,7 @@ function sheetCommitDisabled(TestableComponent $screen): bool $screen = composeSheetOnLog() ->moveCaretTo('sheet-body', new Caret(y: 48, height: 24, line: 2, fieldWidth: 350, fieldHeight: 240)) - ->assertSet('sheetCaret', ['bottom' => 72.0, 'field_height' => 240.0]); + ->assertSet('sheetCaret', ['bottom' => 72.0, 'line_height' => 24.0, 'field_height' => 240.0]); $screen->press('hideCommitSheet')->assertSet('sheetCaret', null); }); diff --git a/tests/Support/LayoutAnimation.php b/tests/Support/LayoutAnimation.php new file mode 100644 index 00000000..155686c8 --- /dev/null +++ b/tests/Support/LayoutAnimation.php @@ -0,0 +1,25 @@ +markTestSkipped('Needs a mobile-air with layout animation (NativePHP/mobile-air#736)'); + } + } +} diff --git a/tests/Unit/Devnull/ComposerSheetTest.php b/tests/Unit/Devnull/ComposerSheetTest.php index 28ccd184..8832a306 100644 --- a/tests/Unit/Devnull/ComposerSheetTest.php +++ b/tests/Unit/Devnull/ComposerSheetTest.php @@ -6,25 +6,81 @@ beforeEach(fn () => TextFieldFill::skipUnlessSupported()); -it('starts the mention list just under the line the field says the caret is on', function () { - $caret = ComposerSheet::caret(new Caret(y: 48, height: 24, line: 2, fieldHeight: 300)); +/** A field 360pt tall, as on a phone with the keyboard up, with its caret's line ending at $bottom. */ +function composerCaret(float $bottom, float $fieldHeight = 360): array +{ + return ComposerSheet::caret(new Caret(y: $bottom - 24, height: 24, fieldHeight: $fieldHeight)); +} - expect(ComposerSheet::mentionTop($caret))->toBe(ComposerSheet::FieldTop + 72 + ComposerSheet::MentionGap); +it('floats the list just under the caret, as tall as its rows, when they fit above the field\'s bottom', function () { + $layout = ComposerSheet::mentionLayout(composerCaret(72), rows: 3); + + expect($layout)->toBe([ + 'field' => null, + 'top' => ComposerSheet::FieldTop + 72 + ComposerSheet::MentionGap, + 'height' => ComposerSheet::MentionPadding + 3 * ComposerSheet::MentionRowHeight, + ]); +}); + +it('holds the list to six rows, plus its heading, and scrolls the rest', function () { + expect(ComposerSheet::mentionHeight(10))->toBe(ComposerSheet::MentionPadding + 6 * ComposerSheet::MentionRowHeight) + ->and(ComposerSheet::mentionHeight(2, heading: true))->toBe(ComposerSheet::MentionPadding + ComposerSheet::MentionHeadingHeight + 2 * ComposerSheet::MentionRowHeight); +}); + +it('shortens the field to end on the caret\'s line when the list would not fit under it, and puts the list under the field', function () { + // The caret low in the field, as in build 42: six people need 272pt, and there's 360 - 300 under the caret. + $layout = ComposerSheet::mentionLayout(composerCaret(300), rows: 8); + $list = ComposerSheet::mentionHeight(8); + $field = 360 - ComposerSheet::MentionGap - ComposerSheet::MentionInset - $list; + + expect($layout)->toBe(['field' => $field, 'top' => ComposerSheet::FieldTop + $field + ComposerSheet::MentionGap, 'height' => null]) + // The list starts under the caret's line, never over it: the field ends on that line. + ->and($layout['top'])->toBeGreaterThan(ComposerSheet::FieldTop + $layout['field']) + // And the list has its six rows from there to the toolbar. + ->and(ComposerSheet::FieldTop + 360 - ComposerSheet::MentionInset - $layout['top'])->toBe($list); +}); + +it('shortens the field only as far as the list needs', function () { + $layout = ComposerSheet::mentionLayout(composerCaret(300), rows: 2); + + expect($layout['field'])->toBe(360 - ComposerSheet::MentionGap - ComposerSheet::MentionInset - ComposerSheet::mentionHeight(2)) + ->and($layout['field'])->toBeLessThan(300); +}); + +it('keeps two lines of field on a short phone, and the list scrolls in what\'s left', function () { + $layout = ComposerSheet::mentionLayout(composerCaret(140, fieldHeight: 160), rows: 6); + + expect($layout)->toBe(['field' => ComposerSheet::MinFieldLines * 24, 'top' => ComposerSheet::FieldTop + 48 + ComposerSheet::MentionGap, 'height' => null]); +}); + +it('leaves the field alone when the caret is already in its first lines', function () { + $layout = ComposerSheet::mentionLayout(composerCaret(24, fieldHeight: 160), rows: 6); + + expect($layout['field'])->toBeNull() + ->and($layout['top'])->toBe(ComposerSheet::FieldTop + 24 + ComposerSheet::MentionGap) + ->and($layout['height'])->toBe(160 - 24 - ComposerSheet::MentionGap - ComposerSheet::MentionInset); }); -it('moves the list up when the caret is too near the field\'s bottom to leave room for three people', function () { - $lowest = ComposerSheet::FieldTop + 300 - ComposerSheet::MentionInset - ComposerSheet::MentionMinRows * ComposerSheet::MentionRowHeight - ComposerSheet::MentionPadding; +it('keeps where the caret is at the field\'s full height while the field is shortened', function () { + $kept = composerCaret(300); + $shortened = ComposerSheet::mentionLayout($kept, rows: 8)['field']; - expect(ComposerSheet::mentionTop(ComposerSheet::caret(new Caret(y: 264, height: 24, fieldHeight: 300))))->toBe($lowest) - // A field too short for three people puts the list at the top of it. - ->and(ComposerSheet::mentionTop(ComposerSheet::caret(new Caret(y: 24, height: 24, fieldHeight: 80))))->toBe(0); + // The shortened field reports itself scrolled to the caret: that's not where the caret is at full height. + expect(ComposerSheet::reported(new Caret(y: $shortened - 24, height: 24, fieldHeight: $shortened), $kept, $shortened))->toBe($kept) + // A report at another height is the field at its full height again. + ->and(ComposerSheet::reported(new Caret(y: 48, height: 24, fieldHeight: 360), $kept, $shortened))->toBe(composerCaret(72)) + ->and(ComposerSheet::reported(new Caret(y: 48, height: 24, fieldHeight: 360), $kept, null))->toBe(composerCaret(72)); }); it('keeps a caret the field has scrolled out of view to the field\'s edges', function () { - expect(ComposerSheet::caret(new Caret(y: -60, height: 24, fieldHeight: 300)))->toBe(['bottom' => 0.0, 'field_height' => 300.0]) - ->and(ComposerSheet::caret(new Caret(y: 400, height: 24, fieldHeight: 300)))->toBe(['bottom' => 300.0, 'field_height' => 300.0]); + expect(ComposerSheet::caret(new Caret(y: -60, height: 24, fieldHeight: 300)))->toBe(['bottom' => 0.0, 'line_height' => 24.0, 'field_height' => 300.0]) + ->and(ComposerSheet::caret(new Caret(y: 400, height: 24, fieldHeight: 300)))->toBe(['bottom' => 300.0, 'line_height' => 24.0, 'field_height' => 300.0]); }); -it('puts the list under about one line before the field has said where its caret is', function () { - expect(ComposerSheet::mentionTop(null))->toBe(ComposerSheet::FieldTop + ComposerSheet::FirstLineHeight + ComposerSheet::MentionGap); +it('puts the list under about one line, down to the toolbar, before the field has said where its caret is', function () { + expect(ComposerSheet::mentionLayout(null, rows: 3))->toBe([ + 'field' => null, + 'top' => ComposerSheet::FieldTop + ComposerSheet::FirstLineHeight + ComposerSheet::MentionGap, + 'height' => null, + ]); }); From f9832b557bb57d5fe2e1f6c8aa2a3aa3ca22ba13 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 10:59:08 +0000 Subject: [PATCH 29/46] Let a caller that scrolls the mention list itself turn off its inner scroll The composer sheet in #198 sizes its mention list and scrolls it. With more than six rows the partial's own six-row scroll view sat inside that one, so a short phone showed two scroll bars. 'scrolls' => false draws every row as tall as it is with no scroll view inside. It defaults to true, so the reply bar and the conversation bar keep their six-row list. Co-Authored-By: Claude Opus 5.5 --- .../partials/mention-suggestions.blade.php | 6 ++- .../Screens/MentionSuggestionsTest.php | 54 +++++++++++++++++++ .../views/mention-suggestions.blade.php | 4 ++ 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 tests/Feature/Screens/MentionSuggestionsTest.php create mode 100644 tests/Fixtures/views/mention-suggestions.blade.php diff --git a/resources/views/native/partials/mention-suggestions.blade.php b/resources/views/native/partials/mention-suggestions.blade.php index 5ed8a646..93dbf174 100644 --- a/resources/views/native/partials/mention-suggestions.blade.php +++ b/resources/views/native/partials/mention-suggestions.blade.php @@ -8,7 +8,9 @@ At most six rows show (Display::MentionRowsShown). Past that the rows scroll inside a list that tall, so the list never pushes the field and the bar's buttons down under the keyboard. Fewer, and it's only as tall as its rows. Each row is then exactly a row's height (Display::MentionRowHeight), so six fill the list. The rows sit inside the - list's own column, so the slot around it, and the field's row beside that, stay where they are. + list's own column, so the slot around it, and the field's row beside that, stay where they are. A caller that + scrolls the list itself (the composer sheet sizes and scrolls its own) passes 'scrolls' => false, and every row is + drawn as tall as it is, with no scroll view inside. --}} @if (($mention['field'] ?? null) === $field && ($mentionPeople !== [] || $mentionOrganizations !== [])) @@ -16,7 +18,7 @@ {{ $heading }} @endif @php($mentionRows = [...array_map(fn ($user) => [$user, true], $mentionPeople), ...array_map(fn ($user) => [$user, false], $mentionOrganizations)]) - @php($mentionScrolls = count($mentionRows) > \App\Devnull\Display::MentionRowsShown) + @php($mentionScrolls = ($scrolls ?? true) && count($mentionRows) > \App\Devnull\Display::MentionRowsShown) @if ($mentionScrolls) @endif diff --git a/tests/Feature/Screens/MentionSuggestionsTest.php b/tests/Feature/Screens/MentionSuggestionsTest.php new file mode 100644 index 00000000..04a7eb65 --- /dev/null +++ b/tests/Feature/Screens/MentionSuggestionsTest.php @@ -0,0 +1,54 @@ + 'body', 'start' => 0, 'query' => 'ada', 'text' => '@ada']; + + /** @var list */ + public array $mentionPeople = []; + + /** @var list */ + public array $mentionOrganizations = []; + + /** @var array */ + public array $options = []; + + public function mount(int $rows = 8, array $options = []): void + { + $this->mentionPeople = array_map(fn (int $n): User => User::fromArray(userJson(['id' => "u{$n}", 'handle' => "ada{$n}", 'name' => "Ada {$n}"])), range(1, $rows)); + $this->options = $options; + } + + public function pickMention(string $field, string $username): void {} + + public function render(): View + { + return view('fixtures::mention-suggestions', ['options' => $this->options]); + } +} + +beforeEach(fn () => view()->addNamespace('fixtures', base_path('tests/Fixtures/views'))); + +it('scrolls more than six rows inside the list by default', function () { + $screen = Native::test(MentionSuggestionsFixture::class, ['rows' => 8]); + + expect(childRefs($screen, 'mention-suggestions'))->toBe(['mention-scroll']) + ->and(nodeByRef($screen, 'mention-scroll')['type'])->toBe('scroll_view'); +}); + +it('draws every row with no scroll view inside when the caller scrolls the list itself', function () { + $screen = Native::test(MentionSuggestionsFixture::class, ['rows' => 8, 'options' => ['scrolls' => false]]); + + expect(rendersRef($screen, 'mention-scroll'))->toBeFalse() + ->and(childRefs($screen, 'mention-suggestions'))->toBe(array_map(fn (int $n): string => "mention-ada{$n}", range(1, 8))) + ->and(nodeByRef($screen, 'mention-ada8')['children'][0]['layout']['height'] ?? null)->toBeNull(); +}); diff --git a/tests/Fixtures/views/mention-suggestions.blade.php b/tests/Fixtures/views/mention-suggestions.blade.php new file mode 100644 index 00000000..d29b0fbf --- /dev/null +++ b/tests/Fixtures/views/mention-suggestions.blade.php @@ -0,0 +1,4 @@ +{{-- The mention list alone, for MentionSuggestionsTest: the partial with whatever options the test passes. --}} + + @include('native.partials.mention-suggestions', ['field' => 'body', ...$options]) + From 75cb547a4c2f8d66b6a9898882f82c252a7d6f4d Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 11:00:46 +0000 Subject: [PATCH 30/46] Ask the sheet's mention list not to scroll inside its own scroll view The sheet sizes its mention list and scrolls it. #196 gives the shared mention list a six-row scroll view of its own, so once both are merged a list of more than six would show two scroll bars on a short phone. The sheet now passes 'scrolls' => false, which #196 adds. Before #196 merges the partial ignores it. Co-Authored-By: Claude Opus 5.5 --- .../native/partials/commit-sheet.blade.php | 2 ++ tests/Feature/Screens/CommitMentionsTest.php | 21 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/resources/views/native/partials/commit-sheet.blade.php b/resources/views/native/partials/commit-sheet.blade.php index 1f21c144..752f5022 100644 --- a/resources/views/native/partials/commit-sheet.blade.php +++ b/resources/views/native/partials/commit-sheet.blade.php @@ -191,6 +191,8 @@ class="absolute left-[12] right-[12] top-[{{ $sheetMentions['top'] }}] {{ $sheet 'heading' => $sheetLayout::mentionHeading($mention, $sheetView) ? 'People you follow' : null, 'label' => 'Mention a developer', 'class' => 'w-full py-1', + // This scroll view scrolls them; the partial's own six-row one would be a second. + 'scrolls' => false, ]) diff --git a/tests/Feature/Screens/CommitMentionsTest.php b/tests/Feature/Screens/CommitMentionsTest.php index 4ee44cb0..471b2886 100644 --- a/tests/Feature/Screens/CommitMentionsTest.php +++ b/tests/Feature/Screens/CommitMentionsTest.php @@ -74,11 +74,11 @@ function mentionsCommitPage(?array $mentions = null): TestableComponent * The Log, with Ada's c1 in it and devnull's mention search answering, and the composer sheet open: for a new commit, * or for a quote of c1. */ -function mentionsComposer(bool $quoting = false): TestableComponent +function mentionsComposer(bool $quoting = false, ?array $mentions = null): TestableComponent { fakeApi([ 'GET /api/v1/log/following' => [pageJson([commitJson(['id' => 'c1', 'body' => 'Required reading.', 'author' => userJson(['id' => 'u2', 'handle' => 'ada', 'name' => 'Ada Lovelace'])])])], - 'GET /api/v1/search/mentions' => mentionsFound(), + 'GET /api/v1/search/mentions' => $mentions ?? mentionsFound(), ]); $screen = Native::visit('/log', platform: 'ios'); @@ -213,6 +213,23 @@ function mentionsComposer(bool $quoting = false): TestableComponent ->and(childRefs($screen, 'mention-suggestions'))->toBe(['mention-ada', 'mention-adam', 'mention-adaptive']); }); +it('scrolls a long list of suggestions in the sheet with one scroll view, its own', function () { + TextFieldFill::skipUnlessSupported(); + + $people = array_map(fn (int $n): array => userJson(['id' => "u{$n}", 'handle' => "ada{$n}", 'name' => "Ada {$n}"]), range(1, 9)); + $screen = mentionsComposer(mentions: [['data' => $people]]) + ->input('sheet-body', "see\n\n\n\n\n\n@a", 12) + ->moveCaretTo('sheet-body', new Caret(x: 20, y: 132, width: 2, height: 22, line: 6, fieldWidth: 350, fieldHeight: 240)); + $overlay = nodeByRef($screen, 'sheet-mentions'); + + // Nine rows is past the six the mention list scrolls by itself, but the sheet scrolls it already, so there is no + // second scroll view inside (two scroll bars on a short phone). + expect(findNodes($overlay, fn (array $node): bool => $node['type'] === 'scroll_view'))->toHaveCount(1) + ->and(nodeByRef($screen, 'sheet-mentions-scroll')['type'])->toBe('scroll_view') + ->and(rendersRef($screen, 'mention-scroll'))->toBeFalse() + ->and(childRefs($screen, 'mention-suggestions'))->toBe(array_map(fn (int $n): string => "mention-ada{$n}", range(1, 9))); +}); + it('shortens the field to end on the caret line when the suggestions would not fit under it, and fills it again once they go', function () { TextFieldFill::skipUnlessSupported(); From 35539b340be36321a315e24b0ac1f84d18288d8c Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 12:44:33 +0000 Subject: [PATCH 31/46] Show the handle under the name in the Post as menu Each row of the Post as menu was "Simon (@simon-hamp)", which wrapped onto two lines. Now the name is the row's label and the handle is a subtitle under it, smaller, on iOS and Android. Screen readers read the name and then the handle. It's the same menu in the New commit sheet, the reply bar and the quote composer. Needs NativePHP/mobile-ui#228 (MenuItem::subtitle). With an older mobile-ui the row keeps the combined label, and the subtitle test skips (tests/Support/MenuSubtitle). Co-Authored-By: Claude Opus 5.5 --- app/Devnull/PostAs.php | 21 +++++++++++++-- tests/Feature/Screens/PostAsTest.php | 40 ++++++++++++++++++++++++---- tests/Support/MenuSubtitle.php | 32 ++++++++++++++++++++++ 3 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 tests/Support/MenuSubtitle.php diff --git a/app/Devnull/PostAs.php b/app/Devnull/PostAs.php index d57f5fb7..b2a89ee3 100644 --- a/app/Devnull/PostAs.php +++ b/app/Devnull/PostAs.php @@ -6,6 +6,7 @@ use App\Icons\Lucide; use Native\Mobile\Edge\Elements\TopBarAction; use Native\Mobile\Edge\Layouts\Builders\NavAction; +use Native\Mobile\UI\MenuItem; /** * Who a composer posts as, as the web's Post as menu chooses: you, or one of @@ -60,6 +61,9 @@ public static function offered(?string $picked): bool * an organization, as elsewhere in the app, and the one posting now ticked. Until an avatar loads, or if it * can't, a person or building icon stands in. $method is called with the handle picked, or '' for you. * + * Each row is the name with the handle under it, smaller, which screen readers read after the name. A mobile-ui + * without menu subtitles (before NativePHP/mobile-ui#228) gets one label, "Simon (@simon-hamp)", instead. + * * @return list */ public static function menu(User $me, ?User $author, string $method): array @@ -67,8 +71,11 @@ public static function menu(User $me, ?User $author, string $method): array return array_map(function (User $identity) use ($author, $method): TopBarAction { $icon = $identity->isOrganization ? Lucide::Building2 : Lucide::UserRound; - return NavAction::make('post-as-'.$identity->username) - ->label($identity->name.' (@'.$identity->username.')') + $handle = '@'.$identity->username; + $subtitled = self::subtitles(); + + $row = NavAction::make('post-as-'.$identity->username) + ->label($subtitled ? $identity->name : $identity->name.' ('.$handle.')') ->icon(ios: $icon->ios(), android: $icon->android()) ->image(ImageCache::src($identity->avatarUrl)) ->press($method."('".($identity->isOrganization ? $identity->username : '')."')") @@ -76,9 +83,19 @@ public static function menu(User $me, ?User $author, string $method): array ->setProp('image_shape', $identity->isOrganization ? 'rounded' : 'circle') ->setProp('checked', self::posting($identity, $author)) ->ref('post-as-'.$identity->username); + + return $subtitled ? MenuItem::subtitle($row, $handle) : $row; }, [$me, ...self::organizations()]); } + /** + * Whether the installed mobile-ui draws a subtitle under a menu row's label. + */ + private static function subtitles(): bool + { + return class_exists(MenuItem::class); + } + /** * What the composer's avatar says to a screen reader. */ diff --git a/tests/Feature/Screens/PostAsTest.php b/tests/Feature/Screens/PostAsTest.php index 21550679..3933b5eb 100644 --- a/tests/Feature/Screens/PostAsTest.php +++ b/tests/Feature/Screens/PostAsTest.php @@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Http; use Native\Mobile\Testing\Native; use Native\Mobile\Testing\TestableComponent; +use Tests\Support\MenuSubtitle; beforeEach(function () { config(['devnull.url' => 'http://devnull.test']); @@ -68,6 +69,18 @@ function composeOnLogAs(?array $answer = null, array $extra = []): TestableCompo return Native::visit('/log', platform: 'ios')->press('composeInSheet'); } +/** + * The Post as menu a pressable opens, as each row's ref, label and subtitle. + * + * @return list + */ +function postAsRows(TestableComponent $screen, string $ref): array +{ + $rows = array_filter(nodeByRef($screen, $ref)['children'] ?? [], fn (array $child): bool => ($child['type'] ?? null) === 'top_bar_action'); + + return array_values(array_map(fn (array $row): array => [$row['ref'] ?? null, $row['props']['label'] ?? null, $row['props']['subtitle'] ?? null], $rows)); +} + /** * The JSON of the commits sent to devnull. * @@ -157,11 +170,7 @@ function commitsSent(): array expect(nodeByRef($screen, 'sheet-post-as-name')['props']['text'])->toBe('Local Dev') ->and(nodeByRef($screen, 'sheet-post-as-handle')['props']['text'])->toBe('@local_dev') ->and(nodeByRef($screen, 'sheet-post-as')['props']['a11y_label'])->toBe('Posting as @local_dev. Choose who to post as') - ->and(array_map(fn (array $item): array => [$item[0], $item[1]], menuItems($screen, 'sheet-post-as')))->toBe([ - ['post-as-local_dev', 'Local Dev (@local_dev)'], - ['post-as-dev-null-sh', '/dev/null (@dev-null-sh)'], - ['post-as-nativephp', 'NativePHP (@nativephp)'], - ]); + ->and(array_column(menuItems($screen, 'sheet-post-as'), 0))->toBe(['post-as-local_dev', 'post-as-dev-null-sh', 'post-as-nativephp']); $screen->call('postAsInSheet', 'nativephp'); @@ -178,6 +187,27 @@ function commitsSent(): array expect(sheetButtonCircle($screen, 'sheet-commit')['style']['bg_color'])->not->toBe($organizationFill); }); +it('names each account in the Post as menu, with its handle under the name', function () { + MenuSubtitle::skipUnlessSupported(); + memberOf([memberOrganizationJson(), memberOrganizationJson(['id' => 'o2', 'handle' => 'nativephp', 'name' => 'NativePHP', 'role' => 'member'])]); + + expect(postAsRows(composeOnLogAs(), 'sheet-post-as'))->toBe([ + ['post-as-local_dev', 'Local Dev', '@local_dev'], + ['post-as-dev-null-sh', '/dev/null', '@dev-null-sh'], + ['post-as-nativephp', 'NativePHP', '@nativephp'], + ]); +}); + +it('puts the handle in the label when mobile-ui has no menu subtitles', function () { + MenuSubtitle::skipIfSupported(); + memberOf([memberOrganizationJson()]); + + expect(postAsRows(composeOnLogAs(), 'sheet-post-as'))->toBe([ + ['post-as-local_dev', 'Local Dev (@local_dev)', null], + ['post-as-dev-null-sh', '/dev/null (@dev-null-sh)', null], + ]); +}); + it('commits as the organization picked, and shows it staged as the organization', function () { memberOf([memberOrganizationJson()]); holdRefreshes(); diff --git a/tests/Support/MenuSubtitle.php b/tests/Support/MenuSubtitle.php new file mode 100644 index 00000000..78e96866 --- /dev/null +++ b/tests/Support/MenuSubtitle.php @@ -0,0 +1,32 @@ +markTestSkipped('Needs a mobile-ui that draws menu row subtitles (NativePHP/mobile-ui#228)'); + } + } + + public static function skipIfSupported(): void + { + if (self::supported()) { + test()->markTestSkipped('The installed mobile-ui draws menu row subtitles, so the menu never falls back to one label'); + } + } +} From 1d72a7703e8633b222deb2ba7735fad793352950 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 13:23:56 +0000 Subject: [PATCH 32/46] Set the Post as handle with core's NavAction::subtitle() Core now has NavAction::subtitle() (NativePHP/mobile-air#740), and mobile-ui#228 dropped its MenuItem::subtitle() stop-gap. PostAs::menu() calls ->subtitle('@handle') on the row, and falls back to the combined "Name (@handle)" label when the installed core has no subtitle(). The tests skip on the same check (tests/Support/MenuSubtitle). Co-Authored-By: Claude Opus 5.5 --- app/Devnull/PostAs.php | 20 +++++++++++--------- tests/Feature/Screens/PostAsTest.php | 2 +- tests/Support/MenuSubtitle.php | 14 +++++++------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/app/Devnull/PostAs.php b/app/Devnull/PostAs.php index b2a89ee3..26711721 100644 --- a/app/Devnull/PostAs.php +++ b/app/Devnull/PostAs.php @@ -6,7 +6,6 @@ use App\Icons\Lucide; use Native\Mobile\Edge\Elements\TopBarAction; use Native\Mobile\Edge\Layouts\Builders\NavAction; -use Native\Mobile\UI\MenuItem; /** * Who a composer posts as, as the web's Post as menu chooses: you, or one of @@ -61,8 +60,8 @@ public static function offered(?string $picked): bool * an organization, as elsewhere in the app, and the one posting now ticked. Until an avatar loads, or if it * can't, a person or building icon stands in. $method is called with the handle picked, or '' for you. * - * Each row is the name with the handle under it, smaller, which screen readers read after the name. A mobile-ui - * without menu subtitles (before NativePHP/mobile-ui#228) gets one label, "Simon (@simon-hamp)", instead. + * Each row is the name with the handle under it, smaller, which screen readers read after the name. A core + * without NavAction::subtitle() (before NativePHP/mobile-air#740) gets one label, "Simon (@simon-hamp)", instead. * * @return list */ @@ -78,22 +77,25 @@ public static function menu(User $me, ?User $author, string $method): array ->label($subtitled ? $identity->name : $identity->name.' ('.$handle.')') ->icon(ios: $icon->ios(), android: $icon->android()) ->image(ImageCache::src($identity->avatarUrl)) - ->press($method."('".($identity->isOrganization ? $identity->username : '')."')") - ->toElement() + ->press($method."('".($identity->isOrganization ? $identity->username : '')."')"); + + if ($subtitled) { + $row->subtitle($handle); + } + + return $row->toElement() ->setProp('image_shape', $identity->isOrganization ? 'rounded' : 'circle') ->setProp('checked', self::posting($identity, $author)) ->ref('post-as-'.$identity->username); - - return $subtitled ? MenuItem::subtitle($row, $handle) : $row; }, [$me, ...self::organizations()]); } /** - * Whether the installed mobile-ui draws a subtitle under a menu row's label. + * Whether the installed core can give a menu row a subtitle under its label. */ private static function subtitles(): bool { - return class_exists(MenuItem::class); + return method_exists(NavAction::class, 'subtitle'); } /** diff --git a/tests/Feature/Screens/PostAsTest.php b/tests/Feature/Screens/PostAsTest.php index 3933b5eb..700b2202 100644 --- a/tests/Feature/Screens/PostAsTest.php +++ b/tests/Feature/Screens/PostAsTest.php @@ -198,7 +198,7 @@ function commitsSent(): array ]); }); -it('puts the handle in the label when mobile-ui has no menu subtitles', function () { +it('puts the handle in the label when core has no menu row subtitles', function () { MenuSubtitle::skipIfSupported(); memberOf([memberOrganizationJson()]); diff --git a/tests/Support/MenuSubtitle.php b/tests/Support/MenuSubtitle.php index 78e96866..4ad7d904 100644 --- a/tests/Support/MenuSubtitle.php +++ b/tests/Support/MenuSubtitle.php @@ -2,31 +2,31 @@ namespace Tests\Support; -use Native\Mobile\UI\MenuItem; +use Native\Mobile\Edge\Layouts\Builders\NavAction; /** - * Whether the installed mobile-ui draws a subtitle under a menu row's label (`MenuItem::subtitle()`, from - * NativePHP/mobile-ui#228). Without it the Post as menu puts the handle in the label, "Simon (@simon-hamp)", - * so the tests of the subtitle skip. + * Whether the installed core can give a menu row a subtitle (`NavAction::subtitle()`, from NativePHP/mobile-air#740; + * mobile-ui draws it since NativePHP/mobile-ui#228). Without it the Post as menu puts the handle in the label, + * "Simon (@simon-hamp)", so the tests of the subtitle skip. */ final class MenuSubtitle { public static function supported(): bool { - return class_exists(MenuItem::class); + return method_exists(NavAction::class, 'subtitle'); } public static function skipUnlessSupported(): void { if (! self::supported()) { - test()->markTestSkipped('Needs a mobile-ui that draws menu row subtitles (NativePHP/mobile-ui#228)'); + test()->markTestSkipped('Needs a core with NavAction::subtitle() (NativePHP/mobile-air#740)'); } } public static function skipIfSupported(): void { if (self::supported()) { - test()->markTestSkipped('The installed mobile-ui draws menu row subtitles, so the menu never falls back to one label'); + test()->markTestSkipped('The installed core has NavAction::subtitle(), so the menu never falls back to one label'); } } } From de4235bed5ec8e8920c23898f8ce779dcff611db Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 22 Nov 2026 10:23:02 +0000 Subject: [PATCH 33/46] Blur what scrolls under the composer bars with iOS 26's scroll edge effect Both composer bars now carry scroll-edge-soft next to glass/80. With a mobile-air that knows the class, iOS 26 and later draw the system scroll edge effect under the bar, a progressive blur like the one under its own toolbars, and the bar drops its fade row and the tint on its rows so the effect shows. Older iOS keeps the fade over glass, and Android its fade over the surface. Which iOS the phone runs comes from System::osVersion(). Without a mobile-air that has it, every iOS keeps the fade, and the new tests skip (tests/Support/ScrollEdge.php). Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Display.php | 52 ++++++++++++++++++- app/NativeComponents/Conversation.php | 2 +- .../views/native/commit-detail.blade.php | 7 +-- resources/views/native/conversation.blade.php | 5 +- .../native/partials/composer-fade.blade.php | 3 +- .../Devnull/ComposerScrollEdgeTest.php | 45 ++++++++++++++++ tests/Feature/Screens/CommitDetailTest.php | 29 +++++++++++ tests/Feature/Screens/RemotesComposerTest.php | 17 ++++++ tests/Support/ScrollEdge.php | 48 +++++++++++++++++ 9 files changed, 199 insertions(+), 9 deletions(-) create mode 100644 tests/Feature/Devnull/ComposerScrollEdgeTest.php create mode 100644 tests/Support/ScrollEdge.php diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index 6648e4e7..32e9d307 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -5,6 +5,7 @@ use App\Devnull\Data\CommitBody; use Carbon\CarbonImmutable; use Carbon\CarbonInterface; +use Native\Mobile\Facades\System; use Native\Mobile\Platform; /** @@ -50,6 +51,11 @@ final class Display */ public const int ComposerGlassOpacity = 80; + /** + * The first iOS whose scroll views draw a scroll edge effect under a bar (see hasScrollEdge()). + */ + public const int ScrollEdgeIosVersion = 26; + /** * About how many characters fit on a line of the box's field, which runs the width of the box. */ @@ -253,7 +259,7 @@ public static function maskedKey(string $openSsh): string */ public static function replyBarClearance(string $draft, bool $hasPhotos = false, bool $describing = false): int { - return self::ComposerFadeHeight + return self::composerFadeHeight() + self::ComposerBoxBarHeight + self::composerBoxGrowth($draft) + ($hasPhotos ? self::ReplyBarPhotosHeight : 0) @@ -302,6 +308,40 @@ public static function fadesInBar(): bool return Platform::isIos(); } + /** + * Whether the composer bars stand on iOS's own scroll edge effect: iOS 26 and later blur what scrolls under the + * bar progressively, as under its own toolbars, from the bar's scroll-edge-soft class (see composerBarGlass()). + * That stands in for the fade and the tinted glass, so a bar there draws neither and lets the effect show. Older + * iOS keeps the fade over glass, and Android its fade over the surface. + * + * It needs a mobile-air that draws the effect for a bottom bar and says which iOS the phone runs + * (System::osVersion()). Without one this is false and every iOS keeps the fade. + */ + public static function hasScrollEdge(): bool + { + if (! Platform::isIos() || ! method_exists(\Native\Mobile\System::class, 'osVersion')) { + return false; + } + + return (int) System::osVersion() >= self::ScrollEdgeIosVersion; + } + + /** + * Whether a composer bar draws partials/composer-fade as its first row: on iOS, before the scroll edge effect. + */ + public static function fadeRowInBar(): bool + { + return self::fadesInBar() && ! self::hasScrollEdge(); + } + + /** + * How tall the composer fade is where it's drawn: none where the scroll edge effect replaces it. + */ + public static function composerFadeHeight(): int + { + return self::hasScrollEdge() ? 0 : self::ComposerFadeHeight; + } + /** * The classes for a composer's native:bottom-bar. On iOS that's Liquid Glass: what scrolls under the bar shows * through it, blurred. A patched mobile-air draws the glass behind the whole bar, under the home indicator too, @@ -309,10 +349,14 @@ public static function fadesInBar(): bool * an element can't be faded, and stops short of the home indicator. The glass stops at ComposerGlassOpacity * percent (glass/N), so a little of the screen under the bar shows through. Android has no glass, so the bar * stays the surface there. + * + * scroll-edge-soft asks iOS 26 and later for its scroll edge effect under the bar instead, a progressive blur + * like the one under its own toolbars, and a patched mobile-air leaves the glass out there (see hasScrollEdge()). + * Older iOS ignores it and keeps the glass. */ public static function composerBarGlass(): string { - return self::fadesInBar() ? 'glass/'.self::ComposerGlassOpacity : ''; + return self::fadesInBar() ? 'glass/'.self::ComposerGlassOpacity.' scroll-edge-soft' : ''; } /** @@ -333,6 +377,10 @@ public static function composerBar(): string */ public static function composerSurface(): string { + if (self::hasScrollEdge()) { + return ''; + } + return self::fadesInBar() ? 'bg-theme-surface/'.self::ComposerGlassTint : 'bg-theme-surface'; } diff --git a/app/NativeComponents/Conversation.php b/app/NativeComponents/Conversation.php index 3f8767e5..8bd97c9b 100644 --- a/app/NativeComponents/Conversation.php +++ b/app/NativeComponents/Conversation.php @@ -1839,7 +1839,7 @@ private function longPins(): array */ private static function composerClearance(string $draft, bool $replying, bool $hasPhotos, bool $describing): int { - return Display::ComposerFadeHeight + self::ComposerBarHeight + Display::composerBoxGrowth($draft) + return Display::composerFadeHeight() + self::ComposerBarHeight + Display::composerBoxGrowth($draft) + ($replying ? self::ReplyingBarHeight : 0) + ($hasPhotos ? self::PhotosHeight : 0) + ($hasPhotos && $describing ? self::DescriptionHeight : 0) diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index 5d26c304..91978b39 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -135,8 +135,9 @@ The reply bar, drawn as the Remotes composer is: the field across the top and a row under it with the tools on the left and the round send button on the right (see partials/composer-box), with the page fading out above it (see partials/composer-fade). On iOS the bar is Liquid Glass, faded in at the top, so the page - shows through it blurred (see Display::composerBarGlass()). On Android it's the surface, painted from this - column. Either fills the strip under the home indicator. + shows through it blurred (see Display::composerBarGlass()). From iOS 26 the system's scroll edge effect + blurs the page under the bar instead, with no fade or glass (see Display::hasScrollEdge()). On Android + it's the surface, painted from this column. Either fills the strip under the home indicator. The bar does everything the composer sheet did for a reply, so a reply never needs the sheet, whose presenting takes the keyboard down and back up on both platforms. The photo button adds photos from the @@ -153,7 +154,7 @@ @php($replyPostsAs = $replyPostingMe !== null && \App\Devnull\PostAs::offered($replyAuthor)) - @if (\App\Devnull\Display::fadesInBar()) + @if (\App\Devnull\Display::fadeRowInBar()) @include('native.partials.composer-fade', ['ref' => 'reply-fade', 'inBar' => true]) @endif diff --git a/resources/views/native/conversation.blade.php b/resources/views/native/conversation.blade.php index 5191385f..c68a3c5a 100644 --- a/resources/views/native/conversation.blade.php +++ b/resources/views/native/conversation.blade.php @@ -81,14 +81,15 @@ The composer: the field over a row holding the + and the round send button (see partials/composer-box), with the thread fading out above it (see partials/composer-fade) rather than meeting a line. On iOS the bar is Liquid Glass, faded in at the top, so the thread shows through it blurred (see - Display::composerBarGlass()). On Android it's the surface. Either fills the strip under the home indicator. + Display::composerBarGlass()). From iOS 26 the system's scroll edge effect blurs the thread under the bar + instead, with no fade or glass (see Display::hasScrollEdge()). On Android it's the surface. Either fills the strip under the home indicator. The web's tools, photos, the microphone and Ping, open from the one +. Above the field sit the people to mention, what you're replying to and the photos on the draft. While the thread can't take a message, why goes in the field's place. --}} - @if (\App\Devnull\Display::fadesInBar()) + @if (\App\Devnull\Display::fadeRowInBar()) @include('native.partials.composer-fade', ['ref' => 'composer-fade', 'inBar' => true]) @endif diff --git a/resources/views/native/partials/composer-fade.blade.php b/resources/views/native/partials/composer-fade.blade.php index 7a817f43..023b2a87 100644 --- a/resources/views/native/partials/composer-fade.blade.php +++ b/resources/views/native/partials/composer-fade.blade.php @@ -6,7 +6,8 @@ Where it goes depends on the platform (Display::fadesInBar()). On iOS the screen runs on under the bar, so the fade is the bar's first row ($inBar), over what runs under it, and the bar's glass fades in under it over the same height (see Display::composerBarGlass()). On Android the screen stops at the bar, so the fade lies over the foot of - the screen's scroll view, at the bottom of the stack around it. $ref names it. + the screen's scroll view, at the bottom of the stack around it. From iOS 26 there's no fade at all: the system's + scroll edge effect blurs what runs under the bar (Display::fadeRowInBar()). $ref names it. --}} @php($inBar ??= false) diff --git a/tests/Feature/Devnull/ComposerScrollEdgeTest.php b/tests/Feature/Devnull/ComposerScrollEdgeTest.php new file mode 100644 index 00000000..2da10027 --- /dev/null +++ b/tests/Feature/Devnull/ComposerScrollEdgeTest.php @@ -0,0 +1,45 @@ +toBe($edge) + ->and(Display::fadeRowInBar())->toBe($platform === 'ios' && ! $edge) + ->and(Display::composerFadeHeight())->toBe($edge ? 0 : Display::ComposerFadeHeight) + ->and(Display::composerSurface() === '')->toBe($edge); + } finally { + System::rememberPlatform(null); + } + }); +})->with([ + 'iOS 18' => ['ios', '18.5', false], + 'iOS 26' => ['ios', '26.0', true], + 'iOS 26.1' => ['ios', '26.1', true], + 'iOS 27' => ['ios', '27.0.1', true], + 'Android 16' => ['android', '16', false], + 'Android 26' => ['android', '26', false], +]); + +it('asks iOS for the soft scroll edge effect under the composer bars, over glass for older iOS', function () { + System::rememberPlatform('ios'); + + try { + expect(Display::composerBarGlass())->toBe('glass/'.Display::ComposerGlassOpacity.' scroll-edge-soft'); + } finally { + System::rememberPlatform(null); + } + + System::rememberPlatform('android'); + + try { + expect(Display::composerBarGlass())->toBe(''); + } finally { + System::rememberPlatform(null); + } +}); diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 591eb7f1..4a9bda70 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -10,6 +10,7 @@ use Native\Mobile\Events\Alert\ButtonPressed; use Native\Mobile\Testing\Native; use Tests\Support\GlassOpacity; +use Tests\Support\ScrollEdge; beforeEach(function () { config(['devnull.url' => 'http://devnull.test']); @@ -927,6 +928,34 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): expect($bottomBar['props']['glass_opacity'] ?? null)->toBe($platform === 'ios' ? Display::ComposerGlassOpacity / 100 : null); })->with(['ios', 'android']); +it('stands the reply bar on the scroll edge effect from iOS 26, with no fade or tint, and glass for older iOS', function () { + fakeThread(replies: [replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'The last reply'])]); + + ScrollEdge::onIos('26.1', function (): void { + $screen = Native::visit('/log/commits/c2', platform: 'ios'); + $bottomBar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); + + // The bar asks for the soft edge effect and keeps its glass for older iOS, which mobile-air leaves out here. + // The page ends where the bar starts, with no fade above it to clear. + expect($bottomBar['props']['scroll_edge'] ?? null)->toBe(1) + ->and($bottomBar['props']['glass'] ?? null)->toBe(1) + ->and(childRefs($screen, 'reply-bar'))->toBe(['reply-rows']) + ->and(nodeByRef($screen, 'reply-rows')['style']['bg_color'] ?? null)->toBeNull() + ->and(findNode($screen->tree(), fn (array $node): bool => ($node['ref'] ?? null) === 'reply-fade'))->toBeNull() + ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual(24 + Display::ComposerBoxBarHeight + 34); + }); +}); + +it('keeps the fade at the top of the reply bar before iOS 26', function () { + fakeThread(); + + ScrollEdge::onIos('18.5', function (): void { + $screen = Native::visit('/log/commits/c2', platform: 'ios'); + + expect(childRefs($screen, 'reply-bar'))->toBe(['reply-fade', 'reply-rows']); + }); +}); + it('ends the page above the reply bar, and further as the draft grows', function () { fakeThread(replies: [replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'The last reply'])]); diff --git a/tests/Feature/Screens/RemotesComposerTest.php b/tests/Feature/Screens/RemotesComposerTest.php index 6e3e0079..eb0c0be8 100644 --- a/tests/Feature/Screens/RemotesComposerTest.php +++ b/tests/Feature/Screens/RemotesComposerTest.php @@ -11,6 +11,7 @@ use Native\Mobile\Testing\Native; use Native\Mobile\Testing\TestableComponent; use Tests\Support\GlassOpacity; +use Tests\Support\ScrollEdge; const ComposerViewerId = '0199e5c4-0000-7000-8000-000000000001'; @@ -341,6 +342,22 @@ function threadWithAda(string $platform = 'ios'): TestableComponent } })->with(['ios', 'android']); +it('stands the message bar on the scroll edge effect from iOS 26, with no fade or tint', function () { + serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); + + ScrollEdge::onIos('26.0', function (): void { + $screen = threadWithAda(); + $bottomBar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); + + expect($bottomBar['props']['scroll_edge'] ?? null)->toBe(1) + ->and(childRefs($screen, 'composer-bar'))->toBe(['composer-rows']) + ->and(nodeByRef($screen, 'composer-bar')['style']['bg_color'] ?? null)->toBeNull() + ->and(nodeByRef($screen, 'composer-rows')['style']['bg_color'] ?? null)->toBeNull() + ->and(findNode($screen->tree(), fn (array $node): bool => ($node['ref'] ?? null) === 'composer-fade'))->toBeNull() + ->and(nodeByRef($screen, 'composer-clearance')['layout']['height'] ?? null)->toEqual(Conversation::ComposerBarHeight + 8); + }); +}); + it('fades to the dark surface in dark mode, and draws again when the phone switches', function () { serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); diff --git a/tests/Support/ScrollEdge.php b/tests/Support/ScrollEdge.php new file mode 100644 index 00000000..a6d073b3 --- /dev/null +++ b/tests/Support/ScrollEdge.php @@ -0,0 +1,48 @@ +markTestSkipped('Needs a mobile-air with scroll-edge-soft on a bottom bar and System::osVersion()'); + } + } + + /** + * Run $test as on a phone with this iOS, then forget it again. + * + * @template T + * + * @param callable(): T $test + * @return T + */ + public static function onIos(string $version, callable $test): mixed + { + self::skipUnlessSupported(); + + System::rememberOsVersion($version); + + try { + return $test(); + } finally { + System::rememberOsVersion(null); + } + } +} From 89bff8d99142f2081904b012c69b0634af6144fa Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 22 Nov 2026 10:24:54 +0000 Subject: [PATCH 34/46] Count the replies of the commits above from their own pages devnull sends the ancestors on a commit's page without replies_count, so a commit above only showed its "N replies" if the page had moved through it before. Each ancestor that shows now reads its count from its own page, kept from before at once and asked for behind, once per refresh. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Data/Commit.php | 8 +++ app/NativeComponents/CommitDetail.php | 64 ++++++++++++++++++- .../Feature/Screens/CommitDetailCacheTest.php | 3 +- tests/Feature/Screens/NestedRepliesTest.php | 49 ++++++++++++++ 4 files changed, 122 insertions(+), 2 deletions(-) diff --git a/app/Devnull/Data/Commit.php b/app/Devnull/Data/Commit.php index 28b52bbf..4a2f608d 100644 --- a/app/Devnull/Data/Commit.php +++ b/app/Devnull/Data/Commit.php @@ -169,6 +169,14 @@ public function withMorePasteis(int $change): self return new self(...[...get_object_vars($this), 'pasteisCount' => max(0, $this->pasteisCount + $change)]); } + /** + * This commit with the count of replies its own page gives, for a copy that came without one. + */ + public function withRepliesCount(int $repliesCount): self + { + return new self(...[...get_object_vars($this), 'repliesCount' => max(0, $repliesCount)]); + } + public function withPinned(bool $isPinned): self { return new self(...[...get_object_vars($this), 'isPinned' => $isPinned]); diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index 7e9292d5..9dd73f7f 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -279,6 +279,13 @@ class CommitDetail extends NativeComponent */ protected bool $forceFullFrames = true; + /** + * The commits above whose own page was asked for their count since the page last asked devnull again. + * + * @var list + */ + protected array $countedAncestors = []; + public function mount(): void { $this->openedId = $this->id; @@ -335,6 +342,7 @@ public function load(): void protected function revalidate(): void { + $this->countedAncestors = []; $this->refresh($this->threadPath(), [], fn (array $json) => $this->takeCommitThread($json)); $this->refresh($this->threadPath().'/replies', [], fn (array $json) => $this->takeReplies($json)); $this->refresh($this->threadPath().'/related', [], fn (array $json) => $this->takeRelated($json), quiet: true, failed: function (): void { @@ -347,6 +355,7 @@ protected function revalidate(): void } $this->refreshThreads(); + $this->countAncestorReplies(); } protected function showsContent(): bool @@ -360,6 +369,7 @@ protected function showsContent(): bool public function showEarlier(): void { $this->earlierShown = true; + $this->countAncestorReplies(); } /** @@ -1121,9 +1131,61 @@ private function takeCommitThread(array $json): void $this->commit = $thread->commit; $this->ancestors = $thread->ancestors; $this->series = $thread->series; + $this->countAncestorReplies(); $this->followThread(); } + /** + * The commits above the commit that show: its parent, or every one once "↑ N earlier commits" opened them. + * + * @return list + */ + private function shownAncestors(): array + { + return $this->earlierShown ? $this->ancestors : array_slice($this->ancestors, -1); + } + + /** + * devnull sends the commits above the commit without their counts, so on their own a commit above never shows + * its "› N replies". Each one showing takes its count from its own page instead: kept from before at once, and + * asked for behind. That also keeps its page, so tapping it moves there with nothing blank. + */ + private function countAncestorReplies(): void + { + foreach ($this->shownAncestors() as $ancestor) { + if ($ancestor->isStaged() || $ancestor->isDeleted()) { + continue; + } + + $id = $ancestor->id; + $path = 'commits/'.rawurlencode($id); + + if (($kept = $this->cached($path)) !== null) { + $this->takeAncestorCount($id, $kept); + } + + // The commit's page landing draws its ancestors again, and they were asked for once already. + if (! in_array($id, $this->countedAncestors, true)) { + $this->countedAncestors[] = $id; + $this->refresh($path, [], fn (array $json) => $this->takeAncestorCount($id, $json), quiet: true); + } + } + } + + /** + * @param array $json + */ + private function takeAncestorCount(string $id, array $json): void + { + $page = CommitThread::fromArray($json)->commit; + + if ($page->id !== $id) { + return; + } + + $this->ancestors = array_map(fn (Commit $ancestor): Commit => $ancestor->id === $id ? $ancestor->withRepliesCount($page->repliesCount) : $ancestor, $this->ancestors); + } + /** * A fresh first page of replies. Pages loaded after it stay, past what it holds. * @@ -1249,7 +1311,7 @@ public function isOwn(): bool public function render(): View { $earlier = $this->earlierShown ? [] : array_slice($this->ancestors, 0, -1); - $above = $this->earlierShown ? $this->ancestors : array_slice($this->ancestors, -1); + $above = $this->shownAncestors(); $viewer = $this->me(); $this->replyRows ??= new RowCache; $this->replyRows->startFrame(); diff --git a/tests/Feature/Screens/CommitDetailCacheTest.php b/tests/Feature/Screens/CommitDetailCacheTest.php index 1694cf61..afc3e075 100644 --- a/tests/Feature/Screens/CommitDetailCacheTest.php +++ b/tests/Feature/Screens/CommitDetailCacheTest.php @@ -48,7 +48,8 @@ function serveThread(): void finishRefreshes($screen)->assertSee('A compiler'); - expect(count(Http::recorded()))->toBe(3); + // The commit, its replies, what's related, and c0's own page for how many replies it has. + expect(count(Http::recorded()))->toBe(4); }); it('opens from a row on what the row knew, then fills in the replies and what it replies to', function () { diff --git a/tests/Feature/Screens/NestedRepliesTest.php b/tests/Feature/Screens/NestedRepliesTest.php index 1e9e4c79..2c9024d9 100644 --- a/tests/Feature/Screens/NestedRepliesTest.php +++ b/tests/Feature/Screens/NestedRepliesTest.php @@ -284,3 +284,52 @@ function fakeAncestorThread(): void expect($screen->get('threads'))->toHaveKey('r1')->not->toHaveKey('c2'); }); + +/** + * c3 answers c2, which answers c1, shaped like devnull's API: the ancestors on c3's page come without their counts, + * since CommitAncestorsQuery doesn't load them. Only a commit's own page says how many replies it has. c2 has two + * besides c3, and c1 has one besides c2. Neither page was opened before. + */ +function fakeUncountedAncestors(): void +{ + $person = fn (string $handle, int $lane): array => userJson(['handle' => $handle, 'name' => ucfirst($handle), 'lane' => $lane]); + $uncounted = fn (array $commit): array => array_diff_key($commit, array_flip(['replies_count', 'stars_count'])); + $c1 = commitJson(['id' => 'c1', 'body' => 'The first commit', 'replies_count' => 2, 'author' => $person('ada', 1)]); + $c2 = commitJson(['id' => 'c2', 'parent_id' => 'c1', 'body' => 'The commit above', 'replies_count' => 3, 'author' => $person('grace', 2)]); + $c3 = commitJson(['id' => 'c3', 'parent_id' => 'c2', 'body' => 'The focused commit', 'author' => $person('ken', 3)]); + $y1 = replyJson(['id' => 'y1', 'parent_id' => 'c1', 'body' => 'Another reply to the first', 'author' => $person('linus', 4)]); + $x1 = replyJson(['id' => 'x1', 'parent_id' => 'c2', 'body' => 'Another reply above', 'author' => $person('alan', 5)]); + $x2 = replyJson(['id' => 'x2', 'parent_id' => 'c2', 'body' => 'One more reply above', 'author' => $person('edsger', 6)]); + + Http::fake(function (Request $request) use ($uncounted, $c1, $c2, $c3, $x1, $x2, $y1) { + return match (parse_url($request->url(), PHP_URL_PATH)) { + '/api/v1/commits/c3' => Http::response(commitPageJson($c3, [$uncounted($c1), $uncounted($c2)])), + '/api/v1/commits/c2' => Http::response(commitPageJson($c2, [$uncounted($c1)])), + '/api/v1/commits/c1' => Http::response(commitPageJson($c1)), + '/api/v1/commits/c1/related', '/api/v1/commits/c2/related', '/api/v1/commits/c3/related' => Http::response(['data' => []]), + '/api/v1/commits/c1/replies' => Http::response(pageJson([$c2, $y1])), + '/api/v1/commits/c2/replies' => Http::response(pageJson([$c3, $x1, $x2])), + '/api/v1/commits/c3/replies', '/api/v1/commits/x1/replies', '/api/v1/commits/x2/replies', '/api/v1/commits/y1/replies' => Http::response(pageJson([])), + default => Http::response(['message' => 'No fake.'], 404), + }; + }); +} + +it('shows the folded replies of a commit above that was never opened, from that commit\'s own page', function () { + fakeUncountedAncestors(); + + $screen = finishRefreshes(Native::visit('/log/commits/c3')); + + // c2's page says it has three replies, and c3 is one of them, on the way down. + expect(nodeByRef($screen, 'replies-c2')['props']['a11y_label'] ?? null)->toBe('2 replies') + ->and($screen->get('threads'))->toBe([]); + + $screen->tap('replies-c2')->assertNoNavigation()->assertSee('Another reply above')->assertSee('One more reply above'); + + // The earlier commits get theirs once they show. + expect(rendersRef($screen, 'replies-c1'))->toBeFalse(); + + finishRefreshes($screen->call('showEarlier')); + + expect(nodeByRef($screen, 'replies-c1')['props']['a11y_label'] ?? null)->toBe('1 reply'); +}); From f3e4adb086d81a0e78cac60dc0caf337b2062e7a Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 22 Nov 2026 10:25:30 +0000 Subject: [PATCH 35/46] Keep the asked-for ancestor counts with the ancestors Moves the new property away from $forceFullFrames, which the phone build removes, so the two merge cleanly. Co-Authored-By: Claude Opus 5.5 --- app/NativeComponents/CommitDetail.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index 9dd73f7f..7b2d94e9 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -127,6 +127,13 @@ class CommitDetail extends NativeComponent /** @var list */ public array $ancestors = []; + /** + * The commits above whose own page was asked for their count since the page last asked devnull again. + * + * @var list + */ + protected array $countedAncestors = []; + /** * The parts of its series after the commit, in order. * @@ -279,13 +286,6 @@ class CommitDetail extends NativeComponent */ protected bool $forceFullFrames = true; - /** - * The commits above whose own page was asked for their count since the page last asked devnull again. - * - * @var list - */ - protected array $countedAncestors = []; - public function mount(): void { $this->openedId = $this->id; From 65bd2cefd7655c7a23ee68d6d427bebc245707d2 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 22 Nov 2026 11:10:16 +0000 Subject: [PATCH 36/46] Put the composer back in a glass box over the edge blur From iOS 26 the field and its row of tools on the commit page's reply bar and the Remote composer sit in a rounded Liquid Glass box, 16pt in from the screen's sides, over the system's scroll edge effect. The bar asks for the effect with mobile-air's new edge-blur attribute in place of the old scroll-edge-soft class. Two Display constants switch it: ComposerInGlassBox (on) and ComposerEdgeBlur ("soft", or "hard" for the opaque fade). In the box the field sits 16pt under the box's edge, as far as it sits above the tools, and the send button is 8pt in from the box's right and bottom edges, so the box is rounded at 24. That makes the bar 6pt taller, which the page and thread clearances follow. Older iOS and Android draw the bars as before. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Display.php | 85 ++++++++++++++++--- app/NativeComponents/Conversation.php | 2 +- .../views/native/commit-detail.blade.php | 7 +- resources/views/native/conversation.blade.php | 6 +- .../native/partials/composer-box.blade.php | 13 +-- .../Devnull/ComposerScrollEdgeTest.php | 22 ++++- tests/Feature/Screens/CommitDetailTest.php | 12 +-- tests/Feature/Screens/RemotesComposerTest.php | 5 +- tests/Support/ScrollEdge.php | 8 +- 9 files changed, 124 insertions(+), 36 deletions(-) diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index 32e9d307..e4f75b03 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -5,6 +5,7 @@ use App\Devnull\Data\CommitBody; use Carbon\CarbonImmutable; use Carbon\CarbonInterface; +use Native\Mobile\Edge\Elements\BottomBar; use Native\Mobile\Facades\System; use Native\Mobile\Platform; @@ -56,6 +57,24 @@ final class Display */ public const int ScrollEdgeIosVersion = 26; + /** + * Whether a composer's field and its row of tools sit in a rounded Liquid Glass box over the scroll edge effect, + * as in Messages (see composerInGlassBox()). Off, they sit straight on the effect. Only on iOS 26 and later. + */ + public const bool ComposerInGlassBox = true; + + /** + * Which scroll edge effect iOS 26 and later draw under a composer bar (see composerEdgeBlur()): "soft", the + * progressive blur under the system's own toolbars, or "hard", an opaque fade. + */ + public const string ComposerEdgeBlur = 'soft'; + + /** + * A bar holding partials/composer-box in its glass box with one line of draft: ComposerBoxBarHeight, plus the + * box's own padding over and under what it holds (see composerBox()). + */ + public const int ComposerGlassBoxBarHeight = 100; + /** * About how many characters fit on a line of the box's field, which runs the width of the box. */ @@ -260,7 +279,7 @@ public static function maskedKey(string $openSsh): string public static function replyBarClearance(string $draft, bool $hasPhotos = false, bool $describing = false): int { return self::composerFadeHeight() - + self::ComposerBoxBarHeight + + self::composerBoxBarHeight() + self::composerBoxGrowth($draft) + ($hasPhotos ? self::ReplyBarPhotosHeight : 0) + ($hasPhotos && $describing ? self::ReplyBarDescriptionHeight : 0) @@ -310,16 +329,18 @@ public static function fadesInBar(): bool /** * Whether the composer bars stand on iOS's own scroll edge effect: iOS 26 and later blur what scrolls under the - * bar progressively, as under its own toolbars, from the bar's scroll-edge-soft class (see composerBarGlass()). - * That stands in for the fade and the tinted glass, so a bar there draws neither and lets the effect show. Older - * iOS keeps the fade over glass, and Android its fade over the surface. + * bar, as under its own toolbars, from the bar's edge-blur attribute (see composerEdgeBlur()). That stands in for + * the fade and the tinted glass, so a bar there draws neither and lets the effect show. Older iOS keeps the fade + * over glass, and Android its fade over the surface. * - * It needs a mobile-air that draws the effect for a bottom bar and says which iOS the phone runs + * It needs a mobile-air that takes edge-blur on a bottom bar and says which iOS the phone runs * (System::osVersion()). Without one this is false and every iOS keeps the fade. */ public static function hasScrollEdge(): bool { - if (! Platform::isIos() || ! method_exists(\Native\Mobile\System::class, 'osVersion')) { + if (! Platform::isIos() + || ! method_exists(\Native\Mobile\System::class, 'osVersion') + || ! method_exists(BottomBar::class, 'edgeBlurStyle')) { return false; } @@ -334,6 +355,42 @@ public static function fadeRowInBar(): bool return self::fadesInBar() && ! self::hasScrollEdge(); } + /** + * Whether the composer's field and tools sit in a rounded Liquid Glass box on the bar (ComposerInGlassBox): on + * iOS 26 and later, over the scroll edge effect. Older iOS and Android draw them straight on the bar, as before. + */ + public static function composerInGlassBox(): bool + { + return self::ComposerInGlassBox && self::hasScrollEdge(); + } + + /** + * The classes for partials/composer-box's outer column. In the glass box it's rounded to match the send button + * inside it, which sits 8pt in from its right and bottom edges: the row of tools leaves 6pt at its end and 2pt + * under the button, and the box 2pt more under the row. + */ + public static function composerBox(): string + { + return self::composerInGlassBox() ? 'rounded-[24] glass pb-[2]' : ''; + } + + /** + * The padding over the field inside partials/composer-box. In the glass box the field sits as far under the + * box's top edge as the row of tools sits under the field, 16pt to the text either way. + */ + public static function composerFieldTop(): string + { + return self::composerInGlassBox() ? 'pt-2' : 'pt-1'; + } + + /** + * How tall a composer bar is with one line of draft (see ComposerBoxBarHeight and ComposerGlassBoxBarHeight). + */ + public static function composerBoxBarHeight(): int + { + return self::composerInGlassBox() ? self::ComposerGlassBoxBarHeight : self::ComposerBoxBarHeight; + } + /** * How tall the composer fade is where it's drawn: none where the scroll edge effect replaces it. */ @@ -350,13 +407,21 @@ public static function composerFadeHeight(): int * percent (glass/N), so a little of the screen under the bar shows through. Android has no glass, so the bar * stays the surface there. * - * scroll-edge-soft asks iOS 26 and later for its scroll edge effect under the bar instead, a progressive blur - * like the one under its own toolbars, and a patched mobile-air leaves the glass out there (see hasScrollEdge()). - * Older iOS ignores it and keeps the glass. + * From iOS 26 the bar's edge-blur takes the glass's place (see composerEdgeBlur()). */ public static function composerBarGlass(): string { - return self::fadesInBar() ? 'glass/'.self::ComposerGlassOpacity.' scroll-edge-soft' : ''; + return self::fadesInBar() ? 'glass/'.self::ComposerGlassOpacity : ''; + } + + /** + * The edge-blur attribute for a composer's native:bottom-bar: on iOS, ComposerEdgeBlur, so iOS 26 and later draw + * the system's scroll edge effect under the bar, and mobile-air leaves the bar's glass out there. Older iOS ignores + * it and keeps the glass. Android has no such effect, so nothing is asked there. + */ + public static function composerEdgeBlur(): string + { + return self::fadesInBar() ? self::ComposerEdgeBlur : ''; } /** diff --git a/app/NativeComponents/Conversation.php b/app/NativeComponents/Conversation.php index 8bd97c9b..7ef029b1 100644 --- a/app/NativeComponents/Conversation.php +++ b/app/NativeComponents/Conversation.php @@ -1839,7 +1839,7 @@ private function longPins(): array */ private static function composerClearance(string $draft, bool $replying, bool $hasPhotos, bool $describing): int { - return Display::composerFadeHeight() + self::ComposerBarHeight + Display::composerBoxGrowth($draft) + return Display::composerFadeHeight() + Display::composerBoxBarHeight() + Display::composerBoxGrowth($draft) + ($replying ? self::ReplyingBarHeight : 0) + ($hasPhotos ? self::PhotosHeight : 0) + ($hasPhotos && $describing ? self::DescriptionHeight : 0) diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index 91978b39..50b8f2c4 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -136,8 +136,9 @@ tools on the left and the round send button on the right (see partials/composer-box), with the page fading out above it (see partials/composer-fade). On iOS the bar is Liquid Glass, faded in at the top, so the page shows through it blurred (see Display::composerBarGlass()). From iOS 26 the system's scroll edge effect - blurs the page under the bar instead, with no fade or glass (see Display::hasScrollEdge()). On Android - it's the surface, painted from this column. Either fills the strip under the home indicator. + blurs the page under the bar instead, with no fade or glass (see Display::composerEdgeBlur()), and the + field and tools sit in a rounded glass box on it (Display::composerInGlassBox()). On Android it's the + surface, painted from this column. Either fills the strip under the home indicator. The bar does everything the composer sheet did for a reply, so a reply never needs the sheet, whose presenting takes the keyboard down and back up on both platforms. The photo button adds photos from the @@ -152,7 +153,7 @@ --}} @php($replyPostingMe = app(\App\Devnull\Account::class)->user()) @php($replyPostsAs = $replyPostingMe !== null && \App\Devnull\PostAs::offered($replyAuthor)) - + @if (\App\Devnull\Display::fadeRowInBar()) @include('native.partials.composer-fade', ['ref' => 'reply-fade', 'inBar' => true]) diff --git a/resources/views/native/conversation.blade.php b/resources/views/native/conversation.blade.php index c68a3c5a..aa77c391 100644 --- a/resources/views/native/conversation.blade.php +++ b/resources/views/native/conversation.blade.php @@ -82,12 +82,14 @@ with the thread fading out above it (see partials/composer-fade) rather than meeting a line. On iOS the bar is Liquid Glass, faded in at the top, so the thread shows through it blurred (see Display::composerBarGlass()). From iOS 26 the system's scroll edge effect blurs the thread under the bar - instead, with no fade or glass (see Display::hasScrollEdge()). On Android it's the surface. Either fills the strip under the home indicator. + instead, with no fade or glass (see Display::composerEdgeBlur()), and the field and tools sit in a rounded + glass box on it (Display::composerInGlassBox()). On Android it's the surface. Either fills the strip under + the home indicator. The web's tools, photos, the microphone and Ping, open from the one +. Above the field sit the people to mention, what you're replying to and the photos on the draft. While the thread can't take a message, why goes in the field's place. --}} - + @if (\App\Devnull\Display::fadeRowInBar()) @include('native.partials.composer-fade', ['ref' => 'composer-fade', 'inBar' => true]) diff --git a/resources/views/native/partials/composer-box.blade.php b/resources/views/native/partials/composer-box.blade.php index c706afc0..fb84f564 100644 --- a/resources/views/native/partials/composer-box.blade.php +++ b/resources/views/native/partials/composer-box.blade.php @@ -1,8 +1,10 @@ {{-- A composer bar's field, tools and send button, laid out the way the Claude and Messages apps lay theirs out: the field across the top, growing to its five lines, and under it a row with the tools on the left and a round send - button in your colour on the right. The same on both platforms. Nothing is drawn around them: they sit straight on - the bar, which is glass on iOS and the surface on Android, under the fade at its top (see partials/composer-fade). + button in your colour on the right. The same on both platforms. Before iOS 26 nothing is drawn around them: they sit + straight on the bar, which is glass on iOS and the surface on Android, under the fade at its top (see + partials/composer-fade). From iOS 26 they sit in a rounded Liquid Glass box over the system's scroll edge effect, + unless Display::ComposerInGlassBox is off (see Display::composerBox()). $ref names the box ("{$ref}-box", also its key, so the field keeps its place as rows above it come and go) and its rows ("{$ref}-field-row", "{$ref}-actions"). $field is the partial that draws the field, keyed itself, so it stays @@ -12,12 +14,13 @@ send-button's: its ref, label, method, and whether it can send yet. The field's text lines up with the tools' icons under it. The field sits a little nearer the fade above it than - the row under it: the row around the box has no top padding, and the field row leaves 8pt under the field. + the row under it: the row around the box has no top padding, and the field row leaves 8pt under the field. In the + glass box the field sits as far under the box's edge as above the tools (Display::composerFieldTop()). --}} @php($lead ??= []) @php($trail ??= []) - - + + @include($field) diff --git a/tests/Feature/Devnull/ComposerScrollEdgeTest.php b/tests/Feature/Devnull/ComposerScrollEdgeTest.php index 2da10027..c56f3556 100644 --- a/tests/Feature/Devnull/ComposerScrollEdgeTest.php +++ b/tests/Feature/Devnull/ComposerScrollEdgeTest.php @@ -12,7 +12,10 @@ expect(Display::hasScrollEdge())->toBe($edge) ->and(Display::fadeRowInBar())->toBe($platform === 'ios' && ! $edge) ->and(Display::composerFadeHeight())->toBe($edge ? 0 : Display::ComposerFadeHeight) - ->and(Display::composerSurface() === '')->toBe($edge); + ->and(Display::composerSurface() === '')->toBe($edge) + ->and(Display::composerInGlassBox())->toBe($edge && Display::ComposerInGlassBox) + ->and(Display::composerBoxBarHeight())->toBe($edge && Display::ComposerInGlassBox ? Display::ComposerGlassBoxBarHeight : Display::ComposerBoxBarHeight) + ->and(Display::composerBox() === '')->toBe(! ($edge && Display::ComposerInGlassBox)); } finally { System::rememberPlatform(null); } @@ -26,11 +29,12 @@ 'Android 26' => ['android', '26', false], ]); -it('asks iOS for the soft scroll edge effect under the composer bars, over glass for older iOS', function () { +it('asks iOS for the composer edge blur on the bar, over glass for older iOS, and Android for neither', function () { System::rememberPlatform('ios'); try { - expect(Display::composerBarGlass())->toBe('glass/'.Display::ComposerGlassOpacity.' scroll-edge-soft'); + expect(Display::composerBarGlass())->toBe('glass/'.Display::ComposerGlassOpacity) + ->and(Display::composerEdgeBlur())->toBe(Display::ComposerEdgeBlur); } finally { System::rememberPlatform(null); } @@ -38,8 +42,18 @@ System::rememberPlatform('android'); try { - expect(Display::composerBarGlass())->toBe(''); + expect(Display::composerBarGlass())->toBe('') + ->and(Display::composerEdgeBlur())->toBe(''); } finally { System::rememberPlatform(null); } }); + +it('asks for an edge blur mobile-air takes', function () { + expect(Display::ComposerEdgeBlur)->toBeIn(['soft', 'hard']); +}); + +it('keeps the glass box as tall as the bar it replaces, plus its own padding', function () { + // The field's padding over it grows from 4 to 8, and the box adds 2 under the row of tools. + expect(Display::ComposerGlassBoxBarHeight)->toBe(Display::ComposerBoxBarHeight + 4 + 2); +}); diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 4a9bda70..e560f1b2 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -935,14 +935,15 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): $screen = Native::visit('/log/commits/c2', platform: 'ios'); $bottomBar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); - // The bar asks for the soft edge effect and keeps its glass for older iOS, which mobile-air leaves out here. - // The page ends where the bar starts, with no fade above it to clear. - expect($bottomBar['props']['scroll_edge'] ?? null)->toBe(1) + // The bar asks for the edge effect and keeps its glass for older iOS, which mobile-air leaves out here. + // The field and tools sit in the glass box. The page ends where the bar starts, with no fade above it. + expect($bottomBar['props']['edge_blur'] ?? null)->toBe(Display::ComposerEdgeBlur) ->and($bottomBar['props']['glass'] ?? null)->toBe(1) ->and(childRefs($screen, 'reply-bar'))->toBe(['reply-rows']) ->and(nodeByRef($screen, 'reply-rows')['style']['bg_color'] ?? null)->toBeNull() ->and(findNode($screen->tree(), fn (array $node): bool => ($node['ref'] ?? null) === 'reply-fade'))->toBeNull() - ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual(24 + Display::ComposerBoxBarHeight + 34); + ->and(nodeByRef($screen, 'reply-box')['props']['glass'] ?? null)->toBe(Display::ComposerInGlassBox ? 1 : null) + ->and(nodeByRef($screen, 'reply-bar-clearance')['layout']['height'])->toEqual(24 + Display::composerBoxBarHeight() + 34); }); }); @@ -952,7 +953,8 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): ScrollEdge::onIos('18.5', function (): void { $screen = Native::visit('/log/commits/c2', platform: 'ios'); - expect(childRefs($screen, 'reply-bar'))->toBe(['reply-fade', 'reply-rows']); + expect(childRefs($screen, 'reply-bar'))->toBe(['reply-fade', 'reply-rows']) + ->and(nodeByRef($screen, 'reply-box')['props']['glass'] ?? null)->toBeNull(); }); }); diff --git a/tests/Feature/Screens/RemotesComposerTest.php b/tests/Feature/Screens/RemotesComposerTest.php index eb0c0be8..353b0cec 100644 --- a/tests/Feature/Screens/RemotesComposerTest.php +++ b/tests/Feature/Screens/RemotesComposerTest.php @@ -349,12 +349,13 @@ function threadWithAda(string $platform = 'ios'): TestableComponent $screen = threadWithAda(); $bottomBar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); - expect($bottomBar['props']['scroll_edge'] ?? null)->toBe(1) + expect($bottomBar['props']['edge_blur'] ?? null)->toBe(Display::ComposerEdgeBlur) + ->and(nodeByRef($screen, 'message-box')['props']['glass'] ?? null)->toBe(Display::ComposerInGlassBox ? 1 : null) ->and(childRefs($screen, 'composer-bar'))->toBe(['composer-rows']) ->and(nodeByRef($screen, 'composer-bar')['style']['bg_color'] ?? null)->toBeNull() ->and(nodeByRef($screen, 'composer-rows')['style']['bg_color'] ?? null)->toBeNull() ->and(findNode($screen->tree(), fn (array $node): bool => ($node['ref'] ?? null) === 'composer-fade'))->toBeNull() - ->and(nodeByRef($screen, 'composer-clearance')['layout']['height'] ?? null)->toEqual(Conversation::ComposerBarHeight + 8); + ->and(nodeByRef($screen, 'composer-clearance')['layout']['height'] ?? null)->toEqual(Display::composerBoxBarHeight() + 8); }); }); diff --git a/tests/Support/ScrollEdge.php b/tests/Support/ScrollEdge.php index a6d073b3..13616b6f 100644 --- a/tests/Support/ScrollEdge.php +++ b/tests/Support/ScrollEdge.php @@ -2,11 +2,11 @@ namespace Tests\Support; -use Native\Mobile\Edge\TailwindParser; +use Native\Mobile\Edge\Elements\BottomBar; use Native\Mobile\System; /** - * Whether the installed mobile-air draws iOS 26's scroll edge effect under a bottom bar (scroll-edge-soft) and says + * Whether the installed mobile-air draws iOS 26's scroll edge effect under a bottom bar (edge-blur) and says * which iOS the phone runs (System::osVersion()). Without them the composer bars keep their fade on every iOS, so the * tests of the scroll edge effect skip. */ @@ -15,13 +15,13 @@ final class ScrollEdge public static function supported(): bool { return method_exists(System::class, 'rememberOsVersion') - && array_key_exists('scrollEdge', TailwindParser::parse('scroll-edge-soft')); + && method_exists(BottomBar::class, 'edgeBlurStyle'); } public static function skipUnlessSupported(): void { if (! self::supported()) { - test()->markTestSkipped('Needs a mobile-air with scroll-edge-soft on a bottom bar and System::osVersion()'); + test()->markTestSkipped('Needs a mobile-air with edge-blur on a bottom bar and System::osVersion()'); } } From e4b24f4d31744d28bb0b5260af20abca777e3832 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 22 Nov 2026 11:23:50 +0000 Subject: [PATCH 37/46] Leave a gap under the mention list on iOS The suggestions now sit 8pt above the composer's glass box on the commit page and in Remotes, instead of touching it. Co-Authored-By: Claude Opus 5.5 --- resources/views/native/commit-detail.blade.php | 2 +- resources/views/native/conversation.blade.php | 2 +- tests/Feature/Screens/CommitMentionsTest.php | 6 ++++++ tests/Feature/Screens/ConversationTest.php | 9 +++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index 50b8f2c4..2096768d 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -166,7 +166,7 @@ otherwise take 10pt of the bar, and EDGE drops a height of 0. --}} @php($mentioning = ($mention['field'] ?? null) === 'reply' && ($mentionPeople !== [] || $mentionOrganizations !== [])) - + @include('native.partials.mention-suggestions', ['field' => 'reply', 'label' => 'Mention a developer']) @php($showsPhotos = $replyImages !== [] && ! $replyPreviewing) diff --git a/resources/views/native/conversation.blade.php b/resources/views/native/conversation.blade.php index aa77c391..1de1c92f 100644 --- a/resources/views/native/conversation.blade.php +++ b/resources/views/native/conversation.blade.php @@ -103,7 +103,7 @@ h-[0.1]: on iOS an empty one otherwise takes 10 points of the bar, and EDGE drops a height of 0. --}} @php($mentioning = ($mention['field'] ?? null) === 'draft' && ($mentionPeople !== [] || $mentionOrganizations !== [])) - + @include('native.partials.mention-suggestions', ['field' => 'draft', 'heading' => ($mention['query'] ?? null) === '' ? 'Members' : null]) diff --git a/tests/Feature/Screens/CommitMentionsTest.php b/tests/Feature/Screens/CommitMentionsTest.php index 471b2886..1d8b3ffc 100644 --- a/tests/Feature/Screens/CommitMentionsTest.php +++ b/tests/Feature/Screens/CommitMentionsTest.php @@ -277,3 +277,9 @@ function mentionsComposer(bool $quoting = false, ?array $mentions = null): Testa expect($overlay['props'])->not->toHaveKey('glass') ->and(strtolower($overlay['style']['bg_color']))->toBe(strtolower(config('native-ui.theme.light.surface'))); }); + +it('leaves a gap between the suggestions and the reply box under them on iOS', function () { + $screen = mentionsCommitPage()->input('reply-input', 'thanks @ad', 10); + + expect(nodeByRef($screen, 'reply-mention-slot')['layout']['padding'][2])->toBe(8.0); +}); diff --git a/tests/Feature/Screens/ConversationTest.php b/tests/Feature/Screens/ConversationTest.php index 4a22b9cc..542dfe4e 100644 --- a/tests/Feature/Screens/ConversationTest.php +++ b/tests/Feature/Screens/ConversationTest.php @@ -1390,3 +1390,12 @@ function orgWithMembers(array $people): array ->tap('mention-ada') ->assertSet('draft', 'hi'); }); + +it('leaves a gap between the suggestions and the message box under them on iOS', function () { + serveOrgThread(orgWithMembers([['ada', 'Ada Lovelace']])); + + $screen = finishRefreshes(Native::visit('/remotes/orgs/org-1', platform: 'ios'))->input('message-input', '@ADA', 4); + + expect(childRefs($screen, 'mention-suggestions'))->not->toBe([]) + ->and(nodeByRef($screen, 'mention-slot')['layout']['padding'][2])->toBe(8.0); +}); From a0ea9bcf44a42c6184314775d430356b3feea876 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 22 Nov 2026 12:22:15 +0000 Subject: [PATCH 38/46] Leave a gap under the Replying to card in Remotes on iOS It sat flush on the composer's glass box. Now there's 8pt between them, as there is under the mention list. Co-Authored-By: Claude Opus 5.5 --- resources/views/native/conversation.blade.php | 2 +- tests/Feature/Screens/RemotesComposerTest.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/resources/views/native/conversation.blade.php b/resources/views/native/conversation.blade.php index 1de1c92f..e60c8a90 100644 --- a/resources/views/native/conversation.blade.php +++ b/resources/views/native/conversation.blade.php @@ -106,7 +106,7 @@ @include('native.partials.mention-suggestions', ['field' => 'draft', 'heading' => ($mention['query'] ?? null) === '' ? 'Members' : null]) - + @if ($replyTo) diff --git a/tests/Feature/Screens/RemotesComposerTest.php b/tests/Feature/Screens/RemotesComposerTest.php index 353b0cec..5678df20 100644 --- a/tests/Feature/Screens/RemotesComposerTest.php +++ b/tests/Feature/Screens/RemotesComposerTest.php @@ -486,3 +486,11 @@ function threadWithAda(string $platform = 'ios'): TestableComponent expect(sentTo('POST', 'remotes/orgs/org-1/ping'))->toBe(['']); }); + +it('leaves a gap between what you are replying to and the message box under it on iOS', function () { + serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); + + $screen = threadWithAda()->trigger('swipe-1')->assertSee('Replying to Ada Lovelace'); + + expect(nodeByRef($screen, 'replying-slot')['layout']['padding'][2])->toBe(8.0); +}); From 820a1756e1b20ced863bf17fc8c087d6f56acf76 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 22 Nov 2026 12:23:46 +0000 Subject: [PATCH 39/46] Suggest every matching org member in Remotes, scrolling past six Org threads ranked members on the phone and kept the first six, so the list never scrolled. Now every member who matches is listed, and the list scrolls past six rows like the reply bar's. Co-Authored-By: Claude Opus 5.5 --- app/NativeComponents/Concerns/SuggestsMentions.php | 6 +++--- tests/Feature/Screens/ConversationTest.php | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/NativeComponents/Concerns/SuggestsMentions.php b/app/NativeComponents/Concerns/SuggestsMentions.php index 9166bcf4..138b82ec 100644 --- a/app/NativeComponents/Concerns/SuggestsMentions.php +++ b/app/NativeComponents/Concerns/SuggestsMentions.php @@ -31,7 +31,6 @@ trait SuggestsMentions */ public const string MentionBeforeCaret = '/(?:^|[^\p{L}\p{N}_.\/@-])@([A-Za-z0-9][A-Za-z0-9-]{0,38}|)$/u'; - public const int MaxMentionSuggestions = 6; /** * The "@handle" the caret is after: the field it's in, where its "@" is, in code points, what follows it, and the @@ -199,7 +198,8 @@ private static function mentionEnd(array $mention, string $text): ?int } /** - * An org's members to suggest for what's typed after the "@", best first. + * An org's members to suggest for what's typed after the "@", best first. All of them: past six the list scrolls + * (see partials/mention-suggestions), as the reply bar's does. * * @param list $members * @return list @@ -236,6 +236,6 @@ private static function rankMembers(array $members, string $query, ?User $viewer usort($ranked, fn (array $a, array $b): int => [$a['tier'], ! $a['followed'], $a['user']->username] <=> [$b['tier'], ! $b['followed'], $b['user']->username]); - return array_column(array_slice($ranked, 0, self::MaxMentionSuggestions), 'user'); + return array_column($ranked, 'user'); } } diff --git a/tests/Feature/Screens/ConversationTest.php b/tests/Feature/Screens/ConversationTest.php index 4a22b9cc..40806fa2 100644 --- a/tests/Feature/Screens/ConversationTest.php +++ b/tests/Feature/Screens/ConversationTest.php @@ -1281,7 +1281,7 @@ function orgWithMembers(array $people): array ->assertMissingElement('column', fn (array $node): bool => ($node['ref'] ?? null) === 'mention-suggestions'); }); -it('filters org members as the web ranks them: exact handle, handle prefix, name prefix, then the rest, followed first, six at most', function () { +it('filters org members as the web ranks them: exact handle, handle prefix, name prefix, then the rest, followed first, all of them in a list that scrolls past six', function () { serveOrgThread(orgWithMembers([ ['grace', 'Grace Hopper'], ['tobias', 'Ada Tobias'], @@ -1295,7 +1295,8 @@ function orgWithMembers(array $people): array $screen = finishRefreshes(Native::visit('/remotes/orgs/org-1'))->input('message-input', '@ADA', 4); - expect(childRefs($screen, 'mention-suggestions'))->toBe(['mention-ada', 'mention-adams', 'mention-adamant', 'mention-tobias', 'mention-bada', 'mention-cada']); + expect(childRefs($screen, 'mention-scroll'))->toBe(['mention-ada', 'mention-adams', 'mention-adamant', 'mention-tobias', 'mention-bada', 'mention-cada', 'mention-dada']) + ->and(nodeByRef($screen, 'mention-scroll')['layout']['height'])->toEqual(Display::MentionRowsShown * Display::MentionRowHeight); }); it('never suggests you, or a member devnull says not to, and suggests nothing in a thread with one person', function () { From b5ecbf738ec6c0ef3b5f107b5be7c80cf086b037 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 22 Nov 2026 12:24:01 +0000 Subject: [PATCH 40/46] Tidy a blank line left by the last commit Co-Authored-By: Claude Opus 5.5 --- app/NativeComponents/Concerns/SuggestsMentions.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/NativeComponents/Concerns/SuggestsMentions.php b/app/NativeComponents/Concerns/SuggestsMentions.php index 138b82ec..4dd2f05e 100644 --- a/app/NativeComponents/Concerns/SuggestsMentions.php +++ b/app/NativeComponents/Concerns/SuggestsMentions.php @@ -31,7 +31,6 @@ trait SuggestsMentions */ public const string MentionBeforeCaret = '/(?:^|[^\p{L}\p{N}_.\/@-])@([A-Za-z0-9][A-Za-z0-9-]{0,38}|)$/u'; - /** * The "@handle" the caret is after: the field it's in, where its "@" is, in code points, what follows it, and the * field's text when the caret was there. Null while there's none. From 3b582bb6e5af45fb7f6d3015dee8be268e442990 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 22 Nov 2026 12:32:33 +0000 Subject: [PATCH 41/46] Scroll to a reply you just sent on a commit page Sending a reply from the bar or the composer sheet now scrolls the page to the staged reply. The scroll view counts its direct children, so the page's rows are now listed by CommitDetail::pageRows() and the view draws exactly that list. The component looks the staged reply up in the same list, so the index can't drift from what's drawn. When devnull's reply replaces the staged one it lands on the same row, so the target and token stay put and the page doesn't move again. The one case where it moves is a reply to your own commit that becomes the next part of your thread; the page follows it there. Co-Authored-By: Claude Opus 5.5 --- app/NativeComponents/CommitDetail.php | 150 ++++++++++++++++-- .../views/native/commit-detail.blade.php | 61 ++----- tests/Feature/Screens/ScrollToReplyTest.php | 129 +++++++++++++++ 3 files changed, 284 insertions(+), 56 deletions(-) create mode 100644 tests/Feature/Screens/ScrollToReplyTest.php diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index 7b2d94e9..edcb88fa 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -80,7 +80,8 @@ * * A reply goes at once: the bar empties and the reply shows staged under the * commit while it goes to devnull from the outbox (see SyncsOutbox), then the - * real one takes its place. If devnull turns it down, it leaves, and what you + * real one takes its place. The page scrolls to it as it shows, and stays + * there when the real one comes (see scrollToRow()). If devnull turns it down, it leaves, and what you * wrote is back in the bar, or in the sheet with its photos. Edit, on the * toast of a reply or a quote turned down after you'd left, opens its commit * here with it ($data['edit']). @@ -256,17 +257,24 @@ class CommitDetail extends NativeComponent public int $scrollKey = 0; /** - * Which of the scroll view's rows it brings into view, the commit's, once tapping another commit in the tree - * moved the page to it (see refocus()). Null until then, so the page opens at the top as it always has. + * Which of the scroll view's rows it brings into view: the commit's, once tapping another commit in the tree + * moved the page to it (see refocus()), or the reply you just sent (see scrollToRow()). Null until one of those, + * so the page opens at the top as it always has. */ public ?int $scrollTarget = null; /** - * Counts the moves refocus() made. The scroll view takes it as its auto-scroll-token, so asking for the same row + * Counts the moves refocus() and scrollToRow() made. The scroll view takes it as its auto-scroll-token, so asking for the same row * as last time (going back to the top twice) scrolls again rather than doing nothing. */ public int $scrollRequest = 0; + /** + * The key of the row scrollToRow() brought into view last, so a reply you sent can be followed when devnull's + * takes its place (see showCommitWent()). + */ + private ?string $scrolledToRow = null; + /** * The commit the page opened on, before tapping others in its tree moved it (see refocus()). */ @@ -821,6 +829,7 @@ public function sendReply(): void $this->updatedReply(); $this->repliesShown = true; $this->keepStagedReplies(); + $this->scrollToRow('thread-reply-'.PendingWrite::stagedId($write->client_id)); $this->sendFromOutbox($write); } @@ -886,6 +895,7 @@ protected function showCommitted(Commit $commit): void $this->replyRestored = false; $this->repliesShown = true; $this->keepStagedReplies(); + $this->scrollToRow('thread-reply-'.$commit->id); } /** @@ -897,6 +907,31 @@ protected function showCommitWent(PendingWrite $write, Commit $commit): void $this->replies = array_map(fn (Commit $reply): Commit => $reply->id === $staged ? $commit : $reply, $this->replies); $this->followThread(); + $this->followSentReply('thread-reply-'.$staged, $commit); + } + + /** + * The page scrolled to a reply you sent, staged, and devnull's reply has taken its place. That's the same row, + * so the scroll view is left be. Only when the reply has moved, as the next part of your thread below the + * commit's replies, does the page follow it there. + */ + private function followSentReply(string $stagedKey, Commit $commit): void + { + if ($this->scrolledToRow !== $stagedKey) { + return; + } + + $keys = array_column($this->pageRows($this->viewData()), 'key'); + $at = array_search('thread-reply-'.$commit->id, $keys, true); + $at = $at === false ? array_search('commit-'.$commit->id, $keys, true) : $at; + + if ($at === false || $at === $this->scrollTarget) { + $this->scrolledToRow = null; + + return; + } + + $this->scrollToRow($keys[$at]); } /** @@ -1309,20 +1344,31 @@ public function isOwn(): bool } public function render(): View + { + $this->replyRows ??= new RowCache; + $this->replyRows->startFrame(); + $data = $this->viewData(); + + return view('native.commit-detail', [...$data, 'replyRows' => $this->replyRows, 'pageRows' => $this->pageRows($data)]); + } + + /** + * What the page's view draws from, besides the component's own properties. + * + * @return array + */ + private function viewData(): array { $earlier = $this->earlierShown ? [] : array_slice($this->ancestors, 0, -1); $above = $this->shownAncestors(); $viewer = $this->me(); - $this->replyRows ??= new RowCache; - $this->replyRows->startFrame(); $thread = $this->selfThread(); $parts = $thread->parts; $partsAbove = $this->commit === null ? 0 : SelfThread::above($this->ancestors, $this->commit, $this->repliesOf())[0]; $lastPart = $thread->hasEnded && $parts !== [] ? end($parts) : null; $replies = $this->commit === null ? $this->replies : SelfThread::others($this->commit, $this->replies); - return view('native.commit-detail', [ - 'replyRows' => $this->replyRows, + return [ 'myColour' => $this->myColour(), 'viewer' => $viewer, 'ownership' => $this->ownership(), @@ -1344,7 +1390,93 @@ public function render(): View 'lastPart' => $lastPart, 'lastPartReplies' => $lastPart === null ? [] : array_slice($this->partReplies[$lastPart->id] ?? [], 0, Client::RepliesPerPage), 'lastPartMore' => $lastPart !== null && (count($this->partReplies[$lastPart->id] ?? []) > Client::RepliesPerPage || in_array($lastPart->id, $this->partsWithMore, true)), - ]); + ]; + } + + /** + * The scroll view's rows from the top down to the end of the thread, in the order the view draws them, each one + * child of the scroll view: "↑ N earlier commits", then each commit with what hangs under it, its replies opened + * in place and theirs (see App\Devnull\ThreadRows). The view draws exactly these, so a row's place here is its + * place among the scroll view's children, which auto-scroll-to counts in (see scrollToRow()). What comes after + * the thread, the related commits and the room for the reply bar, the view draws on its own. + * + * @param array $data What viewData() gave. + * @return list, reply: Commit|null}> + */ + private function pageRows(array $data): array + { + $commit = $this->commit; + $rows = $data['rows']; + $replies = $data['replies']; + $lastPart = $data['lastPart']; + $noReplies = $commit !== null && $data['replyCount'] === 0 && $this->repliesLoaded && $this->series === [] && $data['threadParts'] === []; + $relatedBelow = $commit !== null && $this->related !== [] && ! $noReplies; + $pageRows = []; + + if ($data['earlierCount'] > 0) { + $pageRows[] = ['key' => 'earlier-commits', 'partial' => 'native.partials.earlier-commits', 'data' => ['count' => $data['earlierCount'], 'lane' => $data['earlierLane']], 'reply' => null]; + } + + foreach ($rows as $index => $row) { + $last = $index === array_key_last($rows); + $isFocused = $row->commit->id === $commit?->id; + $isLastPart = $lastPart !== null && $row->commit->id === $lastPart->id; + $hasThread = $isFocused && $this->repliesShown && $replies !== []; + $partThread = $isLastPart && $data['lastPartReplies'] !== []; + $aboveThread = $data['ancestorThreads'][$row->commit->id] ?? null; + $aboveOpen = ($aboveThread['rows'] ?? []) !== []; + + $pageRows[] = ['key' => 'commit-'.$row->commit->id, 'partial' => 'native.partials.commit-row', 'reply' => null, 'data' => [ + 'commit' => $row->commit, + 'previousLane' => $row->previousLane, + 'continuesRun' => $row->continuesRun, + 'continuesNext' => $isFocused || $aboveOpen ? ! $last : null, + 'threadBelow' => $hasThread || $partThread || $aboveOpen, + 'repliesBelow' => $partThread, + 'focused' => $isFocused, + 'muted' => ! $isFocused, + 'seriesExpanded' => true, + 'withTail' => ! $last || $data['threadMore'], + 'hairline' => ! ($last && $relatedBelow && ! $data['threadMore']), + 'threadPosition' => $data['threadPositions'][$row->commit->id] ?? null, + 'showsThread' => false, + 'expandable' => $aboveThread !== null, + 'repliesCount' => $aboveThread['count'] ?? null, + ]]; + + if ($isFocused && $this->repliesShown && $replies === [] && ! $this->repliesLoaded && $this->error === null) { + $pageRows[] = ['key' => 'loading-replies', 'partial' => null, 'data' => [], 'reply' => null]; + } + + // The replies, and theirs opened in place under them as deep as they go. A commit above the commit opens + // its replies in place under it too, all but the one on the line down to the commit, which already shows + // (see ancestorThreads()). + array_push($pageRows, ...match (true) { + $aboveThread !== null => $aboveThread['rows'], + $hasThread => ThreadRows::under($commit, [...$this->threads, $commit->id => $replies], array_filter([...$this->threadCursors, $commit->id => $this->repliesCursor]), $this->threadShown, $last ? null : $commit->lane(), opensInPlace: PHP_INT_MAX, onPage: true, morePress: 'loadMoreReplies'), + $partThread => ThreadRows::under($lastPart, [...$this->threads, $lastPart->id => $data['lastPartReplies']], array_filter([...$this->threadCursors, $lastPart->id => $data['lastPartMore'] ? 'more' : null]), $this->threadShown, opensInPlace: PHP_INT_MAX, onPage: true, morePress: "openReplies('{$lastPart->id}')"), + default => [], + }); + } + + return $pageRows; + } + + /** + * Brings the row keyed $key into view, animated, under a new token so it goes even when that's the row it went to + * last time. Nothing happens for a row the page doesn't draw. + */ + private function scrollToRow(string $key): void + { + $at = array_search($key, array_column($this->pageRows($this->viewData()), 'key'), true); + + if ($at === false) { + return; + } + + $this->scrollTarget = $at; + $this->scrollRequest++; + $this->scrolledToRow = $key; } /** diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index 7d28ab78..ff7bf65b 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -41,61 +41,28 @@ the web reads it (see SelfThread): each part wears its place ("2/5"), ten show at a time with "Show more of this thread" under them, and the replies of the last part hang under it as the commit's do. --}} - @if ($earlierCount > 0) - @include('native.partials.earlier-commits', ['count' => $earlierCount, 'lane' => $earlierLane]) - @endif - {{-- - Related commits start with a full-width line of their own (see partials/related-commits). The last row - above them leaves out its hairline, which runs from the text's edge, so the two don't stack up into a - line and a half. Replies end with no hairline on a commit page, and "No replies yet" keeps the commit's. + The rows down to the end of the thread come from CommitDetail::pageRows(), each one child of the scroll + view, in the order it lists them, so the place it gives a row is the row auto-scroll-to brings into + view: the reply you just sent, say (see CommitDetail::scrollToRow()). A row drawn here and not there + would put every row below it one out. Related commits start with a full-width line of their own (see + partials/related-commits), so the last row above them leaves out its hairline, which runs from the + text's edge, and the two don't stack up into a line and a half. Replies end with no hairline on a + commit page, and "No replies yet" keeps the commit's. --}} @php($noReplies = $commit && $replyCount === 0 && $repliesLoaded && $series === [] && $threadParts === []) - @php($relatedBelow = $commit && $related !== [] && ! $noReplies) - @foreach ($rows as $row) - @php($isFocused = $row->commit->id === $commit?->id) - @php($isLastPart = $lastPart !== null && $row->commit->id === $lastPart->id) - @php($hasThread = $isFocused && $repliesShown && $replies !== []) - @php($partThread = $isLastPart && $lastPartReplies !== []) - @php($aboveThread = $ancestorThreads[$row->commit->id] ?? null) - @php($aboveOpen = ($aboveThread['rows'] ?? []) !== []) - @include('native.partials.commit-row', [ - 'commit' => $row->commit, - 'previousLane' => $row->previousLane, - 'continuesRun' => $row->continuesRun, - 'continuesNext' => $isFocused || $aboveOpen ? ! $loop->last : null, - 'threadBelow' => $hasThread || $partThread || $aboveOpen, - 'repliesBelow' => $partThread, - 'focused' => $isFocused, - 'muted' => ! $isFocused, - 'seriesExpanded' => true, - 'withTail' => ! $loop->last || $threadMore, - 'hairline' => ! ($loop->last && $relatedBelow && ! $threadMore), - 'threadPosition' => $threadPositions[$row->commit->id] ?? null, - 'showsThread' => false, - 'expandable' => $aboveThread !== null, - 'repliesCount' => $aboveThread['count'] ?? null, - ]) - @if ($isFocused && $repliesShown && $replies === [] && ! $repliesLoaded && $error === null) + @foreach ($pageRows as $pageRow) + @if ($pageRow['key'] === 'loading-replies') + @elseif ($pageRow['reply'] === null) + @include($pageRow['partial'], $pageRow['data']) + @else + @php($rowScope = array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1])) + @php($replyRows->include('reply-'.$pageRow['reply']->id, \App\Devnull\RowInputs::for($pageRow['reply'], $rowScope), $pageRow['partial'], $pageRow['data'], $rowScope)) @endif - {{-- - The replies, and theirs opened in place under them as deep as they go (see App\Devnull\ThreadRows). - A commit above the commit opens its replies in place under it too, all but the one on the line down - to the commit, which already shows (see CommitDetail::ancestorThreads()). - --}} - @php($pageThread = match (true) { $aboveThread !== null => $aboveThread['rows'], $hasThread => \App\Devnull\ThreadRows::under($commit, [...$threads, $commit->id => $replies], array_filter([...$threadCursors, $commit->id => $repliesCursor]), $threadShown, $loop->last ? null : $commit->lane(), opensInPlace: PHP_INT_MAX, onPage: true, morePress: 'loadMoreReplies'), $partThread => \App\Devnull\ThreadRows::under($lastPart, [...$threads, $lastPart->id => $lastPartReplies], array_filter([...$threadCursors, $lastPart->id => $lastPartMore ? 'more' : null]), $threadShown, opensInPlace: PHP_INT_MAX, onPage: true, morePress: "openReplies('{$lastPart->id}')"), default => [] }) - @foreach ($pageThread as $threadRow) - @if ($threadRow['reply'] === null) - @include($threadRow['partial'], $threadRow['data']) - @else - @php($rowScope = array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1])) - @php($replyRows->include('reply-'.$threadRow['reply']->id, \App\Devnull\RowInputs::for($threadRow['reply'], $rowScope), $threadRow['partial'], $threadRow['data'], $rowScope)) - @endif - @endforeach @endforeach @if ($threadMore && $threadParts !== []) diff --git a/tests/Feature/Screens/ScrollToReplyTest.php b/tests/Feature/Screens/ScrollToReplyTest.php new file mode 100644 index 00000000..be04ecf7 --- /dev/null +++ b/tests/Feature/Screens/ScrollToReplyTest.php @@ -0,0 +1,129 @@ + 'http://devnull.test']); + signIn(); +}); + +/** + * A commit page for c2, under c1 and c0, with a first page of ten replies and more after them. r1 has a reply of + * its own, n1. Everything is kept from before, so the page shows it at once and holds its refreshes, the reply + * you post among them, until the test lets them go. + * + * @param array $commit + */ +function fakeLongThread(array $commit = [], array $posted = []): void +{ + holdRefreshes(); + + $grace = userJson(['handle' => 'grace', 'name' => 'Grace']); + $c0 = commitJson(['id' => 'c0', 'body' => 'The root commit', 'author' => userJson(['handle' => 'ada', 'name' => 'Ada'])]); + $c1 = commitJson(['id' => 'c1', 'parent_id' => 'c0', 'body' => 'The parent commit', 'author' => userJson(['handle' => 'linus', 'name' => 'Linus'])]); + $c2 = commitJson(['id' => 'c2', 'parent_id' => 'c1', 'body' => 'The focused commit', 'replies_count' => 11, 'author' => $grace, ...$commit]); + $replies = array_map(fn (int $n): array => replyJson(['id' => "r{$n}", 'parent_id' => 'c2', 'body' => "Reply {$n}", 'replies_count' => $n === 1 ? 1 : 0]), range(1, 10)); + $repliesPage = pageJson($replies, 'page2', 'http://devnull.test/api/v1/commits/c2/replies'); + $nested = pageJson([replyJson(['id' => 'n1', 'parent_id' => 'r1', 'body' => 'A reply to the first reply', 'author' => userJson(['handle' => 'alan', 'name' => 'Alan'])])]); + + keep('commits/c2', commitPageJson($c2, [$c0, $c1])); + keep('commits/c2/replies', $repliesPage); + keep('commits/r1/replies', $nested); + + fakeApi([ + 'GET /api/v1/commits/c2' => [commitPageJson($c2, [$c0, $c1])], + 'GET /api/v1/commits/c2/replies' => [$repliesPage], + 'GET /api/v1/commits/c2/related' => [['data' => []]], + 'GET /api/v1/commits/r1/replies' => [$nested], + 'POST /api/v1/commits' => [['data' => commitJson(['id' => 'r99', 'parent_id' => 'c2', 'body' => 'My fresh reply', ...$posted])], 201], + ]); +} + +/** + * Where the scroll view is asked to go: the ref of the child at auto-scroll-to, and the request it's under, which + * the scroll view takes as its auto-scroll-token where mobile-ui has it. + * + * @return array{0: string|null, 1: int} + */ +function scrolledTo(TestableComponent $screen): array +{ + $index = nodeByRef($screen, 'thread-scroll')['props']['auto_scroll_to'] ?? -1; + + return [childRefs($screen, 'thread-scroll')[$index] ?? null, $screen->instance()->scrollRequest]; +} + +function stagedReplyId(TestableComponent $screen): string +{ + /** @var CommitDetail $page */ + $page = $screen->instance(); + + return collect($page->replies)->first(fn ($reply): bool => $reply->isStaged())->id; +} + +it('scrolls to a reply sent from the bar, under the commits above and past ten replies', function () { + fakeLongThread(); + + $screen = Native::visit('/log/commits/c2')->assertSet('scrollRequest', 0); + + $screen->input('reply-input', 'My fresh reply')->tap('send-reply')->assertSet('repliesShown', true); + + $staged = stagedReplyId($screen); + $children = childRefs($screen, 'thread-scroll'); + + expect($children)->toBe([ + 'earlier-commits', 'commit-c1', 'focused-commit', + ...array_map(fn (int $n): string => "thread-reply-r{$n}", range(1, 10)), + "thread-reply-{$staged}", null, 'reply-bar-clearance', + ]) + ->and($screen->instance()->scrollTarget)->toBe(array_search("thread-reply-{$staged}", $children, true)) + ->and(scrolledTo($screen))->toBe(["thread-reply-{$staged}", 1]); + + // devnull's reply takes the staged one's place, on the same row, and the page doesn't scroll again. + finishRefreshes($screen)->assertDontSee('staged'); + + expect(scrolledTo($screen))->toBe(['thread-reply-r99', 1]); +}); + +it('scrolls to a reply sent from the sheet, past replies opened in place under the ones before it', function () { + fakeLongThread(); + + $screen = Native::visit('/log/commits/c2') + ->tap('earlier-commits') + ->tap('replies-c2') + ->tap('replies-r1'); + + finishRefreshes($screen) + ->assertSee('A reply to the first reply') + ->assertSet('scrollRequest', 0); + + $screen->call('replyInSheet', 'c2')->input('sheet-body', 'My fresh reply')->tap('sheet-commit'); + + $staged = stagedReplyId($screen); + $children = childRefs($screen, 'thread-scroll'); + + expect(array_slice($children, 0, 5))->toBe(['commit-c0', 'commit-c1', 'focused-commit', 'thread-reply-r1', 'thread-reply-n1']) + ->and(scrolledTo($screen))->toBe(["thread-reply-{$staged}", 1]) + ->and($screen->instance()->scrollTarget)->toBe(14); + + finishRefreshes($screen); + + expect(scrolledTo($screen))->toBe(['thread-reply-r99', 1]); +}); + +it('follows a reply to your own commit when devnull has it carry your thread on', function () { + // The commit is yours, and so is the reply, so once devnull has it, it's the next part of your thread, below the + // commit's replies, rather than one of them. + fakeLongThread(commit: ['author' => userJson()]); + + $screen = Native::visit('/log/commits/c2'); + $screen->input('reply-input', 'My fresh reply')->tap('send-reply'); + + expect(scrolledTo($screen))->toBe(['thread-reply-'.stagedReplyId($screen), 1]); + + finishRefreshes($screen); + + // It moved a row down, past "Show more" under the replies, so the page goes after it. + expect(scrolledTo($screen))->toBe(['commit-r99', 2]); +}); From 942a74cc92b6a8dccd12af28ccb3fc5232494cca Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 22 Nov 2026 13:12:48 +0000 Subject: [PATCH 42/46] Draw the hairline under replies that another commit follows A commit row gives its hairline up when its replies open under it, and on a commit page the last reply never drew one. So the replies of a commit above the focused one ran straight into the next commit with no line between them. The same happened under the focused commit when later parts of its series follow. ThreadRows::under() takes a hairline flag now. Ancestor threads always end on the line, and the focused commit's replies do when it isn't the last row. Replies at the foot of the page still end without one. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/ThreadRows.php | 14 ++++++++++---- app/NativeComponents/CommitDetail.php | 7 +++++-- .../views/native/partials/thread-reply.blade.php | 10 ++++++---- tests/Feature/Screens/NestedRepliesTest.php | 11 +++++++++-- tests/Feature/Screens/SeriesTest.php | 9 +++++++-- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/app/Devnull/ThreadRows.php b/app/Devnull/ThreadRows.php index 61e7042f..6d26c2b5 100644 --- a/app/Devnull/ThreadRows.php +++ b/app/Devnull/ThreadRows.php @@ -14,7 +14,8 @@ * Under the commit come its replies, each followed by its own replies when * they're open, and theirs, as deep as they go, with "Show more" after the * replies of a thread with more. Every row is a row of its own, and in a feed - * the last one closes the commit's row with its hairline. + * the last one closes the commit's row with its hairline. On a commit page it + * does only when another commit's row follows the thread. * * The thread hangs off the rail in dashes, as on the web: the first reply on * an elbow from the commit's rail, each later one on a short link from the @@ -66,8 +67,10 @@ final class ThreadRows * @param array $shown How many of each open thread's replies show. * @param int|string|null $railLane The commit's rail running on past its thread, when its author's run carries on below. * @param int $opensInPlace How deep a reply's replies button opens its replies in place rather than its page. - * @param bool $onPage On a commit page: replies muted, deleted ones open theirs in place, and no hairline under them. + * @param bool $onPage On a commit page: replies muted, deleted ones open theirs in place, and no hairline under them by default. * @param string|null $morePress What the commit's own "Show more" presses, when it isn't showMoreReplies. + * @param bool|null $hairline Whether the last row closes the thread with a hairline: in a feed it does, and on a + * commit page only when another commit's row comes next. * @return list, reply: Commit|null}> */ public static function under( @@ -79,6 +82,7 @@ public static function under( int $opensInPlace = 1, bool $onPage = false, ?string $morePress = null, + ?bool $hairline = null, ): array { $thread = fn (string $id): array => array_slice($threads[$id] ?? [], 0, $shown[$id] ?? null); $hasMore = fn (string $id): bool => isset($cursors[$id]) || count($thread($id)) < count($threads[$id] ?? []); @@ -89,6 +93,7 @@ public static function under( 'opensInPlace' => $opensInPlace, 'onPage' => $onPage, 'morePress' => $morePress, + 'hairline' => $hairline ?? ! $onPage, ]); if ($rows === []) { @@ -124,7 +129,7 @@ private static function lineAt(int $depth): float * @param list $spines Lines from further up running on past these rows. * @param Closure(string): list $thread * @param Closure(string): bool $hasMore - * @param array{railLane: int|string|null, opensInPlace: int, onPage: bool, morePress: string|null} $options + * @param array{railLane: int|string|null, opensInPlace: int, onPage: bool, morePress: string|null, hairline: bool} $options */ private static function branch(array &$rows, Commit $parent, int $depth, array $spines, Closure $thread, Closure $hasMore, array $options): void { @@ -160,6 +165,7 @@ private static function branch(array &$rows, Commit $parent, int $depth, array $ 'repliesInPlace' => $depth <= $options['opensInPlace'], 'muted' => $onPage, 'tombstones' => $onPage, + 'hairline' => $options['hairline'], ]); // The line that has to run on past this reply's own replies, to the next reply at this depth. @@ -182,7 +188,7 @@ private static function branch(array &$rows, Commit $parent, int $depth, array $ 'indent' => $indent, 'spines' => $spines, 'to' => $flattened && ! $parent->isDeleted() ? $parent->author->handle() : null, - 'hairline' => ! $onPage, + 'hairline' => $options['hairline'], ...($depth === 1 && $options['morePress'] !== null ? ['press' => $options['morePress']] : []), ]); } diff --git a/app/NativeComponents/CommitDetail.php b/app/NativeComponents/CommitDetail.php index edcb88fa..44239e01 100644 --- a/app/NativeComponents/CommitDetail.php +++ b/app/NativeComponents/CommitDetail.php @@ -656,6 +656,8 @@ private function ancestorThreads(array $above): array $ancestor->lane(), opensInPlace: PHP_INT_MAX, onPage: true, + // The next commit on the line follows them, so they end on the hairline the ancestor's row gave up. + hairline: true, ), ]; } @@ -1450,10 +1452,11 @@ private function pageRows(array $data): array // The replies, and theirs opened in place under them as deep as they go. A commit above the commit opens // its replies in place under it too, all but the one on the line down to the commit, which already shows - // (see ancestorThreads()). + // (see ancestorThreads()). Replies with another commit's row after them end on the hairline the row above + // them gave up; at the foot of the page they end on none. array_push($pageRows, ...match (true) { $aboveThread !== null => $aboveThread['rows'], - $hasThread => ThreadRows::under($commit, [...$this->threads, $commit->id => $replies], array_filter([...$this->threadCursors, $commit->id => $this->repliesCursor]), $this->threadShown, $last ? null : $commit->lane(), opensInPlace: PHP_INT_MAX, onPage: true, morePress: 'loadMoreReplies'), + $hasThread => ThreadRows::under($commit, [...$this->threads, $commit->id => $replies], array_filter([...$this->threadCursors, $commit->id => $this->repliesCursor]), $this->threadShown, $last ? null : $commit->lane(), opensInPlace: PHP_INT_MAX, onPage: true, morePress: 'loadMoreReplies', hairline: ! $last), $partThread => ThreadRows::under($lastPart, [...$this->threads, $lastPart->id => $data['lastPartReplies']], array_filter([...$this->threadCursors, $lastPart->id => $data['lastPartMore'] ? 'more' : null]), $this->threadShown, opensInPlace: PHP_INT_MAX, onPage: true, morePress: "openReplies('{$lastPart->id}')"), default => [], }); diff --git a/resources/views/native/partials/thread-reply.blade.php b/resources/views/native/partials/thread-reply.blade.php index aba96aec..9e225242 100644 --- a/resources/views/native/partials/thread-reply.blade.php +++ b/resources/views/native/partials/thread-reply.blade.php @@ -6,8 +6,9 @@ ($previousLane), and a line on down from its avatar when another reply, its own replies, or "Show more", follows ($hasNext). $spines carry lines from further up on past it, and $railLane runs the commit's own rail on past, solid, when its author's run goes on below the thread (see thread-links). A deleted reply keeps its place with a - dashed ring. In a feed the $last closes the commit's row with its hairline. On a commit page nothing follows the - thread, so there's no hairline. + dashed ring. In a feed the $last closes the commit's row with its hairline. On a commit page it has one only when + another commit's row comes next ($hairline): under the replies of a commit above the commit, say, but not at the + foot of the page. Past the web's depth a reply is flattened: it lines up under the reply it answers, with no lines of its own ($links), and says who it answers on a line under its name ($replyingTo), as the web does. @@ -32,6 +33,7 @@ --}} @php($previousLane ??= null) @php($muted ??= false) +@php($hairline ??= ! $muted) @php($railLane ??= null) @php($indent ??= 0) @php($spines ??= []) @@ -66,7 +68,7 @@ @endif - @if ($last && ! $muted) + @if ($last && $hairline) @endif @@ -107,7 +109,7 @@ @endunless - @if ($last && ! $muted) + @if ($last && $hairline) @endif diff --git a/tests/Feature/Screens/NestedRepliesTest.php b/tests/Feature/Screens/NestedRepliesTest.php index 2c9024d9..57fa618e 100644 --- a/tests/Feature/Screens/NestedRepliesTest.php +++ b/tests/Feature/Screens/NestedRepliesTest.php @@ -211,11 +211,18 @@ function fakeAncestorThread(): void $screen->tap('replies-c1')->assertNoNavigation()->assertSee('Another reply above'); // The other reply opens under c1, and the commit the page is on shows once, as the commit. - expect(childRefs($screen, 'thread-scroll'))->toBe(['commit-c1', 'thread-reply-x1', 'focused-commit', 'thread-reply-r1', 'reply-bar-clearance']); + expect(childRefs($screen, 'thread-scroll'))->toBe(['commit-c1', 'thread-reply-x1', 'focused-commit', 'thread-reply-r1', 'reply-bar-clearance']) + // c1 gives up its hairline to its replies, and the last of them ends on it above the commit. The commit's own + // replies end the page, so they end on none. + ->and(rendersRef($screen, 'thread-end-x1'))->toBeTrue() + ->and(rendersRef($screen, 'thread-end-r1'))->toBeFalse(); - // Its replies open in place too, at any depth. + // Its replies open in place too, at any depth, and the hairline moves down under the last of them. $screen->tap('replies-x1')->assertNoNavigation()->assertSee('A reply to the other reply'); + expect(rendersRef($screen, 'thread-end-x2'))->toBeTrue() + ->and(rendersRef($screen, 'thread-end-x1'))->toBeFalse(); + $screen->tap('replies-c1'); finishRefreshes($screen)->assertDontSee('Another reply above')->assertDontSee('A reply to the other reply'); diff --git a/tests/Feature/Screens/SeriesTest.php b/tests/Feature/Screens/SeriesTest.php index cd6027f9..07829c2b 100644 --- a/tests/Feature/Screens/SeriesTest.php +++ b/tests/Feature/Screens/SeriesTest.php @@ -155,7 +155,10 @@ function railRunsOn(TestableComponent $screen, string $ref): bool ->assertSee('Agreed') ->assertDontSee('2 replies'); - expect(threadRows($screen))->toBe(['focused-commit', 'thread-reply-r1', 'thread-reply-r2', 'commit-p2', 'commit-p3']); + expect(threadRows($screen))->toBe(['focused-commit', 'thread-reply-r1', 'thread-reply-r2', 'commit-p2', 'commit-p3']) + // The focused part gave up its hairline to its replies, and the later parts follow, so the last reply ends on it. + ->and(rendersRef($screen, 'thread-end-r2'))->toBeTrue() + ->and(rendersRef($screen, 'thread-end-r1'))->toBeFalse(); }); it('keeps replies at the foot of the last part\'s page', function () { @@ -168,7 +171,9 @@ function railRunsOn(TestableComponent $screen, string $ref): bool ->assertSee('The end'); expect(threadRows($screen))->toBe(['commit-p1', 'commit-p2', 'focused-commit', 'thread-reply-r1']) - ->and(railRunsOn($screen, 'focused-commit'))->toBeFalse(); + ->and(railRunsOn($screen, 'focused-commit'))->toBeFalse() + // Nothing follows the replies at the foot of the page, so they end on no hairline. + ->and(rendersRef($screen, 'thread-end-r1'))->toBeFalse(); }); it('keeps a deleted part in its place in the series', function () { From 59988ed55bf458619861888b52d303f0b802229f Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sun, 22 Nov 2026 13:14:51 +0000 Subject: [PATCH 43/46] Keep a quoted commit clear of the composer sheet's toolbar What sits under the field (the quoted commit, photos, the poll, "Submit at") had padding above it but none below, so the quote card ran into the toolbar's line. It now leaves 12pt there, the same gap the field leaves under "Replying to". Co-Authored-By: Claude Opus 5.5 --- resources/views/native/partials/commit-sheet.blade.php | 4 ++-- tests/Feature/Screens/QuoteTest.php | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/resources/views/native/partials/commit-sheet.blade.php b/resources/views/native/partials/commit-sheet.blade.php index 752f5022..66fea73d 100644 --- a/resources/views/native/partials/commit-sheet.blade.php +++ b/resources/views/native/partials/commit-sheet.blade.php @@ -36,7 +36,7 @@ The sheet doesn't scroll. The field fills the space between the author row and the toolbar, less what's under it: the photos as a strip of 80pt squares, the poll editor, the commit being quoted, or "Submit at", each at its own - height. Only the field scrolls its text. A toolbar is pinned to the bottom of the sheet, so + height, with 12pt clear of the toolbar, as the field leaves under "Replying to". Only the field scrolls its text. A toolbar is pinned to the bottom of the sheet, so it stays just above the keyboard: the tools on the left, photos, the camera, a poll (not on a reply) and the preview, which shows the draft as the commit it would become in place of the field (see AttachesToCommits), and stash@{0} and the counter on the right. An issue draft has no tools, as on the web. With photos, Commit spins while @@ -152,7 +152,7 @@ class="w-full h-full text-theme-ink" /> @php($hasBelow = $linkTooLong || $sheetImages !== [] || $pollShown || $quoting || $scheduling || $issueCommands !== [] || $issueHint !== null) - + @if ($linkTooLong) Each link must not be greater than {{ \App\Devnull\Data\BodyLink::MaxLength }} characters. @endif diff --git a/tests/Feature/Screens/QuoteTest.php b/tests/Feature/Screens/QuoteTest.php index e9a1eb92..cc716537 100644 --- a/tests/Feature/Screens/QuoteTest.php +++ b/tests/Feature/Screens/QuoteTest.php @@ -220,5 +220,7 @@ function quoteButtonDisabled(TestableComponent $screen): bool expect(childRefs($screen, 'sheet-below'))->toBe(['quote-card']) ->and(childRefs($screen, 'sheet-body-area'))->toBe(['sheet-field-slot', 'sheet-below']) - ->and(nodeByRef($screen, 'sheet-body')['props']['fills_height'] ?? null)->toBeTrue(); + ->and(nodeByRef($screen, 'sheet-body')['props']['fills_height'] ?? null)->toBeTrue() + // [top, right, bottom, left]: the card keeps clear of the toolbar, as the field does of "Replying to". + ->and(nodeByRef($screen, 'sheet-below')['layout']['padding'])->toEqual([12, 20, 12, 20]); }); From d122e6077bea88aecf16e109feec3b2bd71b3a41 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 24 Nov 2026 16:57:26 +0000 Subject: [PATCH 44/46] Update dependencies to pick up the merged core changes nativephp/mobile moves to a9fd09f, which brings the soft Liquid Glass behind a bottom bar (mobile-air#710) that this branch's composer bar needs, gradients that keep their dark colours (#734) and NavAction::subtitle() (#740). nativephp/mobile-ui moves to 633ebed, with the multiline field fix (#227) and menu row pictures (#224). The rest are routine Laravel and Symfony patch releases. Co-Authored-By: Claude Opus 5.5 --- composer.lock | 1091 +++++++++++++++++++++++++++---------------------- 1 file changed, 610 insertions(+), 481 deletions(-) diff --git a/composer.lock b/composer.lock index 1aa88999..2c9e81e3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8da614573009c041da1206198f293c72", + "content-hash": "9db9066376d7ad3b55e1afbfba7018e9", "packages": [ { "name": "bacon/bacon-qr-code", @@ -59,7 +59,8 @@ "issues": "https://github.com/Bacon/BaconQrCode/issues", "source": "https://github.com/Bacon/BaconQrCode/tree/v3.1.1" }, - "time": "2026-04-05T21:06:35+00:00" + "time": "2026-04-05T21:06:35+00:00", + "published-time": "2026-04-05T21:07:28+00:00" }, { "name": "brick/math", @@ -119,7 +120,8 @@ "type": "github" } ], - "time": "2026-09-12T10:28:18+00:00" + "time": "2026-09-12T10:28:18+00:00", + "published-time": "2026-09-12T12:23:30+00:00" }, { "name": "carbonphp/carbon-doctrine-types", @@ -193,7 +195,8 @@ "type": "tidelift" } ], - "time": "2026-09-06T14:11:38+00:00" + "time": "2026-09-06T14:11:38+00:00", + "published-time": "2026-09-06T14:15:00+00:00" }, { "name": "codingwithrk/nativephp-social-auth", @@ -262,7 +265,8 @@ "issues": "https://github.com/codingwithrk/nativephp-social-auth/issues", "source": "https://github.com/codingwithrk/nativephp-social-auth/tree/v1.0.0" }, - "time": "2026-09-12T10:32:53+00:00" + "time": "2026-09-12T10:32:53+00:00", + "published-time": "2026-09-12T10:35:30+00:00" }, { "name": "composer/semver", @@ -339,7 +343,8 @@ "type": "github" } ], - "time": "2026-10-29T09:13:34+00:00" + "time": "2026-10-29T09:13:34+00:00", + "published-time": "2026-10-29T09:14:11+00:00" }, { "name": "dasprid/enum", @@ -389,7 +394,8 @@ "issues": "https://github.com/DASPRiD/Enum/issues", "source": "https://github.com/DASPRiD/Enum/tree/1.0.7" }, - "time": "2025-09-16T12:23:56+00:00" + "time": "2025-09-16T12:23:56+00:00", + "published-time": "2025-09-16T12:25:04+00:00" }, { "name": "devnull/adaptive-layout", @@ -573,7 +579,8 @@ "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.3" }, - "time": "2024-07-08T12:26:09+00:00" + "time": "2024-07-08T12:26:09+00:00", + "published-time": "2024-07-08T12:27:13+00:00" }, { "name": "doctrine/inflector", @@ -663,7 +670,8 @@ "type": "tidelift" } ], - "time": "2026-10-26T08:14:14+00:00" + "time": "2026-10-26T08:14:14+00:00", + "published-time": "2026-10-26T20:06:59+00:00" }, { "name": "doctrine/lexer", @@ -738,7 +746,8 @@ "type": "tidelift" } ], - "time": "2026-10-01T06:59:29+00:00" + "time": "2026-10-01T06:59:29+00:00", + "published-time": "2026-10-01T07:01:28+00:00" }, { "name": "dragonmantank/cron-expression", @@ -802,30 +811,31 @@ "type": "github" } ], - "time": "2026-10-19T17:53:57+00:00" + "time": "2026-10-19T17:53:57+00:00", + "published-time": "2026-10-19T17:54:31+00:00" }, { "name": "egulias/email-validator", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa" + "reference": "9bef884e12278a7b89b64adbfb9379c021d3c102" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", - "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/9bef884e12278a7b89b64adbfb9379c021d3c102", + "reference": "9bef884e12278a7b89b64adbfb9379c021d3c102", "shasum": "" }, "require": { - "doctrine/lexer": "^2.0 || ^3.0", + "doctrine/lexer": "^3.0.3", "php": ">=8.1", - "symfony/polyfill-intl-idn": "^1.26" + "symfony/polyfill-intl-idn": "^1.43" }, "require-dev": { - "phpunit/phpunit": "^10.2", - "vimeo/psalm": "^5.12" + "phpunit/phpunit": "^10.5.67", + "vimeo/psalm": "^5.26.1" }, "suggest": { "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" @@ -861,7 +871,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/4.0.4" + "source": "https://github.com/egulias/EmailValidator/tree/4.0.5" }, "funding": [ { @@ -869,7 +879,8 @@ "type": "github" } ], - "time": "2025-03-06T22:45:56+00:00" + "time": "2026-11-22T16:52:20+00:00", + "published-time": "2026-11-22T22:05:57+00:00" }, { "name": "endroid/qr-code", @@ -941,7 +952,8 @@ "type": "github" } ], - "time": "2026-02-05T07:01:58+00:00" + "time": "2026-02-05T07:01:58+00:00", + "published-time": "2026-02-05T07:02:58+00:00" }, { "name": "evenement/evenement", @@ -988,7 +1000,8 @@ "issues": "https://github.com/igorw/evenement/issues", "source": "https://github.com/igorw/evenement/tree/v3.0.2" }, - "time": "2023-08-08T05:53:35+00:00" + "time": "2023-08-08T05:53:35+00:00", + "published-time": "2023-08-08T08:34:49+00:00" }, { "name": "fruitcake/php-cors", @@ -1059,7 +1072,8 @@ "type": "github" } ], - "time": "2025-12-03T09:33:47+00:00" + "time": "2025-12-03T09:33:47+00:00", + "published-time": "2025-12-03T09:37:01+00:00" }, { "name": "graham-campbell/result-type", @@ -1121,29 +1135,31 @@ "type": "tidelift" } ], - "time": "2026-08-24T09:06:52+00:00" + "time": "2026-08-24T09:06:52+00:00", + "published-time": "2026-08-24T09:07:57+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "8.3.1", + "version": "8.6.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "7d9b1f430bb65ac664e120af227bf9a795ad6333" + "reference": "ba6574fd975ab16f87dc356729a36777c03851e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7d9b1f430bb65ac664e120af227bf9a795ad6333", - "reference": "7d9b1f430bb65ac664e120af227bf9a795ad6333", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ba6574fd975ab16f87dc356729a36777c03851e8", + "reference": "ba6574fd975ab16f87dc356729a36777c03851e8", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^3.1", - "guzzlehttp/psr7": "^3.2", + "guzzlehttp/promises": "^3.2", + "guzzlehttp/psr7": "^3.6", "php": "^7.4 || ^8.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", + "symfony/deprecation-contracts": "^2.5 || ^3.0", "symfony/polyfill-php80": "^1.25", "symfony/polyfill-php82": "^1.27" }, @@ -1231,7 +1247,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/8.3.1" + "source": "https://github.com/guzzle/guzzle/tree/8.6.0" }, "funding": [ { @@ -1247,20 +1263,21 @@ "type": "tidelift" } ], - "time": "2026-10-25T21:35:34+00:00" + "time": "2026-11-22T16:48:13+00:00", + "published-time": "2026-11-22T16:50:37+00:00" }, { "name": "guzzlehttp/promises", - "version": "3.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "094d0ec418eb3b1411ea271a180ec95cae6ae933" + "reference": "a201cc78db93065f891278f86eaeaa1c97c5a158" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/094d0ec418eb3b1411ea271a180ec95cae6ae933", - "reference": "094d0ec418eb3b1411ea271a180ec95cae6ae933", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a201cc78db93065f891278f86eaeaa1c97c5a158", + "reference": "a201cc78db93065f891278f86eaeaa1c97c5a158", "shasum": "" }, "require": { @@ -1315,7 +1332,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/3.1.0" + "source": "https://github.com/guzzle/promises/tree/3.2.0" }, "funding": [ { @@ -1331,26 +1348,28 @@ "type": "tidelift" } ], - "time": "2026-10-18T12:48:16+00:00" + "time": "2026-11-21T03:48:02+00:00", + "published-time": "2026-11-21T03:48:27+00:00" }, { "name": "guzzlehttp/psr7", - "version": "3.2.0", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "cdc139396207a5eba10c242d241fb014cb098390" + "reference": "1fa0f8319c046b7dec80030460254283d851388e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/cdc139396207a5eba10c242d241fb014cb098390", - "reference": "cdc139396207a5eba10c242d241fb014cb098390", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/1fa0f8319c046b7dec80030460254283d851388e", + "reference": "1fa0f8319c046b7dec80030460254283d851388e", "shasum": "" }, "require": { "php": "^7.4 || ^8.0", "psr/http-factory": "^1.1", "psr/http-message": "^2.0", + "symfony/deprecation-contracts": "^2.5 || ^3.0", "symfony/polyfill-php80": "^1.25", "symfony/polyfill-php82": "^1.27" }, @@ -1366,6 +1385,7 @@ "phpunit/phpunit": "^9.6.34" }, "suggest": { + "ext-intl": "Convert internationalized hosts with Idna", "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", @@ -1434,7 +1454,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/3.2.0" + "source": "https://github.com/guzzle/psr7/tree/3.6.0" }, "funding": [ { @@ -1450,7 +1470,8 @@ "type": "tidelift" } ], - "time": "2026-10-17T23:57:19+00:00" + "time": "2026-11-22T00:00:35+00:00", + "published-time": "2026-11-22T00:01:04+00:00" }, { "name": "guzzlehttp/uri-template", @@ -1536,20 +1557,21 @@ "type": "tidelift" } ], - "time": "2026-08-24T17:13:02+00:00" + "time": "2026-08-24T17:13:02+00:00", + "published-time": "2026-08-24T17:13:22+00:00" }, { "name": "laravel/boost", - "version": "v2.10.3", + "version": "v2.10.4", "source": { "type": "git", "url": "https://github.com/laravel/boost.git", - "reference": "75c269a8a53e931c7252e7cd562e1a209356a7c6" + "reference": "9cd5e7d81300b5dee4c8b1619ec4b36f4a6367fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/boost/zipball/75c269a8a53e931c7252e7cd562e1a209356a7c6", - "reference": "75c269a8a53e931c7252e7cd562e1a209356a7c6", + "url": "https://api.github.com/repos/laravel/boost/zipball/9cd5e7d81300b5dee4c8b1619ec4b36f4a6367fd", + "reference": "9cd5e7d81300b5dee4c8b1619ec4b36f4a6367fd", "shasum": "" }, "require": { @@ -1568,7 +1590,7 @@ "laravel/pint": "^1.27.0", "mockery/mockery": "^1.6.12", "orchestra/testbench": "^9.15.0|^10.6|^11.0", - "pestphp/pest": "^2.36.0|^3.8.4|^4.1.5", + "pestphp/pest": "^2.36.0|^3.8.4|^4.1.5|^5.3.3", "phpstan/phpstan": "^2.1.27", "rector/rector": "^2.1" }, @@ -1603,20 +1625,21 @@ "issues": "https://github.com/laravel/boost/issues", "source": "https://github.com/laravel/boost" }, - "time": "2026-10-07T19:07:19+00:00" + "time": "2026-10-29T18:31:16+00:00", + "published-time": "2026-10-29T18:32:20+00:00" }, { "name": "laravel/framework", - "version": "v13.40.0", + "version": "v13.44.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "1449bf241017087fbd38c118ecaabef3f6797fdc" + "reference": "8a8c4a84852869e13190d89f9da873cd9a70f14c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/1449bf241017087fbd38c118ecaabef3f6797fdc", - "reference": "1449bf241017087fbd38c118ecaabef3f6797fdc", + "url": "https://api.github.com/repos/laravel/framework/zipball/8a8c4a84852869e13190d89f9da873cd9a70f14c", + "reference": "8a8c4a84852869e13190d89f9da873cd9a70f14c", "shasum": "" }, "require": { @@ -1642,7 +1665,7 @@ "league/commonmark": "^2.8.1", "league/flysystem": "^3.25.1", "league/flysystem-local": "^3.25.1", - "league/uri": "^7.5.1", + "league/uri": "^7.6", "monolog/monolog": "^3.10", "nesbot/carbon": "^3.8.4", "nunomaduro/termwind": "^2.0", @@ -1671,6 +1694,7 @@ "voku/portable-ascii": "^2.0.2" }, "conflict": { + "laravel/horizon": "<5.47.0", "tightenco/collect": "<5.5.33" }, "provide": { @@ -1719,11 +1743,12 @@ "spatie/once": "*" }, "require-dev": { - "ably/ably-php": "^1.0", + "ably/pubsub-server": "^1.0|^2.0", "aws/aws-sdk-php": "^3.322.9", "ext-gmp": "*", "fakerphp/faker": "^1.24", "intervention/image": "^4.2", + "jasonmccreary/double": "^1.2.1", "laravel/pint": "^1.18", "league/flysystem-aws-s3-v3": "^3.25.1", "league/flysystem-ftp": "^3.25.1", @@ -1735,7 +1760,7 @@ "orchestra/testbench-core": "^11.6.0", "pda/pheanstalk": "^7.0.0 || ^8.0.0", "php-http/discovery": "^1.15", - "phpstan/phpstan": "2.3.1", + "phpstan/phpstan": "2.3.5", "phpunit/phpunit": "^11.5.50 || ^12.5.8 || ^13.0.3", "predis/predis": "^2.3 || ^3.0", "rector/rector": "2.6.3", @@ -1748,7 +1773,7 @@ "web-token/jwt-library": "^4.1" }, "suggest": { - "ably/ably-php": "Required to use the Ably broadcast driver (^1.0).", + "ably/pubsub-server": "Required to use the Ably broadcast driver (^1.0|^2.0).", "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage, and SES mail driver (^3.322.9).", "brianium/paratest": "Required to run tests in parallel (^7.0 || ^8.0).", "ext-apcu": "Required to use the APC cache driver.", @@ -1834,40 +1859,41 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2026-11-03T15:07:18+00:00" + "time": "2026-11-24T16:10:06+00:00", + "published-time": "2026-11-24T16:10:17+00:00" }, { "name": "laravel/mcp", - "version": "v1.1.2", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/laravel/mcp.git", - "reference": "ab9238ce6c89095679651dd3d19d67641d73a436" + "reference": "a8057f222549e42384d49482042d762a547aaf2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/mcp/zipball/ab9238ce6c89095679651dd3d19d67641d73a436", - "reference": "ab9238ce6c89095679651dd3d19d67641d73a436", + "url": "https://api.github.com/repos/laravel/mcp/zipball/a8057f222549e42384d49482042d762a547aaf2a", + "reference": "a8057f222549e42384d49482042d762a547aaf2a", "shasum": "" }, "require": { "ext-json": "*", "ext-mbstring": "*", - "illuminate/console": "^11.45.3|^12.41.1|^13.0", - "illuminate/container": "^11.45.3|^12.41.1|^13.0", - "illuminate/contracts": "^11.45.3|^12.41.1|^13.0", - "illuminate/http": "^11.45.3|^12.41.1|^13.0", + "illuminate/console": "^12.41.1|^13.0", + "illuminate/container": "^12.41.1|^13.0", + "illuminate/contracts": "^12.41.1|^13.0", + "illuminate/http": "^12.41.1|^13.0", "illuminate/json-schema": "^12.41.1|^13.0", - "illuminate/routing": "^11.45.3|^12.41.1|^13.0", - "illuminate/support": "^11.45.3|^12.41.1|^13.0", - "illuminate/validation": "^11.45.3|^12.41.1|^13.0", + "illuminate/routing": "^12.41.1|^13.0", + "illuminate/support": "^12.41.1|^13.0", + "illuminate/validation": "^12.41.1|^13.0", "php": "^8.2", "symfony/process": "^7.4.5|^8.0.5" }, "require-dev": { "jasonmccreary/double": "^1.0", - "laravel/pint": "^1.20", - "orchestra/testbench": "^9.15|^10.8|^11.0", + "laravel/pint": "^1.20,!=1.32.2", + "orchestra/testbench": "^10.8|^11.0", "pestphp/pest": "^3.8.5|^4.3.2", "phpstan/phpstan": "^2.1.27", "rector/rector": "^2.2.4" @@ -1909,20 +1935,21 @@ "issues": "https://github.com/laravel/mcp/issues", "source": "https://github.com/laravel/mcp" }, - "time": "2026-10-26T17:48:48+00:00" + "time": "2026-11-17T16:36:18+00:00", + "published-time": "2026-11-17T18:52:14+00:00" }, { "name": "laravel/prompts", - "version": "v0.3.26", + "version": "v0.3.28", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "2d1e9bf6bab8d3f383c254db7f2b4ea8816d55e0" + "reference": "72247703c4d4ac1d6122955c90433aa9429bd236" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/2d1e9bf6bab8d3f383c254db7f2b4ea8816d55e0", - "reference": "2d1e9bf6bab8d3f383c254db7f2b4ea8816d55e0", + "url": "https://api.github.com/repos/laravel/prompts/zipball/72247703c4d4ac1d6122955c90433aa9429bd236", + "reference": "72247703c4d4ac1d6122955c90433aa9429bd236", "shasum": "" }, "require": { @@ -1965,9 +1992,10 @@ ], "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { - "source": "https://github.com/laravel/prompts/tree/v0.3.26" + "source": "https://github.com/laravel/prompts/tree/v0.3.28" }, - "time": "2026-10-09T14:45:13+00:00" + "time": "2026-11-23T14:41:10+00:00", + "published-time": "2026-11-24T16:27:03+00:00" }, { "name": "laravel/roster", @@ -2029,20 +2057,21 @@ "issues": "https://github.com/laravel/roster/issues", "source": "https://github.com/laravel/roster" }, - "time": "2026-07-18T17:53:15+00:00" + "time": "2026-07-18T17:53:15+00:00", + "published-time": "2026-07-20T09:14:35+00:00" }, { "name": "laravel/serializable-closure", - "version": "v2.1.0", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "2d5869a838bbcf37e0d8b0568fc41914e81374b5" + "reference": "2bfb44e8af009b553ed2c060c94b0bc3c67b4769" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/2d5869a838bbcf37e0d8b0568fc41914e81374b5", - "reference": "2d5869a838bbcf37e0d8b0568fc41914e81374b5", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/2bfb44e8af009b553ed2c060c94b0bc3c67b4769", + "reference": "2bfb44e8af009b553ed2c060c94b0bc3c67b4769", "shasum": "" }, "require": { @@ -2090,37 +2119,37 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2026-09-22T14:32:34+00:00" + "time": "2026-10-14T21:20:29+00:00", + "published-time": "2026-11-10T16:11:08+00:00" }, { "name": "laravel/tinker", - "version": "v3.0.2", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "4faba77764bd33411735936acdf30446d058c78b" + "reference": "0630f3d4dc64d7800e7f5dded22ea3362ed52adb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/4faba77764bd33411735936acdf30446d058c78b", - "reference": "4faba77764bd33411735936acdf30446d058c78b", + "url": "https://api.github.com/repos/laravel/tinker/zipball/0630f3d4dc64d7800e7f5dded22ea3362ed52adb", + "reference": "0630f3d4dc64d7800e7f5dded22ea3362ed52adb", "shasum": "" }, "require": { - "illuminate/console": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0", - "illuminate/contracts": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0", - "illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0", - "php": "^8.1", - "psy/psysh": "^0.12.0", - "symfony/var-dumper": "^5.4|^6.0|^7.0|^8.0" + "illuminate/console": "^12.0|^13.0", + "illuminate/contracts": "^12.0|^13.0", + "illuminate/support": "^12.0|^13.0", + "php": "^8.2", + "psy/psysh": "^0.12.19", + "symfony/var-dumper": "^7.0|^8.0" }, "require-dev": { - "mockery/mockery": "~1.3.3|^1.4.2", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^10.5|^11.5" + "phpunit/phpunit": "^10.5|^11.5|^12.5|^13.4" }, "suggest": { - "illuminate/database": "The Illuminate Database package (^8.0|^9.0|^10.0|^11.0|^12.0|^13.0)." + "illuminate/database": "The Illuminate Database package (^12.0|^13.0)." }, "type": "library", "extra": { @@ -2157,22 +2186,23 @@ ], "support": { "issues": "https://github.com/laravel/tinker/issues", - "source": "https://github.com/laravel/tinker/tree/v3.0.2" + "source": "https://github.com/laravel/tinker/tree/v3.2.0" }, - "time": "2026-03-17T14:54:13+00:00" + "time": "2026-11-11T14:11:46+00:00", + "published-time": "2026-11-17T15:22:49+00:00" }, { "name": "league/commonmark", - "version": "2.10.7", + "version": "2.10.8", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "8eb53e906fd60c67038d22f1f1cab420ed58b8be" + "reference": "681e662a40c805c567f52d603b64d55282ea356c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/8eb53e906fd60c67038d22f1f1cab420ed58b8be", - "reference": "8eb53e906fd60c67038d22f1f1cab420ed58b8be", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/681e662a40c805c567f52d603b64d55282ea356c", + "reference": "681e662a40c805c567f52d603b64d55282ea356c", "shasum": "" }, "require": { @@ -2266,7 +2296,8 @@ "type": "tidelift" } ], - "time": "2026-10-31T13:35:37+00:00" + "time": "2026-11-24T15:44:47+00:00", + "published-time": "2026-11-24T15:45:01+00:00" }, { "name": "league/config", @@ -2348,7 +2379,8 @@ "type": "github" } ], - "time": "2022-12-11T20:36:23+00:00" + "time": "2022-12-11T20:36:23+00:00", + "published-time": "2022-12-11T20:36:45+00:00" }, { "name": "league/flysystem", @@ -2431,7 +2463,8 @@ "issues": "https://github.com/thephpleague/flysystem/issues", "source": "https://github.com/thephpleague/flysystem/tree/3.36.0" }, - "time": "2026-09-02T08:00:27+00:00" + "time": "2026-09-02T08:00:27+00:00", + "published-time": "2026-09-02T08:01:40+00:00" }, { "name": "league/flysystem-local", @@ -2480,7 +2513,8 @@ "support": { "source": "https://github.com/thephpleague/flysystem-local/tree/3.35.3" }, - "time": "2026-08-12T13:29:21+00:00" + "time": "2026-08-12T13:29:21+00:00", + "published-time": "2026-08-22T12:57:18+00:00" }, { "name": "league/mime-type-detection", @@ -2536,25 +2570,26 @@ "type": "tidelift" } ], - "time": "2026-07-09T11:49:27+00:00" + "time": "2026-07-09T11:49:27+00:00", + "published-time": "2026-07-09T11:50:09+00:00" }, { "name": "league/uri", - "version": "7.9.1", + "version": "7.10.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri.git", - "reference": "40403f5c3141457a61f7f1aba6706e8fa4a0ece5" + "reference": "be89e2382e37acdef232259071ade5180821397b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/40403f5c3141457a61f7f1aba6706e8fa4a0ece5", - "reference": "40403f5c3141457a61f7f1aba6706e8fa4a0ece5", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/be89e2382e37acdef232259071ade5180821397b", + "reference": "be89e2382e37acdef232259071ade5180821397b", "shasum": "" }, "require": { "ext-mbstring": "*", - "league/uri-interfaces": "^7.9.1", + "league/uri-interfaces": "^7.10.0", "php": "^8.1", "psr/http-factory": "^1" }, @@ -2627,7 +2662,7 @@ "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", "issues": "https://github.com/thephpleague/uri-src/issues", - "source": "https://github.com/thephpleague/uri/tree/7.9.1" + "source": "https://github.com/thephpleague/uri/tree/7.10.0" }, "funding": [ { @@ -2635,20 +2670,21 @@ "type": "github" } ], - "time": "2026-10-27T07:14:23+00:00" + "time": "2026-11-04T12:45:07+00:00", + "published-time": "2026-11-04T13:02:21+00:00" }, { "name": "league/uri-interfaces", - "version": "7.9.1", + "version": "7.10.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-interfaces.git", - "reference": "994300a79e17f179112dc259f8df0c4de982f736" + "reference": "ea66240cff4ae9a56ce85d577a04d038b771e51c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/994300a79e17f179112dc259f8df0c4de982f736", - "reference": "994300a79e17f179112dc259f8df0c4de982f736", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/ea66240cff4ae9a56ce85d577a04d038b771e51c", + "reference": "ea66240cff4ae9a56ce85d577a04d038b771e51c", "shasum": "" }, "require": { @@ -2711,7 +2747,7 @@ "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", "issues": "https://github.com/thephpleague/uri-src/issues", - "source": "https://github.com/thephpleague/uri-interfaces/tree/7.9.1" + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.10.0" }, "funding": [ { @@ -2719,20 +2755,21 @@ "type": "github" } ], - "time": "2026-10-27T07:14:23+00:00" + "time": "2026-11-04T12:45:07+00:00", + "published-time": "2026-11-04T13:02:27+00:00" }, { "name": "monolog/monolog", - "version": "3.12.1", + "version": "3.13.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "d7059e4c691d05ea1222b5124bed0f961be46e15" + "reference": "1f5f55bb4a9a230ff6d8a4ceccea31d10b0142ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/d7059e4c691d05ea1222b5124bed0f961be46e15", - "reference": "d7059e4c691d05ea1222b5124bed0f961be46e15", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1f5f55bb4a9a230ff6d8a4ceccea31d10b0142ac", + "reference": "1f5f55bb4a9a230ff6d8a4ceccea31d10b0142ac", "shasum": "" }, "require": { @@ -2812,7 +2849,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.12.1" + "source": "https://github.com/Seldaek/monolog/tree/3.13.0" }, "funding": [ { @@ -2824,7 +2861,8 @@ "type": "tidelift" } ], - "time": "2026-09-29T19:21:12+00:00" + "time": "2026-11-16T10:43:05+00:00", + "published-time": "2026-11-16T10:45:37+00:00" }, { "name": "nativephp/mobile", @@ -2832,12 +2870,12 @@ "source": { "type": "git", "url": "https://github.com/NativePHP/mobile-air.git", - "reference": "db7d5db8a2870dc0badbf958377872cd4e3826fc" + "reference": "a9fd09f5b998b46cf70d50e29035b882d459f482" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/NativePHP/mobile-air/zipball/db7d5db8a2870dc0badbf958377872cd4e3826fc", - "reference": "db7d5db8a2870dc0badbf958377872cd4e3826fc", + "url": "https://api.github.com/repos/NativePHP/mobile-air/zipball/a9fd09f5b998b46cf70d50e29035b882d459f482", + "reference": "a9fd09f5b998b46cf70d50e29035b882d459f482", "shasum": "" }, "require": { @@ -2887,40 +2925,14 @@ } }, "autoload": { - "psr-4": { - "Native\\Mobile\\": "src/" - }, "files": [ "src/helpers.php" - ] - }, - "autoload-dev": { + ], "psr-4": { - "Tests\\": "tests/" + "Native\\Mobile\\": "src/" } }, - "scripts": { - "qa": [ - "@composer format", - "@composer analyse", - "@composer test" - ], - "post-autoload-dump": [ - "@php ./vendor/bin/testbench package:discover --ansi" - ], - "analyse": [ - "vendor/bin/phpstan analyse" - ], - "test": [ - "vendor/bin/pest" - ], - "test-coverage": [ - "vendor/bin/pest --coverage" - ], - "format": [ - "vendor/bin/pint" - ] - }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2945,10 +2957,11 @@ "nativephp" ], "support": { - "source": "https://github.com/NativePHP/mobile-air/tree/main", - "issues": "https://github.com/NativePHP/mobile-air/issues" + "issues": "https://github.com/NativePHP/mobile-air/issues", + "source": "https://github.com/NativePHP/mobile-air/tree/main" }, - "time": "2026-11-20T17:55:04+00:00" + "time": "2026-11-24T09:54:26+00:00", + "published-time": "2026-11-24T09:54:33+00:00" }, { "name": "nativephp/mobile-browser", @@ -3003,7 +3016,8 @@ "issues": "https://github.com/NativePHP/mobile-browser/issues", "source": "https://github.com/NativePHP/mobile-browser/tree/1.2.1" }, - "time": "2026-10-22T19:51:21+00:00" + "time": "2026-10-22T19:51:21+00:00", + "published-time": "2026-10-22T19:52:31+00:00" }, { "name": "nativephp/mobile-camera", @@ -3058,7 +3072,8 @@ "issues": "https://github.com/NativePHP/mobile-camera/issues", "source": "https://github.com/NativePHP/mobile-camera/tree/1.1.0" }, - "time": "2026-10-22T15:11:58+00:00" + "time": "2026-10-22T15:11:58+00:00", + "published-time": "2026-10-22T15:14:50+00:00" }, { "name": "nativephp/mobile-clipboard", @@ -3113,7 +3128,8 @@ "issues": "https://github.com/NativePHP/mobile-clipboard/issues", "source": "https://github.com/NativePHP/mobile-clipboard/tree/1.0.0" }, - "time": "2026-07-19T02:38:14+00:00" + "time": "2026-07-19T02:38:14+00:00", + "published-time": "2026-07-19T02:38:45+00:00" }, { "name": "nativephp/mobile-firebase", @@ -3224,7 +3240,8 @@ "issues": "https://github.com/NativePHP/mobile-media-player/issues", "source": "https://github.com/NativePHP/mobile-media-player/tree/1.1.0" }, - "time": "2026-10-29T09:15:16+00:00" + "time": "2026-10-29T09:15:16+00:00", + "published-time": "2026-10-29T09:19:23+00:00" }, { "name": "nativephp/mobile-microphone", @@ -3279,7 +3296,8 @@ "issues": "https://github.com/NativePHP/mobile-microphone/issues", "source": "https://github.com/NativePHP/mobile-microphone/tree/1.2.0" }, - "time": "2026-10-29T09:22:03+00:00" + "time": "2026-10-29T09:22:03+00:00", + "published-time": "2026-10-29T09:22:40+00:00" }, { "name": "nativephp/mobile-secure-storage", @@ -3338,16 +3356,16 @@ }, { "name": "nativephp/mobile-share", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/NativePHP/mobile-share.git", - "reference": "217a556ee7863010187a527752b8cef46057f2f5" + "reference": "cc30896ae0751e181c07ce290c05ac37253ae11b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/NativePHP/mobile-share/zipball/217a556ee7863010187a527752b8cef46057f2f5", - "reference": "217a556ee7863010187a527752b8cef46057f2f5", + "url": "https://api.github.com/repos/NativePHP/mobile-share/zipball/cc30896ae0751e181c07ce290c05ac37253ae11b", + "reference": "cc30896ae0751e181c07ce290c05ac37253ae11b", "shasum": "" }, "require": { @@ -3387,18 +3405,19 @@ "description": "Native share sheet plugin for NativePHP Mobile", "support": { "issues": "https://github.com/NativePHP/mobile-share/issues", - "source": "https://github.com/NativePHP/mobile-share/tree/1.1.0" + "source": "https://github.com/NativePHP/mobile-share/tree/1.1.1" }, - "time": "2026-09-03T18:26:20+00:00" + "time": "2026-11-04T12:56:41+00:00", + "published-time": "2026-11-04T12:58:17+00:00" }, { "name": "nativephp/mobile-skia", - "version": "1.0.0", + "version": "1.1.0", "dist": { "type": "zip", - "url": "https://plugins.nativephp.com/dist/nativephp/mobile-skia/nativephp-mobile-skia-ffc7fa9101c1e5183497773ea47cd16fdfbbc72d-zip-f04ec9.zip", - "reference": "ffc7fa9101c1e5183497773ea47cd16fdfbbc72d", - "shasum": "c468d6182ad2ca8e66c7d8827bff9e75499067b8" + "url": "https://plugins.nativephp.com/dist/nativephp/mobile-skia/nativephp-mobile-skia-17820ca291c9a00c5a882b3f083f861054e57407-zip-6b0370.zip", + "reference": "17820ca291c9a00c5a882b3f083f861054e57407", + "shasum": "2dd1514acf47112e11c1ba8f0b7accba38d707c1" }, "require": { "nativephp/mobile": "^4.5.1", @@ -3433,7 +3452,7 @@ ] }, "license": [ - "MIT" + "proprietary" ], "authors": [ { @@ -3451,7 +3470,7 @@ "nativephp", "skia" ], - "time": "2026-10-07T13:32:43+00:00" + "time": "2026-11-02T18:10:45+00:00" }, { "name": "nativephp/mobile-ui", @@ -3459,12 +3478,12 @@ "source": { "type": "git", "url": "https://github.com/NativePHP/mobile-ui.git", - "reference": "3a6096d7c7d1e7e81ab6c5ba1cd6c81bfedc3901" + "reference": "633ebed65ddcb204d343245a8b92196fec1d4185" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/NativePHP/mobile-ui/zipball/3a6096d7c7d1e7e81ab6c5ba1cd6c81bfedc3901", - "reference": "3a6096d7c7d1e7e81ab6c5ba1cd6c81bfedc3901", + "url": "https://api.github.com/repos/NativePHP/mobile-ui/zipball/633ebed65ddcb204d343245a8b92196fec1d4185", + "reference": "633ebed65ddcb204d343245a8b92196fec1d4185", "shasum": "" }, "require": { @@ -3524,7 +3543,7 @@ "url": "https://nativephp.com/sponsor" } ], - "time": "2026-11-19T22:21:34+00:00" + "time": "2026-11-24T10:20:57+00:00" }, { "name": "nesbot/carbon", @@ -3630,7 +3649,8 @@ "type": "tidelift" } ], - "time": "2026-10-25T14:32:48+00:00" + "time": "2026-10-25T14:32:48+00:00", + "published-time": "2026-10-25T14:41:05+00:00" }, { "name": "nette/schema", @@ -3697,7 +3717,8 @@ "issues": "https://github.com/nette/schema/issues", "source": "https://github.com/nette/schema/tree/v1.4.0" }, - "time": "2026-10-22T02:12:50+00:00" + "time": "2026-10-22T02:12:50+00:00", + "published-time": "2026-10-22T02:14:45+00:00" }, { "name": "nette/utils", @@ -3788,7 +3809,8 @@ "issues": "https://github.com/nette/utils/issues", "source": "https://github.com/nette/utils/tree/v4.1.6" }, - "time": "2026-10-20T17:07:56+00:00" + "time": "2026-10-20T17:07:56+00:00", + "published-time": "2026-10-20T17:48:30+00:00" }, { "name": "nikic/php-parser", @@ -3845,35 +3867,36 @@ "issues": "https://github.com/nikic/PHP-Parser/issues", "source": "https://github.com/nikic/PHP-Parser/tree/v5.9.0" }, - "time": "2026-09-13T18:51:52+00:00" + "time": "2026-09-13T18:51:52+00:00", + "published-time": "2026-09-13T18:53:16+00:00" }, { "name": "nunomaduro/termwind", - "version": "v2.4.0", + "version": "v2.4.1", "source": { "type": "git", "url": "https://github.com/nunomaduro/termwind.git", - "reference": "712a31b768f5daea284c2169a7d227031001b9a8" + "reference": "9b85ae4d802403bfc004ea633ce542bc262ee5c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/712a31b768f5daea284c2169a7d227031001b9a8", - "reference": "712a31b768f5daea284c2169a7d227031001b9a8", + "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/9b85ae4d802403bfc004ea633ce542bc262ee5c3", + "reference": "9b85ae4d802403bfc004ea633ce542bc262ee5c3", "shasum": "" }, "require": { "ext-mbstring": "*", "php": "^8.2", - "symfony/console": "^7.4.4 || ^8.0.4" + "symfony/console": "^7.4.23 || ^8.1.11" }, "require-dev": { - "illuminate/console": "^11.47.0", - "laravel/pint": "^1.27.1", - "mockery/mockery": "^1.6.12", - "pestphp/pest": "^2.36.0 || ^3.8.4 || ^4.3.2", - "phpstan/phpstan": "^1.12.32", + "illuminate/console": "^11.51 || ^12.70 || ^13.40", + "laravel/pint": "^1.30.4", + "mockery/mockery": "^1.6.15", + "pestphp/pest": "^2.36.1 || ^3.8.7 || ^4.7.8 || ^5.3.5", + "phpstan/phpstan": "^1.12.34", "phpstan/phpstan-strict-rules": "^1.6.2", - "symfony/var-dumper": "^7.3.5 || ^8.0.4", + "symfony/var-dumper": "^7.4.22 || ^8.1.10", "thecodingmachine/phpstan-strict-rules": "^1.0.0" }, "type": "library", @@ -3916,7 +3939,7 @@ ], "support": { "issues": "https://github.com/nunomaduro/termwind/issues", - "source": "https://github.com/nunomaduro/termwind/tree/v2.4.0" + "source": "https://github.com/nunomaduro/termwind/tree/v2.4.1" }, "funding": [ { @@ -3932,7 +3955,8 @@ "type": "github" } ], - "time": "2026-02-16T23:10:27+00:00" + "time": "2026-11-07T03:57:16+00:00", + "published-time": "2026-11-07T04:01:24+00:00" }, { "name": "phpoption/phpoption", @@ -4007,7 +4031,8 @@ "type": "tidelift" } ], - "time": "2026-08-24T00:54:40+00:00" + "time": "2026-08-24T00:54:40+00:00", + "published-time": "2026-08-24T01:09:05+00:00" }, { "name": "psr/clock", @@ -4055,7 +4080,8 @@ "issues": "https://github.com/php-fig/clock/issues", "source": "https://github.com/php-fig/clock/tree/1.0.0" }, - "time": "2022-11-25T14:36:26+00:00" + "time": "2022-11-25T14:36:26+00:00", + "published-time": "2022-11-25T14:59:22+00:00" }, { "name": "psr/container", @@ -4108,7 +4134,8 @@ "issues": "https://github.com/php-fig/container/issues", "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:47:00+00:00" + "time": "2021-11-05T16:47:00+00:00", + "published-time": "2021-11-05T16:53:27+00:00" }, { "name": "psr/event-dispatcher", @@ -4158,7 +4185,8 @@ "issues": "https://github.com/php-fig/event-dispatcher/issues", "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" }, - "time": "2019-01-08T18:20:26+00:00" + "time": "2019-01-08T18:20:26+00:00", + "published-time": "2019-03-25T15:31:44+00:00" }, { "name": "psr/http-client", @@ -4210,7 +4238,8 @@ "support": { "source": "https://github.com/php-fig/http-client" }, - "time": "2023-09-23T14:17:50+00:00" + "time": "2023-09-23T14:17:50+00:00", + "published-time": "2023-09-23T14:18:12+00:00" }, { "name": "psr/http-factory", @@ -4265,7 +4294,8 @@ "support": { "source": "https://github.com/php-fig/http-factory" }, - "time": "2024-04-15T12:06:14+00:00" + "time": "2024-04-15T12:06:14+00:00", + "published-time": "2024-05-10T07:32:19+00:00" }, { "name": "psr/http-message", @@ -4318,7 +4348,8 @@ "support": { "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2023-04-04T09:54:51+00:00" + "time": "2023-04-04T09:54:51+00:00", + "published-time": "2023-04-04T09:55:35+00:00" }, { "name": "psr/log", @@ -4368,7 +4399,8 @@ "support": { "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2024-09-11T13:17:53+00:00" + "time": "2024-09-11T13:17:53+00:00", + "published-time": "2024-09-11T13:21:14+00:00" }, { "name": "psr/simple-cache", @@ -4419,7 +4451,8 @@ "support": { "source": "https://github.com/php-fig/simple-cache/tree/3.0.0" }, - "time": "2021-10-29T13:26:27+00:00" + "time": "2021-10-29T13:26:27+00:00", + "published-time": "2021-10-29T13:27:19+00:00" }, { "name": "psy/psysh", @@ -4498,7 +4531,8 @@ "issues": "https://github.com/bobthecow/psysh/issues", "source": "https://github.com/bobthecow/psysh/tree/v0.12.24" }, - "time": "2026-06-29T15:41:09+00:00" + "time": "2026-06-29T15:41:09+00:00", + "published-time": "2026-06-29T15:41:53+00:00" }, { "name": "ramsey/collection", @@ -4574,20 +4608,21 @@ "issues": "https://github.com/ramsey/collection/issues", "source": "https://github.com/ramsey/collection/tree/2.1.1" }, - "time": "2025-03-22T05:38:12+00:00" + "time": "2025-03-22T05:38:12+00:00", + "published-time": "2025-03-22T05:39:22+00:00" }, { "name": "ramsey/uuid", - "version": "4.9.4", + "version": "4.10.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "75d73f48d02797c2c285a7e9f348fadc0102ffe2" + "reference": "f9aa3efc8015fcbc013d84d699583b268ccb593a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/75d73f48d02797c2c285a7e9f348fadc0102ffe2", - "reference": "75d73f48d02797c2c285a7e9f348fadc0102ffe2", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/f9aa3efc8015fcbc013d84d699583b268ccb593a", + "reference": "f9aa3efc8015fcbc013d84d699583b268ccb593a", "shasum": "" }, "require": { @@ -4599,23 +4634,22 @@ "rhumsaa/uuid": "self.version" }, "require-dev": { - "captainhook/captainhook": "^5.25", - "captainhook/plugin-composer": "^5.3", - "dealerdirect/phpcodesniffer-composer-installer": "^1.0", - "ergebnis/composer-normalize": "^2.47", - "mockery/mockery": "^1.6", - "paragonie/random-lib": "^2", - "php-mock/php-mock": "^2.6", - "php-mock/php-mock-mockery": "^1.5", + "captainhook/captainhook": "^5.29.3", + "captainhook/plugin-composer": "^5.3.3", + "dealerdirect/phpcodesniffer-composer-installer": "^1.2.1", + "mockery/mockery": "^1.6.15", + "paragonie/random-lib": "^2.0.3", + "php-mock/php-mock": "^2.7.0", + "php-mock/php-mock-mockery": "^1.5.0", "php-parallel-lint/php-parallel-lint": "^1.4.0", "phpbench/phpbench": "^1.2.14", - "phpstan/extension-installer": "^1.4", - "phpstan/phpstan": "^2.1", - "phpstan/phpstan-mockery": "^2.0", - "phpstan/phpstan-phpunit": "^2.0", - "phpunit/phpunit": "^9.6", - "slevomat/coding-standard": "^8.18", - "squizlabs/php_codesniffer": "^3.13" + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^2.3.5", + "phpstan/phpstan-mockery": "^2.0.0", + "phpstan/phpstan-phpunit": "^2.1.2", + "phpunit/phpunit": "^9.6.39", + "slevomat/coding-standard": "^8.31.3", + "squizlabs/php_codesniffer": "^4.0.4" }, "suggest": { "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", @@ -4650,9 +4684,10 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.9.4" + "source": "https://github.com/ramsey/uuid/tree/4.10.0" }, - "time": "2026-09-16T11:39:30+00:00" + "time": "2026-11-14T23:23:20+00:00", + "published-time": "2026-11-14T23:35:39+00:00" }, { "name": "react/cache", @@ -4724,7 +4759,8 @@ "type": "open_collective" } ], - "time": "2022-11-30T15:59:55+00:00" + "time": "2022-11-30T15:59:55+00:00", + "published-time": "2022-11-30T16:03:35+00:00" }, { "name": "react/datagram", @@ -4805,7 +4841,8 @@ "type": "open_collective" } ], - "time": "2024-09-06T11:22:35+00:00" + "time": "2024-09-06T11:22:35+00:00", + "published-time": "2024-09-06T11:49:15+00:00" }, { "name": "react/dns", @@ -4881,7 +4918,8 @@ "type": "open_collective" } ], - "time": "2025-11-18T19:34:28+00:00" + "time": "2025-11-18T19:34:28+00:00", + "published-time": "2025-11-18T19:35:06+00:00" }, { "name": "react/event-loop", @@ -4953,7 +4991,8 @@ "type": "open_collective" } ], - "time": "2025-11-17T20:46:25+00:00" + "time": "2025-11-17T20:46:25+00:00", + "published-time": "2025-11-17T20:47:32+00:00" }, { "name": "react/promise", @@ -5026,7 +5065,8 @@ "type": "open_collective" } ], - "time": "2025-08-19T18:57:03+00:00" + "time": "2025-08-19T18:57:03+00:00", + "published-time": "2025-08-19T19:13:36+00:00" }, { "name": "s2br/nativephp-mobile-splashscreen", @@ -5084,7 +5124,8 @@ "issues": "https://github.com/S2BR/nativephp-mobile-splashscreen/issues", "source": "https://github.com/S2BR/nativephp-mobile-splashscreen/tree/v1.4.0" }, - "time": "2026-07-21T13:52:18+00:00" + "time": "2026-07-21T13:52:18+00:00", + "published-time": "2026-07-21T13:54:32+00:00" }, { "name": "spatie/laravel-package-tools", @@ -5145,7 +5186,8 @@ "type": "github" } ], - "time": "2026-09-28T07:16:50+00:00" + "time": "2026-09-28T07:16:50+00:00", + "published-time": "2026-09-28T07:17:01+00:00" }, { "name": "symfony/clock", @@ -5222,20 +5264,21 @@ "type": "tidelift" } ], - "time": "2026-10-12T14:32:04+00:00" + "time": "2026-10-12T14:32:04+00:00", + "published-time": "2026-10-14T06:48:32+00:00" }, { "name": "symfony/console", - "version": "v8.1.10", + "version": "v8.1.11", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5b6d9b127ec27bc6db59bf65e2e37b6fe5b00083" + "reference": "5a315b092b81f3e920e9daea1a2ae4c66ed298b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5b6d9b127ec27bc6db59bf65e2e37b6fe5b00083", - "reference": "5b6d9b127ec27bc6db59bf65e2e37b6fe5b00083", + "url": "https://api.github.com/repos/symfony/console/zipball/5a315b092b81f3e920e9daea1a2ae4c66ed298b9", + "reference": "5a315b092b81f3e920e9daea1a2ae4c66ed298b9", "shasum": "" }, "require": { @@ -5302,7 +5345,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v8.1.10" + "source": "https://github.com/symfony/console/tree/v8.1.11" }, "funding": [ { @@ -5322,7 +5365,8 @@ "type": "tidelift" } ], - "time": "2026-10-28T11:16:19+00:00" + "time": "2026-11-04T07:07:11+00:00", + "published-time": "2026-11-04T11:31:39+00:00" }, { "name": "symfony/css-selector", @@ -5391,20 +5435,21 @@ "type": "tidelift" } ], - "time": "2026-10-18T14:56:39+00:00" + "time": "2026-10-18T14:56:39+00:00", + "published-time": "2026-10-28T18:24:46+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.7.1", + "version": "v3.8.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d" + "reference": "feb1edf4e546af3b85c5caebe8359a20db230ca3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/f3202fa1b5097b0af062dc978b32ecf63404e31d", - "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/feb1edf4e546af3b85c5caebe8359a20db230ca3", + "reference": "feb1edf4e546af3b85c5caebe8359a20db230ca3", "shasum": "" }, "require": { @@ -5417,7 +5462,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.7-dev" + "dev-main": "3.8-dev" } }, "autoload": { @@ -5442,7 +5487,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.8.1" }, "funding": [ { @@ -5462,7 +5507,8 @@ "type": "tidelift" } ], - "time": "2026-06-05T06:23:12+00:00" + "time": "2026-09-16T14:15:10+00:00", + "published-time": "2026-11-04T11:25:34+00:00" }, { "name": "symfony/error-handler", @@ -5543,7 +5589,8 @@ "type": "tidelift" } ], - "time": "2026-10-25T14:40:25+00:00" + "time": "2026-10-25T14:40:25+00:00", + "published-time": "2026-10-28T18:24:13+00:00" }, { "name": "symfony/event-dispatcher", @@ -5629,20 +5676,21 @@ "type": "tidelift" } ], - "time": "2026-08-21T17:47:34+00:00" + "time": "2026-08-21T17:47:34+00:00", + "published-time": "2026-08-22T13:46:58+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.7.1", + "version": "v3.8.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "c7de7a00ffb67842132da02ea92988a39ccd9f4e" + "reference": "658e29751424da3ef4758c60f769e59d1b2981eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/c7de7a00ffb67842132da02ea92988a39ccd9f4e", - "reference": "c7de7a00ffb67842132da02ea92988a39ccd9f4e", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/658e29751424da3ef4758c60f769e59d1b2981eb", + "reference": "658e29751424da3ef4758c60f769e59d1b2981eb", "shasum": "" }, "require": { @@ -5656,7 +5704,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.7-dev" + "dev-main": "3.8-dev" } }, "autoload": { @@ -5689,7 +5737,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.7.1" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.8.1" }, "funding": [ { @@ -5709,20 +5757,21 @@ "type": "tidelift" } ], - "time": "2026-06-05T06:23:12+00:00" + "time": "2026-09-16T14:15:10+00:00", + "published-time": "2026-11-04T11:25:36+00:00" }, { "name": "symfony/finder", - "version": "v8.1.10", + "version": "v8.1.11", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "2f4c0f26106520d82e1b71759d2fb8d32d8b7a43" + "reference": "a2902e479ba5691d20d51d100a715ea19ad2c837" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/2f4c0f26106520d82e1b71759d2fb8d32d8b7a43", - "reference": "2f4c0f26106520d82e1b71759d2fb8d32d8b7a43", + "url": "https://api.github.com/repos/symfony/finder/zipball/a2902e479ba5691d20d51d100a715ea19ad2c837", + "reference": "a2902e479ba5691d20d51d100a715ea19ad2c837", "shasum": "" }, "require": { @@ -5757,7 +5806,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v8.1.10" + "source": "https://github.com/symfony/finder/tree/v8.1.11" }, "funding": [ { @@ -5777,20 +5826,21 @@ "type": "tidelift" } ], - "time": "2026-10-19T17:00:07+00:00" + "time": "2026-11-02T10:58:30+00:00", + "published-time": "2026-11-04T11:31:20+00:00" }, { "name": "symfony/http-foundation", - "version": "v8.1.10", + "version": "v8.1.11", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "79325f87c3a2acc7564ddce9f457046e980e7255" + "reference": "30fa3efe6e736b0d06f5331cc6abe813582c0a26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/79325f87c3a2acc7564ddce9f457046e980e7255", - "reference": "79325f87c3a2acc7564ddce9f457046e980e7255", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/30fa3efe6e736b0d06f5331cc6abe813582c0a26", + "reference": "30fa3efe6e736b0d06f5331cc6abe813582c0a26", "shasum": "" }, "require": { @@ -5838,7 +5888,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v8.1.10" + "source": "https://github.com/symfony/http-foundation/tree/v8.1.11" }, "funding": [ { @@ -5858,20 +5908,21 @@ "type": "tidelift" } ], - "time": "2026-10-27T12:24:10+00:00" + "time": "2026-11-04T08:39:20+00:00", + "published-time": "2026-11-04T11:31:54+00:00" }, { "name": "symfony/http-kernel", - "version": "v8.1.10", + "version": "v8.1.11", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "924974dbdcdf4cc40d7bb2c65ae83bb6dc67cff1" + "reference": "460658504e26a2794aa614b4fbe6cf9bac2076fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/924974dbdcdf4cc40d7bb2c65ae83bb6dc67cff1", - "reference": "924974dbdcdf4cc40d7bb2c65ae83bb6dc67cff1", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/460658504e26a2794aa614b4fbe6cf9bac2076fe", + "reference": "460658504e26a2794aa614b4fbe6cf9bac2076fe", "shasum": "" }, "require": { @@ -5948,7 +5999,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v8.1.10" + "source": "https://github.com/symfony/http-kernel/tree/v8.1.11" }, "funding": [ { @@ -5968,7 +6019,8 @@ "type": "tidelift" } ], - "time": "2026-10-28T18:22:19+00:00" + "time": "2026-11-04T11:29:46+00:00", + "published-time": "2026-11-04T11:32:19+00:00" }, { "name": "symfony/mailer", @@ -6048,7 +6100,8 @@ "type": "tidelift" } ], - "time": "2026-10-23T17:06:53+00:00" + "time": "2026-10-23T17:06:53+00:00", + "published-time": "2026-10-28T18:23:52+00:00" }, { "name": "symfony/mime", @@ -6134,7 +6187,8 @@ "type": "tidelift" } ], - "time": "2026-10-28T17:58:38+00:00" + "time": "2026-10-28T17:58:38+00:00", + "published-time": "2026-10-28T18:23:55+00:00" }, { "name": "symfony/polyfill-ctype", @@ -6217,7 +6271,8 @@ "type": "tidelift" } ], - "time": "2026-04-10T16:19:22+00:00" + "time": "2026-04-10T16:19:22+00:00", + "published-time": "2026-04-26T14:44:50+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -6299,7 +6354,8 @@ "type": "tidelift" } ], - "time": "2026-10-15T09:18:53+00:00" + "time": "2026-10-15T09:18:53+00:00", + "published-time": "2026-10-28T10:07:44+00:00" }, { "name": "symfony/polyfill-intl-idn", @@ -6386,7 +6442,8 @@ "type": "tidelift" } ], - "time": "2026-09-23T14:40:04+00:00" + "time": "2026-09-23T14:40:04+00:00", + "published-time": "2026-09-30T10:23:39+00:00" }, { "name": "symfony/polyfill-intl-normalizer", @@ -6471,7 +6528,8 @@ "type": "tidelift" } ], - "time": "2026-09-23T22:02:09+00:00" + "time": "2026-09-23T22:02:09+00:00", + "published-time": "2026-09-30T10:23:47+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -6556,7 +6614,8 @@ "type": "tidelift" } ], - "time": "2026-10-28T09:35:49+00:00" + "time": "2026-10-28T09:35:49+00:00", + "published-time": "2026-10-28T10:07:45+00:00" }, { "name": "symfony/polyfill-php80", @@ -6640,7 +6699,8 @@ "type": "tidelift" } ], - "time": "2026-09-25T15:50:05+00:00" + "time": "2026-09-25T15:50:05+00:00", + "published-time": "2026-09-30T10:23:35+00:00" }, { "name": "symfony/polyfill-php82", @@ -6720,7 +6780,8 @@ "type": "tidelift" } ], - "time": "2026-09-25T15:50:05+00:00" + "time": "2026-09-25T15:50:05+00:00", + "published-time": "2026-09-30T10:23:32+00:00" }, { "name": "symfony/polyfill-php84", @@ -6800,20 +6861,21 @@ "type": "tidelift" } ], - "time": "2026-09-23T22:01:09+00:00" + "time": "2026-09-23T22:01:09+00:00", + "published-time": "2026-09-30T10:23:33+00:00" }, { "name": "symfony/polyfill-php85", - "version": "v1.43.0", + "version": "v1.44.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php85.git", - "reference": "86a42cbcc07adc331481a5ab310a4024bfc227f6" + "reference": "94c794cb5ba51784bc259f11e9f128593297d8dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/86a42cbcc07adc331481a5ab310a4024bfc227f6", - "reference": "86a42cbcc07adc331481a5ab310a4024bfc227f6", + "url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/94c794cb5ba51784bc259f11e9f128593297d8dc", + "reference": "94c794cb5ba51784bc259f11e9f128593297d8dc", "shasum": "" }, "require": { @@ -6860,7 +6922,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php85/tree/v1.43.0" + "source": "https://github.com/symfony/polyfill-php85/tree/v1.44.0" }, "funding": [ { @@ -6880,7 +6942,8 @@ "type": "tidelift" } ], - "time": "2026-09-25T15:46:47+00:00" + "time": "2026-10-30T15:20:09+00:00", + "published-time": "2026-11-15T14:20:22+00:00" }, { "name": "symfony/polyfill-php86", @@ -6960,7 +7023,8 @@ "type": "tidelift" } ], - "time": "2026-09-25T15:46:47+00:00" + "time": "2026-09-25T15:46:47+00:00", + "published-time": "2026-09-30T10:23:43+00:00" }, { "name": "symfony/polyfill-time", @@ -7043,7 +7107,8 @@ "type": "tidelift" } ], - "time": "2026-08-07T13:08:13+00:00" + "time": "2026-08-07T13:08:13+00:00", + "published-time": "2026-08-24T11:45:15+00:00" }, { "name": "symfony/polyfill-uuid", @@ -7126,7 +7191,8 @@ "type": "tidelift" } ], - "time": "2026-09-24T05:20:52+00:00" + "time": "2026-09-24T05:20:52+00:00", + "published-time": "2026-09-30T10:23:49+00:00" }, { "name": "symfony/process", @@ -7191,20 +7257,21 @@ "type": "tidelift" } ], - "time": "2026-10-25T14:40:25+00:00" + "time": "2026-10-25T14:40:25+00:00", + "published-time": "2026-10-28T18:25:20+00:00" }, { "name": "symfony/routing", - "version": "v8.1.10", + "version": "v8.1.11", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "41b32d2c5d907abe2c3ffaa7a112dd7492353822" + "reference": "f3fefc6cad3748d538be970ca81b71f06d7aa8b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/41b32d2c5d907abe2c3ffaa7a112dd7492353822", - "reference": "41b32d2c5d907abe2c3ffaa7a112dd7492353822", + "url": "https://api.github.com/repos/symfony/routing/zipball/f3fefc6cad3748d538be970ca81b71f06d7aa8b3", + "reference": "f3fefc6cad3748d538be970ca81b71f06d7aa8b3", "shasum": "" }, "require": { @@ -7251,7 +7318,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v8.1.10" + "source": "https://github.com/symfony/routing/tree/v8.1.11" }, "funding": [ { @@ -7271,20 +7338,21 @@ "type": "tidelift" } ], - "time": "2026-10-26T21:55:04+00:00" + "time": "2026-11-04T08:39:20+00:00", + "published-time": "2026-11-04T11:30:59+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.7.3", + "version": "v3.8.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257" + "reference": "052852a96fd5e5ebdb617dba22031e41a3300fb5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/15e6a07ec2a2c75ceb1b21dd98105ee8456d2257", - "reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/052852a96fd5e5ebdb617dba22031e41a3300fb5", + "reference": "052852a96fd5e5ebdb617dba22031e41a3300fb5", "shasum": "" }, "require": { @@ -7302,7 +7370,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.7-dev" + "dev-main": "3.8-dev" } }, "autoload": { @@ -7338,7 +7406,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.7.3" + "source": "https://github.com/symfony/service-contracts/tree/v3.8.1" }, "funding": [ { @@ -7358,7 +7426,8 @@ "type": "tidelift" } ], - "time": "2026-07-27T15:39:01+00:00" + "time": "2026-10-20T17:38:25+00:00", + "published-time": "2026-11-04T11:25:33+00:00" }, { "name": "symfony/string", @@ -7448,20 +7517,21 @@ "type": "tidelift" } ], - "time": "2026-10-23T17:06:53+00:00" + "time": "2026-10-23T17:06:53+00:00", + "published-time": "2026-10-28T18:24:27+00:00" }, { "name": "symfony/translation", - "version": "v8.1.10", + "version": "v8.1.11", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "8fbbb32f4bbbece5079acb01ab648fd20583fc93" + "reference": "d065adf56e5508293e80d7c140b0a9e043b63e9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/8fbbb32f4bbbece5079acb01ab648fd20583fc93", - "reference": "8fbbb32f4bbbece5079acb01ab648fd20583fc93", + "url": "https://api.github.com/repos/symfony/translation/zipball/d065adf56e5508293e80d7c140b0a9e043b63e9c", + "reference": "d065adf56e5508293e80d7c140b0a9e043b63e9c", "shasum": "" }, "require": { @@ -7521,7 +7591,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v8.1.10" + "source": "https://github.com/symfony/translation/tree/v8.1.11" }, "funding": [ { @@ -7541,20 +7611,21 @@ "type": "tidelift" } ], - "time": "2026-10-25T14:40:25+00:00" + "time": "2026-11-01T22:27:46+00:00", + "published-time": "2026-11-04T11:31:54+00:00" }, { "name": "symfony/translation-contracts", - "version": "v3.7.1", + "version": "v3.8.1", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "ccb206b98faccc511ebae8e5fad50f2dc0b30621" + "reference": "0a3ae917402632fcba2aeddae9c98332f3d7dd05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/ccb206b98faccc511ebae8e5fad50f2dc0b30621", - "reference": "ccb206b98faccc511ebae8e5fad50f2dc0b30621", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/0a3ae917402632fcba2aeddae9c98332f3d7dd05", + "reference": "0a3ae917402632fcba2aeddae9c98332f3d7dd05", "shasum": "" }, "require": { @@ -7567,7 +7638,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.7-dev" + "dev-main": "3.8-dev" } }, "autoload": { @@ -7603,7 +7674,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.7.1" + "source": "https://github.com/symfony/translation-contracts/tree/v3.8.1" }, "funding": [ { @@ -7623,7 +7694,8 @@ "type": "tidelift" } ], - "time": "2026-06-05T06:23:12+00:00" + "time": "2026-10-03T08:17:19+00:00", + "published-time": "2026-11-04T11:25:31+00:00" }, { "name": "symfony/uid", @@ -7701,7 +7773,8 @@ "type": "tidelift" } ], - "time": "2026-10-12T14:32:04+00:00" + "time": "2026-10-12T14:32:04+00:00", + "published-time": "2026-10-14T06:48:53+00:00" }, { "name": "symfony/var-dumper", @@ -7788,20 +7861,21 @@ "type": "tidelift" } ], - "time": "2026-10-26T21:55:04+00:00" + "time": "2026-10-26T21:55:04+00:00", + "published-time": "2026-10-28T18:25:26+00:00" }, { "name": "symfony/yaml", - "version": "v8.1.10", + "version": "v8.1.11", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "9de4ff9874dd18b738b9f248398c3e36ef15a1d2" + "reference": "e8266f55160f674f290a5f567cb55e11e21f921b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/9de4ff9874dd18b738b9f248398c3e36ef15a1d2", - "reference": "9de4ff9874dd18b738b9f248398c3e36ef15a1d2", + "url": "https://api.github.com/repos/symfony/yaml/zipball/e8266f55160f674f290a5f567cb55e11e21f921b", + "reference": "e8266f55160f674f290a5f567cb55e11e21f921b", "shasum": "" }, "require": { @@ -7844,7 +7918,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v8.1.10" + "source": "https://github.com/symfony/yaml/tree/v8.1.11" }, "funding": [ { @@ -7864,7 +7938,8 @@ "type": "tidelift" } ], - "time": "2026-10-18T14:56:39+00:00" + "time": "2026-11-04T08:39:20+00:00", + "published-time": "2026-11-04T11:31:03+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -7919,7 +7994,8 @@ "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.4.0" }, - "time": "2025-12-02T11:56:42+00:00" + "time": "2025-12-02T11:56:42+00:00", + "published-time": "2025-12-11T21:29:16+00:00" }, { "name": "victorycodedev/toastkit", @@ -7988,16 +8064,16 @@ }, { "name": "vlucas/phpdotenv", - "version": "v5.8.0", + "version": "v5.8.1", "source": { "type": "git", "url": "https://github.com/phpdotenv/phpdotenv.git", - "reference": "96149103e62ac67e915f6d2ef59b72dee2e011e0" + "reference": "ba37876e98122ca15151247ce1187d20ee8bf4e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpdotenv/phpdotenv/zipball/96149103e62ac67e915f6d2ef59b72dee2e011e0", - "reference": "96149103e62ac67e915f6d2ef59b72dee2e011e0", + "url": "https://api.github.com/repos/phpdotenv/phpdotenv/zipball/ba37876e98122ca15151247ce1187d20ee8bf4e0", + "reference": "ba37876e98122ca15151247ce1187d20ee8bf4e0", "shasum": "" }, "require": { @@ -8056,7 +8132,7 @@ ], "support": { "issues": "https://github.com/phpdotenv/phpdotenv/issues", - "source": "https://github.com/phpdotenv/phpdotenv/tree/v5.8.0" + "source": "https://github.com/phpdotenv/phpdotenv/tree/v5.8.1" }, "funding": [ { @@ -8068,7 +8144,8 @@ "type": "tidelift" } ], - "time": "2026-10-25T16:26:19+00:00" + "time": "2026-11-23T00:53:11+00:00", + "published-time": "2026-11-23T00:53:39+00:00" }, { "name": "voku/portable-ascii", @@ -8142,20 +8219,21 @@ "type": "tidelift" } ], - "time": "2026-04-26T05:33:54+00:00" + "time": "2026-04-26T05:33:54+00:00", + "published-time": "2026-04-26T05:43:38+00:00" }, { "name": "workerman/workerman", - "version": "v4.2.1", + "version": "v4.2.2", "source": { "type": "git", "url": "https://github.com/walkor/workerman.git", - "reference": "cafb5a43d93d7d30a16b32a57948581cca993562" + "reference": "5cc996a38944282da2746d6c44b5a4c2997ac66a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/walkor/workerman/zipball/cafb5a43d93d7d30a16b32a57948581cca993562", - "reference": "cafb5a43d93d7d30a16b32a57948581cca993562", + "url": "https://api.github.com/repos/walkor/workerman/zipball/5cc996a38944282da2746d6c44b5a4c2997ac66a", + "reference": "5cc996a38944282da2746d6c44b5a4c2997ac66a", "shasum": "" }, "require": { @@ -8205,7 +8283,8 @@ "type": "patreon" } ], - "time": "2024-11-24T11:45:37+00:00" + "time": "2026-11-13T11:24:40+00:00", + "published-time": "2026-11-13T11:59:53+00:00" } ], "packages-dev": [ @@ -8300,7 +8379,8 @@ "type": "paypal" } ], - "time": "2026-03-29T15:46:14+00:00" + "time": "2026-03-29T15:46:14+00:00", + "published-time": "2026-03-29T15:46:42+00:00" }, { "name": "composer/pcre", @@ -8376,7 +8456,8 @@ "type": "github" } ], - "time": "2026-06-07T11:47:49+00:00" + "time": "2026-06-07T11:47:49+00:00", + "published-time": "2026-06-11T12:12:37+00:00" }, { "name": "composer/xdebug-handler", @@ -8442,24 +8523,25 @@ "type": "tidelift" } ], - "time": "2024-05-06T16:37:16+00:00" + "time": "2024-05-06T16:37:16+00:00", + "published-time": "2024-05-06T17:01:42+00:00" }, { "name": "doctrine/deprecations", - "version": "1.1.6", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca" + "reference": "d2e16653a734c8784c1851ad68b02f997b53ca82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", - "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/d2e16653a734c8784c1851ad68b02f997b53ca82", + "reference": "d2e16653a734c8784c1851ad68b02f997b53ca82", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^7.4 || ^8.0" }, "conflict": { "phpunit/phpunit": "<=7.5 || >=14" @@ -8488,9 +8570,10 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.6" + "source": "https://github.com/doctrine/deprecations/tree/1.2.0" }, - "time": "2026-02-07T07:09:04+00:00" + "time": "2026-11-11T10:04:49+00:00", + "published-time": "2026-11-11T10:12:24+00:00" }, { "name": "fakerphp/faker", @@ -8553,7 +8636,8 @@ "issues": "https://github.com/FakerPHP/Faker/issues", "source": "https://github.com/FakerPHP/Faker/tree/v1.24.1" }, - "time": "2024-11-21T13:46:39+00:00" + "time": "2024-11-21T13:46:39+00:00", + "published-time": "2024-11-21T13:47:18+00:00" }, { "name": "fidry/cpu-core-counter", @@ -8615,20 +8699,21 @@ "type": "github" } ], - "time": "2026-09-29T22:11:39+00:00" + "time": "2026-09-29T22:11:39+00:00", + "published-time": "2026-09-29T22:12:43+00:00" }, { "name": "filp/whoops", - "version": "2.18.7", + "version": "2.19.3", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "50670ba239926c50f2073e868f6672f775cd57ec" + "reference": "d5480d53f10069dc4620a39f87e38e8945d47322" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/50670ba239926c50f2073e868f6672f775cd57ec", - "reference": "50670ba239926c50f2073e868f6672f775cd57ec", + "url": "https://api.github.com/repos/filp/whoops/zipball/d5480d53f10069dc4620a39f87e38e8945d47322", + "reference": "d5480d53f10069dc4620a39f87e38e8945d47322", "shasum": "" }, "require": { @@ -8678,7 +8763,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.18.7" + "source": "https://github.com/filp/whoops/tree/2.19.3" }, "funding": [ { @@ -8686,7 +8771,8 @@ "type": "github" } ], - "time": "2026-10-18T13:17:38+00:00" + "time": "2026-11-09T23:30:17+00:00", + "published-time": "2026-11-09T23:32:45+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -8741,7 +8827,8 @@ "issues": "https://github.com/hamcrest/hamcrest-php/issues", "source": "https://github.com/hamcrest/hamcrest-php/tree/v3.0.0" }, - "time": "2026-03-17T11:56:53+00:00" + "time": "2026-03-17T11:56:53+00:00", + "published-time": "2026-06-16T10:52:40+00:00" }, { "name": "jean85/pretty-package-versions", @@ -8801,42 +8888,43 @@ "issues": "https://github.com/Jean85/pretty-package-versions/issues", "source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.1" }, - "time": "2025-03-19T14:43:43+00:00" + "time": "2025-03-19T14:43:43+00:00", + "published-time": "2025-03-19T14:50:06+00:00" }, { "name": "laravel/pail", - "version": "v1.2.7", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/laravel/pail.git", - "reference": "2f7d27dada8effc48b8c424445a69cca7007daaa" + "reference": "72d615ff1104717c1317c6d5d7eab679e43a0408" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pail/zipball/2f7d27dada8effc48b8c424445a69cca7007daaa", - "reference": "2f7d27dada8effc48b8c424445a69cca7007daaa", + "url": "https://api.github.com/repos/laravel/pail/zipball/72d615ff1104717c1317c6d5d7eab679e43a0408", + "reference": "72d615ff1104717c1317c6d5d7eab679e43a0408", "shasum": "" }, "require": { "ext-mbstring": "*", - "illuminate/console": "^10.24|^11.0|^12.0|^13.0", - "illuminate/contracts": "^10.24|^11.0|^12.0|^13.0", - "illuminate/log": "^10.24|^11.0|^12.0|^13.0", - "illuminate/process": "^10.24|^11.0|^12.0|^13.0", - "illuminate/support": "^10.24|^11.0|^12.0|^13.0", - "nunomaduro/termwind": "^1.15|^2.0", + "illuminate/console": "^12.0|^13.0", + "illuminate/contracts": "^12.0|^13.0", + "illuminate/log": "^12.0|^13.0", + "illuminate/process": "^12.0|^13.0", + "illuminate/support": "^12.0|^13.0", + "nunomaduro/termwind": "^2.0", "php": "^8.2", - "symfony/console": "^6.0|^7.0|^8.0" + "symfony/console": "^7.0|^8.0" }, "require-dev": { - "laravel/framework": "^10.24|^11.0|^12.0|^13.0", + "laravel/framework": "^12.69|^13.30", "laravel/pint": "^1.13", - "orchestra/testbench-core": "^8.13|^9.17|^10.8|^11.0", - "pestphp/pest": "^2.20|^3.0|^4.0", - "pestphp/pest-plugin-type-coverage": "^2.3|^3.0|^4.0", + "orchestra/testbench-core": "^10.8|^11.0", + "pestphp/pest": "^3.0|^4.0", + "pestphp/pest-plugin-type-coverage": "^3.0|^4.0", "phpstan/phpstan": "^1.12.27", - "symfony/var-dumper": "^6.3|^7.0|^8.0", - "symfony/yaml": "^6.3|^7.0|^8.0" + "symfony/var-dumper": "^7.0|^8.0", + "symfony/yaml": "^7.0|^8.0" }, "type": "library", "extra": { @@ -8881,20 +8969,21 @@ "issues": "https://github.com/laravel/pail/issues", "source": "https://github.com/laravel/pail" }, - "time": "2026-05-20T22:24:57+00:00" + "time": "2026-11-09T14:56:19+00:00", + "published-time": "2026-11-10T16:07:50+00:00" }, { "name": "laravel/pint", - "version": "v1.32.1", + "version": "v1.32.3", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "006bd7825eb01daf92959d060b89cd9514fe4253" + "reference": "1cf8e0320bed4b3c6e51df92039a5636c3887728" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/006bd7825eb01daf92959d060b89cd9514fe4253", - "reference": "006bd7825eb01daf92959d060b89cd9514fe4253", + "url": "https://api.github.com/repos/laravel/pint/zipball/1cf8e0320bed4b3c6e51df92039a5636c3887728", + "reference": "1cf8e0320bed4b3c6e51df92039a5636c3887728", "shasum": "" }, "require": { @@ -8905,15 +8994,15 @@ "php": "^8.3.0" }, "require-dev": { - "composer/semver": "^3.4.4", - "friendsofphp/php-cs-fixer": "^3.95.25", - "illuminate/view": "^13.31.0", - "larastan/larastan": "^3.11.0", + "composer/semver": "^3.6.0", + "friendsofphp/php-cs-fixer": "^3.95.30", + "illuminate/view": "^13.42.0", + "larastan/larastan": "^3.15.0", "laravel-zero/framework": "^13.0.0", - "laravel/agent-detector": "^2.0.2", - "laravel/prompts": "^0.3.24", + "laravel/agent-detector": "^2.0.5", + "laravel/prompts": "^0.3.27", "mockery/mockery": "^1.6.15", - "nunomaduro/termwind": "^2.4.0", + "nunomaduro/termwind": "^2.4.1", "pestphp/pest": "^4.7.8" }, "bin": [ @@ -8951,32 +9040,33 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2026-09-10T10:47:55+00:00" + "time": "2026-11-11T16:45:13+00:00", + "published-time": "2026-11-11T16:45:39+00:00" }, { "name": "laravel/sail", - "version": "v1.69.0", + "version": "v1.71.0", "source": { "type": "git", "url": "https://github.com/laravel/sail.git", - "reference": "3587ac9d68e8f2eaf36bd9fb003a4555861dca9d" + "reference": "6b56b4f316d1e8048fac6840819b49eaef00cda1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/sail/zipball/3587ac9d68e8f2eaf36bd9fb003a4555861dca9d", - "reference": "3587ac9d68e8f2eaf36bd9fb003a4555861dca9d", + "url": "https://api.github.com/repos/laravel/sail/zipball/6b56b4f316d1e8048fac6840819b49eaef00cda1", + "reference": "6b56b4f316d1e8048fac6840819b49eaef00cda1", "shasum": "" }, "require": { - "illuminate/console": "^9.52.16|^10.0|^11.0|^12.0|^13.0", - "illuminate/contracts": "^9.52.16|^10.0|^11.0|^12.0|^13.0", - "illuminate/support": "^9.52.16|^10.0|^11.0|^12.0|^13.0", - "php": "^8.0", - "symfony/console": "^6.0|^7.0|^8.0", - "symfony/yaml": "^6.0|^7.0|^8.0" + "illuminate/console": "^12.0|^13.0", + "illuminate/contracts": "^12.0|^13.0", + "illuminate/support": "^12.0|^13.0", + "php": "^8.2", + "symfony/console": "^7.0|^8.0", + "symfony/yaml": "^7.0|^8.0" }, "require-dev": { - "orchestra/testbench": "^7.0|^8.0|^9.0|^10.0|^11.0", + "orchestra/testbench": "^10.0|^11.0", "phpstan/phpstan": "^2.0" }, "bin": [ @@ -9014,7 +9104,8 @@ "issues": "https://github.com/laravel/sail/issues", "source": "https://github.com/laravel/sail" }, - "time": "2026-10-08T20:06:52+00:00" + "time": "2026-11-11T14:19:59+00:00", + "published-time": "2026-11-17T15:19:48+00:00" }, { "name": "mockery/mockery", @@ -9096,7 +9187,8 @@ "security": "https://github.com/mockery/mockery/security/advisories", "source": "https://github.com/mockery/mockery" }, - "time": "2026-08-19T19:37:52+00:00" + "time": "2026-08-19T19:37:52+00:00", + "published-time": "2026-08-19T19:38:57+00:00" }, { "name": "myclabs/deep-copy", @@ -9156,40 +9248,41 @@ "type": "github" } ], - "time": "2026-08-11T10:17:44+00:00" + "time": "2026-08-11T10:17:44+00:00", + "published-time": "2026-08-11T10:29:20+00:00" }, { "name": "nunomaduro/collision", - "version": "v8.9.5", + "version": "v8.9.6", "source": { "type": "git", "url": "https://github.com/nunomaduro/collision.git", - "reference": "fb53eacd509a1d303858e2d20cfebf2d630254ec" + "reference": "68806f9257968f23775bee62970cb90925b79d51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/collision/zipball/fb53eacd509a1d303858e2d20cfebf2d630254ec", - "reference": "fb53eacd509a1d303858e2d20cfebf2d630254ec", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/68806f9257968f23775bee62970cb90925b79d51", + "reference": "68806f9257968f23775bee62970cb90925b79d51", "shasum": "" }, "require": { - "filp/whoops": "^2.18.4", - "nunomaduro/termwind": "^2.4.0", + "filp/whoops": "^2.19.3", + "nunomaduro/termwind": "^2.4.1", "php": "^8.2.0", - "symfony/console": "^7.4.14 || ^8.1.1" + "symfony/console": "^7.4.23 || ^8.1.11" }, "conflict": { "laravel/framework": "<11.48.0 || >=14.0.0", "phpunit/phpunit": "<11.5.50 || >=14.0.0" }, "require-dev": { - "brianium/paratest": "^7.8.5", - "larastan/larastan": "^3.10.0", - "laravel/framework": "^11.48.0 || ^12.56.0 || ^13.20.0", - "laravel/pint": "^1.29.3", - "orchestra/testbench-core": "^9.12.0 || ^10.12.1 || ^11.3.5", - "pestphp/pest": "^3.8.5 || ^4.7.5 || ^5.0.0", - "sebastian/environment": "^7.2.1 || ^8.1.2 || ^9.3.2" + "brianium/paratest": "^7.8.6", + "larastan/larastan": "^3.14.0", + "laravel/framework": "^11.57.1 || ^12.72.0 || ^13.40.0", + "laravel/pint": "^1.30.4", + "orchestra/testbench-core": "^9.24.0 || ^10.16.0 || ^11.6.0", + "pestphp/pest": "^3.8.7 || ^4.7.8 || ^5.3.5", + "sebastian/environment": "^7.2.1 || ^8.1.2 || ^9.3.3" }, "type": "library", "extra": { @@ -9252,7 +9345,8 @@ "type": "patreon" } ], - "time": "2026-07-15T19:09:14+00:00" + "time": "2026-11-10T17:06:52+00:00", + "published-time": "2026-11-10T17:23:22+00:00" }, { "name": "pestphp/pest", @@ -9370,7 +9464,8 @@ "type": "github" } ], - "time": "2026-08-03T20:49:44+00:00" + "time": "2026-08-03T20:49:44+00:00", + "published-time": "2026-08-03T20:50:30+00:00" }, { "name": "pestphp/pest-plugin", @@ -9440,7 +9535,8 @@ "type": "patreon" } ], - "time": "2025-08-20T12:35:58+00:00" + "time": "2025-08-20T12:35:58+00:00", + "published-time": "2025-08-20T12:36:18+00:00" }, { "name": "pestphp/pest-plugin-arch", @@ -9510,7 +9606,8 @@ "type": "github" } ], - "time": "2026-04-10T17:20:19+00:00" + "time": "2026-04-10T17:20:19+00:00", + "published-time": "2026-04-10T17:20:32+00:00" }, { "name": "pestphp/pest-plugin-laravel", @@ -9584,7 +9681,8 @@ "type": "github" } ], - "time": "2026-02-21T00:29:45+00:00" + "time": "2026-02-21T00:29:45+00:00", + "published-time": "2026-02-21T00:30:05+00:00" }, { "name": "pestphp/pest-plugin-mutate", @@ -9660,7 +9758,8 @@ "type": "github" } ], - "time": "2025-08-21T20:19:25+00:00" + "time": "2025-08-21T20:19:25+00:00", + "published-time": "2025-08-21T20:29:53+00:00" }, { "name": "pestphp/pest-plugin-profanity", @@ -9716,7 +9815,8 @@ "support": { "source": "https://github.com/pestphp/pest-plugin-profanity/tree/v4.2.1" }, - "time": "2025-12-08T00:13:17+00:00" + "time": "2025-12-08T00:13:17+00:00", + "published-time": "2025-12-08T00:14:31+00:00" }, { "name": "phar-io/manifest", @@ -9783,7 +9883,8 @@ "type": "github" } ], - "time": "2024-03-03T12:33:53+00:00" + "time": "2024-03-03T12:33:53+00:00", + "published-time": "2024-03-03T12:39:44+00:00" }, { "name": "phar-io/version", @@ -9834,7 +9935,8 @@ "issues": "https://github.com/phar-io/version/issues", "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2022-02-21T01:04:05+00:00" + "time": "2022-02-21T01:04:05+00:00", + "published-time": "2022-02-21T01:04:30+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -9892,7 +9994,8 @@ "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.2.1" }, - "time": "2025-11-10T21:21:55+00:00" + "time": "2025-11-10T21:21:55+00:00", + "published-time": "2026-09-27T10:14:49+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -9957,7 +10060,8 @@ "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/6.0.3" }, - "time": "2026-03-18T20:49:53+00:00" + "time": "2026-03-18T20:49:53+00:00", + "published-time": "2026-03-18T20:51:16+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -10015,20 +10119,21 @@ "issues": "https://github.com/phpDocumentor/TypeResolver/issues", "source": "https://github.com/phpDocumentor/TypeResolver/tree/2.1.0" }, - "time": "2026-09-27T19:32:54+00:00" + "time": "2026-09-27T19:32:54+00:00", + "published-time": "2026-09-28T18:39:55+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "2.4.0", + "version": "2.4.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "e3647094ed8f0f1f67393d812b793a5143e25af3" + "reference": "af8e840551031d254cfdb3a18a62c3470a309c10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/e3647094ed8f0f1f67393d812b793a5143e25af3", - "reference": "e3647094ed8f0f1f67393d812b793a5143e25af3", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/af8e840551031d254cfdb3a18a62c3470a309c10", + "reference": "af8e840551031d254cfdb3a18a62c3470a309c10", "shasum": "" }, "require": { @@ -10060,9 +10165,10 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/2.4.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.4.1" }, - "time": "2026-10-28T20:28:58+00:00" + "time": "2026-10-30T19:36:28+00:00", + "published-time": "2026-10-30T19:37:11+00:00" }, { "name": "phpunit/php-code-coverage", @@ -10150,7 +10256,8 @@ "type": "tidelift" } ], - "time": "2026-10-03T14:03:50+00:00" + "time": "2026-10-03T14:03:50+00:00", + "published-time": "2026-10-03T14:04:33+00:00" }, { "name": "phpunit/php-file-iterator", @@ -10223,7 +10330,8 @@ "type": "tidelift" } ], - "time": "2026-08-25T14:40:53+00:00" + "time": "2026-08-25T14:40:53+00:00", + "published-time": "2026-08-25T14:41:57+00:00" }, { "name": "phpunit/php-invoker", @@ -10287,7 +10395,8 @@ "type": "github" } ], - "time": "2025-02-07T04:58:58+00:00" + "time": "2025-02-07T04:58:58+00:00", + "published-time": "2025-02-07T04:59:09+00:00" }, { "name": "phpunit/php-text-template", @@ -10359,7 +10468,8 @@ "type": "tidelift" } ], - "time": "2026-10-03T04:51:29+00:00" + "time": "2026-10-03T04:51:29+00:00", + "published-time": "2026-10-03T04:54:39+00:00" }, { "name": "phpunit/php-timer", @@ -10419,7 +10529,8 @@ "type": "github" } ], - "time": "2025-02-07T04:59:38+00:00" + "time": "2025-02-07T04:59:38+00:00", + "published-time": "2025-02-07T04:59:52+00:00" }, { "name": "phpunit/phpunit", @@ -10509,7 +10620,8 @@ "type": "other" } ], - "time": "2026-07-28T13:58:09+00:00" + "time": "2026-07-28T13:58:09+00:00", + "published-time": "2026-07-28T14:01:28+00:00" }, { "name": "sebastian/cli-parser", @@ -10578,7 +10690,8 @@ "type": "tidelift" } ], - "time": "2026-05-17T05:29:34+00:00" + "time": "2026-05-17T05:29:34+00:00", + "published-time": "2026-05-17T05:30:34+00:00" }, { "name": "sebastian/comparator", @@ -10670,7 +10783,8 @@ "type": "tidelift" } ], - "time": "2026-05-21T04:45:25+00:00" + "time": "2026-05-21T04:45:25+00:00", + "published-time": "2026-05-21T04:45:36+00:00" }, { "name": "sebastian/complexity", @@ -10728,7 +10842,8 @@ "type": "github" } ], - "time": "2025-02-07T04:55:25+00:00" + "time": "2025-02-07T04:55:25+00:00", + "published-time": "2025-02-07T04:55:36+00:00" }, { "name": "sebastian/diff", @@ -10807,7 +10922,8 @@ "type": "tidelift" } ], - "time": "2026-08-25T15:35:54+00:00" + "time": "2026-08-25T15:35:54+00:00", + "published-time": "2026-08-25T15:37:16+00:00" }, { "name": "sebastian/environment", @@ -10883,7 +10999,8 @@ "type": "tidelift" } ], - "time": "2026-05-25T13:40:20+00:00" + "time": "2026-05-25T13:40:20+00:00", + "published-time": "2026-05-25T13:40:39+00:00" }, { "name": "sebastian/exporter", @@ -10973,7 +11090,8 @@ "type": "tidelift" } ], - "time": "2026-05-20T04:37:17+00:00" + "time": "2026-05-20T04:37:17+00:00", + "published-time": "2026-05-20T04:37:31+00:00" }, { "name": "sebastian/global-state", @@ -11047,7 +11165,8 @@ "type": "tidelift" } ], - "time": "2026-06-01T15:10:33+00:00" + "time": "2026-06-01T15:10:33+00:00", + "published-time": "2026-06-01T15:20:45+00:00" }, { "name": "sebastian/lines-of-code", @@ -11117,7 +11236,8 @@ "type": "tidelift" } ], - "time": "2026-05-19T16:22:07+00:00" + "time": "2026-05-19T16:22:07+00:00", + "published-time": "2026-05-19T16:22:47+00:00" }, { "name": "sebastian/object-enumerator", @@ -11175,7 +11295,8 @@ "type": "github" } ], - "time": "2025-02-07T04:57:48+00:00" + "time": "2025-02-07T04:57:48+00:00", + "published-time": "2025-02-07T04:58:08+00:00" }, { "name": "sebastian/object-reflector", @@ -11231,7 +11352,8 @@ "type": "github" } ], - "time": "2025-02-07T04:58:17+00:00" + "time": "2025-02-07T04:58:17+00:00", + "published-time": "2025-02-07T04:58:28+00:00" }, { "name": "sebastian/recursion-context", @@ -11307,7 +11429,8 @@ "type": "tidelift" } ], - "time": "2025-08-13T04:44:59+00:00" + "time": "2025-08-13T04:44:59+00:00", + "published-time": "2025-08-13T04:45:10+00:00" }, { "name": "sebastian/type", @@ -11376,20 +11499,21 @@ "type": "tidelift" } ], - "time": "2026-05-20T06:45:45+00:00" + "time": "2026-05-20T06:45:45+00:00", + "published-time": "2026-05-20T06:50:13+00:00" }, { "name": "sebastian/version", - "version": "6.0.1", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "9e935a16187e14f39b0e79910dabd614972cdb26" + "reference": "a8b6643a19ba6c8125a473623e45fb8cbb0e4159" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/9e935a16187e14f39b0e79910dabd614972cdb26", - "reference": "9e935a16187e14f39b0e79910dabd614972cdb26", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a8b6643a19ba6c8125a473623e45fb8cbb0e4159", + "reference": "a8b6643a19ba6c8125a473623e45fb8cbb0e4159", "shasum": "" }, "require": { @@ -11422,7 +11546,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/version/issues", "security": "https://github.com/sebastianbergmann/version/security/policy", - "source": "https://github.com/sebastianbergmann/version/tree/6.0.1" + "source": "https://github.com/sebastianbergmann/version/tree/6.0.2" }, "funding": [ { @@ -11442,7 +11566,8 @@ "type": "tidelift" } ], - "time": "2026-10-04T05:50:08+00:00" + "time": "2026-11-09T06:30:55+00:00", + "published-time": "2026-11-09T06:31:20+00:00" }, { "name": "staabm/side-effects-detector", @@ -11494,7 +11619,8 @@ "type": "github" } ], - "time": "2024-10-20T05:08:20+00:00" + "time": "2024-10-20T05:08:20+00:00", + "published-time": "2024-10-20T05:09:39+00:00" }, { "name": "ta-tikoma/phpunit-architecture-test", @@ -11553,7 +11679,8 @@ "issues": "https://github.com/ta-tikoma/phpunit-architecture-test/issues", "source": "https://github.com/ta-tikoma/phpunit-architecture-test/tree/0.8.7" }, - "time": "2026-02-17T17:25:14+00:00" + "time": "2026-02-17T17:25:14+00:00", + "published-time": "2026-02-17T17:26:32+00:00" }, { "name": "theseer/tokenizer", @@ -11603,20 +11730,21 @@ "type": "github" } ], - "time": "2025-12-08T11:19:18+00:00" + "time": "2025-12-08T11:19:18+00:00", + "published-time": "2025-12-08T11:19:39+00:00" }, { "name": "webmozart/assert", - "version": "2.5.0", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "8a163706bbcac613733dba03f51e13b5eb1bb819" + "reference": "e578132c01bd0c64108386ab20d8217cd175ddec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/8a163706bbcac613733dba03f51e13b5eb1bb819", - "reference": "8a163706bbcac613733dba03f51e13b5eb1bb819", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/e578132c01bd0c64108386ab20d8217cd175ddec", + "reference": "e578132c01bd0c64108386ab20d8217cd175ddec", "shasum": "" }, "require": { @@ -11667,9 +11795,10 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/2.5.0" + "source": "https://github.com/webmozarts/assert/tree/2.5.1" }, - "time": "2026-10-05T23:14:19+00:00" + "time": "2026-11-15T13:41:13+00:00", + "published-time": "2026-11-15T13:41:42+00:00" } ], "aliases": [ From 5f19776c30f338c389a53984a7c0ba1c54ef5895 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 24 Nov 2026 19:02:56 +0000 Subject: [PATCH 45/46] Drop the mobile-ui#227 test guard now the lock has it The base's dependency update moved mobile-ui to 633ebed, which is #227 merged at aaf451e, so the field fills and reports its caret on every install. Tests\Support\TextFieldFill only skipped tests on a mobile-ui without it, so it goes and those tests always run. ComposerSheet's mention row height and row count now come from Display, which #196 brought in with the same values. That keeps the sheet's sums in step with the rows the partial draws. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/ComposerSheet.php | 8 +++---- tests/Feature/Screens/CommitMentionsTest.php | 7 ------ tests/Feature/Screens/ComposeSheetTest.php | 5 ---- tests/Feature/Screens/QuoteTest.php | 3 --- tests/Support/TextFieldFill.php | 25 -------------------- tests/Unit/Devnull/ComposerSheetTest.php | 3 --- 6 files changed, 4 insertions(+), 47 deletions(-) delete mode 100644 tests/Support/TextFieldFill.php diff --git a/app/Devnull/ComposerSheet.php b/app/Devnull/ComposerSheet.php index 80a3ccf7..8f08c2b6 100644 --- a/app/Devnull/ComposerSheet.php +++ b/app/Devnull/ComposerSheet.php @@ -25,12 +25,12 @@ final class ComposerSheet public const int MinFieldLines = 2; /** - * The mention list's rows, and how many show before the rest scroll inside it. The same as - * Display::MentionRowHeight and Display::MentionRowsShown, which cap the lists by the other fields. + * The mention list's rows, and how many show before the rest scroll inside it. The same as the lists by the other + * fields (see Display), whose row height partials/mention-suggestions draws. */ - public const int MentionRowHeight = 44; + public const int MentionRowHeight = Display::MentionRowHeight; - public const int MentionRowsShown = 6; + public const int MentionRowsShown = Display::MentionRowsShown; /** The list's own padding above and under its rows (py-1), and its heading's height (one line of text-xs, py-1). */ public const int MentionPadding = 8; diff --git a/tests/Feature/Screens/CommitMentionsTest.php b/tests/Feature/Screens/CommitMentionsTest.php index 314f1760..69c2e0b0 100644 --- a/tests/Feature/Screens/CommitMentionsTest.php +++ b/tests/Feature/Screens/CommitMentionsTest.php @@ -7,7 +7,6 @@ use Native\Mobile\Testing\TestableComponent; use Native\Mobile\UI\Caret; use Tests\Support\LayoutAnimation; -use Tests\Support\TextFieldFill; beforeEach(function () { config(['devnull.url' => 'http://devnull.test']); @@ -212,8 +211,6 @@ function mentionsComposer(bool $quoting = false, ?array $mentions = null): Testa }); it('floats the suggestions over the quoted commit on glass, just under the caret line and as tall as their rows', function () { - TextFieldFill::skipUnlessSupported(); - $screen = mentionsComposer(quoting: true) ->input('sheet-body', "see\n@a", 6) ->moveCaretTo('sheet-body', new Caret(x: 20, y: 22, width: 2, height: 22, line: 1, fieldWidth: 350, fieldHeight: 240)); @@ -239,8 +236,6 @@ function mentionsComposer(bool $quoting = false, ?array $mentions = null): Testa }); it('scrolls a long list of suggestions in the sheet with one scroll view, its own', function () { - TextFieldFill::skipUnlessSupported(); - $people = array_map(fn (int $n): array => userJson(['id' => "u{$n}", 'handle' => "ada{$n}", 'name' => "Ada {$n}"]), range(1, 9)); $screen = mentionsComposer(mentions: [['data' => $people]]) ->input('sheet-body', "see\n\n\n\n\n\n@a", 12) @@ -256,8 +251,6 @@ function mentionsComposer(bool $quoting = false, ?array $mentions = null): Testa }); it('shortens the field to end on the caret line when the suggestions would not fit under it, and fills it again once they go', function () { - TextFieldFill::skipUnlessSupported(); - $screen = mentionsComposer(quoting: true)->input('sheet-body', "see\n\n\n\n\n\n\n\n@a", 14); $field = idsDownTo($screen->tree(), 'sheet-body'); diff --git a/tests/Feature/Screens/ComposeSheetTest.php b/tests/Feature/Screens/ComposeSheetTest.php index d7fdc3cd..9a5af929 100644 --- a/tests/Feature/Screens/ComposeSheetTest.php +++ b/tests/Feature/Screens/ComposeSheetTest.php @@ -8,7 +8,6 @@ use Native\Mobile\Testing\Native; use Native\Mobile\Testing\TestableComponent; use Native\Mobile\UI\Caret; -use Tests\Support\TextFieldFill; beforeEach(function () { config(['devnull.url' => 'http://devnull.test']); @@ -285,8 +284,6 @@ function sheetCommitDisabled(TestableComponent $screen): bool }); it('fills the sheet with the field, with nothing scrolling around it', function () { - TextFieldFill::skipUnlessSupported(); - $screen = composeSheetOnLog(); $field = nodeByRef($screen, 'sheet-body')['props']; @@ -308,8 +305,6 @@ function sheetCommitDisabled(TestableComponent $screen): bool }); it('keeps where the field says its caret is until the sheet goes', function () { - TextFieldFill::skipUnlessSupported(); - $screen = composeSheetOnLog() ->moveCaretTo('sheet-body', new Caret(y: 48, height: 24, line: 2, fieldWidth: 350, fieldHeight: 240)) ->assertSet('sheetCaret', ['bottom' => 72.0, 'line_height' => 24.0, 'field_height' => 240.0]); diff --git a/tests/Feature/Screens/QuoteTest.php b/tests/Feature/Screens/QuoteTest.php index cc716537..38d28c21 100644 --- a/tests/Feature/Screens/QuoteTest.php +++ b/tests/Feature/Screens/QuoteTest.php @@ -5,7 +5,6 @@ use Illuminate\Support\Facades\Http; use Native\Mobile\Testing\Native; use Native\Mobile\Testing\TestableComponent; -use Tests\Support\TextFieldFill; beforeEach(function () { config(['devnull.url' => 'http://devnull.test']); @@ -214,8 +213,6 @@ function quoteButtonDisabled(TestableComponent $screen): bool }); it('puts the quoted commit right under the field, which gives up the room it takes', function () { - TextFieldFill::skipUnlessSupported(); - $screen = quoteSheetOnLog(); expect(childRefs($screen, 'sheet-below'))->toBe(['quote-card']) diff --git a/tests/Support/TextFieldFill.php b/tests/Support/TextFieldFill.php deleted file mode 100644 index d714743c..00000000 --- a/tests/Support/TextFieldFill.php +++ /dev/null @@ -1,25 +0,0 @@ -markTestSkipped('Needs a mobile-ui whose multiline field fills and reports its caret (NativePHP/mobile-ui#227)'); - } - } -} diff --git a/tests/Unit/Devnull/ComposerSheetTest.php b/tests/Unit/Devnull/ComposerSheetTest.php index 8832a306..c5cdf23f 100644 --- a/tests/Unit/Devnull/ComposerSheetTest.php +++ b/tests/Unit/Devnull/ComposerSheetTest.php @@ -2,9 +2,6 @@ use App\Devnull\ComposerSheet; use Native\Mobile\UI\Caret; -use Tests\Support\TextFieldFill; - -beforeEach(fn () => TextFieldFill::skipUnlessSupported()); /** A field 360pt tall, as on a phone with the keyboard up, with its caret's line ending at $bottom. */ function composerCaret(float $bottom, float $fieldHeight = 360): array From ab4dca5701cddb4e7df7ef5ceeef85b81847aa0b Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Tue, 24 Nov 2026 19:13:51 +0000 Subject: [PATCH 46/46] Put the draft stash comment back on updatedSheetBody() sheetCaretMoved() landed between the comment and the method it describes, so it sat above another docblock and updatedSheetBody() had none. Co-Authored-By: Claude Opus 5.5 --- app/NativeComponents/Concerns/OpensCommitSheet.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/NativeComponents/Concerns/OpensCommitSheet.php b/app/NativeComponents/Concerns/OpensCommitSheet.php index b71a7ba4..9f771335 100644 --- a/app/NativeComponents/Concerns/OpensCommitSheet.php +++ b/app/NativeComponents/Concerns/OpensCommitSheet.php @@ -338,9 +338,6 @@ public function openScheduledCommits(): void $this->sheetOpen = false; } - /** - * Stashes the draft as it changes (see stashSheetDraft()). - */ /** * The sheet's field drew its caret somewhere else: it moved, the text wrapped differently, or the field scrolled. */ @@ -368,6 +365,9 @@ public function sheetMentionLayout(): ?array ); } + /** + * Stashes the draft as it changes (see stashSheetDraft()). + */ public function updatedSheetBody(): void { $this->typeIssueCommand();