mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Updates
This commit is contained in:
@ -2,65 +2,25 @@ import { MenuContainer, MenuRow } from '@components/Menu'
|
||||
import { useNavigation } from '@react-navigation/native'
|
||||
import { useAnnouncementQuery } from '@utils/queryHooks/announcement'
|
||||
import { useListsQuery } from '@utils/queryHooks/lists'
|
||||
import React, { useMemo } from 'react'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
const Collections: React.FC = () => {
|
||||
const { t, i18n } = useTranslation('screenTabs')
|
||||
const { t } = useTranslation('screenTabs')
|
||||
const navigation = useNavigation()
|
||||
|
||||
const listsQuery = useListsQuery({
|
||||
options: {
|
||||
notifyOnChangeProps: []
|
||||
notifyOnChangeProps: ['data']
|
||||
}
|
||||
})
|
||||
const rowLists = useMemo(() => {
|
||||
if (listsQuery.isSuccess && listsQuery.data?.length) {
|
||||
return (
|
||||
<MenuRow
|
||||
iconFront='List'
|
||||
iconBack='ChevronRight'
|
||||
title={t('me.stacks.lists.name')}
|
||||
onPress={() => navigation.navigate('Tab-Me-Lists')}
|
||||
/>
|
||||
)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}, [listsQuery.isSuccess, listsQuery.data, i18n.language])
|
||||
|
||||
const announcementsQuery = useAnnouncementQuery({
|
||||
showAll: true,
|
||||
options: {
|
||||
notifyOnChangeProps: []
|
||||
notifyOnChangeProps: ['data']
|
||||
}
|
||||
})
|
||||
const rowAnnouncements = useMemo(() => {
|
||||
if (announcementsQuery.isSuccess && announcementsQuery.data?.length) {
|
||||
const amount = announcementsQuery.data.filter(
|
||||
announcement => !announcement.read
|
||||
).length
|
||||
return (
|
||||
<MenuRow
|
||||
iconFront='Clipboard'
|
||||
iconBack='ChevronRight'
|
||||
title={t('screenAnnouncements:heading')}
|
||||
content={
|
||||
amount
|
||||
? t('me.root.announcements.content.unread', {
|
||||
amount
|
||||
})
|
||||
: t('me.root.announcements.content.read')
|
||||
}
|
||||
onPress={() =>
|
||||
navigation.navigate('Screen-Announcements', { showAll: true })
|
||||
}
|
||||
/>
|
||||
)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}, [announcementsQuery.isSuccess, announcementsQuery.data, i18n.language])
|
||||
|
||||
return (
|
||||
<MenuContainer>
|
||||
@ -82,8 +42,34 @@ const Collections: React.FC = () => {
|
||||
title={t('me.stacks.favourites.name')}
|
||||
onPress={() => navigation.navigate('Tab-Me-Favourites')}
|
||||
/>
|
||||
{rowLists}
|
||||
{rowAnnouncements}
|
||||
{listsQuery.data?.length ? (
|
||||
<MenuRow
|
||||
iconFront='List'
|
||||
iconBack='ChevronRight'
|
||||
title={t('me.stacks.lists.name')}
|
||||
onPress={() => navigation.navigate('Tab-Me-Lists')}
|
||||
/>
|
||||
) : null}
|
||||
{announcementsQuery.data?.length ? (
|
||||
<MenuRow
|
||||
iconFront='Clipboard'
|
||||
iconBack='ChevronRight'
|
||||
title={t('screenAnnouncements:heading')}
|
||||
content={
|
||||
announcementsQuery.data.filter(announcement => !announcement.read)
|
||||
.length
|
||||
? t('me.root.announcements.content.unread', {
|
||||
amount: announcementsQuery.data.filter(
|
||||
announcement => !announcement.read
|
||||
).length
|
||||
})
|
||||
: t('me.root.announcements.content.read')
|
||||
}
|
||||
onPress={() =>
|
||||
navigation.navigate('Screen-Announcements', { showAll: true })
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
</MenuContainer>
|
||||
)
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ import {
|
||||
} from '@utils/slices/settingsSlice'
|
||||
import { StyleConstants } from '@utils/styles/constants'
|
||||
import { useTheme } from '@utils/styles/ThemeManager'
|
||||
import * as Updates from 'expo-updates'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { StyleSheet, Text } from 'react-native'
|
||||
import { Constants } from 'react-native-unimodules'
|
||||
import { useDispatch, useSelector } from 'react-redux'
|
||||
|
||||
const SettingsAnalytics: React.FC = () => {
|
||||
@ -29,10 +29,7 @@ const SettingsAnalytics: React.FC = () => {
|
||||
}
|
||||
/>
|
||||
<Text style={[styles.version, { color: theme.secondary }]}>
|
||||
{t('me.settings.version', {
|
||||
// @ts-ignore
|
||||
version: Updates.manifest?.version
|
||||
})}
|
||||
{t('me.settings.version', { version: Constants.manifest.version })}
|
||||
</Text>
|
||||
</MenuContainer>
|
||||
)
|
||||
|
@ -1,12 +1,12 @@
|
||||
import * as Updates from 'expo-updates'
|
||||
import { Constants } from 'react-native-unimodules'
|
||||
import * as Sentry from 'sentry-expo'
|
||||
import log from './log'
|
||||
|
||||
const sentry = () => {
|
||||
log('log', 'Sentry', 'initializing')
|
||||
Sentry.init({
|
||||
// @ts-ignore
|
||||
dsn: Updates.manifest?.extra?.sentryDSN,
|
||||
dsn: Constants.manifest?.extra?.sentryDSN,
|
||||
enableInExpoDevelopment: false,
|
||||
debug:
|
||||
__DEV__ ||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import apiGeneral from '@api/general'
|
||||
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit'
|
||||
import { RootState } from '@root/store'
|
||||
import * as Updates from 'expo-updates'
|
||||
import { Constants } from 'react-native-unimodules'
|
||||
|
||||
export const retriveVersionLatest = createAsyncThunk(
|
||||
'version/latest',
|
||||
@ -29,10 +29,8 @@ const versionSlice = createSlice({
|
||||
reducers: {},
|
||||
extraReducers: builder => {
|
||||
builder.addCase(retriveVersionLatest.fulfilled, (state, action) => {
|
||||
// @ts-ignore
|
||||
if (action.payload && Updates.manifest?.version) {
|
||||
// @ts-ignore
|
||||
if (parseInt(action.payload) > parseInt(Updates.manifest.version)) {
|
||||
if (action.payload && Constants.manifest.version) {
|
||||
if (parseInt(action.payload) > parseInt(Constants.manifest.version)) {
|
||||
state.update = true
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user