Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 115 additions & 2 deletions app/Devnull/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
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;

/**
Expand Down Expand Up @@ -50,6 +52,29 @@ 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;

/**
* 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.
*/
Expand Down Expand Up @@ -253,8 +278,8 @@ 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
return self::composerFadeHeight()
+ self::composerBoxBarHeight()
+ self::composerBoxGrowth($draft)
+ ($hasPhotos ? self::ReplyBarPhotosHeight : 0)
+ ($hasPhotos && $describing ? self::ReplyBarDescriptionHeight : 0)
Expand Down Expand Up @@ -302,19 +327,103 @@ 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, 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 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')
|| ! method_exists(BottomBar::class, 'edgeBlurStyle')) {
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();
}

/**
* 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.
*/
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,
* 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. 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.
*
* 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 : '';
}

/**
* 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 : '';
}

/**
* 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
Expand All @@ -333,6 +442,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';
}

Expand Down
2 changes: 1 addition & 1 deletion app/NativeComponents/Conversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 7 additions & 5 deletions resources/views/native/commit-detail.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@
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::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
Expand All @@ -151,9 +153,9 @@
--}}
@php($replyPostingMe = app(\App\Devnull\Account::class)->user())
@php($replyPostsAs = $replyPostingMe !== null && \App\Devnull\PostAs::offered($replyAuthor))
<native:bottom-bar class="{{ \App\Devnull\Display::composerBarGlass() }}">
<native:bottom-bar class="{{ \App\Devnull\Display::composerBarGlass() }}" edge-blur="{{ \App\Devnull\Display::composerEdgeBlur() }}">
<native:column ref="reply-bar" class="w-full {{ \App\Devnull\Display::composerBar() }}">
@if (\App\Devnull\Display::fadesInBar())
@if (\App\Devnull\Display::fadeRowInBar())
@include('native.partials.composer-fade', ['ref' => 'reply-fade', 'inBar' => true])
@endif
<native:column native:key="reply-rows" ref="reply-rows" class="w-full {{ \App\Devnull\Display::composerSurface() }}">
Expand All @@ -164,7 +166,7 @@
otherwise take 10pt of the bar, and EDGE drops a height of 0.
--}}
@php($mentioning = ($mention['field'] ?? null) === 'reply' && ($mentionPeople !== [] || $mentionOrganizations !== []))
<native:row native:key="reply-mention-slot" ref="reply-mention-slot" class="w-full {{ $mentioning ? 'pt-1 ios:px-4' : 'h-[0.1]' }}">
<native:row native:key="reply-mention-slot" ref="reply-mention-slot" class="w-full {{ $mentioning ? 'pt-1 ios:pb-2 ios:px-4' : 'h-[0.1]' }}">
@include('native.partials.mention-suggestions', ['field' => 'reply', 'label' => 'Mention a developer'])
</native:row>
@php($showsPhotos = $replyImages !== [] && ! $replyPreviewing)
Expand Down
13 changes: 8 additions & 5 deletions resources/views/native/conversation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,17 @@
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::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.
--}}
<native:bottom-bar class="{{ \App\Devnull\Display::composerBarGlass() }}">
<native:bottom-bar class="{{ \App\Devnull\Display::composerBarGlass() }}" edge-blur="{{ \App\Devnull\Display::composerEdgeBlur() }}">
<native:column native:key="composer-bar" ref="composer-bar" class="w-full {{ \App\Devnull\Display::composerBar() }}">
@if (\App\Devnull\Display::fadesInBar())
@if (\App\Devnull\Display::fadeRowInBar())
@include('native.partials.composer-fade', ['ref' => 'composer-fade', 'inBar' => true])
@endif
<native:column native:key="composer-rows" ref="composer-rows" class="w-full {{ \App\Devnull\Display::composerSurface() }}">
Expand All @@ -100,10 +103,10 @@
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 !== []))
<native:row native:key="mention-slot" ref="mention-slot" class="w-full {{ $mentioning ? 'pt-1 ios:px-4' : 'h-[0.1]' }}">
<native:row native:key="mention-slot" ref="mention-slot" class="w-full {{ $mentioning ? 'pt-1 ios:pb-2 ios:px-4' : 'h-[0.1]' }}">
@include('native.partials.mention-suggestions', ['field' => 'draft', 'heading' => ($mention['query'] ?? null) === '' ? 'Members' : null])
</native:row>
<native:row native:key="replying-slot" ref="replying-slot" class="w-full {{ $replyTo ? 'ios:px-4' : 'h-[0.1]' }}">
<native:row native:key="replying-slot" ref="replying-slot" class="w-full {{ $replyTo ? 'ios:px-4 ios:pb-2' : 'h-[0.1]' }}">
@if ($replyTo)
<native:row ref="replying" class="flex-1 h-[44] px-4 gap-3 items-center ios:rounded-[18] ios:glass">
<native:column class="w-[2] h-[28] rounded-full bg-theme-{{ $myColour }}" />
Expand Down
13 changes: 8 additions & 5 deletions resources/views/native/partials/composer-box.blade.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 ??= [])
<native:column native:key="{{ $ref }}-box" ref="{{ $ref }}-box" class="w-full">
<native:row native:key="{{ $ref }}-field-row" ref="{{ $ref }}-field-row" class="w-full pl-4 pr-3 pt-1 pb-2">
<native:column native:key="{{ $ref }}-box" ref="{{ $ref }}-box" class="w-full {{ \App\Devnull\Display::composerBox() }}">
<native:row native:key="{{ $ref }}-field-row" ref="{{ $ref }}-field-row" class="w-full pl-4 pr-3 {{ \App\Devnull\Display::composerFieldTop() }} pb-2">
@include($field)
</native:row>
<native:row native:key="{{ $ref }}-actions" ref="{{ $ref }}-actions" class="w-full h-[40] pl-1 pr-[6] pb-1 gap-2 items-center">
Expand Down
3 changes: 2 additions & 1 deletion resources/views/native/partials/composer-fade.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
<native:column ref="{{ $ref }}" class="{{ $inBar ? '' : 'absolute bottom-0 left-0' }} w-full h-[{{ \App\Devnull\Display::ComposerFadeHeight }}] {{ \App\Devnull\Display::composerFade() }}" />
59 changes: 59 additions & 0 deletions tests/Feature/Devnull/ComposerScrollEdgeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

use App\Devnull\Display;
use Native\Mobile\System;
use Tests\Support\ScrollEdge;

it('stands the composer bars on the scroll edge effect from iOS 26, and keeps the fade before it and on Android', function (string $platform, string $version, bool $edge) {
ScrollEdge::onIos($version, function () use ($platform, $edge): void {
System::rememberPlatform($platform);

try {
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::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);
}
});
})->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 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)
->and(Display::composerEdgeBlur())->toBe(Display::ComposerEdgeBlur);
} finally {
System::rememberPlatform(null);
}

System::rememberPlatform('android');

try {
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);
});
Loading
Loading