mirror of
https://github.com/tooot-app/app
synced 2025-04-22 14:17:24 +02:00
Bump to v4
Preparing for adding support to v3.5 and above
This commit is contained in:
parent
1995f32dfd
commit
bceb70e805
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "tooot",
|
"name": "tooot",
|
||||||
"versions": {
|
"versions": {
|
||||||
"native": "220328",
|
"native": "220428",
|
||||||
"major": 3,
|
"major": 4,
|
||||||
"minor": 6,
|
"minor": 0,
|
||||||
"patch": 0,
|
"patch": 0,
|
||||||
"expo": "44.0.0"
|
"expo": "44.0.0"
|
||||||
},
|
},
|
||||||
@ -62,7 +62,7 @@
|
|||||||
"expo-updates": "0.11.6",
|
"expo-updates": "0.11.6",
|
||||||
"expo-video-thumbnails": "6.2.0",
|
"expo-video-thumbnails": "6.2.0",
|
||||||
"expo-web-browser": "10.1.1",
|
"expo-web-browser": "10.1.1",
|
||||||
"i18next": "21.6.14",
|
"i18next": "21.6.16",
|
||||||
"li": "1.3.0",
|
"li": "1.3.0",
|
||||||
"lodash": "4.17.21",
|
"lodash": "4.17.21",
|
||||||
"react": "17.0.2",
|
"react": "17.0.2",
|
||||||
|
2
src/@types/mastodon.d.ts
vendored
2
src/@types/mastodon.d.ts
vendored
@ -320,8 +320,6 @@ declare namespace Mastodon {
|
|||||||
max_expiration: number
|
max_expiration: number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Custom - to be deprecated in v4
|
|
||||||
max_toot_chars?: number
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mention = {
|
type Mention = {
|
||||||
|
@ -27,7 +27,7 @@ const instancesPersistConfig = {
|
|||||||
key: 'instances',
|
key: 'instances',
|
||||||
prefix,
|
prefix,
|
||||||
storage: secureStorage,
|
storage: secureStorage,
|
||||||
version: 8,
|
version: 9,
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
migrate: createMigrate(instancesMigration)
|
migrate: createMigrate(instancesMigration)
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import { InstanceV5 } from './v5'
|
|||||||
import { InstanceV6 } from './v6'
|
import { InstanceV6 } from './v6'
|
||||||
import { InstanceV7 } from './v7'
|
import { InstanceV7 } from './v7'
|
||||||
import { InstanceV8 } from './v8'
|
import { InstanceV8 } from './v8'
|
||||||
|
import { InstanceV9 } from './v9'
|
||||||
|
|
||||||
const instancesMigration = {
|
const instancesMigration = {
|
||||||
4: (state: InstanceV3): InstanceV4 => {
|
4: (state: InstanceV3): InstanceV4 => {
|
||||||
@ -87,6 +88,17 @@ const instancesMigration = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
9: (state: InstanceV8): { instances: InstanceV9[] } => {
|
||||||
|
return {
|
||||||
|
// @ts-ignore
|
||||||
|
instances: state.instances.map(instance => {
|
||||||
|
return {
|
||||||
|
...instance,
|
||||||
|
version: '0'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
79
src/utils/migrations/instances/v9.ts
Normal file
79
src/utils/migrations/instances/v9.ts
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
import { ComposeStateDraft } from '@screens/Compose/utils/types'
|
||||||
|
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||||
|
|
||||||
|
export type InstanceV9 = {
|
||||||
|
active: boolean
|
||||||
|
appData: {
|
||||||
|
clientId: string
|
||||||
|
clientSecret: string
|
||||||
|
}
|
||||||
|
url: string
|
||||||
|
token: string
|
||||||
|
uri: Mastodon.Instance['uri']
|
||||||
|
urls: Mastodon.Instance['urls']
|
||||||
|
account: {
|
||||||
|
id: Mastodon.Account['id']
|
||||||
|
acct: Mastodon.Account['acct']
|
||||||
|
avatarStatic: Mastodon.Account['avatar_static']
|
||||||
|
preferences: Mastodon.Preferences
|
||||||
|
}
|
||||||
|
version: string
|
||||||
|
configuration?: Mastodon.Instance['configuration']
|
||||||
|
filters: Mastodon.Filter[]
|
||||||
|
notifications_filter: {
|
||||||
|
follow: boolean
|
||||||
|
favourite: boolean
|
||||||
|
reblog: boolean
|
||||||
|
mention: boolean
|
||||||
|
poll: boolean
|
||||||
|
follow_request: boolean
|
||||||
|
}
|
||||||
|
push: {
|
||||||
|
global: { loading: boolean; value: boolean }
|
||||||
|
decode: { loading: boolean; value: boolean }
|
||||||
|
alerts: {
|
||||||
|
follow: {
|
||||||
|
loading: boolean
|
||||||
|
value: Mastodon.PushSubscription['alerts']['follow']
|
||||||
|
}
|
||||||
|
favourite: {
|
||||||
|
loading: boolean
|
||||||
|
value: Mastodon.PushSubscription['alerts']['favourite']
|
||||||
|
}
|
||||||
|
reblog: {
|
||||||
|
loading: boolean
|
||||||
|
value: Mastodon.PushSubscription['alerts']['reblog']
|
||||||
|
}
|
||||||
|
mention: {
|
||||||
|
loading: boolean
|
||||||
|
value: Mastodon.PushSubscription['alerts']['mention']
|
||||||
|
}
|
||||||
|
poll: {
|
||||||
|
loading: boolean
|
||||||
|
value: Mastodon.PushSubscription['alerts']['poll']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
keys: {
|
||||||
|
auth?: string
|
||||||
|
public?: string // legacy
|
||||||
|
private?: string // legacy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
timelinesLookback?: {
|
||||||
|
[key: string]: {
|
||||||
|
queryKey: QueryKeyTimeline
|
||||||
|
ids: Mastodon.Status['id'][]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mePage: {
|
||||||
|
lists: { shown: boolean }
|
||||||
|
announcements: { shown: boolean; unread: number }
|
||||||
|
}
|
||||||
|
drafts: ComposeStateDraft[]
|
||||||
|
frequentEmojis: {
|
||||||
|
emoji: Pick<Mastodon.Emoji, 'shortcode' | 'url' | 'static_url'>
|
||||||
|
score: number
|
||||||
|
count: number
|
||||||
|
lastUsed: number
|
||||||
|
}[]
|
||||||
|
}
|
@ -74,9 +74,7 @@ const addInstance = createAsyncThunk(
|
|||||||
avatarStatic: avatar_static,
|
avatarStatic: avatar_static,
|
||||||
preferences
|
preferences
|
||||||
},
|
},
|
||||||
...(instance.max_toot_chars && {
|
version: instance.version,
|
||||||
max_toot_chars: instance.max_toot_chars
|
|
||||||
}),
|
|
||||||
...(instance.configuration && {
|
...(instance.configuration && {
|
||||||
configuration: instance.configuration
|
configuration: instance.configuration
|
||||||
}),
|
}),
|
||||||
|
@ -2,7 +2,7 @@ import analytics from '@components/analytics'
|
|||||||
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
||||||
import { RootState } from '@root/store'
|
import { RootState } from '@root/store'
|
||||||
import { ComposeStateDraft } from '@screens/Compose/utils/types'
|
import { ComposeStateDraft } from '@screens/Compose/utils/types'
|
||||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
import { InstanceV9 } from '@utils/migrations/instances/v9'
|
||||||
import addInstance from './instances/add'
|
import addInstance from './instances/add'
|
||||||
import { checkEmojis } from './instances/checkEmojis'
|
import { checkEmojis } from './instances/checkEmojis'
|
||||||
import removeInstance from './instances/remove'
|
import removeInstance from './instances/remove'
|
||||||
@ -13,82 +13,7 @@ import { updateInstancePush } from './instances/updatePush'
|
|||||||
import { updateInstancePushAlert } from './instances/updatePushAlert'
|
import { updateInstancePushAlert } from './instances/updatePushAlert'
|
||||||
import { updateInstancePushDecode } from './instances/updatePushDecode'
|
import { updateInstancePushDecode } from './instances/updatePushDecode'
|
||||||
|
|
||||||
export type Instance = {
|
export type Instance = InstanceV9
|
||||||
active: boolean
|
|
||||||
appData: {
|
|
||||||
clientId: string
|
|
||||||
clientSecret: string
|
|
||||||
}
|
|
||||||
url: string
|
|
||||||
token: string
|
|
||||||
uri: Mastodon.Instance['uri']
|
|
||||||
urls: Mastodon.Instance['urls']
|
|
||||||
account: {
|
|
||||||
id: Mastodon.Account['id']
|
|
||||||
acct: Mastodon.Account['acct']
|
|
||||||
avatarStatic: Mastodon.Account['avatar_static']
|
|
||||||
preferences: Mastodon.Preferences
|
|
||||||
}
|
|
||||||
max_toot_chars?: number // To be deprecated in v4
|
|
||||||
configuration?: Mastodon.Instance['configuration']
|
|
||||||
filters: Mastodon.Filter[]
|
|
||||||
notifications_filter: {
|
|
||||||
follow: boolean
|
|
||||||
favourite: boolean
|
|
||||||
reblog: boolean
|
|
||||||
mention: boolean
|
|
||||||
poll: boolean
|
|
||||||
follow_request: boolean
|
|
||||||
}
|
|
||||||
push: {
|
|
||||||
global: { loading: boolean; value: boolean }
|
|
||||||
decode: { loading: boolean; value: boolean }
|
|
||||||
alerts: {
|
|
||||||
follow: {
|
|
||||||
loading: boolean
|
|
||||||
value: Mastodon.PushSubscription['alerts']['follow']
|
|
||||||
}
|
|
||||||
favourite: {
|
|
||||||
loading: boolean
|
|
||||||
value: Mastodon.PushSubscription['alerts']['favourite']
|
|
||||||
}
|
|
||||||
reblog: {
|
|
||||||
loading: boolean
|
|
||||||
value: Mastodon.PushSubscription['alerts']['reblog']
|
|
||||||
}
|
|
||||||
mention: {
|
|
||||||
loading: boolean
|
|
||||||
value: Mastodon.PushSubscription['alerts']['mention']
|
|
||||||
}
|
|
||||||
poll: {
|
|
||||||
loading: boolean
|
|
||||||
value: Mastodon.PushSubscription['alerts']['poll']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
keys: {
|
|
||||||
auth?: string
|
|
||||||
public?: string // legacy
|
|
||||||
private?: string // legacy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
timelinesLookback?: {
|
|
||||||
[key: string]: {
|
|
||||||
queryKey: QueryKeyTimeline
|
|
||||||
ids: Mastodon.Status['id'][]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mePage: {
|
|
||||||
lists: { shown: boolean }
|
|
||||||
announcements: { shown: boolean; unread: number }
|
|
||||||
}
|
|
||||||
drafts: ComposeStateDraft[]
|
|
||||||
frequentEmojis: {
|
|
||||||
emoji: Pick<Mastodon.Emoji, 'shortcode' | 'url' | 'static_url'>
|
|
||||||
score: number
|
|
||||||
count: number
|
|
||||||
lastUsed: number
|
|
||||||
}[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export type InstancesState = {
|
export type InstancesState = {
|
||||||
instances: Instance[]
|
instances: Instance[]
|
||||||
@ -318,8 +243,7 @@ const instancesSlice = createSlice({
|
|||||||
// Update Instance Configuration
|
// Update Instance Configuration
|
||||||
.addCase(updateConfiguration.fulfilled, (state, action) => {
|
.addCase(updateConfiguration.fulfilled, (state, action) => {
|
||||||
const activeIndex = findInstanceActive(state.instances)
|
const activeIndex = findInstanceActive(state.instances)
|
||||||
state.instances[activeIndex].max_toot_chars =
|
state.instances[activeIndex].version = action.payload.version
|
||||||
action.payload.max_toot_chars
|
|
||||||
state.instances[activeIndex].configuration =
|
state.instances[activeIndex].configuration =
|
||||||
action.payload.configuration
|
action.payload.configuration
|
||||||
})
|
})
|
||||||
@ -415,14 +339,18 @@ export const getInstanceUri = ({ instances: { instances } }: RootState) =>
|
|||||||
export const getInstanceUrls = ({ instances: { instances } }: RootState) =>
|
export const getInstanceUrls = ({ instances: { instances } }: RootState) =>
|
||||||
instances[findInstanceActive(instances)]?.urls
|
instances[findInstanceActive(instances)]?.urls
|
||||||
|
|
||||||
|
export const getInstanceVersion = ({ instances: { instances } }: RootState) =>
|
||||||
|
instances[findInstanceActive(instances)]?.version
|
||||||
|
export const getInstanceVersionInFloat = ({
|
||||||
|
instances: { instances }
|
||||||
|
}: RootState) => parseFloat(instances[findInstanceActive(instances)]?.version)
|
||||||
|
|
||||||
/* Get Instance Configuration */
|
/* Get Instance Configuration */
|
||||||
export const getInstanceConfigurationStatusMaxChars = ({
|
export const getInstanceConfigurationStatusMaxChars = ({
|
||||||
instances: { instances }
|
instances: { instances }
|
||||||
}: RootState) =>
|
}: RootState) =>
|
||||||
instances[findInstanceActive(instances)]?.configuration?.statuses
|
instances[findInstanceActive(instances)]?.configuration?.statuses
|
||||||
.max_characters ||
|
.max_characters || 500
|
||||||
instances[findInstanceActive(instances)]?.max_toot_chars ||
|
|
||||||
500
|
|
||||||
|
|
||||||
export const getInstanceConfigurationStatusMaxAttachments = ({
|
export const getInstanceConfigurationStatusMaxAttachments = ({
|
||||||
instances: { instances }
|
instances: { instances }
|
||||||
|
@ -4304,10 +4304,10 @@ https-proxy-agent@^5.0.0:
|
|||||||
agent-base "6"
|
agent-base "6"
|
||||||
debug "4"
|
debug "4"
|
||||||
|
|
||||||
i18next@21.6.14:
|
i18next@21.6.16:
|
||||||
version "21.6.14"
|
version "21.6.16"
|
||||||
resolved "https://registry.yarnpkg.com/i18next/-/i18next-21.6.14.tgz#2bc199fba7f4da44b5952d7df0a3814a6e5c3943"
|
resolved "https://registry.yarnpkg.com/i18next/-/i18next-21.6.16.tgz#8cff8c3ba2ffaf8438a8c83fe284083f15cf3941"
|
||||||
integrity sha512-XL6WyD+xlwQwbieXRlXhKWoLb/rkch50/rA+vl6untHnJ+aYnkQ0YDZciTWE78PPhOpbi2gR0LTJCJpiAhA+uQ==
|
integrity sha512-xJlzrVxG9CyAGsbMP1aKuiNr1Ed2m36KiTB7hjGMG2Zo4idfw3p9THUEu+GjBwIgEZ7F11ZbCzJcfv4uyfKNuw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.17.2"
|
"@babel/runtime" "^7.17.2"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user