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

iOS: Handle foreground notifications

This commit is contained in:
Laurent Cozic
2017-11-28 20:17:34 +00:00
parent c446e4471d
commit 4df73cd82c
6 changed files with 68 additions and 808 deletions

View File

@@ -1,4 +1,5 @@
const { BaseModel } = require('lib/base-model.js');
const { Note } = require('lib/models/note.js');
class Alarm extends BaseModel {
@@ -24,6 +25,20 @@ class Alarm extends BaseModel {
return alarms.map((a) => { return a.id });
}
static async makeNotification(alarm, note = null) {
if (!note) note = await Note.load(alarm.note_id);
const output = {
id: alarm.id,
date: new Date(note.todo_due),
title: note.title.substr(0,128),
};
if (note.body) output.body = note.body.substr(0,512);
return output;
}
}
module.exports = Alarm;