Cordova Slack Digest

Tue, 19 Oct 2021 08:21:16 GMT

User count: 4657

Join the conversation at slack.cordova.io

Channel #general (1 messages)


Tue, 19 Oct 2021 05:40:33 GMT

@ivan.harpley says

Hi, I'm back again with a newbie question: As a general rule, plugins made for browser should work within an Electron build, yeah?

Channel #cordova-ios (4 messages)


Mon, 18 Oct 2021 09:36:54 GMT

@miroslav.vojtus says

Hello all, we are developing cordova-ios app which needs to be integrated with MS Azure OAuth Authorization server. We have setup custom scheme which leads all request to have header Origin set to scheme://localhost. This is not allowed in case of mobile platform request towards Azure. I have confirmed with electron and manual request that removing Origin header solves the problem actuall it is also recommended by Azure at https://login.microsoftonline.com/error?code=9002326.

Is it possible to alter specfic or all request not to add Origin header? Alternatively do you have experience with mobile integration to MS Azure?

Mon, 18 Oct 2021 12:31:41 GMT

@norman137 says

No, the Origin header is added by any CORS-enabled browser and the WKWebView is a CORS-enabled webview. You may need to have a proxy, where you call on your own server, which then forwards the HTTP call to azure.

Or you can escape browser tech by doing the request in native via a cordova plugin instead of using the browser‘s XMLHttpRequest / fetch. Native http calls naturally aren’t bounded by CORS or manipulated by the browser, so you can make a request without specifying the Origin request header.

Mon, 18 Oct 2021 13:00:37 GMT

@miroslav.vojtus says

Thanks for confirming my thoughts. I am keen to go with native CORS disabled call.

Tue, 19 Oct 2021 05:51:59 GMT

@miroslav.vojtus says

I am going to write custom plugin then. I already have one without native impl but now it seems I will write also native 🙂 Question for me is if there is some common approach to unit testing in cordova plugins for iOS? Or should I go the standard way via setting up an xcode project and unit test target in the developed plugins sources?

Channel #cordova-android (3 messages)


Tue, 19 Oct 2021 00:03:33 GMT

@mathewp.94 says

Regarding adaptive icons, is there a need to use different foreground source images for the different icon sizes? I have been testing using a single foreground for all my icons and it seems to work fine but I only have one device to test on.

<resource-file src="res/values/colors.xml" target="/app/src/main/res/values/colors.xml" />

<icon background="@color/background" density="ldpi" foreground="res/icon/android/adaptive-icon-foreground.png" />
<icon background="@color/background" density="mdpi" foreground="res/icon/android/adaptive-icon-foreground.png" />
<icon background="@color/background" density="hdpi" foreground="res/icon/android/adaptive-icon-foreground.png" />
<icon background="@color/background" density="xhdpi" foreground="res/icon/android/adaptive-icon-foreground.png" />
<icon background="@color/background" density="xxhdpi" foreground="res/icon/android/adaptive-icon-foreground.png" />
<icon background="@color/background" density="xxxhdpi" foreground="res/icon/android/adaptive-icon-foreground.png" />```

Tue, 19 Oct 2021 02:09:46 GMT

@mathewp.94 says

Said screw it and got it working with a vector image instead

Tue, 19 Oct 2021 02:09:59 GMT

@mathewp.94 says

Will do a write up on my blog later

Channel #help (1 messages)


Mon, 18 Oct 2021 10:44:10 GMT

@ivan.harpley says

Does anyone have advice on how to get TypeScript typings to work within a Cordova app using Angular? When trying to use let networkConnection = navigator.connection.type I get the following error Property 'connection' does not exist on type 'Navigator'

What's strange though is that within VS code the code hints work (see attached)

The plugin I‘m using is cordova-plugin-network-information... I’ve tried adding the following to /typings/cordova-typings.d.ts but it doesn't change anything:

/// <reference path="../node_modules/cordova-plugin-network-information/types/index.d.ts" />