thingsboard / flutter_thingsboard_pe_app

ThingsBoard PE Mobile Application
https://thingsboard.io/products/mobile-pe/
BSD 3-Clause "New" or "Revised" License
87 stars 69 forks source link

State not working in Notification Click #114

Open ronit18 opened 1 month ago

ronit18 commented 1 month ago

In my android flutter app. I am receiving notification perfectly. In that notification template, I have given a dashboard state to go when notification is clicked. And in that state i have given all widgets 'Entity from dashboard state'. image

Now this is working perfectly (going in that state with the selected device) when i click and open notification through pop-up notifications. But when i try to do the same from notification menu in app. It is going in that state but not with the entity.

ss-1

And then i tried to print this state, So I added a log.debug in lib/core/context/tb_context.dart

ss-2

But this is not printing the state in debug console...

ss-3

ronit18 commented 1 month ago

Any Update?

ybeshkarov commented 1 month ago

Hello @ronit18,

I see an issue in the way you're using longing.

350663039-b48a3ab6-27a0-4633-9c17-dd4710c4c8c7

Please see the screenshot above. You passed the state argument as an error, that's why you see a stack trace and dashboard state separately, from the message you created.

Here is the method signature

Screenshot 2024-08-01 at 12 26 47
bhaveshgohel commented 1 month ago

Hi @ybeshkarov it seems @ronit18 having issue when he try to click the notification from notification tab in app. Main issue is It is going in that state but not with the entity.

eg. WORKING: Notification popsup in the mobile.. > Open by clicking it from mobile lockscreen. it works NOT WORKING: Open the same notificaiton from inside the application notifiction tab.. it open the state but not with entity. ( i.e device details dashboard state with specific device)

How to solve this?

ybeshkarov commented 1 month ago

You need to debug an app to see which data you receive in both cases and compare. Based on it you can decide what to do next.

bhaveshgohel commented 1 month ago

We have used the same code from this Repo . It supposed to work as intended. :confused: Can you share snippet or reference how we can navigate on click with state and entity from notification tab?

Thank you.

ybeshkarov commented 1 month ago

NotificationService has the handleClickOnNotification method. This method is used everywhere through the app to handle notification clicks.

lib/utils/services/notification_service.dart

bhaveshgohel commented 1 month ago

@ybeshkarov. Thank you for the quick reply. Let's us check notification_service code and implimentation internally and update you the findings. :+1: