You've already forked joplin
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:
@@ -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;
|
||||
Reference in New Issue
Block a user