Fixed up bugs in reminders that would cause them to go off continually. Version bumped to 3.2.7

pull/14/head 3.2.7
Tim Su 14 years ago
parent e129443c9d
commit 3e57703911

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timsu.astrid" package="com.timsu.astrid"
android:versionName="3.2.6 (bug fixes and ui improvements)" android:versionName="3.2.7 (bug fixes and ui improvements)"
android:versionCode="153"> android:versionCode="154">
<!-- widgets, alarms, and services will break if Astrid is installed on SD card --> <!-- widgets, alarms, and services will break if Astrid is installed on SD card -->
<!-- android:installLocation="internalOnly"> --> <!-- android:installLocation="internalOnly"> -->

@ -136,9 +136,10 @@ public class Notifications extends BroadcastReceiver {
// update last reminder time // update last reminder time
task.setValue(Task.REMINDER_LAST, DateUtilities.now()); task.setValue(Task.REMINDER_LAST, DateUtilities.now());
taskDao.saveExisting(task); boolean saved = taskDao.saveExisting(task);
// schedule next notification // schedule next notification (unless couldn't save last time)
if(saved)
ReminderService.getInstance().scheduleAlarm(task); ReminderService.getInstance().scheduleAlarm(task);
Context context = ContextManager.getContext(); Context context = ContextManager.getContext();

@ -199,7 +199,7 @@ public final class ReminderService {
private long calculateNextOverdueReminder(Task task) { private long calculateNextOverdueReminder(Task task) {
if(task.hasDueDate() && task.getFlag(Task.REMINDER_FLAGS, Task.NOTIFY_AFTER_DEADLINE)) { if(task.hasDueDate() && task.getFlag(Task.REMINDER_FLAGS, Task.NOTIFY_AFTER_DEADLINE)) {
long dueDate = task.getValue(Task.DUE_DATE); long dueDate = task.getValue(Task.DUE_DATE);
long lastReminder = task.getValue(Task.REMINDER_LAST);; long lastReminder = task.getValue(Task.REMINDER_LAST);
if(dueDate > DateUtilities.now()) if(dueDate > DateUtilities.now())
return dueDate + (long)((0.5f + 2f * random.nextFloat()) * DateUtilities.ONE_HOUR); return dueDate + (long)((0.5f + 2f * random.nextFloat()) * DateUtilities.ONE_HOUR);
@ -233,18 +233,26 @@ public final class ReminderService {
long dueDate = task.getValue(Task.DUE_DATE); long dueDate = task.getValue(Task.DUE_DATE);
long lastReminder = task.getValue(Task.REMINDER_LAST);; long lastReminder = task.getValue(Task.REMINDER_LAST);;
if(lastReminder > dueDate) long dueDateAlarm;
return NO_ALARM;
else if(task.hasDueTime()) if(task.hasDueTime())
// return due date straight up // return due date straight up
return dueDate; dueDateAlarm = dueDate;
else { else {
// return notification time on this day // return notification time on this day
Date date = new Date(dueDate); Date date = new Date(dueDate);
date.setHours(Preferences.getIntegerFromString(R.string.p_rmd_time, 12)); date.setHours(Preferences.getIntegerFromString(R.string.p_rmd_time, 12));
date.setMinutes(0); date.setMinutes(0);
return date.getTime(); dueDateAlarm = date.getTime();
} }
if(lastReminder > dueDateAlarm)
return NO_ALARM;
if(dueDate > DateUtilities.now() && dueDateAlarm < DateUtilities.now())
dueDateAlarm = dueDate;
return dueDateAlarm;
} }
return NO_ALARM; return NO_ALARM;
} }

@ -225,10 +225,14 @@ public class TaskDao extends GenericDao<Task> {
* @param skipHooks whether this save occurs as part of a sync * @param skipHooks whether this save occurs as part of a sync
*/ */
private void afterSave(Task task, ContentValues values) { private void afterSave(Task task, ContentValues values) {
if(values != null && values.containsKey(Task.COMPLETION_DATE.name) && task.isCompleted()) if(values != null) {
if(values.containsKey(Task.COMPLETION_DATE.name) && task.isCompleted())
afterComplete(task, values); afterComplete(task, values);
else else if(values.containsKey(Task.DUE_DATE.name) ||
values.containsKey(Task.REMINDER_FLAGS.name) ||
values.containsKey(Task.REMINDER_PERIOD.name))
ReminderService.getInstance().scheduleAlarm(task); ReminderService.getInstance().scheduleAlarm(task);
}
Astrid2TaskProvider.notifyDatabaseModification(); Astrid2TaskProvider.notifyDatabaseModification();
TasksWidget.updateWidgets(ContextManager.getContext()); TasksWidget.updateWidgets(ContextManager.getContext());

@ -16,6 +16,7 @@ import com.todoroo.astrid.dao.Database;
public final class UpgradeService { public final class UpgradeService {
private static final int V3_2_6 = 153;
private static final int V3_2_5 = 152; private static final int V3_2_5 = 152;
private static final int V3_2_4 = 151; private static final int V3_2_4 = 151;
private static final int V3_2_3 = 150; private static final int V3_2_3 = 150;
@ -110,8 +111,12 @@ public final class UpgradeService {
"If you liked the old version, you can also go back by " + "If you liked the old version, you can also go back by " +
"<a href='http://bit.ly/oldastrid'>clicking here</a>", "<a href='http://bit.ly/oldastrid'>clicking here</a>",
}); });
if(from > V3_1_0 && from <= V3_2_6)
newVersionString(changeLog, "3.2.7 (8/25/10)", new String[] {
"Fixed: crazy notifications for overdue tasks! :(",
});
if(from > V3_1_0 && from <= V3_2_5) if(from > V3_1_0 && from <= V3_2_5)
newVersionString(changeLog, "3.2.6 (8/24/10)", new String[] { newVersionString(changeLog, "3.2.7 (8/24/10)", new String[] {
"RTM: fix for login popping up randomly, not syncing priority", "RTM: fix for login popping up randomly, not syncing priority",
"Sync: added a 'Sync Now!' button to the menu, moved options to Settings", "Sync: added a 'Sync Now!' button to the menu, moved options to Settings",
"Improvements to notification code to remind you of missed notifications", "Improvements to notification code to remind you of missed notifications",

Loading…
Cancel
Save