Commit 85e40365 by Giang Tran

update code

parent e124cc2b
...@@ -5,6 +5,11 @@ ...@@ -5,6 +5,11 @@
<uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" /> <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 <application
android:name=".MainApplication" android:name=".MainApplication"
......
...@@ -903,7 +903,7 @@ ...@@ -903,7 +903,7 @@
CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements; CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 17; CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_TEAM = MXZ24GRH48; DEVELOPMENT_TEAM = MXZ24GRH48;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
...@@ -936,7 +936,7 @@ ...@@ -936,7 +936,7 @@
CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements; CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 17; CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_TEAM = MXZ24GRH48; DEVELOPMENT_TEAM = MXZ24GRH48;
INFOPLIST_FILE = Invest/Info.plist; INFOPLIST_FILE = Invest/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</dict> </dict>
</dict> </dict>
<key>NSLocationWhenInUseUsageDescription</key> <key>NSLocationWhenInUseUsageDescription</key>
<string/> <string></string>
<key>NSPhotoLibraryUsageDescription</key> <key>NSPhotoLibraryUsageDescription</key>
<string>To upload images</string> <string>To upload images</string>
<key>UIAppFonts</key> <key>UIAppFonts</key>
......
import React from 'react'; 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 moment from 'moment';
import _ from 'lodash'; 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) => { export const renderStatus = (status) => {
switch (status) { switch (status) {
case 2: case 2:
......
...@@ -105,6 +105,7 @@ const Profile = (props) => { ...@@ -105,6 +105,7 @@ const Profile = (props) => {
props.showLoading(); props.showLoading();
const res = await verifyAccountApi(data); const res = await verifyAccountApi(data);
props.hideLoading(); props.hideLoading();
console.log(res);
if (res.data.code == 200) { if (res.data.code == 200) {
setTimeout(() => { setTimeout(() => {
props.saveUserToRedux(res.data.data); props.saveUserToRedux(res.data.data);
......
...@@ -58,7 +58,7 @@ const NewFeed = (props) => { ...@@ -58,7 +58,7 @@ const NewFeed = (props) => {
const getItemLayout = (data, index) => ({ const getItemLayout = (data, index) => ({
length: 100, length: 100,
offset: 60 * index, offset: 70 * index,
index, index,
}); });
......
import React, {useState} from 'react'; import React, {useState, useEffect} from 'react';
import { import {
View, View,
Text, Text,
...@@ -6,9 +6,16 @@ import { ...@@ -6,9 +6,16 @@ import {
StyleSheet, StyleSheet,
TouchableOpacity, TouchableOpacity,
TouchableWithoutFeedback, TouchableWithoutFeedback,
Platform,
PermissionsAndroid,
} from 'react-native'; } from 'react-native';
import R from '../../assets/R'; 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 Icon from 'react-native-vector-icons/AntDesign';
import Modal from 'react-native-modal'; import Modal from 'react-native-modal';
import Block from '../Block'; import Block from '../Block';
...@@ -29,6 +36,14 @@ const PickerImgUni = (props) => { ...@@ -29,6 +36,14 @@ const PickerImgUni = (props) => {
const [urlImg, setUrlImg] = useState(''); const [urlImg, setUrlImg] = useState('');
// const [imgPicker, setImgPicker] = useState(''); // const [imgPicker, setImgPicker] = useState('');
const checkPermissionAndroid = () => {
console.log('Chay vao day');
if (!PermissionsAndroid.check('CAMERA')) {
console.log('Chay vao day');
requestCameraPermission();
}
};
const onchoosGalery = () => { const onchoosGalery = () => {
ImagePicker.openPicker({ ImagePicker.openPicker({
mediaType: 'photo', mediaType: 'photo',
...@@ -41,6 +56,7 @@ const PickerImgUni = (props) => { ...@@ -41,6 +56,7 @@ const PickerImgUni = (props) => {
}; };
const onCapture = () => { const onCapture = () => {
if (Platform.OS == 'android') checkPermissionAndroid();
ImagePicker.openCamera({ ImagePicker.openCamera({
mediaType: 'photo', mediaType: 'photo',
width: 300, 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