Skip to content

Commit

Permalink
hide codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sneezry committed Mar 16, 2024
1 parent 2145edc commit 85a6539
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -511,5 +511,9 @@
},
"permission_unknown_permission": {
"message": "Unknown permission. If see this message, please send a bug report."
},
"hide_codes": {
"message": "Hide codes",
"description": "Hide codes and show stars in popup. Users need to click the account to copy the code."
}
}
4 changes: 3 additions & 1 deletion src/components/Popup/EntryComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const computedPrototype = [
"encryption",
]),
mapState("style", ["style"]),
mapState("menu", ["theme"]),
mapState("menu", ["theme", "hideCodes"]),
];
let computed = {};
Expand Down Expand Up @@ -142,6 +142,8 @@ export default Vue.extend({
return this.i18n.encrypted;
} else if (code === CodeState.Invalid) {
return this.i18n.invalid;
} else if (this.$store.state.menu.hideCodes) {
return code.replace(/\w/g, "*");
} else {
return code;
}
Expand Down
9 changes: 9 additions & 0 deletions src/components/Popup/PreferencesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
@change="migrateStorage()"
/>
<a-toggle-input :label="i18n.smart_filter" v-model="smartFilter" />
<a-toggle-input :label="i18n.hide_codes" v-model="hideCodes" />
<a-toggle-input
:label="i18n.enable_context_menu"
v-model="enableContextMenu"
Expand Down Expand Up @@ -141,6 +142,14 @@ export default Vue.extend({
return !isFirefox && !isSafari;
},
},
hideCodes: {
get(): boolean {
return this.$store.state.menu.hideCodes;
},
set(hideCodes: boolean) {
this.$store.commit("menu/setHideCodes", hideCodes);
},
},
},
data() {
return {
Expand Down
1 change: 1 addition & 0 deletions src/definitions/module-interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ interface MenuState {
theme: string;
backupDisabled: boolean;
storageArea: "sync" | "local";
hideCodes: boolean;
}

interface StyleState {
Expand Down
5 changes: 5 additions & 0 deletions src/store/Menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class Menu implements Module {
passwordPolicyHint: await ManagedStorage.get<string>(
"passwordPolicyHint"
),
hideCodes: localStorage.hideCodes === "true",
},
mutations: {
setZoom: (state: MenuState, zoom: number) => {
Expand Down Expand Up @@ -56,6 +57,10 @@ export class Menu implements Module {
state.autolock = autolock;
localStorage.autolock = autolock;
},
setHideCoes(state: MenuState, hideCodes: boolean) {
state.hideCodes = hideCodes;
localStorage.hideCodes = hideCodes;
},
},
namespaced: true,
};
Expand Down

0 comments on commit 85a6539

Please sign in to comment.