Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
safetcut-app
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
atichat
safetcut-app
Commits
8ab12442
Commit
8ab12442
authored
Aug 30, 2019
by
Tonk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update test read notification
parent
8d82acd1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
184 additions
and
65 deletions
+184
-65
screens/Private/HistoryScreen/HistoryScreen.js
+1
-1
screens/Private/HistoryScreen/history.json
+0
-12
screens/Private/NotificationScreen/NotificationScreen.js
+17
-3
screens/Private/NotificationScreen/notification.json
+140
-19
screens/Private/TimerScreen/TimerScreen.ios.js
+26
-30
No files found.
screens/Private/HistoryScreen/HistoryScreen.js
View file @
8ab12442
...
...
@@ -108,7 +108,7 @@ export default class HistoryScreen extends React.Component {
<
XAxis
style
=
{{
marginHorizontal
:
-
10
,
position
:
'absolute'
,
left
:
40
,
right
:
15
,
bottom
:
0
}}
data
=
{
data
}
formatLabel
=
{(
value
,
index
)
=>
format
(
data
[
index
].
time
*
1000
,
'
hh:mm
'
)}
formatLabel
=
{(
value
,
index
)
=>
format
(
data
[
index
].
time
*
1000
,
'
D/M/YY
'
)}
contentInset
=
{{
left
:
10
,
right
:
10
}}
svg
=
{{
fontSize
:
8
,
fill
:
color
.
grey
}}
/
>
...
...
screens/Private/HistoryScreen/history.json
View file @
8ab12442
[
{
"time"
:
1566370057
,
"data"
:
356
},
{
"time"
:
1564639200
,
"data"
:
345
},
...
...
@@ -12,18 +8,10 @@
"data"
:
2356
},
{
"time"
:
1566374629
,
"data"
:
123
},
{
"time"
:
1566317460
,
"data"
:
45
},
{
"time"
:
1566438573
,
"data"
:
457
},
{
"time"
:
1565863930
,
"data"
:
243
},
...
...
screens/Private/NotificationScreen/NotificationScreen.js
View file @
8ab12442
...
...
@@ -10,6 +10,7 @@ import { width, height } from '../../../constants/Layout';
import
RNPickerSelect
from
'react-native-picker-select'
;
import
CalendarPicker
from
'react-native-calendar-picker'
;
import
{
TouchableWithoutFeedback
}
from
'react-native-gesture-handler'
;
import
{
withNavigationFocus
}
from
'react-navigation'
;
const
tabHeader
=
[
{
type
:
'all'
,
label
:
'All'
},
...
...
@@ -17,7 +18,7 @@ const tabHeader = [
{
type
:
'log'
,
label
:
'Logging'
},
];
const
dt2
=
require
(
'./notification.json'
);
export
default
class
NotificationScreen
extends
React
.
Component
{
class
NotificationScreen
extends
React
.
Component
{
static
navigationOptions
=
({
navigation
})
=>
({
title
:
'Notifications'
,
headerLeft
:
(
...
...
@@ -46,6 +47,17 @@ export default class NotificationScreen extends React.Component {
componentDidMount
()
{
this
.
sortDate
();
}
componentDidUpdate
(
prevProps
)
{
if
(
prevProps
.
isFocused
!==
this
.
props
.
isFocused
)
{
console
.
log
(
'test read notification'
);
this
.
setState
(
state
=>
{
const
readed
=
state
.
data
.
map
(
item
=>
(
item
.
read
=
true
));
return
{
readed
,
};
});
}
}
sortDate
()
{
const
sortData
=
dt2
.
sort
(
function
(
a
,
b
)
{
var
dateA
=
new
Date
(
a
.
time
),
...
...
@@ -162,9 +174,8 @@ export default class NotificationScreen extends React.Component {
return
(
<
View
style
=
{[
theme
.
rowContainer
,
styles
.
actionContainer
,
// { backgroundColor: un
read ? 'rgba(238, 84, 84, 0.15)' : color.white },
{
backgroundColor
:
!
data
.
read
?
'rgba(238, 84, 84, 0.15)'
:
color
.
white
},
]}
>
{
data
.
type
===
'log'
?
(
...
...
@@ -409,6 +420,8 @@ export default class NotificationScreen extends React.Component {
}
}
export
default
withNavigationFocus
(
NotificationScreen
);
// style -------------------------------------------------------
const
pickerStyle
=
{
inputIOS
:
{
...
...
@@ -451,6 +464,7 @@ const styles = StyleSheet.create({
color
:
color
.
grey
,
},
actionContainer
:
{
...
theme
.
rowContainer
,
paddingHorizontal
:
30
,
paddingVertical
:
15
,
alignItems
:
'flex-start'
,
...
...
screens/Private/NotificationScreen/notification.json
View file @
8ab12442
[
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566370057
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 4"
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1564639200
,
"action"
:
"Switched off"
,
"device"
:
"sub breaker 1"
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566370057
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 4"
,
"read"
:
true
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1564639200
,
"action"
:
"Switched off"
,
"device"
:
"sub breaker 1"
,
"read"
:
true
},
{
"type"
:
"notification"
,
"user"
:
"Sukanya161"
,
"time"
:
1566370196
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 2"
"device"
:
"sub breaker 2"
,
"read"
:
true
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566371305
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 1"
,
"read"
:
true
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566374629
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 3"
,
"read"
:
true
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1566317460
,
"action"
:
"Set timer"
,
"device"
:
"mcb link 1"
,
"read"
:
true
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1566438573
,
"action"
:
"Set timer"
,
"device"
:
"mcb link 2"
,
"read"
:
true
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1565863930
,
"action"
:
"???"
,
"device"
:
"???"
,
"read"
:
true
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1565777530
,
"action"
:
"???"
,
"device"
:
"???"
,
"read"
:
true
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566467247
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 4"
,
"read"
:
true
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1564639200
,
"action"
:
"Switched off"
,
"device"
:
"sub breaker 1"
,
"read"
:
true
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566371305
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 1"
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566374629
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 3"
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1566317460
,
"action"
:
"Set timer"
,
"device"
:
"mcb link 1"
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1566438573
,
"action"
:
"Set timer"
,
"device"
:
"mcb link 2"
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1565863930
,
"action"
:
"???"
,
"device"
:
"???"
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1565777530
,
"action"
:
"???"
,
"device"
:
"???"
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566467247
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 4"
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1564639200
,
"action"
:
"Switched off"
,
"device"
:
"sub breaker 1"
},
{
"type"
:
"notification"
,
"user"
:
"Sukanya161"
,
"time"
:
1566433810
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 2"
"device"
:
"sub breaker 2"
,
"read"
:
true
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566371305
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 1"
,
"read"
:
true
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566374629
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 3"
,
"read"
:
true
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566371305
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 1"
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566374629
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 3"
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1566317460
,
"action"
:
"Leaved"
,
"device"
:
"office"
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1561975930
,
"action"
:
"Entered"
,
"device"
:
"office"
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1564481530
,
"action"
:
"ง่วง"
,
"device"
:
"มากๆ"
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1563790330
,
"action"
:
"หิว"
,
"device"
:
"ข้าว"
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1566528669
,
"action"
:
"Sleep"
,
"device"
:
""
}
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1566317460
,
"action"
:
"Leaved"
,
"device"
:
"office"
,
"read"
:
true
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1561975930
,
"action"
:
"Entered"
,
"device"
:
"office"
,
"read"
:
true
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1564481530
,
"action"
:
"ง่วง"
,
"device"
:
"มากๆ"
,
"read"
:
true
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1563790330
,
"action"
:
"หิว"
,
"device"
:
"ข้าว"
,
"read"
:
true
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1566528669
,
"action"
:
"Sleep"
,
"device"
:
""
,
"read"
:
false
}
]
screens/Private/TimerScreen/TimerScreen.ios.js
View file @
8ab12442
import
React
,
{
Component
}
from
'react'
;
import
{
Fab
,
Icon
,
Text
}
from
'native-base'
;
import
{
View
,
StyleSheet
,
FlatList
,
ScrollView
,
Modal
,
TouchableOpacity
,
TextInput
,
Animated
,
Platform
,
}
from
'react-native'
;
import
{
Switch
,
Button
,
Col
,
Row
}
from
'native-base'
;
import
{
Icon
,
Text
}
from
'native-base'
;
import
{
View
,
StyleSheet
,
FlatList
,
ScrollView
,
Modal
,
TouchableOpacity
,
Platform
}
from
'react-native'
;
import
{
Switch
,
Button
}
from
'native-base'
;
import
{
HeaderButtons
,
Item
as
HeaderItem
}
from
'react-navigation-header-buttons'
;
import
IoniconsHeaderButton
from
'../../../components/IoniconsHeaderButton'
;
import
{
color
,
theme
}
from
'../../../constants/Styles'
;
import
RNPickerSelect
from
'react-native-picker-select'
;
import
{
Badge
,
CheckBox
,
SearchBar
}
from
'react-native-elements'
;
import
{
CheckBox
,
SearchBar
}
from
'react-native-elements'
;
import
SwipeableRow
from
'../../../components/SwipeableRow'
;
import
DatePicker
from
'react-native-date-picker'
;
import
{
width
,
height
}
from
'../../../constants/Layout'
;
import
InputField
from
'../../../components/InputField'
;
import
{
height
}
from
'../../../constants/Layout'
import
{
isIphoneX
}
from
'../../../utils/isPhoneX'
;
import
FadeDimBG
from
'../../../components/FadeDimBG'
;
import
SlideUpModal
from
'../../../components/SlideUpModal'
;
...
...
@@ -229,7 +218,11 @@ class TimerScreen extends Component {
<
/TouchableOpacity
>
),
});
this
.
setState
({
subBreakerFilterList
:
this
.
props
.
existedData
,
});
console
.
log
(
'STATE'
,
this
.
state
);
console
.
log
(
'PROPS'
,
this
.
props
);
};
renderAddAndEditTimerModal
=
()
=>
{
...
...
@@ -443,7 +436,7 @@ class TimerScreen extends Component {
{
this
.
renderAddAndEditTimerModal
()}
{
/* Filter Modal */
}
{
/*
<Modal
<
Modal
transparent
presentationStyle
=
{
'overFullScreen'
}
animationType
=
"fade"
...
...
@@ -484,19 +477,19 @@ class TimerScreen extends Component {
]}
>
<
RNPickerSelect
items={
breaker
}
items
=
{
this
.
state
.
pickerSelectData
}
onValueChange
=
{(
value
,
index
)
=>
{
this.setState({ selectedBreaker:
breaker[index - 1].sub
});
this
.
setState
({
selectedBreaker
:
value
});
}}
useNativeAndroidPickerStyle
=
{
false
}
placeholder={{ label: 'Select
Breaker
', value: null }}
placeholder
=
{{
label
:
'Select
...
'
,
value
:
null
}}
style
=
{
pickerStyle
}
Icon
=
{()
=>
<
Icon
name
=
"ios-arrow-down"
style
=
{{
fontSize
:
14
,
color
:
'#c8c8c8'
}}
/>
}
/>
<
/View
>
<
FlatList
style
=
{
theme
.
mt2
}
data={this.state.s
electedBreaker
}
data
=
{
this
.
state
.
s
ubBreakerList
}
ListEmptyComponent
=
{()
=>
(
<
View
>
<
Text
style
=
{[
theme
.
normalText
,
theme
.
mt2
]}
>
No
Sub
breaker
<
/Text
>
...
...
@@ -509,28 +502,31 @@ class TimerScreen extends Component {
fontFamily
=
{
'Avenir-Roman'
}
textStyle
=
{{
fontWeight
:
'normal'
,
color
:
color
.
darkGrey
}}
title
=
{
'Sub breaker '
+
item
.
id
}
checked={this.state.s
electedBreaker[index].active
}
checked
=
{
this
.
state
.
s
ubBreakerList
[
index
].
selected
}
checkedIcon
=
{
<
Icon
name
=
"md-checkbox"
style
=
{{
color
:
color
.
primary
,
fontSize
:
26
}}
/
>
}
uncheckedIcon
=
{
<
Icon
name
=
"md-square-outline"
style
=
{{
color
:
color
.
grey
,
fontSize
:
26
}}
/
>
}
onPress={() =>
onPress
=
{()
=>
{
this
.
setState
(
prevState
=>
({
selectedBreaker: prevState.selectedBreaker.map(el =>
el.id === index + 1
? { ...el, active: !this.state.selectedBreaker[index].active }
: el
subBreakerList
:
prevState
.
subBreakerList
.
map
((
el
,
elementIndex
)
=>
elementIndex
===
index
?
{
...
el
,
selected
:
!
this
.
state
.
subBreakerList
[
index
].
selected
,
}
:
{
...
el
}
),
}))
}
}))
;
}
}
/
>
)}
keyExtractor
=
{(
item
,
index
)
=>
`sub
${
index
}
`
}
/
>
<
/SlideUpModal
>
</Modal>
*/
}
<
/Modal
>
<
/
>
);
}
...
...
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