Skip to content

Commit

Permalink
Squashed commit to version 3.15.0
Browse files Browse the repository at this point in the history
commit 44661fc
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Fri Dec 13 15:07:23 2019 -0300

    chore(deps): bump npm from 6.4.1 to 6.13.4 (react-native-camera#2643)

    Bumps [npm](https://github.com/npm/cli) from 6.4.1 to 6.13.4.
    - [Release notes](https://github.com/npm/cli/releases)
    - [Changelog](https://github.com/npm/cli/blob/latest/CHANGELOG.md)
    - [Commits](npm/cli@v6.4.1...v6.13.4)

    Signed-off-by: dependabot[bot] <support@github.com>

commit c235435
Author: semantic-release-bot <semantic-release-bot@martynus.net>
Date:   Fri Dec 13 17:55:53 2019 +0000

    chore(release): 3.15.0 [skip ci]

    # [3.15.0](react-native-camera/react-native-camera@v3.14.0...v3.15.0) (2019-12-13)

    ### Features

    * **ios:** Make camera ready events to fire also on camera/device change to be consistent with Android. Fire unmount error when session or device fails to start. Update advanced example app to use camera ready event instead. ([react-native-camera#2642](react-native-camera#2642)) ([7abf3f7](react-native-camera@7abf3f7))

commit 7abf3f7
Author: cristianoccazinsp <48869228+cristianoccazinsp@users.noreply.github.com>
Date:   Fri Dec 13 14:51:50 2019 -0300

    feat(ios): Make camera ready events to fire also on camera/device change to be consistent with Android. Fire unmount error when session or device fails to start. Update advanced example app to use camera ready event instead. (react-native-camera#2642)

commit 0745fb9
Author: semantic-release-bot <semantic-release-bot@martynus.net>
Date:   Tue Dec 10 14:07:04 2019 +0000

    chore(release): 3.14.0 [skip ci]

    # [3.14.0](react-native-camera/react-native-camera@v3.13.1...v3.14.0) (2019-12-10)

    ### Bug Fixes

    * **android:** Fix Objects.equals that is only available after API 19 ([react-native-camera#2635](react-native-camera#2635)) ([8c6a26f](react-native-camera@8c6a26f))
    * **example:** fixes and updates in mlkit example ([react-native-camera#2618](react-native-camera#2618)) ([72c5624](react-native-camera@72c5624))
    * **ts:** fixed incorrect type definition file path ([react-native-camera#2622](react-native-camera#2622)) ([047bbea](react-native-camera@047bbea))

    ### Features

    * **android:** Load Android Gradle Plugin conditionally ([react-native-camera#2623](react-native-camera#2623)) ([d8cf6c9](react-native-camera@d8cf6c9))
    * **android:** restore state when useCamera2api is enabled ([react-native-camera#2603](react-native-camera#2603)) ([1f8b863](react-native-camera@1f8b863))
    * **docs:** update onBarCodeRead on Android and add additional SubView library ([react-native-camera#2616](react-native-camera#2616)) ([fe84811](react-native-camera@fe84811))
    * **iOS:** allow for audio session to be kept ([react-native-camera#2636](react-native-camera#2636)) ([fe5d11d](react-native-camera@fe5d11d))

commit fe5d11d
Author: cristianoccazinsp <48869228+cristianoccazinsp@users.noreply.github.com>
Date:   Tue Dec 10 11:02:45 2019 -0300

    feat(iOS): allow for audio session to be kept (react-native-camera#2636)

    * allow for audio session to be kept even after unmounts

    * readme typo

commit 8c6a26f
Author: cristianoccazinsp <48869228+cristianoccazinsp@users.noreply.github.com>
Date:   Tue Dec 10 11:02:16 2019 -0300

    fix(android): Fix Objects.equals that is only available after API 19 (react-native-camera#2635)

commit 047bbea
Author: SaeedZhiany <SaeedZhiany@users.noreply.github.com>
Date:   Tue Dec 3 22:40:26 2019 +0330

    fix(ts): fixed incorrect type definition file path (react-native-camera#2622)

commit d8cf6c9
Author: SaeedZhiany <SaeedZhiany@users.noreply.github.com>
Date:   Tue Dec 3 22:39:23 2019 +0330

    feat(android): Load Android Gradle Plugin conditionally (react-native-camera#2623)

commit 1f8b863
Author: Märt Lõhmus <martlohmus12@gmail.com>
Date:   Mon Dec 2 14:28:13 2019 +0200

    feat(android): restore state when useCamera2api is enabled (react-native-camera#2603)

commit fe84811
Author: Chau Tran <ctch5@mail.umsl.edu>
Date:   Mon Dec 2 06:27:17 2019 -0600

    feat(docs): update onBarCodeRead on Android and add additional SubView library (react-native-camera#2616)

commit 72c5624
Author: Stanimir <sytolk@gmail.com>
Date:   Mon Dec 2 14:24:12 2019 +0200

    fix(example): fixes and updates in mlkit example (react-native-camera#2618)

commit 0af8ea9
Author: semantic-release-bot <semantic-release-bot@martynus.net>
Date:   Sun Dec 1 23:56:03 2019 +0000

    chore(release): 3.13.1 [skip ci]

    ## [3.13.1](react-native-camera/react-native-camera@v3.13.0...v3.13.1) (2019-12-01)

    ### Bug Fixes

    * **android:** barcode option passing to mlkit for Android ([react-native-camera#2614](react-native-camera#2614)) ([32355f4](react-native-camera@32355f4))

commit 32355f4
Author: Kyle Johnson <1007162+kyle-johnson@users.noreply.github.com>
Date:   Sun Dec 1 15:50:57 2019 -0800

    fix(android): barcode option passing to mlkit for Android (react-native-camera#2614)

    * pass barcode options to mlkit

    * rm doubled FORMAT_ALL_FORMATS

commit c728529
Author: semantic-release-bot <semantic-release-bot@martynus.net>
Date:   Fri Nov 29 22:04:16 2019 +0000

    chore(release): 3.13.0 [skip ci]

    # [3.13.0](react-native-camera/react-native-camera@v3.12.0...v3.13.0) (2019-11-29)

    ### Features

    * **types:** Add "URL" to Barcode types & export additional TS types ([react-native-camera#2613](react-native-camera#2613)) ([3f1334c](react-native-camera@3f1334c))

commit 3f1334c
Author: Kyle Johnson <1007162+kyle-johnson@users.noreply.github.com>
Date:   Fri Nov 29 14:00:10 2019 -0800

    feat(types): Add "URL" to Barcode types & export additional TS types (react-native-camera#2613)

    * Add "URL" to flow types

    * add "URL" to barcodes & export additional TS types

    * add optional format to flow

    * add optionl format prop to TS

commit ecb2071
Author: semantic-release-bot <semantic-release-bot@martynus.net>
Date:   Fri Nov 29 21:18:30 2019 +0000

    chore(release): 3.12.0 [skip ci]

    # [3.12.0](react-native-camera/react-native-camera@v3.11.1...v3.12.0) (2019-11-29)

    ### Bug Fixes

    * **ios:** camera is not detecting any faces ([react-native-camera#2611](react-native-camera#2611)) ([b3d0ebe](react-native-camera@b3d0ebe))

    ### Features

    * **docs:** Feature/simplify installtion ([react-native-camera#2606](react-native-camera#2606)) ([a39e8a8](react-native-camera@a39e8a8))

commit a39e8a8
Author: mieszko4 <mieszko4@gmail.com>
Date:   Fri Nov 29 22:14:31 2019 +0100

    feat(docs): Feature/simplify installtion (react-native-camera#2606)

    * docs: split installation into 2 main sections, simplify required steps

    * doc: structure Additional installation steps

    * docs: Hide firebase additional android steps

    * docs: Highlight code snippets, add link to Windows

commit b3d0ebe
Author: annakoro <ann.korostelev@gmail.com>
Date:   Fri Nov 29 17:02:25 2019 +0300

    fix(ios): camera is not detecting any faces (react-native-camera#2611)
  • Loading branch information
susanapons89 committed Dec 20, 2019
1 parent 409ece8 commit 5a22f48
Show file tree
Hide file tree
Showing 24 changed files with 4,959 additions and 2,814 deletions.
18 changes: 12 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ def safeExtGet(prop, fallback) {
}

buildscript {
repositories {
google()
jcenter()
}
// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
if (project == rootProject) {
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
dependencies {
//noinspection GradleDependency
classpath("com.android.tools.build:gradle:3.5.2")
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
import java.util.Set;
import java.util.SortedSet;
import java.util.concurrent.atomic.AtomicBoolean;

import org.reactnative.camera.utils.ObjectUtils;


@SuppressWarnings("deprecation")
class Camera1 extends CameraViewImpl implements MediaRecorder.OnInfoListener,
Expand Down Expand Up @@ -287,13 +288,13 @@ int getFacing() {
@Override
void setCameraId(String id) {

if(!Objects.equals(_mCameraId, id)){
if(!ObjectUtils.equals(_mCameraId, id)){
_mCameraId = id;

// only update if our camera ID actually changes
// from what we currently have.
// Passing null will always yield true
if(!Objects.equals(_mCameraId, String.valueOf(mCameraId))){
if(!ObjectUtils.equals(_mCameraId, String.valueOf(mCameraId))){
// this will call chooseCamera
if (isCameraOpened()) {
stop();
Expand Down
11 changes: 7 additions & 4 deletions android/src/main/java/com/google/android/cameraview/Camera2.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
import java.util.Set;
import java.util.SortedSet;

import org.reactnative.camera.utils.ObjectUtils;



@SuppressWarnings("MissingPermission")
@TargetApi(21)
class Camera2 extends CameraViewImpl implements MediaRecorder.OnInfoListener, MediaRecorder.OnErrorListener {
Expand Down Expand Up @@ -384,13 +387,13 @@ int getFacing() {

@Override
void setCameraId(String id) {
if(!Objects.equals(_mCameraId, id)){
if(!ObjectUtils.equals(_mCameraId, id)){
_mCameraId = id;

// only update if our camera ID actually changes
// from what we currently have.
// Passing null will always yield true
if(!Objects.equals(_mCameraId, mCameraId)){
if(!ObjectUtils.equals(_mCameraId, mCameraId)){
// this will call chooseCameraIdByFacing
if (isCameraOpened()) {
stop();
Expand Down Expand Up @@ -454,7 +457,7 @@ void setPictureSize(Size size) {
mStillImageReader.close();
}
if (size == null) {
if (mAspectRatio == null) {
if (mAspectRatio == null || mPictureSize == null) {
return;
}
mPictureSizes.sizes(mAspectRatio).last();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ public void setUsingCamera2Api(boolean useCamera2) {
} else {
mImpl = new Camera2Api23(mCallbacks, mImpl.mPreview, mContext);
}

onRestoreInstanceState(state);
} else {
if (mImpl instanceof Camera1) {
return;
Expand All @@ -296,7 +298,7 @@ public void start() {
this.removeView(mImpl.getView());
}
//store the state and restore this state after fall back to Camera1
Parcelable state=onSaveInstanceState();
Parcelable state = onSaveInstanceState();
// Camera2 uses legacy hardware layer; fall back to Camera1
mImpl = new Camera1(mCallbacks, createPreviewImpl(getContext()));
onRestoreInstanceState(state);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.reactnative.camera.utils;


public class ObjectUtils {

/*
* Replacement for Objects.equals that is only available after Android API 19
*/
public static boolean equals(Object o1, Object o2) {
if (o1 == null && o2 == null) return true;
if (o1 == null) return false;
return o1.equals(o2);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class BarcodeFormatUtils {
map.put(FirebaseVisionBarcode.FORMAT_AZTEC, "AZTEC");
map.put(FirebaseVisionBarcode.FORMAT_ALL_FORMATS, "ALL");
map.put(FirebaseVisionBarcode.FORMAT_UPC_A, "UPC_A");
map.put(FirebaseVisionBarcode.FORMAT_ALL_FORMATS, "ALL");
map.put(-1, "None");
FORMATS = map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void release() {
private void createBarcodeDetector() {
FirebaseVisionBarcodeDetectorOptions options = mBuilder.build();
mBarcodeDetector = FirebaseVision.getInstance()
.getVisionBarcodeDetector();
.getVisionBarcodeDetector(options);

}
}
40 changes: 30 additions & 10 deletions docs/RNCamera.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ Values: boolean `true` (default) | `false`
Specifies if audio recording permissions should be requested.
Make sure to follow README instructions for audio recording permissions [here](README.md).

### iOS `keepAudioSession`

Values: boolean `true` | `false` (false)

(iOS Only) When the camera is unmounted, it will release any audio session it acquired (if `captureAudio=true`) so other media can continue playing. However, this might not be always desirable (e.g., if video is played afterwards) and can be disabled by setting it to `true`. Setting this to `true`, means your app will not release the audio session. Note: other apps might still "steal" the audio session from your app.

### `flashMode`

Values: `RNCamera.Constants.FlashMode.off` (default), `RNCamera.Constants.FlashMode.on`, `RNCamera.Constants.FlashMode.auto` or `RNCamera.Constants.FlashMode.torch`.
Expand Down Expand Up @@ -346,7 +352,7 @@ Note: This solve the flicker video recording issue for iOS

### `onCameraReady`

Function to be called when native code emit onCameraReady event, when camera is ready.
Function to be called when native code emit onCameraReady event, when camera is ready. This event will also fire when changing cameras (by `type` or `cameraId`).

### `onMountError`

Expand Down Expand Up @@ -391,18 +397,24 @@ Event contains the following fields
}
}

- onAndroid:
- onAndroid: the `ResultPoint[]` (`bounds.origin`) is returned for scanned barcode origins. The number of `ResultPoint` returned depends on the type of Barcode.

bounds:[{x:string,y:string}]
- on Android it just returns resultPoints:
- for barcodes:
bounds: {
width: number;
height: number;
origin: Array<{x: number, y: number}>
}

bounds[0].x : left side of barcode.
bounds[1].x : right side of barcode
- counting for QRcodes:
1. **PDF417**: 8 ResultPoint, laid out as follow:
0 --- 4 ------ 6 --- 2
| ////////////////// |
1 --- 5 ------ 7 --- 3

1 2
0
2. **QR**: 4 ResultPoint, laid out as follow:
2 ------ 3
| //////
| //////
1 ------ 0

The following barcode types can be recognised:

Expand Down Expand Up @@ -649,6 +661,14 @@ A Barcode and QR code UI mask which can be use to render a scanning layout on ca

Read more about [react-native-barcode-mask](https://github.com/shahnawaz/react-native-barcode-mask) here.

### @nartc/react-native-barcode-mask

A rewritten version of `react-native-barcode-mask` using `Hooks` and `Reanimated`. If you're already using `react-native-reanimated` (`react-navigation` dependency) then you might benefit from this rewritten component.
- Customizable
- Provide custom hook to "scan barcode within finder area"

Read more about it here [@nartc/react-native-barcode-mask](https://github.com/nartc/react-native-barcode-mask)

## Testing

To learn about how to test components which uses `RNCamera` check its [documentation about testing](./tests.md).
Expand Down
Loading

0 comments on commit 5a22f48

Please sign in to comment.