diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index c89a385f..a73025fc 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -7,6 +7,7 @@ use OCP\AppFramework\Http\TemplateResponse; use OCA\Viewer\Event\LoadViewer; use OCA\Files\Event\LoadSidebar; use OCP\AppFramework\Controller; +use OCP\App\IAppManager; use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IUserSession; @@ -17,6 +18,7 @@ use OCA\Memories\AppInfo\Application; class PageController extends Controller { protected $userId; protected $appName; + private IAppManager $appManager; protected IEventDispatcher $eventDispatcher; private IInitialState $initialState; private IUserSession $userSession; @@ -26,6 +28,7 @@ class PageController extends Controller { string $AppName, IRequest $request, $UserId, + IAppManager $appManager, IEventDispatcher $eventDispatcher, IInitialState $initialState, IUserSession $userSession, @@ -34,6 +37,7 @@ class PageController extends Controller { parent::__construct($AppName, $request); $this->userId = $UserId; $this->appName = $AppName; + $this->appManager = $appManager; $this->eventDispatcher = $eventDispatcher; $this->initialState = $initialState; $this->userSession = $userSession; @@ -50,17 +54,21 @@ class PageController extends Controller { return null; } + // Scripts Util::addScript($this->appName, 'memories-main'); - $this->eventDispatcher->dispatchTyped(new LoadSidebar()); $this->eventDispatcher->dispatchTyped(new LoadViewer()); + // Configuration $uid = $user->getUid(); $timelinePath = \OCA\Memories\Util::getPhotosPath($this->config, $uid); $this->initialState->provideInitialState('timelinePath', $timelinePath); $this->initialState->provideInitialState('showHidden', $this->config->getUserValue( $uid, Application::APPNAME, 'showHidden', false)); + // Apps enabled + $this->initialState->provideInitialState('systemtags', $this->appManager->isEnabledForUser('systemtags') === true); + $response = new TemplateResponse($this->appName, 'main'); return $response; } diff --git a/src/App.vue b/src/App.vue index 41fa8437..872f1168 100644 --- a/src/App.vue +++ b/src/App.vue @@ -27,7 +27,7 @@ :title="t('memories', 'On this day')"> - @@ -71,6 +71,7 @@ import { import Timeline from './components/Timeline.vue' import Settings from './components/Settings.vue' import GlobalMixin from './mixins/GlobalMixin'; +import UserConfig from './mixins/UserConfig'; import ImageMultiple from 'vue-material-design-icons/ImageMultiple.vue' import FolderIcon from 'vue-material-design-icons/Folder.vue' @@ -100,7 +101,7 @@ import TagsIcon from 'vue-material-design-icons/Tag.vue'; TagsIcon, }, }) -export default class App extends Mixins(GlobalMixin) { +export default class App extends Mixins(GlobalMixin, UserConfig) { // Outer element } diff --git a/src/mixins/UserConfig.ts b/src/mixins/UserConfig.ts index 7b968083..deb9a664 100644 --- a/src/mixins/UserConfig.ts +++ b/src/mixins/UserConfig.ts @@ -32,6 +32,7 @@ const eventName = 'memories:user-config-changed' export default class UserConfig extends Vue { config_timelinePath = loadState('memories', 'timelinePath') || ''; config_showHidden = loadState('memories', 'showHidden') === "true"; + config_tagsEnabled = loadState('memories', 'systemtags'); created() { subscribe(eventName, this.updateLocalSetting)