Skip to content
Merged
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
12 changes: 9 additions & 3 deletions app/NativeComponents/Concerns/DrawsSkeletonFirst.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
namespace App\NativeComponents\Concerns;

use App\Devnull\FirstFrame;
use Native\Mobile\Facades\System;

/**
* A tab that opens on skeleton rows and fills in what it kept straight after.
* A tab that opens on skeleton rows and fills in what it kept straight after,
* on Android.
*
* Drawing a screen of kept rows took 2 to 3 seconds on a slow Android phone,
* with nothing on screen to say the tap had worked. A first frame of skeleton
* rows draws at once, and its kept rows and the refresh behind them follow as
* soon as FirstFrame comes back from the background thread.
*
* iOS opens on what it kept. It puts a tab back as it was last drawn the
* moment you tap it, so a skeleton frame there only cut from those rows to a
* spinner and back.
*
* config('devnull.skeleton_first') turns it off, as phpunit.xml does, so a
* test sees a screen as it fills in.
*/
Expand All @@ -24,11 +30,11 @@ trait DrawsSkeletonFirst

/**
* Shows what was kept, then calls $then (the screen's refresh), after a
* first frame of skeleton rows.
* first frame of skeleton rows on Android.
*/
protected function fillInAfterFirstFrame(string $then): void
{
if (! config('devnull.skeleton_first')) {
if (! config('devnull.skeleton_first') || System::isIos()) {
$this->fillIn($then);

return;
Expand Down
7 changes: 4 additions & 3 deletions config/devnull.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
| Skeleton first
|--------------------------------------------------------------------------
|
| A tab draws its first frame with skeleton rows only, so it shows as soon
| as you tap it, and fills in what it kept straight after. Off, it opens on
| what it kept, which tests rely on.
| On Android, a tab draws its first frame with skeleton rows only, so it
| shows as soon as you tap it, and fills in what it kept straight after.
| iOS, and every platform with this off, opens on what it kept, which
| tests rely on.
|
*/

Expand Down
11 changes: 11 additions & 0 deletions tests/Feature/Screens/NotificationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,17 @@ function ringColour(TestableComponent $screen, string $id): ?string
finishRefreshes($screen)->assertSet('skeletonFrame', false)->assertSee('followed you');
});

it('opens on what it kept on iOS, which puts a tab back as it was last drawn, with no spinner first', function () {
config(['devnull.skeleton_first' => true]);
holdRefreshes();
keep('notifications', inboxJson([notificationJson('followed')]), ['type' => null]);

$screen = Native::visit('/notifications', platform: 'ios');

$screen->assertSet('skeletonFrame', false)->assertSee('followed you');
expect(showsLoading(showingNotifications($screen)))->toBeFalse();
});

it('lists a group of followers when it is tapped, each with the same small follow back, and none for the group', function () {
serveApi(function (Request $request) {
return str_contains($request->url(), '/group')
Expand Down
Loading