1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Mobile: Resolves #360: Don't crash if theme not set and improved logging.

This commit is contained in:
Laurent Cozic 2018-04-16 15:15:29 +02:00
parent be8bda8e73
commit 4d0af575e5
2 changed files with 14 additions and 2 deletions

View File

@ -100,7 +100,10 @@ function addExtraStyles(style) {
}
function themeStyle(theme) {
if (!theme) throw new Error('Theme not set');
if (!theme) {
console.warn('Theme not set!! Defaulting to Light theme');
theme = Setting.THEME_LIGHT;
}
if (themeCache_[theme]) return themeCache_[theme];

View File

@ -72,8 +72,17 @@ const EncryptionService = require('lib/services/EncryptionService');
let storeDispatch = function(action) {};
const logReducerAction = function(action) {
if (['SIDE_MENU_OPEN_PERCENT', 'SYNC_REPORT_UPDATE'].indexOf(action.type) >= 0) return;
let msg = [action.type];
if (action.routeName) msg.push(action.routeName);
reg.logger().info('Reducer action', msg.join(', '));
}
const generalMiddleware = store => next => async (action) => {
if (['SIDE_MENU_OPEN_PERCENT', 'SYNC_REPORT_UPDATE'].indexOf(action.type) < 0) reg.logger().info('Reducer action', action.type);
logReducerAction(action);
PoorManIntervals.update(); // This function needs to be called regularly so put it here
const result = next(action);