Skip to content

Commit

Permalink
- 替换 jsdelivr 资源
Browse files Browse the repository at this point in the history
  • Loading branch information
czy0729 committed May 24, 2022
1 parent 40e6023 commit 72b61b8
Show file tree
Hide file tree
Showing 35 changed files with 74 additions and 76 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ yarn.lock

# Bangumi App
\[deprecated\]/
\[auth\]/
auth/
dist/
gradle.properties
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed src/assets/images/anitama.jpg
Binary file not shown.
Binary file removed src/assets/images/hero.png
Binary file not shown.
Binary file removed src/assets/images/hero_title.png
Binary file not shown.
Binary file removed src/assets/images/hero_title_ios.png
Binary file not shown.
Binary file removed src/assets/images/icon/loading.gif
Binary file not shown.
Binary file removed src/assets/images/icon/pic-error-defult.png
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed src/assets/images/splash2.png
Binary file not shown.
Binary file added src/assets/images/static/2018.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/static/2019.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/static/2020.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
19 changes: 0 additions & 19 deletions src/components/image/image.ios.tsx

This file was deleted.

14 changes: 11 additions & 3 deletions src/components/image/image.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
/*
* @Author: czy0729
* @Date: 2022-05-03 22:53:51
* @Date: 2021-11-23 06:15:27
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-08 01:17:54
* @Last Modified time: 2022-05-25 06:56:42
*/
import { Image } from 'react-native'
import { CacheManager } from '@components/@/react-native-expo-image-cache'

export default Image

export async function clearCache() {}
export async function clearCache() {
try {
await CacheManager.clearCache()
return true
} catch (error) {
return false
}
}
16 changes: 8 additions & 8 deletions src/components/mesume/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Author: czy0729
* @Date: 2019-06-01 19:28:22
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-06 15:52:59
* @Last Modified time: 2022-05-25 07:18:30
*/
import React from 'react'
import { observer } from 'mobx-react'
Expand All @@ -21,13 +21,13 @@ let musume: {
}
function init() {
musume = {
1: require('@assets/images/musume1.png'),
2: require('@assets/images/musume2.png'),
3: require('@assets/images/musume3.png'),
4: require('@assets/images/musume4.png'),
5: require('@assets/images/musume5.png'),
6: require('@assets/images/musume6.png'),
7: require('@assets/images/musume7.png')
1: require('@assets/images/musume/musume1.png'),
2: require('@assets/images/musume/musume2.png'),
3: require('@assets/images/musume/musume3.png'),
4: require('@assets/images/musume/musume4.png'),
5: require('@assets/images/musume/musume5.png'),
6: require('@assets/images/musume/musume6.png'),
7: require('@assets/images/musume/musume7.png')
}
}

Expand Down
14 changes: 12 additions & 2 deletions src/constants/cdn/onair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* @Author: czy0729
* @Date: 2022-05-23 05:43:20
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-23 05:45:47
* @Last Modified time: 2022-05-25 06:51:29
*/
import { getTimestamp } from '@utils'
import dayjs from 'dayjs'
import { SubjectId } from '@types'
import { HOST_CDN } from './ds'
import { getFolder } from './utils'
Expand All @@ -20,3 +20,13 @@ export const CDN_EPS = (subjectId: SubjectId) =>
subjectId,
1000
)}/${subjectId}.json?t=${getTimestamp()}`

function trim(str = '') {
return str.replace(/^\s+|\s+$/gm, '')
}

function getTimestamp(date = '') {
const _date = trim(date)
if (_date) return dayjs(_date).unix()
return dayjs().unix()
}
13 changes: 6 additions & 7 deletions src/constants/cdn/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
* @Author: czy0729
* @Date: 2022-05-23 05:03:05
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-23 05:38:15
* @Last Modified time: 2022-05-25 07:15:34
*/
import { SDK } from '../index'
import {
HOST_CDN,
VERSION_STATIC,
Expand Down Expand Up @@ -48,8 +47,8 @@ export const CDN_STATIC_HENTAI = () => {
}

/** 年鉴 */
export const CDN_AWARD = (year: string | number) => {
const v = getVersion('VERSION_STATIC', VERSION_STATIC)
const prefix = SDK >= 36 ? '.expo' : ''
return `${HOST_STATIC}@${v}/data/award/${year}${prefix}.json`
}
// export const CDN_AWARD = (year: string | number) => {
// const v = getVersion('VERSION_STATIC', VERSION_STATIC)
// const prefix = SDK >= 36 ? '.expo' : ''
// return `${HOST_STATIC}@${v}/data/award/${year}${prefix}.json`
// }
5 changes: 1 addition & 4 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @Author: czy0729
* @Date: 2019-02-22 01:25:31
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-23 23:01:09
* @Last Modified time: 2022-05-25 07:17:41
*/
import { Platform } from 'react-native'
import PropTypes from 'prop-types'
Expand Down Expand Up @@ -177,9 +177,6 @@ export const IMG_DEFAULT_AVATAR = '//lain.bgm.tv/pic/user/s/icon.jpg'
/** 默认图 */
export const IMG_DEFAULT = require('@assets/images/default.png')

/** 图裂图 */
export const IMG_ERROR = require('@assets/images/icon/pic-error-defult.png')

/* ==================== IMG SIZE ==================== */
const h = w => parseInt(String(w * 1.4))

Expand Down
2 changes: 1 addition & 1 deletion src/navigations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useObserver } from 'mobx-react-lite'
import * as Screens from '@screens'
import { systemStore } from '@stores'
import { urlStringify } from '@utils'
import navigationsParams from '../../config'
import navigationsParams from '@/config'
import TabBar from './tab-bar'

export const SCREENS_TOTAL = Object.keys(Screens).length
Expand Down
7 changes: 3 additions & 4 deletions src/screens/discovery/index/award-2021.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2022-02-14 06:57:31
* @Last Modified by: czy0729
* @Last Modified time: 2022-03-16 20:47:12
* @Last Modified time: 2022-05-25 07:11:35
*/
import React, { useState, useEffect } from 'react'
import { InteractionManager, View } from 'react-native'
Expand All @@ -14,9 +14,8 @@ import { useObserver } from '@utils/hooks'
import { c } from '@utils/decorators'
import { t } from '@utils/fetch'
import { HOST } from '@constants'
import Img2021 from '@assets/images/year_2021.png'

const jquery = 'https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.slim.min.js'
const jquery = 'https://unpkg.com/jquery@3.6.0/dist/jquery.slim.min.js'

function Award2021(props, { $, navigation }) {
const isFocused = useIsFocused()
Expand Down Expand Up @@ -74,7 +73,7 @@ function Award2021(props, { $, navigation }) {
)
) : (
<Image
src={Img2021}
src={require('@assets/images/static/2021.png')}
size={styles.body.width}
height={styles.body.height}
placeholder={false}
Expand Down
10 changes: 4 additions & 6 deletions src/screens/discovery/index/award.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2019-05-29 16:08:10
* @Last Modified by: czy0729
* @Last Modified time: 2022-02-16 10:58:20
* @Last Modified time: 2022-05-25 07:10:37
*/
import React from 'react'
import { ScrollView } from 'react-native'
Expand All @@ -14,8 +14,6 @@ import { HOST } from '@constants'
import Award2021 from './award-2021'

const years = [2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010]
const cdn =
'https://cdn.jsdelivr.net/gh/czy0729/Bangumi-Static@20210413/data/award/title'

function Award(props, { navigation }) {
rerender('Discovery.Award')
Expand Down Expand Up @@ -48,7 +46,7 @@ function Award(props, { navigation }) {
}}
>
<Image
src={`${cdn}/2020.png`}
src={require('@assets/images/static/2020.png')}
size={styles.item2020.width}
height={styles.item2020.height}
placeholder={false}
Expand All @@ -74,7 +72,7 @@ function Award(props, { navigation }) {
}}
>
<Image
src={`${cdn}/2019.png`}
src={require('@assets/images/static/2019.png')}
size={styles.item2020.width - 32}
height={styles.item2020.height}
placeholder={false}
Expand All @@ -100,7 +98,7 @@ function Award(props, { navigation }) {
}}
>
<Image
src={`${cdn}/2018.png`}
src={require('@assets/images/static/2018.png')}
size={styles.item2018.width}
height={styles.item2020.height}
placeholder={false}
Expand Down
13 changes: 5 additions & 8 deletions src/screens/discovery/yearbook/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@
* @Author: czy0729
* @Date: 2021-07-15 20:23:25
* @Last Modified by: czy0729
* @Last Modified time: 2022-03-11 21:17:10
* @Last Modified time: 2022-05-25 07:12:40
*/
import React from 'react'
import { Header, Page, ScrollView, Touchable, Image, Flex, Text } from '@components'
import { _ } from '@stores'
import { useObserver } from '@utils/hooks'
import { t } from '@utils/fetch'
import { HOST } from '@constants'
import Img2021 from '@assets/images/year_2021.png'

const cdn =
'https://cdn.jsdelivr.net/gh/czy0729/Bangumi-Static@20210413/data/award/title'
const years = [2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010]

const Yearbook = ({ navigation }) => {
Expand All @@ -40,7 +37,7 @@ const Yearbook = ({ navigation }) => {
}}
>
<Image
src={Img2021}
src={require('@assets/images/static/2021.png')}
size={styles.item2021.width}
height={styles.item2021.height}
placeholder={false}
Expand All @@ -61,7 +58,7 @@ const Yearbook = ({ navigation }) => {
}}
>
<Image
src={`${cdn}/2020.png`}
src={require('@assets/images/static/2020.png')}
size={styles.item2020.width}
height={styles.item2020.height}
placeholder={false}
Expand All @@ -83,7 +80,7 @@ const Yearbook = ({ navigation }) => {
>
<Flex justify='center'>
<Image
src={`${cdn}/2019.png`}
src={require('@assets/images/static/2019.png')}
size={styles.item2019.width - 32}
height={styles.item2019.height}
placeholder={false}
Expand All @@ -105,7 +102,7 @@ const Yearbook = ({ navigation }) => {
}}
>
<Image
src={`${cdn}/2018.png`}
src={require('@assets/images/static/2018.png')}
size={styles.item2018.width}
height={styles.item2018.height}
placeholder={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
* @Author: czy0729
* @Date: 2019-10-05 16:48:42
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-12 04:24:34
* @Last Modified time: 2022-05-25 07:03:36
*/
import React from 'react'
import { Header, ScrollView, Flex, Text, Image } from '@components'
import { _, userStore } from '@stores'
import { useObserver } from '@utils/hooks'
import { HOST_CDN } from '@constants/cdn'

const Qiafan = () => {
return useObserver(() => (
Expand Down Expand Up @@ -67,11 +66,9 @@ const Qiafan = () => {
</Text>
<Flex style={styles.mt160} justify='center'>
<Image
style={styles.image}
size={240}
height={274}
mode='aspectFit'
src={`${HOST_CDN}/gh/czy0729/Bangumi-Static@20210314/data/qr/alipay.png`}
src={require('@assets/images/qr/alipay.png')}
/>
</Flex>
<Text style={styles.mt120} align='center' type='sub'>
Expand All @@ -82,10 +79,9 @@ const Qiafan = () => {
</Text>
<Flex style={styles.mt120} justify='center'>
<Image
style={styles.image}
size={240}
height={240}
src={`${HOST_CDN}/gh/czy0729/Bangumi-Static@20210314/data/qr/wechat.png`}
height={295}
src={require('@assets/images/qr/wx.png')}
/>
</Flex>
</>
Expand All @@ -110,9 +106,5 @@ const styles = _.create({
},
mv20: {
marginVertical: 20
},
image: {
borderRadius: _.radiusMd,
overflow: 'hidden'
}
})
14 changes: 13 additions & 1 deletion src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@
* @Author: czy0729
* @Date: 2019-03-14 06:02:03
* @Last Modified by: czy0729
* @Last Modified time: 2022-05-25 04:12:47
* @Last Modified time: 2022-05-25 06:49:30
*/
import * as layout from './layout'
import * as colors from './colors'
import * as utils from './utils'
import * as tools from './tools'

export * from './layout'
export * from './colors'
export * from './utils'
export * from './tools'

export default {
...layout,
...colors,
...utils,
...tools
}
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@": ["./"],
"@/*": ["./*"],
"@_": ["src/screens/_"],
"@_/*": ["src/screens/_/*"],
"@assets": ["src/assets"],
Expand All @@ -12,6 +14,8 @@
"@constants/*": ["src/constants/*"],
"@screens": ["src/screens"],
"@screens/*": ["src/screens/*"],
"@src": ["src"],
"@src/*": ["src/*"],
"@stores": ["src/stores"],
"@stores/*": ["src/stores/*"],
"@styles": ["src/styles"],
Expand All @@ -21,7 +25,7 @@
"@types": ["src/types"],
"@types/*": ["src/types/*"],
"@utils": ["src/utils"],
"@utils/*": ["src/utils/*"]
"@utils/*": ["src/utils/*"],
},
"allowJs": true,
"esModuleInterop": true,
Expand Down

0 comments on commit 72b61b8

Please sign in to comment.