show the camera after the required permissions have been granted (#48)

This commit is contained in:
Akinwale Ariwodola 2019-09-30 12:55:30 +01:00 committed by GitHub
parent 46b99e769f
commit aba0b860e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -870,6 +870,7 @@ class PublishPage extends React.PureComponent {
const {
allThumbnailsChecked,
canUseCamera,
showCameraOverlay,
currentPhase,
checkedThumbnails,
loadingVideos,
@ -882,7 +883,9 @@ class PublishPage extends React.PureComponent {
content = (
<View style={publishStyle.gallerySelector}>
<View style={publishStyle.actionsView}>
{canUseCamera && <RNCamera style={publishStyle.cameraPreview} type={RNCamera.Constants.Type.back} />}
{canUseCamera && !showCameraOverlay && (
<RNCamera captureAudio={false} style={publishStyle.cameraPreview} type={RNCamera.Constants.Type.back} />
)}
<View style={publishStyle.actionsSubView}>
<TouchableOpacity
style={[
@ -1236,34 +1239,36 @@ class PublishPage extends React.PureComponent {
{false && Constants.PHASE_SELECTOR !== this.state.currentPhase && (
<FloatingWalletBalance navigation={navigation} />
)}
{this.state.canUseCamera && this.state.showCameraOverlay && (
{this.state.showCameraOverlay && (
<View style={publishStyle.cameraOverlay}>
<RNCamera
captureAudio={this.state.videoRecordingMode}
style={publishStyle.fullCamera}
ref={ref => {
this.camera = ref;
}}
type={this.state.cameraType}
flashMode={RNCamera.Constants.FlashMode.off}
androidCameraPermissionOptions={{
title: 'Camera',
message: 'Please grant access to make use of your camera',
buttonPositive: 'OK',
buttonNegative: 'Cancel',
}}
androidRecordAudioPermissionOptions={{
title: 'Audio',
message: 'Please grant access to record audio',
buttonPositive: 'OK',
buttonNegative: 'Cancel',
}}
notAuthorizedView={
<View style={publishStyle.fullCentered}>
<Text style={publishStyle.cameraInfo}>Camera not authorized</Text>
</View>
}
/>
{this.state.canUseCamera && (
<RNCamera
captureAudio={this.state.videoRecordingMode}
style={publishStyle.fullCamera}
ref={ref => {
this.camera = ref;
}}
type={this.state.cameraType}
flashMode={RNCamera.Constants.FlashMode.off}
androidCameraPermissionOptions={{
title: __('Camera'),
message: __('Please grant access to make use of your camera'),
buttonPositive: __('OK'),
buttonNegative: __('Cancel'),
}}
androidRecordAudioPermissionOptions={{
title: __('Audio'),
message: __('Please grant access to record audio'),
buttonPositive: __('OK'),
buttonNegative: __('Cancel'),
}}
notAuthorizedView={
<View style={publishStyle.fullCentered}>
<Text style={publishStyle.cameraInfo}>Camera not authorized</Text>
</View>
}
/>
)}
<View
style={[
publishStyle.cameraControls,