diff --git a/ReactNativeClient/lib/components/screen-header.js b/ReactNativeClient/lib/components/screen-header.js
index 678054553..32991398f 100644
--- a/ReactNativeClient/lib/components/screen-header.js
+++ b/ReactNativeClient/lib/components/screen-header.js
@@ -286,10 +286,15 @@ class ScreenHeaderComponent extends Component {
if (!this.props.noteSelectionEnabled) {
for (let i = 0; i < this.props.menuOptions.length; i++) {
let o = this.props.menuOptions[i];
- menuOptionComponents.push(
-
- {o.title}
- );
+
+ if (o.isDivider) {
+ menuOptionComponents.push();
+ } else {
+ menuOptionComponents.push(
+
+ {o.title}
+ );
+ }
}
if (this.props.showAdvancedOptions) {
diff --git a/ReactNativeClient/lib/components/screens/note.js b/ReactNativeClient/lib/components/screens/note.js
index 6a6407012..6e885190a 100644
--- a/ReactNativeClient/lib/components/screens/note.js
+++ b/ReactNativeClient/lib/components/screens/note.js
@@ -384,18 +384,21 @@ class NoteScreenComponent extends BaseScreenComponent {
let canAttachPicture = true;
if (Platform.OS === 'android' && Platform.Version < 21) canAttachPicture = false;
if (canAttachPicture) {
- output.push({ title: _('Attach image'), onPress: () => { this.attachImage_onPress(); } });
- output.push({ title: _('Attach any other file'), onPress: () => { this.attachFile_onPress(); } });
+ output.push({ title: _('Attach photo'), onPress: () => { this.attachImage_onPress(); } });
+ output.push({ title: _('Attach any file'), onPress: () => { this.attachFile_onPress(); } });
+ output.push({ isDivider: true });
}
if (isTodo) {
- output.push({ title: _('Set or clear alarm'), onPress: () => { this.setState({ alarmDialogShown: true }) }});;
+ output.push({ title: _('Set alarm'), onPress: () => { this.setState({ alarmDialogShown: true }) }});;
}
- output.push({ title: _('Delete note'), onPress: () => { this.deleteNote_onPress(); } });
- output.push({ title: isTodo ? _('Convert to regular note') : _('Convert to todo'), onPress: () => { this.toggleIsTodo_onPress(); } });
+ output.push({ title: isTodo ? _('Convert to note') : _('Convert to todo'), onPress: () => { this.toggleIsTodo_onPress(); } });
+ output.push({ isDivider: true });
if (this.props.showAdvancedOptions) output.push({ title: this.state.showNoteMetadata ? _('Hide metadata') : _('Show metadata'), onPress: () => { this.showMetadata_onPress(); } });
- output.push({ title: _('View location on map'), onPress: () => { this.showOnMap_onPress(); } });
+ output.push({ title: _('View on map'), onPress: () => { this.showOnMap_onPress(); } });
+ output.push({ isDivider: true });
+ output.push({ title: _('Delete'), onPress: () => { this.deleteNote_onPress(); } });
return output;
}
diff --git a/ReactNativeClient/lib/models/Alarm.js b/ReactNativeClient/lib/models/Alarm.js
index 505d2399f..b7095c288 100644
--- a/ReactNativeClient/lib/models/Alarm.js
+++ b/ReactNativeClient/lib/models/Alarm.js
@@ -39,6 +39,10 @@ class Alarm extends BaseModel {
return output;
}
+ static async allDue() {
+ return this.modelSelectAll('SELECT * FROM alarms WHERE trigger_time >= ?', [Date.now()]);
+ }
+
}
module.exports = Alarm;
\ No newline at end of file
diff --git a/ReactNativeClient/lib/services/AlarmService.js b/ReactNativeClient/lib/services/AlarmService.js
index f9d2836ba..4817239ca 100644
--- a/ReactNativeClient/lib/services/AlarmService.js
+++ b/ReactNativeClient/lib/services/AlarmService.js
@@ -115,9 +115,6 @@ class AlarmService {
}
}
- // TODO: inner notifications (when app is active)
- // TODO: status to view active notifications
-
}
module.exports = AlarmService;
\ No newline at end of file
diff --git a/ReactNativeClient/lib/services/report.js b/ReactNativeClient/lib/services/report.js
index 8e1f14e42..0b189b651 100644
--- a/ReactNativeClient/lib/services/report.js
+++ b/ReactNativeClient/lib/services/report.js
@@ -1,5 +1,6 @@
const { time } = require('lib/time-utils');
const { BaseItem } = require('lib/models/base-item.js');
+const Alarm = require('lib/models/Alarm');
const { Folder } = require('lib/models/folder.js');
const { Note } = require('lib/models/note.js');
const { _ } = require('lib/locale.js');
@@ -108,10 +109,8 @@ class ReportService {
async status(syncTarget) {
let r = await this.syncStatus(syncTarget);
let sections = [];
- let section = {};
- section.title = _('Sync status (synced items / total items)');
- section.body = [];
+ let section = { title: _('Sync status (synced items / total items)'), body: [] };
for (let n in r.items) {
if (!r.items.hasOwnProperty(n)) continue;
@@ -125,22 +124,31 @@ class ReportService {
sections.push(section);
- section = {};
- section.title = _('Folders');
- section.body = [];
+ section = { title: _('Folders'), body: [] };
- let folders = await Folder.all({
+ const folders = await Folder.all({
order: { by: 'title', dir: 'ASC' },
caseInsensitive: true,
});
for (let i = 0; i < folders.length; i++) {
- let folder = folders[i];
+ const folder = folders[i];
section.body.push(_('%s: %d notes', folders[i].title, await Folder.noteCount(folders[i].id)));
}
sections.push(section);
+ section = { title: _('Coming alarms'), body: [] };
+
+ const alarms = await Alarm.allDue();
+ for (let i = 0; i < alarms.length; i++) {
+ const alarm = alarms[i];
+ const note = await Note.load(alarm.note_id);
+ section.body.push(_('On %s: %s', time.formatMsToLocal(alarm.trigger_time), note.title));
+ }
+
+ sections.push(section);
+
return sections;
}
diff --git a/ReactNativeClient/lib/time-utils.js b/ReactNativeClient/lib/time-utils.js
index 83678fc0d..ac118e8b7 100644
--- a/ReactNativeClient/lib/time-utils.js
+++ b/ReactNativeClient/lib/time-utils.js
@@ -55,7 +55,8 @@ class Time {
return moment.unix(ms / 1000).format('DD/MM/YYYY HH:mm');
}
- formatMsToLocal(ms, format) {
+ formatMsToLocal(ms, format = null) {
+ if (format === null) format = this.dateTimeFormat();
return moment(ms).format(format);
}