sicoobcooplivre Posted July 14, 2022 Share Posted July 14, 2022 Good Morning! My users keep the unigui application open all day! I'm drawing the possibility to display notification! I would like to know if there is any way to display a notification in the browser or even next to the windows notifications? If possible an example for me to study! Thanks! Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted July 15, 2022 Author Share Posted July 15, 2022 @Sherzod Could you please advise if it is possible to do this, and if there is any material for me to study? Thanks! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 15, 2022 Share Posted July 15, 2022 On 7/14/2022 at 6:08 PM, sicoobcooplivre said: I would like to know if there is any way to display a notification in the browser or even next to the windows notifications? Hello @sicoobcooplivre Perhaps you should wait for websockets, although there are some solutions on the forum. Try to search. Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted July 18, 2022 Author Share Posted July 18, 2022 @SherzodGood afternoon. I found it talking about https://pushjs.org/ as a free option, but I don't know how to use it! Do you have any tips for me to study, please? Thanks! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 18, 2022 Share Posted July 18, 2022 Hello @sicoobcooplivre I will check. Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted July 18, 2022 Author Share Posted July 18, 2022 Thanks! Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted July 18, 2022 Author Share Posted July 18, 2022 Within the application I was able to display a toast. Turns out I need to present if it is possible to also display the notification on windows so that users pay attention! Thanks! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 19, 2022 Share Posted July 19, 2022 5 hours ago, sicoobcooplivre said: Within the application I was able to display a toast. With pushjs? Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted July 19, 2022 Author Share Posted July 19, 2022 No, I took an example from the forum! Toast is working. But what they're asking me is to display the notification on windows, because users leave the application in the browser open all day, and they need to see the notifications! I need to know if there is a way? And if there would be any material for me to study, because I'm starting! Thanks! Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted July 19, 2022 Author Share Posted July 19, 2022 @SherzodDo you think it is possible for example to use pushjs with unigui application? I need an answer so I can move forward here! Thanks! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 19, 2022 Share Posted July 19, 2022 38 minutes ago, sicoobcooplivre said: Do you think it is possible for example to use pushjs with unigui application? @sicoobcooplivre I once used in a simple case. Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted July 19, 2022 Author Share Posted July 19, 2022 @SherzodCan you please share here, or a material to study, because I really need it, for yesterday, lol!!! Thanks! Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted July 22, 2022 Author Share Posted July 22, 2022 @SherzodGood Morning! Any news? Would you help me? Otherwise I'll have to cancel this project! It could be a material I study! Thanks! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 22, 2022 Share Posted July 22, 2022 Hello @sicoobcooplivre Sorry I haven't been able to review yet... 4 minutes ago, sicoobcooplivre said: It could be a material I study! https://pushjs.org/docs/quick-start Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted July 22, 2022 Author Share Posted July 22, 2022 Thanks! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 23, 2022 Share Posted July 23, 2022 20 hours ago, sicoobcooplivre said: Would you help me? Hello, Simple usage example. 1. UniServerModule.CustomFiles -> files/push.min.js 2. MainForm OnCreate -> procedure TMainForm.UniFormCreate(Sender: TObject); begin with JSInterface do JSAssign('getGranted', [JSFunction('','ajaxRequest('+ Self.WebForm.JSName +', "getGranted", ["granted="+Push.Permission.get()])')]); end; 3. MainForm -> private { Private declarations } FPermission: string; public { Public declarations } end; 4. MainForm OnAjaxEvent -> procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'getGranted' then begin FPermission := Params.Values['granted']; end; end; 5. UniTimer OnTimer -> procedure TMainForm.UniTimer1Timer(Sender: TObject); var ATitle, ABody, AIcon: string; ATimeoutMS: Integer; begin if FPermission<>'denied' then begin ATitle := 'Hello'; ABody := 'UniGUI'; AIcon := ''; ATimeoutMS := 5000; JSInterface.JSCode( 'Push.create("'+ATitle+'",'+ '{'+ 'body: "'+ ABody +'",'+ 'icon: "'+ AIcon +'",'+ 'timeout: "'+ IntToStr(ATimeoutMS) +'",'+ 'onClick: function () {'+ ' window.focus(); '+ ' this.close(); '+ '}'+ '});' ); end; end; 3 Quote Link to comment Share on other sites More sharing options...
Fred Montier Posted July 27, 2022 Share Posted July 27, 2022 1 Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted August 19, 2022 Author Share Posted August 19, 2022 Thanks! Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted August 10, 2023 Author Share Posted August 10, 2023 @Sherzod Good morning! Your help in this post served just right for my users who use a browser on the PC. But when doing a test on chrome mobile, the push does not work, and does not display an error! Please, can you tell me if it doesn't work in browse mobile? Can you help me please? Thanks! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 10, 2023 Share Posted August 10, 2023 You must give permission for notifications... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.