systers / malaria-app-ios

A mobile app that will aid the Volunteer in sustaining life-saving malaria prevention tactics over their 2+ years of service.
4 stars 16 forks source link

Add remaining pills mechanism #52

Closed teodorciuraru closed 8 years ago

teodorciuraru commented 8 years ago

Summary: Adds a mechanism through which the users will have to keep track of their medicine in order to use the application and will also help them set reminders for when they remain out of medicine.

User Profile View Controller

A new class that, for the moment, implements only the pill taking mechanism. It allows the user to set a Reminder Time for a specific interval of not having enough pills.

Example: I want to be reminded when I lack pills for more than 4 days.

Moreover, this class is the one responsible with letting the user change his current medicine stock. The user will type in their current available pills and the stock will automatically update (and also the rest of the app's screens).

A label will be presented on the bottom, stating for how long the user still has pills. If the value is lower than the value he set a reminder to track, the label will turn red and a local notification will appear..

Use-case:

The volunteers sets their current medicine stock in the User Profile tab and can start selecting if they did or didn't take their pill from the home screen or from the calendar.

In the calendar, the user still have the possibility to change decisions made for dates in the past (change Take pill into Didn't take), without the need to posses any medicine, because decisions before the Refill Date (the last date he modified his remaining medicine stock) won't affect the current stock.

When the user changes a decision made after the refill date, she will either take her medicine back (if setting I didn't took my pill when she said she took) or the medicine stock will be decremented when confirming pill taking.

Changes

bphenriques commented 8 years ago

Teodor, please provide a more detailed public description of the changes you made (widget, bugfix log, etc) so that this pull request is well documented.

I would ask you to submit smaller pull requests in the future, it's easier for me, for you and for anyone curious who wants to read this pull request.

bphenriques commented 8 years ago

@teo029 Please fix (or discuss with me) the proposed resolutions. I will still analyse it with greater detail this evening. In short, the code looks great however, when you use tuples, please identify what is each position explicitly. You scattered (..).0 on the user tests and it is still not clear to be what represents that value which a identifier would solve. IMO Constants related with view controller should remain in the view controller since they are not used anywhere else and will only impact the view controller it self. When makes sense, use @IBInspectable on those constants. All the remaining we have been discussing.

You told me that you have a new commit that fixes some bugs, just push and the pull-request will be updated automatically.

bphenriques commented 8 years ago

"[!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice."

Remove the smart quote (avoid using textedit that automatically does that).

bphenriques commented 8 years ago

I am having a error when clicking the user profile:

cell.UpdateCell(...) on indexPath. EXC_BAD_ACCESS

Log:

2016-06-26 11:09:14.302 malaria-ios[3122:31814] [Crashlytics] Version 3.7.2 (112)
[WARN] - UserSettingsManager::getBool::41   ClearMedicineHistory isn't set, setting and returning default value false
[WARN] - UserSettingsManager::getBool::41   ClearTripHistory isn't set, setting and returning default value false
[INFO] - DidTakePillsViewController::refreshScreen()::97    Refreshing TOOK PILL
[INFO] - DidTakePillsViewController::refreshScreen()::97    Refreshing TOOK PILL
[WARN] - UserSettingsManager::getBool::41   DidConfiguredMedicine isn't set, setting and returning default value false
[INFO] - DidTakePillsViewController::refreshScreen()::97    Refreshing TOOK PILL
[ERRO] - MedicineManager::setCurrentPill::69    No current pill found!
[INFO] - MedicineManager::setCurrentPill::72    Setting Doxycycline as default
[WARN] - MedicineStockManager::hasEnoughPills()::60     User doesn't have enough pills to add an entry.
[INFO] - DidTakePillsViewController::refreshScreen()::97    Refreshing TOOK PILL
[INFO] - DidTakePillsViewController::refreshScreen()::125   No information
[WARN] - MedicineStockManager::hasEnoughPills()::60     User doesn't have enough pills to add an entry.
[WARN] - UserSettingsManager::getBool::41   MedicineReminderSwitch isn't set, setting and returning default value true
[WARN] - UserSettingsManager::getLocalNotifications::86     SaveLocalNotifications isn't set, setting and returning default value <>
2016-06-26 11:09:36.069 malaria-ios[3122:31814] *** -[NSKeyedUnarchiver initForReadingWithData:]: data is empty; did you forget to send -finishEncoding to the NSKeyedArchiver?
[INFO] - NotificationManager::scheduleNotification::27  Sheduling PILL_REMINDER to 26-June-2016 11:09
[INFO] - DidTakePillsViewController::refreshScreen()::97    Refreshing TOOK PILL
[INFO] - DidTakePillsViewController::refreshScreen()::125   No information
[WARN] - MedicineStockManager::hasEnoughPills()::60     User doesn't have enough pills to add an entry.
[WARN] - UserSettingsManager::getString::64     PillReminderValue isn't set, setting and returning default value 
[INFO] - NotificationManager::scheduleNotification::27  Sheduling PillStatusReminder to 26-June-2016 11:09
(lldb) 
bphenriques commented 8 years ago

Now that I notice, you a have this error:

2016-06-26 11:09:36.069 malaria-ios[3122:31814] *** -[NSKeyedUnarchiver initForReadingWithData:]: data is empty; did you forget to send -finishEncoding to the NSKeyedArchiver?

I will resume the testing until I the current issues are solved

bphenriques commented 8 years ago

The icon on iPhone 6s plus is distorted horizontally.

bphenriques commented 8 years ago

The icon looks great now.

I would just add:

  1. Fix the NSDate extensions: NSDate() + 1.day NSDate() - 1.day
  2. Remove unused variables (in unit tests)
  3. Add green view behind the "1 week" and change the color of textField to green as well to conform to the general theme.