diff --git a/ReactNativeClient/lib/BaseApplication.js b/ReactNativeClient/lib/BaseApplication.js index 39bc751f7..3f63b232f 100644 --- a/ReactNativeClient/lib/BaseApplication.js +++ b/ReactNativeClient/lib/BaseApplication.js @@ -567,6 +567,8 @@ class BaseApplication { this.database_.setLogger(this.dbLogger_); await this.database_.open({ name: profileDir + '/database.sqlite' }); + // if (Setting.value('env') === 'dev') await this.database_.clearForTesting(); + reg.setDb(this.database_); BaseModel.db_ = this.database_; diff --git a/ReactNativeClient/lib/MdToHtml/noteStyle.js b/ReactNativeClient/lib/MdToHtml/noteStyle.js index 9eecb3d90..b0981565a 100644 --- a/ReactNativeClient/lib/MdToHtml/noteStyle.js +++ b/ReactNativeClient/lib/MdToHtml/noteStyle.js @@ -167,6 +167,10 @@ module.exports = function(style, options) { .not-loaded-resource img { width: 1.15em; height: 1.15em; + background: white; + padding: 2px !important; + border-radius: 2px; + box-shadow: 0 1px 3px #000000aa; } a.not-loaded-resource img { diff --git a/ReactNativeClient/lib/components/screens/config.js b/ReactNativeClient/lib/components/screens/config.js index 848c07d1d..015763961 100644 --- a/ReactNativeClient/lib/components/screens/config.js +++ b/ReactNativeClient/lib/components/screens/config.js @@ -66,12 +66,21 @@ class ConfigScreenComponent extends BaseScreenComponent { color: theme.color, fontSize: theme.fontSize, flex: 1, + paddingRight: 5, }, descriptionText: { color: theme.color, fontSize: theme.fontSize, flex: 1, }, + settingDescriptionText: { + color: theme.color, + fontSize: theme.fontSize, + flex: 1, + paddingLeft: theme.marginLeft, + paddingRight: theme.marginRight, + paddingBottom: theme.marginBottom, + }, permissionText: { color: theme.color, fontSize: theme.fontSize, @@ -84,10 +93,13 @@ class ConfigScreenComponent extends BaseScreenComponent { }, } - // if (Platform.OS === 'ios') { - styles.settingControl.borderBottomWidth = 1; - styles.settingControl.borderBottomColor = theme.strongDividerColor; - // } + styles.settingContainerNoBottomBorder = Object.assign({}, styles.settingContainer, { + borderBottomWidth: 0, + paddingBottom: theme.marginBottom / 2, + }); + + styles.settingControl.borderBottomWidth = 1; + styles.settingControl.borderBottomColor = theme.strongDividerColor; styles.switchSettingText = Object.assign({}, styles.settingText); styles.switchSettingText.width = '80%'; @@ -121,6 +133,7 @@ class ConfigScreenComponent extends BaseScreenComponent { } const md = Setting.settingMetadata(key); + const settingDescription = md.description ? md.description() : ''; if (md.isEnum) { value = value.toString(); @@ -132,27 +145,33 @@ class ConfigScreenComponent extends BaseScreenComponent { items.push({ label: settingOptions[k], value: k.toString() }); } + const descriptionComp = !settingDescription ? null : {settingDescription} + const containerStyle = !settingDescription ? this.styles().settingContainer : this.styles().settingContainerNoBottomBorder; + return ( - - {md.label()} - { updateSettingValue(key, itemValue); }} - /> + + + {md.label()} + { updateSettingValue(key, itemValue); }} + /> + + {descriptionComp} ); } else if (md.type == Setting.TYPE_BOOL) { diff --git a/ReactNativeClient/lib/joplin-database.js b/ReactNativeClient/lib/joplin-database.js index c66eaaa68..498b4441f 100644 --- a/ReactNativeClient/lib/joplin-database.js +++ b/ReactNativeClient/lib/joplin-database.js @@ -162,6 +162,35 @@ class JoplinDatabase extends Database { return output; } + async clearForTesting() { + const tableNames = [ + 'notes', + 'folders', + 'resources', + 'tags', + 'note_tags', + // 'master_keys', + 'item_changes', + 'note_resources', + // 'settings', + 'deleted_items', + 'sync_items', + 'notes_normalized', + 'revisions', + 'resources_to_download', + ]; + + const queries = []; + for (const n of tableNames) { + queries.push('DELETE FROM ' + n); + queries.push('DELETE FROM sqlite_sequence WHERE name="' + n + '"'); // Reset autoincremented IDs + } + + queries.push('DELETE FROM settings WHERE key="sync.7.context"'); + + await this.transactionExecBatch(queries); + } + createDefaultRow(tableName) { const row = {}; const fields = this.tableFields('resource_local_states'); diff --git a/ReactNativeClient/root.js b/ReactNativeClient/root.js index c02e35abc..8fb111dde 100644 --- a/ReactNativeClient/root.js +++ b/ReactNativeClient/root.js @@ -410,32 +410,7 @@ async function initialize(dispatch) { } else { await db.open({ name: 'joplin-68.sqlite' }); - const tableNames = [ - 'notes', - 'folders', - 'resources', - 'tags', - 'note_tags', - // 'master_keys', - 'item_changes', - 'note_resources', - // 'settings', - 'deleted_items', - 'sync_items', - 'notes_normalized', - 'revisions', - 'resources_to_download', - ]; - - const queries = []; - for (const n of tableNames) { - queries.push('DELETE FROM ' + n); - queries.push('DELETE FROM sqlite_sequence WHERE name="' + n + '"'); // Reset autoincremented IDs - } - - queries.push('DELETE FROM settings WHERE key="sync.7.context"'); - - // await db.transactionExecBatch(queries); + // await db.clearForTesting(); } reg.logger().info('Database is ready.');