├── .gitignore ├── screenshots └── iphone-x-screenshot.jpg ├── src ├── android │ ├── res │ │ ├── drawable │ │ │ ├── flashlight.png │ │ │ ├── rounded_rectangle.xml │ │ │ ├── torch_active.xml │ │ │ └── torch_inactive.xml │ │ └── layout │ │ │ ├── barcode_capture.xml │ │ │ └── activity_main.xml │ ├── build-extras.gradle │ └── src │ │ └── gmvScanner │ │ ├── BarcodeTrackerFactory.java │ │ ├── BarcodeGraphic.java │ │ ├── BarcodeGraphicTracker.java │ │ ├── CDVAndroidScanner.java │ │ ├── SecondaryActivity.java │ │ ├── ui │ │ └── camera │ │ │ ├── GraphicOverlay.java │ │ │ ├── CameraSourcePreview.java │ │ │ └── CameraSource.java │ │ └── BarcodeCaptureActivity.java └── ios │ ├── cordova-gmv-barcode-scanner.xcworkspace │ ├── xcuserdata │ │ └── forrestmiddleton.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── contents.xcworkspacedata │ ├── CDViOSScanner.h │ ├── CameraViewController.h │ ├── CDViOSScanner.m │ └── CameraViewController.m ├── package.json ├── LICENSE.md ├── README.md ├── plugin.xml └── www └── main.js /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /screenshots/iphone-x-screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insightautos/cordova-gmv-barcode-scanner/HEAD/screenshots/iphone-x-screenshot.jpg -------------------------------------------------------------------------------- /src/android/res/drawable/flashlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insightautos/cordova-gmv-barcode-scanner/HEAD/src/android/res/drawable/flashlight.png -------------------------------------------------------------------------------- /src/ios/cordova-gmv-barcode-scanner.xcworkspace/xcuserdata/forrestmiddleton.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insightautos/cordova-gmv-barcode-scanner/HEAD/src/ios/cordova-gmv-barcode-scanner.xcworkspace/xcuserdata/forrestmiddleton.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /src/android/build-extras.gradle: -------------------------------------------------------------------------------- 1 | ext.postBuildExtras = { 2 | android { 3 | compileOptions { 4 | sourceCompatibility JavaVersion.VERSION_1_7 5 | targetCompatibility JavaVersion.VERSION_1_7 6 | } 7 | allprojects { 8 | compileOptions { 9 | sourceCompatibility = JavaVersion.VERSION_1_7 10 | targetCompatibility = JavaVersion.VERSION_1_7 11 | } 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/ios/cordova-gmv-barcode-scanner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/android/res/drawable/rounded_rectangle.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | -------------------------------------------------------------------------------- /src/android/res/drawable/torch_active.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/android/res/drawable/torch_inactive.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/ios/CDViOSScanner.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDViOSScanner.h 3 | // Dealr, Inc. 4 | // 5 | 6 | #import 7 | 8 | #import 9 | #import 10 | #import "CameraViewController.h" 11 | 12 | 13 | @class UIViewController; 14 | 15 | 16 | @interface CDViOSScanner : CDVPlugin { 17 | 18 | NSString *_callback; 19 | Boolean _scannerOpen; 20 | 21 | } 22 | 23 | 24 | @property (nonatomic, retain) CameraViewController* cameraViewController; 25 | 26 | - (void) startScan:(CDVInvokedUrlCommand *)command; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /src/android/res/layout/barcode_capture.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-gmv-barcode-scanner", 3 | "version": "1.3.0", 4 | "description": "Google Mobile Vision Barcode Scanner Plugin", 5 | "cordova": { 6 | "id": "cordova-gmv-barcode-scanner", 7 | "platforms": [ 8 | "ios" 9 | ] 10 | }, 11 | "keywords": [ 12 | "ecosystem:cordova", 13 | "cordova-ios", 14 | "cordova-android" 15 | ], 16 | "engines": [ 17 | { 18 | "name": "cordova", 19 | "version": ">=3.0.0" 20 | } 21 | ], 22 | "author": "Forrest Middleton", 23 | "license": "MIT", 24 | "main": "index.js", 25 | "scripts": { 26 | "test": "echo \"Error: no test specified\" && exit 1" 27 | }, 28 | "repository": { 29 | "type": "git", 30 | "url": "git+https://forrestmid@github.com/dealrinc/cordova-gmv-barcode-scanner.git" 31 | }, 32 | "bugs": { 33 | "url": "https://github.com/dealrinc/cordova-gmv-barcode-scanner/issues" 34 | }, 35 | "homepage": "https://github.com/dealrinc/cordova-gmv-barcode-scanner#readme" 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Dealr, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/ios/CameraViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016-present Google Inc. All Rights Reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | @import UIKit; 18 | 19 | // View controller demonstraing how to use the barcode detector with the AVFoundation 20 | // video pipeline. 21 | @protocol senddataProtocol 22 | 23 | -(void)closeScanner; 24 | -(void)sendResult:(NSString *)result; 25 | 26 | @end 27 | 28 | @interface CameraViewController : UIViewController 29 | 30 | @property(nonatomic,assign)id delegate; 31 | @property(nonatomic,assign) NSNumber *barcodeFormats; 32 | @property(nonatomic,assign) CGFloat scanAreaWidth; 33 | @property(nonatomic,assign) CGFloat scanAreaHeight; 34 | 35 | @end 36 | 37 | -------------------------------------------------------------------------------- /src/android/src/gmvScanner/BarcodeTrackerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.dealrinc.gmvScanner; 17 | 18 | import android.content.Context; 19 | 20 | import com.dealrinc.gmvScanner.ui.camera.GraphicOverlay; 21 | import com.google.android.gms.vision.MultiProcessor; 22 | import com.google.android.gms.vision.Tracker; 23 | import com.google.android.gms.vision.barcode.Barcode; 24 | 25 | /** 26 | * Factory for creating a tracker and associated graphic to be associated with a new barcode. The 27 | * multi-processor uses this factory to create barcode trackers as needed -- one for each barcode. 28 | */ 29 | class BarcodeTrackerFactory implements MultiProcessor.Factory { 30 | private GraphicOverlay mGraphicOverlay; 31 | private Context mContext; 32 | 33 | public BarcodeTrackerFactory(GraphicOverlay mGraphicOverlay, 34 | Context mContext) { 35 | this.mGraphicOverlay = mGraphicOverlay; 36 | this.mContext = mContext; 37 | } 38 | 39 | @Override 40 | public Tracker create(Barcode barcode) { 41 | BarcodeGraphic graphic = new BarcodeGraphic(mGraphicOverlay); 42 | return new BarcodeGraphicTracker(mGraphicOverlay, graphic, mContext); 43 | } 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/android/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 19 | 20 | 31 | 32 |