Skip to content

Commit 61fa897

Browse files
committed
no message
1 parent 08935bc commit 61fa897

File tree

21 files changed

+1433
-1542
lines changed

21 files changed

+1433
-1542
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,23 @@
22
package="com.shitu">
33

44
<uses-permission android:name="android.permission.INTERNET" />
5+
<uses-permission android:name="android.permission.CAMERA" />
6+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
7+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
8+
9+
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
10+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
11+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
12+
<uses-permission android:name="android.permission.READ_LOGS"/>
13+
514

615
<application
716
android:name=".MainApplication"
817
android:label="@string/app_name"
918
android:icon="@mipmap/ic_launcher"
1019
android:roundIcon="@mipmap/ic_launcher_round"
1120
android:allowBackup="false"
21+
android:largeHeap="true"
1222
android:theme="@style/AppTheme">
1323
<activity
1424
android:name=".MainActivity"
@@ -18,6 +28,7 @@
1828
<intent-filter>
1929
<action android:name="android.intent.action.MAIN" />
2030
<category android:name="android.intent.category.LAUNCHER" />
31+
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
2132
</intent-filter>
2233
</activity>
2334
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />

app/components/CustomToast/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import React from 'react';
77
import { StyleSheet, Text, View, Image, ActivityIndicator } from 'react-native';
88

99
type Props = {
10-
style: any
10+
style?: any
1111
};
1212
const CustomToast = (props: Props) => {
1313
const { style } = props;

app/components/PopoverItems/PopoverActionSheetItem.js

Lines changed: 69 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,30 @@
44
*/
55

66
import React, { Component } from 'react';
7-
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
7+
import { View, Text, TouchableOpacity } from 'react-native';
88

99
import Theme from 'teaset/themes/Theme';
10+
import PropTypes from 'prop-types';
1011

1112
type Props = {
1213
type: 'default' | 'cancel',
1314
title: string,
1415
topSeparator: 'none' | 'full' | 'indent',
1516
bottomSeparator: 'none' | 'full' | 'indent',
1617
disabled: boolean,
17-
...TouchableOpacity
18+
...TouchableOpacity.propTypes
1819
};
1920

2021
export default class ActionSheetItem extends Component<Props> {
22+
static propTypes = {
23+
...TouchableOpacity.propTypes,
24+
type: PropTypes.oneOf(['default', 'cancel']),
25+
title: PropTypes.oneOfType([PropTypes.element, PropTypes.string, PropTypes.number]),
26+
topSeparator: PropTypes.oneOfType([PropTypes.element, PropTypes.oneOf(['none', 'full', 'indent'])]),
27+
bottomSeparator: PropTypes.oneOfType([PropTypes.element, PropTypes.oneOf(['none', 'full', 'indent'])]),
28+
disabled: PropTypes.bool
29+
};
30+
2131
static defaultProps = {
2232
...TouchableOpacity.defaultProps,
2333
type: 'default',
@@ -26,11 +36,9 @@ export default class ActionSheetItem extends Component<Props> {
2636
disabled: false
2737
};
2838

29-
buildProps() {
30-
let { style, title, topSeparator, bottomSeparator, activeOpacity, ...others } = this.props;
31-
32-
const { type, disabled, onPress } = this.props;
33-
39+
buildStyle() {
40+
let { style } = this.props;
41+
const { type } = this.props;
3442
style = [
3543
{
3644
backgroundColor: type === 'cancel' ? Theme.asCancelItemColor : Theme.asItemColor,
@@ -43,105 +51,92 @@ export default class ActionSheetItem extends Component<Props> {
4351
justifyContent: 'center'
4452
}
4553
].concat(style);
54+
return style;
55+
}
4656

47-
let textStyle, separatorStyle;
57+
renderSeparator(separator) {
58+
const { type } = this.props;
59+
60+
const indentViewStyle = {
61+
backgroundColor: 'rgba(0,0,0,0)',
62+
paddingLeft: Theme.asItemPaddingLeft
63+
};
64+
let separatorStyle;
4865
if (type === 'cancel') {
49-
textStyle = {
50-
backgroundColor: 'rgba(0, 0, 0, 0)',
51-
color: 'red',
52-
fontSize: Theme.asCancelItemFontSize,
53-
textAlign: Theme.asCancelItemTitleAlign,
54-
opacity: disabled ? Theme.asItemDisabledOpacity : 1,
55-
overflow: 'hidden'
56-
};
5766
separatorStyle = {
5867
backgroundColor: Theme.asCancelItemSeparatorColor,
5968
height: Theme.asCancelItemSeparatorLineWidth
6069
};
6170
} else {
62-
textStyle = {
63-
backgroundColor: 'rgba(0, 0, 0, 0)',
64-
color: Theme.asItemTitleColor,
65-
fontSize: Theme.asItemFontSize,
66-
textAlign: Theme.asItemTitleAlign,
67-
opacity: disabled ? Theme.asItemDisabledOpacity : 1,
68-
overflow: 'hidden'
69-
};
7071
separatorStyle = {
7172
backgroundColor: Theme.asItemSeparatorColor,
7273
height: Theme.asItemSeparatorLineWidth
7374
};
7475
}
75-
76-
if ((title || title === '' || title === 0) && !React.isValidElement(title)) {
77-
title = (
78-
<Text style={textStyle} numberOfLines={1}>
79-
{title}
80-
</Text>
81-
);
82-
}
83-
84-
const indentViewStyle = {
85-
backgroundColor: StyleSheet.flatten(style).backgroundColor,
86-
paddingLeft: Theme.asItemPaddingLeft
87-
};
88-
switch (topSeparator) {
89-
case 'none':
90-
topSeparator = null;
91-
break;
92-
case 'full':
93-
topSeparator = <View style={separatorStyle} />;
94-
break;
95-
case 'indent':
96-
topSeparator = (
97-
<View style={indentViewStyle}>
98-
<View style={separatorStyle} />
99-
</View>
100-
);
101-
break;
102-
}
103-
switch (bottomSeparator) {
104-
case 'none':
105-
bottomSeparator = null;
106-
break;
76+
switch (separator) {
10777
case 'full':
108-
bottomSeparator = <View style={separatorStyle} />;
109-
break;
78+
return <View style={separatorStyle} />;
11079
case 'indent':
111-
bottomSeparator = (
80+
return (
11281
<View style={indentViewStyle}>
11382
<View style={separatorStyle} />
11483
</View>
11584
);
116-
break;
85+
default:
86+
return null;
11787
}
88+
}
11889

119-
if (disabled) activeOpacity = 1;
90+
renderTitle() {
91+
const { type, title, disabled } = this.props;
92+
if (title === null || title === undefined || React.isValidElement(title)) return title;
12093

121-
this.props = {
94+
let textStyle;
95+
if (type === 'cancel') {
96+
textStyle = {
97+
backgroundColor: 'rgba(0, 0, 0, 0)',
98+
color: Theme.asCancelItemTitleColor,
99+
fontSize: Theme.asCancelItemFontSize,
100+
textAlign: Theme.asCancelItemTitleAlign,
101+
opacity: disabled ? Theme.asItemDisabledOpacity : 1,
102+
overflow: 'hidden'
103+
};
104+
} else {
105+
textStyle = {
106+
backgroundColor: 'rgba(0, 0, 0, 0)',
107+
color: Theme.asItemTitleColor,
108+
fontSize: Theme.asItemFontSize,
109+
textAlign: Theme.asItemTitleAlign,
110+
opacity: disabled ? Theme.asItemDisabledOpacity : 1,
111+
overflow: 'hidden'
112+
};
113+
}
114+
return (
115+
<Text style={textStyle} numberOfLines={1}>
116+
{title}
117+
</Text>
118+
);
119+
}
120+
121+
render() {
122+
const {
122123
style,
124+
children,
123125
type,
124126
title,
125127
topSeparator,
126128
bottomSeparator,
127129
disabled,
128130
activeOpacity,
129-
onPress,
130131
...others
131-
};
132-
}
133-
134-
render() {
135-
this.buildProps();
136-
137-
const { style, title, topSeparator, bottomSeparator, ...others } = this.props;
132+
} = this.props;
138133
return (
139134
<View style={{ backgroundColor: 'rgba(0, 0, 0, 0)' }}>
140-
{topSeparator}
141-
<TouchableOpacity style={style} {...others}>
142-
{title}
135+
{this.renderSeparator(topSeparator)}
136+
<TouchableOpacity style={this.buildStyle()} activeOpacity={disabled ? 1 : activeOpacity} {...others}>
137+
{this.renderTitle()}
143138
</TouchableOpacity>
144-
{bottomSeparator}
139+
{this.renderSeparator(bottomSeparator)}
145140
</View>
146141
);
147142
}

app/components/TableList/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export default class index<ItemT> extends React.Component<Props<ItemT>, State<It
152152
value: ?number | ?string;
153153
// _flatList: ?React.ElementRef<any> = null;
154154

155-
_flatList: null | VirtualizedList | ScrollView;
155+
_flatList: any;
156156

157157
constructor(props: Props<ItemT>) {
158158
super(props);

app/components/Toast/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type Props = {
2121
positionValue: number | any,
2222
fadeInDuration?: number,
2323
fadeOutDuration?: number,
24-
opacity?: number,
24+
opacity?: any | ?number,
2525
defaultCloseDelay?: number
2626
};
2727

app/components/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import LoadingSpinner from './LoadingSpinner';
1919
import MyTextInput from './MyTextInput';
2020
import CustomToast from './CustomToast';
2121
import ErrorView from './ErrorView';
22-
// import PopoverActionSheetItem from './PopoverItems/PopoverActionSheetItem';
22+
import PopoverActionSheetItem from './PopoverItems/PopoverActionSheetItem';
2323
// import PopoverPickerViewItem from './PopoverItems/PopoverPickerViewItem';
2424

2525
export {
@@ -37,6 +37,6 @@ export {
3737
MyTextInput,
3838
CustomToast,
3939
ErrorView,
40-
// PopoverActionSheetItem,
40+
PopoverActionSheetItem,
4141
// PopoverPickerViewItem
4242
};

app/mobx/News/BuDeJieMobx.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const MAX_SCREEN_IMAGE_HEIGHT = 7000;
2222
/*
2323
* 顶部UserInfo的高度, px2dp(100)为整体预估高度, px2dp(10)为距离顶部的margin高度
2424
*/
25-
const USER_INFO_HEIGHT = px2dp(100) + px2dp(10);
25+
const USER_INFO_HEIGHT = px2dp(100);
2626

2727
/**
2828
* 文字有marginVertical: px2dp(10)属性
@@ -33,13 +33,16 @@ const JOKE_SPACE_HEIGHT = px2dp(20);
3333
* px2dp(20) 为底部间距高度
3434
*/
3535
const ITEM_HEIGHT_SPACE_HEIGHT = px2dp(10) + JOKE_SPACE_HEIGHT;
36+
// const ITEM_HEIGHT_SPACE_HEIGHT = JOKE_SPACE_HEIGHT;
3637

3738
const DEFAULT_SPACE_HEIGHT = 10;
3839
const DEFAULT_TAB_BAR_HEIGHT = 49;
3940
const DEFAULT_SCROLL_TOP_BAR_HEIGHT = 54;
4041

4142
const JOKE_ITEM_WIDTH = SCREEN_WIDTH - px2dp(40);
42-
const JOKE_FONT_SIZE = FONT_SIZE(17);
43+
// const JOKE_ITEM_WIDTH = SCREEN_WIDTH ;
44+
// const JOKE_FONT_SIZE = FONT_SIZE(17);
45+
const JOKE_FONT_SIZE = 17;
4346

4447
class BuDeJieMobx extends ConfigStore {
4548
static async handleJokeTextWidth(text: string) {
@@ -48,7 +51,7 @@ class BuDeJieMobx extends ConfigStore {
4851
width: JOKE_ITEM_WIDTH,
4952
fontSize: JOKE_FONT_SIZE,
5053
fontWeight: 'normal',
51-
fontFamily: Android ? 'normal' : 'Heiti SC',
54+
fontFamily: Android ? 'normal' : 'Heiti SC'
5255
});
5356
console.log('heights', heights);
5457
return parseFloat(heights.join());
@@ -87,6 +90,9 @@ class BuDeJieMobx extends ConfigStore {
8790
const JokeHeight = await BuDeJieMobx.handleJokeTextWidth(item.text);
8891
const ImageHeight = item?.imageHeight ? item.imageHeight : 0;
8992
item.itemHeight = USER_INFO_HEIGHT + JokeHeight + ImageHeight + ITEM_HEIGHT_SPACE_HEIGHT;
93+
// item.itemHeight = JokeHeight + ImageHeight + ITEM_HEIGHT_SPACE_HEIGHT;
94+
95+
console.log('itemHeight', item.itemHeight);
9096

9197
const {
9298
text,
@@ -157,27 +163,19 @@ class BuDeJieMobx extends ConfigStore {
157163
*/
158164
@action.bound
159165
async fetchBuDeJieData(type: RTBuDeJieType, value: string) {
160-
console.log('value', type, value);
161166
try {
162167
const buDeJieData: RTBDJResult = await loadBuDeJieData(type, value);
163168

164-
console.log('data', buDeJieData);
165-
166-
167169
const { largeListData, dataSource } = await BuDeJieMobx.handleLargeListData(buDeJieData.list, type);
168170

169-
console.log('largeListData', largeListData);
170171

171172
if (value === '') {
172-
console.log('第一次加载?value', value);
173173
runInAction(() => {
174174
this.dataSource = dataSource;
175175
this.largeListData = [largeListData];
176176
this.maxtime = buDeJieData.info.maxid;
177177
});
178178
} else {
179-
console.log('加载更多?value', value);
180-
console.log('largeListData-----', this.largeListData[0].items);
181179
runInAction(() => {
182180
this.dataSource = this.dataSource.concat(dataSource);
183181
this.largeListData = this.largeListData.concat([largeListData]);
@@ -187,7 +185,7 @@ class BuDeJieMobx extends ConfigStore {
187185

188186
console.log('this.largeListData.slice', this.largeListData.slice());
189187
} catch (e) {
190-
this.showErrorView(e);
188+
this.showErrorView(e.message);
191189
console.log('e', e.message);
192190
}
193191
}

app/mobx/News/WelfareMobx.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ class WelfareMobx extends ConfigStore {
4545

4646
try {
4747
// 下载图片
48-
await FetchBlob.config(config)
49-
.fetch('GET', url)
50-
.then(() => FetchBlob.fs.scanFile([{ path: Dirs.DCIMDir + imageName }]));
48+
await FetchBlob.config(config).fetch('GET', url);
49+
FetchBlob.fs.scanFile([{ path: Dirs.DCIMDir + imageName, mime: '' }])
5150
alert('保存成功');
5251
} catch (e) {
5352
console.log(e);
@@ -83,7 +82,6 @@ class WelfareMobx extends ConfigStore {
8382
});
8483
} else {
8584
runInAction(() => {
86-
8785
this.page = 1;
8886
this.dataSource = results;
8987
});

0 commit comments

Comments
 (0)