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

    Send notification locally from QT/C++/QML App.

    Scheduled Pinned Locked Moved App Development
    25 Posts 3 Posters 991 Views 1 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 @lduboeuf
        last edited by pparent

        @lduboeuf

        Thank's

        I've added all the required files:

        https://github.com/pparent76/whatsweb/commit/4be3c40fa6e692b2c6331dff771f169a829634f2

        It does not work any better.....

        Really I don't understand how this can get so insanely complex for something as basic as send a notification... It sure will not help app development on the platform.

        lduboeufL 2 Replies Last reply Reply Quote 0
        • lduboeufL Offline
          lduboeuf @pparent
          last edited by lduboeuf

          @pparent said in Send notification locally from QT/C++/QML App.:

          @lduboeuf

          Thank's

          I've added all the required files:

          https://github.com/pparent76/whatsweb/commit/4be3c40fa6e692b2c6331dff771f169a829634f2

          It does not work any better.....

          Really I don't understand how this can get so insanely complex for something as basic as send a notification... It sure will not help app development on the platform.

          Maybe you will write a HowTo and find that was not so complex later 😉
          The hard part is gathering informations, find the good doc and examples.

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

            @pparent
            Maybe you will need a version bump in your manifest.

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

              @lduboeuf

              No but I mean even with good documentation I don't see any reason why you need to create/edit 10 files, with many possibilities to make a mistake, to send a notification.

              To my mind it should be as simple as something [NOT WORKING EXAMPLES]

              import Lomiri.Notifications 1.0
              
              .....
              LomiriNotify("title","body");
              

              or

              #include <Lomiri/notifications>
              
              .....
              LomiriNotify("title","body");
              

              Possibly changing the apparmor profile, to add a notification profile, but nothing more.

              lduboeufL 1 Reply Last reply Reply Quote 0
              • lduboeufL Offline
                lduboeuf @pparent
                last edited by

                @pparent said in Send notification locally from QT/C++/QML App.:

                @lduboeuf

                No but I mean even with good documentation I don't see any reason why you need to create/edit 10 files, with many possibilities to make a mistake, to send a notification.

                To my mind it should be as simple as something [NOT WORKING EXAMPLES]

                import Lomiri.Notifications 1.0
                
                .....
                LomiriNotify("title","body");
                

                or

                #include <Lomiri/notifications>
                
                .....
                LomiriNotify("title","body");
                

                Possibly changing the apparmor profile, to add a notification profile, but nothing more.

                Yes, just someone who need to do that ^ ^, but we have also the confinement model which makes it more difficult. Hope you will find something that fit our needs.
                Now Qt have made a wrapper for notification, but this doesn't work on our platform yet: https://doc.qt.io/QtApplicationManager/qml-qtapplicationmanager-notification.html#details

                I don't understand well also all that stuff, especially https://gitlab.com/ubports/development/core/lomiri-push-service/-/blob/main/docs/highlevel.txt#L51 , why an app would need to receive a notification? We just want as you said to send a notification
                https://gitlab.com/ubports/development/core/lomiri-push-service/-/blob/main/docs/lowlevel.txt

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

                  @lduboeuf said in Send notification locally from QT/C++/QML App.:

                  why an app would need to receive a notification? We just want as you said to send a notification

                  I guess this is push notifications, I.e the remote server sends a push notifications to an app that is suspended, to wake it up, and have it execute some code, because a new event happened server-side.

                  But in practice, as UT is not a widely spread plateform, I guess very few app devellopers have their Own servers, that can send a push notification, like Facebook, Whatsapp, Signal, Instagram, ect... would do. So it seems to me this thing is a good potential tool, that is not so useful in practice for now, at least not as usefull as sending a basic local notification to the notification panel from the app.

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

                    @lduboeuf said in Send notification locally from QT/C++/QML App.:

                    @pparent
                    Maybe you will need a version bump in your manifest.

                    Done: does not have any effect

                    https://github.com/pparent76/whatsweb/commit/4c959e0ef8fb8b5e8ca6793d7c116531bd5ea497

                    Anyway I think I will stay with LibNotify notifications, and see if I can trigger independently some vibration (Haptic). I will need to see how to connect it to Desktop notifications of the whatsapp webview. But now I will make a pause, because I'm tired of this.

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

                      I actually got it working in a satisfying way form me. 🎉

                      1°) I've been able to have the libNotify notification stay indefinitely (even though not in the system panel), and add haptic feedback (Vibration)

                      2°) I've been able to detect new messages in whatsapp, by detecting a change in the WebView Title, and detecting audio playback. (For now whatsapp does not seem to send desktop notification I don't know why, because I can catch them on other pages without problem. Well even on desktop, desktop notifications from whatsapp seem eratic and unpredictable )

                      I will test it these days in real world use, there probably will be a few tweaks.

                      I've comited everything on my repo:
                      https://github.com/pparent76/whatsweb/tree/master

                      But: If one day we have a way to send UT notifications, that go to the UT panel and does not require to be unconfined it would be ideal.

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

                        For anyone interested I made a small qml module, allowing desktop notifications with haptic feedback (vibration). Once again this is not optimal as the notification does not make its way to the ubuntu touch panel itself, and requires the app to be unconfined, but it is still very usable and usefull.

                        https://github.com/pparent76/UbuntuTouch-qml-notify-module

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

                          Adding dbus authorisation to "org.freedesktop.Notifications" and "com.lomiri.hfd" would solve the confinement problem. Also

                          https://gitlab.com/ubports/development/core/apparmor-easyprof-ubuntu/-/blob/main/data/policygroups/ubuntu/1.2/push-notification-client

                          Also the filtering in this file for Postal is probably buggy as I get

                          [POST] >>   QDBusMessage(type=MethodCall, service="com.lomiri.Postal", path="/com/lomiri/Postal/alefnode_2ewhatsweb", interface="com.lomiri.Postal", member="Post", signature="", contents=("alefnode.whatsweb_whatsweb", "{"notification":{"card":{"actions":["appid://alefnode.whatsweb/whatsweb/current-user-version"],"icon":"/opt/click.ubuntu.com/.click/users/@all/alefnode.whatsweb/icon.png","persist":true,"popup":true,"summary":"Whatsapp test"},"sound":true,"vibrate":true}}") )
                          [POST ERROR]  "An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.483\" (uid=32011 pid=27477 comm=\"/opt/click.ubuntu.com/alefnode.whatsweb/current/bi\" label=\"alefnode.whatsweb_whatsweb_0.2.8 (enforce)\") interface=\"com.lomiri.Postal\" member=\"Post\" error name=\"(unset)\" requested_reply=\"0\" destination=\"com.lomiri.Postal\" (uid=32011 pid=3117 comm=\"/usr/lib/lomiri-push-service/lomiri-push-service \" label=\"unconfined\")"
                          

                          But anyway even unconfined postal does not work for me.

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

                            By the way in this push notifications profile the argument "@{APP_PKGNAME_DBUS}" used to filter Postal service is only used in this profile, and in app prushase (obviously a deprecated one). This is very suspicious.

                            https://gitlab.com/search?search=%40{APP_PKGNAME_DBUS}&nav_source=navbar&project_id=25344238&group_id=4298794&search_code=true&repository_ref=main

                            All the other profile use variable @{APP_ID_DBUS}

                            https://gitlab.com/search?search=%40{APP_ID_DBUS}&nav_source=navbar&project_id=25344238&group_id=4298794&search_code=true&repository_ref=main

                            This is probably a sign that this push-notification has been left abandoned for a while.

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