Skip to content

Commit

Permalink
Private groups, Mobile app - fixes (still WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Dec 13, 2024
1 parent 309c9d1 commit 67c15f5
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/elements/VerticalMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class VerticalMenu extends React.Component {
const LinkType = i.extLink ? ExtLink : Link
const service = i.extLink || undefined
return <li data-link={i.link} data-value={i.value} key={i.key ? i.key : i.value} onClick={i.link ? this.closeMenu : null}>
{i.link ? <LinkType to={i.link} target={target} onClick={i.onClick} service={service}>
{i.link ? <LinkType to={i.link} target={target} onClick={i.onClick} onTouchStart={i.onTouchStart} onTouchEnd={i.onTouchEnd} service={service}>
{i.icon && <Icon name={i.icon} size={iconSize} />}{i.label ? i.label : i.value}
{i.data && <span>{i.data}</span>}
&nbsp; {i.addon}
Expand Down
22 changes: 21 additions & 1 deletion src/components/pages/Messages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ class Messages extends React.Component {
this.notifyErrorsClear()
const ping = async (firstCall = false) => {
if (!firstCall) {
window.errorLogs.push({ details: { ping: Date.now() } })
try {
await notifyWsPing()
if (this.state.notifyErrors) {
Expand All @@ -340,6 +341,7 @@ class Messages extends React.Component {
}
setTimeout(ping, 10000)
}
ping(true)
this.watchGroup(this.props.to)
}

Expand Down Expand Up @@ -956,7 +958,25 @@ class Messages extends React.Component {
]

if (process.env.MOBILE_APP) {
user_menu.push({link: '#', onClick: this.props.openSettings, icon: 'new/setting', value: tt('g.settings')})
user_menu.push({link: '#', onClick: this.props.openSettings, icon: 'new/setting', value: tt('g.settings'),
onTouchStart: (e) => {
window.settingsTouch = setTimeout(() => {
try {
const { errorLogs } = window
let msg = ''
for (const err of errorLogs) {
msg += (err.err ? err.err.toString() : '') + '\n' + JSON.stringify(err.details) + '\n\n'
}
alert(msg)
} catch (err) {
alert('Cannot display error logs, due to: ' + (err && err.toString()))
}
}, 3000)
},
onTouchEnd: (e) => {
clearTimeout(window.settingsTouch)
}
})
}

user_menu.push({link: '#', icon: 'new/logout', onClick: logout, value: tt('g.logout')})
Expand Down
2 changes: 1 addition & 1 deletion src/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
"render_error": ";( Ошибка рендеринга"
},
"stub_jsx": {
"read_only": "Писать сообщения в этой группе могут лишь ее члены.",
"read_only": "Писать сообщения могут только члены группы.",
"private_group": "Это закрытая группа. Чтобы видеть сообщения и общаться в ней, надо стать ее членом.",
"pending": "Вы подали заявку на вступление в группу.",
"banned": "Вы забанены в этой группе.",
Expand Down
4 changes: 4 additions & 0 deletions src/utils/NotifyApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ function saveSession(response) {
}
}
if (!session) return;
if (window.errorLogs) {
let xSess = session && session.substring && (session.substring(0, 5) + '...')
window.errorLogs.push({ details: { xsession: xSess } })
}
localStorage.setItem('X-Session', session);
}

Expand Down

0 comments on commit 67c15f5

Please sign in to comment.