Skip to content

Commit 2aa9813

Browse files
authored
App Icon version 2 (#103)
* Alt implementation * Fix styling --------- Co-authored-by: simonhamp <[email protected]>
1 parent 1080f97 commit 2aa9813

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

src/Commands/BuildCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
use Illuminate\Support\Str;
88
use Native\Electron\Concerns\LocatesPhpBinary;
99
use Native\Electron\Facades\Updater;
10+
use Native\Electron\Traits\InstallsAppIcon;
1011
use Native\Electron\Traits\OsAndArch;
1112

1213
class BuildCommand extends Command
1314
{
15+
use InstallsAppIcon;
1416
use LocatesPhpBinary;
1517
use OsAndArch;
1618

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

45+
$this->installIcon();
46+
4347
$buildCommand = 'build';
4448
if ($os != 'all') {
4549
$arch = $this->selectArchitectureForOs($os, $this->argument('arch'));
4650

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

49-
// Wether to publish the app or not
53+
// Should we publish?
5054
if ($publish = ($this->option('publish'))) {
5155
$buildCommand = 'publish';
5256
}

src/Commands/DevelopCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
use Illuminate\Console\Command;
66
use Native\Electron\Traits\Developer;
77
use Native\Electron\Traits\Installer;
8+
use Native\Electron\Traits\InstallsAppIcon;
89

910
use function Laravel\Prompts\intro;
1011
use function Laravel\Prompts\note;
1112

1213
class DevelopCommand extends Command
1314
{
14-
use Developer, Installer;
15+
use Developer, Installer, InstallsAppIcon;
1516

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

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

3738
$this->patchPackageJson();
3839

40+
$this->installIcon();
41+
3942
$this->runDeveloper(installer: $this->option('installer'), skip_queue: $this->option('no-queue'));
4043
}
4144

src/Traits/InstallsAppIcon.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Native\Electron\Traits;
4+
5+
use function Laravel\Prompts\intro;
6+
use function Laravel\Prompts\note;
7+
8+
trait InstallsAppIcon
9+
{
10+
public function installIcon()
11+
{
12+
intro('Copying app icons...');
13+
14+
@copy(public_path('icon.png'), __DIR__.'/../../resources/js/resources/icon.png');
15+
@copy(public_path('IconTemplate.png'), __DIR__.'/../../resources/js/resources/IconTemplate.png');
16+
@copy(public_path('[email protected]'), __DIR__.'/../../resources/js/resources/[email protected]');
17+
18+
note('App icons copied');
19+
}
20+
}

0 commit comments

Comments
 (0)