Moved push notification place

This commit is contained in:
Zhiyuan Zheng 2021-12-15 23:22:47 +01:00
parent 47e6ca5e59
commit d9228da7d7
5 changed files with 34 additions and 20 deletions

View File

@ -185,6 +185,12 @@
"empty": "None"
}
},
"push": {
"content": {
"enabled": "Enabled",
"disabled": "Disabled"
}
},
"update": {
"title": "Update to latest version"
},

View File

@ -185,6 +185,12 @@
"empty": "无公告"
}
},
"push": {
"content": {
"enabled": "已启用",
"disabled": "未启用"
}
},
"update": {
"title": "更新至最新版本"
},

View File

@ -20,9 +20,9 @@ import FastImage from 'react-native-fast-image'
import { FlatList, ScrollView } from 'react-native-gesture-handler'
import { SafeAreaView } from 'react-native-safe-area-context'
const ScreenAnnouncements: React.FC<RootStackScreenProps<
'Screen-Announcements'
>> = ({
const ScreenAnnouncements: React.FC<
RootStackScreenProps<'Screen-Announcements'>
> = ({
route: {
params: { showAll = false }
},
@ -250,6 +250,7 @@ const styles = StyleSheet.create({
announcementContainer: {
width: Dimensions.get('screen').width,
padding: StyleConstants.Spacing.Global.PagePadding,
marginVertical: StyleConstants.Spacing.Global.PagePadding,
justifyContent: 'center'
},
published: {

View File

@ -3,6 +3,7 @@ import { useNavigation } from '@react-navigation/native'
import { useAnnouncementQuery } from '@utils/queryHooks/announcement'
import { useListsQuery } from '@utils/queryHooks/lists'
import { getMePage, updateContextMePage } from '@utils/slices/contextsSlice'
import { getInstancePush } from '@utils/slices/instancesSlice'
import React, { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import { useDispatch, useSelector } from 'react-redux'
@ -53,6 +54,11 @@ const Collections: React.FC = () => {
}
}, [announcementsQuery.isSuccess, announcementsQuery.data?.length])
const instancePush = useSelector(
getInstancePush,
(prev, next) => prev?.global.value === next?.global.value
)
return (
<MenuContainer>
<MenuRow
@ -98,6 +104,17 @@ const Collections: React.FC = () => {
}
/>
) : null}
<MenuRow
iconFront={instancePush ? 'Bell' : 'BellOff'}
iconBack='ChevronRight'
title={t('me.stacks.push.name')}
content={
instancePush
? t('me.root.push.content.enabled')
: t('me.root.push.content.disabled')
}
onPress={() => navigation.navigate('Tab-Me-Push')}
/>
</MenuContainer>
)
}

View File

@ -3,10 +3,7 @@ import Button from '@components/Button'
import { RelationshipOutgoing } from '@components/Relationship'
import { useNavigation } from '@react-navigation/native'
import { useRelationshipQuery } from '@utils/queryHooks/relationship'
import {
getInstanceAccount,
getInstancePush
} from '@utils/slices/instancesSlice'
import { getInstanceAccount } from '@utils/slices/instancesSlice'
import { StyleConstants } from '@utils/styles/constants'
import React from 'react'
import { useTranslation } from 'react-i18next'
@ -56,7 +53,6 @@ const AccountInformationActions: React.FC<Props> = ({ account, myInfo }) => {
content={t('shared.account.moved')}
onPress={() => {
analytics('account_gotomoved_press')
// @ts-ignore
navigation.push('Tab-Shared-Account', { account: accountMoved })
}}
/>
@ -64,21 +60,9 @@ const AccountInformationActions: React.FC<Props> = ({ account, myInfo }) => {
)
}
const instancePush = useSelector(
getInstancePush,
(prev, next) => prev?.global.value === next?.global.value
)
if (myInfo) {
return (
<View style={styles.base}>
<Button
round
type='icon'
content={instancePush?.global.value ? 'Bell' : 'BellOff'}
style={styles.actionLeft}
onPress={() => navigation.navigate('Tab-Me-Push')}
/>
<Button
type='text'
disabled={account === undefined}