1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-02-01 19:15:01 +02:00

Mobile: Update time when app is activated

This commit is contained in:
Laurent Cozic 2018-02-07 19:51:58 +00:00
parent 3f14878d0f
commit f91c52cdf7

View File

@ -1,5 +1,5 @@
const React = require('react'); const Component = React.Component;
const { Keyboard, NativeModules, BackHandler } = require('react-native');
const { AppState, Keyboard, NativeModules, BackHandler } = require('react-native');
const { SafeAreaView } = require('react-navigation');
const { connect, Provider } = require('react-redux');
const { BackButtonService } = require('lib/services/back-button.js');
@ -469,6 +469,10 @@ class AppComponent extends React.Component {
this.backButtonHandler_ = () => {
return this.backButtonHandler();
}
this.onAppStateChange_ = () => {
PoorManIntervals.update();
}
}
async componentDidMount() {
@ -493,6 +497,12 @@ class AppComponent extends React.Component {
const notification = await Alarm.makeNotification(alarm);
this.dropdownAlert_.alertWithType('info', notification.title, notification.body ? notification.body : '');
});
AppState.addEventListener('change', this.onAppStateChange_);
}
componentWillUnmount() {
AppState.removeEventListener('change', this.onAppStateChange_);
}
async backButtonHandler() {