feat(windows): updated for react-native-windows 0.62 (#2882)
Build:
* Updated ReactNativeCameraCPP projects to use the new RNW lib props/targets provided in 0.62 for easier upgrades
* Added new ReactNativeCameraCPP solution and readme with instructions for building locally
* Added ReactNativeCameraCPP61 solution and project to maintain 0.61 support
ReactNativeCameraCPP RNCamera component:
* Added properties: defaultVideoQuality, mirrorVideo, autoFocus, whiteBalance, cameraId
* Removed deprecated properties: torchMode
* Expanded Type constant (front/back) to include other Windows types (Unknown, Top, Bottom, Left, Right)
ReactNativeCamperaCPP RNCamera module:
* Cleaned up async error handling:
* Uncaught exceptions no longer crash the app, instead returning the error via the promise reject as expected
* Passed in options and promises are now properly captured so as to not get deleted before async operations are completed
* Fixed issue when passed in option values are doubles instead of integers
* Moved all possible processing off of the UI thread
* Fixed device enumeration by id/type to support non-integrated cameras
* Piped out CaptureTarget constants for "target" option (memory, disk, cameraRoll, temp)
* Added BarCodeType constant stubs
* Added FaceDetection constants stubs
* Added VideoCodec constants for "codec" option (H264, HEVC, WMV)
* takePicture:
* Added options: target, quality, doNotSave, base64, width, mirrorImage, exif, writeExif
* Added result properties: width, height, base64, exif
* Fixed issue where EXIF data was being stripped from photos
* record:
* Added options: target, mute, quality, maxDuration, videoBitrate, codec
* Added result properties: codec
* stopRecording: Added implementation
* isRecording: Added implementation
* pausePreview: Added implementation
* resumePreview: Added implementation
* getCameraIds: Added implementation
This commit is contained in:
parent
d62da5f092
commit
93e6581cde
@ -4,6 +4,7 @@ title: Installation
|
||||
---
|
||||
|
||||
This document is split into two main sections:
|
||||
|
||||
1. Required installation steps for basic usage of `react-native-camera`
|
||||
2. Additional installation steps for usage of Face Detection/Text Recognition/BarCode with [MLKit](https://developers.google.com/ml-kit)
|
||||
|
||||
@ -40,16 +41,16 @@ _These steps assume installation for iOS/Android. To install it with Windows, se
|
||||
|
||||
3. Append the following lines to `android/settings.gradle`:
|
||||
|
||||
```gradle
|
||||
include ':react-native-camera'
|
||||
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
|
||||
```
|
||||
```gradle
|
||||
include ':react-native-camera'
|
||||
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
|
||||
```
|
||||
|
||||
4. Insert the following lines in `android/app/build.gradle` inside the dependencies block:
|
||||
|
||||
```gradle
|
||||
implementation project(':react-native-camera')
|
||||
```
|
||||
```gradle
|
||||
implementation project(':react-native-camera')
|
||||
```
|
||||
|
||||
## iOS - other required steps
|
||||
|
||||
@ -76,38 +77,39 @@ Add permissions with usage descriptions to your app `Info.plist`:
|
||||
<details>
|
||||
<summary>Additional information in case of problems</summary>
|
||||
|
||||
You might need to adjust your Podfile following the example below:
|
||||
You might need to adjust your Podfile following the example below:
|
||||
|
||||
```ruby
|
||||
target 'yourTargetName' do
|
||||
# See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
|
||||
pod 'React', :path => '../node_modules/react-native', :subspecs => [
|
||||
'Core',
|
||||
'CxxBridge', # Include this for RN >= 0.47
|
||||
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
|
||||
'RCTText',
|
||||
'RCTNetwork',
|
||||
'RCTWebSocket', # Needed for debugging
|
||||
'RCTAnimation', # Needed for FlatList and animations running on native UI thread
|
||||
# Add any other subspecs you want to use in your project
|
||||
]
|
||||
```ruby
|
||||
target 'yourTargetName' do
|
||||
# See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
|
||||
pod 'React', :path => '../node_modules/react-native', :subspecs => [
|
||||
'Core',
|
||||
'CxxBridge', # Include this for RN >= 0.47
|
||||
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
|
||||
'RCTText',
|
||||
'RCTNetwork',
|
||||
'RCTWebSocket', # Needed for debugging
|
||||
'RCTAnimation', # Needed for FlatList and animations running on native UI thread
|
||||
# Add any other subspecs you want to use in your project
|
||||
]
|
||||
|
||||
# Explicitly include Yoga if you are using RN >= 0.42.0
|
||||
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
|
||||
# Explicitly include Yoga if you are using RN >= 0.42.0
|
||||
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
|
||||
|
||||
# Third party deps podspec link
|
||||
pod 'react-native-camera', path: '../node_modules/react-native-camera'
|
||||
# Third party deps podspec link
|
||||
pod 'react-native-camera', path: '../node_modules/react-native-camera'
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
if target.name == "React"
|
||||
target.remove_from_project
|
||||
end
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
if target.name == "React"
|
||||
target.remove_from_project
|
||||
end
|
||||
end
|
||||
```
|
||||
end
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Android - other required steps
|
||||
@ -141,18 +143,19 @@ android {
|
||||
<details>
|
||||
<summary>Additional information in case of problems</summary>
|
||||
|
||||
1. Make sure you use `JDK >= 1.7` and your `buildToolsVersion >= 25.0.2`
|
||||
1. Make sure you use `JDK >= 1.7` and your `buildToolsVersion >= 25.0.2`
|
||||
|
||||
2. Make sure you have jitpack added in `android/build.gradle`
|
||||
2. Make sure you have jitpack added in `android/build.gradle`
|
||||
|
||||
```gradle
|
||||
allprojects {
|
||||
repositories {
|
||||
maven { url "https://www.jitpack.io" }
|
||||
maven { url "https://maven.google.com" }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```gradle
|
||||
allprojects {
|
||||
repositories {
|
||||
maven { url "https://www.jitpack.io" }
|
||||
maven { url "https://maven.google.com" }
|
||||
}
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
# Additional installation steps
|
||||
@ -170,7 +173,7 @@ If you want any of these optional features, you will need to use CocoaPods.
|
||||
|
||||
Add dependency towards `react-native-camera` in your `Podfile` with `subspecs` using one of the following:
|
||||
|
||||
* For Face Detection:
|
||||
- For Face Detection:
|
||||
|
||||
```ruby
|
||||
pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
|
||||
@ -178,7 +181,7 @@ pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs
|
||||
]
|
||||
```
|
||||
|
||||
* For Text Recognition:
|
||||
- For Text Recognition:
|
||||
|
||||
```ruby
|
||||
pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
|
||||
@ -186,7 +189,7 @@ pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs
|
||||
]
|
||||
```
|
||||
|
||||
* For BarCode Recognition:
|
||||
- For BarCode Recognition:
|
||||
|
||||
```ruby
|
||||
pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
|
||||
@ -194,7 +197,7 @@ pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs
|
||||
]
|
||||
```
|
||||
|
||||
* For all possible detections:
|
||||
- For all possible detections:
|
||||
|
||||
```ruby
|
||||
pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
|
||||
@ -231,10 +234,9 @@ In short, you would need to
|
||||
<details>
|
||||
<summary>Additional information in case of problems</summary>
|
||||
|
||||
- If you have issues with duplicate symbols you will need to enable dead code stripping option in your Xcode (Target > Build Settings > search for "Dead code stripping") [see here](https://github.com/firebase/quickstart-ios/issues/487#issuecomment-415313053).
|
||||
- If you are using `pod Firebase/Core` with a version set below 5.13 you might want to add `pod 'GoogleAppMeasurement', '~> 5.3.0'` to your podfile
|
||||
</details>
|
||||
|
||||
- If you have issues with duplicate symbols you will need to enable dead code stripping option in your Xcode (Target > Build Settings > search for "Dead code stripping") [see here](https://github.com/firebase/quickstart-ios/issues/487#issuecomment-415313053).
|
||||
- If you are using `pod Firebase/Core` with a version set below 5.13 you might want to add `pod 'GoogleAppMeasurement', '~> 5.3.0'` to your podfile
|
||||
</details>
|
||||
|
||||
## Android
|
||||
|
||||
@ -291,157 +293,165 @@ apply plugin: 'com.google.gms.google-services'
|
||||
<summary>Additional information in case of problems</summary>
|
||||
The current Android library defaults to the below values for the Google SDK and Libraries,
|
||||
|
||||
```gradle
|
||||
def DEFAULT_COMPILE_SDK_VERSION = 26
|
||||
def DEFAULT_BUILD_TOOLS_VERSION = "26.0.2"
|
||||
def DEFAULT_TARGET_SDK_VERSION = 26
|
||||
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "12.0.1"
|
||||
def DEFAULT_SUPPORT_LIBRARY_VERSION = "27.1.0"
|
||||
```
|
||||
```gradle
|
||||
def DEFAULT_COMPILE_SDK_VERSION = 26
|
||||
def DEFAULT_BUILD_TOOLS_VERSION = "26.0.2"
|
||||
def DEFAULT_TARGET_SDK_VERSION = 26
|
||||
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "12.0.1"
|
||||
def DEFAULT_SUPPORT_LIBRARY_VERSION = "27.1.0"
|
||||
```
|
||||
|
||||
You can override this settings by adding a Project-wide gradle configuration properties for
|
||||
use by all modules in your ReactNative project by adding the below to `android/build.gradle`
|
||||
file,
|
||||
You can override this settings by adding a Project-wide gradle configuration properties for
|
||||
use by all modules in your ReactNative project by adding the below to `android/build.gradle`
|
||||
file,
|
||||
|
||||
```gradle
|
||||
buildscript {...}
|
||||
```gradle
|
||||
buildscript {...}
|
||||
|
||||
allprojects {...}
|
||||
allprojects {...}
|
||||
|
||||
/**
|
||||
* Project-wide gradle configuration properties for use by all modules
|
||||
*/
|
||||
ext {
|
||||
compileSdkVersion = 26
|
||||
targetSdkVersion = 26
|
||||
buildToolsVersion = "26.0.2"
|
||||
googlePlayServicesVersion = "12.0.1"
|
||||
googlePlayServicesVisionVersion = "15.0.2"
|
||||
supportLibVersion = "27.1.0"
|
||||
}
|
||||
```
|
||||
/**
|
||||
* Project-wide gradle configuration properties for use by all modules
|
||||
*/
|
||||
ext {
|
||||
compileSdkVersion = 26
|
||||
targetSdkVersion = 26
|
||||
buildToolsVersion = "26.0.2"
|
||||
googlePlayServicesVersion = "12.0.1"
|
||||
googlePlayServicesVisionVersion = "15.0.2"
|
||||
supportLibVersion = "27.1.0"
|
||||
}
|
||||
```
|
||||
|
||||
The above settings in the ReactNative project over-rides the values present in the `react-native-camera`
|
||||
module. For your reference below is the `android/build.gradle` file of the module.
|
||||
The above settings in the ReactNative project over-rides the values present in the `react-native-camera`
|
||||
module. For your reference below is the `android/build.gradle` file of the module.
|
||||
|
||||
```gradle
|
||||
def safeExtGet(prop, fallback) {
|
||||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
maven {
|
||||
url 'https://maven.google.com'
|
||||
}
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.3.1'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion safeExtGet('compileSdkVersion', 28)
|
||||
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion safeExtGet('minSdkVersion', 16)
|
||||
targetSdkVersion safeExtGet('targetSdkVersion', 28)
|
||||
}
|
||||
|
||||
flavorDimensions "react-native-camera"
|
||||
|
||||
productFlavors {
|
||||
general {
|
||||
dimension "react-native-camera"
|
||||
}
|
||||
mlkit {
|
||||
dimension "react-native-camera"
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java.srcDirs = ['src/main/java']
|
||||
}
|
||||
general {
|
||||
java.srcDirs = ['src/general/java']
|
||||
}
|
||||
mlkit {
|
||||
java.srcDirs = ['src/mlkit/java']
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
warning 'InvalidPackage'
|
||||
}
|
||||
}
|
||||
```gradle
|
||||
def safeExtGet(prop, fallback) {
|
||||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
maven {
|
||||
url 'https://maven.google.com'
|
||||
}
|
||||
jcenter()
|
||||
maven {
|
||||
url 'https://maven.google.com'
|
||||
}
|
||||
maven { url "https://jitpack.io" }
|
||||
maven {
|
||||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
||||
url "$rootDir/../node_modules/react-native/android"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def googlePlayServicesVisionVersion = safeExtGet('googlePlayServicesVisionVersion', safeExtGet('googlePlayServicesVersion', '17.0.2'))
|
||||
|
||||
implementation 'com.facebook.react:react-native:+'
|
||||
implementation "com.google.zxing:core:3.3.3"
|
||||
implementation "com.drewnoakes:metadata-extractor:2.11.0"
|
||||
generalImplementation "com.google.android.gms:play-services-vision:$googlePlayServicesVisionVersion"
|
||||
implementation "com.android.support:exifinterface:${safeExtGet('supportLibVersion', '28.0.0')}"
|
||||
implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '28.0.0')}"
|
||||
implementation "com.android.support:support-v4:${safeExtGet('supportLibVersion', '28.0.0')}"
|
||||
mlkitImplementation "com.google.firebase:firebase-ml-vision:${safeExtGet('firebase-ml-vision', '19.0.3')}"
|
||||
mlkitImplementation "com.google.firebase:firebase-ml-vision-face-model:${safeExtGet('firebase-ml-vision-face-model', '17.0.2')}"
|
||||
classpath 'com.android.tools.build:gradle:3.3.1'
|
||||
}
|
||||
```
|
||||
}
|
||||
|
||||
If you are using a version of `googlePlayServicesVersion` that does not have `play-services-vision`, you can specify a different version of `play-services-vision` by adding `googlePlayServicesVisionVersion` to the project-wide properties
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
```gradle
|
||||
ext {
|
||||
compileSdkVersion = 26
|
||||
targetSdkVersion = 26
|
||||
buildToolsVersion = "26.0.2"
|
||||
googlePlayServicesVersion = "16.0.1"
|
||||
googlePlayServicesVisionVersion = "15.0.2"
|
||||
supportLibVersion = "27.1.0"
|
||||
android {
|
||||
compileSdkVersion safeExtGet('compileSdkVersion', 28)
|
||||
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion safeExtGet('minSdkVersion', 16)
|
||||
targetSdkVersion safeExtGet('targetSdkVersion', 28)
|
||||
}
|
||||
```
|
||||
|
||||
flavorDimensions "react-native-camera"
|
||||
|
||||
productFlavors {
|
||||
general {
|
||||
dimension "react-native-camera"
|
||||
}
|
||||
mlkit {
|
||||
dimension "react-native-camera"
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java.srcDirs = ['src/main/java']
|
||||
}
|
||||
general {
|
||||
java.srcDirs = ['src/general/java']
|
||||
}
|
||||
mlkit {
|
||||
java.srcDirs = ['src/mlkit/java']
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
warning 'InvalidPackage'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
maven {
|
||||
url 'https://maven.google.com'
|
||||
}
|
||||
maven { url "https://jitpack.io" }
|
||||
maven {
|
||||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
||||
url "$rootDir/../node_modules/react-native/android"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def googlePlayServicesVisionVersion = safeExtGet('googlePlayServicesVisionVersion', safeExtGet('googlePlayServicesVersion', '17.0.2'))
|
||||
|
||||
implementation 'com.facebook.react:react-native:+'
|
||||
implementation "com.google.zxing:core:3.3.3"
|
||||
implementation "com.drewnoakes:metadata-extractor:2.11.0"
|
||||
generalImplementation "com.google.android.gms:play-services-vision:$googlePlayServicesVisionVersion"
|
||||
implementation "com.android.support:exifinterface:${safeExtGet('supportLibVersion', '28.0.0')}"
|
||||
implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '28.0.0')}"
|
||||
implementation "com.android.support:support-v4:${safeExtGet('supportLibVersion', '28.0.0')}"
|
||||
mlkitImplementation "com.google.firebase:firebase-ml-vision:${safeExtGet('firebase-ml-vision', '19.0.3')}"
|
||||
mlkitImplementation "com.google.firebase:firebase-ml-vision-face-model:${safeExtGet('firebase-ml-vision-face-model', '17.0.2')}"
|
||||
}
|
||||
```
|
||||
|
||||
If you are using a version of `googlePlayServicesVersion` that does not have `play-services-vision`, you can specify a different version of `play-services-vision` by adding `googlePlayServicesVisionVersion` to the project-wide properties
|
||||
|
||||
```gradle
|
||||
ext {
|
||||
compileSdkVersion = 26
|
||||
targetSdkVersion = 26
|
||||
buildToolsVersion = "26.0.2"
|
||||
googlePlayServicesVersion = "16.0.1"
|
||||
googlePlayServicesVisionVersion = "15.0.2"
|
||||
supportLibVersion = "27.1.0"
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
# Windows
|
||||
|
||||
## Windows RNW C++/WinRT details
|
||||
## Manual linking for RNW 0.62
|
||||
|
||||
1. `yarn install react-native-camera`
|
||||
2. Link the library as described below:
|
||||
windows/myapp.sln
|
||||
Add the ReactNativeCamera project to your solution.
|
||||
Open the solution in Visual Studio 2019
|
||||
Right-click Solution icon in Solution Explorer > Add > Existing Project Select node_modules\react-native-camera\windows\ReactNativeCameraCPP\ReactNativeCameraCPP.vcxproj
|
||||
windows/myapp/myapp.vcxproj
|
||||
Add a reference to ReactNativeCameraCPP to your main application project. From Visual Studio 2019:
|
||||
Right-click main application project > Add > Reference... Check ReactNativeCameraCPP from Solution Projects.
|
||||
3. Modify files below to add the Camera package providers to your main application project
|
||||
pch.h
|
||||
Add #include "winrt/ReactNativeCameraCPP.h".
|
||||
app.cpp
|
||||
Add PackageProviders().Append(winrt::ReactNativeCameraCPP::ReactPackageProvider()); before InitializeComponent();
|
||||
3. Add the capabilities (permissions) for the webcam and microphone as described here: [docs.microsoft / audio-video-camera](https://docs.microsoft.com/en-us/windows/uwp/audio-video-camera/simple-camera-preview-access#add-capability-declarations-to-the-app-manifest)
|
||||
1. Add the _ReactNativeCameraCPP_ project to your solution (eg. `windows\yourapp.sln`)
|
||||
1. Open your solution in Visual Studio 2019
|
||||
2. Right-click Solution icon in Solution Explorer > Add > Existing Project...
|
||||
3. Select `node_modules\react-native-camera\windows\ReactNativeCameraCPP\ReactNativeCameraCPP.vcxproj`
|
||||
2. Add a reference to _ReactNativeCameraCPP_ to your main application project (eg. `windows\yourapp\yourapp.vcxproj`)
|
||||
1. Open your solution in Visual Studio 2019
|
||||
2. Right-click main application project > Add > Reference...
|
||||
3. Check _ReactNativeCameraCPP_ from Solution Projects
|
||||
3. Modify files below to add the package providers to your main application project
|
||||
1. `pch.h`
|
||||
1. Add `#include "winrt/ReactNativeCameraCPP.h"`
|
||||
2. `App.cpp`
|
||||
1. Add `PackageProviders().Append(winrt::ReactNativeCameraCPP::ReactPackageProvider());` before `InitializeComponent();`
|
||||
4. Add the capabilities (permissions) for the webcam and microphone as described here: [Add capability declarations to the app manifest](https://docs.microsoft.com/en-us/windows/uwp/audio-video-camera/simple-camera-preview-access#add-capability-declarations-to-the-app-manifest)
|
||||
5. If you plan on capturing images to the Pictures Library, or videos to the Videos Library, be sure to enable those capabilities too
|
||||
|
||||
## Manual linking for RNW 0.61
|
||||
|
||||
Follow the same manual steps for RNW 0.62 above, but for step 2 substitute _ReactNativeCameraCPP61_ for _ReactNativeCameraCPP_.
|
||||
|
||||
Follow the [Q & A](QA.md) section if you are having compilation issues.
|
||||
|
||||
@ -364,6 +364,7 @@ export default class Camera extends React.Component<PropsType, StateType> {
|
||||
GoogleVisionBarcodeDetection: CameraManager.GoogleVisionBarcodeDetection,
|
||||
FaceDetection: CameraManager.FaceDetection,
|
||||
CameraStatus,
|
||||
CaptureTarget: CameraManager.CaptureTarget,
|
||||
RecordAudioPermissionStatus: RecordAudioPermissionStatusEnum,
|
||||
VideoStabilization: CameraManager.VideoStabilization,
|
||||
Orientation: {
|
||||
|
||||
92
windows/.clang-format
Normal file
92
windows/.clang-format
Normal file
@ -0,0 +1,92 @@
|
||||
---
|
||||
AccessModifierOffset: -1
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlinesLeft: true
|
||||
AlignOperands: false
|
||||
AlignTrailingComments: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: false
|
||||
ColumnLimit: 120
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ]
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: 'pch.h'
|
||||
Priority: -1
|
||||
- Regex: '.*\.g\..*'
|
||||
Priority: 1
|
||||
- Regex: '^<.*\.h(pp)?>'
|
||||
Priority: 2
|
||||
- Regex: '^<.*'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 4
|
||||
IndentCaseLabels: true
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
...
|
||||
16
windows/.gitignore
vendored
16
windows/.gitignore
vendored
@ -1,6 +1,5 @@
|
||||
*AppPackages*
|
||||
*BundleArtifacts*
|
||||
*ReactAssets*
|
||||
|
||||
#OS junk files
|
||||
[Tt]humbs.db
|
||||
@ -36,6 +35,17 @@ ipch/
|
||||
[Rr]elease*/
|
||||
Ankh.NoLoad
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
#MonoDevelop
|
||||
*.pidb
|
||||
*.userprefs
|
||||
@ -76,3 +86,7 @@ packages/
|
||||
*.DotSettings
|
||||
.vs/
|
||||
*project.lock.json
|
||||
|
||||
#Files generated by the VS build
|
||||
**/Generated Files/**
|
||||
|
||||
|
||||
33
windows/README.md
Normal file
33
windows/README.md
Normal file
@ -0,0 +1,33 @@
|
||||
# React Native Camera (Windows)
|
||||
|
||||
React Native Camera is currently maintained for React Native Windows (RNW) >= 0.61.
|
||||
|
||||
There are two implementations of `react-native-camera` in this folder:
|
||||
|
||||
1. _ReactNativeCameraCPP_ is the currently maintained implementation:
|
||||
1. Use _ReactNativeCameraCPP_ for RNW >= 0.62.
|
||||
2. Use _ReactNativeCameraCPP61_ for RNW 0.61.
|
||||
2. _RNCamera_ is a legacy implementation for `react-native-windows@0.59.0-legacy.2`. It is no longer maintained.
|
||||
|
||||
## Why all the different versions?
|
||||
|
||||
RNW was originally implemented in C#, where development stopped at version 0.59. _RNCamera_ is the version of React Native Camera written in C# against that (now "legacy") RNW.
|
||||
|
||||
RNW was then rebuilt from scratch in C++, and version 0.61 was the first release to support native community modules. _ReactNativeCameraCPP_ is the version of React Native Camera written in C++ against the current RNW.
|
||||
|
||||
RNW 0.62 brought a variety of build improvements, but now requires both Visual Studio 2019 and a newer Windows SDK. So while the native module APIs are 99% forward-compatible, it's currently necessary to maintain a separate `ReactNativeCameraCPP61.vcxproj` project for RNW 0.61 users. The `ReactNativeCameraCPP.vcxproj` project targets RNW >= 0.62 users.
|
||||
|
||||
# Local Development Setup (RNW >= 0.62)
|
||||
|
||||
In order to work on _ReactNativeCameraCPP_, you'll need to install the [Windows Development Dependencies](https://microsoft.github.io/react-native-windows/docs/rnw-dependencies).
|
||||
|
||||
In addition, `react-native-camera` targets React Native 0.59 and doesn't include React Native Windows as a dependency. So in order to build _ReactNativeCameraCPP_ locally you'll need to temporarily upgrade the development dependencies:
|
||||
|
||||
```
|
||||
yarn upgrade react-native@^0.62.2
|
||||
yarn add react-native-windows@^0.62.0 --dev
|
||||
```
|
||||
|
||||
Now you should be able to open `ReactNativeCameraCPP.sln` in Visual Studio and build the project.
|
||||
|
||||
> _Note:_ In order to test your code changes don't break RNW 0.61, you'll want to do the above steps but targeting RN/RNW 0.61, and using `ReactNativeCameraCPP61.sln`.
|
||||
250
windows/ReactNativeCameraCPP.sln
Normal file
250
windows/ReactNativeCameraCPP.sln
Normal file
@ -0,0 +1,250 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30114.105
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactNativeCameraCPP", "ReactNativeCameraCPP\ReactNativeCameraCPP.vcxproj", "{7432C343-CC07-4BC7-9BD0-8C467BE0F018}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReactNative", "ReactNative", "{4F6E56C3-12C5-4457-9239-0ACF0B7150A8}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "..\node_modules\react-native-windows\Common\Common.vcxproj", "{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Folly", "..\node_modules\react-native-windows\Folly\Folly.vcxproj", "{A990658C-CE31-4BCC-976F-0FC6B1AF693D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Universal", "..\node_modules\react-native-windows\JSI\Universal\JSI.Universal.vcxproj", "{A62D504A-16B8-41D2-9F19-E2E86019E5E4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Shared", "..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems", "{0CC28589-39E4-4288-B162-97B959F8B843}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Chakra", "..\node_modules\react-native-windows\Chakra\Chakra.vcxitems", "{C38970C0-5FBF-4D69-90D8-CBAC225AE895}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.ReactNative", "..\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj", "{F7D32BD0-2749-483E-9A0D-1635EF7E3136}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mso", "..\node_modules\react-native-windows\Mso\Mso.vcxitems", "{84E05BFA-CBAF-4F0D-BFB6-4CE85742A57E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactCommon", "..\node_modules\react-native-windows\ReactCommon\ReactCommon.vcxproj", "{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.ReactNative.Cxx", "..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems", "{DA8B35B3-DA00-4B02-BDE6-6A397B3FD46B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Shared", "..\node_modules\react-native-windows\Shared\Shared.vcxitems", "{2049DBE9-8D13-42C9-AE4B-413AE38FFFD0}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactWindowsCore", "..\node_modules\react-native-windows\ReactWindowsCore\ReactWindowsCore.vcxproj", "{11C084A3-A57C-4296-A679-CAC17B603144}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{0cc28589-39e4-4288-b162-97b959f8b843}*SharedItemsImports = 9
|
||||
..\node_modules\react-native-windows\ReactWindowsCore\ReactWindowsCore.vcxitems*{11c084a3-a57c-4296-a679-cac17b603144}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9
|
||||
..\node_modules\react-native-windows\Mso\Mso.vcxitems*{84e05bfa-cbaf-4f0d-bfb6-4ce85742a57e}*SharedItemsImports = 9
|
||||
..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{a62d504a-16b8-41d2-9f19-e2e86019e5e4}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9
|
||||
..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9
|
||||
..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|ARM = Release|ARM
|
||||
Release|ARM64 = Release|ARM64
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
WinUI3|ARM = WinUI3|ARM
|
||||
WinUI3|ARM64 = WinUI3|ARM64
|
||||
WinUI3|x64 = WinUI3|x64
|
||||
WinUI3|x86 = WinUI3|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Debug|x64.Build.0 = Debug|x64
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Debug|x86.Build.0 = Debug|Win32
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Release|ARM.Build.0 = Release|ARM
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Release|x64.ActiveCfg = Release|x64
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Release|x64.Build.0 = Release|x64
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Release|x86.ActiveCfg = Release|Win32
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.Release|x86.Build.0 = Release|Win32
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.WinUI3|ARM.ActiveCfg = Release|ARM
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.WinUI3|ARM.Build.0 = Release|ARM
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.WinUI3|ARM64.ActiveCfg = Release|ARM64
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.WinUI3|ARM64.Build.0 = Release|ARM64
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.WinUI3|x64.ActiveCfg = Release|x64
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.WinUI3|x64.Build.0 = Release|x64
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.WinUI3|x86.ActiveCfg = Release|Win32
|
||||
{7432C343-CC07-4BC7-9BD0-8C467BE0F018}.WinUI3|x86.Build.0 = Release|Win32
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x64.Build.0 = Debug|x64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x86.Build.0 = Debug|Win32
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM.Build.0 = Release|ARM
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.ActiveCfg = Release|x64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.Build.0 = Release|x64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.Build.0 = Release|Win32
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.WinUI3|ARM.ActiveCfg = Release|ARM
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.WinUI3|ARM.Build.0 = Release|ARM
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.WinUI3|ARM64.ActiveCfg = Release|ARM64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.WinUI3|ARM64.Build.0 = Release|ARM64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.WinUI3|x64.ActiveCfg = Release|x64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.WinUI3|x64.Build.0 = Release|x64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.WinUI3|x86.ActiveCfg = Release|Win32
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.WinUI3|x86.Build.0 = Release|Win32
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.Build.0 = Debug|x64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x86.Build.0 = Debug|Win32
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM.Build.0 = Release|ARM
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.ActiveCfg = Release|x64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.Build.0 = Release|x64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.Build.0 = Release|Win32
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.WinUI3|ARM.ActiveCfg = Release|ARM
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.WinUI3|ARM.Build.0 = Release|ARM
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.WinUI3|ARM64.ActiveCfg = Release|ARM64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.WinUI3|ARM64.Build.0 = Release|ARM64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.WinUI3|x64.ActiveCfg = Release|x64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.WinUI3|x64.Build.0 = Release|x64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.WinUI3|x86.ActiveCfg = Release|Win32
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.WinUI3|x86.Build.0 = Release|Win32
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x64.Build.0 = Debug|x64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x86.Build.0 = Debug|Win32
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM.Build.0 = Release|ARM
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x64.ActiveCfg = Release|x64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x64.Build.0 = Release|x64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x86.ActiveCfg = Release|Win32
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x86.Build.0 = Release|Win32
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.WinUI3|ARM.ActiveCfg = Release|ARM
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.WinUI3|ARM.Build.0 = Release|ARM
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.WinUI3|ARM64.ActiveCfg = Release|ARM64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.WinUI3|ARM64.Build.0 = Release|ARM64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.WinUI3|x64.ActiveCfg = Release|x64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.WinUI3|x64.Build.0 = Release|x64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.WinUI3|x86.ActiveCfg = Release|Win32
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.WinUI3|x86.Build.0 = Release|Win32
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x64.Build.0 = Debug|x64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x86.Build.0 = Debug|Win32
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM.Build.0 = Release|ARM
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x64.ActiveCfg = Release|x64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x64.Build.0 = Release|x64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x86.ActiveCfg = Release|Win32
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x86.Build.0 = Release|Win32
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.WinUI3|ARM.ActiveCfg = Release|ARM
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.WinUI3|ARM.Build.0 = Release|ARM
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.WinUI3|ARM64.ActiveCfg = Release|ARM64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.WinUI3|ARM64.Build.0 = Release|ARM64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.WinUI3|x64.ActiveCfg = Release|x64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.WinUI3|x64.Build.0 = Release|x64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.WinUI3|x86.ActiveCfg = Release|Win32
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.WinUI3|x86.Build.0 = Release|Win32
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.Build.0 = Debug|x64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x86.Build.0 = Debug|Win32
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM.Build.0 = Release|ARM
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x64.ActiveCfg = Release|x64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x64.Build.0 = Release|x64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x86.ActiveCfg = Release|Win32
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x86.Build.0 = Release|Win32
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.WinUI3|ARM.ActiveCfg = Release|ARM
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.WinUI3|ARM.Build.0 = Release|ARM
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.WinUI3|ARM64.ActiveCfg = Release|ARM64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.WinUI3|ARM64.Build.0 = Release|ARM64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.WinUI3|x64.ActiveCfg = Release|x64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.WinUI3|x64.Build.0 = Release|x64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.WinUI3|x86.ActiveCfg = Release|Win32
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.WinUI3|x86.Build.0 = Release|Win32
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x64.Build.0 = Debug|x64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x86.Build.0 = Debug|Win32
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM.Build.0 = Release|ARM
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x64.ActiveCfg = Release|x64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x64.Build.0 = Release|x64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x86.ActiveCfg = Release|Win32
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x86.Build.0 = Release|Win32
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.WinUI3|ARM.ActiveCfg = WinUI3|ARM
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.WinUI3|ARM.Build.0 = WinUI3|ARM
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.WinUI3|ARM64.ActiveCfg = WinUI3|ARM64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.WinUI3|ARM64.Build.0 = WinUI3|ARM64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.WinUI3|x64.ActiveCfg = WinUI3|x64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.WinUI3|x64.Build.0 = WinUI3|x64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.WinUI3|x86.ActiveCfg = WinUI3|Win32
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.WinUI3|x86.Build.0 = WinUI3|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D} = {4F6E56C3-12C5-4457-9239-0ACF0B7150A8}
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {4F6E56C3-12C5-4457-9239-0ACF0B7150A8}
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4} = {4F6E56C3-12C5-4457-9239-0ACF0B7150A8}
|
||||
{0CC28589-39E4-4288-B162-97B959F8B843} = {4F6E56C3-12C5-4457-9239-0ACF0B7150A8}
|
||||
{C38970C0-5FBF-4D69-90D8-CBAC225AE895} = {4F6E56C3-12C5-4457-9239-0ACF0B7150A8}
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136} = {4F6E56C3-12C5-4457-9239-0ACF0B7150A8}
|
||||
{84E05BFA-CBAF-4F0D-BFB6-4CE85742A57E} = {4F6E56C3-12C5-4457-9239-0ACF0B7150A8}
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD} = {4F6E56C3-12C5-4457-9239-0ACF0B7150A8}
|
||||
{DA8B35B3-DA00-4B02-BDE6-6A397B3FD46B} = {4F6E56C3-12C5-4457-9239-0ACF0B7150A8}
|
||||
{2049DBE9-8D13-42C9-AE4B-413AE38FFFD0} = {4F6E56C3-12C5-4457-9239-0ACF0B7150A8}
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144} = {4F6E56C3-12C5-4457-9239-0ACF0B7150A8}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1E57BD63-8052-4EAD-9EEB-BD1A60F44A67}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@ -3,240 +3,215 @@
|
||||
#include "CameraRotationHelper.g.cpp"
|
||||
|
||||
namespace winrt {
|
||||
using namespace Windows::Devices::Enumeration;
|
||||
using namespace Windows::Devices::Sensors;
|
||||
using namespace Windows::Storage::FileProperties;
|
||||
using namespace Windows::Graphics::Display;
|
||||
} //namespace winrt
|
||||
using namespace Windows::Devices::Enumeration;
|
||||
using namespace Windows::Devices::Sensors;
|
||||
using namespace Windows::Storage::FileProperties;
|
||||
using namespace Windows::Graphics::Display;
|
||||
} // namespace winrt
|
||||
|
||||
namespace winrt::ReactNativeCameraCPP::implementation
|
||||
{
|
||||
CameraRotationHelper::CameraRotationHelper(EnclosureLocation location)
|
||||
{
|
||||
m_cameraEnclosureLocation = location;
|
||||
namespace winrt::ReactNativeCameraCPP::implementation {
|
||||
CameraRotationHelper::CameraRotationHelper(EnclosureLocation location) {
|
||||
m_cameraEnclosureLocation = location;
|
||||
|
||||
if (!IsEnclosureLocationExternal(m_cameraEnclosureLocation) && m_orientationSensor != nullptr)
|
||||
{
|
||||
m_sensorOrientationChanged_revoker = m_orientationSensor.OrientationChanged(winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args)
|
||||
{
|
||||
if (auto self = ref.get()) {
|
||||
self->SimpleOrientationSensor_OrientationChanged(sender, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
m_displayOrientationChanged_revoker = m_displayInformation.OrientationChanged(winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args)
|
||||
{
|
||||
if (auto self = ref.get()) {
|
||||
self->DisplayInformation_OrientationChanged(sender, args);
|
||||
}
|
||||
if (!IsEnclosureLocationExternal(m_cameraEnclosureLocation) && m_orientationSensor != nullptr) {
|
||||
m_sensorOrientationChanged_revoker = m_orientationSensor.OrientationChanged(
|
||||
winrt::auto_revoke, [ref = get_weak()](auto const &sender, auto const &args) {
|
||||
if (auto self = ref.get()) {
|
||||
self->SimpleOrientationSensor_OrientationChanged(sender, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
PhotoOrientation CameraRotationHelper::GetConvertedCameraCaptureOrientation()
|
||||
{
|
||||
auto orientation = GetCameraCaptureOrientation();
|
||||
return ConvertSimpleOrientationToPhotoOrientation(orientation);
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::GetCameraCaptureOrientation()
|
||||
{
|
||||
if (IsEnclosureLocationExternal(m_cameraEnclosureLocation))
|
||||
{
|
||||
// Cameras that are not attached to the device do not rotate along with it, so apply no rotation
|
||||
return SimpleOrientation::NotRotated;
|
||||
}
|
||||
m_displayOrientationChanged_revoker = m_displayInformation.OrientationChanged(
|
||||
winrt::auto_revoke, [ref = get_weak()](auto const &sender, auto const &args) {
|
||||
if (auto self = ref.get()) {
|
||||
self->DisplayInformation_OrientationChanged(sender, args);
|
||||
}
|
||||
|
||||
// Get the device orientation offset by the camera hardware offset
|
||||
auto deviceOrientation = m_orientationSensor ? m_orientationSensor.GetCurrentOrientation() : SimpleOrientation::NotRotated;
|
||||
auto result = SubtractOrientations(deviceOrientation, GetCameraOrientationRelativeToNativeOrientation());
|
||||
|
||||
// If the preview is being mirrored for a front-facing camera, then the rotation should be inverted
|
||||
if (ShouldMirrorPreview())
|
||||
{
|
||||
result = MirrorOrientation(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::GetCameraPreviewOrientation()
|
||||
{
|
||||
if (IsEnclosureLocationExternal(m_cameraEnclosureLocation))
|
||||
{
|
||||
// Cameras that are not attached to the device do not rotate along with it, so apply no rotation
|
||||
return SimpleOrientation::NotRotated;
|
||||
}
|
||||
|
||||
// Get the app display rotation offset by the camera hardware offset
|
||||
auto result = ConvertDisplayOrientationToSimpleOrientation(m_displayInformation.CurrentOrientation());
|
||||
result = SubtractOrientations(result, GetCameraOrientationRelativeToNativeOrientation());
|
||||
|
||||
// If the preview is being mirrored for a front-facing camera, then the rotation should be inverted
|
||||
if (ShouldMirrorPreview())
|
||||
{
|
||||
result = MirrorOrientation(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int CameraRotationHelper::GetCameraPreviewClockwiseDegrees()
|
||||
{
|
||||
auto rotation = GetCameraPreviewOrientation();
|
||||
return ConvertSimpleOrientationToClockwiseDegrees(rotation);
|
||||
}
|
||||
|
||||
PhotoOrientation CameraRotationHelper::ConvertSimpleOrientationToPhotoOrientation(SimpleOrientation orientation)
|
||||
{
|
||||
switch (orientation)
|
||||
{
|
||||
case SimpleOrientation::Rotated90DegreesCounterclockwise:
|
||||
return PhotoOrientation::Rotate90;
|
||||
case SimpleOrientation::Rotated180DegreesCounterclockwise:
|
||||
return PhotoOrientation::Rotate180;
|
||||
case SimpleOrientation::Rotated270DegreesCounterclockwise:
|
||||
return PhotoOrientation::Rotate270;
|
||||
case SimpleOrientation::NotRotated:
|
||||
default:
|
||||
return PhotoOrientation::Normal;
|
||||
}
|
||||
}
|
||||
|
||||
int CameraRotationHelper::ConvertSimpleOrientationToClockwiseDegrees(SimpleOrientation orientation)
|
||||
{
|
||||
switch (orientation)
|
||||
{
|
||||
case SimpleOrientation::Rotated90DegreesCounterclockwise:
|
||||
return 270;
|
||||
case SimpleOrientation::Rotated180DegreesCounterclockwise:
|
||||
return 180;
|
||||
case SimpleOrientation::Rotated270DegreesCounterclockwise:
|
||||
return 90;
|
||||
case SimpleOrientation::NotRotated:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::ConvertDisplayOrientationToSimpleOrientation(DisplayOrientations orientation)
|
||||
{
|
||||
SimpleOrientation result;
|
||||
switch (orientation)
|
||||
{
|
||||
case DisplayOrientations::Landscape:
|
||||
result = SimpleOrientation::NotRotated;
|
||||
break;
|
||||
case DisplayOrientations::PortraitFlipped:
|
||||
result = SimpleOrientation::Rotated90DegreesCounterclockwise;
|
||||
break;
|
||||
case DisplayOrientations::LandscapeFlipped:
|
||||
result = SimpleOrientation::Rotated180DegreesCounterclockwise;
|
||||
break;
|
||||
case DisplayOrientations::Portrait:
|
||||
default:
|
||||
result = SimpleOrientation::Rotated270DegreesCounterclockwise;
|
||||
break;
|
||||
}
|
||||
|
||||
// Above assumes landscape; offset is needed if native orientation is portrait
|
||||
if (m_displayInformation.NativeOrientation() == DisplayOrientations::Portrait)
|
||||
{
|
||||
result = AddOrientations(result, SimpleOrientation::Rotated90DegreesCounterclockwise);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::SubtractOrientations(SimpleOrientation a, SimpleOrientation b)
|
||||
{
|
||||
auto aRot = ConvertSimpleOrientationToClockwiseDegrees(a);
|
||||
auto bRot = ConvertSimpleOrientationToClockwiseDegrees(b);
|
||||
// Add 360 to ensure the modulus operator does not operate on a negative
|
||||
auto result = (360 + (aRot - bRot)) % 360;
|
||||
return ConvertClockwiseDegreesToSimpleOrientation(result);
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::MirrorOrientation(SimpleOrientation orientation)
|
||||
{
|
||||
// This only affects the 90 and 270 degree cases, because rotating 0 and 180 degrees is the same clockwise and counter-clockwise
|
||||
switch (orientation)
|
||||
{
|
||||
case SimpleOrientation::Rotated90DegreesCounterclockwise:
|
||||
return SimpleOrientation::Rotated270DegreesCounterclockwise;
|
||||
case SimpleOrientation::Rotated270DegreesCounterclockwise:
|
||||
return SimpleOrientation::Rotated90DegreesCounterclockwise;
|
||||
}
|
||||
return orientation;
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::AddOrientations(SimpleOrientation a, SimpleOrientation b)
|
||||
{
|
||||
auto aRot = ConvertSimpleOrientationToClockwiseDegrees(a);
|
||||
auto bRot = ConvertSimpleOrientationToClockwiseDegrees(b);
|
||||
auto result = (aRot + bRot) % 360;
|
||||
return ConvertClockwiseDegreesToSimpleOrientation(result);
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::ConvertClockwiseDegreesToSimpleOrientation(int orientation)
|
||||
{
|
||||
switch (orientation)
|
||||
{
|
||||
case 270:
|
||||
return SimpleOrientation::Rotated90DegreesCounterclockwise;
|
||||
case 180:
|
||||
return SimpleOrientation::Rotated180DegreesCounterclockwise;
|
||||
case 90:
|
||||
return SimpleOrientation::Rotated270DegreesCounterclockwise;
|
||||
case 0:
|
||||
default:
|
||||
return SimpleOrientation::NotRotated;
|
||||
}
|
||||
}
|
||||
|
||||
void CameraRotationHelper::SimpleOrientationSensor_OrientationChanged(IInspectable const&, IInspectable const&)
|
||||
{
|
||||
if (m_orientationSensor.GetCurrentOrientation() != SimpleOrientation::Faceup && m_orientationSensor.GetCurrentOrientation() != SimpleOrientation::Facedown)
|
||||
{
|
||||
// Only raise the OrientationChanged event if the device is not parallel to the ground. This allows users to take pictures of documents (FaceUp)
|
||||
// or the ceiling (FaceDown) in portrait or landscape, by first holding the device in the desired orientation, and then pointing the camera
|
||||
// either up or down, at the desired subject.
|
||||
//Note: This assumes that the camera is either facing the same way as the screen, or the opposite way. For devices with cameras mounted
|
||||
// on other panels, this logic should be adjusted.
|
||||
m_orientationChangedEvent(*this, false);
|
||||
}
|
||||
}
|
||||
|
||||
void CameraRotationHelper::DisplayInformation_OrientationChanged(IInspectable const&, IInspectable const&)
|
||||
{
|
||||
m_orientationChangedEvent(*this, true);
|
||||
}
|
||||
|
||||
bool CameraRotationHelper::ShouldMirrorPreview()
|
||||
{
|
||||
// It is recommended that applications mirror the preview for front-facing cameras, as it gives users a more natural experience, since it behaves more like a mirror
|
||||
return (m_cameraEnclosureLocation.Panel() == Panel::Front);
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::GetCameraOrientationRelativeToNativeOrientation()
|
||||
{
|
||||
// Get the rotation angle of the camera enclosure as it is mounted in the device hardware
|
||||
auto enclosureAngle = ConvertClockwiseDegreesToSimpleOrientation(static_cast<int>(m_cameraEnclosureLocation.RotationAngleInDegreesClockwise()));
|
||||
|
||||
// Account for the fact that, on portrait-first devices, the built in camera sensor is read at a 90 degree offset to the native orientation
|
||||
if (m_displayInformation.NativeOrientation() == DisplayOrientations::Portrait &&
|
||||
!IsEnclosureLocationExternal(m_cameraEnclosureLocation))
|
||||
{
|
||||
enclosureAngle = AddOrientations(SimpleOrientation::Rotated90DegreesCounterclockwise, enclosureAngle);
|
||||
}
|
||||
|
||||
return enclosureAngle;
|
||||
}
|
||||
|
||||
winrt::event_token CameraRotationHelper::OrientationChanged(Windows::Foundation::EventHandler<bool> const& handler)
|
||||
{
|
||||
return m_orientationChangedEvent.add(handler);
|
||||
}
|
||||
|
||||
void CameraRotationHelper::OrientationChanged(winrt::event_token const& token) noexcept
|
||||
{
|
||||
m_orientationChangedEvent.remove(token);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
PhotoOrientation CameraRotationHelper::GetConvertedCameraCaptureOrientation() {
|
||||
auto orientation = GetCameraCaptureOrientation();
|
||||
return ConvertSimpleOrientationToPhotoOrientation(orientation);
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::GetCameraCaptureOrientation() {
|
||||
if (IsEnclosureLocationExternal(m_cameraEnclosureLocation)) {
|
||||
// Cameras that are not attached to the device do not rotate along with it, so apply no rotation
|
||||
return SimpleOrientation::NotRotated;
|
||||
}
|
||||
|
||||
// Get the device orientation offset by the camera hardware offset
|
||||
auto deviceOrientation =
|
||||
m_orientationSensor ? m_orientationSensor.GetCurrentOrientation() : SimpleOrientation::NotRotated;
|
||||
auto result = SubtractOrientations(deviceOrientation, GetCameraOrientationRelativeToNativeOrientation());
|
||||
|
||||
// If the preview is being mirrored for a front-facing camera, then the rotation should be inverted
|
||||
if (ShouldMirrorPreview()) {
|
||||
result = MirrorOrientation(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::GetCameraPreviewOrientation() {
|
||||
if (IsEnclosureLocationExternal(m_cameraEnclosureLocation)) {
|
||||
// Cameras that are not attached to the device do not rotate along with it, so apply no rotation
|
||||
return SimpleOrientation::NotRotated;
|
||||
}
|
||||
|
||||
// Get the app display rotation offset by the camera hardware offset
|
||||
auto result = ConvertDisplayOrientationToSimpleOrientation(m_displayInformation.CurrentOrientation());
|
||||
result = SubtractOrientations(result, GetCameraOrientationRelativeToNativeOrientation());
|
||||
|
||||
// If the preview is being mirrored for a front-facing camera, then the rotation should be inverted
|
||||
if (ShouldMirrorPreview()) {
|
||||
result = MirrorOrientation(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int CameraRotationHelper::GetCameraPreviewClockwiseDegrees() {
|
||||
auto rotation = GetCameraPreviewOrientation();
|
||||
return ConvertSimpleOrientationToClockwiseDegrees(rotation);
|
||||
}
|
||||
|
||||
PhotoOrientation CameraRotationHelper::ConvertSimpleOrientationToPhotoOrientation(SimpleOrientation orientation) {
|
||||
switch (orientation) {
|
||||
case SimpleOrientation::Rotated90DegreesCounterclockwise:
|
||||
return PhotoOrientation::Rotate90;
|
||||
case SimpleOrientation::Rotated180DegreesCounterclockwise:
|
||||
return PhotoOrientation::Rotate180;
|
||||
case SimpleOrientation::Rotated270DegreesCounterclockwise:
|
||||
return PhotoOrientation::Rotate270;
|
||||
case SimpleOrientation::NotRotated:
|
||||
default:
|
||||
return PhotoOrientation::Normal;
|
||||
}
|
||||
}
|
||||
|
||||
int CameraRotationHelper::ConvertSimpleOrientationToClockwiseDegrees(SimpleOrientation orientation) {
|
||||
switch (orientation) {
|
||||
case SimpleOrientation::Rotated90DegreesCounterclockwise:
|
||||
return 270;
|
||||
case SimpleOrientation::Rotated180DegreesCounterclockwise:
|
||||
return 180;
|
||||
case SimpleOrientation::Rotated270DegreesCounterclockwise:
|
||||
return 90;
|
||||
case SimpleOrientation::NotRotated:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::ConvertDisplayOrientationToSimpleOrientation(DisplayOrientations orientation) {
|
||||
SimpleOrientation result;
|
||||
switch (orientation) {
|
||||
case DisplayOrientations::Landscape:
|
||||
result = SimpleOrientation::NotRotated;
|
||||
break;
|
||||
case DisplayOrientations::PortraitFlipped:
|
||||
result = SimpleOrientation::Rotated90DegreesCounterclockwise;
|
||||
break;
|
||||
case DisplayOrientations::LandscapeFlipped:
|
||||
result = SimpleOrientation::Rotated180DegreesCounterclockwise;
|
||||
break;
|
||||
case DisplayOrientations::Portrait:
|
||||
default:
|
||||
result = SimpleOrientation::Rotated270DegreesCounterclockwise;
|
||||
break;
|
||||
}
|
||||
|
||||
// Above assumes landscape; offset is needed if native orientation is portrait
|
||||
if (m_displayInformation.NativeOrientation() == DisplayOrientations::Portrait) {
|
||||
result = AddOrientations(result, SimpleOrientation::Rotated90DegreesCounterclockwise);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::SubtractOrientations(SimpleOrientation a, SimpleOrientation b) {
|
||||
auto aRot = ConvertSimpleOrientationToClockwiseDegrees(a);
|
||||
auto bRot = ConvertSimpleOrientationToClockwiseDegrees(b);
|
||||
// Add 360 to ensure the modulus operator does not operate on a negative
|
||||
auto result = (360 + (aRot - bRot)) % 360;
|
||||
return ConvertClockwiseDegreesToSimpleOrientation(result);
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::MirrorOrientation(SimpleOrientation orientation) {
|
||||
// This only affects the 90 and 270 degree cases, because rotating 0 and 180 degrees is the same clockwise and
|
||||
// counter-clockwise
|
||||
switch (orientation) {
|
||||
case SimpleOrientation::Rotated90DegreesCounterclockwise:
|
||||
return SimpleOrientation::Rotated270DegreesCounterclockwise;
|
||||
case SimpleOrientation::Rotated270DegreesCounterclockwise:
|
||||
return SimpleOrientation::Rotated90DegreesCounterclockwise;
|
||||
}
|
||||
return orientation;
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::AddOrientations(SimpleOrientation a, SimpleOrientation b) {
|
||||
auto aRot = ConvertSimpleOrientationToClockwiseDegrees(a);
|
||||
auto bRot = ConvertSimpleOrientationToClockwiseDegrees(b);
|
||||
auto result = (aRot + bRot) % 360;
|
||||
return ConvertClockwiseDegreesToSimpleOrientation(result);
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::ConvertClockwiseDegreesToSimpleOrientation(int orientation) {
|
||||
switch (orientation) {
|
||||
case 270:
|
||||
return SimpleOrientation::Rotated90DegreesCounterclockwise;
|
||||
case 180:
|
||||
return SimpleOrientation::Rotated180DegreesCounterclockwise;
|
||||
case 90:
|
||||
return SimpleOrientation::Rotated270DegreesCounterclockwise;
|
||||
case 0:
|
||||
default:
|
||||
return SimpleOrientation::NotRotated;
|
||||
}
|
||||
}
|
||||
|
||||
void CameraRotationHelper::SimpleOrientationSensor_OrientationChanged(IInspectable const &, IInspectable const &) {
|
||||
if (m_orientationSensor.GetCurrentOrientation() != SimpleOrientation::Faceup &&
|
||||
m_orientationSensor.GetCurrentOrientation() != SimpleOrientation::Facedown) {
|
||||
// Only raise the OrientationChanged event if the device is not parallel to the ground. This allows users to take
|
||||
// pictures of documents (FaceUp) or the ceiling (FaceDown) in portrait or landscape, by first holding the device in
|
||||
// the desired orientation, and then pointing the camera either up or down, at the desired subject.
|
||||
// Note: This assumes that the camera is either facing the same way as the screen, or the opposite way. For devices
|
||||
// with cameras mounted
|
||||
// on other panels, this logic should be adjusted.
|
||||
m_orientationChangedEvent(*this, false);
|
||||
}
|
||||
}
|
||||
|
||||
void CameraRotationHelper::DisplayInformation_OrientationChanged(IInspectable const &, IInspectable const &) {
|
||||
m_orientationChangedEvent(*this, true);
|
||||
}
|
||||
|
||||
bool CameraRotationHelper::ShouldMirrorPreview() {
|
||||
// It is recommended that applications mirror the preview for front-facing cameras, as it gives users a more natural
|
||||
// experience, since it behaves more like a mirror
|
||||
return (m_cameraEnclosureLocation.Panel() == Panel::Front);
|
||||
}
|
||||
|
||||
SimpleOrientation CameraRotationHelper::GetCameraOrientationRelativeToNativeOrientation() {
|
||||
// Get the rotation angle of the camera enclosure as it is mounted in the device hardware
|
||||
auto enclosureAngle = ConvertClockwiseDegreesToSimpleOrientation(
|
||||
static_cast<int>(m_cameraEnclosureLocation.RotationAngleInDegreesClockwise()));
|
||||
|
||||
// Account for the fact that, on portrait-first devices, the built in camera sensor is read at a 90 degree offset to
|
||||
// the native orientation
|
||||
if (m_displayInformation.NativeOrientation() == DisplayOrientations::Portrait &&
|
||||
!IsEnclosureLocationExternal(m_cameraEnclosureLocation)) {
|
||||
enclosureAngle = AddOrientations(SimpleOrientation::Rotated90DegreesCounterclockwise, enclosureAngle);
|
||||
}
|
||||
|
||||
return enclosureAngle;
|
||||
}
|
||||
|
||||
winrt::event_token CameraRotationHelper::OrientationChanged(Windows::Foundation::EventHandler<bool> const &handler) {
|
||||
return m_orientationChangedEvent.add(handler);
|
||||
}
|
||||
|
||||
void CameraRotationHelper::OrientationChanged(winrt::event_token const &token) noexcept {
|
||||
m_orientationChangedEvent.remove(token);
|
||||
}
|
||||
} // namespace winrt::ReactNativeCameraCPP::implementation
|
||||
|
||||
@ -1,62 +1,69 @@
|
||||
#pragma once
|
||||
|
||||
#include "winrt/Windows.Graphics.Display.h"
|
||||
|
||||
#include "CameraRotationHelper.g.h"
|
||||
|
||||
// This is a Cpp/WinRT implementation of the Camera Rotation Helper class(C#) on MSDN:
|
||||
// https://docs.microsoft.com/en-us/windows/uwp/audio-video-camera/handle-device-orientation-with-mediacapture#camerarotationhelper-full-code-listing
|
||||
|
||||
namespace winrt::ReactNativeCameraCPP::implementation
|
||||
{
|
||||
struct CameraRotationHelper : CameraRotationHelperT<CameraRotationHelper>
|
||||
{
|
||||
public:
|
||||
CameraRotationHelper(winrt::Windows::Devices::Enumeration::EnclosureLocation location);
|
||||
winrt::event_token OrientationChanged(Windows::Foundation::EventHandler<bool> const& handler);
|
||||
void OrientationChanged(winrt::event_token const& token) noexcept;
|
||||
namespace winrt::ReactNativeCameraCPP::implementation {
|
||||
struct CameraRotationHelper : CameraRotationHelperT<CameraRotationHelper> {
|
||||
public:
|
||||
CameraRotationHelper(winrt::Windows::Devices::Enumeration::EnclosureLocation location);
|
||||
winrt::event_token OrientationChanged(Windows::Foundation::EventHandler<bool> const &handler);
|
||||
void OrientationChanged(winrt::event_token const &token) noexcept;
|
||||
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation GetCameraCaptureOrientation();
|
||||
winrt::Windows::Storage::FileProperties::PhotoOrientation GetConvertedCameraCaptureOrientation();
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation GetCameraPreviewOrientation();
|
||||
int GetCameraPreviewClockwiseDegrees();
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation GetCameraCaptureOrientation();
|
||||
winrt::Windows::Storage::FileProperties::PhotoOrientation GetConvertedCameraCaptureOrientation();
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation GetCameraPreviewOrientation();
|
||||
int GetCameraPreviewClockwiseDegrees();
|
||||
|
||||
private:
|
||||
private:
|
||||
bool IsEnclosureLocationExternal(winrt::Windows::Devices::Enumeration::EnclosureLocation enclosureLocation) {
|
||||
return (
|
||||
enclosureLocation == nullptr ||
|
||||
enclosureLocation.Panel() == winrt::Windows::Devices::Enumeration::Panel::Unknown);
|
||||
}
|
||||
bool ShouldMirrorPreview();
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation GetCameraOrientationRelativeToNativeOrientation();
|
||||
|
||||
bool IsEnclosureLocationExternal(winrt::Windows::Devices::Enumeration::EnclosureLocation enclosureLocation)
|
||||
{
|
||||
return (enclosureLocation == nullptr || enclosureLocation.Panel() == winrt::Windows::Devices::Enumeration::Panel::Unknown);
|
||||
}
|
||||
bool ShouldMirrorPreview();
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation GetCameraOrientationRelativeToNativeOrientation();
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation SubtractOrientations(
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation a,
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation b);
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation MirrorOrientation(
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation orientation);
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation AddOrientations(
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation a,
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation b);
|
||||
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation SubtractOrientations(
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation a,
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation b);
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation MirrorOrientation(winrt::Windows::Devices::Sensors::SimpleOrientation orientation);
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation AddOrientations(winrt::Windows::Devices::Sensors::SimpleOrientation a, winrt::Windows::Devices::Sensors::SimpleOrientation b);
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation ConvertDisplayOrientationToSimpleOrientation(
|
||||
Windows::Graphics::Display::DisplayOrientations orientation);
|
||||
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation ConvertDisplayOrientationToSimpleOrientation(Windows::Graphics::Display::DisplayOrientations orientation);
|
||||
|
||||
static winrt::Windows::Storage::FileProperties::PhotoOrientation ConvertSimpleOrientationToPhotoOrientation(
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation orientation);
|
||||
static int ConvertSimpleOrientationToClockwiseDegrees(winrt::Windows::Devices::Sensors::SimpleOrientation orientation);
|
||||
static winrt::Windows::Devices::Sensors::SimpleOrientation ConvertClockwiseDegreesToSimpleOrientation(int orientation);
|
||||
static winrt::Windows::Storage::FileProperties::PhotoOrientation ConvertSimpleOrientationToPhotoOrientation(
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation orientation);
|
||||
static int ConvertSimpleOrientationToClockwiseDegrees(
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientation orientation);
|
||||
static winrt::Windows::Devices::Sensors::SimpleOrientation ConvertClockwiseDegreesToSimpleOrientation(
|
||||
int orientation);
|
||||
|
||||
void SimpleOrientationSensor_OrientationChanged(IInspectable const& sender, IInspectable const& args);
|
||||
void DisplayInformation_OrientationChanged(IInspectable const& sender, IInspectable const& args);
|
||||
void SimpleOrientationSensor_OrientationChanged(IInspectable const &sender, IInspectable const &args);
|
||||
void DisplayInformation_OrientationChanged(IInspectable const &sender, IInspectable const &args);
|
||||
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientationSensor::OrientationChanged_revoker m_sensorOrientationChanged_revoker{};
|
||||
winrt::Windows::Graphics::Display::DisplayInformation::OrientationChanged_revoker m_displayOrientationChanged_revoker{};
|
||||
|
||||
winrt::Windows::Devices::Enumeration::EnclosureLocation m_cameraEnclosureLocation{nullptr};
|
||||
winrt::event<Windows::Foundation::EventHandler<bool>> m_orientationChangedEvent;
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientationSensor m_orientationSensor{ winrt::Windows::Devices::Sensors::SimpleOrientationSensor::GetDefault() };
|
||||
winrt::Windows::Graphics::Display::DisplayInformation m_displayInformation{ winrt::Windows::Graphics::Display::DisplayInformation::GetForCurrentView() };
|
||||
};
|
||||
}
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientationSensor::OrientationChanged_revoker
|
||||
m_sensorOrientationChanged_revoker{};
|
||||
winrt::Windows::Graphics::Display::DisplayInformation::OrientationChanged_revoker
|
||||
m_displayOrientationChanged_revoker{};
|
||||
|
||||
namespace winrt::ReactNativeCameraCPP::factory_implementation
|
||||
{
|
||||
struct CameraRotationHelper : CameraRotationHelperT<CameraRotationHelper, implementation::CameraRotationHelper>
|
||||
{
|
||||
};
|
||||
}
|
||||
winrt::Windows::Devices::Enumeration::EnclosureLocation m_cameraEnclosureLocation{nullptr};
|
||||
winrt::event<Windows::Foundation::EventHandler<bool>> m_orientationChangedEvent;
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientationSensor m_orientationSensor{
|
||||
winrt::Windows::Devices::Sensors::SimpleOrientationSensor::GetDefault()};
|
||||
winrt::Windows::Graphics::Display::DisplayInformation m_displayInformation{
|
||||
winrt::Windows::Graphics::Display::DisplayInformation::GetForCurrentView()};
|
||||
};
|
||||
} // namespace winrt::ReactNativeCameraCPP::implementation
|
||||
|
||||
namespace winrt::ReactNativeCameraCPP::factory_implementation {
|
||||
struct CameraRotationHelper : CameraRotationHelperT<CameraRotationHelper, implementation::CameraRotationHelper> {};
|
||||
} // namespace winrt::ReactNativeCameraCPP::factory_implementation
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
namespace ReactNativeCameraCPP
|
||||
{
|
||||
[webhosthidden]
|
||||
[default_interface]
|
||||
runtimeclass CameraRotationHelper
|
||||
{
|
||||
CameraRotationHelper(Windows.Devices.Enumeration.EnclosureLocation location);
|
||||
|
||||
Windows.Devices.Sensors.SimpleOrientation GetCameraCaptureOrientation();
|
||||
Windows.Devices.Sensors.SimpleOrientation GetCameraPreviewOrientation();
|
||||
Windows.Storage.FileProperties.PhotoOrientation GetConvertedCameraCaptureOrientation();
|
||||
|
||||
@ -2,138 +2,153 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace winrt::ReactNativeCameraCPP
|
||||
{
|
||||
class ReactCameraContants
|
||||
{
|
||||
public:
|
||||
static const int CameraAspectFill = 0;
|
||||
static const int CameraAspectFit = 1;
|
||||
static const int CameraAspectStretch = 2;
|
||||
static const int CameraCaptureTargetMemory = 0;
|
||||
static const int CameraCaptureTargetDisk = 1;
|
||||
static const int CameraCaptureTargetCameraRoll = 2;
|
||||
static const int CameraCaptureTargetTemp = 3;
|
||||
static const int CameraOrientationAuto = UINT_MAX;
|
||||
static const int CameraOrientationPortrait = (int)winrt::Windows::Devices::Sensors::SimpleOrientation::NotRotated;
|
||||
static const int CameraOrientationPortraitUpsideDown = (int)winrt::Windows::Devices::Sensors::SimpleOrientation::Rotated180DegreesCounterclockwise;
|
||||
static const int CameraOrientationLandscapeLeft = (int)winrt::Windows::Devices::Sensors::SimpleOrientation::Rotated90DegreesCounterclockwise;
|
||||
static const int CameraOrientationLandscapeRight = (int)winrt::Windows::Devices::Sensors::SimpleOrientation::Rotated270DegreesCounterclockwise;
|
||||
static const int CameraTypeFront = (int)winrt::Windows::Devices::Enumeration::Panel::Front;
|
||||
static const int CameraTypeBack = (int)winrt::Windows::Devices::Enumeration::Panel::Back;
|
||||
static const int CameraFlashModeOff = 0;
|
||||
static const int CameraFlashModeOn = 1;
|
||||
static const int CameraFlashModeAuto = 2;
|
||||
static const int CameraTorchModeOff = 0;
|
||||
static const int CameraTorchModeOn = 1;
|
||||
static const int CameraTorchModeAuto = 2;
|
||||
static const int CameraAutoFocusOff = 0;
|
||||
static const int CameraAutoFocusOn = 1;
|
||||
static const int CameraWhiteBalanceAuto = 0;
|
||||
static const int CameraWhiteBalanceSunny = 1;
|
||||
static const int CameraWhiteBalanceCloudy = 2;
|
||||
static const int CameraWhiteBalanceShadow = 3;
|
||||
static const int CameraWhiteBalanceIncandescent = 4;
|
||||
static const int CameraWhiteBalanceFluorescent = 5;
|
||||
static const int CameraCaptureQualityHigh = (int)winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD1080p;
|
||||
static const int CameraCaptureQualityLow = (int)winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD720p;
|
||||
static const int CameraCaptureQuality1080p = (int)winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD1080p;
|
||||
static const int CameraCaptureQuality720p = (int)winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD720p;
|
||||
static const int MediaTypeImage = 1;
|
||||
static const int MediaTypeVideo = 2;
|
||||
namespace winrt::ReactNativeCameraCPP {
|
||||
class ReactCameraConstants {
|
||||
public:
|
||||
static const int CameraAspectFill = 0;
|
||||
static const int CameraAspectFit = 1;
|
||||
static const int CameraAspectStretch = 2;
|
||||
static const int CameraCaptureTargetMemory = 0;
|
||||
static const int CameraCaptureTargetDisk = 1;
|
||||
static const int CameraCaptureTargetCameraRoll = 2;
|
||||
static const int CameraCaptureTargetTemp = 3;
|
||||
static const int CameraOrientationAuto = UINT_MAX;
|
||||
static const int CameraOrientationPortrait = (int)winrt::Windows::Devices::Sensors::SimpleOrientation::NotRotated;
|
||||
static const int CameraOrientationPortraitUpsideDown =
|
||||
(int)winrt::Windows::Devices::Sensors::SimpleOrientation::Rotated180DegreesCounterclockwise;
|
||||
static const int CameraOrientationLandscapeLeft =
|
||||
(int)winrt::Windows::Devices::Sensors::SimpleOrientation::Rotated90DegreesCounterclockwise;
|
||||
static const int CameraOrientationLandscapeRight =
|
||||
(int)winrt::Windows::Devices::Sensors::SimpleOrientation::Rotated270DegreesCounterclockwise;
|
||||
static const int CameraTypeUnknown = (int)winrt::Windows::Devices::Enumeration::Panel::Unknown;
|
||||
static const int CameraTypeFront = (int)winrt::Windows::Devices::Enumeration::Panel::Front;
|
||||
static const int CameraTypeBack = (int)winrt::Windows::Devices::Enumeration::Panel::Back;
|
||||
static const int CameraTypeTop = (int)winrt::Windows::Devices::Enumeration::Panel::Top;
|
||||
static const int CameraTypeBottom = (int)winrt::Windows::Devices::Enumeration::Panel::Bottom;
|
||||
static const int CameraTypeLeft = (int)winrt::Windows::Devices::Enumeration::Panel::Left;
|
||||
static const int CameraTypeRight = (int)winrt::Windows::Devices::Enumeration::Panel::Right;
|
||||
static const int CameraFlashModeOff = 0;
|
||||
static const int CameraFlashModeOn = 1;
|
||||
static const int CameraFlashModeAuto = 2;
|
||||
static const int CameraAutoFocusOff = (int)winrt::Windows::Media::Devices::FocusPreset::Manual;
|
||||
static const int CameraAutoFocusOn = (int)winrt::Windows::Media::Devices::FocusPreset::Auto;
|
||||
static const int CameraWhiteBalanceAuto = (int)winrt::Windows::Media::Devices::ColorTemperaturePreset::Auto;
|
||||
static const int CameraWhiteBalanceSunny = (int)winrt::Windows::Media::Devices::ColorTemperaturePreset::Daylight;
|
||||
static const int CameraWhiteBalanceCloudy = (int)winrt::Windows::Media::Devices::ColorTemperaturePreset::Cloudy;
|
||||
static const int CameraWhiteBalanceShadow = (int)winrt::Windows::Media::Devices::ColorTemperaturePreset::Candlelight;
|
||||
static const int CameraWhiteBalanceIncandescent = (int)winrt::Windows::Media::Devices::ColorTemperaturePreset::Tungsten;
|
||||
static const int CameraWhiteBalanceFluorescent =
|
||||
(int)winrt::Windows::Media::Devices::ColorTemperaturePreset::Fluorescent;
|
||||
static const int CameraVideoQualityAuto =
|
||||
(int)winrt::Windows::Media::MediaProperties::VideoEncodingQuality::Auto;
|
||||
static const int CameraVideoQuality2160P =
|
||||
(int)winrt::Windows::Media::MediaProperties::VideoEncodingQuality::Uhd2160p;
|
||||
static const int CameraVideoQuality1080P =
|
||||
(int)winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD1080p;
|
||||
static const int CameraVideoQuality720P = (int)winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD720p;
|
||||
static const int CameraVideoQualityWVGA = (int)winrt::Windows::Media::MediaProperties::VideoEncodingQuality::Wvga;
|
||||
static const int CameraVideoQualityVGA = (int)winrt::Windows::Media::MediaProperties::VideoEncodingQuality::Vga;
|
||||
static const int CameraVideoCodecH264 = 0;
|
||||
static const int CameraVideoCodecHEVC = 1;
|
||||
static const int CameraVideoCodecWMV = 2;
|
||||
static const int MediaTypeJPG = 1;
|
||||
static const int MediaTypeMP4 = 2;
|
||||
static const int MediaTypeWMV = 3;
|
||||
|
||||
static std::map<std::wstring, int> GetAspectConstants() noexcept {
|
||||
return std::map<std::wstring, int>
|
||||
{
|
||||
{ L"stretch", CameraAspectStretch },
|
||||
{ L"fit", CameraAspectFit },
|
||||
{ L"fill", CameraAspectFill }
|
||||
};
|
||||
}
|
||||
|
||||
static std::map<std::wstring, std::wstring> GetBarcodeConstants() noexcept {
|
||||
return std::map<std::wstring, std::wstring>
|
||||
{
|
||||
{ L"UPC_E", L"32768" },
|
||||
{ L"CODE_39", L"4" },
|
||||
};
|
||||
}
|
||||
|
||||
static std::map<std::wstring, int> GetAutoFocusConstants() noexcept {
|
||||
return std::map<std::wstring, int>
|
||||
{
|
||||
{ L"off", CameraAutoFocusOff },
|
||||
{ L"on", CameraAutoFocusOn },
|
||||
};
|
||||
}
|
||||
|
||||
static std::map<std::wstring, int> GetWhiteBalanceConstants() noexcept {
|
||||
return std::map<std::wstring, int>
|
||||
{
|
||||
{ L"auto", CameraWhiteBalanceAuto },
|
||||
{ L"sunny", CameraWhiteBalanceSunny },
|
||||
{ L"cloudy", CameraWhiteBalanceCloudy },
|
||||
{ L"shadow", CameraWhiteBalanceShadow },
|
||||
{ L"incandescent", CameraWhiteBalanceIncandescent },
|
||||
{ L"fluorescent", CameraWhiteBalanceFluorescent },
|
||||
};
|
||||
}
|
||||
|
||||
static std::map<std::wstring, int> GetTypeConstants() noexcept {
|
||||
return std::map<std::wstring, int>
|
||||
{
|
||||
{ L"front", CameraTypeFront },
|
||||
{ L"back", CameraTypeBack },
|
||||
};
|
||||
}
|
||||
|
||||
static std::map<std::wstring, int> GetCaptureQualityConstants() noexcept {
|
||||
return std::map<std::wstring, int>
|
||||
{
|
||||
{ L"low", CameraCaptureQualityLow },
|
||||
{ L"high", CameraCaptureQualityHigh },
|
||||
{ L"720p", CameraCaptureQuality720p },
|
||||
{ L"1080p", CameraCaptureQuality1080p },
|
||||
};
|
||||
}
|
||||
|
||||
static std::map<std::wstring, int> GetCaptureTargetConstants() noexcept {
|
||||
return std::map<std::wstring, int>
|
||||
{
|
||||
{ L"memory", CameraCaptureTargetMemory },
|
||||
{ L"disk", CameraCaptureTargetDisk },
|
||||
{ L"cameraRoll", CameraCaptureTargetCameraRoll },
|
||||
{ L"temp", CameraCaptureTargetTemp },
|
||||
};
|
||||
}
|
||||
|
||||
static std::map<std::wstring, int> GetOrientationConstants() noexcept {
|
||||
return std::map<std::wstring, int>
|
||||
{
|
||||
{ L"auto", CameraOrientationAuto },
|
||||
{ L"landscapeLeft", CameraOrientationLandscapeLeft },
|
||||
{ L"landscapeRight", CameraOrientationLandscapeRight },
|
||||
{ L"portrait", CameraOrientationPortrait },
|
||||
{ L"portraitUpsideDown", CameraOrientationPortraitUpsideDown },
|
||||
};
|
||||
}
|
||||
|
||||
static std::map<std::wstring, int> GetFlashModeConstants() noexcept {
|
||||
return std::map<std::wstring, int>
|
||||
{
|
||||
{ L"off", CameraFlashModeOff },
|
||||
{ L"on", CameraFlashModeOn },
|
||||
{ L"auto", CameraOrientationAuto },
|
||||
};
|
||||
}
|
||||
|
||||
static std::map<std::wstring, int> GetTorchModeConstants() noexcept {
|
||||
return std::map<std::wstring, int>
|
||||
{
|
||||
{ L"off", CameraTorchModeOff },
|
||||
{ L"on", CameraTorchModeOn },
|
||||
{ L"auto", CameraTorchModeAuto },
|
||||
};
|
||||
}
|
||||
static winrt::Microsoft::ReactNative::JSValueObject GetAspectConstants() noexcept {
|
||||
return winrt::Microsoft::ReactNative::JSValueObject{
|
||||
{"stretch", CameraAspectStretch},
|
||||
{"fit", CameraAspectFit},
|
||||
{"fill", CameraAspectFill}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
static winrt::Microsoft::ReactNative::JSValue GetBarcodeConstants() noexcept {
|
||||
return winrt::Microsoft::ReactNative::JSValue::EmptyObject.Copy();
|
||||
}
|
||||
|
||||
static winrt::Microsoft::ReactNative::JSValueObject GetFaceDetectionConstants() noexcept {
|
||||
return winrt::Microsoft::ReactNative::JSValueObject{
|
||||
{"Mode", winrt::Microsoft::ReactNative::JSValue::EmptyObject.Copy()},
|
||||
{"Landmarks", winrt::Microsoft::ReactNative::JSValue::EmptyObject.Copy()},
|
||||
{"Classifications", winrt::Microsoft::ReactNative::JSValue::EmptyObject.Copy()},
|
||||
};
|
||||
}
|
||||
|
||||
static winrt::Microsoft::ReactNative::JSValueObject GetAutoFocusConstants() noexcept {
|
||||
return winrt::Microsoft::ReactNative::JSValueObject{
|
||||
{"off", CameraAutoFocusOff},
|
||||
{"on", CameraAutoFocusOn},
|
||||
};
|
||||
}
|
||||
|
||||
static winrt::Microsoft::ReactNative::JSValueObject GetWhiteBalanceConstants() noexcept {
|
||||
return winrt::Microsoft::ReactNative::JSValueObject{
|
||||
{"auto", CameraWhiteBalanceAuto},
|
||||
{"sunny", CameraWhiteBalanceSunny},
|
||||
{"cloudy", CameraWhiteBalanceCloudy},
|
||||
{"shadow", CameraWhiteBalanceShadow},
|
||||
{"incandescent", CameraWhiteBalanceIncandescent},
|
||||
{"fluorescent", CameraWhiteBalanceFluorescent},
|
||||
};
|
||||
}
|
||||
|
||||
static winrt::Microsoft::ReactNative::JSValueObject GetTypeConstants() noexcept {
|
||||
return winrt::Microsoft::ReactNative::JSValueObject{
|
||||
{"unknown", CameraTypeUnknown},
|
||||
{"front", CameraTypeFront},
|
||||
{"back", CameraTypeBack},
|
||||
{"top", CameraTypeTop},
|
||||
{"bottom", CameraTypeBottom},
|
||||
{"left", CameraTypeLeft},
|
||||
{"right", CameraTypeRight},
|
||||
};
|
||||
}
|
||||
|
||||
static winrt::Microsoft::ReactNative::JSValueObject GetCaptureQualityConstants() noexcept {
|
||||
return winrt::Microsoft::ReactNative::JSValueObject{
|
||||
{"auto", CameraVideoQualityAuto},
|
||||
{"2160p", CameraVideoQuality2160P},
|
||||
{"1080p", CameraVideoQuality1080P},
|
||||
{"720p", CameraVideoQuality720P},
|
||||
{"480p", CameraVideoQualityWVGA},
|
||||
{"4:3", CameraVideoQualityVGA},
|
||||
};
|
||||
}
|
||||
|
||||
static winrt::Microsoft::ReactNative::JSValueObject GetCaptureCodecConstants() noexcept {
|
||||
return winrt::Microsoft::ReactNative::JSValueObject{
|
||||
{"H264", CameraVideoCodecH264},
|
||||
{"HEVC", CameraVideoCodecHEVC},
|
||||
{"WMV", CameraVideoCodecWMV},
|
||||
};
|
||||
}
|
||||
|
||||
static winrt::Microsoft::ReactNative::JSValueObject GetCaptureTargetConstants() noexcept {
|
||||
return winrt::Microsoft::ReactNative::JSValueObject{
|
||||
{"memory", CameraCaptureTargetMemory},
|
||||
{"disk", CameraCaptureTargetDisk},
|
||||
{"cameraRoll", CameraCaptureTargetCameraRoll},
|
||||
{"temp", CameraCaptureTargetTemp},
|
||||
};
|
||||
}
|
||||
|
||||
static winrt::Microsoft::ReactNative::JSValueObject GetOrientationConstants() noexcept {
|
||||
return winrt::Microsoft::ReactNative::JSValueObject{
|
||||
{"auto", CameraOrientationAuto},
|
||||
{"landscapeLeft", CameraOrientationLandscapeLeft},
|
||||
{"landscapeRight", CameraOrientationLandscapeRight},
|
||||
{"portrait", CameraOrientationPortrait},
|
||||
{"portraitUpsideDown", CameraOrientationPortraitUpsideDown},
|
||||
};
|
||||
}
|
||||
|
||||
static winrt::Microsoft::ReactNative::JSValueObject GetFlashModeConstants() noexcept {
|
||||
return winrt::Microsoft::ReactNative::JSValueObject{
|
||||
{"off", CameraFlashModeOff},
|
||||
{"on", CameraFlashModeOn},
|
||||
{"auto", CameraOrientationAuto},
|
||||
};
|
||||
}
|
||||
};
|
||||
}; // namespace winrt::ReactNativeCameraCPP
|
||||
@ -3,13 +3,16 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include <functional>
|
||||
#include <sstream>
|
||||
#include <system_error>
|
||||
|
||||
#include <winrt/Windows.Devices.Enumeration.h>
|
||||
#include <winrt/Windows.Devices.Sensors.h>
|
||||
#include <winrt/Windows.Media.Mediaproperties.h>
|
||||
#include <winrt/Windows.Storage.Streams.h>
|
||||
#include <winrt/Windows.UI.Core.h>
|
||||
|
||||
#include "NativeModules.h"
|
||||
#include <winrt/Windows.Devices.Sensors.h>
|
||||
#include <winrt/Windows.Devices.Enumeration.h>
|
||||
#include <winrt/Windows.Media.Mediaproperties.h>
|
||||
#include <winrt/Windows.UI.Core.h>
|
||||
#include <winrt/Windows.Storage.Streams.h>
|
||||
|
||||
#include "JSValueTreeWriter.h"
|
||||
#include "ReactCameraConstants.h"
|
||||
@ -17,82 +20,126 @@
|
||||
|
||||
using namespace winrt::Microsoft::ReactNative;
|
||||
|
||||
#ifdef RNW61
|
||||
#define JSVALUEOBJECTPARAMETER
|
||||
#else
|
||||
#define JSVALUEOBJECTPARAMETER const&
|
||||
#endif
|
||||
|
||||
namespace winrt {
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::Media::MediaProperties;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::Storage::Streams;
|
||||
} //namespace winrt
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::Media::MediaProperties;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::Storage::Streams;
|
||||
} // namespace winrt
|
||||
namespace winrt::ReactNativeCameraCPP {
|
||||
REACT_MODULE(RNCameraModule);
|
||||
struct RNCameraModule {
|
||||
const std::string Name = "RNCameraModule";
|
||||
REACT_MODULE(RNCameraModule);
|
||||
struct RNCameraModule {
|
||||
const std::string Name = "RNCameraModule";
|
||||
|
||||
#pragma region Constants
|
||||
REACT_CONSTANT_PROVIDER(ConstantProvider)
|
||||
void ConstantProvider(ReactConstantProvider& provider) noexcept {
|
||||
provider.Add(L"Aspect", ReactCameraContants::GetAspectConstants());
|
||||
provider.Add(L"BarCodeType", ReactCameraContants::GetBarcodeConstants());
|
||||
provider.Add(L"AutoFocus", ReactCameraContants::GetAutoFocusConstants());
|
||||
provider.Add(L"WhiteBalance", ReactCameraContants::GetWhiteBalanceConstants());
|
||||
provider.Add(L"Type", ReactCameraContants::GetTypeConstants());
|
||||
provider.Add(L"VideoQuality", ReactCameraContants::GetCaptureQualityConstants());
|
||||
provider.Add(L"CaptureTarget", ReactCameraContants::GetCaptureTargetConstants());
|
||||
provider.Add(L"Orientation", ReactCameraContants::GetOrientationConstants());
|
||||
provider.Add(L"FlashMode", ReactCameraContants::GetFlashModeConstants());
|
||||
provider.Add(L"TorchMode", ReactCameraContants::GetTorchModeConstants());
|
||||
}
|
||||
|
||||
REACT_METHOD(record)
|
||||
void record(
|
||||
std::map<std::wstring, winrt::Microsoft::ReactNative::JSValue>&& options,
|
||||
int viewTag,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<JSValueObject>&& result) noexcept
|
||||
{
|
||||
try {
|
||||
winrt::ReactNativeCameraCPP::implementation::ReactCameraViewManager::RecordAsync(
|
||||
options,
|
||||
viewTag, result).get(); //block on IAsyncAction
|
||||
}
|
||||
catch (winrt::hresult_error const& ex)
|
||||
{
|
||||
result.Reject(ex.message().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
REACT_METHOD(takePicture)
|
||||
void takePicture(
|
||||
std::map<std::wstring, winrt::Microsoft::ReactNative::JSValue>&& options,
|
||||
int viewTag,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<JSValueObject>&& result) noexcept
|
||||
{
|
||||
try {
|
||||
winrt::ReactNativeCameraCPP::implementation::ReactCameraViewManager::TakePictureAsync(
|
||||
options,
|
||||
viewTag, result).get(); //block on IAsyncAction
|
||||
}
|
||||
catch (winrt::hresult_error const& ex)
|
||||
{
|
||||
result.Reject(ex.message().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
REACT_METHOD(checkMediaCapturePermission)
|
||||
void checkMediaCapturePermission(winrt::Microsoft::ReactNative::ReactPromise<bool>&& result) noexcept
|
||||
{
|
||||
winrt::ReactNativeCameraCPP::implementation::ReactCameraViewManager::CheckMediaCapturePermissionAsync(result).get(); //block on IAsyncAction
|
||||
}
|
||||
REACT_CONSTANT_PROVIDER(ConstantProvider)
|
||||
void ConstantProvider(ReactConstantProvider &provider) noexcept {
|
||||
provider.Add(L"Aspect", ReactCameraConstants::GetAspectConstants());
|
||||
provider.Add(L"BarCodeType", ReactCameraConstants::GetBarcodeConstants());
|
||||
provider.Add(L"FaceDetection", ReactCameraConstants::GetFaceDetectionConstants());
|
||||
provider.Add(L"AutoFocus", ReactCameraConstants::GetAutoFocusConstants());
|
||||
provider.Add(L"WhiteBalance", ReactCameraConstants::GetWhiteBalanceConstants());
|
||||
provider.Add(L"Type", ReactCameraConstants::GetTypeConstants());
|
||||
provider.Add(L"VideoQuality", ReactCameraConstants::GetCaptureQualityConstants());
|
||||
provider.Add(L"VideoCodec", ReactCameraConstants::GetCaptureCodecConstants());
|
||||
provider.Add(L"CaptureTarget", ReactCameraConstants::GetCaptureTargetConstants());
|
||||
provider.Add(L"Orientation", ReactCameraConstants::GetOrientationConstants());
|
||||
provider.Add(L"FlashMode", ReactCameraConstants::GetFlashModeConstants());
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
public:
|
||||
RNCameraModule() = default;
|
||||
#pragma region Methods
|
||||
|
||||
~RNCameraModule() = default;
|
||||
template <class TPromiseResult>
|
||||
winrt::AsyncActionCompletedHandler MakeAsyncActionCompletedHandler(
|
||||
winrt::Microsoft::ReactNative::ReactPromise<TPromiseResult> const &promise) {
|
||||
return [promise](winrt::IAsyncAction action, winrt::AsyncStatus status) {
|
||||
if (status == winrt::AsyncStatus::Error) {
|
||||
std::stringstream errorCode;
|
||||
errorCode << "0x" << std::hex << action.ErrorCode() << std::endl;
|
||||
|
||||
auto error = winrt::Microsoft::ReactNative::ReactError();
|
||||
error.Message = "HRESULT " + errorCode.str() + ": " + std::system_category().message(action.ErrorCode());
|
||||
promise.Reject(error);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace ReactNativeCameraCPP
|
||||
REACT_METHOD(record)
|
||||
void record(
|
||||
winrt::Microsoft::ReactNative::JSValueObject JSVALUEOBJECTPARAMETER options,
|
||||
int viewTag,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<winrt::Microsoft::ReactNative::JSValueObject> const
|
||||
&result) noexcept {
|
||||
auto asyncOp =
|
||||
winrt::ReactNativeCameraCPP::implementation::ReactCameraViewManager::RecordAsync(options, viewTag, result);
|
||||
asyncOp.Completed(MakeAsyncActionCompletedHandler(result));
|
||||
}
|
||||
|
||||
REACT_METHOD(stopRecording)
|
||||
void stopRecording(int viewTag) noexcept {
|
||||
auto asyncOp =
|
||||
winrt::ReactNativeCameraCPP::implementation::ReactCameraViewManager::StopRecordAsync(viewTag);
|
||||
}
|
||||
|
||||
REACT_METHOD(isRecording)
|
||||
void isRecording(int viewTag, winrt::Microsoft::ReactNative::ReactPromise<bool> const &result) noexcept {
|
||||
auto asyncOp = winrt::ReactNativeCameraCPP::implementation::ReactCameraViewManager::IsRecordingAsync(viewTag, result);
|
||||
asyncOp.Completed(MakeAsyncActionCompletedHandler(result));
|
||||
}
|
||||
|
||||
REACT_METHOD(pausePreview)
|
||||
void pausePreview(int viewTag) noexcept {
|
||||
auto asyncOp = winrt::ReactNativeCameraCPP::implementation::ReactCameraViewManager::PausePreviewAsync(viewTag);
|
||||
}
|
||||
|
||||
REACT_METHOD(resumePreview)
|
||||
void resumePreview(int viewTag) noexcept {
|
||||
auto asyncOp = winrt::ReactNativeCameraCPP::implementation::ReactCameraViewManager::ResumePreviewAsync(viewTag);
|
||||
}
|
||||
|
||||
REACT_METHOD(takePicture)
|
||||
void takePicture(
|
||||
winrt::Microsoft::ReactNative::JSValueObject JSVALUEOBJECTPARAMETER options,
|
||||
int viewTag,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<winrt::Microsoft::ReactNative::JSValueObject> const
|
||||
&result) noexcept {
|
||||
auto asyncOp =
|
||||
winrt::ReactNativeCameraCPP::implementation::ReactCameraViewManager::TakePictureAsync(options, viewTag, result);
|
||||
asyncOp.Completed(MakeAsyncActionCompletedHandler(result));
|
||||
}
|
||||
|
||||
REACT_METHOD(checkMediaCapturePermission)
|
||||
void checkMediaCapturePermission(winrt::Microsoft::ReactNative::ReactPromise<bool> const &result) noexcept {
|
||||
auto asyncOp =
|
||||
winrt::ReactNativeCameraCPP::implementation::ReactCameraViewManager::CheckMediaCapturePermissionAsync(result);
|
||||
asyncOp.Completed(MakeAsyncActionCompletedHandler(result));
|
||||
}
|
||||
|
||||
REACT_METHOD(getCameraIds)
|
||||
void getCameraIds(winrt::Microsoft::ReactNative::ReactPromise<winrt::Microsoft::ReactNative::JSValueArray> const
|
||||
&result) noexcept {
|
||||
auto asyncOp = winrt::ReactNativeCameraCPP::implementation::ReactCameraViewManager::GetCameraIdsAsync(result);
|
||||
asyncOp.Completed(MakeAsyncActionCompletedHandler(result));
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
public:
|
||||
RNCameraModule() = default;
|
||||
|
||||
~RNCameraModule() = default;
|
||||
};
|
||||
|
||||
} // namespace winrt::ReactNativeCameraCPP
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,68 +1,126 @@
|
||||
#pragma once
|
||||
#include <pch.h>
|
||||
|
||||
#include "NativeModules.h"
|
||||
#include "JSValueTreeWriter.h"
|
||||
|
||||
#include "CameraRotationHelper.h"
|
||||
#include "JSValueTreeWriter.h"
|
||||
#include "ReactCameraConstants.h"
|
||||
|
||||
namespace winrt::ReactNativeCameraCPP {
|
||||
struct ReactCameraView : winrt::Windows::UI::Xaml::Controls::GridT <ReactCameraView> {
|
||||
public:
|
||||
ReactCameraView() = default;
|
||||
~ReactCameraView();
|
||||
void SetContext(winrt::Microsoft::ReactNative::IReactContext const &reactContext);
|
||||
void Initialize();
|
||||
void UpdateProperties(winrt::Microsoft::ReactNative::IJSValueReader const &propertyMapReader);
|
||||
|
||||
winrt::Windows::Foundation::IAsyncAction TakePictureAsync(std::map<std::wstring, winrt::Microsoft::ReactNative::JSValue> const& options,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<winrt::Microsoft::ReactNative::JSValueObject> &result);
|
||||
winrt::Windows::Foundation::IAsyncAction RecordAsync(std::map<std::wstring, winrt::Microsoft::ReactNative::JSValue> const& options, winrt::Microsoft::ReactNative::ReactPromise<winrt::Microsoft::ReactNative::JSValueObject>& result);
|
||||
struct ReactCameraView : winrt::Windows::UI::Xaml::Controls::GridT<ReactCameraView> {
|
||||
public:
|
||||
ReactCameraView() = default;
|
||||
~ReactCameraView();
|
||||
void SetContext(winrt::Microsoft::ReactNative::IReactContext const &reactContext);
|
||||
void Initialize();
|
||||
void UpdateProperties(winrt::Microsoft::ReactNative::IJSValueReader const &propertyMapReader) noexcept;
|
||||
|
||||
public:
|
||||
static winrt::com_ptr<ReactCameraView> Create();
|
||||
winrt::Windows::Foundation::IAsyncAction TakePictureAsync(
|
||||
winrt::Microsoft::ReactNative::JSValueObject const &options,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<winrt::Microsoft::ReactNative::JSValueObject> const &result) noexcept;
|
||||
winrt::Windows::Foundation::IAsyncAction RecordAsync(
|
||||
winrt::Microsoft::ReactNative::JSValueObject const &options,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<winrt::Microsoft::ReactNative::JSValueObject> const &result) noexcept;
|
||||
winrt::Windows::Foundation::IAsyncAction StopRecordAsync() noexcept;
|
||||
winrt::Windows::Foundation::IAsyncAction IsRecordingAsync(
|
||||
winrt::Microsoft::ReactNative::ReactPromise<bool> const &result) noexcept;
|
||||
winrt::Windows::Foundation::IAsyncAction PausePreviewAsync() noexcept;
|
||||
winrt::Windows::Foundation::IAsyncAction ResumePreviewAsync() noexcept;
|
||||
|
||||
private:
|
||||
void UpdateKeepAwake(bool keepAwake);
|
||||
void UpdateTorchMode(int torchMode);
|
||||
void UpdateFlashMode(int flashMode);
|
||||
void UpdateAspect(int aspect);
|
||||
fire_and_forget UpdateDeviceType(int type);
|
||||
public:
|
||||
static winrt::com_ptr<ReactCameraView> Create();
|
||||
|
||||
winrt::Windows::Foundation::IAsyncAction InitializeAsync();
|
||||
winrt::Windows::Foundation::IAsyncAction CleanupMediaCaptureAsync();
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Devices::Enumeration::DeviceInformation> FindCameraDeviceByPanelAsync();
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::hstring> GetBase64DataAsync(winrt::Windows::Storage::Streams::IRandomAccessStream stream);
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Storage::StorageFile> GetOutputStorageFileAsync(int type, int target);
|
||||
winrt::Windows::Foundation::IAsyncAction DelayStopRecording(int totalRecordingInSecs);
|
||||
winrt::Windows::Foundation::IAsyncAction WaitAndStopRecording();
|
||||
winrt::Windows::Foundation::IAsyncAction UpdatePreviewOrientationAsync();
|
||||
winrt::Windows::Foundation::IAsyncAction UpdateFilePropertiesAsync(winrt::Windows::Storage::StorageFile storageFile,
|
||||
std::map<std::wstring, winrt::Microsoft::ReactNative::JSValue> const& options);
|
||||
private:
|
||||
void UpdateKeepAwake(bool keepAwake);
|
||||
void UpdateFlashMode(int flashMode);
|
||||
void UpdateAutoFocus(int focusMode);
|
||||
void UpdateWhiteBalance(int whiteBalance);
|
||||
void UpdateMirrorVideo(bool mirrorVideo);
|
||||
void UpdateAspect(int aspect);
|
||||
void UpdateDefaultVideoQuality(int videoQuality);
|
||||
|
||||
void OnOrientationChanged(const bool updatePreview);
|
||||
void OnApplicationSuspending();
|
||||
void OnApplicationResuming();
|
||||
winrt::Windows::Foundation::IAsyncAction OnUnloaded();
|
||||
fire_and_forget UpdateDeviceId(std::string cameraId);
|
||||
fire_and_forget UpdateDeviceType(int type);
|
||||
|
||||
bool TryGetValueAsInt(std::map<std::wstring, winrt::Microsoft::ReactNative::JSValue> const& options, const std::wstring key, int& value);
|
||||
winrt::Windows::Foundation::IAsyncAction InitializeAsync();
|
||||
|
||||
winrt::Microsoft::ReactNative::IReactContext m_reactContext{ nullptr };
|
||||
winrt::Windows::UI::Xaml::Controls::CaptureElement m_childElement;
|
||||
winrt::Windows::Foundation::IAsyncAction UpdateMediaStreamPropertiesAsync();
|
||||
winrt::Windows::Foundation::IAsyncAction UpdateMediaStreamPropertiesAsync(int videoQuality);
|
||||
|
||||
handle m_signal{ CreateEvent(nullptr, true, false, nullptr) };
|
||||
winrt::Windows::Media::Capture::LowLagMediaRecording m_mediaRecording{ nullptr};
|
||||
winrt::ReactNativeCameraCPP::CameraRotationHelper m_rotationHelper{nullptr};
|
||||
winrt::Windows::System::Display::DisplayRequest m_displayRequest{ nullptr };
|
||||
winrt::Windows::Foundation::IAsyncAction CleanupMediaCaptureAsync();
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Devices::Enumeration::DeviceInformation>
|
||||
FindCameraDeviceAsync();
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::hstring> GetBase64DataAsync(
|
||||
winrt::Windows::Storage::Streams::IRandomAccessStream stream);
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Storage::StorageFile> GetOutputStorageFileAsync(
|
||||
int type,
|
||||
int target);
|
||||
void DelayStopRecording(float totalRecordingInSecs);
|
||||
winrt::Windows::Foundation::IAsyncAction WaitAndStopRecording();
|
||||
winrt::Windows::Foundation::IAsyncAction UpdatePreviewOrientationAsync();
|
||||
winrt::Windows::Foundation::IAsyncAction UpdateFilePropertiesAsync(
|
||||
winrt::Windows::Storage::StorageFile storageFile,
|
||||
winrt::Microsoft::ReactNative::JSValueObject const &options);
|
||||
|
||||
winrt::event_token m_rotationEventToken{};
|
||||
winrt::Windows::UI::Xaml::Application::Suspending_revoker m_applicationSuspendingEventToken;
|
||||
winrt::Windows::UI::Xaml::Application::Resuming_revoker m_applicationResumingEventToken;
|
||||
winrt::Windows::UI::Xaml::FrameworkElement::Unloaded_revoker m_unloadedEventToken;
|
||||
void OnOrientationChanged(const bool updatePreview);
|
||||
void OnApplicationSuspending();
|
||||
void OnApplicationResuming();
|
||||
winrt::Windows::Foundation::IAsyncAction OnUnloaded();
|
||||
|
||||
bool m_isInitialized{ false };
|
||||
bool m_keepAwake{ false };
|
||||
int m_torchMode{ ReactCameraContants::CameraTorchModeOff };
|
||||
int m_flashMode{ ReactCameraContants::CameraFlashModeOff };
|
||||
winrt::Windows::Devices::Enumeration::Panel m_panelType{ winrt::Windows::Devices::Enumeration::Panel::Unknown };
|
||||
};
|
||||
} // namespace winrt::ReactNativeVideoCPP
|
||||
winrt::Microsoft::ReactNative::JSValueObject GetExifObject(
|
||||
winrt::Windows::Graphics::Imaging::BitmapPropertySet const &properties) noexcept;
|
||||
|
||||
bool TryGetValueAsInt(
|
||||
winrt::Microsoft::ReactNative::JSValueObject const &options,
|
||||
const std::string key,
|
||||
int &value,
|
||||
const int defaultValue) noexcept;
|
||||
|
||||
bool TryGetValueAsBool(
|
||||
winrt::Microsoft::ReactNative::JSValueObject const &options,
|
||||
const std::string key,
|
||||
bool &value,
|
||||
const bool defaultValue) noexcept;
|
||||
|
||||
bool TryGetValueAsFloat(
|
||||
winrt::Microsoft::ReactNative::JSValueObject const &options,
|
||||
const std::string key,
|
||||
float &value,
|
||||
const float defaultValue) noexcept;
|
||||
|
||||
winrt::Microsoft::ReactNative::IReactContext m_reactContext{nullptr};
|
||||
winrt::Windows::UI::Xaml::Controls::CaptureElement m_childElement;
|
||||
|
||||
handle m_signal{CreateEvent(nullptr, true, false, nullptr)};
|
||||
winrt::Windows::Media::Capture::LowLagMediaRecording m_mediaRecording{nullptr};
|
||||
winrt::ReactNativeCameraCPP::CameraRotationHelper m_rotationHelper{nullptr};
|
||||
winrt::Windows::System::Display::DisplayRequest m_displayRequest{nullptr};
|
||||
|
||||
winrt::Windows::System::Threading::ThreadPoolTimer m_recordTimer{nullptr};
|
||||
|
||||
winrt::event_token m_rotationEventToken{};
|
||||
winrt::Windows::UI::Xaml::Application::Suspending_revoker m_applicationSuspendingEventToken;
|
||||
winrt::Windows::UI::Xaml::Application::Resuming_revoker m_applicationResumingEventToken;
|
||||
winrt::Windows::UI::Xaml::FrameworkElement::Unloaded_revoker m_unloadedEventToken;
|
||||
|
||||
bool m_isInitialized{false};
|
||||
bool m_keepAwake{false};
|
||||
bool m_isRecording{false};
|
||||
int m_flashMode{ReactCameraConstants::CameraFlashModeOff};
|
||||
int m_whiteBalance{ReactCameraConstants::CameraWhiteBalanceAuto};
|
||||
int m_focusMode{ReactCameraConstants::CameraAutoFocusOn};
|
||||
bool m_isPreview{false};
|
||||
bool m_mirrorVideo{false};
|
||||
|
||||
std::string m_cameraId;
|
||||
|
||||
winrt::Windows::Devices::Enumeration::Panel m_panelType{winrt::Windows::Devices::Enumeration::Panel::Unknown};
|
||||
|
||||
winrt::Windows::Foundation::Collections::IVectorView<winrt::Windows::Media::MediaProperties::IMediaEncodingProperties>
|
||||
m_availableVideoEncodingProperties;
|
||||
|
||||
int m_defaultVideoQuality{ReactCameraConstants::CameraVideoQualityAuto};
|
||||
|
||||
};
|
||||
} // namespace winrt::ReactNativeCameraCPP
|
||||
|
||||
@ -5,152 +5,213 @@
|
||||
#include <iomanip>
|
||||
|
||||
namespace winrt {
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::Devices::Enumeration;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::Media::MediaProperties;
|
||||
using namespace Windows::Storage;
|
||||
using namespace Windows::Storage::Streams;
|
||||
using namespace Microsoft::ReactNative;
|
||||
} //namespace winrt
|
||||
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::Devices::Enumeration;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::Media::MediaProperties;
|
||||
using namespace Windows::Storage;
|
||||
using namespace Windows::Storage::Streams;
|
||||
using namespace Microsoft::ReactNative;
|
||||
} // namespace winrt
|
||||
|
||||
namespace winrt::ReactNativeCameraCPP::implementation {
|
||||
// static vector to contain all currently active camera view instances
|
||||
// This is a temporary workaround to map the view tag to view instance, since
|
||||
// Method call from ReactCameraModule constains view tag as parameter and we need
|
||||
// to forward the call to CameraView instance.
|
||||
std::vector<winrt::com_ptr<ReactNativeCameraCPP::ReactCameraView>> ReactCameraViewManager::m_cameraViewInstances;
|
||||
// static vector to contain all currently active camera view instances
|
||||
// This is a temporary workaround to map the view tag to view instance, since
|
||||
// Method call from ReactCameraModule constains view tag as parameter and we need
|
||||
// to forward the call to CameraView instance.
|
||||
std::vector<winrt::com_ptr<ReactNativeCameraCPP::ReactCameraView>> ReactCameraViewManager::m_cameraViewInstances;
|
||||
|
||||
ReactCameraViewManager::ReactCameraViewManager() {}
|
||||
ReactCameraViewManager::ReactCameraViewManager() {}
|
||||
|
||||
// IViewManager
|
||||
hstring ReactCameraViewManager::Name() noexcept {
|
||||
return L"RNCamera";
|
||||
// IViewManager
|
||||
hstring ReactCameraViewManager::Name() noexcept {
|
||||
return L"RNCamera";
|
||||
}
|
||||
|
||||
FrameworkElement ReactCameraViewManager::CreateView() noexcept {
|
||||
auto const &view = ReactNativeCameraCPP::ReactCameraView::Create();
|
||||
view->SetContext(m_reactContext);
|
||||
m_cameraViewInstances.emplace_back(view);
|
||||
|
||||
return view.as<winrt::Grid>();
|
||||
}
|
||||
|
||||
// IViewManagerWithReactContext
|
||||
IReactContext ReactCameraViewManager::ReactContext() noexcept {
|
||||
return m_reactContext;
|
||||
}
|
||||
|
||||
void ReactCameraViewManager::ReactContext(IReactContext reactContext) noexcept {
|
||||
m_reactContext = reactContext;
|
||||
}
|
||||
|
||||
// IViewManagerWithNativeProperties
|
||||
IMapView<hstring, ViewManagerPropertyType> ReactCameraViewManager::NativeProps() noexcept {
|
||||
auto nativeProps = winrt::single_threaded_map<hstring, ViewManagerPropertyType>();
|
||||
|
||||
nativeProps.Insert(L"aspect", ViewManagerPropertyType::Number);
|
||||
nativeProps.Insert(L"type", ViewManagerPropertyType::Number);
|
||||
nativeProps.Insert(L"cameraId", ViewManagerPropertyType::String);
|
||||
nativeProps.Insert(L"autoFocus", ViewManagerPropertyType::Boolean);
|
||||
nativeProps.Insert(L"whiteBalance", ViewManagerPropertyType::Number);
|
||||
nativeProps.Insert(L"torchMode", ViewManagerPropertyType::Number);
|
||||
nativeProps.Insert(L"flashMode", ViewManagerPropertyType::Number);
|
||||
// nativeProps.Insert(L"barcodeScannerEnabled", ViewManagerPropertyType::Boolean);
|
||||
// nativeProps.Insert(L"barCodeTypes", ViewManagerPropertyType::Array);
|
||||
nativeProps.Insert(L"keepAwake", ViewManagerPropertyType::Boolean);
|
||||
nativeProps.Insert(L"mirrorVideo", ViewManagerPropertyType::Boolean);
|
||||
nativeProps.Insert(L"defaultVideoQuality", ViewManagerPropertyType::Number);
|
||||
|
||||
return nativeProps.GetView();
|
||||
}
|
||||
|
||||
void ReactCameraViewManager::UpdateProperties(
|
||||
FrameworkElement const &view,
|
||||
IJSValueReader const &propertyMapReader) noexcept {
|
||||
if (auto reactCameraView = view.try_as<ReactNativeCameraCPP::ReactCameraView>()) {
|
||||
reactCameraView->UpdateProperties(propertyMapReader);
|
||||
}
|
||||
}
|
||||
|
||||
void ReactCameraViewManager::RemoveViewFromList(winrt::com_ptr<ReactNativeCameraCPP::ReactCameraView> view) {
|
||||
auto it = std::find(m_cameraViewInstances.begin(), m_cameraViewInstances.end(), view);
|
||||
if (it != m_cameraViewInstances.end())
|
||||
m_cameraViewInstances.erase(it);
|
||||
}
|
||||
|
||||
IAsyncAction ReactCameraViewManager::TakePictureAsync(
|
||||
JSValueObject const &options,
|
||||
int viewTag,
|
||||
ReactPromise<JSValueObject> const &result) noexcept {
|
||||
auto capturedPromise = result;
|
||||
auto capturedOptions = options.Copy();
|
||||
|
||||
auto index = co_await FindCamera(viewTag);
|
||||
if (index != -1) {
|
||||
auto cameraView = m_cameraViewInstances.at(index);
|
||||
co_await cameraView->TakePictureAsync(capturedOptions, capturedPromise);
|
||||
} else {
|
||||
capturedPromise.Reject("No camera instance found.");
|
||||
}
|
||||
}
|
||||
|
||||
IAsyncAction ReactCameraViewManager::RecordAsync(
|
||||
JSValueObject const &options,
|
||||
int viewTag,
|
||||
ReactPromise<JSValueObject> const &result) noexcept {
|
||||
auto capturedPromise = result;
|
||||
auto capturedOptions = options.Copy();
|
||||
|
||||
auto index = co_await FindCamera(viewTag);
|
||||
if (index != -1) {
|
||||
auto cameraView = m_cameraViewInstances.at(index);
|
||||
co_await cameraView->RecordAsync(capturedOptions, capturedPromise);
|
||||
} else {
|
||||
capturedPromise.Reject("No camera instance found.");
|
||||
}
|
||||
}
|
||||
|
||||
IAsyncAction ReactCameraViewManager::StopRecordAsync(int viewTag) noexcept {
|
||||
auto index = co_await FindCamera(viewTag);
|
||||
if (index != -1) {
|
||||
auto cameraView = m_cameraViewInstances.at(index);
|
||||
co_await cameraView->StopRecordAsync();
|
||||
}
|
||||
}
|
||||
|
||||
IAsyncAction ReactCameraViewManager::IsRecordingAsync(
|
||||
int viewTag,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<bool> const& result) noexcept {
|
||||
auto capturedPromise = result;
|
||||
|
||||
auto index = co_await FindCamera(viewTag);
|
||||
if (index != -1) {
|
||||
auto cameraView = m_cameraViewInstances.at(index);
|
||||
co_await cameraView->IsRecordingAsync(capturedPromise);
|
||||
} else {
|
||||
capturedPromise.Reject("No camera instance found.");
|
||||
}
|
||||
}
|
||||
|
||||
IAsyncAction ReactCameraViewManager::PausePreviewAsync(int viewTag) noexcept {
|
||||
auto index = co_await FindCamera(viewTag);
|
||||
if (index != -1) {
|
||||
auto cameraView = m_cameraViewInstances.at(index);
|
||||
co_await cameraView->PausePreviewAsync();
|
||||
}
|
||||
}
|
||||
|
||||
IAsyncAction ReactCameraViewManager::ResumePreviewAsync(int viewTag) noexcept {
|
||||
auto index = co_await FindCamera(viewTag);
|
||||
if (index != -1) {
|
||||
auto cameraView = m_cameraViewInstances.at(index);
|
||||
co_await cameraView->ResumePreviewAsync();
|
||||
}
|
||||
}
|
||||
|
||||
// Intialize MediaCapture and will bring up the constent dialog if this
|
||||
// is the first time. RNC will display a progress indicator while waiting
|
||||
// for user click. This method will resolve as no permission if user does
|
||||
// not grant the permission or App does not have the appx capabilities for
|
||||
// Microphone and WebCam specified in its Package.Appxmanifest.
|
||||
IAsyncAction ReactCameraViewManager::CheckMediaCapturePermissionAsync(
|
||||
winrt::Microsoft::ReactNative::ReactPromise<bool> const &result) noexcept {
|
||||
auto capturedPromise = result;
|
||||
|
||||
auto mediaCapture = winrt::Windows::Media::Capture::MediaCapture();
|
||||
bool hasPermission = true;
|
||||
try {
|
||||
co_await mediaCapture.InitializeAsync();
|
||||
} catch (winrt::hresult_error const &) {
|
||||
hasPermission = false;
|
||||
}
|
||||
|
||||
capturedPromise.Resolve(hasPermission);
|
||||
}
|
||||
|
||||
winrt::IAsyncAction ReactCameraViewManager::GetCameraIdsAsync(
|
||||
winrt::ReactPromise<winrt::JSValueArray> const& result) noexcept {
|
||||
auto capturedPromise = result;
|
||||
|
||||
auto allVideoDevices = co_await winrt::DeviceInformation::FindAllAsync(winrt::DeviceClass::VideoCapture);
|
||||
|
||||
winrt::JSValueArray resultArray;
|
||||
|
||||
for (auto cameraDeviceInfo : allVideoDevices) {
|
||||
if (cameraDeviceInfo.IsEnabled()) {
|
||||
resultArray.push_back(winrt::JSValueObject{
|
||||
{"id", winrt::to_string(cameraDeviceInfo.Id())},
|
||||
{"name", winrt::to_string(cameraDeviceInfo.Name())},
|
||||
{"type",
|
||||
cameraDeviceInfo.EnclosureLocation() ? static_cast<int>(cameraDeviceInfo.EnclosureLocation().Panel())
|
||||
: ReactCameraConstants::CameraTypeUnknown},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
FrameworkElement ReactCameraViewManager::CreateView() noexcept {
|
||||
auto const& view = ReactNativeCameraCPP::ReactCameraView::Create();
|
||||
view->SetContext(m_reactContext);
|
||||
m_cameraViewInstances.emplace_back(view);
|
||||
capturedPromise.Resolve(resultArray);
|
||||
|
||||
return view.as<winrt::Grid>();
|
||||
}
|
||||
|
||||
// IViewManagerWithReactContext
|
||||
IReactContext ReactCameraViewManager::ReactContext() noexcept {
|
||||
return m_reactContext;
|
||||
}
|
||||
|
||||
void ReactCameraViewManager::ReactContext(IReactContext reactContext) noexcept {
|
||||
m_reactContext = reactContext;
|
||||
}
|
||||
|
||||
// IViewManagerWithNativeProperties
|
||||
IMapView<hstring, ViewManagerPropertyType> ReactCameraViewManager::NativeProps() noexcept {
|
||||
auto nativeProps = winrt::single_threaded_map<hstring, ViewManagerPropertyType>();
|
||||
|
||||
nativeProps.Insert(L"aspect", ViewManagerPropertyType::Number);
|
||||
nativeProps.Insert(L"type", ViewManagerPropertyType::Number);
|
||||
nativeProps.Insert(L"autoFocus", ViewManagerPropertyType::Boolean);
|
||||
nativeProps.Insert(L"whiteBalance", ViewManagerPropertyType::Number);
|
||||
nativeProps.Insert(L"torchMode", ViewManagerPropertyType::Number);
|
||||
nativeProps.Insert(L"flashMode", ViewManagerPropertyType::Number);
|
||||
// nativeProps.Insert(L"barcodeScannerEnabled", ViewManagerPropertyType::Boolean);
|
||||
// nativeProps.Insert(L"barCodeTypes", ViewManagerPropertyType::Array);
|
||||
nativeProps.Insert(L"keepAwake", ViewManagerPropertyType::Boolean);
|
||||
|
||||
return nativeProps.GetView();
|
||||
}
|
||||
|
||||
void ReactCameraViewManager::UpdateProperties(
|
||||
FrameworkElement const& view,
|
||||
IJSValueReader const& propertyMapReader) noexcept {
|
||||
if (auto reactCameraView = view.try_as<ReactNativeCameraCPP::ReactCameraView>()) {
|
||||
reactCameraView->UpdateProperties(propertyMapReader);
|
||||
}
|
||||
}
|
||||
|
||||
void ReactCameraViewManager::RemoveViewFromList(winrt::com_ptr<ReactNativeCameraCPP::ReactCameraView> view)
|
||||
{
|
||||
auto it = std::find(m_cameraViewInstances.begin(), m_cameraViewInstances.end(), view);
|
||||
if (it != m_cameraViewInstances.end())
|
||||
m_cameraViewInstances.erase(it);
|
||||
}
|
||||
|
||||
IAsyncAction ReactCameraViewManager::TakePictureAsync(
|
||||
std::map<std::wstring, winrt::Microsoft::ReactNative::JSValue> const& options,
|
||||
int viewTag,
|
||||
ReactPromise<JSValueObject>& result)
|
||||
{
|
||||
auto index = co_await FindCamera(viewTag);
|
||||
if (index != -1)
|
||||
{
|
||||
auto cameraView = m_cameraViewInstances.at(index);
|
||||
co_await cameraView->TakePictureAsync(options, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Reject("No camera instance found.");
|
||||
}
|
||||
}
|
||||
|
||||
IAsyncAction ReactCameraViewManager::RecordAsync(
|
||||
std::map<std::wstring, JSValue> const& options,
|
||||
int viewTag,
|
||||
ReactPromise<JSValueObject>& result)
|
||||
{
|
||||
auto index = co_await FindCamera(viewTag);
|
||||
if (index != -1)
|
||||
{
|
||||
auto cameraView = m_cameraViewInstances.at(index);
|
||||
co_await cameraView->RecordAsync(options, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Reject("No camera instance found.");
|
||||
}
|
||||
}
|
||||
|
||||
// Intialize MediaCapture and will bring up the constent dialog if this
|
||||
// is the first time. RNC will display a progress indicator while waiting
|
||||
// for user click. This method will resolve as no permission if user does
|
||||
// not grant the permission or App does not have the appx capabilities for
|
||||
// Microphone and WebCam specified in its Package.Appxmanifest.
|
||||
IAsyncAction ReactCameraViewManager::CheckMediaCapturePermissionAsync(
|
||||
winrt::Microsoft::ReactNative::ReactPromise<bool>& result)
|
||||
{
|
||||
auto mediaCapture = winrt::Windows::Media::Capture::MediaCapture();
|
||||
bool hasPermission = true;
|
||||
try {
|
||||
co_await mediaCapture.InitializeAsync();
|
||||
}
|
||||
catch (winrt::hresult_error const&) {
|
||||
hasPermission = false;
|
||||
}
|
||||
result.Resolve(hasPermission);
|
||||
}
|
||||
|
||||
IAsyncOperation<int> ReactCameraViewManager::FindCamera(int viewTag)
|
||||
{
|
||||
int index = 0;
|
||||
for (const auto& cameraView : m_cameraViewInstances)
|
||||
{
|
||||
auto element = cameraView.as<winrt::Grid>();
|
||||
auto dispatcher = element.Dispatcher();
|
||||
co_await resume_foreground(dispatcher);
|
||||
int currentTag = static_cast<int>(element.GetValue(winrt::FrameworkElement::TagProperty()).as<winrt::IPropertyValue>().GetInt64());
|
||||
if (currentTag == viewTag)
|
||||
{
|
||||
co_return index;
|
||||
}
|
||||
co_await resume_background();
|
||||
index++;
|
||||
}
|
||||
co_return -1;
|
||||
co_return;
|
||||
}
|
||||
|
||||
IAsyncOperation<int> ReactCameraViewManager::FindCamera(int viewTag) noexcept {
|
||||
int index = 0;
|
||||
for (const auto &cameraView : m_cameraViewInstances) {
|
||||
auto element = cameraView.as<winrt::Grid>();
|
||||
auto dispatcher = element.Dispatcher();
|
||||
co_await resume_foreground(dispatcher);
|
||||
int currentTag = static_cast<int>(
|
||||
element.GetValue(winrt::FrameworkElement::TagProperty()).as<winrt::IPropertyValue>().GetInt64());
|
||||
if (currentTag == viewTag) {
|
||||
co_return index;
|
||||
}
|
||||
co_await resume_background();
|
||||
index++;
|
||||
}
|
||||
co_return - 1;
|
||||
}
|
||||
|
||||
} // namespace winrt::ReactNativeCameraCPP::implementation
|
||||
|
||||
@ -3,53 +3,64 @@
|
||||
|
||||
namespace winrt::ReactNativeCameraCPP::implementation {
|
||||
|
||||
struct ReactCameraViewManager
|
||||
: winrt::implements<
|
||||
ReactCameraViewManager,
|
||||
winrt::Microsoft::ReactNative::IViewManager,
|
||||
winrt::Microsoft::ReactNative::IViewManagerWithReactContext,
|
||||
winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties> {
|
||||
public:
|
||||
ReactCameraViewManager();
|
||||
struct ReactCameraViewManager : winrt::implements<
|
||||
ReactCameraViewManager,
|
||||
winrt::Microsoft::ReactNative::IViewManager,
|
||||
winrt::Microsoft::ReactNative::IViewManagerWithReactContext,
|
||||
winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties> {
|
||||
public:
|
||||
ReactCameraViewManager();
|
||||
|
||||
// IViewManager
|
||||
winrt::hstring Name() noexcept;
|
||||
winrt::Windows::UI::Xaml::FrameworkElement CreateView() noexcept;
|
||||
// IViewManager
|
||||
winrt::hstring Name() noexcept;
|
||||
winrt::Windows::UI::Xaml::FrameworkElement CreateView() noexcept;
|
||||
|
||||
// IViewManagerWithReactContext
|
||||
winrt::Microsoft::ReactNative::IReactContext ReactContext() noexcept;
|
||||
void ReactContext(winrt::Microsoft::ReactNative::IReactContext reactContext) noexcept;
|
||||
// IViewManagerWithReactContext
|
||||
winrt::Microsoft::ReactNative::IReactContext ReactContext() noexcept;
|
||||
void ReactContext(winrt::Microsoft::ReactNative::IReactContext reactContext) noexcept;
|
||||
|
||||
// IViewManagerWithNativeProperties
|
||||
winrt::Windows::Foundation::Collections::
|
||||
IMapView<winrt::hstring, winrt::Microsoft::ReactNative::ViewManagerPropertyType>
|
||||
NativeProps() noexcept;
|
||||
// IViewManagerWithNativeProperties
|
||||
winrt::Windows::Foundation::Collections::
|
||||
IMapView<winrt::hstring, winrt::Microsoft::ReactNative::ViewManagerPropertyType>
|
||||
NativeProps() noexcept;
|
||||
|
||||
void UpdateProperties(
|
||||
winrt::Windows::UI::Xaml::FrameworkElement const &view,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader const &propertyMapReader) noexcept;
|
||||
void UpdateProperties(
|
||||
winrt::Windows::UI::Xaml::FrameworkElement const &view,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader const &propertyMapReader) noexcept;
|
||||
|
||||
static winrt::Windows::Foundation::IAsyncAction TakePictureAsync(
|
||||
std::map<std::wstring, winrt::Microsoft::ReactNative::JSValue> const& options,
|
||||
int viewTag,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<winrt::Microsoft::ReactNative::JSValueObject> &result);
|
||||
static winrt::Windows::Foundation::IAsyncAction TakePictureAsync(
|
||||
winrt::Microsoft::ReactNative::JSValueObject const &options,
|
||||
int viewTag,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<winrt::Microsoft::ReactNative::JSValueObject> const &result) noexcept;
|
||||
|
||||
static winrt::Windows::Foundation::IAsyncAction RecordAsync(
|
||||
std::map<std::wstring, winrt::Microsoft::ReactNative::JSValue> const& options,
|
||||
int viewTag,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<winrt::Microsoft::ReactNative::JSValueObject> &result);
|
||||
static winrt::Windows::Foundation::IAsyncAction RecordAsync(
|
||||
winrt::Microsoft::ReactNative::JSValueObject const &options,
|
||||
int viewTag,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<winrt::Microsoft::ReactNative::JSValueObject> const &result) noexcept;
|
||||
|
||||
static winrt::Windows::Foundation::IAsyncAction CheckMediaCapturePermissionAsync(
|
||||
winrt::Microsoft::ReactNative::ReactPromise<bool>& result);
|
||||
static winrt::Windows::Foundation::IAsyncAction StopRecordAsync(int viewTag) noexcept;
|
||||
|
||||
static void RemoveViewFromList(winrt::com_ptr<ReactNativeCameraCPP::ReactCameraView>);
|
||||
static winrt::Windows::Foundation::IAsyncAction IsRecordingAsync(
|
||||
int viewTag,
|
||||
winrt::Microsoft::ReactNative::ReactPromise<bool> const &result) noexcept;
|
||||
|
||||
private:
|
||||
static winrt::Windows::Foundation::IAsyncAction PausePreviewAsync(int viewTag) noexcept;
|
||||
|
||||
static winrt::Windows::Foundation::IAsyncOperation<int> FindCamera(int viewTag);
|
||||
static winrt::Windows::Foundation::IAsyncAction ResumePreviewAsync(int viewTag) noexcept;
|
||||
|
||||
winrt::Microsoft::ReactNative::IReactContext m_reactContext{ nullptr };
|
||||
static std::vector<winrt::com_ptr<ReactNativeCameraCPP::ReactCameraView>> m_cameraViewInstances;
|
||||
};
|
||||
static winrt::Windows::Foundation::IAsyncAction CheckMediaCapturePermissionAsync(
|
||||
winrt::Microsoft::ReactNative::ReactPromise<bool> const &result) noexcept;
|
||||
|
||||
static winrt::Windows::Foundation::IAsyncAction GetCameraIdsAsync(
|
||||
winrt::Microsoft::ReactNative::ReactPromise<winrt::Microsoft::ReactNative::JSValueArray> const &result) noexcept;
|
||||
|
||||
static void RemoveViewFromList(winrt::com_ptr<ReactNativeCameraCPP::ReactCameraView>);
|
||||
|
||||
private:
|
||||
static winrt::Windows::Foundation::IAsyncOperation<int> FindCamera(int viewTag) noexcept;
|
||||
|
||||
winrt::Microsoft::ReactNative::IReactContext m_reactContext{nullptr};
|
||||
static std::vector<winrt::com_ptr<ReactNativeCameraCPP::ReactCameraView>> m_cameraViewInstances;
|
||||
};
|
||||
|
||||
} // namespace winrt::ReactNativeCameraCPP::implementation
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<CppWinRTOptimized>true</CppWinRTOptimized>
|
||||
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
|
||||
@ -9,19 +9,26 @@
|
||||
<ProjectName>ReactNativeCameraCPP</ProjectName>
|
||||
<RootNamespace>ReactNativeCameraCPP</RootNamespace>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
|
||||
<AppContainerApplication>true</AppContainerApplication>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
<WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.15063.0</WindowsTargetPlatformMinVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.16299.0</WindowsTargetPlatformMinVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="ReactNativeWindowsProps">
|
||||
<ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
@ -34,6 +41,10 @@
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
@ -45,9 +56,6 @@
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
@ -63,15 +71,15 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
<Import Project="..\..\..\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems" Label="Shared" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="PropertySheet.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="ReactNativeWindowsPropertySheets">
|
||||
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup>
|
||||
@ -143,21 +151,25 @@
|
||||
<ItemGroup>
|
||||
<None Include="PropertySheet.props" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj">
|
||||
<Project>{f7d32bd0-2749-483e-9a0d-1635ef7e3136}</Project>
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ReactNativeWindowsTargets">
|
||||
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureReactNativeWindowsTargets" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references targets in your node_modules\react-native-windows folder. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props'))" />
|
||||
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets'))" />
|
||||
</Target>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@ -35,5 +35,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="ReactPackageProvider.idl" />
|
||||
<Midl Include="CameraRotationHelper.idl" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -4,18 +4,16 @@
|
||||
#include "ReactPackageProvider.g.cpp"
|
||||
#endif
|
||||
|
||||
#include "ReactCameraViewManager.h"
|
||||
#include "ReactCameraModule.h"
|
||||
#include "ReactCameraViewManager.h"
|
||||
|
||||
using namespace winrt::Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::ReactNativeCameraCPP::implementation {
|
||||
|
||||
void ReactPackageProvider::CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept {
|
||||
AddAttributedModules(packageBuilder);
|
||||
packageBuilder.AddViewManager(L"ReactCameraViewManager", []() {
|
||||
return winrt::make<ReactCameraViewManager>();
|
||||
});
|
||||
}
|
||||
void ReactPackageProvider::CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept {
|
||||
AddAttributedModules(packageBuilder);
|
||||
packageBuilder.AddViewManager(L"ReactCameraViewManager", []() { return winrt::make<ReactCameraViewManager>(); });
|
||||
}
|
||||
|
||||
} // namespace winrt::ReactNativeCameraCPP::implementation
|
||||
|
||||
@ -5,16 +5,16 @@ using namespace winrt::Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::ReactNativeCameraCPP::implementation {
|
||||
|
||||
struct ReactPackageProvider : ReactPackageProviderT<ReactPackageProvider> {
|
||||
ReactPackageProvider() = default;
|
||||
struct ReactPackageProvider : ReactPackageProviderT<ReactPackageProvider> {
|
||||
ReactPackageProvider() = default;
|
||||
|
||||
void CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept;
|
||||
};
|
||||
void CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept;
|
||||
};
|
||||
|
||||
} // namespace winrt::ReactNativeCameraCPP::implementation
|
||||
|
||||
namespace winrt::ReactNativeCameraCPP::factory_implementation {
|
||||
|
||||
struct ReactPackageProvider : ReactPackageProviderT<ReactPackageProvider, implementation::ReactPackageProvider> {};
|
||||
struct ReactPackageProvider : ReactPackageProviderT<ReactPackageProvider, implementation::ReactPackageProvider> {};
|
||||
|
||||
} // namespace winrt::ReactNativeCameraCPP::factory_implementation
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
namespace ReactNativeCameraCPP {
|
||||
[webhosthidden][default_interface] runtimeclass ReactPackageProvider : Microsoft.ReactNative.IReactPackageProvider {
|
||||
ReactPackageProvider();
|
||||
};
|
||||
} // namespace ReactNativeCameraCPP
|
||||
namespace ReactNativeCameraCPP
|
||||
{
|
||||
[webhosthidden]
|
||||
[default_interface]
|
||||
runtimeclass ReactPackageProvider : Microsoft.ReactNative.IReactPackageProvider
|
||||
{
|
||||
ReactPackageProvider();
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.190730.2" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200316.3" targetFramework="native" />
|
||||
</packages>
|
||||
@ -1,9 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <unknwn.h>
|
||||
#include <winrt/Windows.Devices.Enumeration.h>
|
||||
#include <winrt/Windows.Devices.Sensors.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Graphics.Imaging.h>
|
||||
#include <winrt/Windows.Media.Capture.h>
|
||||
#include <winrt/Windows.Media.Devices.h>
|
||||
#include <winrt/Windows.Media.MediaProperties.h>
|
||||
#include <winrt/Windows.Media.Mediaproperties.h>
|
||||
#include <winrt/Windows.Security.Cryptography.h>
|
||||
#include <winrt/Windows.Storage.FileProperties.h>
|
||||
#include <winrt/Windows.Storage.Streams.h>
|
||||
#include <winrt/Windows.Storage.h>
|
||||
#include <winrt/Windows.System.Display.h>
|
||||
#include <winrt/Windows.System.Threading.h>
|
||||
#include <winrt/Windows.UI.Core.h>
|
||||
#include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
|
||||
#include <winrt/Windows.UI.Xaml.Controls.h>
|
||||
#include <winrt/Windows.UI.Xaml.Data.h>
|
||||
@ -11,21 +24,8 @@
|
||||
#include <winrt/Windows.UI.Xaml.Markup.h>
|
||||
#include <winrt/Windows.UI.Xaml.Navigation.h>
|
||||
#include <winrt/Windows.UI.Xaml.h>
|
||||
#include <winrt/Windows.Devices.Enumeration.h>
|
||||
#include <winrt/Windows.Media.Capture.h>
|
||||
#include <winrt/Windows.Media.MediaProperties.h>
|
||||
#include <winrt/Windows.Devices.Sensors.h>
|
||||
#include <winrt/Windows.Devices.Enumeration.h>
|
||||
#include <winrt/Windows.Media.Mediaproperties.h>
|
||||
#include <winrt/Windows.Media.Devices.h>
|
||||
#include <winrt/Windows.UI.Core.h>
|
||||
#include <winrt/Windows.Storage.Streams.h>
|
||||
#include <winrt/Windows.Security.Cryptography.h>
|
||||
#include <winrt/Windows.Storage.h>
|
||||
#include <winrt/Windows.Graphics.Imaging.h>
|
||||
#include <winrt/Windows.System.Display.h>
|
||||
#include <winrt/Windows.Storage.FileProperties.h>
|
||||
|
||||
#include "winrt/Microsoft.ReactNative.h"
|
||||
|
||||
#include "JSValueTreeWriter.h"
|
||||
#include "ReactCameraView.h"
|
||||
|
||||
199
windows/ReactNativeCameraCPP61.sln
Normal file
199
windows/ReactNativeCameraCPP61.sln
Normal file
@ -0,0 +1,199 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29215.179
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Folly", "..\node_modules\react-native-windows\Folly\Folly.vcxproj", "{A990658C-CE31-4BCC-976F-0FC6B1AF693D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactCommon", "..\node_modules\react-native-windows\ReactCommon\ReactCommon.vcxproj", "{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {A990658C-CE31-4BCC-976F-0FC6B1AF693D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactWindowsCore", "..\node_modules\react-native-windows\ReactWindowsCore\ReactWindowsCore.vcxproj", "{11C084A3-A57C-4296-A679-CAC17B603144}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {A990658C-CE31-4BCC-976F-0FC6B1AF693D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Chakra", "..\node_modules\react-native-windows\Chakra\Chakra.vcxitems", "{C38970C0-5FBF-4D69-90D8-CBAC225AE895}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.ReactNative", "..\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj", "{F7D32BD0-2749-483E-9A0D-1635EF7E3136}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Shared", "..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems", "{0CC28589-39E4-4288-B162-97B959F8B843}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Universal", "..\node_modules\react-native-windows\JSI\Universal\JSI.Universal.vcxproj", "{A62D504A-16B8-41D2-9F19-E2E86019E5E4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.ReactNative.Cxx", "..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems", "{DA8B35B3-DA00-4B02-BDE6-6A397B3FD46B}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.ReactNative.SharedManaged", "..\node_modules\react-native-windows\Microsoft.ReactNative.SharedManaged\Microsoft.ReactNative.SharedManaged.shproj", "{67A1076F-7790-4203-86EA-4402CCB5E782}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "..\node_modules\react-native-windows\Common\Common.vcxproj", "{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReactNative", "ReactNative", "{5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Shared", "..\node_modules\react-native-windows\Shared\Shared.vcxitems", "{2049DBE9-8D13-42C9-AE4B-413AE38FFFD0}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mso", "..\node_modules\react-native-windows\Mso\Mso.vcxitems", "{84E05BFA-CBAF-4F0D-BFB6-4CE85742A57E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactNativeCameraCPP61", "ReactNativeCameraCPP61\ReactNativeCameraCPP61.vcxproj", "{5898D41D-92CC-48D0-95CD-9954572C266D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{0cc28589-39e4-4288-b162-97b959f8b843}*SharedItemsImports = 9
|
||||
..\node_modules\react-native-windows\ReactWindowsCore\ReactWindowsCore.vcxitems*{11c084a3-a57c-4296-a679-cac17b603144}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9
|
||||
..\node_modules\react-native-windows\Microsoft.ReactNative.SharedManaged\Microsoft.ReactNative.SharedManaged.projitems*{67a1076f-7790-4203-86ea-4402ccb5e782}*SharedItemsImports = 13
|
||||
..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{5898d41d-92cc-48d0-95cd-9954572c266d}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\Mso\Mso.vcxitems*{84e05bfa-cbaf-4f0d-bfb6-4ce85742a57e}*SharedItemsImports = 9
|
||||
..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{a62d504a-16b8-41d2-9f19-e2e86019e5e4}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9
|
||||
..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9
|
||||
..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
|
||||
..\node_modules\react-native-windows\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|ARM = Release|ARM
|
||||
Release|ARM64 = Release|ARM64
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.Build.0 = Debug|x64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x86.Build.0 = Debug|Win32
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM.Build.0 = Release|ARM
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.ActiveCfg = Release|x64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.Build.0 = Release|x64
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.Build.0 = Release|Win32
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.Build.0 = Debug|x64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x86.Build.0 = Debug|Win32
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM.Build.0 = Release|ARM
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x64.ActiveCfg = Release|x64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x64.Build.0 = Release|x64
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x86.ActiveCfg = Release|Win32
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x86.Build.0 = Release|Win32
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x64.Build.0 = Debug|x64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x86.Build.0 = Debug|Win32
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM.Build.0 = Release|ARM
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x64.ActiveCfg = Release|x64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x64.Build.0 = Release|x64
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x86.ActiveCfg = Release|Win32
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x86.Build.0 = Release|Win32
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x64.Build.0 = Debug|x64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x86.Build.0 = Debug|Win32
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM.Build.0 = Release|ARM
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x64.ActiveCfg = Release|x64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x64.Build.0 = Release|x64
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x86.ActiveCfg = Release|Win32
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x86.Build.0 = Release|Win32
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x64.Build.0 = Debug|x64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x86.Build.0 = Debug|Win32
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM.Build.0 = Release|ARM
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x64.ActiveCfg = Release|x64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x64.Build.0 = Release|x64
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x86.ActiveCfg = Release|Win32
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x86.Build.0 = Release|Win32
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x64.Build.0 = Debug|x64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x86.Build.0 = Debug|Win32
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM.Build.0 = Release|ARM
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.ActiveCfg = Release|x64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.Build.0 = Release|x64
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.Build.0 = Release|Win32
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Debug|ARM64.ActiveCfg = Debug|Win32
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Debug|x64.Build.0 = Debug|x64
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Debug|x86.Build.0 = Debug|Win32
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Release|ARM.Build.0 = Release|ARM
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Release|ARM64.ActiveCfg = Release|Win32
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Release|x64.ActiveCfg = Release|x64
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Release|x64.Build.0 = Release|x64
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{5898D41D-92CC-48D0-95CD-9954572C266D}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
|
||||
{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
|
||||
{11C084A3-A57C-4296-A679-CAC17B603144} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
|
||||
{C38970C0-5FBF-4D69-90D8-CBAC225AE895} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
|
||||
{F7D32BD0-2749-483E-9A0D-1635EF7E3136} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
|
||||
{0CC28589-39E4-4288-B162-97B959F8B843} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
|
||||
{A62D504A-16B8-41D2-9F19-E2E86019E5E4} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
|
||||
{DA8B35B3-DA00-4B02-BDE6-6A397B3FD46B} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
|
||||
{67A1076F-7790-4203-86EA-4402CCB5E782} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
|
||||
{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
|
||||
{2049DBE9-8D13-42C9-AE4B-413AE38FFFD0} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
|
||||
{84E05BFA-CBAF-4F0D-BFB6-4CE85742A57E} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D43FAD39-F619-437D-BB40-04A3982ACB6A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
16
windows/ReactNativeCameraCPP61/PropertySheet.props
Normal file
16
windows/ReactNativeCameraCPP61/PropertySheet.props
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<!--
|
||||
To customize common C++/WinRT project properties:
|
||||
* right-click the project node
|
||||
* expand the Common Properties item
|
||||
* select the C++/WinRT property page
|
||||
|
||||
For more advanced scenarios, and complete documentation, please see:
|
||||
https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget
|
||||
-->
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup />
|
||||
</Project>
|
||||
166
windows/ReactNativeCameraCPP61/ReactNativeCameraCPP61.vcxproj
Normal file
166
windows/ReactNativeCameraCPP61/ReactNativeCameraCPP61.vcxproj
Normal file
@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<CppWinRTOptimized>true</CppWinRTOptimized>
|
||||
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
|
||||
<MinimalCoreWin>true</MinimalCoreWin>
|
||||
<ProjectGuid>{5898d41d-92cc-48d0-95cd-9954572c266d}</ProjectGuid>
|
||||
<ProjectName>ReactNativeCameraCPP61</ProjectName>
|
||||
<RootNamespace>ReactNativeCameraCPP</RootNamespace>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<AppContainerApplication>true</AppContainerApplication>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
<WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.15063.0</WindowsTargetPlatformMinVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="ReactNativeWindowsProps">
|
||||
<ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
<Import Project="$(ReactNativeWindowsDir)\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems" Label="Shared" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="PropertySheet.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
|
||||
<!--Temporarily disable cppwinrt heap enforcement to work around xaml compiler generated std::shared_ptr use -->
|
||||
<AdditionalOptions Condition="'$(CppWinRTHeapEnforcement)'==''">/DWINRT_NO_MAKE_DETECTION %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>_WINRT_DLL;RNW61;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateWindowsMetadata>true</GenerateWindowsMetadata>
|
||||
<ModuleDefinitionFile>ReactNativeCameraCPP.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\ReactCameraConstants.h" />
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\ReactCameraView.h" />
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\ReactCameraViewManager.h" />
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\pch.h" />
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\ReactPackageProvider.h">
|
||||
<DependentUpon>..\ReactNativeCameraCPP\ReactPackageProvider.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\CameraRotationHelper.h">
|
||||
<DependentUpon>..\ReactNativeCameraCPP\CameraRotationHelper.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\ReactCameraModule.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\ReactNativeCameraCPP\ReactCameraView.cpp" />
|
||||
<ClCompile Include="..\ReactNativeCameraCPP\ReactCameraViewManager.cpp" />
|
||||
<ClCompile Include="..\ReactNativeCameraCPP\pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ReactNativeCameraCPP\ReactPackageProvider.cpp">
|
||||
<DependentUpon>..\ReactNativeCameraCPP\ReactPackageProvider.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ReactNativeCameraCPP\CameraRotationHelper.cpp">
|
||||
<DependentUpon>..\ReactNativeCameraCPP\CameraRotationHelper.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="..\ReactNativeCameraCPP\ReactPackageProvider.idl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="..\ReactNativeCameraCPP\CameraRotationHelper.idl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="..\ReactNativeCameraCPP\ReactNativeCameraCPP.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="PropertySheet.props" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(ReactNativeWindowsDir)\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj">
|
||||
<Project>{f7d32bd0-2749-483e-9a0d-1635ef7e3136}</Project>
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Resources">
|
||||
<UniqueIdentifier>accd3aa8-1ba0-4223-9bbe-0c431709210b</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Generated Files">
|
||||
<UniqueIdentifier>{926ab91d-31b5-48c3-b9a4-e681349f27f0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\ReactNativeCameraCPP\pch.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
||||
<ClCompile Include="..\ReactNativeCameraCPP\ReactPackageProvider.cpp" />
|
||||
<ClCompile Include="..\ReactNativeCameraCPP\ReactCameraViewManager.cpp" />
|
||||
<ClCompile Include="..\ReactNativeCameraCPP\ReactCameraView.cpp" />
|
||||
<ClCompile Include="..\ReactNativeCameraCPP\CameraRotationHelper.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\pch.h" />
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\ReactPackageProvider.h" />
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\ReactCameraModule.h" />
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\ReactCameraViewManager.h" />
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\ReactCameraConstants.h" />
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\ReactCameraView.h" />
|
||||
<ClInclude Include="..\ReactNativeCameraCPP\CameraRotationHelper.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\ReactNativeCameraCPP\ReactNativeCameraCPP.def" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="PropertySheet.props" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="..\ReactNativeCameraCPP\ReactPackageProvider.idl" />
|
||||
<Midl Include="..\ReactNativeCameraCPP\CameraRotationHelper.idl" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
4
windows/ReactNativeCameraCPP61/packages.config
Normal file
4
windows/ReactNativeCameraCPP61/packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.190730.2" targetFramework="native" />
|
||||
</packages>
|
||||
Loading…
Reference in New Issue
Block a user