Commit 360b0079 authored by Chok's avatar Chok
Browse files

chok: 8.1.0 commit

parent bf07bdf3
Pipeline #22 failed with stages
# This file is for unifying the coding style of different editors and IDEs.
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.json]
indent_size = 2
# Contributing
We love pull requests from everyone.
[Fork](https://help.github.com/articles/fork-a-repo/), then [clone](https://help.github.com/articles/cloning-a-repository/) the repo:
```
git clone git@github.com:your-username/phonegap-plugin-barcodescanner.git
```
Set up a branch for your feature or bugfix with a link to the original repo:
```
git checkout -b my-awesome-new-feature
git push --set-upstream origin my-awesome-new-feature
git remote add upstream https://github.com/phonegap/phonegap-plugin-barcodescanner.git
```
Set up the project:
```
npm install
```
Make sure the tests pass before changing anything:
```
npm test
```
Make your change. Add tests for your change. Make the tests pass:
```
npm test
```
Commit changes:
```
git commit -m "Cool stuff"
```
Make sure your branch is up to date with the original repo:
```
git fetch upstream
git merge upstream/master
```
Review your changes and any possible conflicts and push to your fork:
```
git push origin
```
[Submit a pull request](https://help.github.com/articles/creating-a-pull-request/).
At this point you're waiting on us. We do our best to keep on top of all the pull requests. We may suggest some changes, improvements or alternatives.
Some things that will increase the chance that your pull request is accepted:
- Write tests.
- Write a [good commit message](http://chris.beams.io/posts/git-commit/).
- Make sure the PR merges cleanly with the latest master.
- Describe your feature/bugfix and why it's needed/important in the pull request description.
## Editor Config
The project uses [.editorconfig](http://editorconfig.org/) to define the coding
style of each file. We recommend that you install the Editor Config extension
for your preferred IDE. Consistency is key.
### Expected Behaviour
### Actual Behaviour
### Reproduce Scenario (including but not limited to)
#### Steps to Reproduce
#### Platform and Version (eg. Android 5.0 or iOS 9.2.1)
#### (Android) What device vendor (e.g. Samsung, HTC, Sony...)
#### Cordova CLI version and cordova platform version
cordova --version
cordova platforms
#### Plugin version
cordova plugin version | grep phonegap-plugin-barcodescanner
#### Sample Code that illustrates the problem
#### Logs taken while reproducing problem
# Configuration for lock-threads - https://github.com/dessant/lock-threads
# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 30
# Issues and pull requests with these labels will not be locked. Set to `[]` to disable
exemptLabels: []
# Label to add before locking, such as `outdated`. Set to `false` to disable
lockLabel: false
# Comment to post before locking. Set to `false` to disable
lockComment: This thread has been automatically locked.
# Limit to only `issues` or `pulls`
# only: issues
# Optionally, specify configuration settings just for `issues` or `pulls`
# issues:
# exemptLabels:
# - help-wanted
# lockLabel: outdated
# pulls:
# daysUntilLock: 30
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 90
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 20
# Issues with these labels will never be considered stale
exemptLabels:
- bug
- docs
- enhancement
- feature
- retest
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
.DS_Store
bin/
.classpath
.project
.idea
*.iml
local.properties
src/windows/lib/.vs
src/windows/lib/bin
src/windows/lib/obj
node_modules
language: node_js
node_js:
- 6
- 8
- 10
branches:
only:
- master
notifications:
slack:
secure: QI+nroFHoaX5vBTtMiJwBt9pYBvFKC8TPwyREEY0yZNjp4+bF/rk7Sj7nNK136m4+nP+wPrAPSC+8jk7jdjRWP2j+CRbnGCSf/29xeDWgXpRUoOGTe8/XWhHlLKwwJ6zm+eB6kwNN3wqrQ+C/9L7gckbj6BCvpp9SwH1q02lpNU=
email:
- PhoneGapCI@adobe.com
This diff is collapsed.
Copyright 2010 Matt Kane
Copyright 2011 IBM Corporation
Copyright 2012-2017 Adobe Systems
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# PhoneGap Plugin BarcodeScanner
================================
[![Build Status](https://travis-ci.org/phonegap/phonegap-plugin-barcodescanner.svg)](https://travis-ci.org/phonegap/phonegap-plugin-barcodescanner)
Cross-platform BarcodeScanner for Cordova / PhoneGap.
Follows the [Cordova Plugin spec](https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html), so that it works with [Plugman](https://github.com/apache/cordova-plugman).
## Installation
This requires phonegap 7.1.0+ ( current stable v8.0.0 )
phonegap plugin add phonegap-plugin-barcodescanner
It is also possible to install via repo url directly ( unstable )
phonegap plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git
Optional variables:
This plugin requires the Android support library v4. The minimum version is `24.1.0`. Default value is `27.+`. Check out the latest version [here](https://developer.android.com/topic/libraries/support-library/revisions.html).
```
phonegap plugin add phonegap-plugin-barcodescanner --variable ANDROID_SUPPORT_V4_VERSION="27.1.1"
```
### Supported Platforms
- Android
- iOS
- Windows (Windows/Windows Phone 8.1 and Windows 10)
- Browser
Note: the Android source for this project includes an Android Library Project.
plugman currently doesn't support Library Project refs, so its been
prebuilt as a jar library. Any updates to the Library Project should be
committed with an updated jar.
Note: Windows 10 applications can not be build for `AnyCPU` architecture, which is default for Windows platform. If you want to build/run Windows 10 app, you should specify target architecture explicitly, for example (Cordova CLI):
```
cordova run windows -- --archs=x86
```
### PhoneGap Build Usage
Add the following to your config.xml:
```
<!-- add a version here, otherwise PGB will use whatever the latest version of the package on npm is -->
<plugin name="phonegap-plugin-barcodescanner" />
```
On PhoneGap Build if you're using a version of cordova-android of 4 or less, ensure you're building with gradle:
```
<preference name="android-build-tool" value="gradle" />
```
## Using the plugin ##
The plugin creates the object `cordova.plugins.barcodeScanner` with the method `scan(success, fail)`.
The following barcode types are currently supported:
| Barcode Type | Android | iOS | Windows |
|---------------|:-------:|:---:|:--------:|
| QR_CODE | ✔ | ✔ | ✔ |
| DATA_MATRIX | ✔ | ✔ | ✔ |
| UPC_A | ✔ | ✔ | ✔ |
| UPC_E | ✔ | ✔ | ✔ |
| EAN_8 | ✔ | ✔ | ✔ |
| EAN_13 | ✔ | ✔ | ✔ |
| CODE_39 | ✔ | ✔ | ✔ |
| CODE_93 | ✔ | ✔ | ✔ |
| CODE_128 | ✔ | ✔ | ✔ |
| CODABAR | ✔ | ✖ | ✔ |
| ITF | ✔ | ✔ | ✔ |
| RSS14 | ✔ | ✖ | ✔ |
| PDF_417 | ✔ | ✔ | ✔ |
| RSS_EXPANDED | ✔ | ✖ | ✖ |
| MSI | ✖ | ✖ | ✔ |
| AZTEC | ✔ | ✔ | ✔ |
`success` and `fail` are callback functions. Success is passed an object with data, type and cancelled properties. Data is the text representation of the barcode data, type is the type of barcode detected and cancelled is whether or not the user cancelled the scan.
A full example could be:
```js
cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
},
{
preferFrontCamera : true, // iOS and Android
showFlipCameraButton : true, // iOS and Android
showTorchButton : true, // iOS and Android
torchOn: true, // Android, launch with the torch switched on (if available)
saveHistory: true, // Android, save scan history (default false)
prompt : "Place a barcode inside the scan area", // Android
resultDisplayDuration: 500, // Android, display scanned text for X ms. 0 suppresses it entirely, default 1500
formats : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED
orientation : "landscape", // Android only (portrait|landscape), default unset so it rotates with the device
disableAnimations : true, // iOS
disableSuccessBeep: false // iOS and Android
}
);
```
## Encoding a Barcode ##
The plugin creates the object `cordova.plugins.barcodeScanner` with the method `encode(type, data, success, fail)`.
Supported encoding types:
* TEXT_TYPE
* EMAIL_TYPE
* PHONE_TYPE
* SMS_TYPE
```
A full example could be:
cordova.plugins.barcodeScanner.encode(cordova.plugins.barcodeScanner.Encode.TEXT_TYPE, "http://www.nytimes.com", function(success) {
alert("encode success: " + success);
}, function(fail) {
alert("encoding failed: " + fail);
}
);
```
## iOS quirks ##
Since iOS 10 it's mandatory to add a `NSCameraUsageDescription` in the `Info.plist`.
`NSCameraUsageDescription` describes the reason that the app accesses the user's camera.
When the system prompts the user to allow access, this string is displayed as part of the dialog box. If you didn't provide the usage description, the app will crash before showing the dialog. Also, Apple will reject apps that access private data but don't provide an usage description.
To add this entry you can use the `edit-config` tag in the `config.xml` like this:
```
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
<string>To scan barcodes</string>
</edit-config>
```
## Windows quirks ##
* Windows implementation currently doesn't support encode functionality.
* On Windows 10 desktop ensure that you have Windows Media Player and Media Feature pack installed.
## Thanks on Github ##
So many -- check out the original [iOS](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/iOS/BarcodeScanner), [Android](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/Android/BarcodeScanner) and
[BlackBerry 10](https://github.com/blackberry/WebWorks-Community-APIs/tree/master/BB10-Cordova/BarcodeScanner) repos.
## Licence ##
The MIT License
Copyright (c) 2010 Matt Kane
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
# Phonegap Plugin Barcodescanner
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin http://dev.silverlakemobility.com/gitlab/cordova-custom/phonegap-plugin-barcodescanner.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](http://dev.silverlakemobility.com/gitlab/cordova-custom/phonegap-plugin-barcodescanner/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
module.exports = function(ctx) {
if (ctx.opts && ctx.opts.platforms && ctx.opts.platforms.indexOf('windows') > -1
&& ctx.opts.options) {
var path = require('path');
var shell = require('shelljs');
var nopt = require('nopt');
// parse and validate args
var args = nopt({
'archs': [String],
'appx': String,
'phone': Boolean,
'win': Boolean,
'bundle': Boolean,
'packageCertificateKeyFile': String,
'packageThumbprint': String,
'publisherId': String,
'buildConfig': String
}, {}, ctx.opts.options.argv, 0);
// Check if --appx flag is passed so that we have a project build version override:
var isWin10 = args.appx && args.appx.toLowerCase() === 'uap';
// Else check "windows-target-version" preference:
if (!isWin10) {
var configXml = shell.ls(path.join(ctx.opts.projectRoot, 'config.xml'))[0];
var reTargetVersion = /<preference\s+name="windows-target-version"\s+value="(.+)"\s*\/>/i;
var targetVersion = shell.grep(reTargetVersion, configXml);
var result = reTargetVersion.exec(targetVersion);
if (result !== null) {
var match = result[1];
isWin10 = parseInt(match.split('.'), 10) > 8;
}
}
// Non-AnyCPU arch is required for Windows 10 (UWP) projects only:
if (isWin10) {
var rawArchs = ctx.opts.options.archs || args.archs;
var archs = rawArchs ? rawArchs.split(' ') : [];
// Avoid "anycpu" arch:
if (archs.length === 0 || archs.some(function (item) {
return item.toLowerCase() === 'anycpu';
})) {
throw new Error('You must specify an architecture to include the proper ZXing library version.'
+ '\nUse \'cordova run windows -- --arch="x64"\' or \'cordova run windows -- --arch="arm" --phone --device\' for example.');
}
}
}
}
{
"name": "phonegap-plugin-barcodescanner",
"version": "8.1.0",
"description": "You can use the BarcodeScanner plugin to scan different types of barcodes (using the device's camera) and get the metadata encoded in them for processing within your application.",
"cordova": {
"id": "phonegap-plugin-barcodescanner",
"platforms": [
"ios",
"android",
"windows",
"browser"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/phonegap/phonegap-plugin-barcodescanner.git"
},
"keywords": [
"ecosystem:cordova",
"ecosystem:phonegap",
"cordova-ios",
"cordova-android",
"cordova-windows",
"cordova-browser",
"cordova:plugin"
],
"engines": {
"cordovaDependencies": {
"<7.0.0": {
"cordova-android": "<6.3.0"
},
"7.0.0": {
"cordova-android": ">=6.3.0"
},
"7.1.0": {
"cordova-android": ">=6.3.0",
"cordova": ">=7.1.0"
},
"8.0.0": {
"cordova-android": ">=6.3.0",
"cordova": ">=7.1.0"
}
}
},
"author": "Adobe PhoneGap Team",
"license": "MIT",
"bugs": {
"url": "https://github.com/phonegap/phonegap-plugin-barcodescanner/issues"
},
"homepage": "https://github.com/phonegap/phonegap-plugin-barcodescanner#readme",
"scripts": {
"test": "jasmine-node --color spec"
},
"devDependencies": {
"pluginpub": "^0.0.9"
},
"dependencies": {
"nopt": "^4.0.1",
"shelljs": "^0.8.3"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:rim="http://www.blackberry.com/ns/widgets" id="phonegap-plugin-barcodescanner" version="8.1.0">
<name>BarcodeScanner</name>
<description>You can use the BarcodeScanner plugin to scan different types of barcodes (using the device's camera) and get the metadata encoded in them for processing within your application.</description>
<license>MIT</license>
<repo>https://github.com/phonegap/phonegap-plugin-barcodescanner</repo>
<issue>https://github.com/phonegap/phonegap-plugin-barcodescanner/issues</issue>
<engines>
<engine name="cordova" version=">=7.1.0"/>
<engine name="cordova-android" version=">=6.3.0"/>
</engines>
<js-module src="www/barcodescanner.js" name="BarcodeScanner">
<clobbers target="cordova.plugins.barcodeScanner"/>
</js-module>
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="BarcodeScanner">
<param name="ios-package" value="CDVBarcodeScanner"/>
</feature>
</config-file>
<resource-file src="src/ios/scannerOverlay.xib"/>
<resource-file src="src/ios/CDVBarcodeScanner.bundle"/>
<source-file src="src/ios/CDVBarcodeScanner.mm"/>
<!-- frameworks -->
<framework src="AVFoundation.framework" />
<framework src="AudioToolbox.framework" />
</platform>
<platform name="android">
<source-file src="src/android/com/phonegap/plugins/barcodescanner/BarcodeScanner.java" target-dir="src/com/phonegap/plugins/barcodescanner"/>
<config-file target="res/xml/config.xml" parent="/*">
<feature name="BarcodeScanner">
<param name="android-package" value="com.phonegap.plugins.barcodescanner.BarcodeScanner"/>
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="com.google.zxing.client.android.CaptureActivity" android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboardHidden|screenSize" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden" android:exported="false"/>
<activity android:name="com.google.zxing.client.android.encode.EncodeActivity" android:label="Share"/>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<uses-feature android:name="android.hardware.camera" android:required="true"/>
</config-file>
<framework src="src/android/barcodescanner.gradle" custom="true" type="gradleReference"/>
<framework src="com.android.support:support-v4:$ANDROID_SUPPORT_V4_VERSION"/>
<lib-file src="src/android/barcodescanner-release-2.1.5.aar"/>
<preference name="ANDROID_SUPPORT_V4_VERSION" default="27.+"/>
</platform>
<platform name="windows">
<js-module src="src/windows/BarcodeScannerProxy.js" name="BarcodeScannerProxy">
<merges target=""/>
</js-module>
<config-file target="package.appxmanifest" parent="/Package/Capabilities">
<DeviceCapability Name="webcam"/>
</config-file>
<framework src="src/windows/lib.UW/x86/ZXing.winmd" target-dir="x86" arch="x86" custom="true" versions=">8.1"/>
<framework src="src/windows/lib.UW/x64/ZXing.winmd" target-dir="x64" arch="x64" custom="true" versions=">8.1"/>
<framework src="src/windows/lib.UW/ARM/ZXing.winmd" target-dir="ARM" arch="ARM" custom="true" versions=">8.1"/>
<framework src="src/windows/lib/WinRTBarcodeReader.csproj" custom="true" type="projectReference" versions="&lt;=8.1"/>
<asset src="src/windows/assets/plugin-barcodeScanner.css" target="css/plugin-barcodeScanner.css"/>
<hook src="hooks/windows/check-arch.js" type="before_compile"/>
<hook src="hooks/windows/check-arch.js" type="before_run"/>
</platform>
<platform name="browser">
<config-file target="config.xml" parent="/*">
<feature name="BarcodeScanner">
<param name="browser-package" value="BarcodeScanner"/>
</feature>
</config-file>
<js-module src="src/browser/BarcodeScannerProxy.js" name="BarcodeScannerProxy">
<runs/>
</js-module>
</platform>
</plugin>
# Customized
local_plugins\phonegap-plugin-barcodescanner\8.1.0\phonegap-plugin-barcodescanner\src\android\barcodescanner.gradle
- Android gradle dependencies 'com.android.support:support-v4:24+'
local_plugins\phonegap-plugin-barcodescanner\8.1.0\phonegap-plugin-barcodescanner\src\ios\CDVBarcodeScanner.mm
- iOS Using fullscreen for UIModalPresentationStyle
==========
- Changes (local_plugins/phonegap-plugin-barcodescanner/8.1.0/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle)
implementation to compile >
compile(name:'barcodescanner-release-2.1.5', ext:'aar')
- to
implementation(name:'barcodescanner-release-2.1.5', ext:'aar')
=========
- Changes (apps/showroom-mb/local_plugins/phonegap-plugin-barcodescanner/8.1.0/phonegap-plugin-barcodescanner/package.json)
Remove "jasmine-node": "1.14.5", from devDependecies to settle npm audit vulnerabilities problem
# Redmine #19928 - Jenn Hong
affected path: showroom-nx/apps/showroom-mb/local_plugins/phonegap-plugin-barcodescanner/8.1.0/phonegap-plugin-barcodescanner/src/windows/lib/Reader.cs
===========
Line 117 - Add logging in catch block for exception event
From -
catch (OperationCanceledException) { }
To -
catch (OperationCanceledException) {
Console.WriteLine("Barcode reading operation was canceled.");
}
===========
# Installation
If your platforms having the existing plugin, remove it first. Make sure platforms & plugins do not have the plugins.
- Remove plugin
cordova plugin rm phonegap-plugin-barcodescanner
- Add plugin
cordova plugin add ./apps/showroom-mb/local_plugins/phonegap-plugin-barcodescanner/8.1.0/phonegap-plugin-barcodescanner
/* global cordova:true */
/*!
* Module dependencies.
*/
/**
* cordova.js for node.
*
* Think of this as cordova-node, which would be simliar to cordova-android
* or cordova-browser. The purpose of this module is to enable testing
* of a plugin's JavaScript interface.
*
* When this module is first required, it will insert a global cordova
* instance, which can hijack cordova-specific commands within the pluin's
* implementation.
*
* Remember to require this module before the plugin that you want to test.
*
* Example:
*
* var cordova = require('./helper/cordova'),
* myPlugin = require('../www/myPlugin');
*/
module.exports = global.cordova = cordova = {
/**
* cordova.require Mock.
*
* Hijacks all cordova.requires. By default, it returns an empty function.
* You can define your own implementation of each required module before
* or after it has been required.
*
* See `cordova.required` to learn how to add your own module implemtnation.
*/
require: function(moduleId) {
// define a default function if it doesn't exist
if (!cordova.required[moduleId]) {
cordova.required[moduleId] = function() {};
}
// create a new module mapping between the module Id and cordova.required.
return new ModuleMap(moduleId);
},
/**
* Cordova module implementations.
*
* A key-value hash, where the key is the module such as 'cordova/exec'
* and the value is the function or object returned.
*
* For example:
*
* var exec = require('cordova/exec');
*
* Will map to:
*
* cordova.required['cordova/exec'];
*/
required: {
// populated at runtime
}
};
/**
* Module Mapper.
*
* Returns a function that when executed will lookup the implementation
* in cordova.required[id].
*
* @param {String} moduleId is the module name/path, such as 'cordova/exec'
* @return {Function}.
*/
function ModuleMap(moduleId) {
return function() {
// lookup and execute the module's mock implementation, passing
// in any parameters that were provided.
return cordova.required[moduleId].apply(this, arguments);
};
}
/* globals require */
/*!
* Module dependencies.
*/
var cordova = require('./helper/cordova'),
BarcodeScanner = require('../www/barcodescanner'),
execSpy,
execWin,
options;
/*!
* Specification.
*/
describe('phonegap-plugin-barcodescanner', function () {
beforeEach(function () {
execWin = jasmine.createSpy();
execSpy = spyOn(cordova.required, 'cordova/exec').andCallFake(execWin);
});
describe('BarcodeScanner', function () {
it("BarcodeScanner plugin should exist", function() {
expect(BarcodeScanner).toBeDefined();
expect(typeof BarcodeScanner == 'object').toBe(true);
});
it("should contain a scan function", function() {
expect(BarcodeScanner.scan).toBeDefined();
expect(typeof BarcodeScanner.scan == 'function').toBe(true);
});
it("should contain an encode function", function() {
expect(BarcodeScanner.encode).toBeDefined();
expect(typeof BarcodeScanner.encode == 'function').toBe(true);
});
it("should contain three DestinationType constants", function() {
expect(BarcodeScanner.Encode.TEXT_TYPE).toBe("TEXT_TYPE");
expect(BarcodeScanner.Encode.EMAIL_TYPE).toBe("EMAIL_TYPE");
expect(BarcodeScanner.Encode.PHONE_TYPE).toBe("PHONE_TYPE");
expect(BarcodeScanner.Encode.SMS_TYPE).toBe("SMS_TYPE");
});
});
describe('BarcodeScanner instance', function () {
describe('cordova.exec', function () {
it('should call cordova.exec on next process tick', function (done) {
BarcodeScanner.scan(function() {}, function() {}, {});
setTimeout(function () {
expect(execSpy).toHaveBeenCalledWith(
jasmine.any(Function),
jasmine.any(Function),
'BarcodeScanner',
'scan',
jasmine.any(Object)
);
done();
}, 100);
});
it('should call cordova.exec on next process tick', function (done) {
BarcodeScanner.encode("", "",function() {}, function() {}, {});
setTimeout(function () {
expect(execSpy).toHaveBeenCalledWith(
jasmine.any(Function),
jasmine.any(Function),
'BarcodeScanner',
'encode',
jasmine.any(Object)
);
done();
}, 100);
});
});
});
});
The Android .aar sources are [here](https://github.com/EddyVerbruggen/barcodescanner-lib-aar).
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment