Skip to content
This repository was archived by the owner on Nov 12, 2019. It is now read-only.

Commit ea2d1b9

Browse files
committed
finish night mode
1 parent df76717 commit ea2d1b9

File tree

7 files changed

+73
-38
lines changed

7 files changed

+73
-38
lines changed

android/app/app-release.apk

1.67 KB
Binary file not shown.

android/app/src/main/assets/index.android.bundle

Lines changed: 28 additions & 27 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
����şǩ{k���F��}
1+
T�����g1����i�,l�

js/actions/modifySettings.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export function changeShowThumbnail(value, flag=true) {
3737

3838
export function changeNightMode(value, flag=true) {
3939
if(flag){
40-
40+
let dao = new SettingsDataDAO();
41+
dao.saveOpenNightMode(value);
4142
}
4243

4344
if(value){
@@ -74,6 +75,17 @@ function fetchShowThumbnailValue() {
7475
};
7576
}
7677

78+
function fetchOpenNightModelValue() {
79+
return (dispatch) => {
80+
let dao = new SettingsDataDAO();
81+
dao.getOpenNightModeValue().then((result)=>{
82+
dispatch(changeNightMode(result, false));
83+
}, (error)=>{
84+
dispatch(changeNightMode(error));
85+
});
86+
};
87+
}
88+
7789
function fetchThemeColorValue() {
7890
return (dispatch) => {
7991
let dao = new SettingsDataDAO();
@@ -101,5 +113,6 @@ export function initialSettingsStateFacade() {
101113
dispatch(fetchShowThumbnailValue());
102114
dispatch(fetchThemeColorValue());
103115
dispatch(fetchDisplayOrderValue());
116+
dispatch(fetchOpenNightModelValue());
104117
}
105118
}

js/containers/CollectionTab/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CollectionFragment extends Component{
2828
</ScrollView>
2929
:
3030
<View style={{flex: 1, justifyContent:'center', alignItems: 'center'}}>
31-
<Text>还没有任何收藏数据,找篇文章收藏吧~</Text>
31+
<Text style={{color: this.props.subTitleColor}}>还没有任何收藏数据,找篇文章收藏吧~</Text>
3232
</View>
3333
}
3434
</View>
@@ -40,6 +40,7 @@ const mapStateToProps = (state) => {
4040
return {
4141
dataSource: state.favorData.dataSource,
4242
pageBackgroundColor: state.settingState.colorScheme.pageBackgroundColor,
43+
subTitleColor: state.settingState.colorScheme.subTitleColor,
4344
};
4445
};
4546

js/containers/DiscoveryTab/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class DiscoveryFragment extends Component{
7272
}
7373

7474
_renderHeader(){
75-
const {rowItemBackgroundColor, segmentColor} = this.props;
75+
const {rowItemBackgroundColor, segmentColor, subTitleColor} = this.props;
7676
return(
7777
<View>
7878
<View style={[styles.btnPanel, {backgroundColor: rowItemBackgroundColor, borderBottomColor: segmentColor, borderTopColor: segmentColor}]}>
@@ -97,13 +97,13 @@ class DiscoveryFragment extends Component{
9797
</View>
9898
{this.props.loading ?
9999
<View style={[styles.fakeListViewHeader, {backgroundColor: rowItemBackgroundColor, borderBottomColor: segmentColor, borderTopColor: segmentColor}]}>
100-
<Icon name="md-aperture" color={this.props.arrowColor} size={px2dp(16)}/>
101-
<Text style={{color: this.props.arrowColor, marginLeft: px2dp(5)}}>刷新中...</Text>
100+
<Icon name="md-aperture" color={subTitleColor} size={px2dp(16)}/>
101+
<Text style={{color: subTitleColor, marginLeft: px2dp(5)}}>刷新中...</Text>
102102
</View>
103103
:
104104
<View style={[styles.fakeListViewHeader, {backgroundColor: rowItemBackgroundColor, borderBottomColor: segmentColor, borderTopColor: segmentColor}]}>
105-
<Icon name="md-aperture" color={this.props.arrowColor} size={px2dp(16)}/>
106-
<Text style={{color: this.props.arrowColor, marginLeft: px2dp(5)}}>随机干货</Text>
105+
<Icon name="md-aperture" color={subTitleColor} size={px2dp(16)}/>
106+
<Text style={{color: subTitleColor, marginLeft: px2dp(5)}}>随机干货</Text>
107107
</View>
108108
}
109109
</View>

js/dao/SettingsDataDAO.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
*/
44
'use strict';
55

6-
const SHOW_THUMBNAIL = 'showThumbnail';
7-
const THEME_COLOR = 'themeColor';
8-
const DISPLAY_ORDER = 'displayOrder';
6+
const SHOW_THUMBNAIL = '@ShowThumbnail';
7+
const THEME_COLOR = '@ThemeColor';
8+
const DISPLAY_ORDER = '@DisplayOrder';
9+
const NIGHT_MODE = '@NightMode';
910

1011
import {AsyncStorage} from 'react-native';
1112

@@ -30,6 +31,25 @@ export default class SettingsDataDAO{
3031
});
3132
}
3233

34+
saveOpenNightMode(value){
35+
AsyncStorage.setItem(NIGHT_MODE, value+'');
36+
}
37+
38+
getOpenNightModeValue(){
39+
return new Promise((resolve, reject) => {
40+
AsyncStorage.getItem(NIGHT_MODE, (error, result) => {
41+
if(!error){
42+
if(result === 'true')
43+
resolve(true);
44+
else
45+
resolve(false);
46+
}else{
47+
reject(false);
48+
}
49+
});
50+
});
51+
}
52+
3353
saveThemeColor(color){
3454
AsyncStorage.setItem(THEME_COLOR, color);
3555
}

0 commit comments

Comments
 (0)