Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
1fee225
Enable iPad support in NativePHP config
shanesmithdev Dec 1, 2026
d44eae7
Let the two-column host split an iPad in portrait, behind a sidebar o…
shanesmithdev Dec 1, 2026
b76c92f
Share the two-column host's back-report check
shanesmithdev Dec 1, 2026
ddefb01
Split the Account screen into a partial per section
shanesmithdev Dec 1, 2026
e865a75
List the rows of Account's sidebar and the sections each opens
shanesmithdev Dec 1, 2026
82d010a
Show Account as a sidebar and a pane on wide iOS windows
shanesmithdev Dec 1, 2026
91ca4fe
Say device instead of phone on the Account screen
shanesmithdev Dec 1, 2026
bf2c9b5
Move the Safety list test helpers into Pest.php with clearer names
shanesmithdev Dec 1, 2026
abf7ba6
Fix Account's Safety pane not updating when you come back to it
shanesmithdev Dec 1, 2026
5d15672
Fix the sidebar width splitting across the Duo's hinge
shanesmithdev Dec 1, 2026
dceddf9
Fix swiping back from Account while it shows two columns
shanesmithdev Dec 1, 2026
7ff2a77
Fix Profile menu needing two taps on an iPad in portrait
shanesmithdev Dec 1, 2026
cb27b58
Fix the back swipe stopping after a cancelled swipe on Account
shanesmithdev Dec 1, 2026
86fa581
Say device in the Sign out confirmation
shanesmithdev Dec 1, 2026
29dcab1
Open Account in two columns straight away on an iPad
shanesmithdev Dec 1, 2026
0556f3e
Fix Account opening on Notifications when your profile loads after it…
shanesmithdev Dec 1, 2026
11ddda1
Fix the sidebar's banners sharing refs with the Safety pane's
shanesmithdev Dec 1, 2026
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
102 changes: 102 additions & 0 deletions app/Devnull/AccountSection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

namespace App\Devnull;

use App\Icons\Lucide;

/**
* The rows of the Account screen's sidebar on a wide window, each opening its sections beside it. A row can gather
* several of the long scroll's sections, such as Features for the switches that turn a feature on or off. Terms and
* privacy, Delete account and Sign out sit apart at the bottom. Sign out opens nothing: it asks you to confirm. Safety
* opens the muted and blocked lists themselves, rather than a section with a button to them.
*/
enum AccountSection: string
{
case Profile = 'profile';
case Timezone = 'timezone';
case Features = 'features';
case Notifications = 'notifications';
case Safety = 'safety';
case Devices = 'devices';
case Terms = 'terms';
case Delete = 'delete';
case SignOut = 'sign-out';

public function title(): string
{
return match ($this) {
self::Profile => 'Profile',
self::Timezone => 'Timezone',
self::Features => 'Features',
self::Notifications => 'Notifications',
self::Safety => 'Safety',
self::Devices => 'Devices',
self::Terms => 'Terms and privacy',
self::Delete => 'Delete account',
self::SignOut => 'Sign out',
};
}

public function icon(): Lucide
{
return match ($this) {
self::Profile => Lucide::UserRound,
self::Timezone => Lucide::Clock3,
self::Features => Lucide::Sparkles,
self::Notifications => Lucide::Bell,
self::Safety => Lucide::Shield,
self::Devices => Lucide::TabletSmartphone,
self::Terms => Lucide::Bookmark,
self::Delete => Lucide::Trash2,
self::SignOut => Lucide::LogOut,
};
}

/**
* The long scroll's sections this row opens, in order, by their partial's name. Apple ID only shows where Apple
* is offered. Safety and Sign out open no sections.
*
* @return list<string>
*/
public function sections(bool $offersApple): array
{
return match ($this) {
self::Profile => ['profile', 'color'],
self::Timezone => ['timezone'],
self::Features => ['pasteis', 'remotes', 'who-to-follow'],
self::Notifications => ['push'],
self::Devices => $offersApple ? ['apple', 'this-phone'] : ['this-phone'],
self::Terms => ['terms'],
self::Delete => ['delete'],
self::Safety, self::SignOut => [],
};
}

public function setApart(): bool
{
return in_array($this, [self::Terms, self::Delete, self::SignOut], true);
}

public function hasPane(): bool
{
return $this !== self::SignOut;
}

/**
* The rows that are about your profile, which the screen only shows once it has loaded.
*/
public function needsProfile(): bool
{
return in_array($this, [self::Profile, self::Timezone, self::Features], true);
}

/**
* The rows the screen can show now, in order.
*
* @return list<self>
*/
public static function available(bool $hasProfile): array
{
return array_values(array_filter(self::cases(), fn (self $section): bool => $hasProfile || ! $section->needsProfile()));
}
}
22 changes: 22 additions & 0 deletions app/Devnull/DeviceModel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Devnull;

use Native\Mobile\Facades\Device;

/**
* What kind of device the app runs on, as the device names its own model.
*/
final class DeviceModel
{
/**
* Whether the app runs on an iPad. iOS names every iPad's model "iPad", and Android never does. Each call asks
* the device, so read it once when a screen opens.
*/
public static function isIpad(): bool
{
$info = json_decode((string) Device::getInfo(), true);

return is_array($info) && ($info['model'] ?? null) === 'iPad';
}
}
45 changes: 45 additions & 0 deletions app/NativeComponents/Concerns/FollowsAdaptiveHost.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace App\NativeComponents\Concerns;

/**
* Reads what the two-column host reports through its change callback. A back report says which history the native
* side saw, and one about an older history is dropped, so a late report never closes the wrong page.
*/
trait FollowsAdaptiveHost
{
/**
* The host's report, decoded, or null when it isn't one.
*
* @return array<string, mixed>|null
*/
protected function hostReport(string $event): ?array
{
$change = json_decode($event, true);

return is_array($change) && is_string($change['action'] ?? null) ? $change : null;
}

/**
* How deep the history should be after a back report: the depth to keep, or null when the report is about a
* history other than the one PHP has now.
*
* @param array<string, mixed> $change
* @param list<string> $identities The history PHP has now, oldest first.
*/
protected function backDepthFrom(array $change, array $identities, int $revision): ?int
{
$expected = $change['expected_history'] ?? null;

if (! is_array($expected)
|| ($change['expected_revision'] ?? null) !== $revision
|| ($change['expected_depth'] ?? null) !== count($expected)
|| array_slice($expected, 0, count($identities)) !== $identities) {
return null;
}

$depth = $change['depth'] ?? count($identities) - 1;

return is_int($depth) && $depth >= 0 && $depth < count($identities) ? $depth : null;
}
}
2 changes: 1 addition & 1 deletion app/NativeComponents/Concerns/LeavesDevnull.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function confirmSignOut(): void
{
Dialog::alert(
'Sign out?',
'This deletes the key from this phone. The phone stays listed on dev-null.sh until you remove it there, and signing in again makes a new key.',
'This deletes the key from this device. The device stays listed on dev-null.sh until you remove it there, and signing in again makes a new key.',
[
['label' => 'Cancel', 'style' => 'cancel'],
['label' => 'Sign out', 'style' => 'destructive'],
Expand Down
57 changes: 50 additions & 7 deletions app/NativeComponents/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use App\Devnull\Data\Page;
use App\Devnull\Data\Profile as ProfileData;
use App\Devnull\Data\User;
use App\Devnull\DeviceModel;
use App\Devnull\ErrorCode;
use App\Devnull\Exceptions\ApiException;
use App\Devnull\RowCache;
Expand Down Expand Up @@ -153,12 +154,19 @@ class Profile extends NativeComponent
*/
public ?string $unavailable = null;

/**
* Whether the app runs on an iPad, read once when the screen opens. See navigationOptions().
*/
public bool $onIpad = false;

public function mount(): void
{
if ($this->username === '') {
$this->username = $this->me()?->username ?? '';
}

$this->onIpad = DeviceModel::isIpad();

if ($this->isMe()) {
$this->tab = app(ShownTabs::class)->get($this->me()?->id, 'profile', self::Tabs, 'commits');
}
Expand All @@ -181,8 +189,33 @@ public function navTitle(): string
return '@'.$this->username;
}

/**
* Your own profile puts Scheduled commits and Starred in the bar, then a ⋯ with Share profile
* and Account. On an iPad in portrait the top tab bar leaves too little room for all three,
* so iPadOS folds them into its own overflow menu, and Account ends up in a menu inside a
* menu. So on an iPad they all go in the one ⋯, which always fits.
*/
public function navigationOptions(): ?NavBarOptions
{
if ($this->isMe() && $this->onIpad) {
return NavBarOptions::make()->action(
NavAction::make('more')
->icon(ios: Lucide::Ellipsis->ios(), android: Lucide::Ellipsis->android())
->a11yLabel('More options')
->items([
NavAction::make('scheduled')
->label('Scheduled commits')
->icon(ios: Lucide::CalendarDays->ios(), android: Lucide::CalendarDays->android())
->press('openScheduledCommits'),
NavAction::make('starred')
->label('Starred')
->icon(ios: Lucide::Star->ios(), android: Lucide::Star->android())
->press('openStarred'),
...$this->ownMenuItems(),
]),
);
}

if ($this->isMe()) {
return NavBarOptions::make()
->action(
Expand All @@ -201,13 +234,7 @@ public function navigationOptions(): ?NavBarOptions
NavAction::make('more')
->icon(ios: Lucide::Ellipsis->ios(), android: Lucide::Ellipsis->android())
->a11yLabel('More options')
->items([
$this->shareAction()->label('Share profile'),
NavAction::make('account')
->label('Account')
->icon(ios: Lucide::Settings2->ios(), android: Lucide::Settings2->android())
->press('openAccount'),
]),
->items($this->ownMenuItems()),
);
}

Expand All @@ -219,6 +246,22 @@ public function navigationOptions(): ?NavBarOptions
);
}

/**
* Share profile and Account, which end the ⋯ of your own profile.
*
* @return list<NavAction>
*/
private function ownMenuItems(): array
{
return [
$this->shareAction()->label('Share profile'),
NavAction::make('account')
->label('Account')
->icon(ios: Lucide::Settings2->ios(), android: Lucide::Settings2->android())
->press('openAccount'),
];
}

/**
* Share profile, under the share shape each phone uses (Lucide's share on
* iOS, share-2 on Android), first in the ⋯ of every profile. It's always
Expand Down
Loading