Skip to content

App Icon version 2 #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 2, 2024
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
6 changes: 5 additions & 1 deletion src/Commands/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
use Illuminate\Support\Str;
use Native\Electron\Concerns\LocatesPhpBinary;
use Native\Electron\Facades\Updater;
use Native\Electron\Traits\InstallsAppIcon;
use Native\Electron\Traits\OsAndArch;

class BuildCommand extends Command
{
use InstallsAppIcon;
use LocatesPhpBinary;
use OsAndArch;

Expand Down Expand Up @@ -40,13 +42,15 @@ public function handle(): void
// Added checks for correct input for os and arch
$os = $this->selectOs($this->argument('os'));

$this->installIcon();

$buildCommand = 'build';
if ($os != 'all') {
$arch = $this->selectArchitectureForOs($os, $this->argument('arch'));

$os .= $arch != 'all' ? "-{$arch}" : '';

// Wether to publish the app or not
// Should we publish?
if ($publish = ($this->option('publish'))) {
$buildCommand = 'publish';
}
Expand Down
5 changes: 4 additions & 1 deletion src/Commands/DevelopCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
use Illuminate\Console\Command;
use Native\Electron\Traits\Developer;
use Native\Electron\Traits\Installer;
use Native\Electron\Traits\InstallsAppIcon;

use function Laravel\Prompts\intro;
use function Laravel\Prompts\note;

class DevelopCommand extends Command
{
use Developer, Installer;
use Developer, Installer, InstallsAppIcon;

protected $signature = 'native:serve {--no-queue} {--D|no-dependencies} {--installer=npm}';

Expand All @@ -36,6 +37,8 @@ public function handle(): void

$this->patchPackageJson();

$this->installIcon();

$this->runDeveloper(installer: $this->option('installer'), skip_queue: $this->option('no-queue'));
}

Expand Down
20 changes: 20 additions & 0 deletions src/Traits/InstallsAppIcon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Native\Electron\Traits;

use function Laravel\Prompts\intro;
use function Laravel\Prompts\note;

trait InstallsAppIcon
{
public function installIcon()
{
intro('Copying app icons...');

@copy(public_path('icon.png'), __DIR__.'/../../resources/js/resources/icon.png');
@copy(public_path('IconTemplate.png'), __DIR__.'/../../resources/js/resources/IconTemplate.png');
@copy(public_path('[email protected]'), __DIR__.'/../../resources/js/resources/[email protected]');

note('App icons copied');
}
}
Loading