1
0
mirror of https://github.com/tooot-app/app synced 2025-04-26 07:58:48 +02:00

Merge pull request #112 from tooot-app/candidate

Nightly 210419
This commit is contained in:
xmflsct 2021-04-19 23:46:21 +02:00 committed by GitHub
commit eca5349635
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 44 additions and 33 deletions

View File

@ -18,4 +18,5 @@ primary_category("SOCIAL_NETWORKING")
automatic_release(false) automatic_release(false)
force(true) force(true)
precheck_include_in_app_purchases(false) precheck_include_in_app_purchases(false)
submit_for_review(true) submit_for_review(true)
overwrite_screenshots(true)

View File

@ -57,6 +57,7 @@ declare namespace Nav {
'Screen-ImagesViewer': { 'Screen-ImagesViewer': {
imageUrls: { imageUrls: {
id: Mastodon.Attachment['id'] id: Mastodon.Attachment['id']
preview_url: Mastodon.AttachmentImage['preview_url']
url: Mastodon.AttachmentImage['url'] url: Mastodon.AttachmentImage['url']
remote_url?: Mastodon.AttachmentImage['remote_url'] remote_url?: Mastodon.AttachmentImage['remote_url']
blurhash: Mastodon.AttachmentImage['blurhash'] blurhash: Mastodon.AttachmentImage['blurhash']

View File

@ -67,8 +67,8 @@ const GracefullyImage = React.memo(
setImageLoaded(true) setImageLoaded(true)
setImageDimensions && setImageDimensions &&
setImageDimensions({ setImageDimensions({
width: nativeEvent.width, width: nativeEvent.source.width,
height: nativeEvent.height height: nativeEvent.source.height
}) })
}, },
[source.uri] [source.uri]
@ -83,15 +83,20 @@ const GracefullyImage = React.memo(
() => () =>
uri.preview && !imageLoaded ? ( uri.preview && !imageLoaded ? (
<Image <Image
fadeDuration={0}
source={{ uri: uri.preview }} source={{ uri: uri.preview }}
style={[{ flex: 1 }, imageStyle]} style={[
styles.placeholder,
{ backgroundColor: theme.shimmerDefault }
]}
/> />
) : null, ) : null,
[imageLoaded] []
) )
const originalView = useMemo( const originalView = useMemo(
() => ( () => (
<Image <Image
fadeDuration={0}
source={source} source={source}
style={[{ flex: 1 }, imageStyle]} style={[{ flex: 1 }, imageStyle]}
onLoad={onLoad} onLoad={onLoad}
@ -104,12 +109,19 @@ const GracefullyImage = React.memo(
if (hidden || !imageLoaded) { if (hidden || !imageLoaded) {
if (blurhash) { if (blurhash) {
return ( return (
<Blurhash decodeAsync blurhash={blurhash} style={styles.blurhash} /> <Blurhash
decodeAsync
blurhash={blurhash}
style={styles.placeholder}
/>
) )
} else { } else {
return ( return (
<View <View
style={[styles.blurhash, { backgroundColor: theme.disabled }]} style={[
styles.placeholder,
{ backgroundColor: theme.shimmerDefault }
]}
/> />
) )
} }
@ -146,7 +158,7 @@ const GracefullyImage = React.memo(
) )
const styles = StyleSheet.create({ const styles = StyleSheet.create({
blurhash: { placeholder: {
width: '100%', width: '100%',
height: '100%', height: '100%',
position: 'absolute' position: 'absolute'

View File

@ -128,7 +128,8 @@ const renderNode = ({
}) })
}} }}
> >
{content || (showFullLink ? href : domain[1])} {(content && content !== href && content) ||
(showFullLink ? href : domain[1])}
{!shouldBeTag ? ( {!shouldBeTag ? (
<Icon <Icon
color={theme.blue} color={theme.blue}

View File

@ -47,6 +47,7 @@ const TimelineAttachment = React.memo(
case 'image': case 'image':
imageUrls.push({ imageUrls.push({
id: attachment.id, id: attachment.id,
preview_url: attachment.preview_url,
url: attachment.url, url: attachment.url,
remote_url: attachment.remote_url, remote_url: attachment.remote_url,
blurhash: attachment.blurhash, blurhash: attachment.blurhash,
@ -107,6 +108,7 @@ const TimelineAttachment = React.memo(
) { ) {
imageUrls.push({ imageUrls.push({
id: attachment.id, id: attachment.id,
preview_url: attachment.preview_url,
url: attachment.url, url: attachment.url,
remote_url: attachment.remote_url, remote_url: attachment.remote_url,
blurhash: attachment.blurhash, blurhash: attachment.blurhash,

View File

@ -90,10 +90,10 @@ const ImageItem = ({
children={ children={
<GracefullyImage <GracefullyImage
uri={{ uri={{
preview: imageSrc.preview_url,
original: imageSrc.url, original: imageSrc.url,
remote: imageSrc.remote_url remote: imageSrc.remote_url
}} }}
blurhash={imageSrc.blurhash}
{...((!imageSrc.width || !imageSrc.height) && { {...((!imageSrc.width || !imageSrc.height) && {
setImageDimensions setImageDimensions
})} })}

View File

@ -145,10 +145,10 @@ const ImageItem = ({
children={ children={
<GracefullyImage <GracefullyImage
uri={{ uri={{
preview: imageSrc.preview_url,
original: imageSrc.url, original: imageSrc.url,
remote: imageSrc.remote_url remote: imageSrc.remote_url
}} }}
blurhash={imageSrc.blurhash}
{...((!imageSrc.width || !imageSrc.height) && { {...((!imageSrc.width || !imageSrc.height) && {
setImageDimensions setImageDimensions
})} })}

View File

@ -6,7 +6,9 @@ const saveIos = async (
image: Nav.RootStackParamList['Screen-ImagesViewer']['imageUrls'][0] image: Nav.RootStackParamList['Screen-ImagesViewer']['imageUrls'][0]
) => { ) => {
CameraRoll.save(image.url) CameraRoll.save(image.url)
.then(() => haptics('Success')) .then(() => {
haptics('Success')
})
.catch(() => { .catch(() => {
if (image.remote_url) { if (image.remote_url) {
CameraRoll.save(image.remote_url) CameraRoll.save(image.remote_url)

View File

@ -11,15 +11,19 @@ import {
useSafeAreaInsets useSafeAreaInsets
} from 'react-native-safe-area-context' } from 'react-native-safe-area-context'
import ImageViewer from './ImageViewer/Root' import ImageViewer from './ImageViewer/Root'
import { saveAndroid, saveIos } from './ImageViewer/save'
const saveImage = async ( const saveImage = async (
image: Nav.RootStackParamList['Screen-ImagesViewer']['imageUrls'][0] image: Nav.RootStackParamList['Screen-ImagesViewer']['imageUrls'][0]
) => { ) => {
const save = require('./ImageViewer/save') switch (Platform.OS) {
Platform.select({ case 'ios':
ios: save.saveIos(image), saveIos(image)
android: save.saveAndroid(image) break
}) case 'android':
saveAndroid(image)
break
}
} }
const HeaderComponent = React.memo( const HeaderComponent = React.memo(
@ -113,6 +117,7 @@ const ScreenImagesViewer = ({
navigation navigation
}: ScreenImagesViewerProp) => { }: ScreenImagesViewerProp) => {
if (imageUrls.length === 0) { if (imageUrls.length === 0) {
navigation.goBack()
return null return null
} }

View File

@ -2,7 +2,6 @@ import analytics from '@components/analytics'
import Icon from '@components/Icon' import Icon from '@components/Icon'
import { MenuContainer, MenuRow } from '@components/Menu' import { MenuContainer, MenuRow } from '@components/Menu'
import { useNavigation } from '@react-navigation/native' import { useNavigation } from '@react-navigation/native'
import { useSearchQuery } from '@utils/queryHooks/search'
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 * as Updates from 'expo-updates' import * as Updates from 'expo-updates'
@ -20,11 +19,6 @@ const SettingsTooot: React.FC = () => {
const { theme } = useTheme() const { theme } = useTheme()
const { t } = useTranslation('screenTabs') const { t } = useTranslation('screenTabs')
const { isLoading, data } = useSearchQuery({
term: '@tooot@xmflsct.com',
options: { enabled: instanceActive !== -1 }
})
return ( return (
<MenuContainer> <MenuContainer>
<MenuRow <MenuRow
@ -66,7 +60,6 @@ const SettingsTooot: React.FC = () => {
) : null} ) : null}
<MenuRow <MenuRow
title={t('me.settings.contact.heading')} title={t('me.settings.contact.heading')}
loading={isLoading}
content={ content={
<Icon <Icon
name='Mail' name='Mail'
@ -76,15 +69,10 @@ const SettingsTooot: React.FC = () => {
} }
iconBack='ChevronRight' iconBack='ChevronRight'
onPress={() => { onPress={() => {
const foundAccounts = data?.accounts.filter( if (instanceActive !== -1) {
account =>
account.acct === 'tooot@xmflsct.com' ||
account.url === 'https://social.xmflsct.com/@tooot'
)
if (foundAccounts?.length === 1) {
navigation.navigate('Screen-Compose', { navigation.navigate('Screen-Compose', {
type: 'conversation', type: 'conversation',
accts: [foundAccounts[0].acct] accts: ['tooot@xmflsct.com']
}) })
} else { } else {
WebBrowser.openBrowserAsync('https://social.xmflsct.com/@tooot') WebBrowser.openBrowserAsync('https://social.xmflsct.com/@tooot')

View File

@ -7,8 +7,7 @@ const audio = () => {
playsInSilentModeIOS: true, playsInSilentModeIOS: true,
interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX, interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX, interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
shouldDuckAndroid: true, shouldDuckAndroid: true
playThroughEarpieceAndroid: true
}) })
} }