Merge branch 'release' into develop

This commit is contained in:
SabreCat
2018-02-01 21:09:57 +00:00
11 changed files with 39 additions and 21 deletions

View File

@@ -364,6 +364,13 @@ export default {
if (modalOnTop) this.$root.$emit('bv::show::modal', modalOnTop, {fromRoot: true}); if (modalOnTop) this.$root.$emit('bv::show::modal', modalOnTop, {fromRoot: true});
}); });
}, },
beforeDestroy () {
this.$root.$off('playSound');
this.$root.$off('bv::modal::hidden');
this.$root.$off('bv::show::modal');
this.$root.$off('buyModal::showItem');
this.$root.$off('selectMembersModal::showItem');
},
mounted () { mounted () {
// Remove the index.html loading screen and now show the inapp loading // Remove the index.html loading screen and now show the inapp loading
const loadingScreen = document.getElementById('loading-screen'); const loadingScreen = document.getElementById('loading-screen');

View File

@@ -242,7 +242,7 @@ export default {
this.$root.$emit('bv::show::modal', 'challenge-modal'); this.$root.$emit('bv::show::modal', 'challenge-modal');
}); });
}, },
destroyed () { beforeDestroy () {
this.$root.$off('habitica:clone-challenge'); this.$root.$off('habitica:clone-challenge');
}, },
watch: { watch: {

View File

@@ -31,8 +31,6 @@
button.btn.btn-primary(@click="equipItem()") {{ $t(isEquipped ? 'unequip' : 'equip') }} button.btn.btn-primary(@click="equipItem()") {{ $t(isEquipped ? 'unequip' : 'equip') }}
div.clearfix(slot="modal-footer") div.clearfix(slot="modal-footer")
</template> </template>
<style lang="scss"> <style lang="scss">

View File

@@ -19,9 +19,7 @@
div.clearfix(slot="modal-footer") div.clearfix(slot="modal-footer")
</template> </template>
<style lang="scss"> <style lang="scss">
@import '~client/assets/scss/colors.scss'; @import '~client/assets/scss/colors.scss';
@import '~client/assets/scss/modal.scss'; @import '~client/assets/scss/modal.scss';
@@ -61,7 +59,6 @@
</style> </style>
<script> <script>
import markdownDirective from 'client/directives/markdown'; import markdownDirective from 'client/directives/markdown';
@@ -73,9 +70,6 @@
}, },
directives: { directives: {
markdown: markdownDirective, markdown: markdownDirective,
},
created () {
}, },
mounted () { mounted () {
this.$root.$on('hatchedPet::open', this.openDialog); this.$root.$on('hatchedPet::open', this.openDialog);

View File

@@ -291,12 +291,18 @@ export default {
this.runYesterDailies(); this.runYesterDailies();
// Do not remove the event listener as it's live for the entire app lifetime // Do not remove the event listener as it's live for the entire app lifetime
document.addEventListener('mousemove', () => this.checkNextCron()); document.addEventListener('mousemove', this.checkNextCron);
document.addEventListener('touchstart', () => this.checkNextCron()); document.addEventListener('touchstart', this.checkNextCron);
document.addEventListener('mousedown', () => this.checkNextCron()); document.addEventListener('mousedown', this.checkNextCron);
document.addEventListener('keydown', () => this.checkNextCron()); document.addEventListener('keydown', this.checkNextCron);
}); });
}, },
beforeDestroy () {
document.removeEventListener('mousemove', this.checkNextCron);
document.removeEventListener('touchstart', this.checkNextCron);
document.removeEventListener('mousedown', this.checkNextCron);
document.removeEventListener('keydown', this.checkNextCron);
},
methods: { methods: {
checkUserAchievements () { checkUserAchievements () {
if (this.user.needsCron) return; if (this.user.needsCron) return;

View File

@@ -503,5 +503,8 @@
this.backgroundUpdate = new Date(); this.backgroundUpdate = new Date();
}); });
}, },
beforeDestroy () {
this.$root.$off('buyModal::boughtItem');
},
}; };
</script> </script>

View File

@@ -388,5 +388,8 @@
this.backgroundUpdate = new Date(); this.backgroundUpdate = new Date();
}); });
}, },
beforeDestroy () {
this.$root.$off('buyModal::boughtItem');
},
}; };
</script> </script>

View File

@@ -135,11 +135,14 @@ export default {
if (timeout) { if (timeout) {
let delay = this.notification.delay || 1500; let delay = this.notification.delay || 1500;
delay += this.$store.state.notificationStore.length * 1000; delay += this.$store.state.notificationStore.length * 1000;
setTimeout(() => { this.timer = setTimeout(() => {
this.show = false; this.show = false;
}, delay); }, delay);
} }
}, },
beforeDestroy () {
clearTimeout(this.timer);
},
watch: { watch: {
show () { show () {
this.$store.dispatch('snackbars:remove', this.notification); this.$store.dispatch('snackbars:remove', this.notification);

View File

@@ -48,8 +48,8 @@ export default {
this.$root.$emit('bv::show::modal', 'broken-task-modal'); this.$root.$emit('bv::show::modal', 'broken-task-modal');
}); });
}, },
removed () { beforeDestroy () {
this.$root.$remove('handle-broken-task'); this.$root.$off('handle-broken-task');
}, },
methods: { methods: {
...mapActions({ ...mapActions({

View File

@@ -192,10 +192,7 @@ export default {
this.castEnd(target, type, $event); this.castEnd(target, type, $event);
}); });
document.addEventListener('keyup', keyEvent => { document.addEventListener('keyup', this.handleKeyUp);
if (keyEvent.keyCode !== 27) return;
this.castCancel();
});
// @TODO: should we abstract the drawer state/local store to a library and mixing combo? We use a similar pattern in equipment // @TODO: should we abstract the drawer state/local store to a library and mixing combo? We use a similar pattern in equipment
const spellDrawerState = getLocalSetting(CONSTANTS.keyConstants.SPELL_DRAWER_STATE); const spellDrawerState = getLocalSetting(CONSTANTS.keyConstants.SPELL_DRAWER_STATE);
@@ -203,6 +200,10 @@ export default {
this.$store.state.spellOptions.spellDrawOpen = false; this.$store.state.spellOptions.spellDrawOpen = false;
} }
}, },
beforeDestroy () {
this.$root.$off('castEnd');
document.removeEventListener('keyup', this.handleKeyUp);
},
computed: { computed: {
...mapState({user: 'user.data'}), ...mapState({user: 'user.data'}),
openStatus () { openStatus () {
@@ -210,6 +211,10 @@ export default {
}, },
}, },
methods: { methods: {
handleKeyUp (keyEvent) {
if (keyEvent.keyCode !== 27) return;
this.castCancel();
},
drawerToggled (newState) { drawerToggled (newState) {
this.$store.state.spellOptions.spellDrawOpen = newState; this.$store.state.spellOptions.spellDrawOpen = newState;

View File

@@ -16,7 +16,6 @@
) {{ showAll ? $t('showLess') : $t('showMore') }} ) {{ showAll ? $t('showLess') : $t('showMore') }}
div.fill-height(v-else) div.fill-height(v-else)
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>