1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
This commit is contained in:
xmflsct
2022-11-06 23:39:31 +01:00
parent 28028c8aab
commit d4be002016
11 changed files with 74 additions and 75 deletions

View File

@@ -884,7 +884,7 @@ SPEC CHECKSUMS:
FirebaseCoreInternal: bca76517fe1ed381e989f5e7d8abb0da8d85bed3 FirebaseCoreInternal: bca76517fe1ed381e989f5e7d8abb0da8d85bed3
FirebaseInstallations: 0a115432c4e223c5ab20b0dbbe4cbefa793a0e8e FirebaseInstallations: 0a115432c4e223c5ab20b0dbbe4cbefa793a0e8e
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 3d02b25ca00c2d456734d0bcff864cbc62f6ae1a glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
GoogleAppMeasurement: 6ee231473fbd75c11221dfce489894334024eead GoogleAppMeasurement: 6ee231473fbd75c11221dfce489894334024eead
GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f
GoogleUtilities: 1d20a6ad97ef46f67bbdec158ce00563a671ebb7 GoogleUtilities: 1d20a6ad97ef46f67bbdec158ce00563a671ebb7

View File

@@ -29,6 +29,7 @@ declare namespace Mastodon {
fields: Field[] fields: Field[]
bot: boolean bot: boolean
source?: Source source?: Source
suspended?: boolean
} }
type Announcement = { type Announcement = {

View File

@@ -1,4 +1,9 @@
[ [
{
"feature": "account_return_suspended",
"version": 3.3,
"reference": "https://github.com/mastodon/mastodon/releases/tag/v3.3.0"
},
{ {
"feature": "edit_post", "feature": "edit_post",
"version": 3.5, "version": 3.5,
@@ -9,11 +14,6 @@
"version": 3.5, "version": 3.5,
"reference": "https://github.com/mastodon/mastodon/releases/tag/v3.5.0" "reference": "https://github.com/mastodon/mastodon/releases/tag/v3.5.0"
}, },
{
"feature": "notification_type_status",
"version": 3.3,
"reference": "https://docs.joinmastodon.org/entities/notification/#required-attributes"
},
{ {
"feature": "notification_type_update", "feature": "notification_type_update",
"version": 3.5, "version": 3.5,

View File

@@ -304,7 +304,8 @@
"toots": { "toots": {
"default": "Toots", "default": "Toots",
"all": "Toots and replies" "all": "Toots and replies"
} },
"suspended": "Account suspended by the moderators of your server"
}, },
"attachments": { "attachments": {
"name": "<0 /><1>\"s media</1>" "name": "<0 /><1>\"s media</1>"

View File

@@ -6,9 +6,9 @@ import { useAccountQuery } from '@utils/queryHooks/account'
import { QueryKeyTimeline } from '@utils/queryHooks/timeline' import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
import { StyleConstants } from '@utils/styles/constants' import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager' import { useTheme } from '@utils/styles/ThemeManager'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' import React, { useEffect, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { StyleSheet, View } from 'react-native' import { StyleSheet, Text, View } from 'react-native'
import { useSharedValue } from 'react-native-reanimated' import { useSharedValue } from 'react-native-reanimated'
import { useIsFetching } from 'react-query' import { useIsFetching } from 'react-query'
import AccountAttachments from './Account/Attachments' import AccountAttachments from './Account/Attachments'
@@ -16,9 +16,7 @@ import AccountHeader from './Account/Header'
import AccountInformation from './Account/Information' import AccountInformation from './Account/Information'
import AccountNav from './Account/Nav' import AccountNav from './Account/Nav'
const TabSharedAccount: React.FC< const TabSharedAccount: React.FC<TabSharedStackScreenProps<'Tab-Shared-Account'>> = ({
TabSharedStackScreenProps<'Tab-Shared-Account'>
> = ({
route: { route: {
params: { account } params: { account }
} }
@@ -48,35 +46,42 @@ const TabSharedAccount: React.FC<
<View style={[styles.header, { borderBottomColor: colors.border }]}> <View style={[styles.header, { borderBottomColor: colors.border }]}>
<AccountHeader account={data} /> <AccountHeader account={data} />
<AccountInformation account={data} /> <AccountInformation account={data} />
{fetchedTimeline.current ? ( {!data?.suspended && fetchedTimeline.current ? (
<AccountAttachments account={data} /> <AccountAttachments account={data} />
) : null} ) : null}
</View> </View>
<SegmentedControl {!data?.suspended ? (
appearance={mode} <SegmentedControl
values={[ appearance={mode}
t('shared.account.toots.default'), values={[t('shared.account.toots.default'), t('shared.account.toots.all')]}
t('shared.account.toots.all') selectedIndex={queryKey[1].page === 'Account_Default' ? 0 : 1}
]} onChange={({ nativeEvent }) => {
selectedIndex={queryKey[1].page === 'Account_Default' ? 0 : 1} switch (nativeEvent.selectedSegmentIndex) {
onChange={({ nativeEvent }) => { case 0:
switch (nativeEvent.selectedSegmentIndex) { setQueryKey([queryKey[0], { ...queryKey[1], page: 'Account_Default' }])
case 0: break
setQueryKey([ case 1:
queryKey[0], setQueryKey([queryKey[0], { ...queryKey[1], page: 'Account_All' }])
{ ...queryKey[1], page: 'Account_Default' } break
]) }
break }}
case 1: style={styles.segmentsContainer}
setQueryKey([ />
queryKey[0], ) : null}
{ ...queryKey[1], page: 'Account_All' } {data?.suspended ? (
]) <View
break style={{
} flex: 1,
}} justifyContent: 'center',
style={styles.segmentsContainer} alignItems: 'center',
/> paddingHorizontal: StyleConstants.Spacing.Global.PagePadding
}}
>
<Text style={{ ...StyleConstants.FontStyle.M, color: colors.secondary, textAlign: 'center' }}>
{t('shared.account.suspended')}
</Text>
</View>
) : null}
</> </>
) )
}, [data, fetchedTimeline.current, queryKey[1].page, i18n.language, mode]) }, [data, fetchedTimeline.current, queryKey[1].page, i18n.language, mode])
@@ -85,19 +90,20 @@ const TabSharedAccount: React.FC<
<> <>
<AccountNav scrollY={scrollY} account={data} /> <AccountNav scrollY={scrollY} account={data} />
<Timeline {data?.suspended ? (
queryKey={queryKey} ListHeaderComponent
disableRefresh ) : (
customProps={{ <Timeline
renderItem: ({ item }) => ( queryKey={queryKey}
<TimelineDefault item={item} queryKey={queryKey} /> disableRefresh
), customProps={{
onScroll: ({ nativeEvent }) => renderItem: ({ item }) => <TimelineDefault item={item} queryKey={queryKey} />,
(scrollY.value = nativeEvent.contentOffset.y), onScroll: ({ nativeEvent }) => (scrollY.value = nativeEvent.contentOffset.y),
ListHeaderComponent, ListHeaderComponent,
maintainVisibleContentPosition: undefined maintainVisibleContentPosition: undefined
}} }}
/> />
)}
</> </>
) )
} }

View File

@@ -54,7 +54,7 @@ const AccountInformationAccount: React.FC<Props> = ({
) : null} ) : null}
<CustomText <CustomText
style={{ style={{
textDecorationLine: account?.moved ? 'line-through' : undefined textDecorationLine: (account?.moved || account?.suspended) ? 'line-through' : undefined
}} }}
selectable selectable
> >

View File

@@ -37,7 +37,7 @@ const Conversation = ({ account }: { account: Mastodon.Account }) => {
} }
const AccountInformationActions: React.FC<Props> = ({ account, myInfo }) => { const AccountInformationActions: React.FC<Props> = ({ account, myInfo }) => {
if (!account) { if (!account || account.suspended) {
return null return null
} }

View File

@@ -12,7 +12,7 @@ export interface Props {
const AccountInformationFields = React.memo( const AccountInformationFields = React.memo(
({ account, myInfo }: Props) => { ({ account, myInfo }: Props) => {
if (myInfo || !account?.fields || account.fields.length === 0) { if (account?.suspended || myInfo || !account?.fields || account.fields.length === 0) {
return null return null
} }
@@ -21,13 +21,8 @@ const AccountInformationFields = React.memo(
return ( return (
<View style={[styles.fields, { borderTopColor: colors.border }]}> <View style={[styles.fields, { borderTopColor: colors.border }]}>
{account.fields.map((field, index) => ( {account.fields.map((field, index) => (
<View <View key={index} style={[styles.field, { borderBottomColor: colors.border }]}>
key={index} <View style={[styles.fieldLeft, { borderRightColor: colors.border }]}>
style={[styles.field, { borderBottomColor: colors.border }]}
>
<View
style={[styles.fieldLeft, { borderRightColor: colors.border }]}
>
<ParseHTML <ParseHTML
content={field.name} content={field.name}
size={'S'} size={'S'}

View File

@@ -41,7 +41,7 @@ const AccountInformationName: React.FC<Props> = ({ account }) => {
<> <>
<CustomText <CustomText
style={{ style={{
textDecorationLine: account?.moved ? 'line-through' : undefined textDecorationLine: account?.moved || account.suspended ? 'line-through' : undefined
}} }}
> >
<ParseEmojis <ParseEmojis

View File

@@ -12,6 +12,7 @@ const AccountInformationNote = React.memo(
({ account, myInfo }: Props) => { ({ account, myInfo }: Props) => {
const [note, setNote] = useState(account?.source?.note) const [note, setNote] = useState(account?.source?.note)
if ( if (
account?.suspended ||
myInfo || myInfo ||
!account?.note || !account?.note ||
account.note.length === 0 || account.note.length === 0 ||

View File

@@ -16,8 +16,11 @@ export interface Props {
} }
const AccountInformationStats: React.FC<Props> = ({ account, myInfo }) => { const AccountInformationStats: React.FC<Props> = ({ account, myInfo }) => {
const navigation = if (account?.suspended) {
useNavigation<StackNavigationProp<TabLocalStackParamList>>() return null
}
const navigation = useNavigation<StackNavigationProp<TabLocalStackParamList>>()
const { colors } = useTheme() const { colors } = useTheme()
const { t } = useTranslation('screenTabs') const { t } = useTranslation('screenTabs')
@@ -31,9 +34,7 @@ const AccountInformationStats: React.FC<Props> = ({ account, myInfo }) => {
})} })}
onPress={() => { onPress={() => {
analytics('account_stats_toots_press') analytics('account_stats_toots_press')
myInfo && myInfo && account && navigation.push('Tab-Shared-Account', { account })
account &&
navigation.push('Tab-Shared-Account', { account })
}} }}
/> />
) : ( ) : (
@@ -47,10 +48,7 @@ const AccountInformationStats: React.FC<Props> = ({ account, myInfo }) => {
)} )}
{account ? ( {account ? (
<CustomText <CustomText
style={[ style={[styles.stat, { color: colors.primaryDefault, textAlign: 'right' }]}
styles.stat,
{ color: colors.primaryDefault, textAlign: 'right' }
]}
children={t('shared.account.summary.following_count', { children={t('shared.account.summary.following_count', {
count: account.following_count count: account.following_count
})} })}
@@ -77,10 +75,7 @@ const AccountInformationStats: React.FC<Props> = ({ account, myInfo }) => {
)} )}
{account ? ( {account ? (
<CustomText <CustomText
style={[ style={[styles.stat, { color: colors.primaryDefault, textAlign: 'center' }]}
styles.stat,
{ color: colors.primaryDefault, textAlign: 'center' }
]}
children={t('shared.account.summary.followers_count', { children={t('shared.account.summary.followers_count', {
count: account.followers_count count: account.followers_count
})} })}