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

Achievements #57

Closed teodorciuraru closed 8 years ago

teodorciuraru commented 8 years ago

Adds achievements to the app.

Achievements represents titles that the user receives when completing tasks throughout the app.

Classes and Files

AchievementManager

Offers methods like getAchievements(withTag:), unlock(achievement:) checkForDuplicates(), isAchievementUnlocked(achievement:).

Specialized achievement trackers (MedicineAchievementsManager, RapidFireAchievementsManager, GeneralAchievementsManager)

Define and check achievements, overall creating 3 main achievement categories (Pill, Games and General achievements).

In our developers' opinion, only one more manager could be added (MythVsFactManager) at the app's current state. Else, if there are no other games implemented, those 3-4 managers should cover all the achievements that can be invented for this application.

Achievement

Core Data object that defines an achievement for this app.

Some future achievements could support tracking progress (e.g achieving 2 / 5 of the current achievement's task. If needed, the Achievement class will be modified so that it will also track the progress (maybe another property to do this)

AchievementsViewController

Represents a View Controller with a Table View that fetches the achievements from all the three categories (Pills, Games, General) and sets the progress bar depending on the achievement's completition.

Toasts

Cocoapod that allows us to present an Android Toast-like alert when the user triggers and achievement.

Adding achievements

  1. Define the Achievement in the corespondent specialized achievement manager (create a new one if adding achievements for the MythVsFact game or another game).
  2. Implement a check_() method for the achievement in the same manager.
  3. Make sure you can use one of the NSNotificationEvents, if not create a new observer for the class and the trigger method and post the notification in the code where / when needed.
  4. Create unit test for that achievement.

    Additional fix

This PR also adds a LocationTextLabel validation so that a trip could not be generated without a location name.