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
16d4fdc9
Commit
16d4fdc9
authored
Apr 16, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
control notification
parent
85e40365
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
217 additions
and
305 deletions
+217
-305
AndroidManifest.xml
android/app/src/main/AndroidManifest.xml
+1
-1
RootView.js
src/RootView.js
+4
-39
Success.js
src/Screens/Action/Wallet/Tab/Success.js
+23
-11
Watting.js
src/Screens/Action/Wallet/Tab/Watting.js
+31
-14
FeedbackView.js
src/Screens/Feedback/FeedbackView.js
+2
-2
Customer.js
src/Screens/LegalDocument/Customer.js
+1
-1
GeneralInfor.js
src/Screens/Menu/Profile/Tab/GeneralInfor.js
+5
-5
AddMethod.js
src/Screens/MethodPay/AddMethod.js
+1
-1
Calendar.js
src/Screens/NewFeed/Calendar/Calendar.js
+3
-3
item.js
src/Screens/NewFeed/Calendar/item.js
+2
-2
MediaDetail.js
src/Screens/NewFeed/Media/MediaDetail.js
+2
-2
NotificaitonView.js
src/Screens/Notification/NotificaitonView.js
+1
-1
SnackBarAction.js
src/actions/SnackBarAction.js
+3
-6
Drawer.js
src/components/Header/Drawer.js
+1
-1
HeaderBack.js
src/components/Header/HeaderBack.js
+2
-0
HeaderDrawer.js
src/components/Header/HeaderDrawer.js
+3
-1
HeaderHome.js
src/components/Header/HeaderHome.js
+2
-1
HeaderSB.js
src/components/Header/HeaderSB.js
+2
-1
SnackBar.js
src/components/SnackBar.js
+86
-74
FirebaseNotification.js
src/helper/FirebaseNotification.js
+41
-139
StackNavigation.js
src/routers/StackNavigation.js
+1
-0
No files found.
android/app/src/main/AndroidManifest.xml
View file @
16d4fdc9
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
</activity>
</activity>
<activity
<activity
android:name=
"com.zoontek.rnbootsplash.RNBootSplashActivity"
android:name=
"com.zoontek.rnbootsplash.RNBootSplashActivity"
android:theme=
"@style/BootTheme"
android:theme=
"@style/BootTheme"
android:launchMode=
"singleTask"
>
android:launchMode=
"singleTask"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
src/RootView.js
View file @
16d4fdc9
...
@@ -5,51 +5,16 @@ import {connect} from 'react-redux';
...
@@ -5,51 +5,16 @@ import {connect} from 'react-redux';
import
StackNavigation
from
'./routers/StackNavigation'
;
import
StackNavigation
from
'./routers/StackNavigation'
;
import
Modal
from
'react-native-modal'
;
import
Modal
from
'react-native-modal'
;
import
{
SkypeIndicator
}
from
'react-native-indicators'
;
import
{
SkypeIndicator
}
from
'react-native-indicators'
;
import
{
HEIGHT
,
HEIGHTXD
}
from
'./Config/Functions'
;
import
FirebaseNotification
from
'./helper/FirebaseNotification'
;
import
R
from
'./assets/R'
;
import
messaging
from
'@react-native-firebase/messaging'
;
import
{
enableScreens
}
from
'react-native-screens'
;
import
{
enableScreens
}
from
'react-native-screens'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
KEY
from
'./assets/AsynStorage'
;
enableScreens
();
enableScreens
();
const
RootView
=
(
props
)
=>
{
const
RootView
=
(
props
)
=>
{
messaging
().
setBackgroundMessageHandler
(
async
(
remoteMessage
)
=>
{
console
.
log
(
'Message handled in the background!'
,
remoteMessage
);
});
useEffect
(()
=>
{
requestUserPermission
();
const
unsubscribe
=
messaging
().
onMessage
(
async
(
remoteMessage
)
=>
{
console
.
log
(
'A new FCM message arrived!'
,
remoteMessage
);
});
return
unsubscribe
;
},
[]);
const
requestUserPermission
=
async
()
=>
{
const
authStatus
=
await
messaging
().
requestPermission
();
const
enabled
=
authStatus
===
messaging
.
AuthorizationStatus
.
AUTHORIZED
||
authStatus
===
messaging
.
AuthorizationStatus
.
PROVISIONAL
;
if
(
enabled
)
{
getFcmToken
();
console
.
log
(
'Authorization status:'
,
authStatus
);
}
};
const
getFcmToken
=
async
()
=>
{
let
fcmToken
=
await
AsyncStorage
.
getItem
(
KEY
.
FIREBASE
);
console
.
log
(
'Dat tao'
,
fcmToken
);
if
(
!
fcmToken
)
{
fcmToken
=
await
messaging
().
getToken
();
console
.
log
(
'Vua tao'
,
fcmToken
);
if
(
fcmToken
)
{
AsyncStorage
.
setItem
(
KEY
.
FIREBASE
,
fcmToken
);
}
}
};
return
(
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
FirebaseNotification
/>
<
Modal
isVisible
=
{
props
.
loadingModal
.
isVisible
}
>
<
Modal
isVisible
=
{
props
.
loadingModal
.
isVisible
}
>
<
SkypeIndicator
color
=
{
'white'
}
/
>
<
SkypeIndicator
color
=
{
'white'
}
/
>
<
/Modal
>
<
/Modal
>
...
...
src/Screens/Action/Wallet/Tab/Success.js
View file @
16d4fdc9
...
@@ -67,17 +67,29 @@ const Success = (props) => {
...
@@ -67,17 +67,29 @@ const Success = (props) => {
return
(
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
FlatList
{
data
.
length
==
0
?
(
keyExtractor
=
{(
item
)
=>
item
.
transection_id
+
'a'
}
<
View
style
=
{{
justifyContent
:
'center'
,
alignItems
:
'center'
,
flex
:
1
}}
>
refreshing
=
{
isRefresh
}
<
Text
onRefresh
=
{
onRefresh
}
style
=
{{
onEndReachedThreshold
=
{
0.01
}
fontSize
:
18
,
onEndReached
=
{(
info
)
=>
{
fontWeight
:
'bold'
,
onLoadMore
();
}}
>
}}
Kh
ô
ng
c
ó
th
ô
ng
b
á
o
n
à
o
!
data
=
{
data
}
<
/Text
>
renderItem
=
{({
item
})
=>
<
Item
item
=
{
item
}
/>
}
<
/View
>
/>
)
:
(
<
FlatList
keyExtractor
=
{(
item
)
=>
item
.
transection_id
+
'a'
}
refreshing
=
{
isRefresh
}
onRefresh
=
{
onRefresh
}
onEndReachedThreshold
=
{
0.01
}
onEndReached
=
{(
info
)
=>
{
onLoadMore
();
}}
data
=
{
data
}
renderItem
=
{({
item
})
=>
<
Item
item
=
{
item
}
/>
}
/>
)}
<
/View
>
<
/View
>
);
);
};
};
...
...
src/Screens/Action/Wallet/Tab/Watting.js
View file @
16d4fdc9
...
@@ -3,16 +3,21 @@ import {View, Text, FlatList} from 'react-native';
...
@@ -3,16 +3,21 @@ import {View, Text, FlatList} from 'react-native';
import
HeaderBack
from
'../../../../components/Header/HeaderBack'
;
import
HeaderBack
from
'../../../../components/Header/HeaderBack'
;
import
Item
from
'./Item'
;
import
Item
from
'./Item'
;
import
{
getListTransaction
}
from
'../../../../apis/Functions/Widthdraw'
;
import
{
getListTransaction
}
from
'../../../../apis/Functions/Widthdraw'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
const
Watting
=
(
props
)
=>
{
const
Watting
=
(
props
)
=>
{
const
[
page
,
setPage
]
=
useState
(
1
);
const
[
page
,
setPage
]
=
useState
(
1
);
const
[
data
,
setData
]
=
useState
([]);
const
[
data
,
setData
]
=
useState
([]);
const
[
tottalPage
,
setTotalPage
]
=
useState
(
1
);
const
[
tottalPage
,
setTotalPage
]
=
useState
(
1
);
const
[
isRefresh
,
setisRefresh
]
=
useState
(
false
);
const
[
isRefresh
,
setisRefresh
]
=
useState
(
false
);
const
navigation
=
useNavigation
();
useEffect
(()
=>
{
useEffect
(()
=>
{
getData
();
const
unsubscribe
=
navigation
.
addListener
(
'focus'
,
()
=>
{
},
[]);
getData
();
});
return
unsubscribe
;
},
[
navigation
]);
const
getData
=
async
()
=>
{
const
getData
=
async
()
=>
{
setisRefresh
(
true
);
setisRefresh
(
true
);
...
@@ -67,17 +72,29 @@ const Watting = (props) => {
...
@@ -67,17 +72,29 @@ const Watting = (props) => {
return
(
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
FlatList
{
data
.
length
==
0
?
(
keyExtractor
=
{(
item
)
=>
item
.
transection_id
+
'a'
}
<
View
style
=
{{
justifyContent
:
'center'
,
alignItems
:
'center'
,
flex
:
1
}}
>
refreshing
=
{
isRefresh
}
<
Text
onRefresh
=
{
onRefresh
}
style
=
{{
onEndReachedThreshold
=
{
0.01
}
fontSize
:
18
,
onEndReached
=
{(
info
)
=>
{
fontWeight
:
'bold'
,
onLoadMore
();
}}
>
}}
Kh
ô
ng
c
ó
th
ô
ng
b
á
o
n
à
o
!
data
=
{
data
}
<
/Text
>
renderItem
=
{({
item
})
=>
<
Item
item
=
{
item
}
/>
}
<
/View
>
/>
)
:
(
<
FlatList
keyExtractor
=
{(
item
)
=>
item
.
transection_id
+
'a'
}
refreshing
=
{
isRefresh
}
onRefresh
=
{
onRefresh
}
onEndReachedThreshold
=
{
0.01
}
onEndReached
=
{(
info
)
=>
{
onLoadMore
();
}}
data
=
{
data
}
renderItem
=
{({
item
})
=>
<
Item
item
=
{
item
}
/>
}
/>
)}
<
/View
>
<
/View
>
);
);
};
};
...
...
src/Screens/Feedback/FeedbackView.js
View file @
16d4fdc9
...
@@ -62,7 +62,7 @@ const FeedbackView = (props) => {
...
@@ -62,7 +62,7 @@ const FeedbackView = (props) => {
keyboardVerticalOffset
=
{
-
50
}
>
keyboardVerticalOffset
=
{
-
50
}
>
<
TouchableWithoutFeedback
onPress
=
{
Keyboard
.
dismiss
}
>
<
TouchableWithoutFeedback
onPress
=
{
Keyboard
.
dismiss
}
>
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
HeaderBack
isWhite
=
{
true
}
title
=
{
'G
ỬI FEEDBACK
'
}
/
>
<
HeaderBack
isWhite
=
{
true
}
title
=
{
'G
ửi phản hồi
'
}
/
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
Text
style
=
{
styles
.
txt
}
>
Đá
nh
gi
á
d
ị
ch
v
ụ
c
ủ
a
DCV
Invest
<
/Text
>
<
Text
style
=
{
styles
.
txt
}
>
Đá
nh
gi
á
d
ị
ch
v
ụ
c
ủ
a
DCV
Invest
<
/Text
>
...
@@ -149,7 +149,7 @@ const FeedbackView = (props) => {
...
@@ -149,7 +149,7 @@ const FeedbackView = (props) => {
<
View
style
=
{
styles
.
containerBtn
}
>
<
View
style
=
{
styles
.
containerBtn
}
>
<
Button
<
Button
onClick
=
{()
=>
console
.
log
(
'hello'
)}
onClick
=
{()
=>
console
.
log
(
'hello'
)}
title
=
{
'Gửi
feedback
'
}
title
=
{
'Gửi
phản hồi
'
}
/
>
/
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
...
...
src/Screens/LegalDocument/Customer.js
View file @
16d4fdc9
...
@@ -9,7 +9,7 @@ const Customer = (props) => {
...
@@ -9,7 +9,7 @@ const Customer = (props) => {
const
navigate
=
useNavigation
();
const
navigate
=
useNavigation
();
return
(
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
HeaderBack
title
=
{
'K
inh doanh chu
ng'
}
/
>
<
HeaderBack
title
=
{
'K
hách hà
ng'
}
/
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
Text
<
Text
style
=
{{
style
=
{{
...
...
src/Screens/Menu/Profile/Tab/GeneralInfor.js
View file @
16d4fdc9
...
@@ -113,11 +113,11 @@ const GeneralInfor = (props) => {
...
@@ -113,11 +113,11 @@ const GeneralInfor = (props) => {
<
View
style
=
{{
height
:
40
}}
/
>
<
View
style
=
{{
height
:
40
}}
/
>
<
View
style
=
{{
justifyContent
:
'center'
,
alignItems
:
'center'
}}
>
<
View
style
=
{{
justifyContent
:
'center'
,
alignItems
:
'center'
}}
>
{
/*
<TouchableOpacity
<
TouchableOpacity
onPress={() => console.log('Hello')}
onPress
=
{()
=>
console
.
log
(
'Hello'
)}
style={styles.btn}>
style
=
{
styles
.
btn
}
>
<Text style={styles.txtBtn}>Cập nhật</Text>
<
Text
style
=
{
styles
.
txtBtn
}
>
C
ậ
p
nh
ậ
t
<
/Text
>
</TouchableOpacity> */
}
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/ScrollView
>
<
/ScrollView
>
...
...
src/Screens/MethodPay/AddMethod.js
View file @
16d4fdc9
...
@@ -70,7 +70,7 @@ const AddMethodPay = (props) => {
...
@@ -70,7 +70,7 @@ const AddMethodPay = (props) => {
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
bank_id
:
bank_id
.
id
,
bank_id
:
bank_id
.
id
,
branch_name
,
branch_name
,
account_name
,
account_name
:
account_name
.
toUpperCase
()
,
account_no
,
account_no
,
});
});
props
.
hideLoading
();
props
.
hideLoading
();
...
...
src/Screens/NewFeed/Calendar/Calendar.js
View file @
16d4fdc9
...
@@ -37,16 +37,16 @@ const NewFeed = (props) => {
...
@@ -37,16 +37,16 @@ const NewFeed = (props) => {
const
scrollToCurrent
=
()
=>
{
const
scrollToCurrent
=
()
=>
{
const
date
=
new
Date
();
const
date
=
new
Date
();
let
index
=
0
;
let
index
=
0
;
const
today
=
convertTimeApi
(
date
);
const
today
=
convertTimeApi
(
date
);
if
(
data
.
length
>
0
)
{
if
(
data
.
length
>
0
)
{
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
start_date
.
substring
(
0
,
10
)
==
today
)
{
if
(
data
[
i
].
start_date
.
substring
(
0
,
10
)
==
today
)
{
index
=
i
;
index
=
i
;
break
;
break
;
}
else
{
index
=
30
-
today
.
substring
(
8
);
}
}
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
ListDayRef
.
current
.
scrollToIndex
({
ListDayRef
.
current
.
scrollToIndex
({
animated
:
true
,
animated
:
true
,
...
@@ -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
:
7
0
*
index
,
offset
:
6
0
*
index
,
index
,
index
,
});
});
...
...
src/Screens/NewFeed/Calendar/item.js
View file @
16d4fdc9
...
@@ -35,7 +35,7 @@ const styles = StyleSheet.create({
...
@@ -35,7 +35,7 @@ const styles = StyleSheet.create({
},
},
right
:
{
right
:
{
marginLeft
:
20
,
marginLeft
:
20
,
paddingVertical
:
2
0
,
paddingVertical
:
1
0
,
borderTopWidth
:
0.6
,
borderTopWidth
:
0.6
,
borderBottomWidth
:
0.6
,
borderBottomWidth
:
0.6
,
borderColor
:
'#CECECE'
,
borderColor
:
'#CECECE'
,
...
@@ -52,7 +52,7 @@ const styles = StyleSheet.create({
...
@@ -52,7 +52,7 @@ const styles = StyleSheet.create({
backgroundColor
:
R
.
colors
.
main
,
backgroundColor
:
R
.
colors
.
main
,
borderRadius
:
5
,
borderRadius
:
5
,
marginLeft
:
-
5
,
marginLeft
:
-
5
,
marginTop
:
2
5
,
marginTop
:
1
5
,
},
},
txtTitle
:
{
txtTitle
:
{
fontSize
:
getFontXD
(
42
),
fontSize
:
getFontXD
(
42
),
...
...
src/Screens/NewFeed/Media/MediaDetail.js
View file @
16d4fdc9
...
@@ -38,11 +38,11 @@ const Item = (props) => {
...
@@ -38,11 +38,11 @@ const Item = (props) => {
<
/ImageBackground
>
<
/ImageBackground
>
<
View
style
=
{
styles
.
wrapRight
}
>
<
View
style
=
{
styles
.
wrapRight
}
>
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
Text
style
=
{
styles
.
txtTitle
}
numberOfLines
=
{
2
}
>
<
Text
style
=
{
styles
.
txtTitle
}
numberOfLines
=
{
4
}
>
{
title
}
{
title
}
<
/Text
>
<
/Text
>
<
/View
>
<
/View
>
<
Text
>
{
published_at
}
<
/Text
>
<
Text
style
=
{{
color
:
'#8E8C8C'
}}
>
{
published_at
}
<
/Text
>
<
/View
>
<
/View
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
);
);
...
...
src/Screens/Notification/NotificaitonView.js
View file @
16d4fdc9
...
@@ -68,7 +68,7 @@ const NotificaitonView = (props) => {
...
@@ -68,7 +68,7 @@ const NotificaitonView = (props) => {
<
View
style
=
{{
justifyContent
:
'center'
,
alignItems
:
'center'
,
flex
:
1
}}
>
<
View
style
=
{{
justifyContent
:
'center'
,
alignItems
:
'center'
,
flex
:
1
}}
>
<
Text
<
Text
style
=
{{
style
=
{{
fontSize
:
getFontXD
(
46
)
,
fontSize
:
18
,
fontWeight
:
'bold'
,
fontWeight
:
'bold'
,
}}
>
}}
>
Kh
ô
ng
c
ó
th
ô
ng
b
á
o
n
à
o
!
Kh
ô
ng
c
ó
th
ô
ng
b
á
o
n
à
o
!
...
...
src/actions/SnackBarAction.js
View file @
16d4fdc9
import
{
import
{
PUSHNOTI
,
HIDENOTI
}
from
'./actionTypes'
;
PUSHNOTI
,
HIDENOTI
}
from
'./actionTypes'
;
export
const
showNotificaton
=
(
data
)
=>
{
export
const
showNotificaton
=
(
data
)
=>
{
return
{
return
{
type
:
PUSHNOTI
,
type
:
PUSHNOTI
,
data
data
,
};
};
};
};
export
const
hideNotification
=
()
=>
{
export
const
hideNotification
=
()
=>
{
return
{
return
{
type
:
HIDENOTI
type
:
HIDENOTI
,
};
};
};
};
src/components/Header/Drawer.js
View file @
16d4fdc9
...
@@ -77,7 +77,7 @@ const Drawer = (props) => {
...
@@ -77,7 +77,7 @@ const Drawer = (props) => {
navigate
.
navigate
(
PROFILE
);
navigate
.
navigate
(
PROFILE
);
}}
>
}}
>
<
Text
style
=
{
styles
.
txtTop
}
>
{
props
.
user
.
fullname
}
<
/Text
>
<
Text
style
=
{
styles
.
txtTop
}
>
{
props
.
user
.
fullname
}
<
/Text
>
<
Text
>
{
props
.
user
.
sponso
r_id
}
<
/Text
>
<
Text
>
{
props
.
user
.
use
r_id
}
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
TouchableOpacity
<
TouchableOpacity
onPress
=
{()
=>
{
onPress
=
{()
=>
{
...
...
src/components/Header/HeaderBack.js
View file @
16d4fdc9
...
@@ -18,6 +18,7 @@ import LinearGradient from 'react-native-linear-gradient';
...
@@ -18,6 +18,7 @@ import LinearGradient from 'react-native-linear-gradient';
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
{
HEIGHTXD
}
from
'../../Config/Functions'
;
import
{
HEIGHTXD
}
from
'../../Config/Functions'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
SnackBar
from
'../SnackBar'
;
const
HeaderHome
=
(
props
)
=>
{
const
HeaderHome
=
(
props
)
=>
{
const
{
title
,
isWhite
}
=
props
;
const
{
title
,
isWhite
}
=
props
;
const
navigate
=
useNavigation
();
const
navigate
=
useNavigation
();
...
@@ -26,6 +27,7 @@ const HeaderHome = (props) => {
...
@@ -26,6 +27,7 @@ const HeaderHome = (props) => {
imageStyle
=
{{
resizeMode
:
'stretch'
}}
imageStyle
=
{{
resizeMode
:
'stretch'
}}
style
=
{[
styles
.
img
,
isWhite
?
{
backgroundColor
:
'white'
}
:
{}]}
style
=
{[
styles
.
img
,
isWhite
?
{
backgroundColor
:
'white'
}
:
{}]}
source
=
{
R
.
images
.
bgHeader
}
>
source
=
{
R
.
images
.
bgHeader
}
>
<
SnackBar
/>
<
StatusBar
backgroundColor
=
"transparent"
translucent
=
{
true
}
/
>
<
StatusBar
backgroundColor
=
"transparent"
translucent
=
{
true
}
/
>
<
View
style
=
{
styles
.
headerContainer
}
>
<
View
style
=
{
styles
.
headerContainer
}
>
<
TouchableOpacity
onPress
=
{()
=>
navigate
.
goBack
()}
>
<
TouchableOpacity
onPress
=
{()
=>
navigate
.
goBack
()}
>
...
...
src/components/Header/HeaderDrawer.js
View file @
16d4fdc9
...
@@ -19,7 +19,7 @@ import {connect} from 'react-redux';
...
@@ -19,7 +19,7 @@ import {connect} from 'react-redux';
import
{
HEIGHTXD
}
from
'../../Config/Functions'
;
import
{
HEIGHTXD
}
from
'../../Config/Functions'
;
import
Modal
from
'react-native-modal'
;
import
Modal
from
'react-native-modal'
;
import
Drawer
from
'./Drawer'
;
import
Drawer
from
'./Drawer'
;
import
SnackBar
from
'../SnackBar'
;
const
HeaderDrawer
=
(
props
)
=>
{
const
HeaderDrawer
=
(
props
)
=>
{
const
{
title
,
isWhite
}
=
props
;
const
{
title
,
isWhite
}
=
props
;
const
[
isModalVisible
,
setModalVisible
]
=
useState
(
false
);
const
[
isModalVisible
,
setModalVisible
]
=
useState
(
false
);
...
@@ -33,7 +33,9 @@ const HeaderDrawer = (props) => {
...
@@ -33,7 +33,9 @@ const HeaderDrawer = (props) => {
imageStyle
=
{{
resizeMode
:
'stretch'
}}
imageStyle
=
{{
resizeMode
:
'stretch'
}}
style
=
{[
styles
.
img
,
isWhite
?
{
backgroundColor
:
'white'
}
:
{}]}
style
=
{[
styles
.
img
,
isWhite
?
{
backgroundColor
:
'white'
}
:
{}]}
source
=
{
R
.
images
.
bgHeader
}
>
source
=
{
R
.
images
.
bgHeader
}
>
<
SnackBar
/>
<
StatusBar
backgroundColor
=
"transparent"
translucent
=
{
true
}
/
>
<
StatusBar
backgroundColor
=
"transparent"
translucent
=
{
true
}
/
>
<
View
style
=
{
styles
.
headerContainer
}
>
<
View
style
=
{
styles
.
headerContainer
}
>
<
TouchableOpacity
onPress
=
{
toggleModal
}
>
<
TouchableOpacity
onPress
=
{
toggleModal
}
>
<
Image
source
=
{
R
.
images
.
iconMenu
}
style
=
{
styles
.
imgIcon
}
/
>
<
Image
source
=
{
R
.
images
.
iconMenu
}
style
=
{
styles
.
imgIcon
}
/
>
...
...
src/components/Header/HeaderHome.js
View file @
16d4fdc9
...
@@ -17,7 +17,7 @@ import LinearGradient from 'react-native-linear-gradient';
...
@@ -17,7 +17,7 @@ import LinearGradient from 'react-native-linear-gradient';
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
{
HEIGHTXD
,
toPriceVnd
}
from
'../../Config/Functions'
;
import
{
HEIGHTXD
,
toPriceVnd
}
from
'../../Config/Functions'
;
import
Clipboard
from
'@react-native-clipboard/clipboard'
;
import
Clipboard
from
'@react-native-clipboard/clipboard'
;
import
SnackBar
from
'../SnackBar'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
import
{
WITHDRAW
,
WITHDRAW
,
...
@@ -117,6 +117,7 @@ const HeaderHome = (props) => {
...
@@ -117,6 +117,7 @@ const HeaderHome = (props) => {
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
SnackBar
/>
<
StatusBar
backgroundColor
=
"transparent"
translucent
=
{
true
}
/
>
<
StatusBar
backgroundColor
=
"transparent"
translucent
=
{
true
}
/
>
<
View
<
View
style
=
{{
style
=
{{
...
...
src/components/Header/HeaderSB.js
View file @
16d4fdc9
...
@@ -18,7 +18,7 @@ import {getFontXD, HEIGHT, WIDTHXD} from '../../Config/Functions';
...
@@ -18,7 +18,7 @@ import {getFontXD, HEIGHT, WIDTHXD} from '../../Config/Functions';
import
LinearGradient
from
'react-native-linear-gradient'
;
import
LinearGradient
from
'react-native-linear-gradient'
;
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
{
HEIGHTXD
}
from
'../../Config/Functions'
;
import
{
HEIGHTXD
}
from
'../../Config/Functions'
;
import
SnackBar
from
'../SnackBar'
;
import
Icon
from
'react-native-vector-icons/Ionicons'
;
import
Icon
from
'react-native-vector-icons/Ionicons'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
...
@@ -39,6 +39,7 @@ const HeaderSearch = (props) => {
...
@@ -39,6 +39,7 @@ const HeaderSearch = (props) => {
style
=
{[
styles
.
img
,
isWhite
?
{
backgroundColor
:
'white'
}
:
{}]}
style
=
{[
styles
.
img
,
isWhite
?
{
backgroundColor
:
'white'
}
:
{}]}
source
=
{
R
.
images
.
bgHeader
}
>
source
=
{
R
.
images
.
bgHeader
}
>
<
StatusBar
backgroundColor
=
"transparent"
translucent
=
{
true
}
/
>
<
StatusBar
backgroundColor
=
"transparent"
translucent
=
{
true
}
/
>
<
SnackBar
/>
<
View
style
=
{
styles
.
headerContainer
}
>
<
View
style
=
{
styles
.
headerContainer
}
>
<
TouchableOpacity
onPress
=
{()
=>
navigate
.
goBack
()}
>
<
TouchableOpacity
onPress
=
{()
=>
navigate
.
goBack
()}
>
<
Image
source
=
{
R
.
images
.
iconBack
}
style
=
{
styles
.
imgIcon
}
/
>
<
Image
source
=
{
R
.
images
.
iconBack
}
style
=
{
styles
.
imgIcon
}
/
>
...
...
src/components/SnackBar.js
View file @
16d4fdc9
import
React
,{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
View
,
Text
,
StyleSheet
,
TouchableOpacity
,
StatusBar
,
TouchableWithoutFeedback
}
from
'react-native'
;
import
{
import
R
from
'../assets/R'
View
,
import
Block
from
'./Block'
Text
,
import
{
getFontXD
,
HEIGHTXD
}
from
"../config/Functions"
;
StyleSheet
,
import
LinearGradient
from
"react-native-linear-gradient"
;
TouchableOpacity
,
StatusBar
,
TouchableWithoutFeedback
,
}
from
'react-native'
;
import
R
from
'../assets/R'
;
import
Block
from
'./Block'
;
import
{
getFontXD
,
HEIGHTXD
}
from
'../Config/Functions'
;
import
LinearGradient
from
'react-native-linear-gradient'
;
import
Modal
from
'react-native-modal'
;
import
Modal
from
'react-native-modal'
;
import
SnackReducer
from
"../reducers/SnackReducer"
;
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
import
{
showNotificaton
,
hideNotification
}
from
'../actions/SnackBarAction'
;
import
{
showNotificaton
,
hideNotification
}
from
'../actions/SnackBarAction'
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
const
SnackBar
=
(
props
)
=>
{
const
SnackBar
=
(
props
)
=>
{
const
navigate
=
useNavigation
();
const
{
isOpen
,
title
,
content
,
screen
,
id_record
}
=
props
.
snackReducer
;
useEffect
(()
=>
{
console
.
log
(
'Reducer'
,
props
.
snackReducer
);
if
(
isOpen
)
setTimeout
(()
=>
{
props
.
hideNotification
();
},
10000
);
},
[
props
.
snackReducer
]);
const
navigation
=
useNavigation
();
return
(
<
Modal
style
=
{{
padding
:
0
,
margin
:
0
}}
const
{
isOpen
,
title
,
content
,
screen
,
id_record
}
=
props
.
snackReducer
animationInTiming
=
{
1500
}
useEffect
(()
=>
{
animationOutTiming
=
{
800
}
if
(
isOpen
)
backdropOpacity
=
{
0
}
setTimeout
(()
=>
{
animationIn
=
{
'slideInDown'
}
props
.
hideNotification
()
animationOut
=
{
'slideOutUp'
}
},
10000
)
isVisible
=
{
isOpen
}
>
<
View
style
=
{
styles
.
container
}
>
},[
props
.
snackReducer
])
<
View
style
=
{{
flex
:
1
}}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
{
title
}
<
/Text
>
return
(
<
Text
numberOfLines
=
{
2
}
style
=
{
styles
.
txt
}
>
<
Modal
style
=
{{
padding
:
0
,
margin
:
0
}}
animationInTiming
=
{
1500
}
animationOutTiming
=
{
800
}
backdropOpacity
=
{
0
}
{
content
}
animationIn
=
{
'slideInDown'
}
animationOut
=
{
'slideOutUp'
}
isVisible
=
{
isOpen
}
>
<
/Text
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{{
flex
:
1
}}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
{
title
}
<
/Text
>
<
Text
numberOfLines
=
{
2
}
style
=
{
styles
.
txt
}
>
{
content
}
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
row
}
>
<
TouchableOpacity
onPress
=
{
()
=>
props
.
hideNotification
()}
style
=
{
styles
.
btn
}
>
<
Text
style
=
{
styles
.
txtBtn
}
>
Đó
ng
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
{
props
.
hideNotification
()
navigation
.
navigate
(
screen
,{
id
:
id_record
})
}
}
style
=
{[
styles
.
btn
,{
marginLeft
:
20
}]}
>
<
Text
style
=
{
styles
.
txtBtn
}
>
Chi
ti
ế
t
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
<
TouchableWithoutFeedback
onPress
=
{
()
=>
props
.
hideNotification
()}
>
<
View
style
=
{
styles
.
row
}
>
<
View
style
=
{{
flex
:
1
}}
>
<
TouchableOpacity
onPress
=
{()
=>
props
.
hideNotification
()}
style
=
{
styles
.
btn
}
>
<
Text
style
=
{
styles
.
txtBtn
}
>
Đó
ng
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
{
props
.
hideNotification
();
navigate
.
navigate
(
screen
,
{
id
:
id_record
});
}}
style
=
{[
styles
.
btn
,
{
marginLeft
:
20
}]}
>
<
Text
style
=
{
styles
.
txtBtn
}
>
Chi
ti
ế
t
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
<
TouchableWithoutFeedback
onPress
=
{()
=>
props
.
hideNotification
()}
>
<
View
style
=
{{
flex
:
1
}}
><
/View
>
<
/TouchableWithoutFeedback
>
<
/TouchableWithoutFeedback
>
<
/Modal
>
<
/Modal
>
);
};
const
mapStateToProps
=
(
state
)
=>
{
)
}
const
mapStateToProps
=
(
state
)
=>
{
return
{
return
{
snackReducer
:
state
.
SnackReducer
,
snackReducer
:
state
.
SnackReducer
,
};
};
};
};
export
default
connect
(
mapStateToProps
,
{
showNotificaton
,
hideNotification
})(
SnackBar
);
export
default
connect
(
mapStateToProps
,
{
showNotificaton
,
hideNotification
})(
SnackBar
,
);
const
styles
=
StyleSheet
.
create
({
const
styles
=
StyleSheet
.
create
({
container
:{
container
:
{
marginTop
:
10
,
marginTop
:
10
,
height
:
HEIGHTXD
(
380
),
height
:
HEIGHTXD
(
380
),
backgroundColor
:
R
.
colors
.
white
,
backgroundColor
:
R
.
colors
.
white
,
marginHorizontal
:
10
,
marginHorizontal
:
10
,
borderRadius
:
10
,
borderRadius
:
10
,
paddingVertical
:
10
,
paddingVertical
:
10
,
paddingHorizontal
:
10
,
paddingHorizontal
:
10
,
shadowColor
:
'#000'
,
shadowColor
:
'#000'
,
shadowOffset
:
{
shadowOffset
:
{
width
:
0
,
width
:
0
,
...
@@ -83,21 +95,21 @@ const styles=StyleSheet.create({
...
@@ -83,21 +95,21 @@ const styles=StyleSheet.create({
shadowRadius
:
3.84
,
shadowRadius
:
3.84
,
elevation
:
3
,
elevation
:
3
,
},
},
row
:{
row
:
{
flexDirection
:
'row'
,
flexDirection
:
'row'
,
justifyContent
:
'flex-end'
,
justifyContent
:
'flex-end'
,
},
},
txt
:{
txt
:
{
color
:
R
.
colors
.
black
color
:
R
.
colors
.
black
,
},
},
txtBtn
:{
txtBtn
:
{
fontSize
:
getFontXD
(
42
),
fontSize
:
getFontXD
(
42
),
color
:
R
.
colors
.
txtMain
,
color
:
R
.
colors
.
txtMain
,
fontWeight
:
'bold'
fontWeight
:
'bold'
,
},
},
txtTitle
:{
txtTitle
:
{
fontSize
:
getFontXD
(
42
),
fontSize
:
getFontXD
(
42
),
color
:
R
.
colors
.
black
,
color
:
R
.
colors
.
black
,
fontWeight
:
'bold'
fontWeight
:
'bold'
,
}
}
,
})
})
;
src/helper/FirebaseNotification.js
View file @
16d4fdc9
/* eslint-disable no-console */
/* eslint-disable no-console */
import
React
from
'react'
;
import
React
,
{
useEffect
}
from
'react'
;
import
{
Platform
,
View
,
Alert
}
from
'react-native'
;
import
{
Platform
,
View
,
Alert
}
from
'react-native'
;
import
firebase
from
'@react-native-firebase/app'
;
import
messaging
from
'@react-native-firebase/messaging'
;
import
sampleaudio
from
'../../sampleaudio.mp3'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
KEY
from
'../assets/AsynStorage'
;
import
KEY
from
'../assets/AsynStorage'
;
import
{
showNotificaton
,
updateNotification
}
from
'../actions/SnackBarAction'
;
class
FirebaseNotification
extends
React
.
PureComponent
{
import
{
connect
}
from
'react-redux'
;
checkPermission
=
()
=>
{
const
FirebaseNotification
=
(
props
)
=>
{
firebase
messaging
().
setBackgroundMessageHandler
(
async
(
remoteMessage
)
=>
{
.
messaging
()
console
.
log
(
'Message handled in the background!'
,
remoteMessage
);
.
hasPermission
()
});
.
then
((
enabled
)
=>
{
useEffect
(()
=>
{
if
(
enabled
)
{
requestUserPermission
();
this
.
getToken
();
const
unsubscribe
=
messaging
().
onMessage
(
async
(
remoteMessage
)
=>
{
}
else
{
console
.
log
(
'A new FCM message arrived!'
,
remoteMessage
);
this
.
requestPermission
();
props
.
showNotificaton
({
}
title
:
'Title'
,
content
:
'Content notification'
,
screen
:
'NOTIFICATION'
,
id_record
:
9
,
});
});
};
});
return
unsubscribe
;
},
[]);
requestPermission
=
async
()
=>
{
const
requestUserPermission
=
async
()
=>
{
try
{
const
authStatus
=
await
messaging
().
requestPermission
();
await
firebase
.
messaging
().
requestPermission
();
const
enabled
=
this
.
getToken
();
authStatus
===
messaging
.
AuthorizationStatus
.
AUTHORIZED
||
}
catch
(
error
)
{}
authStatus
===
messaging
.
AuthorizationStatus
.
PROVISIONAL
;
};
getToken
=
async
()
=>
{
if
(
enabled
)
{
getFcmToken
();
}
};
const
getFcmToken
=
async
()
=>
{
let
fcmToken
=
await
AsyncStorage
.
getItem
(
KEY
.
FIREBASE
);
let
fcmToken
=
await
AsyncStorage
.
getItem
(
KEY
.
FIREBASE
);
console
.
log
(
'Dat tao'
,
fcmToken
);
if
(
!
fcmToken
)
{
if
(
!
fcmToken
)
{
fcmToken
=
await
firebase
.
messaging
().
getToken
();
fcmToken
=
await
messaging
().
getToken
();
console
.
log
(
'Vua tao'
,
fcmToken
);
if
(
fcmToken
)
{
if
(
fcmToken
)
{
AsyncStorage
.
setItem
(
KEY
.
FIREBASE
,
fcmToken
);
AsyncStorage
.
setItem
(
KEY
.
FIREBASE
,
fcmToken
);
}
}
}
}
};
};
return
<
View
/>
;
};
async
componentDidMount
()
{
const
mapStateToProps
=
(
state
)
=>
{
this
.
checkPermission
();
return
{
this
.
createNotificationListeners
();
loadingModal
:
state
.
ModalLoadingReducer
,
this
.
removeNotificationDisplayedListener
=
firebase
};
.
notifications
()
};
.
onNotificationDisplayed
((
notification
)
=>
{
console
.
log
(
'Can alert'
,
notification
);
this
.
props
.
onReceived
(
notification
);
// Process your notification as required
// ANDROID: Remote notifications do not contain the channel ID. You will have to specify this manually if you'd like to re-display the notification.
});
}
componentWillUnmount
()
{
this
.
removeNotificationDisplayedListener
;
this
.
notificationListener
;
this
.
notificationOpenedListener
;
}
async
createNotificationListeners
()
{
/*
* Triggered when a particular notification has been received in foreground
* */
console
.
log
(
'Notification log'
);
const
channel
=
new
firebase
.
notifications
.
Android
.
Channel
(
'500'
,
'Channel Name 1001'
,
firebase
.
notifications
.
Android
.
Importance
.
Max
,
)
.
setDescription
(
'A natural description of the channel'
)
.
setSound
(
'default'
);
firebase
.
notifications
().
android
.
createChannel
(
channel
);
this
.
notificationListener
=
firebase
.
notifications
()
.
onNotification
((
notification
)
=>
{
console
.
log
(
'notificaiton'
,
notification
);
if
(
Platform
.
OS
===
'android'
)
{
const
localNotification
=
new
firebase
.
notifications
.
Notification
({
sound
:
sampleaudio
,
show_in_foreground
:
true
,
})
.
setSound
(
'default'
)
.
setNotificationId
(
notification
.
notificationId
)
.
setTitle
(
notification
.
title
)
.
setBody
(
notification
.
body
)
.
setData
(
notification
.
data
)
.
android
.
setChannelId
(
'default_notification_channel_id'
)
// e.g. the id you chose above
// .android.setSmallIcon('@mipmap/ic_launcher') // create this icon in Android Studio
// .android.setColor('red') // you can set a color here
.
android
.
setPriority
(
firebase
.
notifications
.
Android
.
Priority
.
High
)
.
android
.
setVibrate
([
300
])
.
android
.
setDefaults
([
firebase
.
notifications
.
Android
.
Defaults
.
Vibrate
,
]);
console
.
log
(
'Notification:'
,
localNotification
);
firebase
.
notifications
()
.
displayNotification
(
localNotification
)
.
catch
((
err
)
=>
console
.
error
(
'Chay vao day android'
,
err
));
}
else
if
(
Platform
.
OS
===
'ios'
)
{
const
localNotification
=
new
firebase
.
notifications
.
Notification
()
.
setNotificationId
(
notification
.
notificationId
)
.
setTitle
(
notification
.
title
)
.
setSubtitle
(
notification
.
subtitle
)
.
setBody
(
notification
.
body
)
.
setData
(
notification
.
data
)
.
ios
.
setBadge
(
notification
.
ios
.
badge
)
.
ios
.
setLaunchImage
(
'@mipmap/ic_stat_ic_notification'
);
firebase
.
notifications
()
.
displayNotification
(
localNotification
)
.
catch
((
err
)
=>
console
.
error
(
'Chay vao day'
,
err
));
}
// this.getNotifyNumber();
});
/*
* If your app is in background, you can listen for when a notification is clicked / tapped / opened as follows:
* */
this
.
notificationOpenedListener
=
firebase
.
notifications
()
.
onNotificationOpened
((
notificationOpen
)
=>
{
this
.
props
.
onOpened
(
notificationOpen
.
notification
);
});
/*
* If your app is closed, you can check if it was opened by a notification being clicked / tapped / opened as follows:
* */
const
notificationOpen
=
await
firebase
.
notifications
()
.
getInitialNotification
();
if
(
notificationOpen
)
{
this
.
props
.
onOpened
(
notificationOpen
.
notification
);
}
/*
* Triggered for data only payload in foreground
* */
this
.
messageListener
=
firebase
.
messaging
().
onMessage
((
message
)
=>
{
// process data message
console
.
log
(
'message---'
,
message
);
this
.
props
.
onReceived
(
message
);
});
}
render
()
{
return
<
View
/>
;
}
}
export
default
FirebaseNotification
;
export
default
connect
(
mapStateToProps
,
{
showNotificaton
,
updateNotification
})(
FirebaseNotification
,
);
src/routers/StackNavigation.js
View file @
16d4fdc9
...
@@ -43,6 +43,7 @@ import LegaDocument from '../Screens/LegalDocument/LegalDocument';
...
@@ -43,6 +43,7 @@ import LegaDocument from '../Screens/LegalDocument/LegalDocument';
import
Business
from
'../Screens/LegalDocument/Business'
;
import
Business
from
'../Screens/LegalDocument/Business'
;
import
Customer
from
'../Screens/LegalDocument/Customer'
;
import
Customer
from
'../Screens/LegalDocument/Customer'
;
import
Partner
from
'../Screens/LegalDocument/Partner'
;
import
Partner
from
'../Screens/LegalDocument/Partner'
;
import
SnackBar
from
'../components/SnackBar'
;
import
*
as
ScreenName
from
'./ScreenNames'
;
import
*
as
ScreenName
from
'./ScreenNames'
;
...
...
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