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
    50 Posts 4 Posters 1.7k 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.
      • pparentP Offline
        pparent @Guest
        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.

        ? 1 Reply Last reply Reply Quote 1
        • ? Offline
          A Former User @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
          • ? Offline
            A Former User
            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

            ? 1 Reply Last reply Reply Quote 0
            • ? Offline
              A Former User @Guest
              last edited by

              I'm doing something wrong the app froze

              1 Reply Last reply Reply Quote 0
              • pparentP Offline
                pparent @Guest
                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); 
                        }
                    }
                
                ? 1 Reply Last reply Reply Quote 0
                • ? Offline
                  A Former User @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
                  • ? Offline
                    A Former User
                    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 @Guest
                      last edited by

                      @wilson101

                      You need to add

                      import Pparent.Notifications 1.0
                      

                      And of course link my QML module

                      ? 1 Reply Last reply Reply Quote 0
                      • pparentP Offline
                        pparent @Guest
                        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
                        • ? Offline
                          A Former User @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 @Guest
                            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.

                            ? 1 Reply Last reply Reply Quote 0
                            • ? Offline
                              A Former User @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
                              • ? Offline
                                A Former User
                                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
                                • poVoqP Offline
                                  poVoq @pparent
                                  last edited by

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

                                  @poVoq

                                  Standard XMMP protocol does not allow to register a custom push server? If so it was poorly designed for a federated protocol...

                                  I am no expert on the topic, but I think while you can of course register a custom push server from the client, UT's push implementation is significantly different from FCM or Apple's one that you would still need a custom proxy server.

                                  Fairphone 5 (Not yet installed UT on it though)

                                  1 Reply Last reply Reply Quote 0
                                  • ? Offline
                                    A Former User
                                    last edited by

                                    I'm ready with compiling, but now the app don't start.
                                    Launching app
                                    terminate called after throwing an instance of 'std::runtime_error'
                                    what(): Lost our connection with the registry
                                    -bash: line 1: 112884 Aborted
                                    lomiri-app-launch conversejs.wilson101_conversejs_1.5.7
                                    Started: conversejs.wilson101_conversejs_1.5.7
                                    ADB_COMMAND_FAILED

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

                                      @wilson101

                                      I see your project is a Rust project, honestly I don't know how it should work with Rust + Qt, because Rust is not an officially supported language for Qt. There might be problems when linking a C++ Qml module in a Rust project. This is beyond my scope, sorry.

                                      ? 1 Reply Last reply Reply Quote 0
                                      • ? Offline
                                        A Former User @pparent
                                        last edited by

                                        @pparent I will try to rewrite the rust code in C++. Then it should work right?

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

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

                                          @pparent I will try to rewrite the rust code in C++. Then it should work right?

                                          Well sure I don't see why it would not work, it works perfect in whatsweb, which is a webapp just as yours.

                                          Make sure that the compiled QML module gets included.

                                          ? 1 Reply Last reply Reply Quote 0
                                          • ? Offline
                                            A Former User @pparent
                                            last edited by

                                            @pparent The problem is that I need to implement web server in C++ and I am very confused of this combination of qml and other languages. I don't know how to do it. Most likely I will give up.

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

                                              @wilson101

                                              OK sure do as you prefer! 😉

                                              The last thing I can say is that normally you must have the compiled module in your application in qml-plugins/Pparent/Notifications/libNotificationsPlugin.so and qml-plugins/Pparent/Notifications/qmldir

                                              Then you can include the qml module dir in c++ with

                                              QQmlApplicationEngine engine;
                                              engine.addImportPath("qml-plugins");
                                              

                                              That's all I can say! I wish you good luck!

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