Skip to content

Commit cbf4f73

Browse files
author
build
committed
New version of React Native CaptureSDK
1 parent b261fcc commit cbf4f73

File tree

75 files changed

+2659
-1720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2659
-1720
lines changed

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
yarn.lock
2+
#this us needed for compilation but not for the NPM package itself.
3+
src
4+
.npmrc

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

CHANGELOG.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,37 @@
22

33
This file tracks released versions with the changes made to this project.
44

5+
## Version 1.5.111
6+
7+
### New
8+
9+
- 🚀 React Native CaptureSDK is back to being public 🚀
10+
- Library name is changed back to `react-native-capture`
11+
12+
### Improvements
13+
14+
- Updated `react-native` to support `v0.75.4`.
15+
- Updated `react` to support `v18.3.1`.
16+
- Updated `socketmobile-capturejs` to `v1.3.50`.
17+
- Updated Gradle to support `v8.8` and new version of React Native.
18+
- Updated the [iOS CaptureSDK](https://github.com/SocketMobile/cocoapods-capturesdk) to `v1.9.74`.
19+
- Updated the Android CaptureSDK to `v1.8.21`.
20+
521
## Version 1.5.86
622

723
### New
824

9-
- Added the support of SocketCam C820 or SocketCam C860 custom sized view on Android and iOS that the developer can import from `react-native-capturesdk`.
10-
- Added the `SocketCamViewContainer` component that the developer can import from `react-native-capturesdk`.
25+
- Added the support of SocketCam custom sized view on Android and iOS that the developer can import from `react-native-capture`.
26+
- Added the `SocketCamViewContainer` component that the developer can import from `react-native-capture`.
1127
- `SocketCamViewContainer` handles much of the SocketCam logic, like starting the SocketCam extension on Android, checking whether or not SocketCam is enabled, and setting the trigger type based on a provided value.
12-
- Added the first iteration of `CaptureHelper` that the developer can import from `react-native-capturesdk`.
28+
- Added the first iteration of `CaptureHelper` that the developer can import from `react-native-capture`.
1329
- `CaptureHelper` contains useful functions related to SocketCam for the developer to use so they no longer have to build them from scratch.
1430
- For Android: added a template for providing your own custom view, which includes a layout file to serve as the layout container for `SocketCamFragment`, as well as other Kotlin files specific to the custom view's package, view manager, custom view itself and the associated custom view activity. You can read more about custom views [here](https://docs.socketmobile.com/react-native-capture/en/latest/socketCamCustom.html).
1531
- Updated documentation to include information related to `SocketCamViewContainer`, how to implement custom views for Android and iOS, `CaptureHelper`, and how to enable/disable a symbology.
1632

1733
### Improvements
1834

19-
- Removed any reference of/need for `NativeModules`, `DeviceEventEmitter`, getting whether or not SocketCam is enabled, or setting the SocketCam trigger from the example app.
35+
- Removed any reference of/need for `NativeModules`, `DeviceEventEmitter`, getting whether or not SocketCam is enabled, or setting the SocketCam trigger from the example app.
2036
- Introduction of the`SocketCamViewContainer` component means the previous Native Module logic is now handled exclusively in the React Native CaptureSDK.
2137

2238
## Version 1.5.64

README.md

Lines changed: 55 additions & 331 deletions
Large diffs are not rendered by default.

android/build.gradle

Lines changed: 86 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1,110 @@
1-
// android/build.gradle
2-
3-
// based on:
4-
//
5-
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle
6-
// original location:
7-
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle
8-
//
9-
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle
10-
// original location:
11-
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
12-
13-
def DEFAULT_COMPILE_SDK_VERSION = 28
14-
def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
15-
def DEFAULT_MIN_SDK_VERSION = 16
16-
def DEFAULT_TARGET_SDK_VERSION = 28
17-
18-
def safeExtGet(prop, fallback) {
19-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
20-
}
21-
22-
apply plugin: 'com.android.library'
1+
apply plugin: "com.android.library"
2+
apply plugin: "kotlin-android"
233
apply plugin: 'maven-publish'
244

255
buildscript {
26-
// The Android Gradle plugin is only required when opening the android folder stand-alone.
27-
// This avoids unnecessary downloads and potential conflicts when the library is included as a
28-
// module dependency in an application project.
29-
// ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
30-
if (project == rootProject) {
31-
repositories {
32-
google()
33-
jcenter()
34-
}
35-
dependencies {
36-
classpath 'com.android.tools.build:gradle:4.2.0'
37-
}
38-
}
6+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
7+
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["CaptureSdk_kotlinVersion"]
8+
9+
repositories {
10+
google()
11+
mavenCentral()
12+
}
13+
14+
dependencies {
15+
classpath "com.android.tools.build:gradle:7.2.1"
16+
// noinspection DifferentKotlinGradleVersion
17+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
18+
}
3919
}
4020

41-
apply plugin: 'com.android.library'
42-
apply plugin: 'maven-publish'
21+
def reactNativeArchitectures() {
22+
def value = rootProject.getProperties().get("reactNativeArchitectures")
23+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
24+
}
4325

44-
android {
45-
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
46-
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
47-
defaultConfig {
48-
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
49-
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
50-
versionCode 1
51-
versionName "1.0"
52-
}
53-
lintOptions {
54-
abortOnError false
55-
}
26+
def isNewArchitectureEnabled() {
27+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
5628
}
5729

58-
repositories {
59-
// ref: https://www.baeldung.com/maven-local-repository
60-
maven {
61-
// Android JSC is installed from npm
62-
url "$rootDir/../node_modules/jsc-android/dist"
63-
}
64-
mavenCentral()
65-
google()
66-
jcenter()
30+
if (isNewArchitectureEnabled()) {
31+
apply plugin: "com.facebook.react"
6732
}
6833

69-
dependencies {
70-
//noinspection GradleDynamicVersion
71-
// implementation fileTree(dir: "libs", include: ["*.aar", "*.jar"])
72-
implementation 'com.facebook.react:react-native:+' // From node_modules
73-
implementation 'com.google.zxing:core:3.5.1'
74-
implementation 'com.socketmobile:capture-socketcam:1.7.39'
34+
def getExtOrDefault(name) {
35+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["CaptureSdk_" + name]
7536
}
7637

77-
def configureReactNativePom(def pom) {
78-
def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)
79-
80-
pom.project {
81-
name packageJson.title
82-
artifactId packageJson.name
83-
version = packageJson.version
84-
group = "com.socketmobile"
85-
description packageJson.description
86-
url packageJson.repository.baseUrl
87-
88-
licenses {
89-
license {
90-
name packageJson.license
91-
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
92-
distribution 'repo'
93-
}
94-
}
95-
96-
developers {
97-
developer {
98-
id packageJson.author.username
99-
name packageJson.author.name
100-
}
101-
}
102-
}
38+
def getExtOrIntegerDefault(name) {
39+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["CaptureSdk_" + name]).toInteger()
10340
}
10441

105-
afterEvaluate { project ->
106-
// some Gradle build hooks ref:
107-
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
108-
task androidJavadoc(type: Javadoc) {
109-
configurations.implementation.canBeResolved = true
110-
source = android.sourceSets.main.java.srcDirs
111-
classpath += files(android.bootClasspath)
112-
classpath += files(project.getConfigurations().getByName('implementation').asList())
113-
include '**/*.java'
114-
}
42+
def supportsNamespace() {
43+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
44+
def major = parsed[0].toInteger()
45+
def minor = parsed[1].toInteger()
11546

116-
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
117-
classifier = 'javadoc'
118-
from androidJavadoc.destinationDir
119-
}
47+
// Namespace support was added in 7.3.0
48+
return (major == 7 && minor >= 3) || major >= 8
49+
}
50+
51+
android {
52+
if (supportsNamespace()) {
53+
namespace "com.socketmobile"
12054

121-
task androidSourcesJar(type: Jar) {
122-
classifier = 'sources'
123-
from android.sourceSets.main.java.srcDirs
124-
include '**/*.java'
55+
sourceSets {
56+
main {
57+
manifest.srcFile "src/main/AndroidManifest.xml"
58+
}
12559
}
60+
}
12661

127-
android.libraryVariants.all { variant ->
128-
def name = variant.name.capitalize()
129-
def javaCompileTask = variant.javaCompileProvider.get()
62+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
13063

131-
task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
132-
from javaCompileTask.destinationDir
133-
}
134-
}
64+
defaultConfig {
65+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
66+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
67+
68+
}
13569

136-
artifacts {
137-
archives androidSourcesJar
138-
archives androidJavadocJar
70+
buildTypes {
71+
release {
72+
minifyEnabled false
13973
}
74+
}
14075

141-
task installArchives(type: Upload) {
142-
configuration = configurations.archives
143-
publishing {
144-
repositories {
145-
maven {
146-
url = uri("${rootProject.projectDir}/maven-repo")
147-
}
148-
}
149-
}
76+
lintOptions {
77+
disable "GradleCompatible"
78+
}
79+
80+
compileOptions {
81+
sourceCompatibility JavaVersion.VERSION_1_8
82+
targetCompatibility JavaVersion.VERSION_1_8
83+
}
84+
}
85+
86+
def kotlin_version = getExtOrDefault("kotlinVersion")
87+
88+
allprojects {
89+
repositories {
90+
mavenCentral()
91+
google()
92+
maven {
93+
url "https://bin.socketmobile.com/repo/releases"
15094
}
95+
}
96+
}
97+
98+
dependencies {
99+
// For < 0.71, this will be from the local maven repo
100+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
101+
//noinspection GradleDynamicVersion
102+
implementation "com.facebook.react:react-native:+"
103+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
104+
implementation "com.google.zxing:core:3.5.1"
105+
api "com.socketmobile:capture-socketcam:1.8.21"
151106
}
107+
108+
109+
110+

android/libs/capture-1.6.15.jar

-58 KB
Binary file not shown.
-65.4 KB
Binary file not shown.

android/libs/capture_socketcam.aar

-195 KB
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.socketmobile">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32

43
</manifest>

0 commit comments

Comments
 (0)