Patch Calendar Notification Repeat

From WebOS Internals
Jump to navigation Jump to search


Introduction

The following assumes that you have experience applying modifications.

This modification will cause the Calendar reminder notifications to be repeated every 2 minutes until they are either dismissed or snoozed.

Editing Process

Edit

/usr/palm/applications/com.palm.app.calendar/app/controllers/app-assistant.js

Find

handleLaunch: function

Within this function find

else if (launchParams.alarmclose){
	this.closeReminder(launchParams.alarmclose);
}

Add the following immediatley after the above code

else if (launchParams.playalarmsound){
	this.playAlarmSound();
}

Find the following funcition

closeReminder: function

After this function add the following function

playAlarmSound: function() {
	if (this.openReminderAlert) {
		this.openReminderAlert.playAlarmSound();
		this.openReminderAlert = null;
	}
},


Edit

/usr/palm/applications/com.palm.app.calendar/app/controllers/reminder-assistant.js

Find

cleanup: function

Add the following line to the end of this function

//remove the Notification repeat task
this.removePlayAlarmSoundTask();

Find

updateMostRecentReminder: function

Add the follwoing lines to the end of this function

//setup the notification repeat task
this.schedulePlayAlarmSoundTask();

Find

autoCloseAlert: Function

Add the following function after it

playAlarmSound: function() {
	//temporarily set the snooze to 0 will immediately re-trigger allert to get our attention.
	this.dismissed = false;
	this.DEFAULT_SNOOZE = 0;
	this.closeAlert();
},

Find

removeAutoCloseTask: function

Add the following two functions after it

schedulePlayAlarmSoundTask: function() {
	//retrigger reminder every two minutes until we acknowledge it.
	//change the value in addMinutes to a value other than 2 if you prefer a different time span for the notification repeat.
	//ultimatly it would be best to add this to the preferences page.
	var playSoundTime = new Date().addMinutes(2);
	this.controller.serviceRequest('palm://com.palm.taskScheduler', {
		method: 'updateTask',
		parameters: {uri: 'palm://com.palm.applicationManager/open',
		arguments: {'id': 'com.palm.app.calendar',
				'params': {'playalarmsound': 'true'}},
		key: 'calendar-playalarmsound',
		start: {date: playSoundTime.toUTCString()}}
		});
},
	
removePlayAlarmSoundTask: function() {
	this.controller.serviceRequest('palm://com.palm.taskScheduler', {
		method: 'removeTask',
		parameters: {key: 'calendar-playalarmsound'}
		});
},