I would like to show a list of devices that a user has enabled push notifications for in their dashboard. In this list I would like to highlight the current device they are using if it's in the list or show a "Add this device" button if it's not in the list. So let's say the user has enabled push notifications on their phone and on their desktop. They log into the dashboard on their phone. Is there a way for me to tell that it's their phone? Also, what if they decide to block notifications in their browser or do a factory reset (my database won't sync obviously)? So what would be a good way to purge that old device from the list?
I'm doing this because I want a good user experience and I want to give users the option to toggle push notifications on/off per device through the dashboard without making them do it through the browser which could end up in them never re-enabling them again.
I was thinking maybe passing a hardcoded (but generated) id variable into the service worker?
let deviceId = 0;
But this seems really clunky. Is there a better way?
PS. My backend is PHP and MYSQL. Don't think it matters, but any answers with server-side code I'd prefer with those. I think this is all client-side though.
If the user resets the browser (device), you will only discover it by trying to send something and getting a 404. So it's not possible to always be able to show a list of devices with 100 % correct info if you're not spamming the user all the time. You could probably show something like the last time a push was delivered to a certain device, maybe that would be good UX-wise.
To detect which of the devices is the current one looking at the list, simply use some sort of an id that is saved in the db when the push subscription is created. Then hold on to that id in the device (browser) and based on that, make one of the items on the list pop up.
Related
The Dynamics documentation is just awful and I couldn't find an answer to this simple question:
In the web version of the CRM, is it possible to register a web page that can be toggled by the user and that itself has an internal state (updated regularly by an interval set with setInterval) that will persist even if the users closes the page (not the entire CRM, just the sub-page)?
We need the user to provide some information for a CTI integration, and this background process to keep alive the CTI session by polling an API while the user session is active. In addition, we need to reuse the component where the user provides the CTI information to be notified if the session fails and restore it or close it if necessary. The real purpose for this is to make a screen pop (push content information about the incoming call to the agent) which I know can be done using Xrm.Utility, although doing it with a REST API method would be much better, RouteTo Aciton looks like the best method to do this, but I'm not sure it will proactively show the item in the user's browser.
I'm not sure this question is as simple as you suggest, it seems relatively complicated, and involves an integration. I'm not suprised the Dynamics documentation doesn't provide an answer for this specific and unique scenario.
I don't believe there is any single feature within Dynamics that will meet this requirement.
You could use a HTML web resource or a web page from a seperate web site iframed into CRM. I think the possible use of these depends on your expected user experience; I believe the user would need to have the page loaded at all times showing these controls (e.g. user is looking at a dashboard) - I don't see how the controls could interact with the user client side otherwise. You could show the controls in multiple places however.
Xrm.Utility is one way to open a record, but it can also be done by Open forms, views, dialogs, and reports with a URL.
RouteToAction looks like it just adds a record into the user queue, the user would need to refresh the queues to see the changes. I don't believe there is any way for a server side REST API call to natively redirect the user.
You could add JavaScript to do this, however you might struggle to add the JavaScript into every page of CRM.
Where I have worked on a CTI integration in the past (assuming you mean computer telephony integration), we always had some other component doing the screen pops - the client's all had a desktop app installed as part of the telephony solution.
Perhaps you could look into browser notifications, or a browser plugin?
I am writing a system where multiple people will be logged into it at a time but we can't have two users looking at the same user record at the same time. how would i make it so that two people cant be looking at the same data. so say if username: admin is looking at record: 123, and username: user wants to access record: 123 user would be given a prompt saying "sorry admin is already looking at that record please wait until they have finished thank you"
how would i go about locking the other user out.
so you search for your record in the left box and click search it then brings up this results pane on the right with the results. i want it so when you click open it takes you to the record but if theres someone in the record i want it to say what i wrote above.
There is no simple way of achieving this, and you cannot do it client side as the browser is unaware of what is happening on other browsers.
You will have to implement something on your Server Side like socket.io.
With the socket you can issue a websocket push to all currently logged in users when another user goes to a record.
For instance with your example lets say user Admin goes into record 123.
Then you can send a notification to all other currently logged in users and tell them user Admin is currently looking at record 123.
On the client side ( presuming you are using something like Redux for the store ) you can then update the records and make 123
unreadable or not displayable.
*There is something you need to keep in mind though, when the user navigates out of the screen you will need to unlock that record. The problem with that is that users can leave the page by doing multiple actions ( pressing browser back button, closing the page, or navigating to some other page on your application ). You will need a way to figure this out, once you have done so you can then update all users with a notification saying the record is now available and repeat the steps above.
Hope that explains it well enough, tell me if you need more clarification.
I am coding an application, there is a drop down in GUI contains values that are directly from back end data. However, there is a new requirement coming, when user is browsing the drop down and click delete button from keyboard/right click mouse, we should hide the value in drop down and don't show it anymore in GUI, but I don't want to delete the hided value in back end database.
The difficulty for me is how can I store the filtered drop down list values in my GWT java code? Any ideas? Thanks!
It sounds like you want each client to have data stored on what they've deleted. Instead of having to track each client's decisions in the database, you should have the information stored on the client's machine. This can be done in a preferences file, HTML5 Storage, etc depending on what kind of client it is. If the client changes computers, their data won't be saved, but I don't think that's unexpected behavior. It really depends on the application and what you expect. Either way, store the client and their deletions in a separate table or on their own machine.
I'm building a chat application with some php, mysql, nodejs, socketio.
I want to allow users to be logged in from nomatterwhat number devices. Like eg. Facebook where it doesn't matter which screen you're looking at. They all reflect the latest changes.
Tested it right now and it works that way. If i open the notifidations the number dissappears on the same page on different devices.
My guess -and started building with that iedea in mind – was that a room is created for each user when a user logs in the first time and any following login from the same user is also added to that room so the changes can easily be broadcasted to the room.
All browsers are aware off the multiple logins because i send a soclet-message to the room setting a variable - multilogin- so that it knows that there are more.
Also needed to see when a user clicks on the logout-buttons it send that information along.
If it is the only one logged in it should kill the session set the user offline.
Actions performed on one device, broadcasts it to the other members in the room etc.
Seems logical?
It works so far but i'm uncertain about the session part of this setup.
The logic in php -inherited from the origanal build of the chat – checks the user logging in to see if the user is already logged in and if so, it destroys the existing session first and then sends a loggout command -which i prevent now when the multilogin parameter is send along- to the other browser.
My question now is, what could be a logical approach towards the sessions?
I was playing with some ideas in my head and then i thought, let's look on the internet about the subject.
An idea could be that only the first loggin in gets the session created and is shared by sending the id to the others so they can be identified as being the same user.
Would that be an approach that one would suggest?
Found a simple solution by letting each device with same user that logs in getting a new sessionid which is send to the others (socket message to room) so their sessionid becomes the same to authenticate themselves to the server. Session id is save enough for that purpose.
Here's the idea.
I'm coding a chat bar, I have everything functioning. But my issue is keeping everything continuous whilst browsing pages across the site. By this I mean, chat boxes staying open. Like Facebook, as on Facebook, every time you open up a chat box and then navigate to a different page, it stays open, you don't have to go back into your online friends list and load of the chat box.
What have I done so far?
One method I have thought of using is using cookies to store the ID of the conversation in a cookie and put whether it is open or closed. So if a conversation has an ID of 64 a cookie is made called chat_64. I am using this jQuery cookie documentation: https://github.com/carhartl/jquery-cookie
I was thinking that it would be done by putting them into an array, and then using opening a chat box for each cookie.
I have come to ask for suggestions on how this could be done?
Don't store that kind of information in a cookie, use sessions in your server. It's a big risk for privacy.
Store session data or use a database, with a call to a php(for example) script that fetches the current chats from a database, an additional feature is that if the user logs off and then logs in again, the chats could stay the same.
the table could be something like this:
chat_id | user_id | chatting_with_id | timestamp
When the user closes the chat window you might just set a time limit for the user to reopen the window and if he/she didn't, send a delete request for that row.