UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. ari
    3. Posts
    A
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 13
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: How to port Flutter App

      @javperan yup, looks like the template has changed since.

      Currently, I'd probably change line 360:

      await serviceWorkerLoader.loadServiceWorker(serviceWorker).catch(e => {
      

      to:

      await serviceWorkerLoader.loadServiceWorker(null).catch(e => {
      

      Basically, I'm trying to find the section of the code that checks for the service worker, which is in line 117:

      loadServiceWorker(settings) {
        if (settings == null) {
          // In the future, settings = null -> uninstall service worker?
          console.debug("Null serviceWorker configuration. Skipping.");
          return Promise.resolve();
        }
        ...
      

      Here you can see it checks if 'settings' is null, and seems to handle it gracefully, so any way you can force it to run through that if statement would work fine.

      posted in App Development
      A
      ari
    • RE: WebGL between Clickable Templates

      Unfortunately, what I need is not to append flags, but to remove the existing ones which I can't find any way to do.

      I can do the following in my main.cpp file:

      qDebug() << qgetenv("QTWEBENGINE_CHROMIUM_FLAGS"); 
      qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--anything-i-want");
      

      But the output from the getenv is just "", so I'm not sure where its getting the flags from.

      The addition of the chromium flag is indeed working, but the final command line shown by chrome://gpu is this: (which includes the --disable-gpu at the end)

      webglcpptest --anything-i-want --browser-subprocess-path=/usr/lib/x86_64-linux-gnu/qt5/libexec/QtWebEngineProcess --application-name=webglcpptest.red --no-sandbox --enable-threaded-compositing --disable-speech-api --enable-features=AllowContentInitiatedDataUrlNavigations,NetworkServiceInProcess,TracingServiceInProcess --disable-features=MojoVideoCapture,FontSrcLocalMatching,UseSkiaRenderer,DnsOverHttpsUpgrade,ConsolidatedMovementXY,InstalledApp,BackgroundFetch,SmsReceiver,WebPayments,WebUSB,PictureInPicture --disable-gpu
      

      It doesn't seem possible to override the existing flag with another, I've tried things like --disable-gpu=false and so on, I've tried finding a way to comment out the rest of the flags, even tried a buffer overflow to get rid of the last flag...

      So I have to find where the flags are coming from and remove them.

      posted in App Development
      A
      ari
    • RE: WebGL between Clickable Templates

      @kugiigi Appreciate the help, looks like you were right, sort of...
      Changing the URL to "chrome://gpu" shows the command line used to open chromium which contains "--disable-gpu" at the end.

      Like you said, I am able to add arguments to the command line by adding this line to the main.cpp (proved to be working in "chrome://gpu"):

      qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--ignore-gpu-blacklist");
      

      (btw the ignore flag does nothing)
      But I can't seem to remove the existing arguments...

      I've tried doing a grep -r "disable-gpu" to no avail, and tried printing all environment variables and have found nothing.

      How do I remove the flag!? Where does it come from? Is there anyway to override a flag with another?

      Thank you.

      posted in App Development
      A
      ari
    • WebGL between Clickable Templates

      Skipable preamble: I'm back to trying to port some flutter apps, everything is working fine and I'm ready to publish them, except for one thing: WebGL. My apps are running really slow (yes they are all just local webapps), but if I try them on the morph browser, its suddenly smooth. Well clearly this is the reason:

      webgl_ut_comparison.png

      To test, I've created 3 simple clickable applications using; (from left to right) CPP template, (second is just regular morph browser), GO template and QML Only template.

      I added 'import QtWebEngine 1.10', and pointed them all to the same website with WebEngineView: https://webglreport.com/

      Result: Only the 'QML Only' template has WebGL.

      What can I do to give my C++ apps WebGL? How does Morph do it?

      Appreciate any help. Thank you 🙂

      p.s. I've tried adding 'settings.webGLEnabled: true', doesnt help.

      p.p.s I'm running UT 20.04 OTA-2 on a Pixel 3a

      posted in App Development
      A
      ari
    • How to port Flutter App

      Hello.

      I've just discovered a way to remove the service worker requirement from Flutter Web Applications. Making it much easier to create a simple Flutter Application for Ubuntu Touch.

      Here's a little tutorial for anyone who might want to try it out:

      Compile your flutter application with the following:

      flutter build web --pwa-strategy none
      

      Change the index.html base to:

      <base href="">
      

      Optional: add the following to the body to prevent right click menu on long press

      <body oncontextmenu="return false;">
      

      Then change line 48 of flutter.js to

      return this._loadWithServiceWorker(entrypointUrl, null);
      

      (This will disable the service worker)

      You can test it out with the following:

      brave --allow-file-access-from-files index.html
      

      For Ubuntu Touch:

      Create an HTML clickable app.

      Copy the flutter compiled /web to the clickable www.

      Add the following to the .desktop exec after webapp-container:

      --local-content-can-access-remote-urls
      

      That's it. You now have a super simple app made from flutter, no local server needed. (I wouldn't expect the camera or any phone specific functions to work, but there's still a lot you can do.)

      I've just published an example "Pictionary Generator" to the open store you can try.

      posted in App Development
      A
      ari
    • RE: Matrix Notifications Existential Crisis

      @kugiigi Thanks for the reply.

      Perhaps I should have given a little more context. Matrix (server protocol) has an option for custom push notification apis. What Cinny seems to be doing, is sending the api url to the server, which the matrix server then uses to send the push notifications.

      Evidently UBports realizes this use-case and created an endpoint to accept the matrix-formatted api call. But I cannot find any documentation.

      Does anyone know anything about this?

      Or who specifically to contact?

      posted in App Development
      A
      ari
    • Matrix Notifications Existential Crisis

      I'm attempting to port a matrix client, and trying to add notifications.

      I noticed that cinny (cinny-click-packaging) uses the url "https://push.ubports.com:5003/_matrix/push/v1/notify" (which is awesome btw).

      BUT, I cannot find a single shred of evidence that this api exists anywhere, yet I can see its live and working because it gives me a 400 error when pinging it (also the fact that cinny works).

      I've looked through the documentation, the code for the lomiri-push-service (which I'm guessing is the server implementation), and just googling "ubports" and "matrix" brings up nothing.

      I've also attempted to just steal the cinny code, but its not working for me... And using the regular push notification example code doesnt work for this api (but does for the normal one).

      Am I missing something super obvious? Where is the documentation!?

      posted in App Development
      A
      ari
    • U2F?

      Any support for hardward 2fa keys? FIDO U2F, YubiKey, Google Titan...

      Just heard about a deal on cheap YubiKey, but realised they probably wouldn't work on Ubuntu Touch.

      From my understanding to get it to work, one would need it installed on the OS (libu2f-udev in apt), which might be possible if I make the root read-write.

      But the browser also has to support it, and I have a feeling Morph Browser doesn't.

      Is this in the radar? Is it possible with some tinkering? Or should I just avoid that method of 2fa?

      To be clear I'm interested in using it to log into online accounts, not into the os.

      posted in General
      A
      ari
    • Weird Issue with c++ vs qml Webview

      Ok, I know its likely that this is a bug, that no one here can help with, but I'm not sure where I would submit the bug report, so any hints on that will also be appreciated.

      The camera doesnt work on C++ projects but does with qml only (with the WebEngineView).

      Steps to replicate:

      • Create 'qml only' and 'c++' clickable projects.
      • Change apparmor permissions for both
      • Add WebEngineView to Main.qml of both
      • Point url to site with camera access
      • Discover that: qml project works with camera, c++ doesn't.

      (error seems to show as: "NotReadableError: could not start video source")

      Is this a WebEngineView bug, c++ bug, clickable... Is it a feature!?

      Any help would be greatly appreciated.

      posted in App Development
      A
      ari
    • RE: Camera not working in Webview

      Finally figured it out. Well... kind of.
      The solution is to not use the Webview, but instead WebEngineView, and make sure to include the onFeaturePermissionRequested method.
      In conclusion, just steal the code from the discord app.

      posted in App Development
      A
      ari
    • RE: Camera not working in Webview

      @dobey I'm using the Ubuntu.Web WebView in a clickable qml project. But actually importing "Morph .Web" as... well actually its because you said so.

      posted in App Development
      A
      ari
    • Camera not working in Webview

      Using a webview in QML, testing with sites like: https://webcamtests.com/ the camera does not appear.

      Trying the same site on the regular morph browser works as expected.

      I've already set "camera" as one of the policy_groups.

      What am I missing?

      posted in App Development
      A
      ari