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
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ yarn-error.log
/.vscode
/.zed
NUL
storage/.DS_Store
.DS_Store
Binary file added .junie/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Laravel Boost guidelines are specifically curated by Laravel maintainers for

This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.

- php - 8.4.15
- php - 8.5.0
- laravel/fortify (FORTIFY) - v1
- laravel/framework (LARAVEL) - v12
- laravel/prompts (PROMPTS) - v0
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Laravel Boost guidelines are specifically curated by Laravel maintainers for

This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.

- php - 8.4.15
- php - 8.5.0
- laravel/fortify (FORTIFY) - v1
- laravel/framework (LARAVEL) - v12
- laravel/prompts (PROMPTS) - v0
Expand Down
Binary file added app/.DS_Store
Binary file not shown.
19 changes: 19 additions & 0 deletions app/Console/Commands/SyncDataCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class SyncDataCommand extends Command
{
protected $signature = 'sync:data';

protected $description = 'Background sync task (runs via WorkManager)';

public function handle(): int
{
logger('sync:data fired at ' . now()->toDateTimeString());

return self::SUCCESS;
}
}
29 changes: 29 additions & 0 deletions app/Jobs/SleepTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Jobs;

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Native\Mobile\Facades\Dialog;

class SleepTest implements ShouldQueue
{
use Queueable;

/**
* Create a new job instance.
*/
public function __construct()
{
//
}

/**
* Execute the job.
*/
public function handle(): void
{
sleep(3);
Dialog::toast('Done sleeping from queue');
}
}
59 changes: 5 additions & 54 deletions app/NativeComponents/Explore.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,30 @@

namespace App\NativeComponents;

use App\Jobs\SleepTest;
use App\NativeComponents\Concerns\HasListingData;
use Native\Mobile\Edge\Element;
use Native\Mobile\Edge\NativeComponent;
use Native\Mobile\Edge\Transition;
use Native\Mobile\Facades\Device;
use Native\Mobile\Facades\Dialog;

class Explore extends NativeComponent
{
use HasListingData;

public int $count = 0;

public int $selectedCategory = -1;

/** @var array<int, bool> */
public array $wishlisted = [];

public function mount(): void
{
nativephp_call('UI.SetBackground', json_encode(['color' => '#FFFFFF']));
}

public function selectCategory(int $index): void
{
$this->selectedCategory = $this->selectedCategory === $index ? -1 : $index;
}

public function toggleWishlist(int $index): void
public function increment()
{
if (isset($this->wishlisted[$index])) {
unset($this->wishlisted[$index]);
} else {
$this->wishlisted[$index] = true;
}
$this->count++;
}

public function viewListing(int $index): void
public function decrement()
{
$this->navigate($this->route('listing.show', $index))
->transition(Transition::SlideFromRight);
$this->count--;
}

public function render(): Element
{
$allListings = self::listings();
$categories = self::categories();

$selectedName = '';
if ($this->selectedCategory >= 0 && isset($categories[$this->selectedCategory])) {
$selectedName = $categories[$this->selectedCategory]['name'];
}

$listings = $allListings;
if ($selectedName !== '') {
$listings = array_values(
array_filter($allListings, fn (array $listing): bool => $listing['category'] === $selectedName)
);
}

// Map back to original indices for navigation
$mappedListings = [];
foreach ($listings as $listing) {
$originalIndex = array_search($listing['title'], array_column($allListings, 'title'));
$listing['isWishlisted'] = isset($this->wishlisted[$originalIndex]);
$listing['originalIndex'] = $originalIndex;
$mappedListings[] = $listing;
}

return $this->view('explore', [
'listings' => $mappedListings,
'categories' => $categories,
]);
return $this->view('explore');
}
}
57 changes: 57 additions & 0 deletions app/NativeComponents/SkiaShowcase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

namespace App\NativeComponents;

use Native\Mobile\Edge\Element;
use Native\Mobile\Edge\NativeComponent;

class SkiaShowcase extends NativeComponent
{
public bool $pulseRunning = true;
public bool $spinRunning = true;
public bool $timerRunning = false;
public int $timerSeconds = 30;
public int $barAnimRunning = 1;
public int $waveRunning = 1;

public function mount(): void
{
nativephp_call('UI.SetBackground', json_encode(['color' => '#0f0f1e']));
}

public function togglePulse(): void
{
$this->pulseRunning = ! $this->pulseRunning;
}

public function toggleSpin(): void
{
$this->spinRunning = ! $this->spinRunning;
}

public function toggleTimer(): void
{
$this->timerRunning = ! $this->timerRunning;
}

public function setTimerSeconds(int $seconds): void
{
$this->timerSeconds = $seconds;
$this->timerRunning = false;
}

public function toggleBars(): void
{
$this->barAnimRunning = $this->barAnimRunning === 1 ? 0 : 1;
}

public function toggleWave(): void
{
$this->waveRunning = $this->waveRunning === 1 ? 0 : 1;
}

public function render(): Element
{
return $this->view('skia-showcase');
}
}
7 changes: 5 additions & 2 deletions app/Providers/NativeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ public function boot(): void
public function plugins(): array
{
return [
\Nativephp\ComposeUi\ComposeUIServiceProvider::class,
// \Nativephp\ComposeUi\ComposeUIServiceProvider::class,
\Native\Mobile\Providers\DialogServiceProvider::class,
\Native\Mobile\Providers\DeviceServiceProvider::class,

// \Native\Mobile\Providers\BackgroundTasksServiceProvider::class,
// \Native\Mobile\Providers\TimerServiceProvider::class,
// \Native\Mobile\Providers\DebugLogServiceProvider::class,
// \NativePhp\SkiaCanvas\SkiaCanvasServiceProvider::class,
];
}
}
8 changes: 1 addition & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@
],
"repositories": {

"ui": {
"type": "vcs",
"url": "https://github.com/NativePHP/compose-ui.git"
}
},
"license": "MIT",
"require": {
"php": "^8.2",
"php": "^8.5",
"laravel/fortify": "^1.30",
"laravel/framework": "^12.0",
"laravel/tinker": "^2.10.1",
"livewire/flux": "^2.9.0",
"livewire/livewire": "^4.0",
"nativephp/compose-ui": "*",
"nativephp/mobile": "dev-element",
"nativephp/mobile-device": "^1.0",
"nativephp/mobile-dialog": "^1.0"
Expand Down
Loading
Loading