AccessibilityProvider.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
  4. * @copyright Copyright (c) 2019 Janis Köhr <janiskoehr@icloud.com>
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Greta Doci <gretadoci@gmail.com>
  8. * @author Jan-Christoph Borchardt <hey@jancborchardt.net>
  9. * @author Janis Köhr <janis.koehr@novatec-gmbh.de>
  10. * @author Joas Schilling <coding@schilljs.com>
  11. * @author John Molakvoæ <skjnldsv@protonmail.com>
  12. *
  13. * @license GNU AGPL version 3 or any later version
  14. *
  15. * This program is free software: you can redistribute it and/or modify
  16. * it under the terms of the GNU Affero General Public License as
  17. * published by the Free Software Foundation, either version 3 of the
  18. * License, or (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU Affero General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU Affero General Public License
  26. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  27. *
  28. */
  29. namespace OCA\Accessibility;
  30. use OCP\IL10N;
  31. use OCP\IURLGenerator;
  32. class AccessibilityProvider {
  33. protected string $appName;
  34. private IURLGenerator $urlGenerator;
  35. private IL10N $l;
  36. public function __construct(string $appName,
  37. IURLGenerator $urlGenerator,
  38. IL10N $l) {
  39. $this->appName = $appName;
  40. $this->urlGenerator = $urlGenerator;
  41. $this->l = $l;
  42. }
  43. /**
  44. * @psalm-return array<array-key, array{id: string, img: string, title: string, enableLabel: string, text: string}>
  45. */
  46. public function getThemes(): array {
  47. return [
  48. [
  49. 'id' => 'dark',
  50. 'img' => $this->urlGenerator->imagePath($this->appName, 'theme-dark.jpg'),
  51. 'title' => $this->l->t('Dark theme'),
  52. 'enableLabel' => $this->l->t('Enable dark theme'),
  53. 'text' => $this->l->t('A dark theme to ease your eyes by reducing the overall luminosity and brightness. It is still under development, so please report any issues you may find.')
  54. ]
  55. ];
  56. }
  57. /**
  58. * @psalm-return array{id: string, img: string, title: string, enableLabel: string, text: string}
  59. */
  60. public function getHighContrast(): array {
  61. return [
  62. 'id' => 'highcontrast',
  63. 'img' => $this->urlGenerator->imagePath($this->appName, 'mode-highcontrast.jpg'),
  64. 'title' => $this->l->t('High contrast mode'),
  65. 'enableLabel' => $this->l->t('Enable high contrast mode'),
  66. 'text' => $this->l->t('A high contrast mode to ease your navigation. Visual quality will be reduced but clarity will be increased.')
  67. ];
  68. }
  69. /**
  70. * @psalm-return array<array-key, array{id: string, img: string, title: string, enableLabel: string, text: string}>
  71. */
  72. public function getFonts(): array {
  73. return [
  74. [
  75. 'id' => 'fontdyslexic',
  76. 'img' => $this->urlGenerator->imagePath($this->appName, 'font-opendyslexic.jpg'),
  77. 'title' => $this->l->t('Dyslexia font'),
  78. 'enableLabel' => $this->l->t('Enable dyslexia font'),
  79. 'text' => $this->l->t('OpenDyslexic is a free typeface/font designed to mitigate some of the common reading errors caused by dyslexia.')
  80. ]
  81. ];
  82. }
  83. }