diff --git a/.gitignore b/.gitignore index d41eea35e..800977929 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,10 @@ node_modules -node_modules33 -node_modules34 -package33.json -package34.json .vscode .expo .expo-shared +yarn.lock bangumi.jks KEYSTORE.MD -yarn.lock \ No newline at end of file +bangumi.mobileprovision +ApplePushServices.p12 +iPhoneDistribution.p12 \ No newline at end of file diff --git a/app.json b/app.json index c4e7b121b..73e0a3e0b 100644 --- a/app.json +++ b/app.json @@ -8,7 +8,7 @@ "ios", "android" ], - "version": "0.13.1", + "version": "1.0.0", "orientation": "portrait", "icon": "./assets/images/icon.png", "splash": { @@ -24,7 +24,8 @@ "**/*" ], "ios": { - "supportsTablet": true + "bundleIdentifier": "com.czy0729.bangumi", + "supportsTablet": false }, "android": { "package": "com.czy0729.bangumi" diff --git a/assets/images/icon.png b/assets/images/icon.png old mode 100755 new mode 100644 index b442b7bf2..4f1a3d147 Binary files a/assets/images/icon.png and b/assets/images/icon.png differ diff --git a/components/bgm.js b/components/bgm.js index d02008f6e..aab23da8b 100644 --- a/components/bgm.js +++ b/components/bgm.js @@ -3,7 +3,7 @@ * @Author: czy0729 * @Date: 2019-06-16 04:41:39 * @Last Modified by: czy0729 - * @Last Modified time: 2019-06-22 14:03:14 + * @Last Modified time: 2019-08-30 18:08:38 */ import React from 'react' import Image from './image' @@ -111,15 +111,17 @@ export const bgm = { 100: require('@bgm/100.gif') } -const Bgm = ({ index, size, ...other }) => ( - -) +function Bgm({ index, size, ...other }) { + return ( + + ) +} Bgm.defaultProps = { index: 1, diff --git a/components/blur-view.js b/components/blur-view.js index 04ee8183d..b1863f88a 100644 --- a/components/blur-view.js +++ b/components/blur-view.js @@ -4,7 +4,7 @@ * @Author: czy0729 * @Date: 2019-03-14 15:38:50 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-20 20:18:37 + * @Last Modified time: 2019-08-30 18:08:56 */ import React from 'react' import { StyleSheet, View } from 'react-native' @@ -20,7 +20,7 @@ const backgroundColor = { xlight: ['rgba(255, 255, 255, 0.64)', 'rgba(255, 255, 255, 0.8)'] } -const BlurView = ({ style, src, theme, intensity, children }) => { +function BlurView({ style, src, theme, intensity, children }) { if (!src) { return null } diff --git a/components/button.js b/components/button.js index 66e042edc..4fd6c8538 100644 --- a/components/button.js +++ b/components/button.js @@ -3,7 +3,7 @@ * @Author: czy0729 * @Date: 2019-03-15 02:32:29 * @Last Modified by: czy0729 - * @Last Modified time: 2019-06-22 14:14:42 + * @Last Modified time: 2019-08-30 18:09:04 */ import React from 'react' import { StyleSheet, View } from 'react-native' @@ -15,7 +15,7 @@ import Flex from './flex' import Text from './text' import Touchable from './touchable' -const Button = ({ +function Button({ style, type, size, @@ -25,7 +25,7 @@ const Button = ({ children, onPress, ...other -}) => { +}) { const _wrap = [styles.button] const _text = [styles.text] diff --git a/components/divider.js b/components/divider.js index ccb695538..52f9514a1 100644 --- a/components/divider.js +++ b/components/divider.js @@ -3,7 +3,7 @@ * @Author: czy0729 * @Date: 2019-03-29 03:42:01 * @Last Modified by: czy0729 - * @Last Modified time: 2019-06-22 14:15:00 + * @Last Modified time: 2019-08-30 18:09:18 */ import React from 'react' import { StyleSheet, View } from 'react-native' @@ -11,15 +11,17 @@ import _ from '@styles' import Flex from './flex' import Text from './text' -const Divider = ({ style }) => ( - - - - / / / - - - -) +function Divider({ style }) { + return ( + + + + / / / + + + + ) +} Divider.defaultProps = { style: undefined diff --git a/components/header-placeholder.js b/components/header-placeholder.js index d49bf0897..df5717bfe 100644 --- a/components/header-placeholder.js +++ b/components/header-placeholder.js @@ -3,13 +3,13 @@ * @Author: czy0729 * @Date: 2019-04-28 17:04:04 * @Last Modified by: czy0729 - * @Last Modified time: 2019-06-22 14:15:33 + * @Last Modified time: 2019-08-30 18:09:33 */ import React from 'react' import { View } from 'react-native' import _ from '@styles' -const HeaderPlaceholder = ({ style, tabs }) => { +function HeaderPlaceholder({ style, tabs }) { let height = _.headerHeight if (tabs) { height += _.tabsHeight diff --git a/components/icon.js b/components/icon.js index 5f0e01aa8..be8d454a3 100644 --- a/components/icon.js +++ b/components/icon.js @@ -4,26 +4,28 @@ * @Author: czy0729 * @Date: 2019-03-15 08:20:56 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-20 20:19:15 + * @Last Modified time: 2019-08-30 18:09:45 */ import React from 'react' import * as ExpoIcon from '@expo/vector-icons' -const Icon = ({ style, name, size, color, ...other }) => ( - -) +function Icon({ style, name, size, color, ...other }) { + return ( + + ) +} Icon.defaultProps = { style: undefined, diff --git a/components/iconfont.js b/components/iconfont.js index 82ca8ad71..e6696699a 100644 --- a/components/iconfont.js +++ b/components/iconfont.js @@ -3,27 +3,29 @@ * @Author: czy0729 * @Date: 2019-05-07 14:28:43 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-20 20:19:22 + * @Last Modified time: 2019-08-30 18:09:57 */ import React from 'react' import * as Icon from '@expo/vector-icons' import { colorIcon } from '@styles' -const Iconfont = ({ style, name, size, color, ...other }) => ( - -) +function Iconfont({ style, name, size, color, ...other }) { + return ( + + ) +} Iconfont.defaultProps = { style: undefined, diff --git a/components/image.js b/components/image.js index d153e8ae5..76e5d66d0 100644 --- a/components/image.js +++ b/components/image.js @@ -10,7 +10,7 @@ * @Author: czy0729 * @Date: 2019-03-15 06:17:18 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-27 17:09:01 + * @Last Modified time: 2019-08-30 23:17:27 */ import React from 'react' import { StyleSheet, View, Image as RNImage } from 'react-native' @@ -108,6 +108,11 @@ export default class Image extends React.Component { } _src = this.getQuality(_src, qualityLevel) + // 空地址不作处理 + if (_src === 'https:') { + return false + } + // 检查本地有没有图片缓存 // @issue 这个地方没判断同时一个页面有相同图片, 同时检测本地地址的会触发unmounted res = CacheManager.get(_src).getPath() @@ -141,6 +146,12 @@ export default class Image extends React.Component { uri = `https:${uri}` } } + + // 空地址不作处理 + if (uri === 'https:') { + return false + } + this.setState({ uri }) diff --git a/components/menu.js b/components/menu.js index c807bbc1a..ad6829081 100644 --- a/components/menu.js +++ b/components/menu.js @@ -3,7 +3,7 @@ * @Author: czy0729 * @Date: 2019-04-06 06:57:49 * @Last Modified by: czy0729 - * @Last Modified time: 2019-06-22 14:20:36 + * @Last Modified time: 2019-08-30 18:10:26 */ import React from 'react' import { StyleSheet, View } from 'react-native' @@ -11,51 +11,53 @@ import _ from '@styles' import Text from './text' import Touchable from './touchable' -const Menu = ({ style, title, data, onSelect }) => ( - - {title.length !== 0 && ( - - {title.map((item, index) => ( - - {item} - - ))} - - )} - {data.map((item, index) => { - if (typeof item === 'string') { +function Menu({ style, title, data, onSelect }) { + return ( + + {title.length !== 0 && ( + + {title.map((item, index) => ( + + {item} + + ))} + + )} + {data.map((item, index) => { + if (typeof item === 'string') { + return ( + + onSelect(item)}> + + {item} + + + + ) + } + + if (item.type === 'divider') { + // eslint-disable-next-line react/no-array-index-key + return + } + return ( - - onSelect(item)}> - - {item} - + + onSelect(item.title)}> + {item.title} ) - } - - if (item.type === 'divider') { - // eslint-disable-next-line react/no-array-index-key - return - } - - return ( - - onSelect(item.title)}> - {item.title} - - - ) - })} - -) + })} + + ) +} Menu.defaultProps = { style: undefined, diff --git a/components/mesume.js b/components/mesume.js index c322f880f..6704fda56 100644 --- a/components/mesume.js +++ b/components/mesume.js @@ -3,7 +3,7 @@ * @Author: czy0729 * @Date: 2019-06-01 19:28:22 * @Last Modified by: czy0729 - * @Last Modified time: 2019-06-22 14:20:49 + * @Last Modified time: 2019-08-30 18:10:42 */ import React from 'react' import Image from './image' @@ -18,7 +18,7 @@ const musume = { 7: require('@assets/images/musume7.png') } -const Musume = ({ style, size, ...other }) => { +function Musume({ style, size, ...other }) { // 获取1-7之间的随机数 const key = Math.floor(Math.random() * 7) + 1 return ( diff --git a/components/render-html/index.js b/components/render-html/index.js index 3c955b346..bdb2cbbc9 100644 --- a/components/render-html/index.js +++ b/components/render-html/index.js @@ -4,7 +4,7 @@ * @Author: czy0729 * @Date: 2019-04-29 19:54:57 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-29 17:29:56 + * @Last Modified time: 2019-08-30 18:32:57 */ import React from 'react' import { View } from 'react-native' @@ -170,15 +170,7 @@ export default class RenderHtml extends React.Component { formatHTML = () => { const { html, baseFontStyle } = this.props - - // 给纯文字包上span - // let _html = `
${html}
` - // const match = _html.match(/>[^<>]+? (_html = _html.replace(item, `><`)) - // ) - // } + let _html // 把bgm表情替换成bgm字体文字 const $ = cheerio(html) @@ -195,8 +187,18 @@ export default class RenderHtml extends React.Component { } return $img.html() }) + _html = $.html() + + // 给纯文字包上span, 否则安卓不能自由复制 + _html = `
${_html}
` + const match = _html.match(/>[^<>]+? (_html = _html.replace(item, `><`)) + ) + } - return $.html() + return _html } render() { diff --git a/components/shadow.js b/components/shadow.js index 2231176a7..daa452579 100644 --- a/components/shadow.js +++ b/components/shadow.js @@ -3,16 +3,20 @@ * @Author: czy0729 * @Date: 2019-04-01 07:54:06 * @Last Modified by: czy0729 - * @Last Modified time: 2019-06-22 14:24:02 + * @Last Modified time: 2019-08-30 18:10:56 */ import React from 'react' import { StyleSheet, View } from 'react-native' import { IOS } from '@constants' import _ from '@styles' -const Shadow = ({ style, children }) => ( - {children} -) +function Shadow({ style, children }) { + return ( + + {children} + + ) +} export default Shadow diff --git a/components/tabs.js b/components/tabs.js index 94c33fa65..55903cd6c 100644 --- a/components/tabs.js +++ b/components/tabs.js @@ -4,14 +4,14 @@ * @Author: czy0729 * @Date: 2019-04-14 00:32:51 * @Last Modified by: czy0729 - * @Last Modified time: 2019-07-27 16:00:34 + * @Last Modified time: 2019-08-30 18:11:10 */ import React from 'react' import { StyleSheet } from 'react-native' import { colorMain, radiusSm } from '@styles' import AntdTabs from './@/ant-design/tabs' -const Tabs = ({ +function Tabs({ tabs, tabBarBackgroundColor, tabBarUnderlineStyle, @@ -19,18 +19,20 @@ const Tabs = ({ renderTabBarLeft, children, ...other -}) => ( - - {children} - -) +}) { + return ( + + {children} + + ) +} Tabs.defaultProps = { tabs: [], diff --git a/components/text.js b/components/text.js index 4953d90c7..636bce497 100644 --- a/components/text.js +++ b/components/text.js @@ -3,14 +3,14 @@ * @Author: czy0729 * @Date: 2019-03-15 06:11:55 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-12 09:24:37 + * @Last Modified time: 2019-08-30 18:08:10 */ import React from 'react' import { StyleSheet, Text as RNText } from 'react-native' import { IOS } from '@constants' import _ from '@styles' -const Text = ({ +function Text({ style, type, underline, @@ -20,7 +20,7 @@ const Text = ({ bold, children, ...other -}) => { +}) { const _style = [styles.text] if (type) { _style.push(styles[type]) diff --git a/components/touchable.js b/components/touchable.js index 0affff089..ea108aab2 100644 --- a/components/touchable.js +++ b/components/touchable.js @@ -3,7 +3,7 @@ * @Author: czy0729 * @Date: 2019-03-28 15:35:04 * @Last Modified by: czy0729 - * @Last Modified time: 2019-06-22 14:25:29 + * @Last Modified time: 2019-08-30 18:11:21 */ import React from 'react' import { @@ -16,13 +16,7 @@ import { import { IOS } from '@constants' import _ from '@styles' -const Touchable = ({ - style, - withoutFeedback, - highlight, - children, - ...other -}) => { +function Touchable({ style, withoutFeedback, highlight, children, ...other }) { if (withoutFeedback) { return ( diff --git a/constants/index.js b/constants/index.js index 29a8afa4a..ffb471e03 100644 --- a/constants/index.js +++ b/constants/index.js @@ -3,7 +3,7 @@ * @Author: czy0729 * @Date: 2019-02-22 01:25:31 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-29 17:41:18 + * @Last Modified time: 2019-08-30 23:11:26 */ import { Platform } from 'react-native' import Constants from 'expo-constants' @@ -31,9 +31,9 @@ export const GITHUB_URL = 'https://github.com/czy0729/Bangumi' export const GITHUB_RELEASE_URL = `${GITHUB_URL}/releases` export const GITHUB_RELEASE_REPOS_URL = 'https://api.github.com/repos/czy0729/Bangumi/releases' -export const GITHUB_RELEASE_VERSION = '0.13.1' +export const GITHUB_RELEASE_VERSION = '1.0.0' export const CODE_PUSH_VERSION = '' -export const DEV = false +export const DEV = true // 图片 export const IMG_DEFAULT_AVATAR = '//lain.bgm.tv/pic/user/s/icon.jpg' diff --git a/navigations.js b/navigations.js index 6e9757ba8..0ecf95661 100644 --- a/navigations.js +++ b/navigations.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-06-02 14:42:28 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-29 15:57:35 + * @Last Modified time: 2019-08-29 21:02:10 */ export default { initialRouteName: 'HomeTab', // HomeTab diff --git a/screens/_/base/eps.js b/screens/_/base/eps.js index 448e6a079..e99537b29 100644 --- a/screens/_/base/eps.js +++ b/screens/_/base/eps.js @@ -2,18 +2,22 @@ * @Author: czy0729 * @Date: 2019-03-15 02:19:02 * @Last Modified by: czy0729 - * @Last Modified time: 2019-07-22 01:09:16 + * @Last Modified time: 2019-08-31 00:23:36 */ import React from 'react' import { StyleSheet, View } from 'react-native' +import { observer } from 'mobx-react' import { Carousel } from '@ant-design/react-native' import { Flex, Popover, Menu, Button, Text } from '@components' +import { systemStore } from '@stores' +import { arrGroup } from '@utils' import { IOS } from '@constants' import { MODEL_EP_TYPE } from '@constants/model' -import { arrGroup } from '@utils' import _ from '@styles' -export default class Eps extends React.Component { +export default +@observer +class Eps extends React.Component { static defaultProps = { numbersOfLine: 8, // 1行多少个, 为了美观, 通过计算按钮占满1行 pagination: false, // 是否分页, 1页4行按钮, 不分页显示1页, 分页会显示Carousel @@ -64,6 +68,16 @@ export default class Eps extends React.Component { } } + get commentMin() { + const { eps } = this.props + return Math.min(...eps.map(item => item.comment).filter(item => !!item)) + } + + get commentMax() { + const { eps } = this.props + return Math.max(...eps.map(item => item.comment)) + } + getPopoverData = item => { const { canPlay, login, advance, userProgress } = this.props let discuss @@ -139,6 +153,17 @@ export default class Eps extends React.Component { > {item.sort} + {systemStore.setting.heatMap && ( + + )} ) } @@ -295,6 +320,16 @@ const styles = StyleSheet.create({ marginTop: 2, borderLeftWidth: 2, borderColor: _.colorSub + }, + hotBar: { + position: 'absolute', + right: 0, + bottom: 0, + left: 0, + height: 4, + marginBottom: -4, + backgroundColor: _.colorWarning, + borderRadius: 4 } }) diff --git a/screens/_/item/timeline.js b/screens/_/item/timeline.js index a91faf29f..4ecdda42d 100644 --- a/screens/_/item/timeline.js +++ b/screens/_/item/timeline.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-05-08 17:13:08 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-29 01:16:09 + * @Last Modified time: 2019-08-30 23:19:01 */ import React from 'react' import { StyleSheet, ScrollView, View, Alert } from 'react-native' @@ -240,7 +240,7 @@ class ItemTimeline extends React.Component { {this.renderP()} {this.renderDesc()} {this.renderImages()} - + {!!reply.count && ( navigation.push('Tinygrail')} /> navigation.push('Tinygrail')} /> + + } + withoutFeedback + /> 联系 diff --git a/screens/timeline/index.js b/screens/timeline/index.js index ea66f2555..401830022 100644 --- a/screens/timeline/index.js +++ b/screens/timeline/index.js @@ -2,13 +2,14 @@ * @Author: czy0729 * @Date: 2019-04-12 13:56:44 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-11 14:13:06 + * @Last Modified time: 2019-08-30 23:23:52 */ import React from 'react' import { View } from 'react-native' import { SafeAreaView } from 'react-navigation' import PropTypes from 'prop-types' import { StatusBarEvents, IconTabsHeader, IconTabBar } from '@screens/_' +import { open } from '@utils' import { inject, withTabsHeader, observer } from '@utils/decorators' import { hm } from '@utils/fetch' import { HTML_NEW_TIMELINE } from '@constants/html' @@ -46,14 +47,15 @@ class Timeline extends React.Component { name='add' position='right' onPress={() => { - if ($.isWebLogin) { - navigation.push('WebView', { - uri: HTML_NEW_TIMELINE($.myUserId), - title: '添加新时间线' - }) - } else { - navigation.push('LoginV2') - } + open(HTML_NEW_TIMELINE($.myUserId)) + // if ($.isWebLogin) { + // navigation.push('WebView', { + // uri: HTML_NEW_TIMELINE($.myUserId), + // title: '添加新时间线' + // }) + // } else { + // navigation.push('LoginV2') + // } }} /> ) diff --git a/stores/system/index.js b/stores/system/index.js index 53e5947af..1309361cc 100644 --- a/stores/system/index.js +++ b/stores/system/index.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-05-17 21:53:14 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-29 17:23:03 + * @Last Modified time: 2019-08-31 00:18:11 */ import { NetInfo } from 'react-native' import { observable, computed } from 'mobx' @@ -91,13 +91,12 @@ class System extends store { const { browser_download_url: downloadUrl } = assets[0] const { name: currentVersion } = this.state.release if (githubVersion !== (currentVersion || GITHUB_RELEASE_VERSION)) { - setTimeout(() => { - info( - IOS - ? '有新版本, iOS版本上线会有延迟, 请关注商店动态' - : '有新版本, 可到设置里下载' - ) - }, 1600) + // iOS不允许提示更新 + if (!IOS) { + setTimeout(() => { + info('有新版本, 可到设置里下载') + }, 1600) + } const release = { name: githubVersion, @@ -207,6 +206,21 @@ class System extends store { this.setStorage(key, undefined, NAMESPACE) } + /** + * 切换`章节热力图` + */ + switchHeatMap = () => { + const { heatMap } = this.setting + const key = 'setting' + this.setState({ + [key]: { + ...this.setting, + heatMap: !heatMap + } + }) + this.setStorage(key, undefined, NAMESPACE) + } + /** * 显示ImageViewer * @param {*} imageUrls Image Source diff --git a/stores/system/init.js b/stores/system/init.js index d83605c51..d5386ffbc 100644 --- a/stores/system/init.js +++ b/stores/system/init.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-07-13 14:00:59 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-25 18:20:34 + * @Last Modified time: 2019-08-31 00:17:21 */ import { GITHUB_RELEASE_VERSION } from '@constants' import { MODEL_SETTING_QUALITY } from '@constants/model' @@ -16,7 +16,8 @@ export const INIT_SETTING = { autoFetch: true, // 切换页面自动请求 speech: true, // Bangumi娘话语 tinygrail: true, // 小圣杯是否开启 - avatarRound: true // 头像是否圆形 + avatarRound: true, // 头像是否圆形 + heatMap: true // 章节热力图 } export const INIT_RELEASE = { diff --git a/styles/index.js b/styles/index.js index 3793c217d..ef8fee6af 100644 --- a/styles/index.js +++ b/styles/index.js @@ -3,7 +3,7 @@ * @Author: czy0729 * @Date: 2019-03-14 06:02:03 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-24 17:52:53 + * @Last Modified time: 2019-08-30 23:51:16 */ import { Dimensions, StyleSheet } from 'react-native' import Constants from 'expo-constants' @@ -47,6 +47,7 @@ export const colorPrimaryBorder = 'rgb(159, 230, 254)' export const colorSuccess = 'rgb(50, 200, 64)' export const colorSuccessLight = 'rgb(236, 255, 236)' export const colorSuccessBorder = 'rgb(115, 241, 115)' +export const colorYellow = 'rgb(255, 202, 40)' export const colorWarning = 'rgb(254, 190, 88)' export const colorWarningLight = 'rgb(255, 248, 238)' export const colorWarningBorder = 'rgb(254, 190, 88)'