4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-11 01:35:51 +00:00

Aedd get wallet balance automatically

This commit is contained in:
AlphaX-Qortal 2025-02-06 23:09:41 +01:00
parent 82dfabd6c0
commit 2483163b6e
27 changed files with 144 additions and 36 deletions

View File

@ -1416,6 +1416,7 @@
"mpchange82": "FEHLENDE FELDER",
"mpchange83": "ABGELEHNT",
"mpchange84": "FEHLER",
"mpchange85": "ERFOLGREICH"
"mpchange85": "ERFOLGREICH",
"mpchange86": "Immer automatisches Abrufen des Wallet-Guthabens zulassen"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "CAMPOS FALTANTES",
"mpchange83": "RECHAZADO",
"mpchange84": "ERROR",
"mpchange85": "ÉXITO"
"mpchange85": "ÉXITO",
"mpchange86": "Permitir siempre obtener el saldo de la billetera automáticamente"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "PUUDUVAD VÄLJAD",
"mpchange83": "DECLINED",
"mpchange84": "FAILURE",
"mpchange85": "EDU"
"mpchange85": "EDU",
"mpchange86": "Luba alati rahakoti saldo automaatne hankimine"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "PUITTUVAT KENTÄT",
"mpchange83": "hylätty",
"mpchange84": "FAILURE",
"mpchange85": "SUCCESS"
"mpchange85": "SUCCESS",
"mpchange86": "Salli aina saada lompakon saldo automaattisesti"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "CHAMPS MANQUANTS",
"mpchange83": "REFUSÉ",
"mpchange84": "ÉCHEC",
"mpchange85": "SUCCÈS"
"mpchange85": "SUCCÈS",
"mpchange86": "Toujours autoriser l'obtention automatique du solde du portefeuille"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "फ़ील्ड गुम",
"mpchange83": "अस्वीकृत",
"mpchange84": "विफल",
"mpchange85": "सफल"
"mpchange85": "सफल",
"mpchange86": "हमेशा वॉलेट बैलेंस को स्वचालित रूप से प्राप्त करने की अनुमति दें"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "NEDOSTAJUĆA POLJA",
"mpchange83": "ODBIJENO",
"mpchange84": "GREŠKA",
"mpchange85": "USPJEH"
"mpchange85": "USPJEH",
"mpchange86": "Uvijek dopusti automatsko dobivanje stanja novčanika"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "HIÁNYZÓ MEZŐK",
"mpchange83": "Elutasítva",
"mpchange84": "FAILURE",
"mpchange85": "SIKER"
"mpchange85": "SIKER",
"mpchange86": "Mindig engedélyezze a pénztárcaegyenleg automatikus lekérését"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "CAMPI MANCANTI",
"mpchange83": "RIFIUTATO",
"mpchange84": "FALLITO",
"mpchange85": "RIUSCITO"
"mpchange85": "RIUSCITO",
"mpchange86": "Consenti sempre di ottenere automaticamente il saldo del portafoglio"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "フィールドがありません",
"mpchange83": "拒否されました",
"mpchange84": "失敗",
"mpchange85": "成功"
"mpchange85": "成功",
"mpchange86": "ウォレット残高の自動取得を常に許可する"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "누락된 필드",
"mpchange83": "거부됨",
"mpchange84": "실패",
"mpchange85": "성공"
"mpchange85": "성공",
"mpchange86": "항상 지갑 잔액을 자동으로 가져오도록 허용"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "ONTBREKENDE VELDEN",
"mpchange83": "GEWEIGERD",
"mpchange84": "MISLUKT",
"mpchange85": "SUCCES"
"mpchange85": "SUCCES",
"mpchange86": "Altijd toestaan om automatisch saldo in portemonnee op te halen"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "MANGLER FELT",
"mpchange83": "AVSLAGT",
"mpchange84": "FEIL",
"mpchange85": "SUKSESS"
"mpchange85": "SUKSESS",
"mpchange86": "Tillat alltid få lommeboksaldo automatisk"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "Brakujące pola",
"mpchange83": "ODRZUCONE",
"mpchange84": "NIEPOWODZENIE",
"mpchange85": "POWODZENIE"
"mpchange85": "POWODZENIE",
"mpchange86": "Zawsze zezwalaj na automatyczne pobieranie salda portfela"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "Campos em falta",
"mpchange83": "RECLINADO",
"mpchange84": "FALHA",
"mpchange85": "SUCESSO"
"mpchange85": "SUCESSO",
"mpchange86": "Permitir sempre obter saldo da carteira automaticamente"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "CÂMPURI LIPSĂ",
"mpchange83": "RESFUS",
"mpchange84": "Eșec",
"mpchange85": "SUCCES"
"mpchange85": "SUCCES",
"mpchange86": "Permiteți întotdeauna obținerea automată a soldului portofelului"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "POLJA NEDOSTAJU",
"mpchange83": "ODBIJENO",
"mpchange84": "GREŠKA",
"mpchange85": "USPEH"
"mpchange85": "USPEH",
"mpchange86": "Uvek dozvoli automatsko dobijanje stanja novčanika"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "ПРОПУЩЕННЫЕ ПОЛЯ",
"mpchange83": "ОТКЛОНЕНО",
"mpchange84": "НЕУДАЧА",
"mpchange85": "УСПЕШНО"
"mpchange85": "УСПЕШНО",
"mpchange86": "Всегда разрешать автоматически получать баланс кошелька"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "MISSING FIELDS",
"mpchange83": "DECLINED",
"mpchange84": "FAILURE",
"mpchange85": "SUCCESS"
"mpchange85": "SUCCESS",
"mpchange86": "Always allow get wallet balance automatically"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "缺少字段",
"mpchange83": "拒绝",
"mpchange84": "失败",
"mpchange85": "成功"
"mpchange85": "成功",
"mpchange86": "始终允许自动获取钱包余额"
}
}

View File

@ -1416,6 +1416,7 @@
"mpchange82": "缺少欄位",
"mpchange83": "拒絕",
"mpchange84": "失敗",
"mpchange85": "成功"
"mpchange85": "成功",
"mpchange86": "隨時允許自動取得錢包餘額"
}
}

View File

@ -18,7 +18,9 @@ import {
setNewNotification,
setNewTab,
setSideEffectAction,
setTabNotifications
setTabNotifications,
allowQAPPAutoBalance,
removeQAPPAutoBalance
} from '../../redux/app/app-actions'
import settings from '../../functional-components/settings-page'
import './welcome-page'
@ -52,7 +54,9 @@ window.reduxAction = {
allowQAPPAutoFriendsList: allowQAPPAutoFriendsList,
removeQAPPAutoFriendsList: removeQAPPAutoFriendsList,
allowShowSyncIndicator: allowShowSyncIndicator,
removeShowSyncIndicator: removeShowSyncIndicator
removeShowSyncIndicator: removeShowSyncIndicator,
allowQAPPAutoBalance: allowQAPPAutoBalance,
removeQAPPAutoBalance: removeQAPPAutoBalance
}
const animationDuration = 0.7 // Seconds

View File

@ -8,7 +8,9 @@ import {
removeQAPPAutoAuth,
removeQAPPAutoFriendsList,
removeQAPPAutoLists,
setIsOpenDevDialog
setIsOpenDevDialog,
allowQAPPAutoBalance,
removeQAPPAutoBalance
} from '../../redux/app/app-actions'
import { securityViewStyles } from '../../styles/core-css'
import FileSaver from 'file-saver'
@ -79,6 +81,12 @@ class SecurityView extends connect(store)(LitElement) {
</label>
<mwc-checkbox style="margin-right: -15px;" id="authButton" @click=${(e) => this.checkForAuth(e)} ?checked=${store.getState().app.qAPPAutoAuth}></mwc-checkbox>
</div>
<div class="checkbox-row">
<label for="balanceButton" id="balanceButtonLabel" style="color: var(--black);">
${get('modals.mpchange86')}
</label>
<mwc-checkbox style="margin-right: -15px;" id="balanceButton" @click=${(e) => this.checkForBalance(e)} ?checked=${store.getState().app.qAPPAutoBalance}></mwc-checkbox>
</div>
<div class="checkbox-row">
<label for="authButton" id="authButtonLabel" style="color: var(--black);">
${get('browserpage.bchange39')}
@ -108,6 +116,14 @@ class SecurityView extends connect(store)(LitElement) {
}
}
checkForBalance(e) {
if (e.target.checked) {
store.dispatch(removeQAPPAutoBalance(false))
} else {
store.dispatch(allowQAPPAutoBalance(true))
}
}
checkForLists(e) {
if (e.target.checked) {
store.dispatch(removeQAPPAutoLists(false))

View File

@ -24,7 +24,9 @@ import {
ALLOW_QAPP_FRIENDS_LIST,
REMOVE_QAPP_FRIENDS_LIST,
ALLOW_SHOW_SYNC_INDICATOR,
REMOVE_SHOW_SYNC_INDICATOR
REMOVE_SHOW_SYNC_INDICATOR,
ALLOW_QAPP_AUTO_BALANCE,
REMOVE_QAPP_AUTO_BALANCE
} from '../app-action-types'
export const doUpdateBlockInfo = (blockObj) => {
@ -120,6 +122,20 @@ export const removeQAPPAutoAuth = (payload) => {
}
}
export const allowQAPPAutoBalance = (payload) => {
return {
type: ALLOW_QAPP_AUTO_BALANCE,
payload
}
}
export const removeQAPPAutoBalance = (payload) => {
return {
type: REMOVE_QAPP_AUTO_BALANCE,
payload
}
}
export const allowQAPPAutoLists = (payload) => {
return {
type: ALLOW_QAPP_AUTO_LISTS,

View File

@ -38,4 +38,6 @@ export const SET_COIN_BALANCES = 'SET_COIN_BALANCES'
export const ALLOW_QAPP_FRIENDS_LIST = 'ALLOW_QAPP_FRIENDS_LIST'
export const REMOVE_QAPP_FRIENDS_LIST = 'REMOVE_QAPP_FRIENDS_LIST'
export const ALLOW_SHOW_SYNC_INDICATOR = 'ALLOW_SHOW_SYNC_INDICATOR'
export const REMOVE_SHOW_SYNC_INDICATOR = 'REMOVE_SHOW_SYNC_INDICATOR'
export const REMOVE_SHOW_SYNC_INDICATOR = 'REMOVE_SHOW_SYNC_INDICATOR'
export const ALLOW_QAPP_AUTO_BALANCE = 'ALLOW_QAPP_AUTO_BALANCE'
export const REMOVE_QAPP_AUTO_BALANCE = 'REMOVE_QAPP_AUTO_BALANCE'

View File

@ -40,7 +40,9 @@ import {
ALLOW_QAPP_FRIENDS_LIST,
REMOVE_QAPP_FRIENDS_LIST,
ALLOW_SHOW_SYNC_INDICATOR,
REMOVE_SHOW_SYNC_INDICATOR
REMOVE_SHOW_SYNC_INDICATOR,
ALLOW_QAPP_AUTO_BALANCE,
REMOVE_QAPP_AUTO_BALANCE
} from './app-action-types'
import { initWorkersReducer } from './reducers/init-workers'
import { loginReducer } from './reducers/login-reducer'
@ -89,6 +91,7 @@ const INITIAL_STATE = {
qAPPAutoLists: loadStateFromLocalStorage('qAPPAutoLists') || false,
qAPPFriendsList: loadStateFromLocalStorage('qAPPFriendsList') || false,
showSyncIndicator: loadStateFromLocalStorage('showSyncIndicator') || false,
qAPPAutoBalance: loadStateFromLocalStorage('qAPPAutoBalance') || false,
chatLastSeen: [],
newTab: null,
tabInfo: {},
@ -251,6 +254,22 @@ export default (state = INITIAL_STATE, action) => {
}
}
case ALLOW_QAPP_AUTO_BALANCE: {
saveStateToLocalStorage("qAPPAutoBalance", true)
return {
...state,
qAPPAutoBalance: action.payload
}
}
case REMOVE_QAPP_AUTO_BALANCE: {
saveStateToLocalStorage("qAPPAutoBalance", false)
return {
...state,
qAPPAutoBalance: action.payload
}
}
case ALLOW_QAPP_AUTO_LISTS: {
saveStateToLocalStorage("qAPPAutoLists", true)
return {

View File

@ -315,7 +315,8 @@ class WebBrowser extends LitElement {
switch (data.action) {
case actions.IS_USING_PUBLIC_NODE: {
const res = await isUsingPublicNode()
return res
response = res
break
}
case actions.ADMIN_ACTION: {
@ -405,10 +406,7 @@ class WebBrowser extends LitElement {
}
case actions.SHOW_ACTIONS: {
let dataSentBack = {}
const resMsg = `${listOfAllQortalRequests}`
dataSentBack['qortalRequests'] = resMsg
response = JSON.stringify(dataSentBack)
response = listOfAllQortalRequests
break
}
@ -2642,6 +2640,8 @@ class WebBrowser extends LitElement {
const requiredFields = ['coin']
const missingFields = []
let dataSentBack = {}
let skip = false
let res3
requiredFields.forEach((field) => {
if (!data[field]) {
missingFields.push(field)
@ -2666,10 +2666,15 @@ class WebBrowser extends LitElement {
// TODO: prompt user to share wallet balance. If they confirm, call `GET /crosschain/:coin/walletbalance`, or for QORT, call `GET /addresses/balance/:address`
// then set the response string from the core to the `response` variable (defined above)
// If they decline, send back JSON that includes an `error` key, such as `{"error": "User declined request"}`
const res3 = await showModalAndWait(
actions.GET_WALLET_BALANCE
)
if (res3.action === 'accept') {
if (window.parent.reduxStore.getState().app.qAPPAutoBalance) {
skip = true
}
if (!skip) {
res3 = await showModalAndWait(
actions.GET_WALLET_BALANCE
)
}
if ((res3 && res3.action === 'accept') || skip) {
let coin = data.coin
if (coin === "QORT") {
let qortAddress = window.parent.reduxStore.getState().app.selectedAddress.address
@ -5117,6 +5122,12 @@ async function showModalAndWait(type, data) {
${type === actions.GET_WALLET_BALANCE ? `
<div class="modal-subcontainer">
<p class="modal-paragraph">${get("browserpage.bchange20")}</p>
<div class="checkbox-row">
<label for="balanceButton" id="balanceButtonLabel" style="color: var(--black);">
${get('modals.mpchange86')}
</label>
<mwc-checkbox style="margin-right: -15px;" id="balanceButton" ?checked=${window.parent.reduxStore.getState().app.qAPPAutoBalance}></mwc-checkbox>
</div>
</div>
` : ''}
@ -5266,6 +5277,7 @@ async function showModalAndWait(type, data) {
}
resolve({ action: 'reject' })
})
const cancelButton = modal.querySelector('#cancel-button')
cancelButton.addEventListener('click', () => {
if (modal.parentNode === document.body) {
@ -5292,6 +5304,24 @@ async function showModalAndWait(type, data) {
})
}
const labelButton1 = modal.querySelector('#balanceButtonLabel')
if (labelButton1) {
labelButton1.addEventListener('click', () => {
this.shadowRoot.getElementById('balanceButton').click()
})
}
const checkbox1 = modal.querySelector('#abalanceButton')
if (checkbox1) {
checkbox1.addEventListener('click', (e) => {
if (e.target.checked) {
window.parent.reduxStore.dispatch(window.parent.reduxAction.removeQAPPAutoBalance(false))
return
}
window.parent.reduxStore.dispatch(window.parent.reduxAction.allowQAPPAutoBalance(true))
})
}
const labelButton2 = modal.querySelector('#listsButtonLabel')
if (labelButton2) {
labelButton2.addEventListener('click', () => {