Skip to content

Commit

Permalink
computed
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Feb 7, 2024
1 parent b70f645 commit 9d972bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
4 changes: 3 additions & 1 deletion core/frontend/src/components/vehiclesetup/Configure.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export default Vue.extend({
data() {
return {
page_selected: null as string | null,
is_dev_mode: settings.is_dev_mode,
pages: [
{ title: 'Parameters', component: ParamSets },
{ title: 'Accelerometer', component: undefined },
Expand All @@ -108,6 +107,9 @@ export default Vue.extend({
// eslint-disable-next-line no-extra-parens
return this.pages.filter((page) => (page.filter ? page.filter() : true))
},
is_dev_mode() {
return settings.is_dev_mode
},
},
})
</script>
22 changes: 6 additions & 16 deletions core/frontend/src/store/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ class SettingsStore extends VuexModule {

is_pirate_mode = false

// Secret mode for developers that know our secret.
// It's enabled when the vehicle name is 'Sir Francis Drake', one the most famous pirates,
// and the pirate mode toggled to be enabled.
is_dev_mode = false

last_version_update_notification_time = 0 // Start in 1970: https://www.youtube.com/watch?v=wwcKs5K1oWg

tour_version = 0
Expand All @@ -45,7 +40,6 @@ class SettingsStore extends VuexModule {
@Mutation
setPirateMode(value: boolean): void {
this.is_pirate_mode = value
SettingsStore.checkDevMode()
SettingsStore.save()
}

Expand All @@ -67,16 +61,12 @@ class SettingsStore extends VuexModule {
SettingsStore.save()
}

static checkDevMode(): void {
const { is_pirate_mode } = SettingsStore.state
const is_dev_mode = beacon.vehicle_name === 'Sir Francis Drake' && is_pirate_mode
Vue.set(SettingsStore.state, 'is_dev_mode', is_dev_mode)

if (is_dev_mode) {
const message = 'You are in the secret developer mode. Be careful with your actions.'
+ 'Sir Francis Drake is watching you.'
notifier.pushInfo('SECRET_DEV_MODE_ENABLED', message)
}
// Secret mode for developers that know our secret.
// It's enabled when the vehicle name is 'Sir Francis Drake', one the most famous pirates,
// and the pirate mode toggled to be enabled.
get is_dev_mode() {
const is_dev_mode = beacon.vehicle_name === 'Sir Francis Drake' && this.is_pirate_mode
return is_dev_mode
}

/**
Expand Down

0 comments on commit 9d972bd

Please sign in to comment.