Cordova Slack Digest

Fri, 27 Aug 2021 08:25:22 GMT

User count: 4598

Join the conversation at slack.cordova.io

Channel #general (49 messages)


Thu, 26 Aug 2021 12:28:15 GMT

@trinitiwowka says

HI!

Thu, 26 Aug 2021 12:28:29 GMT

@trinitiwowka says

I upgraded from cordova-android 8 to 10.1 and for the third day I can’t get the app to work. I get an error: “System UI isn’t responding” Google chrome remote debugger : “deviceready has not fired after 5 seconds. Channel not fired: onPluginsReady Channel not fired: onCordovaReady” Added a delay. the error does not appear immediately, but appears after 60 seconds. What are the options for solving the problem? Thanks.

Thu, 26 Aug 2021 14:11:34 GMT

@israr.rizvi22 says

hi i urgently need to convert a website into an app

Thu, 26 Aug 2021 14:11:59 GMT

@israr.rizvi22 says

but I am facing some difficulties setting it up

Thu, 26 Aug 2021 14:21:58 GMT

@israr.rizvi22 says

more specifically it shows that i have android target not installed

Thu, 26 Aug 2021 16:53:51 GMT

@jac.darby says

does anyone know what changed in cordova ios 6+ for cookies - our express passport registration works for the app if it’s built on 5.1.1.

Thu, 26 Aug 2021 17:03:46 GMT

@norman137 says

not 6+ specific change, but cookies work horribly under wkwebview. I don't use cookies in my apps, but I think the current workaround is to proxy all network requests to native land instead of relying on the WKWebView network implementation.

Mileage may vary, but I think https://github.com/GEDYSIntraWare/cordova-plugin-webview-proxy is one plugin that does this.

Thu, 26 Aug 2021 18:05:09 GMT

@jac.darby says

I tried this, you just wrap the url in it before calling fetch?

Thu, 26 Aug 2021 18:05:34 GMT

@jac.darby says

But literally, I can upgrade and downgrade cordova-ios between 6 and 5 and it affects our sign in

Thu, 26 Aug 2021 18:05:42 GMT

@jac.darby says

same xcode, device, etc

Thu, 26 Aug 2021 18:07:42 GMT

@norman137 says

hmm... Are you enabling scheme settings when using 6?

Thu, 26 Aug 2021 18:08:15 GMT

@norman137 says

5 by default also uses the UIWebView

Thu, 26 Aug 2021 18:08:38 GMT

@jac.darby says

yes - i admit i’m not fully understanding what they are - I’ve tried changing the domain to our api’s, to localhost and i saw a github issue where it was left blank

Thu, 26 Aug 2021 18:08:51 GMT

@norman137 says

which I think didn't have cookie issues... at least I rarely saw people report cookie issues against UIWebView

Thu, 26 Aug 2021 18:08:54 GMT

@jac.darby says

can 5 use UIwebview on ios 14?

Thu, 26 Aug 2021 18:09:12 GMT

@norman137 says

no, apple forbids you from using UIWebView, if you intend on distirbuting to the app store

Thu, 26 Aug 2021 18:09:32 GMT

@norman137 says

Which is hwy cordova-ios@6 uses WKWebView by default now

Thu, 26 Aug 2021 18:09:33 GMT

@jac.darby says

Ah, but it’s still included for backwards compatability of course

Thu, 26 Aug 2021 18:09:53 GMT

@jac.darby says

is there a way to force 6 to use uiwebview, just to test if that is the issue?

Thu, 26 Aug 2021 18:10:03 GMT

@norman137 says

5 used UIWebView byd efault since that's what it always used, and you could opt into the WKWebView plugin

Thu, 26 Aug 2021 18:10:14 GMT

@norman137 says

6 removes all UIWebView code

Thu, 26 Aug 2021 18:10:15 GMT

@norman137 says

No

Thu, 26 Aug 2021 18:10:16 GMT

@norman137 says

But

Thu, 26 Aug 2021 18:10:18 GMT

@norman137 says

You can use 5.1

Thu, 26 Aug 2021 18:10:35 GMT

@norman137 says

One sec... I'll find the blog post, where we had a temporary workaround for users

Thu, 26 Aug 2021 18:11:02 GMT

@norman137 says

Apple literally scans your binary code for UIWebView references which is why the UIWebView code had to be physically removed.

Thu, 26 Aug 2021 18:12:00 GMT

@jac.darby says

thanks - i’ve tried searching for stuff, but i’m actually awful at google

Thu, 26 Aug 2021 18:12:18 GMT

@norman137 says

https://cordova.apache.org/howto/2020/03/18/wkwebviewonly.html

Thu, 26 Aug 2021 18:12:30 GMT

@norman137 says

if you install 5.1.1 (5.1.0 had a bug)

Thu, 26 Aug 2021 18:13:24 GMT

@norman137 says

You can use https://github.com/apache/cordova-plugin-wkwebview-engine plugin with the example config in the blog post to run cordova-ios@5 with wkwebview

Thu, 26 Aug 2021 18:15:21 GMT

@jac.darby says

ok thats really helpful thanks

Thu, 26 Aug 2021 18:15:53 GMT

@jac.darby says

just wondering do you have any recommendations for passport to work well with cordova/ios14?

Thu, 26 Aug 2021 18:15:58 GMT

@norman137 says

Lots of people do complain about cookies on WKWebView... tbh I‘m not 100% sure on the details surrounding why cookies don’t work well. All I know is that cookies are handled differentl in WKWebView and I think the problem is that it's not handled synchronously, with no way to know when cookies are actually available/synced.

So the server could set the cookies header but it doesn't mean the cookie value actually syncs with the webview.

Thu, 26 Aug 2021 18:18:47 GMT

@jac.darby says

ok cool

Thu, 26 Aug 2021 18:18:52 GMT

@jac.darby says

thanks big help

Thu, 26 Aug 2021 18:19:27 GMT

@norman137 says

In my apps, I use JWT for authentication, and the access token are stored locally on the device using non-browser storage mechanisms (e.g... simply a json file written/read using cordova-plugin-file)

Thu, 26 Aug 2021 18:20:04 GMT

@jac.darby says

thats actually worth considering

Thu, 26 Aug 2021 18:20:36 GMT

@norman137 says

JWT token is then passed through an HTTP header on all apis that requires authentication

Thu, 26 Aug 2021 18:20:40 GMT

@jac.darby says

Though at the moment the current solution worked (well did I guess) on both web and cordova

Thu, 26 Aug 2021 18:20:50 GMT

@jac.darby says

with very little platform specific code

Thu, 26 Aug 2021 18:21:04 GMT

@norman137 says

yah -- well I kinda have my own framework that handles

Thu, 26 Aug 2021 18:21:53 GMT

@norman137 says

Have astorage strategy thing that goes on... so generically the application doesn't know how things are store.d.. on cordova apps it uses an implementation that uses cordova-plugin-file... on our web portal it uses a different implementation that simply uses local storage or session storage... depending if theuser clicked on the “remember me” box

Thu, 26 Aug 2021 18:24:04 GMT

@norman137 says

It's a bit more work than the old traditional cookie method -- but cookies are constantly under attack for privacy concerns (even though you can do most of the same stuff with local storage...) and Apple is also essentially killing cookies with their ITP (Intelligent Tracking Preventation) stuff

Thu, 26 Aug 2021 18:25:58 GMT

@norman137 says

A previous solution too... but idk if it works on cordova-ios@6 was https://www.npmjs.com/package/cordova-plugin-wkwebview-inject-cookie and that links to a SO post on why cookies doesn't work as expected on WKWebView... https://stackoverflow.com/questions/26573137/can-i-set-the-cookies-to-be-used-by-a-wkwebview/49534854#49534854

Basically I guess you need to manually set cookies before you initialize the webview -- and well that's kinda hard to do dynamically in a hybrid app wher eoy need the webview to run your application code

Thu, 26 Aug 2021 18:31:08 GMT

@jac.darby says

thanks you’ve stopped me hitting my head against a wall

Thu, 26 Aug 2021 18:41:20 GMT

@zach657 says

I just posted in <#C09EYAJTD|testing> and now see that there are only 57 people in that channel.

I would like to get the following question in front of the right audience: https://cordova.slack.com/archives/C09EYAJTD/p1630001589006100

Thu, 26 Aug 2021 18:41:47 GMT

@norman137 says

I didn't even know that channel existed.

Thu, 26 Aug 2021 18:43:17 GMT

@norman137 says

cordova-paramedic is not exactly abandoned.... it's the primary tool used by Apache Cordova repos for CI builds & testing but uhh -- it definitely needs work.

Thu, 26 Aug 2021 19:30:12 GMT

@jcesarmobile says

If you found cookie issues report them to Apple because they say there are no cookie issues on WKWebView

Channel #asia (2 messages)


Fri, 27 Aug 2021 06:37:47 GMT

@saurabhbehra5 says

Hey

Fri, 27 Aug 2021 06:39:45 GMT

@saurabhbehra5 says

can anyone explain how to use cordova plugins in cordova SPA ?

Channel #testing (36 messages)


Thu, 26 Aug 2021 18:13:09 GMT

@zach657 says

I’ve only recently discovered cordova-paramedic https://github.com/apache/cordova-paramedic as a testing tool for plugin development. This tool is amazing and I believe is going to change our efficiency of plugin development. Specifically when a new SDK (or cordova-&lt;platform&gt;) is released.

My concern is that it seems abandoned. I had to fork and make several changes to introduce support for cordova-android@10 Is there a replacement for cordova-paramedic ? Or can I get some help to incorporate the changes needed for cordova-android@10 into this main repo?

Thu, 26 Aug 2021 18:35:53 GMT

@zach657 says

This is one PR that I just opened. https://github.com/apache/cordova-paramedic/pull/214

It specifically solves one problem. However there is at least one more change that is needed for running cordova-paramedic --platform android@10.1.0 --plugin cordova-plugin-statusbar to succeed.

One other change required is: Allowing insecure (HTTP) is necessary for cordova-paramedic to work, because the https://github.com/apache/cordova-plugin-test-framework|cordova-plugin-test-framework scripts running in the cordova environment, need to post (HTTP PUT) test results to the local server of cordova-paramedic, awaiting the results.

Thu, 26 Aug 2021 18:44:06 GMT

@dpogue says

Paramedic was meant as a CI test runner for the official Apache-maintained plugins, but flaky tests and a decrease in active contributors have led to it mostly being unmaintained. I‘m not sure how much stuff is still using it, and I personally don’t have any experience with it.

However it is great that you‘re finding it useful, and getting it updated to work with android@10 seems like something we’d want to support

Thu, 26 Aug 2021 18:44:27 GMT

@dpogue says

The PR about the emulator paths looks good to me

Thu, 26 Aug 2021 18:46:17 GMT

@zach657 says

There is a second part for getting cordova-android@10 working with cordova-paramedic and that is the Allowing insecure (HTTP) so that the test results can be posted back to the local server.

Thu, 26 Aug 2021 18:49:12 GMT

@zach657 says

I achieved this by forking cordova-app-hello-world and allowing insecure. Then updating cordova-paramedic to reference my fork

https://github.com/SwitchCaseGroup/cordova-paramedic/commit/996951d3e455d91c9439951d2c3f1a96ef927de2

https://github.com/apache/cordova-app-hello-world/compare/master...SwitchCaseGroup:allow-http-for-posting-status

Thu, 26 Aug 2021 18:49:40 GMT

@zach657 says

(sorry for all the commits) I’ll squash before opening the PR

Thu, 26 Aug 2021 18:50:32 GMT

@norman137 says

I think this is the template used for creating new cordova projects... I don‘t think it’s a good idea having the clear text traffic enabled by default here

Thu, 26 Aug 2021 18:50:52 GMT

@norman137 says

I think the tests should probably define an alternate template

Thu, 26 Aug 2021 18:50:52 GMT

@zach657 says

I agree

Thu, 26 Aug 2021 18:51:11 GMT

@dpogue says

It should be possible to inject that cleartext option via edit-config in config.xml

Thu, 26 Aug 2021 18:51:19 GMT

@zach657 says

These questions are why I wanted to have a slack conversation before opening the PR

Thu, 26 Aug 2021 18:51:29 GMT

@zach657 says

In which edit-config?

Thu, 26 Aug 2021 18:51:49 GMT

@zach657 says

oh .. of the test plugin?

Thu, 26 Aug 2021 18:52:13 GMT

@dpogue says

As I said, I know very little about how paramedic actually works... I'm guessing it creates a Cordova app from the default template, installs plugins into it, and then paramedic coordinates launching that app in the simulators for tests to run?

Thu, 26 Aug 2021 18:52:23 GMT

@zach657 says

So add a edit-config to every one of these per plugin? https://github.com/SwitchCaseGroup/cordova-plugin-statusbar/blob/master/tests/plugin.xml

Thu, 26 Aug 2021 18:53:52 GMT

@zach657 says

eg

index c78ea36..4dfc5d2 100644
--- a/tests/plugin.xml
+++ b/tests/plugin.xml
@@ -28,4 +28,12 @@
 
     &lt;js-module src="tests.js" name="tests"&gt;
     &lt;/js-module&gt;
+
+    &lt;platform name="android"&gt;
+       &lt;preference name="AndroidInsecureFileModeEnabled" value="true" /&gt;
+       &lt;edit-config xmlns:android="<http://schemas.android.com/apk/res/android>" file="AndroidManifest.xml" mode="merge" target="/manifest/application"&gt;
+          &lt;application android:usesCleartextTraffic="true" /&gt;
+       &lt;/edit-config&gt;
+       &lt;allow-intent href="market:*" /&gt;
+    &lt;/platform&gt;
 &lt;/plugin&gt;```

Thu, 26 Aug 2021 18:54:01 GMT

@norman137 says

https://github.com/apache/cordova-plugin-test-framework/blob/master/plugin.xml

Thu, 26 Aug 2021 18:54:20 GMT

@norman137 says

I think it can be added in the cordova-plugin-test-framework... but not 100% sure

Thu, 26 Aug 2021 18:54:37 GMT

@zach657 says

I’ll look there. that looks like it will work and better in the one place

Thu, 26 Aug 2021 18:54:54 GMT

@norman137 says

I believe this is a plugin that gets added as part of the test app that the CI generates

Thu, 26 Aug 2021 18:56:10 GMT

@zach657 says

I’ll migrate my changes to there and share the results

Thu, 26 Aug 2021 18:57:55 GMT

@zach657 says

I do have a few questions regrading maintenance of these repos. They seem to be way behind on their NPM publishing, so in the repo, they switched to github references eg https://github.com/apache/cordova-paramedic/commit/5465099f23cec4d2e64e10f5cc23794e4b289e92

I’m sure that is causing a lot of confusion. (it did for me) Is there a reason that the NPM publishing stopped?

Thu, 26 Aug 2021 18:58:14 GMT

@norman137 says

personally I want to replace paramedic 😁 -- i had a karmajs system proof of concept setup... but still in private repositories -- created a cordova plugin for karma where it created a cordova project, installed plugin(s) that is required for testing, then launches an emulator in headless mode to launch the app and runs the tests in the test runner if your choice.

Kinda abandoned the project cause I got busy with other stuff but I feel like it has potential

Thu, 26 Aug 2021 18:59:05 GMT

@norman137 says

a lot of “internal” packages aren't published to npm anymore...

Thu, 26 Aug 2021 19:00:36 GMT

@dpogue says

One aspect is that we wanted paramedic to be running against current dev work to catch issues early, rather than not finding stuff until after a release

Thu, 26 Aug 2021 19:00:57 GMT

@zach657 says

Well paramedic really looks like it checks a lot of boxes for me. So I’m going to keep pushing forward with it and will be wanting to contribute back.

Thu, 26 Aug 2021 19:01:30 GMT

@dpogue says

another aspect is that publishing anything involves a somewhat lengthly process and voting on the mailing list, and didn't seem super worthwhile for internal-facing stuff 😅

Thu, 26 Aug 2021 19:02:45 GMT

@zach657 says

I did just notice the time for that, cordova-android@10.1.0 had a really needed bug fix

Thu, 26 Aug 2021 19:03:48 GMT

@zach657 says

While I have your attention. Any advice regarding these actions that run paramedic is appreciated. It is pretty hacked together, but the visibility is valuable to me and I believe can be iterated on / useful to others. https://github.com/SwitchCaseGroup/cordova-plugin-statusbar/actions/runs/1168154209

Thu, 26 Aug 2021 19:05:10 GMT

@zach657 says

It’s just a workflow https://github.com/apache/cordova-plugin-statusbar/compare/master...SwitchCaseGroup:github-actions-ci-tests

Thu, 26 Aug 2021 19:06:11 GMT

@zach657 says

Okay… I’ll work on the edit-config in https://github.com/apache/cordova-plugin-test-framework/blob/master/plugin.xml for now.

Thank you for the help

Thu, 26 Aug 2021 19:06:33 GMT

@norman137 says

Tbh you probably have just as much, or perhaps a bit more knowledge about paramedic than me at this point.

Thu, 26 Aug 2021 19:08:23 GMT

@zach657 says

Ha! Well its awesome and I appreciate your help.

Fri, 27 Aug 2021 04:04:22 GMT

@erisu says

One other person and I had been trying to move cordova-paramedic CI off TravisCI, AppVeyor, & SauseLabs and onto GitHub Actions.

For about a year, we looked at it on and off but always kept getting hit with various issues and as well needed to focus on other areas. The workflow setup that you have is pretty much identical to what I and one other had. Except you had caching and some different emulator options. I tried modifying my workflow to be a bit more in line with yours, but I am getting timeout issues.

We hope to get the paramedic CI passing again so that we can start getting the core plugins CI working as well.

Regards the timeout issue, it happens around the time of running the app.

...
2021-08-27T03:15:51.1681920Z INSTALL SUCCESS
2021-08-27T03:16:03.6321010Z LAUNCH SUCCESS
2021-08-27T03:22:05.3550970Z Error: waitForConnection: Seems like device not connected to local server in 540 secs
2021-08-27T03:22:05.3553560Z Error: waitForConnection: Seems like device not connected to local server in 540 secs
2021-08-27T03:22:05.3556510Z     at Timeout._onTimeout (/Users/runner/work/cordova-paramedic/cordova-paramedic/lib/paramedic.js:454:28)
2021-08-27T03:22:05.3557900Z     at listOnTimeout (node:internal/timers:557:17)
2021-08-27T03:22:05.3558950Z     at processTimers (node:internal/timers:500:7)```
I can get as far as launching but it times out at this point.

We hope to update or replace paramedic with something more stable and less complex.

Fri, 27 Aug 2021 06:11:02 GMT

@erisu says

OK I got paramedic to pass the timeout issue in GH Actions.

To follow inline with what you had:

  • I updated the GH Actions workflow, but slightly different.
  • I added the usesCleartextTraffic that you mentioned above. This actually helped with the timeout, but will investigate in the future how to pass without this.
  • I am using the HTTP scheme while you are using the file scheme. I will be pushing a PR later today.