LFSAskForReview 0.0.3

LFSAskForReview 0.0.3

测试已测试
Lang语言 Obj-CObjective C
许可协议 MIT
发布最后发布2014年12月

未声明的 维护。




  • Lluís Gómez

简介

LFSAskForReview 是一个类,您可以将其添加到 iOS 应用以让用户评分。其主要功能包括:不要求用户在每个版本中多次评分;完全可定制,您可以

  • 决定在显示警报之前需要执行哪些操作以及需要多少重复(数据源协议)
  • 设置警报的标题、消息和按钮标题(数据源协议)
  • 实现对用户正面和负面答案的响应(代理协议)

使用方法

@property (strong, nonatomic) id<LFSAskForReviewServiceDataSource>dataSource;
@property (strong, nonatomic) id<LFSAskForReviewServiceDelegate>delegate;

//Singleton
+ (LFSAskForReviewService *)sharedService;

//Method to call when the user action that could trigger the ask for review alert happened.
- (void)askIfNecessaryAfterUserAction:(NSString *)action;

数据源

/**
 For a given action, returns the number of repetitions that must happen before showing the alert asking for a review.
 */
- (NSUInteger)necessaryRepetitionsForAction:(NSString *)action
{
    if ([action isEqualToString:@"OpenSection"]) {
        return 10;
    }

    if ([action isEqualToString:@"SendMessage"]) {
        return 20;
    }

    return 0;
}

/**
 Returns the title to be displayed in the alert.
 */
- (NSString *)title
{
    return @"Y U NO RATE";
}

/**
 Returns the message to be displayed in the alert.
 */
- (NSString *)message
{
    return @"We have a family to feed\n PLEASE RATE US";
}

/**
 Returns the title for the positive answer button of the alert.
 */
- (NSString *)positiveButtonTitle
{
    return @"YOU'RE AWESOME";
}

/**
 Returns the title for the negative answer button of the alert.
 */
- (NSString *)negativeButtonTitle
{
    return @"YOU'RE A DICK";
}

代理

/**
 Handles user's positive response to the ask for review alert.
 */
- (void)userResponseWasNegative
{
    //Do whatever you want
}

/**
 Handles user's negative response to the ask for review alert.
 */
- (void)userResponseWasPositive
{
    //Do whatever you want
}