From 890998c827a7f32ecd5bab59d93e9c6ca194e923 Mon Sep 17 00:00:00 2001 From: Alexander Emelin Date: Wed, 28 Feb 2024 22:43:50 +0200 Subject: [PATCH] support push language, timezone, proper logout in non idp case --- src/App.tsx | 4 ++ .../PushNotification/PushNotification.tsx | 59 +++++++++++++++---- 2 files changed, 51 insertions(+), 12 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 390a862..1b266a8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -247,6 +247,10 @@ function ShellWrapper({ const [lastSignIn, setLastSignIn] = useState(0) const signinSilent = () => { + if (!useIDP) { + handleLogout() + return + } if (!auth) { handleLogout() return diff --git a/src/pages/PushNotification/PushNotification.tsx b/src/pages/PushNotification/PushNotification.tsx index 9d37b63..39b0066 100644 --- a/src/pages/PushNotification/PushNotification.tsx +++ b/src/pages/PushNotification/PushNotification.tsx @@ -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, @@ -56,6 +65,8 @@ function createData( provider, platform, user, + timezone, + language, created_at, updated_at, meta, @@ -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, @@ -520,22 +533,34 @@ export function PushNotification({

Topics:

- {selectedItem.topics.map( - (item: string, index: number) => ( - + {selectedItem.topics ? ( + selectedItem.topics.map( + (item: string, index: number) => ( + + ) ) + ) : ( + + Device does not have topics + )}

Meta information:

-
-                          {JSON.stringify(selectedItem.meta, null, '  ')}
-                        
+ {selectedItem.meta ? ( +
+                            {JSON.stringify(selectedItem.meta, null, '  ')}
+                          
+ ) : ( + + Device does not have meta + + )}
User + + Timezone + + + Language + Created @@ -708,7 +739,9 @@ export function PushNotification({ }} > - {node.deviceId} + handleRowClick(node)}> + {truncateText(node.deviceId, 30)} + {node.provider} {node.platform} {node.user} + {node.timezone} + {node.language} {new Date(node.created_at).toLocaleString()}