Skip to content

Commit ba0e27e

Browse files
committed
better help menu
1 parent 899456e commit ba0e27e

File tree

4 files changed

+95
-9
lines changed

4 files changed

+95
-9
lines changed

app/components/FavNotif.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { StyleSheet, View, Text } from 'react-native';
33
import Swipeout from 'react-native-swipeout';
44
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome'
5-
import { /*faQuestion,*/ faTrash } from '@fortawesome/free-solid-svg-icons'
5+
import { faQuestion, faTrash } from '@fortawesome/free-solid-svg-icons'
66

77
import PropTypes from 'prop-types';
88

@@ -11,11 +11,11 @@ export default class FavNotif extends React.Component
1111
constructor(props) {
1212
super(props);
1313
this.swipeData = [
14-
/*{ // TODO: add a more information feature to the notifications
14+
{ // TODO: add a more information feature to the notifications
1515
text: <FontAwesomeIcon color={'white'} icon={faQuestion} size={25} />,
1616
backgroundColor: 'blue',
1717
onPress: () => { this.props.info(this.props.data._id) }
18-
},*/
18+
},
1919
{
2020
text: <FontAwesomeIcon color={'white'} icon={faTrash} size={25} />,
2121
backgroundColor: 'red',

app/screens/FavoritesScreen.js

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,22 @@ export default class FavoritesScreen extends React.Component
3535
}
3636

3737
info(key) {
38-
console.log(key);
39-
this.setState({modal: !this.state.modal});
38+
fetch(`${this.props.url}user/get_notification/${key}`, {
39+
method: 'GET',
40+
headers: {
41+
Accept: 'application/json',
42+
'Content-Type': 'application/json',
43+
'authorization': `Bearer ${this.props.token}`
44+
}
45+
}).then((response) => response.json()).then((json) => {
46+
console.log(json);
47+
this.setState({modal: !this.state.modal});
48+
this.setState({selected: json[0]});
49+
}).catch((err) => {
50+
console.error(err);
51+
alert("Error: Could not connect");
52+
this.props.logout();
53+
});
4054
}
4155

4256
async remove(index) {
@@ -60,8 +74,26 @@ export default class FavoritesScreen extends React.Component
6074
return (
6175
<View style={styles.container}>
6276
<Modal animationType={"slide"} transparent={true}
63-
visible={this.state.modal} onRequestClose={this.info}>
64-
<Text>HELLO</Text>
77+
visible={this.state.modal} onRequestClose={() =>
78+
this.setState({modal: !this.state.modal})}>
79+
<View style={styles.modealContainer}>
80+
<View style={styles.inspector}>
81+
<Text style={styles.header}>
82+
{this.state.selected !== undefined ? this.state.selected.method : ""}
83+
{this.state.selected !== undefined ? this.state.selected.link: ""}
84+
</Text>
85+
<Text style={styles.para}>
86+
{this.state.selected !== undefined && (this.state.selected.body !== undefined &&
87+
this.state.selected.body.length == 0) ? this.state.selected.body : "The body is empty"}
88+
</Text>
89+
<Text style={styles.para}>
90+
{this.state.selected !== undefined && this.state.selected.header[0]? this.state.selected.header[0].cookie : ""}
91+
</Text>
92+
<Text style={styles.para}>
93+
{this.state.selected !== undefined && this.state.selected.header[0]? this.state.selected.header[0].referer: ""}
94+
</Text>
95+
</View>
96+
</View>
6597
</Modal>
6698
<ScrollView style={{width:'90%', height:'80%' }}
6799
refreshControl={<RefreshControl refreshing={this.state.refreshing}
@@ -129,5 +161,16 @@ const styles = StyleSheet.create({
129161
height: 150,
130162
marginBottom: 50,
131163
borderRadius: 30,
164+
},
165+
inspector: {
166+
width: '85%',
167+
backgroundColor: '#222222',
168+
height: '95%'
169+
},
170+
modealContainer: {
171+
width: '100%',
172+
height: '100%',
173+
alignItems: 'center',
174+
justifyContent: 'center',
132175
}
133176
});

app/screens/HelpScreen.js

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import React from 'react';
2-
import { Text, StyleSheet, Image, View, ScrollView } from 'react-native';
2+
import { Text, Linking, Button, StyleSheet, Image, View, ScrollView } from 'react-native';
33
import PropTypes from 'prop-types';
44

55
import SplashScreen from './SplashScreen';
66

77
const logo = '../assets/icon.png';
8+
const githubURL = "https://github.com/p4p1/xss_bomb";
9+
const wikiURL= "https://github.com/p4p1/xss_bomb/wiki";
10+
const trelloURL= "https://github.com/p4p1/xss_bomb/projects";
11+
const meURL = "https://leosmith.xyz";
812

913
export default class HelpScreen extends React.Component
1014
{
@@ -13,6 +17,18 @@ export default class HelpScreen extends React.Component
1317
this.state = {
1418
api_id: undefined,
1519
};
20+
21+
this.openURL = this.openURL.bind(this);
22+
}
23+
24+
async openURL(url) {
25+
const supported = await Linking.canOpenURL(url)
26+
27+
if (supported) {
28+
await Linking.openURL(url);
29+
} else {
30+
alert("This link is not supported by your device");
31+
}
1632
}
1733

1834
componentDidMount() {
@@ -55,21 +71,39 @@ export default class HelpScreen extends React.Component
5571
receives a request it will send you a notification and you will be able to
5672
inspect it on your mobile device.
5773
</Text>
74+
<Button title={"Open wiki"} onPress={() => this.openURL(wikiURL)}/>
75+
<View style={styles.padding}></View>
5876
<Text style={styles.header}>Who built this?</Text>
5977
<Text style={styles.para}>
6078
This app was built by me (p4p1) over on github and is provided for free
6179
there if you wish to support me this app will probably be on the store for
6280
$2 ish.
6381
</Text>
82+
<Button title={"About author"} onPress={() => this.openURL(meURL)}/>
83+
<View style={styles.padding}></View>
6484
<Text style={styles.header}>Is this open source?</Text>
6585
<Text style={styles.para}>
6686
Yes this app is open source and you can contribute over on github.
6787
</Text>
88+
<Button title={"View on github"} onPress={() => this.openURL(githubURL)}/>
89+
<View style={styles.padding}></View>
6890
<Text style={styles.header}>Can I host my own instance?</Text>
6991
<Text style={styles.para}>
7092
Yes you can host your own instance of this app and it's backend there
7193
is a tutorial on the official wiki of the app over on github.
7294
</Text>
95+
<Text style={styles.header}>Updates?</Text>
96+
<Text style={styles.para}>
97+
All of the updates are first pushed on github then the rest. If you wish
98+
to see how this app is evolving you can view the project page.
99+
</Text>
100+
<Button title={"Open project logs"} onPress={() => this.openURL(trelloURL)}/>
101+
<View style={styles.padding}></View>
102+
<Text style={styles.header}>Bugs or an idea?</Text>
103+
<Text style={styles.para}>
104+
If you find a bug or you just have and idea for the app please open
105+
an issue on github so that I can fix it as soon as possible.
106+
</Text>
73107
</ScrollView>
74108
</View>
75109
);
@@ -120,5 +154,8 @@ const styles = StyleSheet.create({
120154
width: '100%',
121155
alignItems: 'center',
122156
justifyContent: 'center',
157+
},
158+
padding: {
159+
marginBottom: 20,
123160
}
124161
});

app/screens/NotificationScreen.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default class HomeScreen extends React.Component
110110
}).catch((err) => {
111111
console.error(err);
112112
alert("Error: Could not connect");
113-
//this.props.logout();
113+
this.props.logout();
114114
});
115115
}
116116

@@ -151,6 +151,12 @@ export default class HomeScreen extends React.Component
151151
{this.state.selected !== undefined && (this.state.selected.body !== undefined &&
152152
this.state.selected.body.length == 0) ? this.state.selected.body : "The body is empty"}
153153
</Text>
154+
<Text style={styles.para}>
155+
{this.state.selected !== undefined && this.state.selected.header[0]? this.state.selected.header[0].cookie : ""}
156+
</Text>
157+
<Text style={styles.para}>
158+
{this.state.selected !== undefined && this.state.selected.header[0]? this.state.selected.header[0].referer: ""}
159+
</Text>
154160
</View>
155161
</View>
156162
</Modal>

0 commit comments

Comments
 (0)