Push add more types

This commit is contained in:
Zhiyuan Zheng 2022-05-29 01:57:15 +02:00
parent 242b11761b
commit 6b4c2d18ec
7 changed files with 48 additions and 4 deletions

View File

@ -376,10 +376,12 @@ declare namespace Mastodon {
endpoint: string endpoint: string
alerts: { alerts: {
follow: boolean follow: boolean
follow_request: boolean
favourite: boolean favourite: boolean
reblog: boolean reblog: boolean
mention: boolean mention: boolean
poll: boolean poll: boolean
status: boolean
} }
server_key: string server_key: string
} }

View File

@ -169,6 +169,9 @@
"follow": { "follow": {
"heading": "New follower" "heading": "New follower"
}, },
"follow_request": {
"heading": "Follow request"
},
"favourite": { "favourite": {
"heading": "Favourited" "heading": "Favourited"
}, },
@ -181,6 +184,9 @@
"poll": { "poll": {
"heading": "Poll updates" "heading": "Poll updates"
}, },
"status": {
"heading": "Toot from subscribed users"
},
"howitworks": "Learn how routing works" "howitworks": "Learn how routing works"
}, },
"root": { "root": {

View File

@ -73,12 +73,22 @@ const TabMePush: React.FC = () => {
const alerts = useMemo(() => { const alerts = useMemo(() => {
return instancePush?.alerts return instancePush?.alerts
? ( ? (
['follow', 'favourite', 'reblog', 'mention', 'poll'] as [ [
'follow', 'follow',
'follow_request',
'favourite', 'favourite',
'reblog', 'reblog',
'mention', 'mention',
'poll' 'poll',
'status'
] as [
'follow',
'follow_request',
'favourite',
'reblog',
'mention',
'poll',
'status'
] ]
).map(alert => ( ).map(alert => (
<MenuRow <MenuRow

View File

@ -14,7 +14,7 @@ import { useDispatch, useSelector } from 'react-redux'
const TabMeSettingsLanguage: React.FC< const TabMeSettingsLanguage: React.FC<
TabMeStackScreenProps<'Tab-Me-Settings-Language'> TabMeStackScreenProps<'Tab-Me-Settings-Language'>
> = () => { > = ({ navigation }) => {
const { i18n, t } = useTranslation('screenTabs') const { i18n, t } = useTranslation('screenTabs')
const languages = Object.entries(LOCALES) const languages = Object.entries(LOCALES)
const instances = useSelector(getInstances) const instances = useSelector(getInstances)
@ -72,6 +72,8 @@ const TabMeSettingsLanguage: React.FC<
} }
}) })
} }
navigation.pop(1)
} }
return ( return (

View File

@ -110,6 +110,20 @@ const instancesMigration = {
...instance.notifications_filter, ...instance.notifications_filter,
status: true, status: true,
update: true update: true
},
push: {
...instance.push,
alerts: {
...instance.push.alerts,
follow_request: {
loading: false,
value: true
},
status: {
loading: false,
value: true
}
}
} }
} }
}) })

View File

@ -38,6 +38,10 @@ export type InstanceV10 = {
loading: boolean loading: boolean
value: Mastodon.PushSubscription['alerts']['follow'] value: Mastodon.PushSubscription['alerts']['follow']
} }
follow_request: {
loading: boolean
value: Mastodon.PushSubscription['alerts']['follow_request']
}
favourite: { favourite: {
loading: boolean loading: boolean
value: Mastodon.PushSubscription['alerts']['favourite'] value: Mastodon.PushSubscription['alerts']['favourite']
@ -54,6 +58,10 @@ export type InstanceV10 = {
loading: boolean loading: boolean
value: Mastodon.PushSubscription['alerts']['poll'] value: Mastodon.PushSubscription['alerts']['poll']
} }
status: {
loading: boolean
value: Mastodon.PushSubscription['alerts']['status']
}
} }
keys: { keys: {
auth?: string auth?: string

View File

@ -94,10 +94,12 @@ const addInstance = createAsyncThunk(
decode: { loading: false, value: false }, decode: { loading: false, value: false },
alerts: { alerts: {
follow: { loading: false, value: true }, follow: { loading: false, value: true },
follow_request: { loading: false, value: true },
favourite: { loading: false, value: true }, favourite: { loading: false, value: true },
reblog: { loading: false, value: true }, reblog: { loading: false, value: true },
mention: { loading: false, value: true }, mention: { loading: false, value: true },
poll: { loading: false, value: true } poll: { loading: false, value: true },
status: { loading: false, value: true }
}, },
keys: { auth: undefined, public: undefined, private: undefined } keys: { auth: undefined, public: undefined, private: undefined }
}, },