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

Merged
akinwale merged 2 commits from camera-not-authorized into master 2019-09-30 13:55:31 +02:00

View file

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