Skip to content

Commit

Permalink
Adds Windows10/11 Widgets, edge_side_panel, iarc_rating_id, scope_ext…
Browse files Browse the repository at this point in the history
…ensions and handle_links parameters
  • Loading branch information
Spomky committed Jan 10, 2024
1 parent bf29e1b commit 23d340f
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.
101 changes: 101 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function getConfigTreeBuilder(): TreeBuilder
$this->setupRelatedApplications($rootNode);
$this->setupShortcuts($rootNode);
$this->setupSharedTarget($rootNode);
$this->setupWidgets($rootNode);
$this->setupServiceWorker($rootNode);

return $treeBuilder;
Expand Down Expand Up @@ -355,6 +356,37 @@ private function setupSimpleOptions(ArrayNodeDefinition $node): void
->info('The theme color of the application.')
->example('red')
->end()
->arrayNode('edge_side_panel')
->info('Specifies whether or not your app supports the side panel view in Microsoft Edge.')
->children()
->integerNode('preferred_width')
->info('Specifies the preferred width of the side panel view in Microsoft Edge.')
->end()
->end()
->end()
->scalarNode('iarc_rating_id')
->info(
'Specifies the International Age Rating Coalition (IARC) rating ID for the app. See https://www.globalratings.com/how-iarc-works.aspx for more information.'
)
->end()
->arrayNode('scope_extensions')
->info(
'Specifies a list of origin patterns to associate with. This allows for your app to control multiple subdomains and top-level domains as a single entity.'
)
->arrayPrototype()
->children()
->scalarNode('origin')
->isRequired()
->info('Specifies the origin pattern to associate with.')
->example('*.foo.com')
->end()
->end()
->end()
->end()
->scalarNode('handle_links')
->info('Specifies the default link handling for the web app.')
->example(['auto', 'preferred', 'not-preferred'])
->end()
->end()
;
}
Expand All @@ -365,6 +397,9 @@ private function getIconsNode(): ArrayNodeDefinition
$node = $treeBuilder->getRootNode();
assert($node instanceof ArrayNodeDefinition);
$node
->info(
'An array of icons to be used for the widget. If missing, the icons manifest member is used instead. Icons larger than 1024x1024 are ignored.'
)
->treatFalseLike([])
->treatTrueLike([])
->treatNullLike([])
Expand Down Expand Up @@ -513,4 +548,70 @@ private function getScreenshotsNode(): ArrayNodeDefinition

return $node;
}

private function setupWidgets(ArrayNodeDefinition $node): void
{
$node->children()
->arrayNode('widgets')
->info(
'EXPERIMENTAL. Specifies PWA-driven widgets. See https://learn.microsoft.com/en-us/microsoft-edge/progressive-web-apps-chromium/how-to/widgets for more information'
)
->arrayPrototype()
->children()
->scalarNode('name')
->isRequired()
->info('The title of the widget, presented to users.')
->end()
->scalarNode('short_name')
->info('An alternative short version of the name.')
->end()
->scalarNode('description')
->isRequired()
->info('The description of the widget.')
->example('My awesome widget')
->end()
->append($this->getIconsNode())
->append($this->getScreenshotsNode()->cannotBeEmpty())
->scalarNode('tag')
->isRequired()
->info('A string used to reference the widget in the PWA service worker.')
->end()
->scalarNode('template')
->info(
'The template to use to display the widget in the operating system widgets dashboard. Note: this property is currently only informational and not used. See ms_ac_template below.'
)
->end()
->scalarNode('ms_ac_template')
->isRequired()
->info(
'The URL of the custom Adaptive Cards template to use to display the widget in the operating system widgets dashboard. See Define a widget template below.'
)
->end()
->scalarNode('data')
->info(
'The URL where the data to fill the template with can be found. If present, this URL is required to return valid JSON.'
)
->end()
->scalarNode('type')
->info('The MIME type for the widget data.')
->end()
->booleanNode('auth')
->info('A boolean indicating if the widget requires authentication.')
->end()
->integerNode('update')
->info(
'The frequency, in seconds, at which the widget will be updated. Code in your service worker must perform the updating; the widget is not updated automatically. See Access widget instances at runtime.'
)
->end()
->booleanNode('multiple')
->defaultTrue()
->info(
'A boolean indicating whether to allow multiple instances of the widget. Defaults to true.'
)
->end()
->end()
->end()
->end()
->end();
}
}
16 changes: 16 additions & 0 deletions tests/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,22 @@
],
],
],
'edge_side_panel' => [
'preferred_width' => 480,
],
'iarc_rating_id' => '123456',
'scope_extensions' => [
[
'origin' => '*.foo.com',
],
[
'origin' => 'https://*.bar.com',
],
[
'origin' => 'https://*.baz.com',
],
],
'handle_links' => 'auto',
'serviceworker' => [
'generate' => true,
'src' => '/my-sw.js',
Expand Down

0 comments on commit 23d340f

Please sign in to comment.