Permalink
Browse files

removed android notification code(not working), marked TODOS

  • Loading branch information...
1 parent e457dd8 commit 4bd485e0771a8709adee2d81814a9924e81256bf ashok committed Jan 19, 2011
Showing with 5 additions and 33 deletions.
  1. +1 −1 Resources/add.js
  2. +3 −32 Resources/edit.js
  3. BIN Resources/iphone/appicon.png
  4. +1 −0 Resources/medicine.js
View
@@ -57,7 +57,7 @@ button.addEventListener('click', function() {
if (!android) {
Titanium.App.iOS.scheduleLocalNotification({
alertAction: 'Take Medicine',
- alertBody: 'Time to take medicine, ' + medicine,
+ alertBody: 'Time to take the medicine ' + medicine,
sound: 'pop.caf',
repeat: 'daily',
date: notify_time
View
@@ -42,11 +42,9 @@ db.close();
button.addEventListener('click', function() {
var medicine = medicine_name.value;
var med_dosage = dosage.value;
- // TODO: INCLUDE A REMIND FIELD IN THE WINDOW
+ // INCLUDE A REMIND FIELD IN THE WINDOW
// AND TAKE THE VALUE FROM THE FIELD
var remind = 1;
- // TODO: INCLUDE A TIME PICKER AND TAKE
- // TIME AND AM_PM VALUE FROM IT
var med_time = hours + ':' + minutes + ':00';
var am_pm = ampm;
var med_stock = stock.value;
@@ -63,6 +61,7 @@ button.addEventListener('click', function() {
db.close();
+ // TODO: UPDATE THE EXISTING LOCAL NOTIFICATIONS OF THE MEDICINE
var notify_time = new Date();
if (am_pm == 'PM') {
if (hours < 12) {hours += 12};
@@ -75,40 +74,12 @@ button.addEventListener('click', function() {
if (!android) {
Ti.App.iOS.scheduleLocalNotification({
alertAction: 'Take Medicine',
- alertBody: 'Time to take medicine, ' + medicine,
+ alertBody: 'Time to take the medicine ' + medicine,
sound: 'pop.caf',
repeat: 'daily',
date: notify_time
});
}
- if (android) {
- // The actions supposedly map 1:1 with the native constants
- var intent = Ti.Android.createIntent({
- action: Ti.Android.ACTION_DIAL,
- data: "tel:55505050"
- });
-
- // This is fairly static: Not much need to be altered here
- var pending = Ti.Android.createPendingIntent({
- activity: Ti.Android.currentActivity,
- intent: intent,
- type: Ti.Android.PENDING_INTENT_FOR_ACTIVITY,
- flags: 1073741824
- });
-
- var notification = Ti.Android.NotificationManager.createNotification({
- contentIntent: pending,
- contentTitle: 'Take medicine',
- contentText: 'Time to take medicine, ' + medicine,
- tickerText: "Tick tock!",
- when: notify_time.getTime()
- });
- Ti.Android.NotificationManager.notify(1, notification);
- }
-
- //var tabGroup = win.getTabGroup();
- //tabGroup.setActiveTab(2);
win.close();
- //Titanium.UI.createAlertDialog({'title': 'MediTracker', 'message': 'all over'}).show();
});
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -106,6 +106,7 @@ win.addEventListener('focus', function(e){
db.execute('DELETE FROM medicine WHERE id = ?', win.pk);
db.execute('DELETE FROM medicine_stock WHERE medicine = ?', win.pk);
db.execute('DELETE FROM medicine_timing WHERE medicine = ?', win.pk);
+ // TODO: REMOVE THE LOCAL NOTIFICATIONS OF THE MEDICINE
db.close();
win.close();
}

0 comments on commit 4bd485e

Please sign in to comment.