Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

add issue reporting to github.

ammarahm-ed1479b2d8c780
diff --git a/apps/mobile/src/components/Github/issue.js b/apps/mobile/src/components/Github/issue.js
index 7516d8f6e..134b333d1 100644
--- a/apps/mobile/src/components/Github/issue.js
+++ b/apps/mobile/src/components/Github/issue.js
@@ -1,36 +1,66 @@
-import React, {useRef} from 'react';
-import {Text, TextInput, View} from 'react-native';
+import React, {useRef, useState} from 'react';
+import {Linking, Platform, Text, TextInput, View} from 'react-native';
+import deviceInfoModule from 'react-native-device-info';
import {useTracked} from '../../provider';
-import { eSendEvent } from '../../services/EventManager';
-import { eCloseProgressDialog } from '../../utils/Events';
+import {eSendEvent, ToastEvent} from '../../services/EventManager';
+import {APP_VERSION} from '../../utils';
+import {db} from '../../utils/database';
+import {eCloseProgressDialog} from '../../utils/Events';
import {openLinkInBrowser} from '../../utils/functions';
import {SIZE} from '../../utils/SizeUtils';
-import { sleep } from '../../utils/TimeUtils';
+import {sleep} from '../../utils/TimeUtils';
import {Button} from '../Button';
import DialogHeader from '../Dialog/dialog-header';
-import { presentDialog } from '../Dialog/functions';
+import {presentDialog} from '../Dialog/functions';
import Seperator from '../Seperator';
import Paragraph from '../Typography/Paragraph';
export const Issue = () => {
const [state, dispatch] = useTracked();
const colors = state.colors;
- const value = useRef(null);
-
- onPress = async () => {
-
- eSendEvent(eCloseProgressDialog);
- await sleep(300);
- presentDialog({
- title:"Issue submitted",
- paragraph:"The issue you submitted has been published on github",
- positiveText:"View",
- negativeText:"Done",
- positivePress:async () => {
-
- }
- })
+ const body = useRef(null);
+ const title = useRef(null);
+ const [loading, setLoading] = useState(false);
+ const onPress = async () => {
+ if (loading) return;
+ if (!title.current || !body.current) return;
+ if (title.current.trim() === '' || body.trim().length === 0) return;
+ try {
+ setLoading(true);
+ let issue_url = await db.debug.report(
+ title.current,
+ body.current +
+ `\n_______________
+Device information:
+App version: ${APP_VERSION}
+Platform: ${Platform.OS}
+Model: ${Platform.constants.Brand}-${Platform.constants.Model}-${
+ Platform.constants.Version
+ }`
+ );
+ setLoading(false);
+ eSendEvent(eCloseProgressDialog);
+ await sleep(300);
+ presentDialog({
+ title: 'Issue reported',
+ paragraph:
+ 'You can track your issue at ' +
+ issue_url,
+ positiveText: 'Go to Github',
+ negativeText: 'Done',
+ positivePress: async () => {
+ Linking.openURL(issue_url);
+ }
+ });
+ } catch (e) {
+ setLoading(false);
+ ToastEvent.show({
+ heading: 'An error occured',
+ message: e.message,
+ type: 'error'
+ });
+ }
};
return (
@@ -39,32 +69,58 @@ export const Issue = () => {
paddingHorizontal: 12
}}>
<DialogHeader
- title="Submit an issue"
- paragraph="Let us know if you are facing any issue while using Notesnook."
+ title="Report issue"
+ paragraph="Let us know if you have faced any issue/bug while using Notesnook."
/>
<Seperator half />
<TextInput
- placeholder="Tell us what issue you have faced."
+ placeholder="Title"
+ onChangeText={v => (title.current = v)}
+ style={{
+ borderWidth: 1,
+ borderColor: colors.nav,
+ borderRadius: 5,
+ padding: 12,
+ fontFamily: 'OpenSans-Regular',
+ marginBottom: 10,
+ fontSize: SIZE.md
+ }}
+ />
+
+ <TextInput
+ placeholder={`Tell us more about the issue you are facing.
+
+For example:
+- Steps to reproduce the issue
+- Things you have tried etc.`}
multiline
numberOfLines={5}
textAlignVertical="top"
- onChangeText={v => (value.current = v)}
+ onChangeText={v => (body.current = v)}
style={{
borderWidth: 1,
borderColor: colors.nav,
- borderRadius: 10,
+ borderRadius: 5,
padding: 12,
fontFamily: 'OpenSans-Regular',
- maxHeight: 150
+ maxHeight: 200,
+ fontSize: SIZE.sm,
+ marginBottom: 2.5
}}
/>
+ <Paragraph
+ size={SIZE.xs}
+ color={
+ colors.icon
+ }>{`App version: ${APP_VERSION} Platform: ${Platform.OS} Model: ${Platform.constants.Brand}-${Platform.constants.Model}-${Platform.constants.Version}`}</Paragraph>
<Seperator />
<Button
onPress={onPress}
- title="Submit"
+ title={loading ? null : 'Submit'}
+ loading={loading}
height={50}
width="100%"
type="accent"
@@ -77,11 +133,23 @@ export const Issue = () => {
marginTop: 10,
textAlign: 'center'
}}>
- If you want to ask something general or request a feature, we would suggest that
- you{' '}
+ The information above will be is publically available on{' '}
+ <Text
+ onPress={() => {
+ Linking.openURL('https://github.com/streetwriters/notesnook');
+ }}
+ style={{
+ textDecorationLine: 'underline',
+ color: colors.accent
+ }}>
+ github.com/streetwriters/notesnook.
+ </Text>{' '}
+ If you want to ask something general or need some assistance, we would
+ suggest that you{' '}
<Text
style={{
- textDecorationLine: 'underline'
+ textDecorationLine: 'underline',
+ color: colors.accent
}}
onPress={async () => {
try {
diff --git a/apps/mobile/src/utils/database.js b/apps/mobile/src/utils/database.js
index bf61723ed..8068b7d4a 100644
--- a/apps/mobile/src/utils/database.js
+++ b/apps/mobile/src/utils/database.js
@@ -21,7 +21,8 @@ db.host(
API_HOST: 'http://192.168.10.29:5264',
AUTH_HOST: 'http://192.168.10.29:8264',
SSE_HOST: 'http://192.168.10.29:7264',
- SUBSCRIPTIONS_HOST: 'http://192.168.10.29:9264'
+ SUBSCRIPTIONS_HOST: 'http://192.168.10.29:9264',
+ ISSUES_HOST: 'http://192.168.10.29:2624'
}
: {
API_HOST: 'https://api.notesnook.com',
diff --git a/apps/mobile/src/views/Settings/logout.js b/apps/mobile/src/views/Settings/logout.js
index ae9a8098c..8d480da35 100644
--- a/apps/mobile/src/views/Settings/logout.js
+++ b/apps/mobile/src/views/Settings/logout.js
@@ -28,7 +28,7 @@ const AccoutLogoutSection = () => {
const [loading, setLoading] = useState(false);
const passwordValue = useRef();
- return user ? null : (
+ return !user ? null : (
<>
{loading && (
<BaseDialog visible={true}>