Remove '@remobile/react-native-qrcode-local-image'
This commit is contained in:
@@ -20,8 +20,6 @@ target 'zeus' do
|
||||
|
||||
pod 'react-native-blob-util', :path => '../node_modules/react-native-blob-util'
|
||||
|
||||
pod 'react-native-qrcode-local-image', :path => '../zeus_modules/@remobile/react-native-qrcode-local-image'
|
||||
|
||||
target 'zeusTests' do
|
||||
inherit! :complete
|
||||
# Pods for testing
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
*.[aod]
|
||||
*.DS_Store
|
||||
.DS_Store
|
||||
*Thumbs.db
|
||||
*.iml
|
||||
.gradle
|
||||
.idea
|
||||
node_modules
|
||||
npm-debug.log
|
||||
/android/build
|
||||
/ios/**/*xcuserdata*
|
||||
/ios/**/*xcshareddata*
|
||||
@@ -1,12 +0,0 @@
|
||||
*.DS_Store
|
||||
.DS_Store
|
||||
*Thumbs.db
|
||||
.gradle
|
||||
.idea
|
||||
*.iml
|
||||
npm-debug.log
|
||||
node_modules
|
||||
/android/build
|
||||
/ios/**/*xcuserdata*
|
||||
/ios/**/*xcshareddata*
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015-2016 YunJiang.Fang <42550564@qq.com>
|
||||
|
||||
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.
|
||||
@@ -1,102 +0,0 @@
|
||||
# React Native QRCodeLocalImage (remobile)
|
||||
A local qrcode image parse for react-native, support for ios and android
|
||||
|
||||
## Installation
|
||||
```sh
|
||||
npm install @remobile/react-native-qrcode-local-image --save
|
||||
```
|
||||
### Installation (iOS)
|
||||
* Drag RCTQRCodeLocalImage.xcodeproj to your project on Xcode.
|
||||
* Click on your main project file (the one that represents the .xcodeproj) select Build Phases and drag libRCTQRCodeLocalImage.a from the Products folder inside the RCTQRCodeLocalImage.xcodeproj.
|
||||
* Look for Header Search Paths and make sure it contains $(SRCROOT)/../../../react-native/React as recursive.
|
||||
|
||||
### Installation (Android)
|
||||
```gradle
|
||||
...
|
||||
include ':react-native-qrcode-local-image'
|
||||
project(':react-native-qrcode-local-image').projectDir = new File(settingsDir, '../node_modules/@remobile/react-native-qrcode-local-image/android')
|
||||
```
|
||||
|
||||
* In `android/app/build.gradle`
|
||||
|
||||
```gradle
|
||||
...
|
||||
dependencies {
|
||||
...
|
||||
compile project(':react-native-qrcode-local-image')
|
||||
}
|
||||
```
|
||||
|
||||
* register module (in MainApplication.java)
|
||||
|
||||
```java
|
||||
......
|
||||
import com.remobile.qrcodeLocalImage.RCTQRCodeLocalImagePackage; // <--- import
|
||||
|
||||
......
|
||||
|
||||
@Override
|
||||
protected List<ReactPackage> getPackages() {
|
||||
......
|
||||
new RCTQRCodeLocalImagePackage() // <------ add here
|
||||
......
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Example
|
||||
```js
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var ReactNative = require('react-native');
|
||||
var {
|
||||
StyleSheet,
|
||||
View,
|
||||
Text,
|
||||
} = ReactNative;
|
||||
|
||||
var Button = require('@remobile/react-native-simple-button');
|
||||
var QRCode = require('@remobile/react-native-qrcode-local-image');
|
||||
|
||||
|
||||
module.exports = React.createClass({
|
||||
getInitialState() {
|
||||
return {text: ''}
|
||||
},
|
||||
onPress() {
|
||||
QRCode.decode(!app.isandroid?'/Users/fang/Desktop/qr.png':'/sdcard/qr.png', (error, result)=>{
|
||||
this.setState({text: JSON.stringify({error, result})});
|
||||
});
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Button onPress={this.onPress}>测试</Button>
|
||||
<Text>
|
||||
{this.state.text}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: 'transparent',
|
||||
justifyContent: 'space-around',
|
||||
paddingVertical: 150,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### method
|
||||
- `decode(path, callback)` path canbe local image or url
|
||||
|
||||
|
||||
### see detail use
|
||||
* https://github.com/remobile/react-native-template
|
||||
@@ -1,26 +0,0 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.get('compileSdkVersion')
|
||||
buildToolsVersion rootProject.ext.get('buildToolsVersion')
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion rootProject.ext.get('targetSdkVersion')
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'com.android.support:appcompat-v7:23.0.1'
|
||||
implementation 'com.facebook.react:react-native:+'
|
||||
implementation 'com.google.zxing:core:3.2.0'
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.remobile.qrcodeLocalImage">
|
||||
</manifest>
|
||||
-120
@@ -1,120 +0,0 @@
|
||||
package com.remobile.qrcodeLocalImage;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.util.Base64;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.google.zxing.BinaryBitmap;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.RGBLuminanceSource;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.common.HybridBinarizer;
|
||||
import com.google.zxing.qrcode.QRCodeReader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Hashtable;
|
||||
|
||||
|
||||
public class RCTQRCodeLocalImage extends ReactContextBaseJavaModule {
|
||||
|
||||
private Context context;
|
||||
|
||||
public RCTQRCodeLocalImage(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RCTQRCodeLocalImage";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void decode(String path, Callback callback) {
|
||||
Hashtable<DecodeHintType, String> hints = new Hashtable<DecodeHintType, String>();
|
||||
hints.put(DecodeHintType.CHARACTER_SET, "utf-8"); // 设置二维码内容的编码
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inSampleSize = 4;
|
||||
options.inPreferredConfig = Bitmap.Config.RGB_565;
|
||||
options.inPurgeable = true;
|
||||
|
||||
Bitmap scanBitmap = null;
|
||||
if (path.startsWith("http://")||path.startsWith("https://")) {
|
||||
scanBitmap = getbitmap(path);
|
||||
} else if (path.startsWith("content://")) {
|
||||
try {
|
||||
final Uri imagePath = Uri.parse(path.replace("file://", "").replace("file:/", ""));
|
||||
InputStream inputStream = this.context.getContentResolver().openInputStream(imagePath);
|
||||
if (inputStream != null) {
|
||||
scanBitmap = BitmapFactory.decodeStream(inputStream, null, options);
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
scanBitmap = null;
|
||||
}
|
||||
} else if (path.startsWith("base64://")) {
|
||||
try {
|
||||
byte[] decodedBytes = Base64.decode(path.replace("base64://", ""), 0);
|
||||
scanBitmap = BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.length);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
scanBitmap = null;
|
||||
}
|
||||
} else {
|
||||
scanBitmap = BitmapFactory.decodeFile(path.replace("file://", ""), options);
|
||||
}
|
||||
|
||||
if (scanBitmap == null) {
|
||||
callback.invoke("cannot load image");
|
||||
return;
|
||||
}
|
||||
|
||||
int[] intArray = new int[scanBitmap.getWidth()*scanBitmap.getHeight()];
|
||||
scanBitmap.getPixels(intArray, 0, scanBitmap.getWidth(), 0, 0, scanBitmap.getWidth(), scanBitmap.getHeight());
|
||||
|
||||
RGBLuminanceSource source = new RGBLuminanceSource(scanBitmap.getWidth(), scanBitmap.getHeight(), intArray);
|
||||
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
|
||||
QRCodeReader reader = new QRCodeReader();
|
||||
try {
|
||||
Result result = reader.decode(bitmap, hints);
|
||||
if (result == null) {
|
||||
callback.invoke("image format error");
|
||||
} else {
|
||||
callback.invoke(null, result.toString());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
callback.invoke("decode error");
|
||||
}
|
||||
}
|
||||
|
||||
public static Bitmap getbitmap(String imageUri) {
|
||||
Bitmap bitmap = null;
|
||||
try {
|
||||
URL myFileUrl = new URL(imageUri);
|
||||
HttpURLConnection conn = (HttpURLConnection) myFileUrl.openConnection();
|
||||
conn.setDoInput(true);
|
||||
conn.connect();
|
||||
InputStream is = conn.getInputStream();
|
||||
bitmap = BitmapFactory.decodeStream(is);
|
||||
is.close();
|
||||
} catch (OutOfMemoryError e) {
|
||||
e.printStackTrace();
|
||||
bitmap = null;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
bitmap = null;
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
package com.remobile.qrcodeLocalImage;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
|
||||
public class RCTQRCodeLocalImagePackage implements ReactPackage {
|
||||
@Override
|
||||
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
||||
return Arrays.<NativeModule>asList(
|
||||
new RCTQRCodeLocalImage(reactContext)
|
||||
);
|
||||
}
|
||||
|
||||
public List<Class<? extends JavaScriptModule>> createJSModules() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
||||
return Arrays.<ViewManager>asList();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
const ReactNative = require("react-native");
|
||||
const NativeModules = ReactNative.NativeModules;
|
||||
const QRCodeLocalImage = NativeModules.QRCodeLocalImage;
|
||||
|
||||
const QRCodeReader = {
|
||||
/**
|
||||
* @public
|
||||
* Decode a QR code an call back with results, or errors.
|
||||
*
|
||||
* @param {String} path - An image path to open & search for QR code presence/content.
|
||||
* @param {Function} callback - A callback in form of `(error, results)`.
|
||||
* @return {void}
|
||||
*/
|
||||
decode: function(path, callback) {
|
||||
console.log(NativeModules);
|
||||
QRCodeLocalImage.decode(path, callback);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = QRCodeReader;
|
||||
-260
@@ -1,260 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
32D980E11BE9F11C00FA27E5 /* RCTQRCodeLocalImage.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 32D980E01BE9F11C00FA27E5 /* RCTQRCodeLocalImage.h */; };
|
||||
32D980E31BE9F11C00FA27E5 /* RCTQRCodeLocalImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 32D980E21BE9F11C00FA27E5 /* RCTQRCodeLocalImage.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
32D980DB1BE9F11C00FA27E5 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
32D980E11BE9F11C00FA27E5 /* RCTQRCodeLocalImage.h in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
32D980DD1BE9F11C00FA27E5 /* libRCTQRCodeLocalImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTQRCodeLocalImage.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
32D980E01BE9F11C00FA27E5 /* RCTQRCodeLocalImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTQRCodeLocalImage.h; sourceTree = "<group>"; };
|
||||
32D980E21BE9F11C00FA27E5 /* RCTQRCodeLocalImage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTQRCodeLocalImage.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
32D980DA1BE9F11C00FA27E5 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
32D980D41BE9F11C00FA27E5 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
32D980DF1BE9F11C00FA27E5 /* RCTQRCodeLocalImage */,
|
||||
32D980DE1BE9F11C00FA27E5 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
32D980DE1BE9F11C00FA27E5 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
32D980DD1BE9F11C00FA27E5 /* libRCTQRCodeLocalImage.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
32D980DF1BE9F11C00FA27E5 /* RCTQRCodeLocalImage */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
32D980E01BE9F11C00FA27E5 /* RCTQRCodeLocalImage.h */,
|
||||
32D980E21BE9F11C00FA27E5 /* RCTQRCodeLocalImage.m */,
|
||||
);
|
||||
path = RCTQRCodeLocalImage;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
32D980DC1BE9F11C00FA27E5 /* RCTQRCodeLocalImage */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 32D980F11BE9F11C00FA27E5 /* Build configuration list for PBXNativeTarget "RCTQRCodeLocalImage" */;
|
||||
buildPhases = (
|
||||
32D980D91BE9F11C00FA27E5 /* Sources */,
|
||||
32D980DA1BE9F11C00FA27E5 /* Frameworks */,
|
||||
32D980DB1BE9F11C00FA27E5 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = RCTQRCodeLocalImage;
|
||||
productName = RCTQRCodeLocalImage;
|
||||
productReference = 32D980DD1BE9F11C00FA27E5 /* libRCTQRCodeLocalImage.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
32D980D51BE9F11C00FA27E5 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0640;
|
||||
ORGANIZATIONNAME = remobile;
|
||||
TargetAttributes = {
|
||||
32D980DC1BE9F11C00FA27E5 = {
|
||||
CreatedOnToolsVersion = 6.4;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 32D980D81BE9F11C00FA27E5 /* Build configuration list for PBXProject "RCTQRCodeLocalImage" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 32D980D41BE9F11C00FA27E5;
|
||||
productRefGroup = 32D980DE1BE9F11C00FA27E5 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
32D980DC1BE9F11C00FA27E5 /* RCTQRCodeLocalImage */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
32D980D91BE9F11C00FA27E5 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
32D980E31BE9F11C00FA27E5 /* RCTQRCodeLocalImage.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
32D980EF1BE9F11C00FA27E5 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
32D980F01BE9F11C00FA27E5 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
32D980F21BE9F11C00FA27E5 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
);
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
32D980F31BE9F11C00FA27E5 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
);
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
32D980D81BE9F11C00FA27E5 /* Build configuration list for PBXProject "RCTQRCodeLocalImage" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
32D980EF1BE9F11C00FA27E5 /* Debug */,
|
||||
32D980F01BE9F11C00FA27E5 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
32D980F11BE9F11C00FA27E5 /* Build configuration list for PBXNativeTarget "RCTQRCodeLocalImage" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
32D980F21BE9F11C00FA27E5 /* Debug */,
|
||||
32D980F31BE9F11C00FA27E5 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 32D980D51BE9F11C00FA27E5 /* Project object */;
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
//
|
||||
// RCTQRCodeLocalImage.h
|
||||
// RCTQRCodeLocalImage
|
||||
//
|
||||
// Created by fangyunjiang on 15/11/4.
|
||||
// Copyright (c) 2015年 remobile. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#import <React/RCTBridgeModule.h>
|
||||
|
||||
@interface RCTQRCodeLocalImage : NSObject <RCTBridgeModule>
|
||||
|
||||
@end
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
//
|
||||
// RCTQRCodeLocalImage.m
|
||||
// RCTQRCodeLocalImage
|
||||
//
|
||||
// Created by fangyunjiang on 15/11/4.
|
||||
// Copyright (c) 2015年 remobile. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <React/RCTLog.h>
|
||||
#import <React/RCTUtils.h>
|
||||
#import "RCTQRCodeLocalImage.h"
|
||||
|
||||
@implementation RCTQRCodeLocalImage
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
RCT_EXPORT_METHOD(decode:(NSString *)path callback:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
UIImage *srcImage;
|
||||
if ([path hasPrefix:@"http://"] || [path hasPrefix:@"https://"]) {
|
||||
srcImage = [UIImage imageWithData: [NSData dataWithContentsOfURL:[NSURL URLWithString: path]]];
|
||||
} else {
|
||||
srcImage = [[UIImage alloc] initWithContentsOfFile:path];
|
||||
}
|
||||
if (nil==srcImage){
|
||||
NSLog(@"PROBLEM! IMAGE NOT LOADED\n");
|
||||
callback(@[RCTMakeError(@"IMAGE NOT LOADED!", nil, nil)]);
|
||||
return;
|
||||
}
|
||||
NSLog(@"OK - IMAGE LOADED\n");
|
||||
NSDictionary *detectorOptions = @{@"CIDetectorAccuracy": @"CIDetectorAccuracyHigh"};
|
||||
CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeQRCode context:nil options:detectorOptions];
|
||||
CIImage *image = [CIImage imageWithCGImage:srcImage.CGImage];
|
||||
NSArray *features = [detector featuresInImage:image];
|
||||
if (0==features.count) {
|
||||
NSLog(@"PROBLEM! Feature size is zero!\n");
|
||||
callback(@[RCTMakeError(@"Feature size is zero!", nil, nil)]);
|
||||
return;
|
||||
}
|
||||
|
||||
CIQRCodeFeature *feature = [features firstObject];
|
||||
|
||||
NSString *result = feature.messageString;
|
||||
NSLog(@"result: %@", result);
|
||||
|
||||
if (result) {
|
||||
callback(@[[NSNull null], result]);
|
||||
} else {
|
||||
callback(@[RCTMakeError(@"QR Parse failed!", nil, nil)]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@end
|
||||
@@ -1,81 +0,0 @@
|
||||
{
|
||||
"name": "@remobile/react-native-qrcode-local-image",
|
||||
"version": "1.0.4",
|
||||
"qrcode-local-imagecription": "A local qrcode image parse for react-native",
|
||||
"main": "index.js",
|
||||
"author": {
|
||||
"name": "YunJiang.Fang",
|
||||
"email": "42550564@qq.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
"react-component",
|
||||
"ios",
|
||||
"android",
|
||||
"qrcode",
|
||||
"local-image",
|
||||
"remobile",
|
||||
"mobile"
|
||||
],
|
||||
"homepage": "https://github.com/remobile/react-native-qrcode-local-image",
|
||||
"bugs": {
|
||||
"url": "https://github.com/remobile/react-native-qrcode-local-image/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/remobile/react-native-qrcode-local-image.git"
|
||||
},
|
||||
"react-native": {
|
||||
"zlib": "browserify-zlib",
|
||||
"console": "console-browserify",
|
||||
"constants": "constants-browserify",
|
||||
"crypto": "react-native-crypto",
|
||||
"dns": "dns.js",
|
||||
"net": "react-native-tcp",
|
||||
"domain": "domain-browser",
|
||||
"http": "@tradle/react-native-http",
|
||||
"https": "https-browserify",
|
||||
"os": "react-native-os",
|
||||
"path": "path-browserify",
|
||||
"querystring": "querystring-es3",
|
||||
"fs": "react-native-level-fs",
|
||||
"_stream_transform": "readable-stream/transform",
|
||||
"_stream_readable": "readable-stream/readable",
|
||||
"_stream_writable": "readable-stream/writable",
|
||||
"_stream_duplex": "readable-stream/duplex",
|
||||
"_stream_passthrough": "readable-stream/passthrough",
|
||||
"dgram": "react-native-udp",
|
||||
"stream": "stream-browserify",
|
||||
"timers": "timers-browserify",
|
||||
"tty": "tty-browserify",
|
||||
"vm": "vm-browserify",
|
||||
"tls": false
|
||||
},
|
||||
"browser": {
|
||||
"zlib": "browserify-zlib",
|
||||
"console": "console-browserify",
|
||||
"constants": "constants-browserify",
|
||||
"crypto": "react-native-crypto",
|
||||
"dns": "dns.js",
|
||||
"net": "react-native-tcp",
|
||||
"domain": "domain-browser",
|
||||
"http": "@tradle/react-native-http",
|
||||
"https": "https-browserify",
|
||||
"os": "react-native-os",
|
||||
"path": "path-browserify",
|
||||
"querystring": "querystring-es3",
|
||||
"fs": "react-native-level-fs",
|
||||
"_stream_transform": "readable-stream/transform",
|
||||
"_stream_readable": "readable-stream/readable",
|
||||
"_stream_writable": "readable-stream/writable",
|
||||
"_stream_duplex": "readable-stream/duplex",
|
||||
"_stream_passthrough": "readable-stream/passthrough",
|
||||
"dgram": "react-native-udp",
|
||||
"stream": "stream-browserify",
|
||||
"timers": "timers-browserify",
|
||||
"tty": "tty-browserify",
|
||||
"vm": "vm-browserify",
|
||||
"tls": false
|
||||
}
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
require 'json'
|
||||
|
||||
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "react-native-qrcode-local-image"
|
||||
s.version = package['version']
|
||||
s.summary = "A local qrcode image parse for react-native, support for ios and android"
|
||||
|
||||
s.authors = { "YunJiang.Fang" => "42550564@qq.com" }
|
||||
s.license = "MIT"
|
||||
s.platform = :ios, "9.0"
|
||||
|
||||
s.source_files = "ios/**/*.{h,m}"
|
||||
s.homepage = 'https://'
|
||||
s.source = { :path => '.' }
|
||||
s.requires_arc = true
|
||||
s.static_framework = true
|
||||
|
||||
s.dependency 'React'
|
||||
end
|
||||
Reference in New Issue
Block a user