UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    New ConverseJS (XMPP) app with broken source links?

    Scheduled Pinned Locked Moved App Development
    44 Posts 4 Posters 504 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • W Offline
        wilson101
        last edited by

        I'm wondering why the sound notifications don't work even if I use the tweak tool and prevent app suspension. On my computers browser works. On the app don't work.

        W 1 Reply Last reply Reply Quote 0
        • W Offline
          wilson101 @wilson101
          last edited by

          Ok I fixed that now sound notifications are working, but we need to make the app not suspend from the tweak tool if we want to get notifications on locked screen.

          pparentP 1 Reply Last reply Reply Quote 0
          • pparentP Offline
            pparent @wilson101
            last edited by pparent

            @wilson101

            Congrats , thought it might not be ideal to let your app emit notification sounds in background, because users could want their phone to be in mute mode, and only vibrate (+ if you don't hear the notification you cannot know if there was one later).

            Ideally you could make notifications real UT notifications as I did in whatsweb:

            https://github.com/alefnode/ubports-apps/pull/44/commits

            W 1 Reply Last reply Reply Quote 2
            • W Offline
              wilson101 @pparent
              last edited by

              @pparent It's not ideal for sure. But QML is to confusing for me to be able to implement the push notifications properly with the js code of conversejs. If you have any ideas how to do it exactly I will appreciate it.

              pparentP 2 Replies Last reply Reply Quote 0
              • pparentP Offline
                pparent @wilson101
                last edited by

                @wilson101

                It's basically doing the exact same thing I did in this pull request:

                https://github.com/alefnode/ubports-apps/pull/44/commits

                Although you can do something much simpler because, to make sure I don't miss a notification I've taken into account 3 sources: desktop notifications, title change, and sound. The first one may be enough in your case.

                W 1 Reply Last reply Reply Quote 0
                • W Offline
                  wilson101 @pparent
                  last edited by

                  @pparent desktop notifications are enabled in covnerejs by default, but I don't know how to enable them in QML to be able to interact with your module.

                  pparentP 1 Reply Last reply Reply Quote 0
                  • pparentP Offline
                    pparent @wilson101
                    last edited by

                    @wilson101

                    Also make sure to allow your webview to receive desktop notifications in the first place:

                    onFeaturePermissionRequested: {
                           grantFeaturePermission(securityOrigin, feature, true);
                           }
                    
                    1 Reply Last reply Reply Quote 1
                    • pparentP Offline
                      pparent @wilson101
                      last edited by pparent

                      @wilson101 said in New ConverseJS (XMPP) app with broken source links?:

                      @pparent desktop notifications are enabled in covnerejs by default, but I don't know how to enable them in QML to be able to interact with your module.

                      Well first you add to your webview

                      onFeaturePermissionRequested: {
                             grantFeaturePermission(securityOrigin, feature, true);
                             }
                      

                      Then in the profile of the webview:

                      profile:  WebEngineProfile {
                      ......
                      
                               onPresentNotification: (notification) => {
                                      helper.showNotificationMessage(notification.title, notification.message);
                               }
                               
                          .......
                             
                             }//End WebEngineProfile
                      

                      It should be pretty straight forward.

                      W 1 Reply Last reply Reply Quote 1
                      • W Offline
                        wilson101 @pparent
                        last edited by

                        @pparent I have a question about onFeaturePermissionRequested: {
                        grantFeaturePermission(securityOrigin, feature, true);
                        }
                        should I replace feature with notification or whatever name it has in qml or leave it like that ?

                        pparentP 1 Reply Last reply Reply Quote 0
                        • W Offline
                          wilson101
                          last edited by

                          I'm trying this now onFeaturePermissionRequested: {
                          grantFeaturePermission("http://127.0.0.1:9090/index.html", Notifications, true);
                          }

                          I saw the examples here https://doc.qt.io/qt-6/qml-qtwebengine-webengineview-obsolete.html#featurePermissionRequested-signal

                          W 1 Reply Last reply Reply Quote 0
                          • W Offline
                            wilson101 @wilson101
                            last edited by

                            I'm doing something wrong the app froze

                            1 Reply Last reply Reply Quote 0
                            • pparentP Offline
                              pparent @wilson101
                              last edited by pparent

                              @wilson101 said in New ConverseJS (XMPP) app with broken source links?:

                              should I replace feature with notification or whatever name it has in qml or leave it like that ?

                              Yes you can allow only notifications permissions, but if I were you I would see that once you get notifications working in the first place.

                              Normally what you want to do would be something like that:

                              onFeaturePermissionRequested: function(securityOrigin, feature) {
                                      if (feature === WebEngineView.Notifications) {
                                          grantFeaturePermission(securityOrigin, feature, true); 
                                      } else {
                                          grantFeaturePermission(securityOrigin, feature, false); 
                                      }
                                  }
                              
                              W 1 Reply Last reply Reply Quote 0
                              • W Offline
                                wilson101 @pparent
                                last edited by

                                @pparent The problem now is that I can't import your code. This is main.qml https://pastebin.com/raw/kt9cpWBz I get :/qml/Main.qml:37 NotificationHelper is not a type

                                pparentP 1 Reply Last reply Reply Quote 0
                                • W Offline
                                  wilson101
                                  last edited by

                                  I did ./setup-project.sh [PROJECT-PATH] so it must be installed.

                                  pparentP 1 Reply Last reply Reply Quote 0
                                  • pparentP Offline
                                    pparent @wilson101
                                    last edited by

                                    @wilson101

                                    You need to add

                                    import Pparent.Notifications 1.0
                                    

                                    And of course link my QML module

                                    W 1 Reply Last reply Reply Quote 0
                                    • pparentP Offline
                                      pparent @wilson101
                                      last edited by

                                      @wilson101 said in New ConverseJS (XMPP) app with broken source links?:

                                      I did ./setup-project.sh [PROJECT-PATH] so it must be installed.

                                      Yes but you should check that the module gets indeed compiled and linked to your project.

                                      1 Reply Last reply Reply Quote 0
                                      • W Offline
                                        wilson101 @pparent
                                        last edited by

                                        said in New ConverseJS (XMPP) app with broken source links?:

                                        import Pparent.Notifications 1.0

                                        It's building and installing the app it runs but freezes.

                                        pparentP 1 Reply Last reply Reply Quote 0
                                        • pparentP Offline
                                          pparent @wilson101
                                          last edited by

                                          @wilson101

                                          You can always debug with

                                          journalctl -r
                                          

                                          I don't see how the module could make the app freeze, but if the qml module was not built, or not linked to the project, then it could refuse to start QML.

                                          W 1 Reply Last reply Reply Quote 0
                                          • W Offline
                                            wilson101 @pparent
                                            last edited by

                                            @pparent ubuntu-phablet aa-exec[74446]: qrc:/qml/Main.qml:27:1: module "Pparent.Notifications" is not installed yes i see this in clickable logs

                                            1 Reply Last reply Reply Quote 0
                                            • W Offline
                                              wilson101
                                              last edited by

                                              should I add to clickable.yaml here

                                              clickable_minimum_required: 8.6.0
                                              builder: rust
                                              kill: conversejs
                                              install_root_data:

                                              • manifest.json
                                              • content-hub.json
                                              • conversejs.apparmor
                                              • conversejs.desktop
                                              • assets
                                              • www

                                              the folder of the module?

                                              1 Reply Last reply Reply Quote 0
                                              • First post
                                                Last post