SmartRate
只有当用户满意时才要求他们进行评价。
这个库将帮助你实现这个复杂逻辑。
你可以设置任何序列的操作。
//Configure SmartRate
SMBlocker.shared.minTimeAfterInstalled = 60 //Will not fire 60 seconds after first launch
SMBlocker.shared.minTimeAfterLaunch = 10 //Will not fire 10 seconds after launch
SMBlocker.shared.minTimeAfterFire = 60 //Will not fire 60 seconds after fire 😀
SMBlocker.shared.showRatingForEveryVersion = true //Will reset block if the app version will change
//Create triggers for SmartRate
let countTrigger = SMTriggerCounterType(notificationName: ViewController.duplicateActionNotificationName, repeatTimes: 4, uniqName: "press4TimesTrigger")
//For every trigger you can provide custom fire function, or use default
countTrigger.customFireCompletion = {
if #available(iOS 10.3, *) {
SKStoreReviewController.requestReview()
}
}
//Will fire on 4-th button press
SMTriggersStore.shared.addTrigger(countTrigger)
let chainTrigger = SMTriggerChainType(notificationNames: [
ViewController.step1NotificationName, //provide sequence of steps
ViewController.step2NotificationName,
ViewController.step3NotificationName,
],
breakNotificationName: ViewController.breakNotificationName, //You can break chain on any other action, or set nil
uniqName: "pressButtons123Trigger"
)
//Will fire after correct sequence of 3 steps. Will not fire if sequence will be broken
SMTriggersStore.shared.addTrigger(chainTrigger)
示例
要运行示例项目,请先clone 仓库,然后从 Example 目录运行 pod install
系统要求
安装
SmartRate 可以通过 CocoaPods 获得。要安装它,只需将以下行添加到 Podfile 中
pod "SmartRate"
许可协议
SmartRate 采用 MIT 许可协议。有关更多信息,请参阅 LICENSE 文件。