Captainup  2.4
Instance Methods | Properties | List of all members
<CPTBadge> Protocol Reference
Inheritance diagram for <CPTBadge>:
<CPTObject>

Instance Methods

(BOOL) - hasReward
 
(nullable id< CPTReward >) - getReward
 
(BOOL) - isSegmentedForUser:
 
- Instance Methods inherited from <CPTObject>
(nonnull instancetype) - initWithDictionary:
 
(nonnull NSDictionary< NSString *, id > *) - toDictionary
 

Properties

NSString * badgeId
 
BOOL isActive
 
NSString * name
 
NSString * badgeDescription
 
BOOL isHidden
 
BOOL isVisible
 
CPTPoint points
 
NSInteger weight
 
NSDictionary< NSString *, id > * customData
 
NSString * imageURL
 
id< CPTImageFilesimageFiles
 
NSArray< id< CPTCondition > > * conditions
 
NSArray< id< CPTReward > > * rewards
 
BOOL repeatable
 
NSDictionary< NSString *, NSNumber * > * currencies
 
BOOL isSegmented
 
- Properties inherited from <CPTObject>
NSDictionary< NSString *, id > * sourceDictionary
 

Detailed Description

Method Documentation

◆ getReward()

- (nullable id<CPTReward>) getReward

Get badge reward

Returns
return CPTRward object or null if badge do not have any reward

◆ hasReward()

- (BOOL) hasReward

if Badge object has any Reward

Returns
return is badge have reward or not

◆ isSegmentedForUser:()

- (BOOL) isSegmentedForUser: (nonnull id< CPTUser >)  user

Use this function to know if a badge should be displayed for your specific user For example: badge.isSegmentedForUser(CaptainUp.getLoggedInUser())

Parameters
userCPTUser object
Returns
return Bool is segmemted for user or not

Property Documentation

◆ badgeDescription

- (NSString*) badgeDescription
readnonatomicassign

The badge description

◆ badgeId

- (NSString*) badgeId
readnonatomicassign

The badge ID

◆ conditions

- (NSArray<id<CPTCondition> >*) conditions
readnonatomicassign

A list of all the badge conditions for achievment

◆ currencies

- (NSDictionary<NSString*,NSNumber*>*) currencies
readnonatomicassign

Get the currencies awarded when achieving this badge. For example: badge.getCurrencies().get("points") will return the amount of points awarded when completing the badge's conditions

Returns
A map where key is the currency name and value is the awarded currency amount

◆ customData

- (NSDictionary<NSString*,id>*) customData
readnonatomicassign

The badge's custom data. A dictionary between the key (always NSString) to the data (NSString, NSNumber or NSArray)

◆ imageFiles

- (id<CPTImageFiles>) imageFiles
readnonatomicassign

Details on the badge's image files

Returns
the details of the badge's image files

◆ imageURL

- (NSString*) imageURL
readnonatomicassign

A URL pointing to the badge's image.

◆ isActive

- (BOOL) isActive
readnonatomicassign

Whether the badge is active or not (in v1 - this will always be true)

◆ isHidden

- (BOOL) isHidden
readnonatomicassign

Whether the badge is "hidden". Hidden badges are to be show as a secret badge in the UI.

◆ isSegmented

- (BOOL) isSegmented
readnonatomicassign

Segmented badges can be used to filter the badge presentation according to different user attributes. For example - you can add a "market" filter so only users in this specific market can see the badge.

If a badge is segmented, you can check if it is restricted for the current user by checking his unavailable segmented badges list (User#getUnavailableSegmentedBadgesIDs() - A badge that is both segmented and appears in the user restricted segmented badges list should not be shown to that user.

Returns
true if badge is segmented, false otherwise.

◆ isVisible

- (BOOL) isVisible
readnonatomicassign

A badge that is not visible will be hidden from users that have not achieved it.

Returns
true if badge is visible

◆ name

- (NSString*) name
readnonatomicassign

The name of the badge

◆ points

- (CPTPoint) points
readnonatomicassign

The number of points that will be awarded to the user for achieving this badge

◆ repeatable

- (BOOL) repeatable
readnonatomicassign

A repeatable badge is a badge that can be achieved multiple times. you can check inside a player's badge progress to know how many times he achieved a badge For example:

CaptainUp.getLoggedInUser().getBadgeProgress().get(badge.getID()).getTimesCompleted()
Returns
true if a badge is repeatable, false otherwise.

◆ rewards

- (NSArray<id<CPTReward> >*) rewards
readnonatomicassign

A list of rewards

◆ weight

- (NSInteger) weight
readnonatomicassign

The badge weight affect the weight given to each badge when we sort, display and recommend the badges to users. The higher the weight, the more difficult the badge is considered the be, the lower the likelihood we recommend users to complete this badge.


The documentation for this protocol was generated from the following file: