Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InvestCustomer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Giang Tran
InvestCustomer
Commits
8f843cc6
Commit
8f843cc6
authored
May 13, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chage avatart
parent
9a6020d8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
208 additions
and
204 deletions
+208
-204
project.pbxproj
ios/Invest.xcodeproj/project.pbxproj
+2
-2
images.js
src/assets/images.js
+1
-0
Drawer.js
src/components/Header/Drawer.js
+1
-1
PickerAvatart.js
src/components/Picker/PickerAvatart.js
+204
-201
No files found.
ios/Invest.xcodeproj/project.pbxproj
View file @
8f843cc6
...
@@ -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
=
8
;
CURRENT_PROJECT_VERSION
=
9
;
DEVELOPMENT_TEAM
=
MXZ24GRH48
;
DEVELOPMENT_TEAM
=
MXZ24GRH48
;
ENABLE_BITCODE
=
NO
;
ENABLE_BITCODE
=
NO
;
GCC_PREPROCESSOR_DEFINITIONS
=
(
GCC_PREPROCESSOR_DEFINITIONS
=
(
...
@@ -937,7 +937,7 @@
...
@@ -937,7 +937,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
=
8
;
CURRENT_PROJECT_VERSION
=
9
;
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"
;
...
...
src/assets/images.js
View file @
8f843cc6
...
@@ -17,6 +17,7 @@ const images = {
...
@@ -17,6 +17,7 @@ const images = {
bgHome
:
require
(
'./images/bgHome01.png'
),
bgHome
:
require
(
'./images/bgHome01.png'
),
iconUser
:
require
(
'./images/iconUser1.png'
),
iconUser
:
require
(
'./images/iconUser1.png'
),
iconUserHome
:
require
(
'./images/iconUser.png'
),
iconUserAccuracy
:
require
(
'./images/iconUserAccuracy.png'
),
iconUserAccuracy
:
require
(
'./images/iconUserAccuracy.png'
),
iconList
:
require
(
'./images/iconList7.png'
),
iconList
:
require
(
'./images/iconList7.png'
),
iconRose
:
require
(
'./images/iconRose2.png'
),
iconRose
:
require
(
'./images/iconRose2.png'
),
...
...
src/components/Header/Drawer.js
View file @
8f843cc6
...
@@ -172,7 +172,7 @@ const Drawer = (props) => {
...
@@ -172,7 +172,7 @@ const Drawer = (props) => {
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
header
}
>
<
View
style
=
{
styles
.
header
}
>
<
Image
<
Image
source
=
{
imgAvatart
?
{
uri
:
imgAvatart
}
:
R
.
images
.
avarta
r
}
source
=
{
imgAvatart
?
{
uri
:
imgAvatart
}
:
R
.
images
.
iconUse
r
}
style
=
{
styles
.
imgAvatar
}
style
=
{
styles
.
imgAvatar
}
/
>
/
>
<
TouchableOpacity
<
TouchableOpacity
...
...
src/components/Picker/PickerAvatart.js
View file @
8f843cc6
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
import
{
View
,
View
,
Text
,
Text
,
Image
,
Image
,
StyleSheet
,
StyleSheet
,
TouchableOpacity
,
TouchableOpacity
,
TouchableWithoutFeedback
,
TouchableWithoutFeedback
,
Platform
,
Platform
,
Alert
,
Alert
,
}
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
}
from
'../../Config/Functions'
;
...
@@ -25,218 +25,221 @@ import {changeAvatart} from '../../apis/Functions/users';
...
@@ -25,218 +25,221 @@ import {changeAvatart} from '../../apis/Functions/users';
import
{
showLoading
,
hideLoading
}
from
'../../actions/loadingAction'
;
import
{
showLoading
,
hideLoading
}
from
'../../actions/loadingAction'
;
const
options
=
{
const
options
=
{
title
:
'Select Avatar'
,
title
:
'Select Avatar'
,
customButtons
:
[{
name
:
'fb'
,
title
:
'Choose Photo from Facebook'
}],
customButtons
:
[{
name
:
'fb'
,
title
:
'Choose Photo from Facebook'
}],
storageOptions
:
{
storageOptions
:
{
skipBackup
:
true
,
skipBackup
:
true
,
path
:
'images'
,
path
:
'images'
,
},
},
};
};
const
PickerImg
=
(
props
)
=>
{
const
PickerImg
=
(
props
)
=>
{
const
naviagtion
=
useNavigation
();
const
naviagtion
=
useNavigation
();
const
[
isModalVisible
,
setModalVisible
]
=
useState
(
false
);
const
[
isModalVisible
,
setModalVisible
]
=
useState
(
false
);
const
[
imgAvatart
,
setImgAvatart
]
=
useState
(
props
.
user
.
picture_url
);
const
[
imgAvatart
,
setImgAvatart
]
=
useState
(
props
.
user
.
picture_url
);
// useEffect(() => {
// useEffect(() => {
// setTimeout(() => {
// setTimeout(() => {
// console.log('Affter', props.user.picture_url);
// console.log('Affter', props.user.picture_url);
// setImgAvatart(props.user.picture_url);
// setImgAvatart(props.user.picture_url);
// }, 500);
// }, 500);
// }, [props.user]);
// }, [props.user]);
const
createFormData
=
(
photo
,
body
)
=>
{
const
createFormData
=
(
photo
,
body
)
=>
{
const
data
=
new
FormData
();
const
data
=
new
FormData
();
data
.
append
(
'avatar'
,
{
data
.
append
(
'avatar'
,
{
name
:
'sign_img.jpg'
,
name
:
'sign_img.jpg'
,
type
:
'image/jpg'
,
type
:
'image/jpg'
,
uri
:
Platform
.
OS
===
'android'
?
photo
:
photo
.
replace
(
'file://'
,
''
),
uri
:
Platform
.
OS
===
'android'
?
photo
:
photo
.
replace
(
'file://'
,
''
),
});
});
Object
.
keys
(
body
).
forEach
((
key
)
=>
{
Object
.
keys
(
body
).
forEach
((
key
)
=>
{
data
.
append
(
key
,
body
[
key
]);
data
.
append
(
key
,
body
[
key
]);
});
});
return
data
;
return
data
;
};
};
const
callApi
=
async
(
image
)
=>
{
const
callApi
=
async
(
image
)
=>
{
props
.
showLoading
();
props
.
showLoading
();
const
res
=
await
changeAvatart
(
const
res
=
await
changeAvatart
(
createFormData
(
image
,
{
uid
:
props
.
user
.
uid
,
platform
:
Platform
.
OS
}),
createFormData
(
image
,
{
uid
:
props
.
user
.
uid
,
platform
:
Platform
.
OS
}),
);
);
console
.
log
(
'upload avatar'
,
res
);
console
.
log
(
'upload avatar'
,
res
);
props
.
hideLoading
();
props
.
hideLoading
();
if
(
res
?.
status
==
200
&&
res
.
data
)
{
if
(
res
?.
status
==
200
&&
res
.
data
)
{
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
props
.
saveUserToRedux
(
res
.
data
.
data
);
props
.
saveUserToRedux
(
res
.
data
.
data
);
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
},
500
);
},
500
);
}
else
{
}
else
{
setImgAvatart
(
props
.
user
.
picture_url
);
setImgAvatart
(
props
.
user
.
picture_url
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
},
500
);
},
500
);
}
}
}
else
{
}
else
{
setImgAvatart
(
props
.
user
.
picture_url
);
setImgAvatart
(
props
.
user
.
picture_url
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
'upload fail'
);
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
'upload fail'
);
},
500
);
},
500
);
}
}
};
};
const
onchoosGalery
=
()
=>
{
const
onchoosGalery
=
()
=>
{
ImagePicker
.
openPicker
({
ImagePicker
.
openPicker
({
mediaType
:
'photo'
,
mediaType
:
'photo'
,
multiple
:
false
,
multiple
:
false
,
cropping
:
true
,
cropping
:
true
,
width
:
300
,
width
:
300
,
height
:
300
,
height
:
300
,
}).
then
((
image
)
=>
{
}).
then
((
image
)
=>
{
setModalVisible
(
false
);
setModalVisible
(
false
);
callApi
(
image
.
path
);
callApi
(
image
.
path
);
setImgAvatart
(
image
.
path
);
setImgAvatart
(
image
.
path
);
});
});
};
};
const
onCapture
=
()
=>
{
const
onCapture
=
()
=>
{
ImagePicker
.
openCamera
({
ImagePicker
.
openCamera
({
mediaType
:
'photo'
,
mediaType
:
'photo'
,
multiple
:
false
,
multiple
:
false
,
width
:
300
,
width
:
300
,
height
:
300
,
height
:
300
,
cropping
:
true
,
cropping
:
true
,
}).
then
((
image
)
=>
{
}).
then
((
image
)
=>
{
setModalVisible
(
false
);
setModalVisible
(
false
);
callApi
(
image
.
path
);
callApi
(
image
.
path
);
setImgAvatart
(
image
.
path
);
setImgAvatart
(
image
.
path
);
});
});
};
};
return
(
return
(
<
TouchableOpacity
onPress
=
{()
=>
setModalVisible
(
true
)}
>
<
TouchableOpacity
onPress
=
{()
=>
setModalVisible
(
true
)}
>
<
View
style
=
{
styles
.
containerImg
}
>
<
View
style
=
{
styles
.
containerImg
}
>
{
/*{imgAvatart ? (*/
}
{
/*{imgAvatart ? (*/
}
<
Image
source
=
{
imgAvatart
?
{
uri
:
imgAvatart
}
:
R
.
images
.
avartar
}
style
=
{
styles
.
imgAvatar
}
/
>
<
Image
{
/*) : (*/
}
source
=
{
imgAvatart
?
{
uri
:
imgAvatart
}
:
R
.
images
.
iconUser
}
{
/* <View style={styles.imgAvatar}/>*/
}
style
=
{
styles
.
imgAvatar
}
{
/*)}*/
}
/
>
{
/*) : (*/
}
{
/* <View style={styles.imgAvatar}/>*/
}
{
/*)}*/
}
<
View
style
=
{
styles
.
iconPicker
}
>
<
View
style
=
{
styles
.
iconPicker
}
>
<
Image
<
Image
style
=
{{
width
:
20
,
height
:
20
}}
style
=
{{
width
:
20
,
height
:
20
}}
source
=
{
R
.
images
.
imagePicker
}
source
=
{
R
.
images
.
imagePicker
}
/
>
/
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
Modal
<
Modal
isVisible
=
{
isModalVisible
}
isVisible
=
{
isModalVisible
}
style
=
{{
margin
:
0
,
justifyContent
:
'flex-end'
}}
style
=
{{
margin
:
0
,
justifyContent
:
'flex-end'
}}
onSwipeComplete
=
{()
=>
setModalVisible
(
false
)}
onSwipeComplete
=
{()
=>
setModalVisible
(
false
)}
swipeDirection
=
{[
'up'
,
'left'
,
'right'
,
'down'
]}
>
swipeDirection
=
{[
'up'
,
'left'
,
'right'
,
'down'
]}
>
<
TouchableWithoutFeedback
onPress
=
{()
=>
setModalVisible
(
false
)}
>
<
TouchableWithoutFeedback
onPress
=
{()
=>
setModalVisible
(
false
)}
>
<
View
style
=
{{
flex
:
1
}}
><
/View
>
<
View
style
=
{{
flex
:
1
}}
><
/View
>
<
/TouchableWithoutFeedback
>
<
/TouchableWithoutFeedback
>
<
View
style
=
{
styles
.
containerSelect
}
>
<
View
style
=
{
styles
.
containerSelect
}
>
<
AppText
<
AppText
i18nKey
=
{
'Select_source_image'
}
i18nKey
=
{
'Select_source_image'
}
style
=
{{
style
=
{{
textAlign
:
'center'
,
textAlign
:
'center'
,
fontSize
:
getFontXD
(
42
),
fontSize
:
getFontXD
(
42
),
fontWeight
:
'bold'
,
fontWeight
:
'bold'
,
color
:
'#1473E6'
,
color
:
'#1473E6'
,
}}
}}
/
>
/
>
<
View
style
=
{
styles
.
line
}
/
>
<
View
style
=
{
styles
.
line
}
/
>
<
Block
row
space
=
{
'around'
}
center
>
<
Block
row
space
=
{
'around'
}
center
>
<
TouchableOpacity
style
=
{
styles
.
selectionImg
}
onPress
=
{
onCapture
}
>
<
TouchableOpacity
style
=
{
styles
.
selectionImg
}
onPress
=
{
onCapture
}
>
<
Image
style
=
{
styles
.
imgIcon
}
source
=
{
R
.
images
.
iconCamera
}
/
>
<
Image
style
=
{
styles
.
imgIcon
}
source
=
{
R
.
images
.
iconCamera
}
/
>
<
AppText
i18nKey
=
{
'Take_photo'
}
style
=
{
styles
.
txtTitleBtn
}
/
>
<
AppText
i18nKey
=
{
'Take_photo'
}
style
=
{
styles
.
txtTitleBtn
}
/
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
TouchableOpacity
<
TouchableOpacity
style
=
{
styles
.
selectionImg
}
style
=
{
styles
.
selectionImg
}
onPress
=
{
onchoosGalery
}
>
onPress
=
{
onchoosGalery
}
>
<
Image
style
=
{
styles
.
imgIcon
}
source
=
{
R
.
images
.
iconImg
}
/
>
<
Image
style
=
{
styles
.
imgIcon
}
source
=
{
R
.
images
.
iconImg
}
/
>
<
AppText
i18nKey
=
{
'Photo_library'
}
style
=
{
styles
.
txtTitleBtn
}
/
>
<
AppText
i18nKey
=
{
'Photo_library'
}
style
=
{
styles
.
txtTitleBtn
}
/
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
/Block
>
<
/Block
>
<
/View
>
<
/View
>
<
/Modal
>
<
/Modal
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
);
);
};
};
const
styles
=
StyleSheet
.
create
({
const
styles
=
StyleSheet
.
create
({
container
:
{
container
:
{
width
:
WIDTHXD
(
350
),
width
:
WIDTHXD
(
350
),
height
:
HEIGHTXD
(
280
),
height
:
HEIGHTXD
(
280
),
backgroundColor
:
R
.
colors
.
white
,
backgroundColor
:
R
.
colors
.
white
,
borderRadius
:
10
,
borderRadius
:
10
,
borderWidth
:
2
,
borderWidth
:
2
,
borderColor
:
'#DBDBDB'
,
borderColor
:
'#DBDBDB'
,
borderStyle
:
'dashed'
,
borderStyle
:
'dashed'
,
justifyContent
:
'center'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
alignItems
:
'center'
,
},
},
txt
:
{
txt
:
{
fontSize
:
getFontXD
(
42
),
fontSize
:
getFontXD
(
42
),
color
:
R
.
colors
.
color777
,
color
:
R
.
colors
.
color777
,
marginBottom
:
5
,
marginBottom
:
5
,
paddingLeft
:
10
,
paddingLeft
:
10
,
},
},
selectionImg
:
{
selectionImg
:
{
padding
:
10
,
padding
:
10
,
justifyContent
:
'center'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
alignItems
:
'center'
,
},
},
containerSelect
:
{
containerSelect
:
{
height
:
HEIGHTXD
(
520
),
height
:
HEIGHTXD
(
520
),
backgroundColor
:
'white'
,
backgroundColor
:
'white'
,
paddingTop
:
10
,
paddingTop
:
10
,
borderTopLeftRadius
:
20
,
borderTopLeftRadius
:
20
,
borderTopRightRadius
:
20
,
borderTopRightRadius
:
20
,
},
},
line
:
{
line
:
{
height
:
1
,
height
:
1
,
backgroundColor
:
'#929292'
,
backgroundColor
:
'#929292'
,
width
:
'100%'
,
width
:
'100%'
,
marginTop
:
5
,
marginTop
:
5
,
},
},
imgIcon
:
{
imgIcon
:
{
width
:
40
,
width
:
40
,
height
:
40
,
height
:
40
,
},
},
txtTitleBtn
:
{
txtTitleBtn
:
{
textAlign
:
'center'
,
textAlign
:
'center'
,
fontSize
:
getFontXD
(
42
),
fontSize
:
getFontXD
(
42
),
color
:
'#1473E6'
,
color
:
'#1473E6'
,
},
},
imgAvatar
:
{
imgAvatar
:
{
width
:
WIDTHXD
(
180
),
width
:
WIDTHXD
(
180
),
height
:
WIDTHXD
(
180
),
height
:
WIDTHXD
(
180
),
borderRadius
:
WIDTHXD
(
90
),
borderRadius
:
WIDTHXD
(
90
),
},
},
containerImg
:
{
containerImg
:
{
width
:
WIDTHXD
(
180
),
width
:
WIDTHXD
(
180
),
height
:
WIDTHXD
(
180
),
height
:
WIDTHXD
(
180
),
},
},
iconPicker
:
{
iconPicker
:
{
position
:
'absolute'
,
position
:
'absolute'
,
bottom
:
0
,
bottom
:
0
,
right
:
0
,
right
:
0
,
},
},
});
});
const
mapStateToProps
=
(
state
)
=>
{
const
mapStateToProps
=
(
state
)
=>
{
return
{
return
{
user
:
state
.
userReducer
,
user
:
state
.
userReducer
,
};
};
};
};
export
default
connect
(
mapStateToProps
,
{
export
default
connect
(
mapStateToProps
,
{
saveUserToRedux
,
saveUserToRedux
,
showLoading
,
showLoading
,
hideLoading
,
hideLoading
,
})(
PickerImg
);
})(
PickerImg
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment