Skip to content

Commit

Permalink
support push language, timezone, proper logout in non idp case
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-emelin committed Feb 28, 2024
1 parent 85f800f commit 890998c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 12 deletions.
4 changes: 4 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ function ShellWrapper({
const [lastSignIn, setLastSignIn] = useState(0)

const signinSilent = () => {
if (!useIDP) {
handleLogout()
return
}
if (!auth) {
handleLogout()
return
Expand Down
59 changes: 47 additions & 12 deletions src/pages/PushNotification/PushNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,21 @@ interface PushNotificationProps {
edition: 'oss' | 'pro'
}

function truncateText(text: String, len: number) {
if (text.length > len) {
text = text.substring(0, len) + '...'
}
return text
}

function createData(
deviceId: string,
token: string,
provider: string,
platform: string,
user: string,
timezone: string,
language: string,
created_at: number,
updated_at: number,
meta: any,
Expand All @@ -56,6 +65,8 @@ function createData(
provider,
platform,
user,
timezone,
language,
created_at,
updated_at,
meta,
Expand Down Expand Up @@ -292,6 +303,8 @@ export function PushNotification({
item.provider,
item.platform,
item.user,
item.timezone || '',
item.language || '',
item.created_at,
item.updated_at,
item.meta,
Expand Down Expand Up @@ -520,22 +533,34 @@ export function PushNotification({
</Box>
<Box>
<p style={{ marginBottom: '5px' }}>Topics:</p>
{selectedItem.topics.map(
(item: string, index: number) => (
<Chip
variant="outlined"
key={index}
label={item}
style={{ marginRight: '3px' }}
/>
{selectedItem.topics ? (
selectedItem.topics.map(
(item: string, index: number) => (
<Chip
variant="outlined"
key={index}
label={item}
style={{ marginRight: '3px' }}
/>
)
)
) : (
<span style={{ fontSize: '0.8em' }}>
Device does not have topics
</span>
)}
</Box>
<Box>
<p style={{ marginBottom: '5px' }}>Meta information:</p>
<pre style={{ fontSize: '0.8em' }}>
{JSON.stringify(selectedItem.meta, null, ' ')}
</pre>
{selectedItem.meta ? (
<pre style={{ fontSize: '0.8em' }}>
{JSON.stringify(selectedItem.meta, null, ' ')}
</pre>
) : (
<span style={{ fontSize: '0.8em' }}>
Device does not have meta
</span>
)}
</Box>
<Box
style={{ marginTop: '20px' }}
Expand Down Expand Up @@ -691,6 +716,12 @@ export function PushNotification({
<TableCell sx={headCellSx} align="right">
User
</TableCell>
<TableCell sx={headCellSx} align="right">
Timezone
</TableCell>
<TableCell sx={headCellSx} align="right">
Language
</TableCell>
<TableCell sx={headCellSx} align="right">
Created
</TableCell>
Expand All @@ -708,7 +739,9 @@ export function PushNotification({
}}
>
<TableCell component="th" scope="row">
{node.deviceId}
<span onClick={() => handleRowClick(node)}>
{truncateText(node.deviceId, 30)}
</span>
</TableCell>
<TableCell align="right">
<SettingsIcon
Expand All @@ -721,6 +754,8 @@ export function PushNotification({
<TableCell align="right">{node.provider}</TableCell>
<TableCell align="right">{node.platform}</TableCell>
<TableCell align="right">{node.user}</TableCell>
<TableCell align="right">{node.timezone}</TableCell>
<TableCell align="right">{node.language}</TableCell>
<TableCell align="right">
{new Date(node.created_at).toLocaleString()}
</TableCell>
Expand Down

0 comments on commit 890998c

Please sign in to comment.