Sailfish Share API and Sailfish WebView

I’ll try an Early access target 4.2. from 3.5. I hadn’t had those installed (just got 4.2 running on Volla last week). Might help me get a couple of modern html apps into the store! Thanks!

EDIT: Errr, silly question, I’ve always avoided early access on the phone, in the developer settings. How do I set it up as a developer without touching the phone?

Ok. So I installed 4.2.0.19 and managed to get everything compiled. QT creator says ‘QML module not found (Sailfish.WebView).’ but if I build and send to phone it just works ™. And the app in question, which does not work with the old QTWebView does work with the new! Progress. New apps coming right up…

2 Likes

This depends on exactly what you mean by debugging. You can view the javascript console output in the device console log by setting EMBED_CONSOLE=1, just as with the browser. Or did you mean something more interactive?

1 Like

I can’t seem to make pixelRatio do anything.

I have this inside the WebViewPage:

            Component.onCompleted: {
                WebEngineSettings.pixelRatio = 5
            }

…but web pages look the same as if the setting wasn’t there. Any idea what i might have done wrong?

Also; the link to MDN at the bottom of this page seems to be dead.

Ok, that’s cool. That wasn’t possible with the QT WebView we had till now.

And here is an app demonstrating the new WebView component:

3 Likes

Indeed, code assistance for the Sailfish.WebView package is still missing in the initial release.

It’s probably in place with 3.6?

Unfortunately not, as this relies on bits supplied on the OS side. I.e., it will be fixed for build targets matching some of the future OS releases and it will remain unfixed for 4.2.0.21 build targets even with newer SDK.

Ok, is there any place other than here we should mention that? I just went and ignored the error which ‘just worked’ but might have ‘despaired’ it I didn’t have such a thick skull.

1 Like

Anyone doing a forum search should find this thread quite easily. But if you have any ideas where else that could be mentioned, please let us know.

1 Like

Random, but how long has the share API been part of the OS?
So I can hide it for older OS versions it doesn’t work on

See first post: The Sailfish OS 4.2.0 release …

API’s are sometimes part of the OS before they are official announced and allowed on harbour, like the WebView API which was inside the OS in 4.1 as dev but announced in 4.2…

Hence why I’m I’m asking.

4.2.0 introduced: Sharing system redone

With SDK 3.6.6 I got this message in QTCreator with Webview:

[W] unknown:1283 - file:///usr/lib/qt5/qml/Sailfish/Silica/PageStack.qml:1283:13: QML AnimatedLoader: (file:///usr/share/harbour-ieligweb/qml/pages/SailfishWebviewPage.qml:5:1: module “Sailfish.WebView” is not installed
import Sailfish.WebView 1.0
^)

The lines mention above in .pro and .yaml are added. Any hints? Thx.

And in the SDK installation directory in “mersdk/targets/…/qml/Sailfish/Silica” there is no entry for “WebView”. Is this needed? On the phone there are entries for WebView and Share.

I needed two or three takes to get it installed. I think I did a buildrequires to get the SDK to push it to the target. In any case, just including it in Requires didn’t work ‘the first time’. I should have documented.

@vige Can we have a “How-To for dummies”? Thx.

As stated earlier, code assistance is missing for Sailfish.WebView in the initial release (4.2.0.21 build targets).

You can use Tools > Options > Sailfish OS > Build Engine > Manage Build Targets... > Manage Packages to install sailfish-components-webview-qt5 under your 4.2.0.21 build targets, which will fix the module “Sailfish.WebView” is not installed warning. But still, the code assistance for types provided by that module will not be available.

(If it was a true build-time dependency, the preferred way would be to add it to BuildRequires as @poetaster suggested. But here we are adding it just to make the IDE happy, so it’s not a true build-time dependency. In future build targets it will be preinstalled by default.)

1 Like

I’m sorry but you need to be a bit more specific. How-To for what?