From 2a2d5f404ec5cea83693808e5671ee525f0dd116 Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Wed, 8 Jun 2022 18:00:42 +0530 Subject: [PATCH] Added option to hide FLO ID on homepage --- index.html | 16 ++++++++++++++-- scripts/components.js | 3 +++ scripts/fn_ui.js | 13 ------------- scripts/std_ui.js | 8 ++++++++ 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index d0b1bf6..324510c 100644 --- a/index.html +++ b/index.html @@ -142,7 +142,7 @@
-
+

Welcome

@@ -428,7 +428,7 @@
+ +
+ FLO ID visibility + Don't show my FLO ID on homepage. *Only applies to this device. +
+
Sign out
@@ -1262,6 +1268,12 @@ console.log('Exchange API initialized!') floDapps.launchStartUp().then(result => { console.log(`Welcome ${myFloID}`); + getRef('flo_id_visibility_switcher').checked = localStorage.getItem(`${myFloID}_id_visibility`) === 'true' + toggleFloIDVisibility(localStorage.getItem(`${myFloID}_id_visibility`) === 'true') + getRef('flo_id_visibility_switcher').addEventListener('change', e => { + localStorage.setItem(`${myFloID}_id_visibility`, e.target.checked) + toggleFloIDVisibility(e.target.checked) + }) floGlobals.savedIds = {}; floGlobals.savedUserData = { upiIds: {} diff --git a/scripts/components.js b/scripts/components.js index b0c57bb..b5cbb52 100644 --- a/scripts/components.js +++ b/scripts/components.js @@ -1904,6 +1904,9 @@ customElements.define('sm-switch', class extends HTMLElement { this.removeAttribute('checked') } } + get value() { + return this.isChecked + } reset() { diff --git a/scripts/fn_ui.js b/scripts/fn_ui.js index 9b3ddd2..a5e5a19 100644 --- a/scripts/fn_ui.js +++ b/scripts/fn_ui.js @@ -517,19 +517,6 @@ function formatAmount(amount = 0) { return amount.toLocaleString(`en-IN`, { style: 'currency', currency: 'INR' }) } -function getStatusIcon(status) { - switch (status) { - case 'PENDING': - return ''; - case 'COMPLETED': - return ''; - case 'REJECTED': - return ''; - default: - break; - } -} - const cashierRejectionErrors = { 1001: `Your request was reject because of wrong transaction ID. If you have sent money, it'll be returned within 24 hrs.`, 1002: `Amount requested and amount sent via UPI doesn't match. your transferred money will be returned within 24hrs.`, diff --git a/scripts/std_ui.js b/scripts/std_ui.js index 58a8e94..a2c23ef 100644 --- a/scripts/std_ui.js +++ b/scripts/std_ui.js @@ -277,6 +277,14 @@ window.addEventListener("load", () => { }) }) }); +function toggleFloIDVisibility(hide) { + document.querySelectorAll('.flo-id-wrapper').forEach(elem => { + if(hide) + elem.classList.add('hide') + else + elem.classList.remove('hide') + }) +} function createRipple(event, target) { const circle = document.createElement("span"); const diameter = Math.max(target.clientWidth, target.clientHeight);