From 98b8b5bbe3136f018c6038c84d1780509d288a46 Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 5 Aug 2020 15:58:21 +0200 Subject: [PATCH 1/4] added switch to setting enabling to skip the labeling screen when sending a TX to a previously unknown address, which is a hassle if one is mostly sending to one-time addresses, e.g. to companies, collaborators, etc. in a professional setup --- src/components/layouts/Settings.vue | 14 ++++++++++++++ src/components/modals/SendModal.vue | 5 ++--- src/stores/Settings.ts | 6 ++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/components/layouts/Settings.vue b/src/components/layouts/Settings.vue index 67f5464fb..1093293f2 100644 --- a/src/components/layouts/Settings.vue +++ b/src/components/layouts/Settings.vue @@ -40,6 +40,20 @@ +
+
+ +

+ {{ $t('Ask for a label when sending to an unknown address?') }} +

+
+ + +
+
diff --git a/src/components/modals/SendModal.vue b/src/components/modals/SendModal.vue index a7474b9dd..887eb24a1 100644 --- a/src/components/modals/SendModal.vue +++ b/src/components/modals/SendModal.vue @@ -248,6 +248,7 @@ export default defineComponent({ const { state: addresses$, activeAddressInfo, addressInfos } = useAddressStore(); const { contactsArray: contacts, setContact, getLabel } = useContactsStore(); const { state: network$ } = useNetworkStore(); + const { amountsHidden, skipRecipientLabeling } = useSettingsStore(); const recipientDetailsOpened = ref(false); const recipientWithLabel = ref<{address: string, label: string, type: RecipientType} | null>(null); @@ -295,7 +296,7 @@ export default defineComponent({ } recipientWithLabel.value = { address, label, type }; - if (!label) { + if (!skipRecipientLabeling.value && !label) { recipientDetailsOpened.value = true; } else { page.value = Pages.AMOUNT_INPUT; @@ -542,8 +543,6 @@ export default defineComponent({ feeSelectionOpened.value = false; } - const { amountsHidden } = useSettingsStore(); - return { // General Pages, diff --git a/src/stores/Settings.ts b/src/stores/Settings.ts index 012224967..1858b9f8f 100644 --- a/src/stores/Settings.ts +++ b/src/stores/Settings.ts @@ -12,6 +12,7 @@ export type SettingsState = { language: string, // locale colorMode: ColorMode, amountsHidden: boolean, + skipRecipientLabeling: boolean, }; export const useSettingsStore = createStore({ @@ -21,12 +22,14 @@ export const useSettingsStore = createStore({ language: detectLanguage(), colorMode: ColorMode.AUTOMATIC, amountsHidden: false, + skipRecipientLabeling: false, }), getters: { decimals: (state): Readonly => state.decimals, language: (state): Readonly => state.language, colorMode: (state): Readonly => state.colorMode, amountsHidden: (state): Readonly => state.amountsHidden, + skipRecipientLabeling: (state): Readonly => state.skipRecipientLabeling, }, actions: { setDecimals(num: 0 | 2 | 5 = 0) { @@ -41,6 +44,9 @@ export const useSettingsStore = createStore({ this.state.colorMode = colorMode; } }, + setSkipRecipientLabeling(skip: boolean) { + this.state.skipRecipientLabeling = skip; + }, toggleAmountsHidden() { this.state.amountsHidden = !this.state.amountsHidden; }, From 5918ce22e1bc8e88e1431d17f02918f63a4bfcd1 Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 5 Aug 2020 16:47:06 +0200 Subject: [PATCH 2/4] improve var naming --- src/components/layouts/Settings.vue | 8 ++++---- src/components/modals/SendModal.vue | 4 ++-- src/stores/Settings.ts | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/layouts/Settings.vue b/src/components/layouts/Settings.vue index 1093293f2..13e3c510b 100644 --- a/src/components/layouts/Settings.vue +++ b/src/components/layouts/Settings.vue @@ -42,15 +42,15 @@
- +

{{ $t('Ask for a label when sending to an unknown address?') }}

- + +
diff --git a/src/components/modals/SendModal.vue b/src/components/modals/SendModal.vue index 887eb24a1..33c8c89dd 100644 --- a/src/components/modals/SendModal.vue +++ b/src/components/modals/SendModal.vue @@ -248,7 +248,7 @@ export default defineComponent({ const { state: addresses$, activeAddressInfo, addressInfos } = useAddressStore(); const { contactsArray: contacts, setContact, getLabel } = useContactsStore(); const { state: network$ } = useNetworkStore(); - const { amountsHidden, skipRecipientLabeling } = useSettingsStore(); + const { amountsHidden, askForRecipientLabeling } = useSettingsStore(); const recipientDetailsOpened = ref(false); const recipientWithLabel = ref<{address: string, label: string, type: RecipientType} | null>(null); @@ -296,7 +296,7 @@ export default defineComponent({ } recipientWithLabel.value = { address, label, type }; - if (!skipRecipientLabeling.value && !label) { + if (!askForRecipientLabeling.value && !label) { recipientDetailsOpened.value = true; } else { page.value = Pages.AMOUNT_INPUT; diff --git a/src/stores/Settings.ts b/src/stores/Settings.ts index 1858b9f8f..bd24ea33d 100644 --- a/src/stores/Settings.ts +++ b/src/stores/Settings.ts @@ -12,7 +12,7 @@ export type SettingsState = { language: string, // locale colorMode: ColorMode, amountsHidden: boolean, - skipRecipientLabeling: boolean, + askForRecipientLabeling: boolean, }; export const useSettingsStore = createStore({ @@ -22,14 +22,14 @@ export const useSettingsStore = createStore({ language: detectLanguage(), colorMode: ColorMode.AUTOMATIC, amountsHidden: false, - skipRecipientLabeling: false, + askForRecipientLabeling: true, }), getters: { decimals: (state): Readonly => state.decimals, language: (state): Readonly => state.language, colorMode: (state): Readonly => state.colorMode, amountsHidden: (state): Readonly => state.amountsHidden, - skipRecipientLabeling: (state): Readonly => state.skipRecipientLabeling, + askForRecipientLabeling: (state): Readonly => state.askForRecipientLabeling, }, actions: { setDecimals(num: 0 | 2 | 5 = 0) { @@ -44,8 +44,8 @@ export const useSettingsStore = createStore({ this.state.colorMode = colorMode; } }, - setSkipRecipientLabeling(skip: boolean) { - this.state.skipRecipientLabeling = skip; + setAskForRecipientLabeling(ask: boolean) { + this.state.askForRecipientLabeling = ask; }, toggleAmountsHidden() { this.state.amountsHidden = !this.state.amountsHidden; From ba02a056115f0d503b758df649ff778bf51e9c94 Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 5 Aug 2020 16:53:38 +0200 Subject: [PATCH 3/4] linting issue --- src/components/layouts/Settings.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/layouts/Settings.vue b/src/components/layouts/Settings.vue index 13e3c510b..a56676578 100644 --- a/src/components/layouts/Settings.vue +++ b/src/components/layouts/Settings.vue @@ -48,7 +48,11 @@

- From 079c624fd0b05ac897ce511c7124cecdd7906310 Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 5 Aug 2020 17:37:54 +0200 Subject: [PATCH 4/4] testing and fixes --- src/components/layouts/Settings.vue | 6 +++--- src/components/modals/SendModal.vue | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/layouts/Settings.vue b/src/components/layouts/Settings.vue index a56676578..5d45daff9 100644 --- a/src/components/layouts/Settings.vue +++ b/src/components/layouts/Settings.vue @@ -51,10 +51,10 @@
diff --git a/src/components/modals/SendModal.vue b/src/components/modals/SendModal.vue index 33c8c89dd..06e953430 100644 --- a/src/components/modals/SendModal.vue +++ b/src/components/modals/SendModal.vue @@ -296,7 +296,7 @@ export default defineComponent({ } recipientWithLabel.value = { address, label, type }; - if (!askForRecipientLabeling.value && !label) { + if (askForRecipientLabeling.value && !label) { recipientDetailsOpened.value = true; } else { page.value = Pages.AMOUNT_INPUT;