Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
#15 Android M (6) compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Oct 27, 2015
1 parent f028ec4 commit 82bd97e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
12 changes: 8 additions & 4 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?><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="1.3.0">
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.phonegap.plugins.barcodescanner"
version="1.3.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>
Expand Down Expand Up @@ -293,7 +293,11 @@
<string name="wifi_type_label">Type</string>
</config-file>

<framework src="com.android.support:support-v4:+" />
<!-- This would make the plugin build only with gradle on AB (cordova-android 4),
so to remain compatible with older build targets we're bundling the support lib instead (yuk!)..
this is a different version (newer) than the one in the PushNotification plugin btw.
<framework src="com.android.support:support-v4:+" /-->
<source-file src="src/android/android-support-v4.jar" target-dir="libs/"/>

<framework src="src/android/ignorelinterrors.gradle" custom="true" type="gradleReference"/>

Expand Down
Binary file added src/android/android-support-v4.jar
Binary file not shown.
12 changes: 12 additions & 0 deletions src/ios/CDVBarcodeScanner.mm
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ - (BOOL)shouldAutorotate;
@interface CDVBarcodeScanner : CDVPlugin {}
- (NSString*)isScanNotPossible;
- (void)scan:(CDVInvokedUrlCommand*)command;
- (void)hasCameraPermission:(CDVInvokedUrlCommand*)command;
- (void)requestCameraPermission:(CDVInvokedUrlCommand*)command;
- (void)encode:(CDVInvokedUrlCommand*)command;
- (void)returnSuccess:(NSString*)scannedText format:(NSString*)format cancelled:(BOOL)cancelled flipped:(BOOL)flipped callback:(NSString*)callback;
- (void)returnError:(NSString*)message callback:(NSString*)callback;
Expand Down Expand Up @@ -124,6 +126,16 @@ - (NSString*)isScanNotPossible {
}

//--------------------------------------------------------------------------
- (void)hasCameraPermission:(CDVInvokedUrlCommand*)command {
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:YES];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void)requestCameraPermission:(CDVInvokedUrlCommand*)command {
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void)scan:(CDVInvokedUrlCommand*)command {
CDVbcsProcessor* processor;
NSString* callback;
Expand Down
10 changes: 10 additions & 0 deletions src/wp8/BarcodeScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ public void scan(string options)
});
}

public void hasCameraPermission(string options)
{
DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
}

public void requestCameraPermission(string options)
{
DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
}

public void OnScanFailed(string error)
{
this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, error));
Expand Down

0 comments on commit 82bd97e

Please sign in to comment.