mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-11 17:55:51 +00:00
Merge branch 'master' of https://github.com/Qortal/qortal-ui
This commit is contained in:
commit
0210218fff
@ -736,7 +736,10 @@
|
||||
"bchange49": "Do you grant this application permission to access the following private information from your profile?",
|
||||
"bchange50": "This app has requested a change to your public profile. Property: ",
|
||||
"bchange51": "To submit the changes don't forget to click on 'Update profile'",
|
||||
"bchange52": "Do you give this application permission to get your wallet information?"
|
||||
"bchange52": "Do you give this application permission to get your wallet information?",
|
||||
"bchange53": "Always allow your friends list to be retrieved automatically by all apps",
|
||||
"bchange54": "Do you give this application permission to access your friends list?"
|
||||
|
||||
},
|
||||
"datapage": {
|
||||
"dchange1": "Data Management",
|
||||
|
@ -20,9 +20,11 @@ import {
|
||||
addChatLastSeen,
|
||||
addTabInfo,
|
||||
allowQAPPAutoAuth,
|
||||
allowQAPPAutoFriendsList,
|
||||
allowQAPPAutoLists,
|
||||
removeAutoLoadImageChat,
|
||||
removeQAPPAutoAuth,
|
||||
removeQAPPAutoFriendsList,
|
||||
removeQAPPAutoLists,
|
||||
setNewNotification,
|
||||
setNewTab,
|
||||
@ -43,7 +45,9 @@ window.reduxAction = {
|
||||
setTabNotifications: setTabNotifications,
|
||||
setNewTab: setNewTab,
|
||||
setNewNotification: setNewNotification,
|
||||
setSideEffectAction: setSideEffectAction
|
||||
setSideEffectAction: setSideEffectAction,
|
||||
allowQAPPAutoFriendsList: allowQAPPAutoFriendsList,
|
||||
removeQAPPAutoFriendsList: removeQAPPAutoFriendsList
|
||||
}
|
||||
|
||||
const animationDuration = 0.7 // Seconds
|
||||
|
@ -3,8 +3,10 @@ import {connect} from 'pwa-helpers'
|
||||
import {store} from '../../store.js'
|
||||
import {
|
||||
allowQAPPAutoAuth,
|
||||
allowQAPPAutoFriendsList,
|
||||
allowQAPPAutoLists,
|
||||
removeQAPPAutoAuth,
|
||||
removeQAPPAutoFriendsList,
|
||||
removeQAPPAutoLists,
|
||||
setIsOpenDevDialog
|
||||
} from '../../redux/app/app-actions.js'
|
||||
@ -146,6 +148,12 @@ class SecurityView extends connect(store)(LitElement) {
|
||||
</label>
|
||||
<mwc-checkbox style="margin-right: -15px;" id="authButton" @click=${(e) => this.checkForLists(e)} ?checked=${store.getState().app.qAPPAutoLists}></mwc-checkbox>
|
||||
</div>
|
||||
<div class="checkbox-row">
|
||||
<label for="authButton" id="authButtonLabel" style="color: var(--black);">
|
||||
${get('browserpage.bchange53')}
|
||||
</label>
|
||||
<mwc-checkbox style="margin-right: -15px;" id="authButton" @click=${(e) => this.checkForFriends(e)} ?checked=${store.getState().app.qAPPFriendsList}></mwc-checkbox>
|
||||
</div>
|
||||
<div class="checkbox-row">
|
||||
<button
|
||||
class="add-dev-button"
|
||||
@ -176,6 +184,14 @@ class SecurityView extends connect(store)(LitElement) {
|
||||
}
|
||||
}
|
||||
|
||||
checkForFriends(e) {
|
||||
if (e.target.checked) {
|
||||
store.dispatch(removeQAPPAutoFriendsList(false))
|
||||
} else {
|
||||
store.dispatch(allowQAPPAutoFriendsList(true))
|
||||
}
|
||||
}
|
||||
|
||||
checkForDownload() {
|
||||
const checkPass = this.shadowRoot.getElementById('downloadBackupPassword').value
|
||||
if (checkPass === '') {
|
||||
|
@ -20,7 +20,9 @@ import {
|
||||
UPDATE_BLOCK_INFO,
|
||||
UPDATE_NODE_INFO,
|
||||
UPDATE_NODE_STATUS,
|
||||
SET_PROFILE_DATA
|
||||
SET_PROFILE_DATA,
|
||||
ALLOW_QAPP_FRIENDS_LIST,
|
||||
REMOVE_QAPP_FRIENDS_LIST
|
||||
} from '../app-action-types.js'
|
||||
|
||||
export const doUpdateBlockInfo = (blockObj) => {
|
||||
@ -129,6 +131,20 @@ export const removeQAPPAutoLists = (payload) => {
|
||||
}
|
||||
}
|
||||
|
||||
export const allowQAPPAutoFriendsList = (payload) => {
|
||||
return {
|
||||
type: ALLOW_QAPP_FRIENDS_LIST,
|
||||
payload
|
||||
}
|
||||
}
|
||||
|
||||
export const removeQAPPAutoFriendsList = (payload) => {
|
||||
return {
|
||||
type: REMOVE_QAPP_FRIENDS_LIST,
|
||||
payload
|
||||
}
|
||||
}
|
||||
|
||||
export const setChatLastSeen = (payload) => {
|
||||
return {
|
||||
type: SET_CHAT_LAST_SEEN,
|
||||
|
@ -35,3 +35,5 @@ export const SET_NEW_NOTIFICATION = 'SET_NEW_NOTIFICATION'
|
||||
export const SET_SIDE_EFFECT= 'SET_SIDE_EFFECT'
|
||||
export const SET_PROFILE_DATA = 'SET_PROFILE_DATA'
|
||||
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'
|
||||
|
@ -36,7 +36,9 @@ import {
|
||||
UPDATE_BLOCK_INFO,
|
||||
UPDATE_NODE_INFO,
|
||||
UPDATE_NODE_STATUS,
|
||||
SET_PROFILE_DATA
|
||||
SET_PROFILE_DATA,
|
||||
ALLOW_QAPP_FRIENDS_LIST,
|
||||
REMOVE_QAPP_FRIENDS_LIST
|
||||
} from './app-action-types.js'
|
||||
import {initWorkersReducer} from './reducers/init-workers.js'
|
||||
import {loginReducer} from './reducers/login-reducer.js'
|
||||
@ -85,6 +87,7 @@ const INITIAL_STATE = {
|
||||
autoLoadImageChats: loadStateFromLocalStorage('autoLoadImageChats') || [],
|
||||
qAPPAutoAuth: loadStateFromLocalStorage('qAPPAutoAuth') || false,
|
||||
qAPPAutoLists: loadStateFromLocalStorage('qAPPAutoLists') || false,
|
||||
qAPPFriendsList: loadStateFromLocalStorage('qAPPFriendsList') || false,
|
||||
chatLastSeen: [],
|
||||
newTab: null,
|
||||
tabInfo: {},
|
||||
@ -241,6 +244,22 @@ export default (state = INITIAL_STATE, action) => {
|
||||
}
|
||||
}
|
||||
|
||||
case ALLOW_QAPP_FRIENDS_LIST: {
|
||||
saveStateToLocalStorage("qAPPFriendsList", true)
|
||||
return {
|
||||
...state,
|
||||
qAPPFriendsList: action.payload
|
||||
}
|
||||
}
|
||||
|
||||
case REMOVE_QAPP_FRIENDS_LIST: {
|
||||
saveStateToLocalStorage("qAPPFriendsList", false)
|
||||
return {
|
||||
...state,
|
||||
qAPPFriendsList: action.payload
|
||||
}
|
||||
}
|
||||
|
||||
case SET_CHAT_LAST_SEEN: {
|
||||
return {
|
||||
...state,
|
||||
|
@ -73,8 +73,11 @@ export const CREATE_POLL= 'CREATE_POLL'
|
||||
//GET_PROFILE_DATA
|
||||
export const GET_PROFILE_DATA = 'GET_PROFILE_DATA'
|
||||
|
||||
|
||||
// SET_PROFILE_DATA
|
||||
export const SET_PROFILE_DATA= 'SET_PROFILE_DATA'
|
||||
|
||||
//GET_DAY_SUMMARY
|
||||
export const GET_DAY_SUMMARY = 'GET_DAY_SUMMARY'
|
||||
|
||||
//GET_FRIENDS_LIST
|
||||
export const GET_FRIENDS_LIST = 'GET_FRIENDS_LIST'
|
@ -1083,6 +1083,44 @@ class WebBrowser extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
case actions.GET_FRIENDS_LIST: {
|
||||
let skip = false
|
||||
if (window.parent.reduxStore.getState().app.qAPPFriendsList) {
|
||||
skip = true
|
||||
}
|
||||
let res1
|
||||
if (!skip) {
|
||||
res1 = await showModalAndWait(
|
||||
actions.GET_FRIENDS_LIST
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
if (res1 && res1.action === 'accept' || skip) {
|
||||
|
||||
try {
|
||||
let list = JSON.parse(localStorage.getItem('friends-my-friend-list') || "[]")
|
||||
|
||||
list = list.map((friend)=> friend.name || "")
|
||||
response = JSON.stringify(list)
|
||||
} catch (error) {
|
||||
const data = {}
|
||||
const errorMsg = "Error in retrieving friends list"
|
||||
data['error'] = errorMsg
|
||||
response = JSON.stringify(data)
|
||||
}
|
||||
|
||||
break
|
||||
|
||||
} else {
|
||||
const data = {}
|
||||
const errorMsg = "User declined to share friends list"
|
||||
data['error'] = errorMsg
|
||||
response = JSON.stringify(data)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
case actions.LINK_TO_QDN_RESOURCE:
|
||||
case actions.QDN_RESOURCE_DISPLAYED:
|
||||
// Links are handled by the core, but the UI also listens for these actions in order to update the address bar.
|
||||
@ -3773,6 +3811,17 @@ async function showModalAndWait(type, data) {
|
||||
</div>
|
||||
</div>
|
||||
` : ''}
|
||||
${type === actions.GET_FRIENDS_LIST ? `
|
||||
<div class="modal-subcontainer">
|
||||
<p class="modal-paragraph">${get("browserpage.bchange54")}</p>
|
||||
<div class="checkbox-row">
|
||||
<label for="friendsListCheckbox" id="friendsListLabel" style="color: var(--black);">
|
||||
${get('browserpage.bchange53')}
|
||||
</label>
|
||||
<mwc-checkbox style="margin-right: -15px;" id="friendsListCheckbox" ?checked=${window.parent.reduxStore.getState().app.qAPPFriendsList}></mwc-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
` : ''}
|
||||
${type === actions.ADD_LIST_ITEMS ? `
|
||||
<div class="modal-subcontainer">
|
||||
<p class="modal-paragraph">${get("browserpage.bchange43")}</p>
|
||||
@ -3891,6 +3940,23 @@ async function showModalAndWait(type, data) {
|
||||
window.parent.reduxStore.dispatch(window.parent.reduxAction.allowQAPPAutoLists(true))
|
||||
})
|
||||
}
|
||||
|
||||
const labelButtonFriendsList = modal.querySelector('#friendsListLabel')
|
||||
if (labelButtonFriendsList) {
|
||||
labelButtonFriendsList.addEventListener('click', () => {
|
||||
this.shadowRoot.getElementById('listsButton').click()
|
||||
})
|
||||
}
|
||||
const labelButtonFriendsList2 = modal.querySelector('#friendsListCheckbox')
|
||||
if (labelButtonFriendsList2) {
|
||||
labelButtonFriendsList2.addEventListener('click', (e) => {
|
||||
if (e.target.checked) {
|
||||
window.parent.reduxStore.dispatch(window.parent.reduxAction.removeQAPPAutoFriendsList(false))
|
||||
return
|
||||
}
|
||||
window.parent.reduxStore.dispatch(window.parent.reduxAction.allowQAPPAutoFriendsList(true))
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user