1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-07 22:03:09 +02:00

Mobile: Fixes #244: When accessing configuration or encrypt configuration option while making a note and the going back, the note gets erased

This commit is contained in:
Laurent Cozic
2018-02-21 22:08:34 +00:00
parent 14a93a9f26
commit 71aa841265
4 changed files with 59 additions and 25 deletions

View File

@ -0,0 +1,35 @@
class NavService {
static async go(routeName) {
if (this.handlers_.length) {
let r = await this.handlers_[this.handlers_.length - 1]();
if (r) return r;
}
this.dispatch({
type: 'NAV_GO',
routeName: routeName,
});
}
static addHandler(handler) {
for (let i = this.handlers_.length - 1; i >= 0; i--) {
const h = this.handlers_[i];
if (h === handler) return;
}
return this.handlers_.push(handler);
}
static removeHandler(hanlder) {
for (let i = this.handlers_.length - 1; i >= 0; i--) {
const h = this.handlers_[i];
if (h === hanlder) this.handlers_.splice(i, 1);
}
}
}
NavService.handlers_ = [];
module.exports = NavService;