Skip to content

Commit

Permalink
feat: add contact us button
Browse files Browse the repository at this point in the history
  • Loading branch information
hyochan committed Aug 6, 2024
1 parent 792bc58 commit 23e7f7a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 24 deletions.
1 change: 1 addition & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default ({config}: ConfigContext): ExpoConfig => ({
'com.apple.developer.applesignin': ['Default'],
},
infoPlist: {
LSApplicationQueriesSchemes: ['mailto'],
CFBundleAllowMixedLocalizations: true,
CFBundleURLTypes: [
{
Expand Down
75 changes: 53 additions & 22 deletions app/(app)/settings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {Fragment, useMemo, useState} from 'react';
import {Fragment, useEffect, useMemo, useState} from 'react';
import {Platform, ScrollView, View} from 'react-native';
import {useSafeAreaInsets} from 'react-native-safe-area-context';
import {dark, light} from '@dooboo-ui/theme';
import styled, {css} from '@emotion/native';
import AsyncStorage from '@react-native-async-storage/async-storage';
import * as Notifications from 'expo-notifications';
import {Icon, SwitchToggle, Typography, useDooboo} from 'dooboo-ui';
import CustomPressable from 'dooboo-ui/uis/CustomPressable';
import * as Linking from 'expo-linking';
Expand All @@ -15,6 +16,8 @@ import {authRecoilState} from '../../../src/recoil/atoms';
import {t} from '../../../src/STRINGS';
import {AsyncStorageKey} from '../../../src/utils/constants';
import CustomLoadingIndicator from '../../../src/components/uis/CustomLoadingIndicator';
import useAppState from '../../../src/hooks/useAppState';
import { openEmail } from '../../../src/utils/common';

Check failure on line 20 in app/(app)/settings/index.tsx

View workflow job for this annotation

GitHub Actions / build

Module '"../../../src/utils/common"' has no exported member 'openEmail'.

const Container = styled.View`
background-color: ${({theme}) => theme.bg.basic};
Expand All @@ -38,35 +41,30 @@ const Divider = styled.View`

export default function Settings(): JSX.Element {
const {push} = useRouter();
const {theme, changeThemeType, themeType} = useDooboo();
const {theme,changeThemeType, themeType} = useDooboo();
const authId = useRecoilValue(authRecoilState);
const {bottom} = useSafeAreaInsets();

const [hasNotificationPermission, setHasNotificationPermission] =
useState(false);

// useEffect(() => {
// const checkNotiPermission = async (): Promise<void> => {
// setHasNotificationPermission(
// await RNOnesignal?.Notifications.getPermissionAsync(),
// );
// };
// checkNotiPermission();
// }, []);
const checkNotificationPermission = async (): Promise<void> => {
const {status} = await Notifications.getPermissionsAsync();
setHasNotificationPermission(status === 'granted');
};

// useAppState((state) => {
// if (state === 'active') {
// const timeout = setTimeout(async () => {
// setHasNotificationPermission(
// await RNOnesignal?.Notifications.getPermissionAsync(),
// );
useEffect(() => {
checkNotificationPermission();
}, []);

// if (timeout) {
// clearTimeout(timeout);
// }
// }, 100);
// }
// });
useAppState((state) => {
if (state === 'active') {
const timeout = setTimeout(async () => {
await checkNotificationPermission();
clearTimeout(timeout);
}, 100);
}
});

type Menu = {
onPress?: () => void;
Expand Down Expand Up @@ -248,6 +246,39 @@ export default function Settings(): JSX.Element {
bounces={false}
showsVerticalScrollIndicator={Platform.OS === 'web'}
>
<SettingButton
onPress={openEmail}
style={css`
background-color: ${theme.role.primary};
`}
>
<>
<Icon
color={theme.button.primary.text}
name="AutoAwesome"
size={24}
style={css`
margin-right: 16px;
`}
/>
<Typography.Body2
style={css`
font-family: Pretendard-Bold;
color: ${theme.button.primary.text};
`}
>
{t('common.contactUs')}
</Typography.Body2>
<Icon
color={theme.button.primary.text}
name="OpenInNew"
size={16}
style={css`
margin-left: auto;
`}
/>
</>
</SettingButton>
{menus.map((menu) => (
<Fragment key={menu.title}>
{!menu.onPress ? (
Expand Down
5 changes: 4 additions & 1 deletion assets/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
"cancel": "Cancel",
"community": "Community",
"confirm": "Confirm",
"contactUs": "Contact Us",
"delete": "Delete",
"deleteSuccess": "Successfully deleted",
"deletedAccount": "Retired account.",
"done": "Done",
"error": "Error",
"follow": "Follow",
"followers": {
"one": "Follower",
Expand Down Expand Up @@ -63,7 +65,8 @@
"default": "Error occurred!",
"displayNameExists": "The nickname already exists",
"displayNameInvalid": "Nickname must be between 2 and 20 characters",
"displayNameIsEmpty": "Please enter a nickname"
"displayNameIsEmpty": "Please enter a nickname",
"unableToOpenEmailClient": "Unable to open email client"
},
"loginInfo": {
"cancel": "Cancel",
Expand Down
5 changes: 4 additions & 1 deletion assets/langs/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
"cancel": "취소",
"community": "커뮤니티",
"confirm": "확인",
"contactUs": "문의하기",
"delete": "삭제",
"deleteSuccess": "성공적으로 삭제되었습니다",
"deletedAccount": "탈퇴한 계정입니다.",
"done": "완료",
"error": "오류",
"follow": "팔로우",
"followers": {
"one": "팔로워",
Expand Down Expand Up @@ -63,7 +65,8 @@
"default": "오류가 발생했습니다!",
"displayNameExists": "이미 존재하는 닉네임입니다",
"displayNameInvalid": "닉네임은 2자 이상 20자 이하여야 합니다",
"displayNameIsEmpty": "닉네임을 입력해주세요"
"displayNameIsEmpty": "닉네임을 입력해주세요",
"unableToOpenEmailClient": "이메일 클라이언트를 열 수 없습니다"
},
"loginInfo": {
"cancel": "취소",
Expand Down

0 comments on commit 23e7f7a

Please sign in to comment.