Skip to content

Commit

Permalink
remove the rest of message transmission from settings (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
nionata authored Nov 22, 2021
1 parent 67e669a commit f330049
Showing 1 changed file with 2 additions and 64 deletions.
66 changes: 2 additions & 64 deletions app/src/screens/settings.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,12 @@
import React, { useEffect } from 'react';
import { View, Text, Card, Button, Switch } from 'react-native-ui-lib';
import { View, Text, Card, Switch } from 'react-native-ui-lib';
import AsyncStorage from '@react-native-async-storage/async-storage';

import { StyleSheet } from 'react-native';
import { GRAPEVINE_MESSAGE } from 'Const';

function SettingsScreen() {
const [messageTransmitText, setMessageText] = React.useState<string | null>(
null
);
const [isEditingMessage, setIsEditingMessage] =
React.useState<boolean>(false);
const [isTransmitting, setIsTransmitting] = React.useState<boolean>(true);

const getMessage: () => Promise<string | null> = async () => {
try {
const message = await AsyncStorage.getItem(GRAPEVINE_MESSAGE);
if (message !== null) {
setMessageText(message);
}

return message;
} catch (e) {
console.error(e);

return null;
}
};

const getIsTranmittingSetting: () => Promise<void> = async () => {
try {
const shouldTransmit =
Expand All @@ -48,7 +27,6 @@ function SettingsScreen() {
};

useEffect(() => {
getMessage();
getIsTranmittingSetting();
}, []);

Expand All @@ -62,39 +40,6 @@ function SettingsScreen() {
},
});

const editMessageCardHeader = (
<Text style={styles.cardHeader} marginB-10>
Message to Transmit
</Text>
);

const editMessageCardContents =
messageTransmitText !== null && !isEditingMessage ? (
<View>
<Text>{messageTransmitText}</Text>
<Button
marginT-20
size={Button.sizes.small}
backgroundColor="blueviolet"
label="Edit Message"
enableShadow
onPress={() => setIsEditingMessage(true)}
/>
</View>
) : (
<View>
<Text>Fix this up</Text>
</View>
);

const editMessageCardHelpText = (
<View paddingT-10>
<Text color={'gray'}>
This is the message that will be transmitted to other GrapeVineusers.
</Text>
</View>
);

const otherSettingsCardContents = (
<View>
<Text style={styles.cardHeader} marginB-10>
Expand Down Expand Up @@ -134,14 +79,7 @@ function SettingsScreen() {

return (
<View padding-20>
<Card padding-20>
{editMessageCardHeader}
{editMessageCardContents}
{editMessageCardHelpText}
</Card>
<Card marginT-20 padding-20>
{otherSettingsCardContents}
</Card>
<Card padding-20>{otherSettingsCardContents}</Card>
<Card marginT-20 padding-20>
{statsCardContents}
</Card>
Expand Down

0 comments on commit f330049

Please sign in to comment.