Skip to content

Commit 93e8470

Browse files
committed
Fix file selector param names
1 parent 8330e4d commit 93e8470

9 files changed

Lines changed: 39 additions & 94 deletions

File tree

src/Api/Autorun/AutorunExtension.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ public function __construct(
3333

3434
public function load(IdentifiableInterface $ctx, EventListener $listener): null
3535
{
36-
/**
37-
* Checks for the presence of a deprecated config flag.
38-
*
39-
* TODO The {@see ApplicationCreateInfo::$autorun} check should be
40-
* removed after the flag is removed.
41-
*/
42-
if (!$ctx->info->autorun) {
43-
return null;
44-
}
45-
4636
$this->listenStartup($ctx, $listener);
4737

4838
$callback = function () use ($ctx, $listener): void {

src/Api/Dialog/FileSelectorInterface.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,30 @@ interface FileSelectorInterface
99
/**
1010
* Opens a system dialog to open a specific file.
1111
*
12-
* @param non-empty-string|null $path
12+
* @param non-empty-string|null $directory
1313
* @param iterable<mixed, non-empty-string> $filter
1414
*
1515
* @return non-empty-string|null
1616
*/
17-
public function selectFile(?string $path = null, iterable $filter = []): ?string;
17+
public function selectFile(?string $directory = null, iterable $filter = []): ?string;
1818

1919
/**
2020
* Opens a system dialog to open a specific directory.
2121
*
22-
* @param non-empty-string|null $path
22+
* @param non-empty-string|null $directory
2323
* @param iterable<mixed, non-empty-string> $filter
2424
*
2525
* @return non-empty-string|null
2626
*/
27-
public function selectDirectory(?string $path = null, iterable $filter = []): ?string;
27+
public function selectDirectory(?string $directory = null, iterable $filter = []): ?string;
2828

2929
/**
3030
* Opens a system dialog to open a list of specific files.
3131
*
32-
* @param non-empty-string|null $path
32+
* @param non-empty-string|null $directory
3333
* @param iterable<mixed, non-empty-string> $filter
3434
*
3535
* @return iterable<array-key, non-empty-string>
3636
*/
37-
public function selectFiles(?string $path = null, iterable $filter = []): iterable;
37+
public function selectFiles(?string $directory = null, iterable $filter = []): iterable;
3838
}

src/Api/Dialog/SaucerDialogApi.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,35 +137,35 @@ public function open(string|\Stringable $uri): void
137137
$this->dispatch(new UriOpened($this->app, $uri));
138138
}
139139

140-
public function selectDirectory(?string $path = null, iterable $filter = []): ?string
140+
public function selectDirectory(?string $directory = null, iterable $filter = []): ?string
141141
{
142-
if (!$this->intent(new DirectorySelecting($this->app, $path, $filter))) {
142+
if (!$this->intent(new DirectorySelecting($this->app, $directory, $filter))) {
143143
return null;
144144
}
145145

146146
$filter = \iterator_to_array($filter, false);
147147

148-
$result = $this->selectOne($path, $filter, $this->app->saucer->saucer_picker_pick_folder(...));
148+
$result = $this->selectOne($directory, $filter, $this->app->saucer->saucer_picker_pick_folder(...));
149149

150150
if ($result !== null) {
151-
$this->dispatch(new DirectorySelected($this->app, $result, $path, $filter));
151+
$this->dispatch(new DirectorySelected($this->app, $result, $directory, $filter));
152152
}
153153

154154
return $result;
155155
}
156156

157-
public function selectFile(?string $path = null, iterable $filter = []): ?string
157+
public function selectFile(?string $directory = null, iterable $filter = []): ?string
158158
{
159-
if (!$this->intent(new FileSelecting($this->app, $path, $filter))) {
159+
if (!$this->intent(new FileSelecting($this->app, $directory, $filter))) {
160160
return null;
161161
}
162162

163163
$filter = \iterator_to_array($filter, false);
164164

165-
$result = $this->selectOne($path, $filter, $this->app->saucer->saucer_picker_pick_file(...));
165+
$result = $this->selectOne($directory, $filter, $this->app->saucer->saucer_picker_pick_file(...));
166166

167167
if ($result !== null) {
168-
$this->dispatch(new FileSelected($this->app, $result, $path, $filter));
168+
$this->dispatch(new FileSelected($this->app, $result, $directory, $filter));
169169
}
170170

171171
return $result;
@@ -174,18 +174,18 @@ public function selectFile(?string $path = null, iterable $filter = []): ?string
174174
/**
175175
* @return list<non-empty-string>
176176
*/
177-
public function selectFiles(?string $path = null, iterable $filter = []): array
177+
public function selectFiles(?string $directory = null, iterable $filter = []): array
178178
{
179-
if (!$this->intent(new FilesSelecting($this->app, $path, $filter))) {
179+
if (!$this->intent(new FilesSelecting($this->app, $directory, $filter))) {
180180
return [];
181181
}
182182

183183
$filter = \iterator_to_array($filter, false);
184184

185-
$result = $this->selectMany($path, $filter, $this->app->saucer->saucer_picker_pick_files(...));
185+
$result = $this->selectMany($directory, $filter, $this->app->saucer->saucer_picker_pick_files(...));
186186

187187
foreach ($result as $selection) {
188-
$this->dispatch(new FileSelected($this->app, $selection, $path, $filter));
188+
$this->dispatch(new FileSelected($this->app, $selection, $directory, $filter));
189189
}
190190

191191
return $result;

src/Api/QuitOnClose/QuitOnCloseExtension.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ final class QuitOnCloseExtension extends Extension
2020
{
2121
public function load(IdentifiableInterface $ctx, EventListener $listener): null
2222
{
23-
/**
24-
* Checks for the presence of a deprecated config flag.
25-
*
26-
* TODO The {@see ApplicationCreateInfo::$quitOnClose} check should be
27-
* removed after the flag is removed.
28-
*/
29-
if (!$ctx->info->quitOnClose) {
30-
return null;
31-
}
32-
3323
$listener->addEventListener(WindowClosed::class, $this->onWindowClose(...));
3424

3525
return null;

src/Application.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -328,23 +328,9 @@ private function registerSchemes(): void
328328
*/
329329
private function registerDefaultEventListeners(): void
330330
{
331-
$this->listener->addEventListener(WindowClosed::class, $this->onWindowClose(...));
332331
$this->listener->addEventListener(ApplicationStarted::class, $this->onApplicationStarted(...));
333332
}
334333

335-
/**
336-
* Handles the window close event.
337-
*
338-
* If {@see $quitOnClose} is enabled ({@see true}) and
339-
* all windows are closed, the application will quit.
340-
*/
341-
private function onWindowClose(): void
342-
{
343-
if ($this->info->quitOnClose && $this->windows->count() === 0) {
344-
$this->quit();
345-
}
346-
}
347-
348334
/**
349335
* Handles an application started event.
350336
*

src/ApplicationCreateInfo.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -86,33 +86,6 @@ public function __construct(
8686
* @var non-empty-string|null
8787
*/
8888
public ?string $library = null,
89-
/**
90-
* Automatically terminates the application if
91-
* all windows have been closed.
92-
*
93-
* @deprecated will be removed in future versions it and replaced by
94-
* the presence of the {@see QuitOnCloseExtension}
95-
* in the {@see $extensions} list.
96-
*
97-
* To disable this functionality, you should remove the
98-
* {@see QuitOnCloseExtension} from the
99-
* {@see $extensions} list, instead of setting the field
100-
* to {@see false}.
101-
*/
102-
public bool $quitOnClose = true,
103-
/**
104-
* Automatically starts the application if set to {@see true}.
105-
*
106-
* @deprecated will be removed in future versions it and replaced by
107-
* the presence of the {@see AutorunExtension}
108-
* in the {@see $extensions} list.
109-
*
110-
* To disable this functionality, you should remove the
111-
* {@see AutorunExtension} from the
112-
* {@see $extensions} list, instead of setting the field
113-
* to {@see false}.
114-
*/
115-
public bool $autorun = true,
11689
iterable $extensions = self::DEFAULT_APPLICATION_EXTENSIONS,
11790
/**
11891
* Main (default) window configuration DTO.

src/WebView/Manager/WebViewHandlerFactory.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private function isDevToolsEnabled(Window $window, WebViewCreateInfo $info): boo
8585
}
8686

8787
/**
88-
* Enable context menu in case of the corresponding value was passed
88+
* Enable a context menu in case of the corresponding value was passed
8989
* explicitly to the create info options or debug mode was enabled.
9090
*/
9191
private function isContextMenuEnabled(Window $window, WebViewCreateInfo $info): bool
@@ -95,18 +95,17 @@ private function isContextMenuEnabled(Window $window, WebViewCreateInfo $info):
9595
}
9696

9797
/**
98-
* Enable dark mode in case of the corresponding value was passed in
98+
* Enable dark mode in case of the corresponding value was passed in the
9999
* parent window config instance.
100-
*
101-
* TODO Move this option to webview
102100
*/
103101
private function isDarkModeEnabled(Window $window, WebViewCreateInfo $info): bool
104102
{
105-
return $info->forceDarkMode === true;
103+
return $info->forceDarkMode
104+
?? $window->info->forceDarkMode;
106105
}
107106

108107
/**
109-
* Gets real hardware acceleration option from configuration options
108+
* Gets a real hardware acceleration option from configuration options
110109
*/
111110
private function isHardwareAccelerationEnabled(Window $window, WebViewCreateInfo $info): bool
112111
{
@@ -118,7 +117,7 @@ private function applyWebViewBeforeCreated(CData $options, Window $window, WebVi
118117
{
119118
if ($this->isDevToolsEnabled($window, $info)) {
120119
/**
121-
* Force disable unnecessary XSS warnings in dev tools
120+
* Force to disable unnecessary XSS warnings in dev tools
122121
*
123122
* @link https://developer.chrome.com/blog/self-xss#can_you_disable_it_for_test_automation
124123
*/

src/WebView/WebViewCreateInfo.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ public function __construct(
127127
string|false|null $storage = false,
128128
iterable $flags = [],
129129
/**
130-
* Enable or disable default webview context menu (right mouse button).
130+
* Enable or disable a default webview context menu (right mouse button).
131131
*
132132
* If {@see null} is passed (by default), the behavior depends
133133
* on the application's debug ({@see Application::$isDebug}) settings:
134-
* - Context menu will be enabled if debug mode is enabled.
135-
* - Context menu will bew disabled if debug mode is disabled.
134+
* - A context menu will be enabled if debug mode is enabled.
135+
* - A context menu will be disabled if debug mode is disabled.
136136
*/
137137
public ?bool $contextMenu = null,
138138
/**
@@ -148,21 +148,21 @@ public function __construct(
148148
* Enables graphics hardware acceleration in case of this option
149149
* is set to {@see true} or disables in case {@see false}.
150150
*
151-
* By default, in case of {@see null}, uses parent (windows)
151+
* By default, in case of {@see null}, uses a parent (windows)
152152
* configuration option:
153153
* - {@see WindowCreateInfo::$enableHardwareAcceleration}
154154
*
155-
* Note: [MACOS] WKWebView does not allow to control
155+
* Note: [MACOS] WKWebView does not allow controlling
156156
* hardware-acceleration.
157157
*/
158158
public ?bool $enableHardwareAcceleration = null,
159159
/**
160160
* Forces dark mode in case of this option
161161
* is set to {@see true} or disables in case {@see false}.
162162
*
163-
* By default, in case of {@see null}, uses parent (windows)
163+
* By default, in case of {@see null}, uses a parent (windows)
164164
* configuration option:
165-
* - {@see WindowCreateInfo::$decoration}
165+
* - {@see WindowCreateInfo::$forceDarkMode}
166166
*/
167167
public ?bool $forceDarkMode = null,
168168
iterable $extensions = self::DEFAULT_WEBVIEW_EXTENSIONS,

src/Window/WindowCreateInfo.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ public function __construct(
7171
* @see WebViewCreateInfo::$enableHardwareAcceleration
7272
*/
7373
public bool $enableHardwareAcceleration = true,
74+
/**
75+
* Forces dark mode for all children webview instances in case of
76+
* this option is set to {@see true} or disables in case {@see false}.
77+
*
78+
* @see WebViewCreateInfo::$forceDarkMode
79+
*/
80+
public bool $forceDarkMode = false,
7481
/**
7582
* Displays a window when the application starts.
7683
*/
@@ -90,7 +97,7 @@ public function __construct(
9097
/**
9198
* Manage window decorations.
9299
*
93-
* Enable or disable title bar, minimize, maximize, exit buttons,
100+
* Enable or disable the title bar, minimize, maximize, exit buttons,
94101
* transparency and so on...
95102
*/
96103
public WindowDecoration $decoration = WindowDecoration::DEFAULT,

0 commit comments

Comments
 (0)