react-native-roxit-code-scanner 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,138 +1,37 @@
1
- //buildscript {
2
- // repositories {
3
- // google()
4
- // mavenCentral()
5
- // }
6
- //
7
- // dependencies {
8
- // classpath 'com.android.tools.build:gradle:3.5.3'
9
- // }
10
- //}
11
-
12
- //def isNewArchitectureEnabled() {
13
- // return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
14
- //}
15
-
16
1
  apply plugin: 'com.android.library'
17
2
 
18
- //if (isNewArchitectureEnabled()) {
19
- // apply plugin: 'com.facebook.react'
20
- //}
21
-
22
- def getExtOrDefault(name) {
23
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RoxitCodeScanner_' + name]
24
- }
25
-
26
- def getExtOrIntegerDefault(name) {
27
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['RoxitCodeScanner_' + name]).toInteger()
28
- }
3
+ def DEFAULT_COMPILE_SDK_VERSION = 27
4
+ def DEFAULT_BUILD_TOOLS_VERSION = "27.0.3"
5
+ def DEFAULT_MIN_SDK_VERSION = 16
6
+ def DEFAULT_TARGET_SDK_VERSION = 27
29
7
 
30
8
  android {
31
- compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
32
-
33
- defaultConfig {
34
- minSdkVersion getExtOrIntegerDefault('minSdkVersion')
35
- targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
36
- //buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
37
- }
38
- buildTypes {
39
- release {
40
- minifyEnabled false
9
+ compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
10
+ buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
11
+
12
+ defaultConfig {
13
+ minSdkVersion rootProject.hasProperty('minSdkVersion') ? rootProject.minSdkVersion : DEFAULT_MIN_SDK_VERSION
14
+ targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
15
+ versionCode 1
16
+ versionName "1.1"
17
+ }
18
+ lintOptions {
19
+ abortOnError false
41
20
  }
42
- }
43
-
44
- lintOptions {
45
- disable 'GradleCompatible'
46
- }
47
-
48
- compileOptions {
49
- sourceCompatibility JavaVersion.VERSION_1_8
50
- targetCompatibility JavaVersion.VERSION_1_8
51
- }
52
-
53
21
  }
54
22
 
55
- //repositories {
56
- // mavenCentral()
57
- // google()
58
- //
59
- // def found = false
60
- // def defaultDir = null
61
- // def androidSourcesName = 'React Native sources'
62
- //
63
- // if (rootProject.ext.has('reactNativeAndroidRoot')) {
64
- // defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
65
- // } else {
66
- // defaultDir = new File(
67
- // projectDir,
68
- // '/../../../node_modules/react-native/android'
69
- // )
70
- // }
71
- //
72
- // if (defaultDir.exists()) {
73
- // maven {
74
- // url defaultDir.toString()
75
- // name androidSourcesName
76
- // }
77
- //
78
- // logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
79
- // found = true
80
- // } else {
81
- // def parentDir = rootProject.projectDir
82
- //
83
- // 1.upto(5, {
84
- // if (found) return true
85
- // parentDir = parentDir.parentFile
86
- //
87
- // def androidSourcesDir = new File(
88
- // parentDir,
89
- // 'node_modules/react-native'
90
- // )
91
- //
92
- // def androidPrebuiltBinaryDir = new File(
93
- // parentDir,
94
- // 'node_modules/react-native/android'
95
- // )
96
- //
97
- // if (androidPrebuiltBinaryDir.exists()) {
98
- // maven {
99
- // url androidPrebuiltBinaryDir.toString()
100
- // name androidSourcesName
101
- // }
102
- //
103
- // logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
104
- // found = true
105
- // } else if (androidSourcesDir.exists()) {
106
- // maven {
107
- // url androidSourcesDir.toString()
108
- // name androidSourcesName
109
- // }
110
- //
111
- // logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
112
- // found = true
113
- // }
114
- // })
115
- // }
116
- //
117
- // if (!found) {
118
- // throw new GradleException(
119
- // "${project.name}: unable to locate React Native android sources. " +
120
- // "Ensure you have you installed React Native as a dependency in your project and try again."
121
- // )
122
- // }
123
- //}
124
-
23
+ repositories {
24
+ mavenLocal()
25
+ jcenter()
26
+ maven {
27
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
28
+ url "$projectDir/../../../node_modules/react-native/android"
29
+ }
30
+ }
125
31
 
126
32
  dependencies {
127
- //noinspection GradleDynamicVersion
128
- implementation "com.facebook.react:react-native:+"
129
- // From node_modules
33
+ implementation 'androidx.appcompat:appcompat:1.0.0'
34
+ implementation 'com.facebook.react:react-native:+'
35
+ implementation fileTree( dir: "libs", includes: ['*.jar'] )
130
36
  }
131
37
 
132
- //if (isNewArchitectureEnabled()) {
133
- // react {
134
- // jsRootDir = file("../src/")
135
- // libraryName = "RoxitCodeScanner"
136
- // codegenJavaPackageName = "com.roxitcodescanner"
137
- // }
138
- //}
@@ -0,0 +1,138 @@
1
+ //buildscript {
2
+ // repositories {
3
+ // google()
4
+ // mavenCentral()
5
+ // }
6
+ //
7
+ // dependencies {
8
+ // classpath 'com.android.tools.build:gradle:3.5.3'
9
+ // }
10
+ //}
11
+
12
+ //def isNewArchitectureEnabled() {
13
+ // return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
14
+ //}
15
+
16
+ apply plugin: 'com.android.library'
17
+
18
+ //if (isNewArchitectureEnabled()) {
19
+ // apply plugin: 'com.facebook.react'
20
+ //}
21
+
22
+ def getExtOrDefault(name) {
23
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RoxitCodeScanner_' + name]
24
+ }
25
+
26
+ def getExtOrIntegerDefault(name) {
27
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['RoxitCodeScanner_' + name]).toInteger()
28
+ }
29
+
30
+ android {
31
+ compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
32
+
33
+ defaultConfig {
34
+ minSdkVersion getExtOrIntegerDefault('minSdkVersion')
35
+ targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
36
+ //buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
37
+ }
38
+ buildTypes {
39
+ release {
40
+ minifyEnabled false
41
+ }
42
+ }
43
+
44
+ lintOptions {
45
+ disable 'GradleCompatible'
46
+ }
47
+
48
+ compileOptions {
49
+ sourceCompatibility JavaVersion.VERSION_1_8
50
+ targetCompatibility JavaVersion.VERSION_1_8
51
+ }
52
+
53
+ }
54
+
55
+ //repositories {
56
+ // mavenCentral()
57
+ // google()
58
+ //
59
+ // def found = false
60
+ // def defaultDir = null
61
+ // def androidSourcesName = 'React Native sources'
62
+ //
63
+ // if (rootProject.ext.has('reactNativeAndroidRoot')) {
64
+ // defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
65
+ // } else {
66
+ // defaultDir = new File(
67
+ // projectDir,
68
+ // '/../../../node_modules/react-native/android'
69
+ // )
70
+ // }
71
+ //
72
+ // if (defaultDir.exists()) {
73
+ // maven {
74
+ // url defaultDir.toString()
75
+ // name androidSourcesName
76
+ // }
77
+ //
78
+ // logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
79
+ // found = true
80
+ // } else {
81
+ // def parentDir = rootProject.projectDir
82
+ //
83
+ // 1.upto(5, {
84
+ // if (found) return true
85
+ // parentDir = parentDir.parentFile
86
+ //
87
+ // def androidSourcesDir = new File(
88
+ // parentDir,
89
+ // 'node_modules/react-native'
90
+ // )
91
+ //
92
+ // def androidPrebuiltBinaryDir = new File(
93
+ // parentDir,
94
+ // 'node_modules/react-native/android'
95
+ // )
96
+ //
97
+ // if (androidPrebuiltBinaryDir.exists()) {
98
+ // maven {
99
+ // url androidPrebuiltBinaryDir.toString()
100
+ // name androidSourcesName
101
+ // }
102
+ //
103
+ // logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
104
+ // found = true
105
+ // } else if (androidSourcesDir.exists()) {
106
+ // maven {
107
+ // url androidSourcesDir.toString()
108
+ // name androidSourcesName
109
+ // }
110
+ //
111
+ // logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
112
+ // found = true
113
+ // }
114
+ // })
115
+ // }
116
+ //
117
+ // if (!found) {
118
+ // throw new GradleException(
119
+ // "${project.name}: unable to locate React Native android sources. " +
120
+ // "Ensure you have you installed React Native as a dependency in your project and try again."
121
+ // )
122
+ // }
123
+ //}
124
+
125
+
126
+ dependencies {
127
+ //noinspection GradleDynamicVersion
128
+ implementation "com.facebook.react:react-native:+"
129
+ // From node_modules
130
+ }
131
+
132
+ //if (isNewArchitectureEnabled()) {
133
+ // react {
134
+ // jsRootDir = file("../src/")
135
+ // libraryName = "RoxitCodeScanner"
136
+ // codegenJavaPackageName = "com.roxitcodescanner"
137
+ // }
138
+ //}
@@ -28,26 +28,22 @@ public class ScannerReceiver extends BroadcastReceiver {
28
28
  if (intent.getAction().equals("com.xcheng.scanner.action.BARCODE_DECODING_BROADCAST")) {
29
29
  // bundle.putString("barcode", intent.getStringExtra(Intent.EXTRA_TEXT));
30
30
  // Toast.makeText(context, intent.getStringExtra("EXTRA_BARCODE_DECODING_DATA"), 2000).show();
31
- rnApp.getReactNativeHost().getReactInstanceManager()
32
- .getCurrentReactContext()
31
+ reactContext
33
32
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
34
33
  .emit("barcode", intent.getStringExtra("EXTRA_BARCODE_DECODING_DATA"));
35
34
  }
36
35
  if (intent.getAction().equals("android.intent.ACTION_DECODE_DATA")) {
37
- rnApp.getReactNativeHost().getReactInstanceManager()
38
- .getCurrentReactContext()
36
+ reactContext
39
37
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
40
38
  .emit("barcode", intent.getStringExtra("barcode_string"));
41
39
  }
42
40
  if (intent.getAction().equals("scan.rcv.message")) {
43
- rnApp.getReactNativeHost().getReactInstanceManager()
44
- .getCurrentReactContext()
41
+ reactContext
45
42
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
46
43
  .emit("barcode", intent.getStringExtra("barcodeData"));
47
44
  }
48
45
  if (intent.getAction().equals("barcode")) {
49
- rnApp.getReactNativeHost().getReactInstanceManager()
50
- .getCurrentReactContext()
46
+ reactContext
51
47
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
52
48
  .emit("barcode", intent.getStringExtra("barcode"));
53
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-roxit-code-scanner",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Broadcast code scanner receiver",
5
5
  "main": "index.js",
6
6
  "scripts": {