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)
force(true)
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': {
imageUrls: {
id: Mastodon.Attachment['id']
preview_url: Mastodon.AttachmentImage['preview_url']
url: Mastodon.AttachmentImage['url']
remote_url?: Mastodon.AttachmentImage['remote_url']
blurhash: Mastodon.AttachmentImage['blurhash']

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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