Ensure tags enabled

cache
Varun Patil 2022-10-07 10:46:09 -07:00
parent b39365d556
commit 4c684f1aef
3 changed files with 13 additions and 3 deletions

View File

@ -7,6 +7,7 @@ use OCP\AppFramework\Http\TemplateResponse;
use OCA\Viewer\Event\LoadViewer; use OCA\Viewer\Event\LoadViewer;
use OCA\Files\Event\LoadSidebar; use OCA\Files\Event\LoadSidebar;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\App\IAppManager;
use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig; use OCP\IConfig;
use OCP\IUserSession; use OCP\IUserSession;
@ -17,6 +18,7 @@ use OCA\Memories\AppInfo\Application;
class PageController extends Controller { class PageController extends Controller {
protected $userId; protected $userId;
protected $appName; protected $appName;
private IAppManager $appManager;
protected IEventDispatcher $eventDispatcher; protected IEventDispatcher $eventDispatcher;
private IInitialState $initialState; private IInitialState $initialState;
private IUserSession $userSession; private IUserSession $userSession;
@ -26,6 +28,7 @@ class PageController extends Controller {
string $AppName, string $AppName,
IRequest $request, IRequest $request,
$UserId, $UserId,
IAppManager $appManager,
IEventDispatcher $eventDispatcher, IEventDispatcher $eventDispatcher,
IInitialState $initialState, IInitialState $initialState,
IUserSession $userSession, IUserSession $userSession,
@ -34,6 +37,7 @@ class PageController extends Controller {
parent::__construct($AppName, $request); parent::__construct($AppName, $request);
$this->userId = $UserId; $this->userId = $UserId;
$this->appName = $AppName; $this->appName = $AppName;
$this->appManager = $appManager;
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
$this->initialState = $initialState; $this->initialState = $initialState;
$this->userSession = $userSession; $this->userSession = $userSession;
@ -50,17 +54,21 @@ class PageController extends Controller {
return null; return null;
} }
// Scripts
Util::addScript($this->appName, 'memories-main'); Util::addScript($this->appName, 'memories-main');
$this->eventDispatcher->dispatchTyped(new LoadSidebar()); $this->eventDispatcher->dispatchTyped(new LoadSidebar());
$this->eventDispatcher->dispatchTyped(new LoadViewer()); $this->eventDispatcher->dispatchTyped(new LoadViewer());
// Configuration
$uid = $user->getUid(); $uid = $user->getUid();
$timelinePath = \OCA\Memories\Util::getPhotosPath($this->config, $uid); $timelinePath = \OCA\Memories\Util::getPhotosPath($this->config, $uid);
$this->initialState->provideInitialState('timelinePath', $timelinePath); $this->initialState->provideInitialState('timelinePath', $timelinePath);
$this->initialState->provideInitialState('showHidden', $this->config->getUserValue( $this->initialState->provideInitialState('showHidden', $this->config->getUserValue(
$uid, Application::APPNAME, 'showHidden', false)); $uid, Application::APPNAME, 'showHidden', false));
// Apps enabled
$this->initialState->provideInitialState('systemtags', $this->appManager->isEnabledForUser('systemtags') === true);
$response = new TemplateResponse($this->appName, 'main'); $response = new TemplateResponse($this->appName, 'main');
return $response; return $response;
} }

View File

@ -27,7 +27,7 @@
:title="t('memories', 'On this day')"> :title="t('memories', 'On this day')">
<CalendarIcon slot="icon" :size="20" /> <CalendarIcon slot="icon" :size="20" />
</NcAppNavigationItem> </NcAppNavigationItem>
<NcAppNavigationItem :to="{name: 'tags'}" <NcAppNavigationItem :to="{name: 'tags'}" v-if="config_tagsEnabled"
:title="t('memories', 'Tags')"> :title="t('memories', 'Tags')">
<TagsIcon slot="icon" :size="20" /> <TagsIcon slot="icon" :size="20" />
</NcAppNavigationItem> </NcAppNavigationItem>
@ -71,6 +71,7 @@ import {
import Timeline from './components/Timeline.vue' import Timeline from './components/Timeline.vue'
import Settings from './components/Settings.vue' import Settings from './components/Settings.vue'
import GlobalMixin from './mixins/GlobalMixin'; import GlobalMixin from './mixins/GlobalMixin';
import UserConfig from './mixins/UserConfig';
import ImageMultiple from 'vue-material-design-icons/ImageMultiple.vue' import ImageMultiple from 'vue-material-design-icons/ImageMultiple.vue'
import FolderIcon from 'vue-material-design-icons/Folder.vue' import FolderIcon from 'vue-material-design-icons/Folder.vue'
@ -100,7 +101,7 @@ import TagsIcon from 'vue-material-design-icons/Tag.vue';
TagsIcon, TagsIcon,
}, },
}) })
export default class App extends Mixins(GlobalMixin) { export default class App extends Mixins(GlobalMixin, UserConfig) {
// Outer element // Outer element
} }
</script> </script>

View File

@ -32,6 +32,7 @@ const eventName = 'memories:user-config-changed'
export default class UserConfig extends Vue { export default class UserConfig extends Vue {
config_timelinePath = loadState('memories', 'timelinePath') || ''; config_timelinePath = loadState('memories', 'timelinePath') || '';
config_showHidden = loadState('memories', 'showHidden') === "true"; config_showHidden = loadState('memories', 'showHidden') === "true";
config_tagsEnabled = loadState('memories', 'systemtags');
created() { created() {
subscribe(eventName, this.updateLocalSetting) subscribe(eventName, this.updateLocalSetting)