Skip to content

Commit

Permalink
fix: Migrate personal settings to Vue
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Aug 7, 2024
1 parent 3b39ad3 commit e505205
Show file tree
Hide file tree
Showing 11 changed files with 937 additions and 160 deletions.
67 changes: 60 additions & 7 deletions lib/Settings/Personal.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
namespace OCA\FirstRunWizard\Settings;

use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\Defaults;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\Settings\ISettings;

Expand All @@ -18,6 +21,9 @@ public function __construct(
private IConfig $config,
private IURLGenerator $urlGenerator,
private Defaults $defaults,
private IInitialState $initialState,
private IL10N $l,
private IRequest $request,
) {
}

Expand All @@ -26,9 +32,40 @@ public function __construct(
* @since 9.1
*/
public function getForm() {
$url = $this->urlGenerator->getAbsoluteURL('');
$parameters = [ 'clients' => $this->getClientLinks() ,'url' => $url];
return new TemplateResponse('firstrunwizard', 'personal-settings', $parameters);
$apps = [
'calendar' => [
'label' => $this->l->t('Connect your calendar'),
'link' => $this->urlGenerator->linkToDocs('user-sync-calendars'),
'image' => $this->urlGenerator->imagePath('core', 'places/calendar.svg'),
],
'contacts' => [
'label' => $this->l->t('Connect your contacts'),
'link' => $this->urlGenerator->linkToDocs('user-sync-contacts'),
'image' => $this->urlGenerator->imagePath('core', 'places/contacts.svg'),
],
'webdav' => [
'label' => $this->l->t('Access files via WebDAV'),
'link' => $this->urlGenerator->linkToDocs('user-webdav'),
'image' => $this->urlGenerator->imagePath('files', 'folder.svg'),
],
];
if ($this->request->getServerProtocol() === 'https') {
$apps['mac'] = [
'label' => $this->l->t('Download macOS/iOS configuration profile'),
'link' => \OCP\Util::linkToRemote('dav') . 'provisioning/apple-provisioning.mobileconfig',
'image' => $this->urlGenerator->imagePath('core', 'actions/settings.svg'),
];
}

$this->initialState->provideInitialState('apps', $apps);
$this->initialState->provideInitialState('links', [
'clients' => $this->getClientLinks(),
'appPasswords' => $this->urlGenerator->linkToRoute('settings.PersonalSettings.index', ['section' => 'security']),
]);

\OCP\Util::addStyle('firstrunwizard', 'firstrunwizard-style', 'settings');
\OCP\Util::addScript('firstrunwizard', 'firstrunwizard-settings', 'settings');
return new TemplateResponse('firstrunwizard', 'personal-settings');
}

/**
Expand Down Expand Up @@ -58,10 +95,26 @@ public function getPriority() {
*/
private function getClientLinks() {
$clients = [
'desktop' => $this->config->getSystemValue('customclient_desktop', $this->defaults->getSyncClientUrl()),
'android' => $this->config->getSystemValue('customclient_android', $this->defaults->getAndroidClientUrl()),
'fdroid' => $this->config->getSystemValue('customclient_fdroid', $this->defaults->getFDroidClientUrl()),
'ios' => $this->config->getSystemValue('customclient_ios', $this->defaults->getiOSClientUrl())
'desktop' => [
'href' => $this->config->getSystemValue('customclient_desktop', $this->defaults->getSyncClientUrl()),
'name' => $this->l->t('Desktop client'),
'image' => $this->urlGenerator->imagePath('core', 'desktopapp.svg'),
],
'android' => [
'href' => $this->config->getSystemValue('customclient_android', $this->defaults->getAndroidClientUrl()),
'name' => $this->l->t('Android app on Google Play Store'),
'image' => $this->urlGenerator->imagePath('core', 'googleplay.png'),
],
'fdroid' => [
'href' => $this->config->getSystemValue('customclient_fdroid', $this->defaults->getFDroidClientUrl()),
'name' => $this->l->t('Android app on F-Droid'),
'image' => $this->urlGenerator->imagePath('core', 'f-droid.svg'),
],
'ios' => [
'href' => $this->config->getSystemValue('customclient_ios', $this->defaults->getiOSClientUrl()),
'name' => $this->l->t('iOS app'),
'image' => $this->urlGenerator->imagePath('core', 'appstore.svg'),
],
];
return $clients;
}
Expand Down
Loading

0 comments on commit e505205

Please sign in to comment.