mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Mobile: Added status info to view active alarms
This commit is contained in:
parent
ddb73c8642
commit
d1a83d065a
@ -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(
|
||||
<MenuOption value={o.onPress} key={'menuOption_' + key++} style={this.styles().contextMenuItem}>
|
||||
<Text style={this.styles().contextMenuItemText}>{o.title}</Text>
|
||||
</MenuOption>);
|
||||
|
||||
if (o.isDivider) {
|
||||
menuOptionComponents.push(<View key={'menuOption_' + key++} style={this.styles().divider}/>);
|
||||
} else {
|
||||
menuOptionComponents.push(
|
||||
<MenuOption value={o.onPress} key={'menuOption_' + key++} style={this.styles().contextMenuItem}>
|
||||
<Text style={this.styles().contextMenuItemText}>{o.title}</Text>
|
||||
</MenuOption>);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.props.showAdvancedOptions) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
@ -115,9 +115,6 @@ class AlarmService {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: inner notifications (when app is active)
|
||||
// TODO: status to view active notifications
|
||||
|
||||
}
|
||||
|
||||
module.exports = AlarmService;
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user