Skip to content

Commit

Permalink
- expo publish iOS v6.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
czy0729 committed May 31, 2022
1 parent 303d4f6 commit 61019ef
Show file tree
Hide file tree
Showing 12 changed files with 220 additions and 101 deletions.
17 changes: 2 additions & 15 deletions src/components/expand/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,18 @@
* @Author: czy0729
* @Date: 2019-05-09 16:49:41
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-02 10:07:07
* @Last Modified time: 2022-05-31 11:20:47
*/
import React, { useState, useMemo, useRef, useCallback, useEffect } from 'react'
import { View, Animated } from 'react-native'
import { LinearGradient } from 'expo-linear-gradient'
import { useObserver } from 'mobx-react-lite'
import { _ } from '@stores'
import { ViewStyle, ReactNode } from '@types'
import { Touchable } from '../touchable'
import { Flex } from '../flex'
import { Iconfont } from '../iconfont'
import { styles } from './styles'

type Props = {
/** 容器样式 */
style?: ViewStyle

/** 展开箭头样式 */
moreStyle?: ViewStyle

/** 比例 */
ratio?: number

children: ReactNode
}
import { Props } from './types'

export const Expand = ({ style, moreStyle, ratio = 1, children }: Props) => {
const aHeight = useRef(new Animated.Value(0))
Expand Down
4 changes: 2 additions & 2 deletions src/components/expand/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2022-05-01 14:39:50
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-02 09:23:34
* @Last Modified time: 2022-05-31 11:26:59
*/
import { _ } from '@stores'

Expand All @@ -25,7 +25,7 @@ export const styles = _.create({
},
more: {
position: 'absolute',
zIndex: 1,
zIndex: 10,
right: 0,
bottom: -_.md,
left: 0,
Expand Down
20 changes: 20 additions & 0 deletions src/components/expand/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* @Author: czy0729
* @Date: 2022-05-31 08:31:39
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-31 08:31:39
*/
import { ViewStyle, ReactNode } from '@types'

export type Props = {
/** 容器样式 */
style?: ViewStyle

/** 展开箭头样式 */
moreStyle?: ViewStyle

/** 比例 */
ratio?: number

children: ReactNode
}
80 changes: 54 additions & 26 deletions src/components/image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @Author: czy0729
* @Date: 2019-03-15 06:17:18
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-30 07:51:03
* @Last Modified time: 2022-05-31 14:26:19
*/
import React from 'react'
import { View, Image as RNImage } from 'react-native'
Expand All @@ -28,6 +28,7 @@ import { t } from '@utils/fetch'
import { HOST, IOS, IMG_EMPTY, IMG_EMPTY_DARK, EVENT, TEXT_ONLY } from '@constants'
import { MODEL_SETTING_QUALITY } from '@constants/model'
import { Touchable } from '../touchable'
import { Iconfont } from '../iconfont'
import { Flex } from '../flex'
import { Text } from '../text'
import CompImage from './image'
Expand Down Expand Up @@ -159,7 +160,7 @@ export const Image = observer(

// 空地址不作处理
if (_src === 'https:') {
this.onError()
this.comitError()
return false
}

Expand All @@ -169,7 +170,7 @@ export const Image = observer(
* @issue to fixed
*/
if (typeof _src === 'string' && _src.includes('https:/img/')) {
this.onError()
this.comitError()
return false
}

Expand All @@ -188,9 +189,10 @@ export const Image = observer(
_src.includes(OSS_MEGMA_PREFIX) &&
path === undefined
) {
setTimeout(() => {
this.retry(src)
}, RETRY_DISTANCE)
// setTimeout(() => {
// this.retry(src)
// }, RETRY_DISTANCE)
this.onError()
} else {
this.setState({
uri: path || _src
Expand Down Expand Up @@ -291,28 +293,52 @@ export const Image = observer(
*/
onError = async () => {
const { src } = this.props
if (!IOS && typeof src === 'string' && src.includes(OSS_MEGMA_PREFIX)) {
if (
typeof src === 'string' &&
src.includes(OSS_MEGMA_PREFIX) &&
this.errorCount < MAX_ERROR_COUNT
) {
if (checkError451(src)) {
this.recoveryToBgmCover()
return
}

setTimeout(() => {
RNImage.getSize(
src,
() => {},
error => {
// magma oss 若 status code 为 451 直接触发失败
if (String(error).includes('code=451')) {
setError451(src)
this.recoveryToBgmCover()
} else {
setTimeout(() => {
this.retry(`${src}?ts=${getTimestamp()}`)
}, RETRY_DISTANCE)
if (IOS) {
const that = this
const request = new XMLHttpRequest()
request.withCredentials = false
request.onreadystatechange = function () {
if (this.readyState === 4) {
if (this.status === 451) {
setError451(src)
that.recoveryToBgmCover()
} else {
setTimeout(() => {
that.retry(`${src}?ts=${getTimestamp()}`)
}, RETRY_DISTANCE)
}
}
}
)
request.open('get', src, true)
request.send(null)
} else {
RNImage.getSize(
src,
() => {},
error => {
// magma oss 若 status code 为 451 直接触发失败
if (String(error).includes('code=451')) {
setError451(src)
this.recoveryToBgmCover()
} else {
setTimeout(() => {
this.retry(`${src}?ts=${getTimestamp()}`)
}, RETRY_DISTANCE)
}
}
)
}
}, 0)
return
}
Expand Down Expand Up @@ -502,13 +528,15 @@ export const Image = observer(
const { imageTransition } = systemStore.setting
if (error) {
// 错误显示本地的错误提示图片
const size = this.props.size || this.props.width || 80
return (
<CompImage
style={[this.computedStyle.image, this.styles.error]}
source={_.select(IMG_EMPTY, IMG_EMPTY_DARK)}
fadeDuration={this.fadeDuration}
{...other}
/>
<Flex style={[this.computedStyle.image, this.styles.error]} justify='center'>
<Iconfont
style={this.styles.errorIcon}
name='md-do-not-disturb-alt'
size={size / 2.4}
/>
</Flex>
)
}

Expand Down
5 changes: 4 additions & 1 deletion src/components/image/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2022-05-03 21:13:45
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-27 09:24:19
* @Last Modified time: 2022-05-31 13:35:37
*/
import { _ } from '@stores'

Expand All @@ -28,6 +28,9 @@ export const memoStyles = _.memoStyles(() => ({
error: {
padding: 4
},
errorIcon: {
opacity: _.select(0.5, 0.3)
},
textOnly: {
marginTop: -8
}
Expand Down
15 changes: 10 additions & 5 deletions src/screens/_/item/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
* @Author: czy0729
* @Date: 2019-05-08 17:13:08
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-14 06:11:35
* @Last Modified time: 2022-05-31 11:27:10
*/
import React, { useMemo, useCallback } from 'react'
import { ScrollView, View, Alert } from 'react-native'
import { Flex, Katakana, Text, Iconfont, Touchable } from '@components'
import { Flex, Katakana, Text, Iconfont, Touchable, Expand } from '@components'
import { _, timelineStore } from '@stores'
import { getTimestamp, appNavigate, findSubjectCn, getCoverMedium } from '@utils'
import { matchUserId } from '@utils/match'
Expand Down Expand Up @@ -252,9 +252,11 @@ const Item = memo(
</View>
)}
{!!(comment || replyContent || replyCount) && (
<Text style={_.mt.sm} lineHeight={20}>
{comment || replyContent || replyCount}
</Text>
<View style={_.mt.sm}>
<Expand moreStyle={styles.more} ratio={0.64}>
<Text lineHeight={20}>{comment || replyContent || replyCount}</Text>
</Expand>
</View>
)}
</>
)
Expand Down Expand Up @@ -508,6 +510,9 @@ const memoStyles = _.memoStyles(() => ({
extra: {
width: 36,
height: 36
},
more: {
paddingHorizontal: 0
}
}))

Expand Down
37 changes: 19 additions & 18 deletions src/screens/home/subject/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* @Author: czy0729
* @Date: 2019-03-23 04:30:59
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-30 11:52:23
* @Last Modified time: 2022-05-31 08:19:06
*/
import React from 'react'
import { View, Clipboard } from 'react-native'
import { Flex, Text, Katakana, Heatmap } from '@components'
import { Flex, Text, Heatmap } from '@components'
import { ScoreTag, Tag } from '@_'
import { _, systemStore } from '@stores'
import { toFixed, cnjp, getTimestamp } from '@utils'
Expand All @@ -26,6 +26,7 @@ const defaultProps = {
cn: '',
jp: '',
release: '',
year: '',
coverPlaceholder: '',
imageWidth: 0,
imageHeight: 0,
Expand All @@ -46,6 +47,7 @@ const Head = memo(
cn,
jp,
release,
year,
coverPlaceholder,
imageWidth,
imageHeight,
Expand Down Expand Up @@ -83,8 +85,11 @@ const Head = memo(
showRelease = true
}

let tops = [top]
const year = String(release).match(/(\d{4})/)?.[0] || ''
const maxLen = 28
let tops = [
`${String(top).slice(0, maxLen)}${String(top).length >= maxLen ? '...' : ''}`
]

if (year) tops.push(year)
if (titleLabel) tops.push(titleLabel)
tops = tops.join(' · ')
Expand Down Expand Up @@ -131,23 +136,18 @@ const Head = memo(
>
<View>
{!!top && (
<Katakana.Provider
<Text
type='sub'
size={topSize}
itemStyle={styles.katakana}
lineHeight={topSize + 1}
numberOfLines={2}
onLongPress={() => {
Clipboard.setString(top)
info(`已复制 ${top}`)
}}
>
<Katakana
type='sub'
size={topSize}
numberOfLines={2}
onLongPress={() => {
Clipboard.setString(top)
info(`已复制 ${top}`)
}}
>
{tops}
</Katakana>
</Katakana.Provider>
{tops}
</Text>
)}
{!subjectSeries && (
<Text
Expand Down Expand Up @@ -199,6 +199,7 @@ export default obc((props, { $ }) => {
cn={$.cn}
jp={$.jp}
release={$.release}
year={$.year}
coverPlaceholder={$.coverPlaceholder}
imageWidth={$.imageWidth}
imageHeight={$.imageHeight}
Expand Down
Loading

0 comments on commit 61019ef

Please sign in to comment.