From f565e60bcf555dc6a267e33f47dc9922e4ccb6e1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 24 May 2018 05:46:09 +0900 Subject: [PATCH] Darken --- .../views/components/messaging-room.form.vue | 12 ++++++-- .../components/messaging-room.message.vue | 28 ++++++++++++++----- .../views/components/messaging-room.vue | 19 +++++++++---- .../app/mobile/views/pages/messaging-room.vue | 17 +++++++++-- 4 files changed, 58 insertions(+), 18 deletions(-) diff --git a/src/client/app/common/views/components/messaging-room.form.vue b/src/client/app/common/views/components/messaging-room.form.vue index 32a43ace5..050906cf4 100644 --- a/src/client/app/common/views/components/messaging-room.form.vue +++ b/src/client/app/common/views/components/messaging-room.form.vue @@ -197,7 +197,7 @@ export default Vue.extend({ diff --git a/src/client/app/common/views/components/messaging-room.message.vue b/src/client/app/common/views/components/messaging-room.message.vue index ba0ab3209..ef39199dc 100644 --- a/src/client/app/common/views/components/messaging-room.message.vue +++ b/src/client/app/common/views/components/messaging-room.message.vue @@ -59,8 +59,10 @@ export default Vue.extend({ diff --git a/src/client/app/common/views/components/messaging-room.vue b/src/client/app/common/views/components/messaging-room.vue index 496d66a82..34280d7a2 100644 --- a/src/client/app/common/views/components/messaging-room.vue +++ b/src/client/app/common/views/components/messaging-room.vue @@ -244,11 +244,12 @@ export default Vue.extend({ diff --git a/src/client/app/mobile/views/pages/messaging-room.vue b/src/client/app/mobile/views/pages/messaging-room.vue index c26a9b735..7fbfa056d 100644 --- a/src/client/app/mobile/views/pages/messaging-room.vue +++ b/src/client/app/mobile/views/pages/messaging-room.vue @@ -16,16 +16,29 @@ export default Vue.extend({ data() { return { fetching: true, - user: null + user: null, + unwatchDarkmode: null }; }, watch: { $route: 'fetch' }, created() { - document.documentElement.style.background = '#fff'; + const applyBg = v => + document.documentElement.style.setProperty('background', v ? '#191b22' : '#fff', 'important'); + + this.$nextTick(() => applyBg(this.$store.state.device.darkmode)); + + this.unwatchDarkmode = this.$store.watch(s => { + return s.device.darkmode; + }, applyBg); + this.fetch(); }, + beforeDestroy() { + document.documentElement.style.removeProperty('background'); + this.unwatchDarkmode(); + }, methods: { fetch() { this.fetching = true;