Protocols

The following protocols are available globally.

  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol FBShimmering <NSObject>
    
    //! @abstract Set this to YES to start shimming and NO to stop. Defaults to NO.
    @property (nonatomic, assign, readwrite, getter = isShimmering) BOOL shimmering;
    
    //! @abstract The time interval between shimmerings in seconds. Defaults to 0.4.
    @property (assign, nonatomic, readwrite) CFTimeInterval shimmeringPauseDuration;
    
    //! @abstract The opacity of the content while it is shimmering. Defaults to 1.0.
    @property (assign, nonatomic, readwrite) CGFloat shimmeringAnimationOpacity;
    
    //! @abstract The opacity of the content before it is shimmering. Defaults to 0.5.
    @property (assign, nonatomic, readwrite) CGFloat shimmeringOpacity;
    
    //! @abstract The speed of shimmering, in points per second. Defaults to 230.
    @property (assign, nonatomic, readwrite) CGFloat shimmeringSpeed;
    
    //! @abstract The highlight length of shimmering. Range of [0,1], defaults to 0.33.
    @property (assign, nonatomic, readwrite) CGFloat shimmeringHighlightLength;
    
    //! @abstract @deprecated Same as "shimmeringHighlightLength", just for downward compatibility
    @property (assign, nonatomic, readwrite, getter = shimmeringHighlightLength, setter = setShimmeringHighlightLength:) CGFloat shimmeringHighlightWidth;
    
    //! @abstract The direction of shimmering animation. Defaults to FBShimmerDirectionRight.
    @property (assign, nonatomic, readwrite) FBShimmerDirection shimmeringDirection;
    
    //! @abstract The duration of the fade used when shimmer begins. Defaults to 0.1.
    @property (assign, nonatomic, readwrite) CFTimeInterval shimmeringBeginFadeDuration;
    
    //! @abstract The duration of the fade used when shimmer ends. Defaults to 0.3.
    @property (assign, nonatomic, readwrite) CFTimeInterval shimmeringEndFadeDuration;
    
    /**
     @abstract The absolute CoreAnimation media time when the shimmer will fade in.
     @discussion Only valid after setting {@ref shimmering} to NO.
     */
    @property (assign, nonatomic, readonly) CFTimeInterval shimmeringFadeTime;
    
    @end

    Swift

    protocol FBShimmering : NSObjectProtocol
  • The YYAnimatedImage protocol declares the required methods for animated image display with YYAnimatedImageView.

    Subclass a UIImage and implement this protocol, so that instances of that class can be set to YYAnimatedImageView.image or YYAnimatedImageView.highlightedImage to display animation.

    See YYImage and YYFrameImage for example.

    See more

    Declaration

    Objective-C

    @protocol YYAnimatedImage <NSObject>

    Swift

    protocol YYAnimatedImage : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol VOCacheProtocol
    
    @property (nonatomic) int maxItems;
    @property (nonatomic) NSString *directoryName;
    
    - (NSObject *)objectForKey:(NSString *)key;
    - (void)setObject:(NSObject *)object forKey:(NSString *)key;
    - (void)setObject:(NSObject *)object forKey:(NSString *)key shouldSaveToFileSystem:(BOOL)shouldSaveToFile lifeTime:(NSInteger)lifeTime;
    
    - (void)removeAllData;
    - (void)removeAllInMemoryData;
    - (void)removeObjectForKey:(NSString *)key;
    
    - (void)removeAllFromFileSystem;
    - (void)restoreAllFromFileSystem;
    
    @end

    Swift

    protocol VOCacheProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol VOGameManagerProtocol <NSObject>
    
    @property (nonatomic, strong, readonly) NSArray <GameData *> *gameDatas;
    
    - (void)requestGamesWithSuccess:(void(^)(NSArray <GameData *> *))onSuccess
                            failure:(void(^)(NSError *error))onFail;
    
    - (void)addGameScoreToGift:(NSString*)v3SurpriiseUri
                         score:(NSInteger)score
                 previousScore:(NSInteger)previousScore
                       success:(void(^)(void))onSucceed
                       failure:(void(^)(NSError *error))onFail;
    
    @end

    Swift

    protocol VOGameManagerProtocol : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol VOGiftManagerProtocol
    
    /**
     * Creates a pending voucher. This will save & validate the voucher created in the create process
     * This voucher will not be sent to users until activate call is made
     *
     * @param voucher - the voucher that is being created
     * @param onSucceed - success callblock when the request completes
     * @param onError - error callblock if the request fails
     *
     **/
    - (void)createPendingVoucher:(Voucher *)voucher
                       onSuccess:(void(^)(Voucher *voucher))onSucceed
                         onError:(void(^)(NSError *error))onError;
    
    /**
     * This validates payment and sends the Voucher to users
     *
     * @param voucherId - the id of the voucher sent to the server
     * @param paymentSourceDictionary - payment information if necessary, if nil it is assumed this is a FREE voucher
     * @param onSuccess - success callblock when the request completes
     * @param onError - error callblock if the request fails
     *
     **/
    -(void)activateVoucherWithId:(long long)voucherId
         paymentSourceDictionary:(NSDictionary *)paymentSourceDictionary
                       onSuccess:(void(^)(Voucher *voucher))onSuccess
                         onError:(void(^)(NSError *error))onError;
    
    
    /**
     * Unwraps a voucher
     * @discussion - Multiple people can unwrap a voucher but only one person can claim a voucher.
        Usually the unwrap & claim call occur one right after the other.
     * ## Note - Unwrap must be called before claim for the user.
     *
     * @param voucherId - the id of the voucher sent to the server
     * @param score - the score achieved in the game, if a game was played
     * @param onSuccess - success callblock when the request completes
     * @param onError - error callblock if the request fails
     *
     **/
    - (void)unwrapVoucherWithId:(long long)voucherId
                          score:(NSInteger)score
                      onSuccess:(void(^)(Voucher *voucher))onSuccess
                        onError:(void(^)(NSError *error))onError;
    
    /**
     * Claims a voucher. After a voucher is claimed no other users will be able to claim.
     *
     * @param voucherId - the id of the voucher sent to the server
     * @param onSuccess - success callblock when the request completes
     * @param onError - error callblock if the request fails
     *
     **/
    - (void)claimVoucherWithId:(long long)voucherId
                     onSuccess:(void(^)(Voucher *voucher))onSuccess
                       onError:(void(^)(NSError *error))onError;
    
    /**
     * Retrieves a voucher from server or cache
     *
     * @param voucherId - the id of the voucher sent to the server
     * @param forceUpdate - if true, will ignore cache
     * @param onSuccess - success callblock when the request completes
     * @param onError - error callblock if the request fails
     *
     **/
    -(void)requestVoucher:(long long)voucherId
              forceUpdate:(BOOL)forceUpdate
                onSuccess:(void(^)(Voucher *voucher))onSuccess
                  onError:(void(^)(NSError *error))onError;
    
    - (void)requestActivityFeedWithFilterType:(ActivityFeedFilterType)filterType
                                        limit:(NSInteger)limit
                                  forceUpdate:(BOOL)forceUpdate
                                    onSuccess:(void(^)(NSArray <ActivityFeedVoucher *> *giftModels, NSString *nextPageUrl))onSuccess
                                      onError:(void(^)(NSError *error))onError;
    
    - (void)requestActivityFeedPageWithPageUrl:(NSURL *)url
                                     onSuccess:(void(^)(NSArray <ActivityFeedVoucher *> *giftModels, NSString *nextPageUrl))onSuccess
                                       onError:(void(^)(NSError *error))onError;
    
    @end

    Swift

    protocol VOGiftManagerProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol VOMerchantManagerProtocol <NSObject>
    
    - (void)getMerchantWithCurrency:(NSString *)currency
                        countryCode:(NSString *)countryCode
                            success:(void(^)(NSArray<Merchant *> *merchants, NSArray<Merchant *> *banners))onSuccess
                              error:(void(^)(NSError *error))onError;
    
    @end

    Swift

    protocol VOMerchantManagerProtocol : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol VONetworkManagerProtocol
    
    - (NSURL *)v3UrlWithPath:(NSString *)path;
    - (NSURL *)v2UrlWithPath:(NSString *)path;
    - (NSURL *)v2UrlWithPath:(NSString *)path withQueryItems:(NSArray<NSURLQueryItem *> *)queryItems;
    - (NSURL *)v3UrlWithPath:(NSString *)path withQueryItems:(NSArray<NSURLQueryItem *> *)queryItems;
    
    - (void)requestWithUrl:(NSURL *)url
                 onSuccess:(void(^)(id responseObject))onSuccess
                   onError:(void(^)(NSError *error))onFail;
    
    - (void)requestWithUrl:(NSURL *)url
                httpMethod:(NSString *)method
                      data:(id)data
                isTypeJson:(BOOL)isJsonData
     requiresAuthorization:(BOOL)requiresAuthorization
              headerParams:(NSDictionary *)additionalHeaderParams
                onProgress:(void (^)(NSProgress *progress))uploadProgress
                 onSuccess:(void(^)(id responseObject))onSuccess
                   onError:(void(^)(NSError *error))onFail;
    
    @end

    Swift

    protocol VONetworkManagerProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol VOPersistManagerProtocol
    
    -(id)getObjectForKey:(NSString*)key;
    -(void)saveObject:(id)value forKey:(NSString*)key;
    
    -(void)removeObjectForKey:(NSString*)aKey;
    
    @end

    Swift

    protocol VOPersistManagerProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol VORefreshTokenProtocol
    
    - (void)refreshTokenOnSuccess:(void(^)(Credential* credentials))onSucceed
                          onError:(void(^)(NSError* error))onError;
    
    @end

    Swift

    protocol VORefreshTokenProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol VOTrackManagerProtocol
    
    - (void)trackEvent:(NSString *)event withParams:(NSDictionary *)params;
    - (void)trackScreen:(NSString *)screenName screenClass:(Class)screenClass;
    
    @end

    Swift

    protocol VOTrackManagerProtocol
  • VOUserManagerProtocol is an interface for all User related network calls. If not using the default UserManager, the replacement must adhere to this protocol.

    See more

    Declaration

    Objective-C

    @protocol VOUserManagerProtocol

    Swift

    protocol VOUserManagerProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol VOWrappingPaperManagerProtocol
    
    // TODO: document these
    - (void)requestWrappingPapers:(void(^)(NSArray <WrappingPaperCategory *> *categories))onSuccess
                            error:(void(^)(NSError *error))onError;
    
    - (void)getRandomWrappingPaperWithCompletion:(void (^)(WrappingPaper*))completed;
    
    @end

    Swift

    protocol VOWrappingPaperManagerProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol VOYoutubeManagerProtocol
    
    - (void)searchYoutubeVideosWithQueryString:(NSString *)queryString
                                         token:(NSString *)token
                                       success:(void(^)(NSArray <YoutubeMedia *> *, NSString *))onSuccess
                                       failure:(void(^)(NSError *error))onFail;
    
    @end

    Swift

    protocol VOYoutubeManagerProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol GameViewControllerDelegate <NSObject>
    
    /**
     This method will be called anytime a game view controller updated a property in the GameData.
     */
    - (void)gameDifficultyUpdatedWithGameData:(GameData *)gameData;
    
    @optional
    
    /**
     This method will be called anytime a game view controller finishes playing a game.
     */
    - (void)gameCompletedWithScore:(NSInteger)score gameData:(GameData *)gameData;
    
    /**
     This method gets called when the user opts to share their score
     */
    - (void)gameShareWithScore:(NSInteger)score gameData:(GameData *)gameData;
    
    @end

    Swift

    protocol GameViewControllerDelegate : NSObjectProtocol
  • GameViewControllerProtocol is the interface for UIViewControllers that facilitate interactions with games. UIViewControllers must implement this protocol to appear in the game selection screen.

    See more

    Declaration

    Objective-C

    @protocol GameViewControllerProtocol <NSObject>

    Swift

    protocol GameViewControllerProtocol : NSObjectProtocol
  • General search protocol for asynchronous string-based searches. *

    See more

    Declaration

    Objective-C

    @protocol SearchAgent <NSObject>

    Swift

    protocol SearchAgent : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol VouchrLoadingViewProtocol
    
    - (void)startLoadingOnView:(UIView *)view withAnimation:(BOOL)animation;
    - (void)endLoadingWithAnimation:(BOOL)animation;
    - (void)setTintColor:(UIColor *)tintColor;
    - (UIColor *)tintColor;
    
    @end

    Swift

    protocol VouchrLoadingViewProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol AddNoteViewControllerDelegate <NSObject>
    
    /**
     This delegate callback occurs when the user has finished creating a note.
     @param note - The `NoteMedia` containing information about the created note.
     @param noteView - The styled `UIView` containing the note, to be used to render and dropped in envelope.
     **/
    - (void)didAddNote:(NoteMedia *)note noteView:(UIView *)noteView;
    
    // TODO: RB - this may no longer be needed
    - (void)didEditNote:(NoteMedia *)note noteView:(UIView *)noteView;
    
    @end

    Swift

    protocol AddNoteViewControllerDelegate : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol FullScreenImageEditViewControllerDelegate <NSObject>
    
    - (void)fullScreenImageEditViewControllerFinishedEditingImageMedia:(ImageMedia *)editedImageMedia;
    
    @end

    Swift

    protocol FullScreenImageEditViewControllerDelegate : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol VoucherCreationFlowDelegate <NSObject>
    
    @required
    
    /************************************************************************
    * * * * * * * * * * * * * * * * PAYMENTS * * * * * * * * * * * * * * * *
    *************************************************************************/
    
    /**
    This delegate method is called if payment information needs to be provided to complete activation of the voucher. The callback occurs when the user hits send on the summary screen or if the user taps on the credit card cell.
     
    @note If no paymentInfo needs to be provided, execute the completion block with a nil payment.
    @note The contents of the paymentInfo dictionary will be dependent on the payment system being used and will require discussion with backend team.
     
    @property viewController - the current top viewController. If a paymentViewController needs to be presented to retrieve additional payment information, it should be presented on this viewController.
    @property voucher - The voucher that needs the payment information.
    @property completion - Completion block to be executed when the payment information has been obtained. Supply a dictionary with payment info as the paymentInfo. This will be used in the activateVoucher call. Supply an error if an error has occurred, or if the payment could not be completed.
     */
    - (void)voucherCreationShowPaymentOnViewController:(UIViewController *)viewController forVoucher:(Voucher *)voucher onCompletion:(void(^)(NSDictionary *paymentInfo, NSError *error))completion;
    
    
    /************************************************************************
     * * * * * * * * * * * * * * * * * LOGIN * * * * * * * * * * * * * * * *
     ************************************************************************/
    
    /**
     This delegate method is called when a user needs to be logged in to proceed with the flow. Users can start with creation of a voucher without being logged in, but must be logged in to send it.
     @note This callback will occur if the `UserManager` in the `CreationManager` returns false for isLoggedIn.
     
     @param viewController - the current top viewController. If a loginViewController needs to be presented as part of login, it should be presented on this viewController.
     @param completion - completionBlock when login has completed. If an error occurred it will be returned in the completion block.
     This completion block does not need to be called, however it is recommended that it should be.
     */
    - (void)showLoginOnViewController:(UIViewController *)viewController onCompletion:(void(^)(NSError *error))completion;
    
    
    @optional
    
    /************************************************************************
     * * * * * * * * * * * * PERSONALIZATION OPTIONS * * * * * * * * * * * *
     ************************************************************************/
    
    /**
     * This delegate method is called when a personalization screen needs to be displayed to the user.
     * If a nil object is returned, the default implementation of the personalization screen will be used.
     *
     * @param type - the type classification of the personalization requested.
     * @param transitionController - the transition animator for displaying personalization screens. If no transition controller is supplied, the default circular expand transition will be used.
     * @return - The view controller returned must adhere to PersonalizationOptionViewControllerProtocol
     */
    - (UIViewController<PersonalizationOptionViewControllerProtocol> *)personalizationViewControllerForType:(PersonalizationType)type
                                                                                       transitionController:(NSObject<UIViewControllerAnimatedTransitioning> *)transitionController;
    
    /************************************************************************
     * * * * * * * * * * * * * * CUSTOM CHALLENGES * * * * * * * * * * * * *
     ************************************************************************/
    
    /**
     * This delegate method is called when a user selects a game to play.
     * Provide a nil object to use the default game implementation.
     * If no default implementation exists, the game will be selected without playing.
     *
     * @param gameData - The game data associated with the selected game
     * @return - The view controller used to play the challenge.
     */
    - (UIViewController<GameViewControllerProtocol> *)challengeViewControllerForGameData:(GameData *)gameData;
    
    
    /************************************************************************
     * * * * * * * * * * * * * * SUMMARY SCREEN * * * * * * * * * * * * * * *
     ************************************************************************/
    
    /**
     This delegate method is called when the default summary screen is displayed to the user. The summary screen requires an array of data sources, each representing sections of cells in the tableView. They will be displayed in the default summary screen in the order given. Custom data sources & cells can be added as long as they follow the SectionDataSourceProtocol.
     
     @note
     If this method is not implemented, or if nil is returned, it will use the default data sources:
     1) SummaryScreenClaimerInfoDataSource
         - shows who the gift is being sent to (if there is one)
         - shows when the gift is claimable
     2) SummaryScreenPriceDataSource
         - shows the gift card envelope
         - shows the amount, fees and total cost
         - shows any credits used (if any were used)
         - shows who the gift is visible to
     3) SummaryScreenPaymentDataSource
         - shows which credit card will be used (last 4 digits and type of card) if a credit card is provided
     4) SummaryScreenEndInfoDataSource
         - shows where the receipt is being emailed to
         - shows legal disclaimerText if any is in the Voucher
         - shows terms and conditions if any is in the Voucher
         - shows cardHolderAgreementUrl if one is in the Voucher
     */
    - (NSArray <id<SectionDataSourceProtocol>> *)summaryScreenDataSourcesForVoucher:(Voucher *)voucher;
    
    /**
     This delegate method is called when a summary screen needs to be displayed to the user.
     If a nil object is returned, the default implementation will be used
     
     @param payment - the payment type of the Voucher
     @param transitionController - the transition animator for displaying personalization screens.
     */
    - (UIViewController<VoucherSummaryScreenProtocol> *)summaryScreenViewControllerForVoucherPayment:(VoucherPayment *)payment
                                                                                transitionController:(NSObject<UIViewControllerAnimatedTransitioning> *)transitionController;
    
    
    /************************************************************************
     * * * * * * * * * * * * * * * * WRAPPING * * * * * * * * * * * * * * * *
     ************************************************************************/
    
    /**
     This delegate method is called before the network request to the Vouchr server is made to wrap a voucher.
     @note Wrapping a voucher puts it in a 'pending' state. The contents of the voucher will be validated,
     payment requirements and fees will be added, and the voucher will be saved in the Vouchr database.
     @param voucher - This is the voucher that will be sent to the server for validation. Can be modified before being sent.
     */
    - (void)voucherCreationVoucherWillWrap:(MutableVoucher *)voucher;
    
    /*
     * This delegate method is called when a merchant is required to present a disclaimer to the user.
     *
     * @param paymentMerchantInfo - PaymentMerchantInfo of the merchant requesting the user to accept the terms of agreement.
     * @param viewController - the view controller that the disclaimer will be presented on top of
     * @param onCompletion - completion block that is called when the disclaimer is accepted/dismissed
     */
    - (void)showDisclaimerForPaymentMerchantInfo:(PaymentMerchantInfo *)paymentMerchantInfo
                                onViewController:(UIViewController *)viewController
                                  withCompletion:(void(^)(void))onCompletion;
    
    /*
     * This delegate method is called before presenting the ProductDetailsViewController. This delegate is used to setup the card views in the ProductDetailsViewController.
     *
     * @param paymentMerchantInfo - details of the merchant that will be presented to the user.
     * @return - whether or not a secondary overlaying card view is presented.
     */
    - (BOOL)shouldShowOverlayingCardsForPaymentMerchantInfo:(PaymentMerchantInfo *)paymentMerchantInfo;
    
    /**
      This delegate method is called after the network request to the Vouchr server is made to wrap a voucher completes successfully.
      @param voucher - The finalized voucher returned from the server.
     */
    - (void)voucherCreationVoucherWrapCompleted:(Voucher *)voucher;
    
    /**
     This delegate method is called if the network request to the Vouchr server fails during validation.
     @param error - The error returned from the server.
     */
    - (void)voucherCreationVoucherWrapFailedWithError:(NSError *)error;
    
    
    /************************************************************************
     * * * * * * * * * * * * * * * ACTIVATION * * * * * * * * * * * * * * * *
     ************************************************************************/
    
    /**
     This delegate method is called before the network request to the Voucher server is made to activate a voucher. Activating a voucher will process the payment, put the voucher in an active state, and notify the claimer(s) they have been sent a voucher.
     @param voucher - The voucher that is being activated.
     */
    - (void)voucherCreationVoucherWillActivate:(Voucher *)voucher;
    
    /**
     This delegate method is called when a voucher is activated successfully.
     @param voucher - The voucher that was activated.
     */
    - (void)voucherCreationVoucherActivationCompleted:(Voucher *)voucher;
    
    /**
     This delegate method is called if the network request to the Vouchr server fails when activating a voucher.
     @param error - The error returned from the server.
     */
    - (void)voucherCreationVoucherActivationFailedWithError:(NSError *)error;
    
    
    @end

    Swift

    protocol VoucherCreationFlowDelegate : NSObjectProtocol
  • The ‘VoucherCreationViewControllerDelegate’ is the object responsible for supplying additional screens *

    See more

    Declaration

    Objective-C

    @protocol VoucherCreationViewControllerDelegate <NSObject>

    Swift

    protocol VoucherCreationViewControllerDelegate : NSObjectProtocol
  • Delegate protocol for the VouchrActionSheetViewController class *

    See more

    Declaration

    Objective-C

    @protocol VouchrActionSheetViewControllerDelegate <NSObject>

    Swift

    protocol VouchrActionSheetViewControllerDelegate : NSObjectProtocol