Commit 85e40365 by Giang Tran

update code

parent e124cc2b
......@@ -5,6 +5,11 @@
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name=".MainApplication"
......
......@@ -903,7 +903,7 @@
CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 17;
CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_TEAM = MXZ24GRH48;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
......@@ -936,7 +936,7 @@
CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 17;
CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_TEAM = MXZ24GRH48;
INFOPLIST_FILE = Invest/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
......
......@@ -42,7 +42,7 @@
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string/>
<string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string>To upload images</string>
<key>UIAppFonts</key>
......
import React from 'react';
import {Dimensions, Platform, Alert, Text} from 'react-native';
import {
Dimensions,
Platform,
Alert,
Text,
PermissionsAndroid,
} from 'react-native';
import moment from 'moment';
import _ from 'lodash';
export const requestCameraPermission = async () => {
try {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.CAMERA,
{
title: 'Cool Photo App Camera Permission',
message:
'Cool Photo App needs access to your camera ' +
'so you can take awesome pictures.',
buttonNeutral: 'Ask Me Later',
buttonNegative: 'Cancel',
buttonPositive: 'OK',
},
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log('You can use the camera');
} else {
console.log('Camera permission denied');
}
} catch (err) {
console.warn(err);
}
};
export const renderStatus = (status) => {
switch (status) {
case 2:
......
......@@ -105,6 +105,7 @@ const Profile = (props) => {
props.showLoading();
const res = await verifyAccountApi(data);
props.hideLoading();
console.log(res);
if (res.data.code == 200) {
setTimeout(() => {
props.saveUserToRedux(res.data.data);
......
......@@ -58,7 +58,7 @@ const NewFeed = (props) => {
const getItemLayout = (data, index) => ({
length: 100,
offset: 60 * index,
offset: 70 * index,
index,
});
......
import React, {useState} from 'react';
import React, {useState, useEffect} from 'react';
import {
View,
Text,
......@@ -6,9 +6,16 @@ import {
StyleSheet,
TouchableOpacity,
TouchableWithoutFeedback,
Platform,
PermissionsAndroid,
} from 'react-native';
import R from '../../assets/R';
import {HEIGHTXD, WIDTHXD, getFontXD} from '../../Config/Functions';
import {
HEIGHTXD,
WIDTHXD,
getFontXD,
requestCameraPermission,
} from '../../Config/Functions';
import Icon from 'react-native-vector-icons/AntDesign';
import Modal from 'react-native-modal';
import Block from '../Block';
......@@ -29,6 +36,14 @@ const PickerImgUni = (props) => {
const [urlImg, setUrlImg] = useState('');
// const [imgPicker, setImgPicker] = useState('');
const checkPermissionAndroid = () => {
console.log('Chay vao day');
if (!PermissionsAndroid.check('CAMERA')) {
console.log('Chay vao day');
requestCameraPermission();
}
};
const onchoosGalery = () => {
ImagePicker.openPicker({
mediaType: 'photo',
......@@ -41,6 +56,7 @@ const PickerImgUni = (props) => {
};
const onCapture = () => {
if (Platform.OS == 'android') checkPermissionAndroid();
ImagePicker.openCamera({
mediaType: 'photo',
width: 300,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment