a3f83b9076
* add tests for beastMaster, mountMaster, and triadBingo achievements * add tests for challengeWon, streak, ultimateGear, rebirth, and contributor achievements * add achievement service that has openModal function * achievement test pass again * fix indentation, rename openModal to more descriptive displayAchievement * add unit tests for achievements service * initialize user.preferences.suppressModals in specHelper.newUser * update achievement tests to account for new notification service * add new achievementServices file to manifest.json * fix tests * award wonChallenge achiev like other achievs * differentiate between small and normal achiev modals * refactor achievementService.displayAchievement() to take options param
29 lines
611 B
JavaScript
29 lines
611 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Services that handle achievement logic.
|
|
*/
|
|
|
|
angular.module('habitrpg').factory('Achievement',
|
|
['$rootScope', function($rootScope) {
|
|
var sizes = ['sm', 'md', 'lg'];
|
|
var DEFAULT_SIZE = 'sm';
|
|
|
|
function displayAchievement(achievementName, options) {
|
|
options = options || {};
|
|
|
|
if (options.size && sizes.indexOf(options.size) === -1) {
|
|
delete options.size;
|
|
}
|
|
|
|
$rootScope.openModal('achievements/' + achievementName, {
|
|
controller: 'UserCtrl',
|
|
size: options.size || DEFAULT_SIZE
|
|
});
|
|
}
|
|
|
|
return {
|
|
displayAchievement: displayAchievement
|
|
};
|
|
}]);
|