1
0
mirror of https://github.com/tooot-app/app synced 2025-02-07 15:38:47 +01:00

Minor fixes according to DeepScan

This commit is contained in:
Zhiyuan Zheng 2021-03-09 01:17:07 +01:00
parent f127fc3a1a
commit e1e4aace78
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
9 changed files with 17 additions and 26 deletions

View File

@ -47,7 +47,10 @@ const App: React.FC = () => {
})
return () => {
AppState.removeEventListener('change', () => {})
AppState.removeEventListener('change', () => {
Notifications.setBadgeCountAsync(0)
Notifications.dismissAllNotificationsAsync()
})
}
}, [])

View File

@ -42,17 +42,17 @@ const ComposeEditAttachmentImage: React.FC<Props> = ({ index, focus }) => {
width: imageWidthBase,
height:
imageWidthBase /
((theAttachmentRemote as Mastodon.AttachmentImage).meta?.original
((theAttachmentRemote as Mastodon.AttachmentImage)?.meta?.original
?.aspect || 1)
}
const panX = useSharedValue(
(((theAttachmentRemote as Mastodon.AttachmentImage).meta?.focus?.x || 0) *
(((theAttachmentRemote as Mastodon.AttachmentImage)?.meta?.focus?.x || 0) *
imageDimensionis.width) /
2
)
const panY = useSharedValue(
(((theAttachmentRemote as Mastodon.AttachmentImage).meta?.focus?.y || 0) *
(((theAttachmentRemote as Mastodon.AttachmentImage)?.meta?.focus?.y || 0) *
imageDimensionis.height) /
2
)

View File

@ -19,8 +19,8 @@ const prefetchEmojis = (
sortedEmojis: { title: string; data: Mastodon.Emoji[] }[]
) => {
let requestedIndex = 0
sortedEmojis.map(sorted => {
sorted.data.map(emoji => {
sortedEmojis.forEach(sorted => {
sorted.data.forEach(emoji => {
if (requestedIndex > 40) {
return
}

View File

@ -2,7 +2,7 @@ import analytics from '@components/analytics'
import haptics from '@components/haptics'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useCallback, useContext, useEffect, useMemo } from 'react'
import React, { useCallback, useContext, useMemo } from 'react'
import {
Image,
Pressable,

View File

@ -32,7 +32,7 @@ const ScreenMeSettingsPush: React.FC = () => {
checkPush()
AppState.addEventListener('change', () => checkPush())
return () => {
AppState.removeEventListener('change', () => {})
AppState.removeEventListener('change', () => checkPush())
}
}, [])
@ -59,7 +59,7 @@ const ScreenMeSettingsPush: React.FC = () => {
updateInstancePushAlert({
changed: alert,
alerts: {
...instancePush.alerts,
...instancePush?.alerts,
[alert]: {
...instancePush?.alerts[alert],
value: !instancePush?.alerts[alert].value

View File

@ -13,13 +13,7 @@ import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React from 'react'
import { useTranslation } from 'react-i18next'
import {
KeyboardAvoidingView,
Platform,
StyleSheet,
Text,
View
} from 'react-native'
import { StyleSheet, Text, View } from 'react-native'
import { ScrollView } from 'react-native-gesture-handler'
import { useQueryClient } from 'react-query'
import { useDispatch, useSelector } from 'react-redux'

View File

@ -7,14 +7,12 @@ import React, { useCallback, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { Platform } from 'react-native'
import { createNativeStackNavigator } from 'react-native-screens/native-stack'
import { useDispatch } from 'react-redux'
const Stack = createNativeStackNavigator<Nav.TabNotificationsStackParamList>()
const TabNotifications = React.memo(
() => {
const { t } = useTranslation()
const dispatch = useDispatch()
const screenOptions = useMemo(
() => ({

View File

@ -1,12 +1,8 @@
import { createAsyncThunk, createSlice, PayloadAction } from '@reduxjs/toolkit'
import i18n from '@root/i18n/i18n'
import { RootState, store } from '@root/store'
import { RootState } from '@root/store'
import * as Analytics from 'expo-firebase-analytics'
import * as Localization from 'expo-localization'
import * as Notifications from 'expo-notifications'
import { pickBy } from 'lodash'
import androidDefaults from './instances/push/androidDefaults'
import { getInstances } from './instancesSlice'
enum availableLanguages {
'zh-Hans',

View File

@ -1,12 +1,12 @@
import { Dimensions } from 'react-native'
const { width, height } = Dimensions.get('screen')
const { width } = Dimensions.get('screen')
const guidelineBaseWidth = 375
const guidelineBaseHeight = 667
// const guidelineBaseHeight = 667
const scale = (size: number) => (width / guidelineBaseWidth) * size
const verticalScale = (size: number) => (height / guidelineBaseHeight) * size
// const verticalScale = (size: number) => (height / guidelineBaseHeight) * size
const moderateScale = (size: number, factor = 0.5) =>
size + (scale(size) - size) * factor