Cordova Slack Digest

Thu, 25 Feb 2021 08:34:56 GMT

User count: 4381

Join the conversation at slack.cordova.io

Channel #general (39 messages)


Wed, 24 Feb 2021 13:37:38 GMT

@iliya.stambolov says

Hello! I have this weird trouble. When i build my project using npm run build i get cordova is not defined. And the weirdest thing is that it does not happen everytime. But when happens i cannot fix it. I am using a cordova plugin inside my react code. But i am loading my react code on device ready. And i have script src=cordova.js inside index.js

Wed, 24 Feb 2021 13:40:04 GMT

@norman137 says

are you using a bundler like webpack? You might have to configure it to say that cordova is a global variable.

Wed, 24 Feb 2021 13:40:16 GMT

@norman137 says

and not something that is imported.

Wed, 24 Feb 2021 13:40:34 GMT

@iliya.stambolov says

How can i do that ?

Wed, 24 Feb 2021 13:42:06 GMT

@norman137 says

hmmm, well that was something I thought I did but looking at my webpack config I don't do that 😅

Wed, 24 Feb 2021 13:45:05 GMT

@norman137 says

Oh maybe it‘s eslint... if you use eslint you’d have to tell eslint that cordova is a global variable:

		"window": true,
		"cordova": true,
		"StatusBar": true,
                ...
}```

Wed, 24 Feb 2021 13:45:29 GMT

@norman137 says

If you paste that actual error, I might be able to give you a more specific answer.

Wed, 24 Feb 2021 13:48:56 GMT

@iliya.stambolov says

npm run build

> breeze-staff-app@0.1.0 build > node scripts/build.js

node:internal/modules/cjs/loader:928 throw err; ^

Error: Cannot find module ‘cordova’ Require stack:

  • /Users/usr/Desktop/app/CORDOVA/config/webpack.config.js
  • /Users/usr/Desktop/app/CORDOVA/scripts/build.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15) at Function.Module._load (node:internal/modules/cjs/loader:769:27) at Module.require (node:internal/modules/cjs/loader:997:19) at require (node:internal/modules/cjs/helpers:92:18) at Object.<anonymous> (/Users/usr/Desktop/app/CORDOVA/config/webpack.config.js:4:17) at Module._compile (node:internal/modules/cjs/loader:1108:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10) at Module.load (node:internal/modules/cjs/loader:973:32) at Function.Module._load (node:internal/modules/cjs/loader:813:14) at Module.require (node:internal/modules/cjs/loader:997:19) { code: ‘MODULE_NOT_FOUND’, requireStack: [ ‘/Users/usr/Desktop/app/CORDOVA/config/webpack.config.js’, ‘/Users/usr/Desktop/app/CORDOVA/scripts/build.js’ ] } npm run build

> breeze-staff-app@0.1.0 build > node scripts/build.js

Creating an optimized production build... Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db Failed to compile.

./src/pages/TableList.js Line 78:25: ‘cordova’ is not defined no-undef Line 79:25: ‘cordova’ is not defined no-undef

Wed, 24 Feb 2021 13:50:07 GMT

@norman137 says

no-undef does look like a lint error

Wed, 24 Feb 2021 13:50:49 GMT

@iliya.stambolov says

i dont use lint on my project but idk

Wed, 24 Feb 2021 13:51:51 GMT

@norman137 says

eslint has a no-undef rule: https://eslint.org/docs/rules/no-undef

But from the output it's not obvious that is what it is.

Wed, 24 Feb 2021 13:53:47 GMT

@norman137 says

do you use cordova inside webpack.config.js??

Wed, 24 Feb 2021 13:54:01 GMT

@iliya.stambolov says

the problem is that eaven if i do a check cordova && cordova.plugin so i get the build to start, i do not see the plugin in use

Wed, 24 Feb 2021 13:54:30 GMT

@iliya.stambolov says

no i haven`t touched the webpack.config

Wed, 24 Feb 2021 13:54:55 GMT

@iliya.stambolov says

and one more thing i did is i ejected the react app if that is important

Wed, 24 Feb 2021 13:54:59 GMT

@iliya.stambolov says

before building

Wed, 24 Feb 2021 13:58:32 GMT

@norman137 says

so you use the create-react-app to create your app?

Wed, 24 Feb 2021 14:01:53 GMT

@norman137 says

yah.. if you use that, the project it creates will have eslint setup

Wed, 24 Feb 2021 14:02:43 GMT

@norman137 says

if you ejected the react app you'd have:

Wed, 24 Feb 2021 14:03:05 GMT

@norman137 says

    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },```
In your `package.json` file, you'd need to add onto that to declare some globals.

Wed, 24 Feb 2021 14:04:07 GMT

@norman137 says

This is what I have for global settings, but you may not need everything...

		"window": true,
		"cordova": true,
		"StatusBar": true,
		"plugin": true,
		"device": true,
		"document": true,
		"Image": true,
		"Promise": true,
		"XMLSerializer": true,
		"console": true,
		"Blob": true,
		"JL": true,
		"Element": true,
		"alert": true,
		"setTimeout": true,
		"clearTimeout": true,
		"sessionStorage": true,
		"localStorage": true,
		"BuildInfo": true,
		"XMLHttpRequest": true,
		"FileReader": true,
		"FormData": true,
		"FileError": true,
		"FileEntry": true,
		"LocalFileSystem": true,
		"DirectoryEntry": true,
		"process": true
	},```

Wed, 24 Feb 2021 14:04:59 GMT

@norman137 says

The main thing you'll need is cordova, but you may run into some others as well.

Wed, 24 Feb 2021 14:18:39 GMT

@iliya.stambolov says

i added it

Wed, 24 Feb 2021 14:18:45 GMT

@iliya.stambolov says

it doesn`t work

Wed, 24 Feb 2021 14:22:06 GMT

@norman137 says

If you go to ./src/pages/TableList.js and add a line just above Line 78 (where cordova is used) and add // eslint-disable-next-line does this work? e.g:

cordova.blah```

Wed, 24 Feb 2021 14:23:00 GMT

@iliya.stambolov says

last time i did cordova && cordova.plugins. ....

Wed, 24 Feb 2021 14:23:08 GMT

@iliya.stambolov says

and it didn`t use the plugin

Wed, 24 Feb 2021 14:23:12 GMT

@iliya.stambolov says

but i will try it again

Wed, 24 Feb 2021 14:23:23 GMT

@norman137 says

this is a build error though -- not a runtime error.

Wed, 24 Feb 2021 14:24:26 GMT

@iliya.stambolov says

yes

Wed, 24 Feb 2021 15:29:15 GMT

@iliya.stambolov says

I think it worked thx!

Wed, 24 Feb 2021 15:54:01 GMT

@norman137 says

FYI: that was a temp solution to prove it was eslint. You should figure out why the global config wasn't working

Wed, 24 Feb 2021 16:24:55 GMT

@iliya.stambolov says

Gotch ya thx!

Wed, 24 Feb 2021 16:25:17 GMT

@iliya.stambolov says

One more question. Is it possible to trigger local notifications in background process (ios) ?

Wed, 24 Feb 2021 16:28:38 GMT

@norman137 says

From the webview? I don‘t think so, as I’m pretty sure iOS will pause the webview/JS engine while the app is in the background. If you need something to run in the background, I think it requires a plugin that schedules a task. But I'm not 100% confident with this, I could be wrong.

Wed, 24 Feb 2021 16:37:21 GMT

@iliya.stambolov says

Apple has been pretty aggressive since iOS 9 about background processing. You used to get a few minutes to do stuff. However people abused it, drained the batteries and Apple stopped it. That‘s why we don’t have nice things anymore. We‘re aware of code that you can hijack to do background processing. So is Apple, guaranteed to get your app rejected. The solution to this is to use a server side push. That’s what we do, send a remote notification. It's the easiest solution and costs very little. Onesignal is free.

Wed, 24 Feb 2021 16:37:55 GMT

@iliya.stambolov says

i red that inside a issue in one of the cordova local not. plugins repo

Thu, 25 Feb 2021 07:21:45 GMT

@iliya.stambolov says

I made it work with testflight. Hoping will work in appstore.

Thu, 25 Feb 2021 07:46:09 GMT

@abul.asar22 says

Hello everyone, I am trying to use <https://github.com/havesource/cordova-plugin-push> plugin. Since, old plugin is no longer mainted. But on using this plugin I am getting some error. It is failing to install all libraries in config.xml with this error Error: Cannot find module 'xcode' .

Error:

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'xcode'```
Similary, i am getting this error for all plugins. Can anyone help me with this error.

Channel #cordova-ios (1 messages)


Thu, 25 Feb 2021 01:45:49 GMT

@dozer247 says

Hi, Has anyone managed to sync their file to iCloud? I‘m saving a file to the cordova.file.documentsDirectory directory and was hoping to see the files when i use the input=“file” element. But i can’t see the saved files. I'm unsure if i have configured my cordova app correctly. I basically followed https://nemecek.be/blog/6/saving-files-into-users-icloud-drive-using-filemanager to setup icloud. Or is there another way where i can backup some files and restore them later?

Channel #cordova-android (1 messages)


Wed, 24 Feb 2021 22:52:55 GMT

@tomkinson says

We recently had a webview issues that caused a white flash on swipe nav. Wasn‘t there prior..samsung Note 20 Ultra. We backtracked apks months same issue. Although wasn’t there months ago. So...OS likely. Hopefully helpful thread here. It resolved on webview uninstall (only reverts to base version). But how do you get a user to handle so they don't get any bugs, anyone know of a Webview version control or some such standardization to resolve for all versions and devices? For the record; No bug 83.0.4103.106 Bug 88.0.4324.181 https://eu.community.samsung.com/t5/galaxy-note20-series/flickering-in-google-not-anywhere-else/td-p/1976219/page/3|https://eu.community.samsung.com/t5/galaxy-note20-series/flickering-in-google-not-anywhere-else/td-p/1976219/page/3

Channel #plugins (1 messages)


Wed, 24 Feb 2021 16:28:22 GMT

@prasunjajodia says

Hi Guys.. I‘m using cordova-plugin-camera-preview https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview I’m trying to implement pinch to zoom using hammerjs but I can't seem to get the event to trigger when I pinch over the preview. Any suggestions?