forked from vergnet/application-amicale
Remove AF theme and start screen
This commit is contained in:
parent
bd99727c5f
commit
9132668943
5 changed files with 3 additions and 58 deletions
11
App.js
11
App.js
|
@ -12,7 +12,6 @@ import {createStackNavigator} from '@react-navigation/stack';
|
||||||
import DrawerNavigator from './navigation/DrawerNavigator';
|
import DrawerNavigator from './navigation/DrawerNavigator';
|
||||||
import NotificationsManager from "./utils/NotificationsManager";
|
import NotificationsManager from "./utils/NotificationsManager";
|
||||||
import {Provider as PaperProvider} from 'react-native-paper';
|
import {Provider as PaperProvider} from 'react-native-paper';
|
||||||
import AprilFoolsManager from "./utils/AprilFoolsManager";
|
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
|
|
||||||
|
@ -20,7 +19,6 @@ type State = {
|
||||||
isLoading: boolean,
|
isLoading: boolean,
|
||||||
showIntro: boolean,
|
showIntro: boolean,
|
||||||
showUpdate: boolean,
|
showUpdate: boolean,
|
||||||
showAprilFools: boolean,
|
|
||||||
currentTheme: ?Object,
|
currentTheme: ?Object,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,7 +30,6 @@ export default class App extends React.Component<Props, State> {
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
showIntro: true,
|
showIntro: true,
|
||||||
showUpdate: true,
|
showUpdate: true,
|
||||||
showAprilFools: false,
|
|
||||||
currentTheme: null,
|
currentTheme: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -74,11 +71,9 @@ export default class App extends React.Component<Props, State> {
|
||||||
this.setState({
|
this.setState({
|
||||||
showIntro: false,
|
showIntro: false,
|
||||||
showUpdate: false,
|
showUpdate: false,
|
||||||
showAprilFools: false,
|
|
||||||
});
|
});
|
||||||
AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.showIntro.key, '0');
|
AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.showIntro.key, '0');
|
||||||
AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.showUpdate5.key, '0');
|
AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.showUpdate5.key, '0');
|
||||||
AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.showAprilFoolsStart.key, '0');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
|
@ -89,7 +84,7 @@ export default class App extends React.Component<Props, State> {
|
||||||
// Wait for custom fonts to be loaded before showing the app
|
// Wait for custom fonts to be loaded before showing the app
|
||||||
await AsyncStorageManager.getInstance().loadPreferences();
|
await AsyncStorageManager.getInstance().loadPreferences();
|
||||||
ThemeManager.getInstance().setUpdateThemeCallback(this.onUpdateTheme);
|
ThemeManager.getInstance().setUpdateThemeCallback(this.onUpdateTheme);
|
||||||
// await NotificationsManager.initExpoToken();
|
await NotificationsManager.initExpoToken();
|
||||||
this.onLoadFinished();
|
this.onLoadFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +96,6 @@ export default class App extends React.Component<Props, State> {
|
||||||
currentTheme: ThemeManager.getCurrentTheme(),
|
currentTheme: ThemeManager.getCurrentTheme(),
|
||||||
showIntro: AsyncStorageManager.getInstance().preferences.showIntro.current === '1',
|
showIntro: AsyncStorageManager.getInstance().preferences.showIntro.current === '1',
|
||||||
showUpdate: AsyncStorageManager.getInstance().preferences.showUpdate5.current === '1',
|
showUpdate: AsyncStorageManager.getInstance().preferences.showUpdate5.current === '1',
|
||||||
showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled() && AsyncStorageManager.getInstance().preferences.showAprilFoolsStart.current === '1',
|
|
||||||
});
|
});
|
||||||
// Status bar goes dark if set too fast
|
// Status bar goes dark if set too fast
|
||||||
setTimeout(this.setupStatusBar, 1000);
|
setTimeout(this.setupStatusBar, 1000);
|
||||||
|
@ -114,11 +108,10 @@ export default class App extends React.Component<Props, State> {
|
||||||
render() {
|
render() {
|
||||||
if (this.state.isLoading) {
|
if (this.state.isLoading) {
|
||||||
return null;
|
return null;
|
||||||
} else if (this.state.showIntro || this.state.showUpdate || this.state.showAprilFools) {
|
} else if (this.state.showIntro || this.state.showUpdate) {
|
||||||
return <CustomIntroSlider
|
return <CustomIntroSlider
|
||||||
onDone={this.onIntroDone}
|
onDone={this.onIntroDone}
|
||||||
isUpdate={this.state.showUpdate && !this.state.showIntro}
|
isUpdate={this.state.showUpdate && !this.state.showIntro}
|
||||||
isAprilFools={this.state.showAprilFools && !this.state.showIntro}
|
|
||||||
/>;
|
/>;
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -40,14 +40,12 @@ const styles = StyleSheet.create({
|
||||||
type Props = {
|
type Props = {
|
||||||
onDone: Function,
|
onDone: Function,
|
||||||
isUpdate: boolean,
|
isUpdate: boolean,
|
||||||
isAprilFools: boolean,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class CustomIntroSlider extends React.Component<Props> {
|
export default class CustomIntroSlider extends React.Component<Props> {
|
||||||
|
|
||||||
introSlides: Array<Object>;
|
introSlides: Array<Object>;
|
||||||
updateSlides: Array<Object>;
|
updateSlides: Array<Object>;
|
||||||
aprilFoolsSlides: Array<Object>;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
@ -111,15 +109,6 @@ export default class CustomIntroSlider extends React.Component<Props> {
|
||||||
colors: ['#e01928', '#be1522'],
|
colors: ['#e01928', '#be1522'],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
this.aprilFoolsSlides = [
|
|
||||||
{
|
|
||||||
key: '1',
|
|
||||||
title: i18n.t('intro.aprilFoolsSlide.title'),
|
|
||||||
text: i18n.t('intro.aprilFoolsSlide.text'),
|
|
||||||
icon: 'fish',
|
|
||||||
colors: ['#e01928', '#be1522'],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -158,8 +147,6 @@ export default class CustomIntroSlider extends React.Component<Props> {
|
||||||
let slides = this.introSlides;
|
let slides = this.introSlides;
|
||||||
if (this.props.isUpdate)
|
if (this.props.isUpdate)
|
||||||
slides = this.updateSlides;
|
slides = this.updateSlides;
|
||||||
else if (this.props.isAprilFools)
|
|
||||||
slides = this.aprilFoolsSlides;
|
|
||||||
return (
|
return (
|
||||||
<AppIntroSlider
|
<AppIntroSlider
|
||||||
renderItem={CustomIntroSlider.getIntroRenderItem}
|
renderItem={CustomIntroSlider.getIntroRenderItem}
|
||||||
|
|
|
@ -67,7 +67,6 @@ export default class AprilFoolsManager {
|
||||||
washers.splice(4, 1, ninth);
|
washers.splice(4, 1, ninth);
|
||||||
washers.splice(1, 1, first);
|
washers.splice(1, 1, first);
|
||||||
washers.splice(0, 1, fifth);
|
washers.splice(0, 1, fifth);
|
||||||
// washers.push(fifth);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,27 +74,6 @@ export default class AprilFoolsManager {
|
||||||
return AprilFoolsManager.fakeMachineNumber[number];
|
return AprilFoolsManager.fakeMachineNumber[number];
|
||||||
}
|
}
|
||||||
|
|
||||||
static getAprilFoolsTheme(currentTheme: Object) {
|
|
||||||
return {
|
|
||||||
...currentTheme,
|
|
||||||
colors: {
|
|
||||||
...currentTheme.colors,
|
|
||||||
primary: '#00be45',
|
|
||||||
accent: '#00be45',
|
|
||||||
background: '#d02eee',
|
|
||||||
tabIcon: "#380d43",
|
|
||||||
card: "#eed639",
|
|
||||||
surface: "#eed639",
|
|
||||||
dividerBackground: '#c72ce4',
|
|
||||||
textDisabled: '#b9b9b9',
|
|
||||||
|
|
||||||
// Calendar/Agenda
|
|
||||||
agendaBackgroundColor: '#c72ce4',
|
|
||||||
agendaDayTextColor: '#6d6d6d',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
isAprilFoolsEnabled() {
|
isAprilFoolsEnabled() {
|
||||||
return this.aprilFoolsEnabled;
|
return this.aprilFoolsEnabled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,12 +78,7 @@ export default class AsyncStorageManager {
|
||||||
key: 'planexShowBanner',
|
key: 'planexShowBanner',
|
||||||
default: '1',
|
default: '1',
|
||||||
current: '',
|
current: '',
|
||||||
},
|
}
|
||||||
showAprilFoolsStart: {
|
|
||||||
key: 'showAprilFoolsStart',
|
|
||||||
default: '1',
|
|
||||||
current: '',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import AsyncStorageManager from "./AsyncStorageManager";
|
import AsyncStorageManager from "./AsyncStorageManager";
|
||||||
import {DarkTheme, DefaultTheme} from 'react-native-paper';
|
import {DarkTheme, DefaultTheme} from 'react-native-paper';
|
||||||
import AprilFoolsManager from "./AprilFoolsManager";
|
|
||||||
import {Appearance} from 'react-native-appearance';
|
import {Appearance} from 'react-native-appearance';
|
||||||
|
|
||||||
const colorScheme = Appearance.getColorScheme();
|
const colorScheme = Appearance.getColorScheme();
|
||||||
|
@ -123,13 +122,6 @@ export default class ThemeManager {
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
static getCurrentTheme(): Object {
|
static getCurrentTheme(): Object {
|
||||||
if (AprilFoolsManager.getInstance().isAprilFoolsEnabled())
|
|
||||||
return AprilFoolsManager.getAprilFoolsTheme(ThemeManager.getWhiteTheme());
|
|
||||||
else
|
|
||||||
return ThemeManager.getBaseTheme()
|
|
||||||
}
|
|
||||||
|
|
||||||
static getBaseTheme() {
|
|
||||||
if (ThemeManager.getNightMode())
|
if (ThemeManager.getNightMode())
|
||||||
return ThemeManager.getDarkTheme();
|
return ThemeManager.getDarkTheme();
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue