21 Commits
Author SHA1 Message Date
Fil MajandRyan Willoughby f26cde76f5 fix for a java ref 2013-05-29 17:05:16 -07:00
Fil MajandRyan Willoughby 5d452348da full paths for android 2013-05-29 17:05:16 -07:00
Fil MajandRyan Willoughby 4d8646e26d fully qualified paths 2013-05-29 17:05:16 -07:00
Ryan Willoughby cc0f7d82a1 [spec] FIXED IT 2013-05-10 14:04:27 -07:00
Ryan Willoughby f94c6129ae [spec] 2.5.0 2013-04-24 14:58:29 -07:00
Ryan Willoughby 4579d40dc0 [spec] removing a maybe bunk spec 2013-04-24 14:58:29 -07:00
Ryan Willoughby 40849d52d6 [spec] removing filsystem init 2013-04-24 14:58:29 -07:00
Ryan Willoughby 2f7d652587 [spec] more specs 2013-04-24 14:58:29 -07:00
Ryan Willoughby c1d0b47929 [spec] formatting for medic 2013-04-24 14:58:29 -07:00
Ryan Willoughby 381ee1c6ac [spec] app id 2013-04-24 14:58:29 -07:00
Ryan Willoughby 560cecc5b8 [spec] Fixed spec 2013-04-24 14:58:29 -07:00
Ryan Willoughby a0373c766f [spec] app id, title 2013-04-24 14:58:29 -07:00
Ryan Willoughby f9e3d0cffa [spec] fixing spec app 2013-04-24 14:58:29 -07:00
Ryan Willoughby 604ebdf144 [spec] add barcodescanner.js 2013-04-24 14:58:29 -07:00
Ryan Willoughby 7c47973f78 [spec] Initial version of spec 2013-04-24 14:58:28 -07:00
Bob EasterdayandRyan Willoughby 1661cc4387 update BarcodeScanner plugin for 2.5.0+ 2013-04-24 14:58:28 -07:00
Ryan Willoughby 15b5cb9442 Merge pull request #14 from jwark/do_not_copy_to_clipboard
Android: Do not copy the scanned barcode to the clipboard.
2013-04-11 15:49:55 -07:00
Justin Wark 1d8ee5ca8d Do not copy the scanned barcode to the clipboard. 2013-03-26 12:20:55 +11:00
Ryan Willoughby 3c73e21796 Merge pull request #7 from JaysonRaymond/master
Updates for Cordova/PhoneGap's 2.0 plugins
2013-03-05 11:22:50 -08:00
Jayson Raymond c7158af58e readme fix 2013-01-10 15:54:44 -08:00
Jayson Raymond 3f166162a0 Update for Cordova/PhoneGap 2.0 plugins (http://simonmacdonald.blogspot.ca/2012/08/so-you-wanna-write-phonegap-200-android.html) 2013-01-07 15:49:52 -08:00
5 changed files with 43 additions and 29 deletions
+5 -7
View File
@@ -47,8 +47,8 @@ The following barcode types are currently supported:
`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:
```
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
var scanner = window.PhoneGap.require("cordova/plugin/BarcodeScanner");
scanner.scan(
function (result) {
@@ -61,7 +61,7 @@ A full example could be:
alert("Scanning failed: " + error);
}
);
```
## Encoding a Barcode ##
The plugin creates the object `window.plugins.barcodeScanner` with the method `encode(type, data, success, fail)`.
@@ -72,10 +72,9 @@ Supported encoding types:
* PHONE_TYPE
* SMS_TYPE
```
A full example could be:
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
var scanner = window.PhoneGap.require("cordova/plugin/BarcodeScanner");
scanner.encode(BarcodeScanner.Encode.TEXT_TYPE, "http://www.nytimes.com", function(success) {
alert("encode success: " + success);
@@ -83,7 +82,6 @@ A full example could be:
alert("encoding failed: " + fail);
}
);
```
## Thanks on Github ##
@@ -112,4 +110,4 @@ 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.
THE SOFTWARE.
+1 -1
View File
@@ -2,7 +2,7 @@
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.phonegap.plugins.barcodescanner"
version="0.5.3">
version="0.3.1">
<name>BarcodeScanner</name>
+14 -18
View File
@@ -19,39 +19,35 @@
*
*/
var scanner;
describe('cordova.require object should exist', function () {
describe('Plugin object (window.plugins)', function () {
it("should exist", function() {
expect(window.cordova).toBeDefined();
expect(typeof cordova.require == 'function').toBe(true);
expect(window.plugins).toBeDefined();
});
it("BarcodeScanner plugin should exist", function() {
scanner = cordova.require("cordova/plugin/BarcodeScanner")
expect(scanner).toBeDefined();
expect(typeof scanner == 'object').toBe(true);
it("should contain a barcodeScanner object", function() {
expect(window.plugins.barcodeScanner).toBeDefined();
expect(typeof window.plugins.barcodeScanner == 'object').toBe(true);
});
it("should contain a scan function", function() {
expect(scanner.scan).toBeDefined();
expect(typeof scanner.scan == 'function').toBe(true);
expect(window.plugins.barcodeScanner.scan).toBeDefined();
expect(typeof window.plugins.barcodeScanner.scan == 'function').toBe(true);
});
it("should contain an encode function", function() {
expect(scanner.encode).toBeDefined();
expect(typeof scanner.encode == 'function').toBe(true);
expect(window.plugins.barcodeScanner.encode).toBeDefined();
expect(typeof window.plugins.barcodeScanner.encode == 'function').toBe(true);
});
it("should contain three DestinationType constants", function() {
expect(scanner.Encode.TEXT_TYPE).toBe("TEXT_TYPE");
expect(scanner.Encode.EMAIL_TYPE).toBe("EMAIL_TYPE");
expect(scanner.Encode.PHONE_TYPE).toBe("PHONE_TYPE");
expect(scanner.Encode.SMS_TYPE).toBe("SMS_TYPE");
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");
});
/*
it("should call scan successfully", function() {
scanner.scan(function() {}, function() {});
window.plugins.barcodeScanner.scan(function() {}, function() {});
});
*/
});
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "org.apache.cordova.example"
version = "2.0.0">
<name>cordovaExample</name>
<description>
Barcode Scanner Spec
</description>
<author href="http://phonegap.com" email="support@phonegap.com">
Ryan Willoughby - PhoneGap Team
</author>
<gap:preference name="phonegap-version" value="2.5.0" />
<gap:plugin name="BarcodeScanner"/>
</widget>
+3 -3
View File
@@ -7,7 +7,7 @@
*/
cordova.define("cordova/plugin/BarcodeScanner",
PhoneGap.define("cordova/plugin/BarcodeScanner",
function (require, exports, module) {
@@ -54,12 +54,12 @@ cordova.define("cordova/plugin/BarcodeScanner",
}
if (typeof errorCallback != "function") {
console.log("BarcodeScanner.encode failure: failure parameter not a function");
console.log("BarcodeScanner.scan failure: failure parameter not a function");
return
}
if (typeof successCallback != "function") {
console.log("BarcodeScanner.encode failure: success callback parameter must be a function");
console.log("BarcodeScanner.scan failure: success callback parameter must be a function");
return
}