1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Full login flow working

Refresh can be faster
This commit is contained in:
Zhiyuan Zheng
2020-11-21 00:40:55 +01:00
parent ab0062e73c
commit 3280663144
27 changed files with 330 additions and 138 deletions

View File

@ -15,7 +15,7 @@ const renderNode = ({
node: HTMLViewNode
index: number
navigation: any
mentions?: mastodon.Mention[]
mentions?: Mastodon.Mention[]
showFullLink: boolean
}) => {
if (node.name == 'a') {
@ -80,9 +80,9 @@ const renderNode = ({
export interface Props {
content: string
emojis?: mastodon.Emoji[]
emojis?: Mastodon.Emoji[]
emojiSize?: number
mentions?: mastodon.Mention[]
mentions?: Mastodon.Mention[]
showFullLink?: boolean
linesTruncated?: number
}

View File

@ -7,7 +7,7 @@ import Emojis from './Emojis'
export interface Props {
action: 'favourite' | 'follow' | 'mention' | 'poll' | 'reblog'
name?: string
emojis?: mastodon.Emoji[]
emojis?: Mastodon.Emoji[]
notification?: boolean
}

View File

@ -10,10 +10,11 @@ import {
} from 'react-native'
import Toast from 'react-native-toast-message'
import { useMutation, useQueryCache } from 'react-query'
import { useSelector } from 'react-redux'
import { Feather } from '@expo/vector-icons'
import client from 'src/api/client'
import { getLocalAccountId } from 'src/stacks/common/instancesSlice'
import store from 'src/stacks/common/store'
const fireMutation = async ({
id,
@ -106,12 +107,12 @@ const fireMutation = async ({
}
export interface Props {
queryKey: store.QueryKey
status: mastodon.Status
queryKey: App.QueryKey
status: Mastodon.Status
}
const ActionsStatus: React.FC<Props> = ({ queryKey, status }) => {
const localAccountId = useSelector(state => state.instanceInfo.localAccountId)
const localAccountId = getLocalAccountId(store.getState())
const [modalVisible, setModalVisible] = useState(false)
const queryCache = useQueryCache()
@ -129,7 +130,7 @@ const ActionsStatus: React.FC<Props> = ({ queryKey, status }) => {
// oldData &&
// oldData.map((paging: any) => {
// paging.toots.map(
// (status: mastodon.Status | mastodon.Notification, i: number) => {
// (status: Mastodon.Status | Mastodon.Notification, i: number) => {
// if (status.id === newData.id) {
// paging.toots[i] = newData
// }

View File

@ -5,7 +5,7 @@ import AttachmentImage from './Attachment/AttachmentImage'
import AttachmentVideo from './Attachment/AttachmentVideo'
export interface Props {
media_attachments: mastodon.Attachment[]
media_attachments: Mastodon.Attachment[]
sensitive: boolean
width: number
}

View File

@ -3,7 +3,7 @@ import { Button, Image, Modal, StyleSheet, Pressable, View } from 'react-native'
import ImageViewer from 'react-native-image-zoom-viewer'
export interface Props {
media_attachments: mastodon.Attachment[]
media_attachments: Mastodon.Attachment[]
sensitive: boolean
width: number
}

View File

@ -4,7 +4,7 @@ import { Video } from 'expo-av'
import { Feather } from '@expo/vector-icons'
export interface Props {
media_attachments: mastodon.Attachment[]
media_attachments: Mastodon.Attachment[]
sensitive: boolean
width: number
}

View File

@ -3,7 +3,7 @@ import { Image, Pressable, StyleSheet, Text, View } from 'react-native'
import { useNavigation } from '@react-navigation/native'
export interface Props {
card: mastodon.Card
card: Mastodon.Card
}
const Card: React.FC<Props> = ({ card }) => {

View File

@ -6,8 +6,8 @@ import ParseContent from 'src/components/ParseContent'
export interface Props {
content: string
emojis: mastodon.Emoji[]
mentions: mastodon.Mention[]
emojis: Mastodon.Emoji[]
mentions: Mastodon.Mention[]
spoiler_text?: string
}

View File

@ -5,7 +5,7 @@ const regexEmoji = new RegExp(/(:[a-z0-9_]+:)/)
export interface Props {
content: string
emojis: mastodon.Emoji[]
emojis: Mastodon.Emoji[]
dimension: number
}

View File

@ -9,6 +9,11 @@ import Emojis from './Emojis'
import relativeTime from 'src/utils/relativeTime'
import client from 'src/api/client'
import { useSelector } from 'react-redux'
import {
getLocalAccountId,
getLocalUrl
} from 'src/stacks/common/instancesSlice'
import store from 'src/stacks/common/store'
const fireMutation = async ({
id,
@ -116,14 +121,14 @@ const fireMutation = async ({
}
export interface Props {
queryKey: store.QueryKey
queryKey: App.QueryKey
accountId: string
domain: string
name: string
emojis?: mastodon.Emoji[]
emojis?: Mastodon.Emoji[]
account: string
created_at: string
application?: mastodon.Application
application?: Mastodon.Application
}
const Header: React.FC<Props> = ({
@ -137,8 +142,8 @@ const Header: React.FC<Props> = ({
application
}) => {
const navigation = useNavigation()
const localAccountId = useSelector(state => state.instanceInfo.localAccountId)
const localDomain = useSelector(state => state.instanceInfo.local)
const localAccountId = getLocalAccountId(store.getState())
const localDomain = getLocalUrl(store.getState())
const [since, setSince] = useState(relativeTime(created_at))
const [modalVisible, setModalVisible] = useState(false)
@ -158,7 +163,7 @@ const Header: React.FC<Props> = ({
// oldData &&
// oldData.map((paging: any) => {
// paging.toots.map(
// (status: mastodon.Status | mastodon.Notification, i: number) => {
// (status: Mastodon.Status | Mastodon.Notification, i: number) => {
// if (status.id === newData.id) {
// paging.toots[i] = newData
// }

View File

@ -4,7 +4,7 @@ import { StyleSheet, Text, View } from 'react-native'
import Emojis from './Emojis'
export interface Props {
poll: mastodon.Poll
poll: Mastodon.Poll
}
// When haven't voted, result should not be shown but intead let people vote
const Poll: React.FC<Props> = ({ poll }) => {

View File

@ -12,8 +12,8 @@ import Card from './Status/Card'
import ActionsStatus from './Status/ActionsStatus'
export interface Props {
notification: mastodon.Notification
queryKey: store.QueryKey
notification: Mastodon.Notification
queryKey: App.QueryKey
}
const TootNotification: React.FC<Props> = ({ notification, queryKey }) => {

View File

@ -12,8 +12,8 @@ import Card from './Status/Card'
import ActionsStatus from './Status/ActionsStatus'
export interface Props {
status: mastodon.Status
queryKey: store.QueryKey
status: Mastodon.Status
queryKey: App.QueryKey
}
const StatusInTimeline: React.FC<Props> = ({ status, queryKey }) => {