-
Notifications
You must be signed in to change notification settings - Fork 104
步骤器
Ven edited this page Apr 28, 2024
·
1 revision
步骤器可以帮助快速实现复杂的业务场景,比如自动发朋友圈、获取微信所有好友昵称、自动删除好友...等等都是一些逻辑较多的业务场景,步骤器可帮助快速实现。 前提: 已完成前面的快速开始配置
直接在接口onImpl(collector: StepCollector)
写逻辑
//OpenWechat为该业务场景的分类
class OpenWechat:StepImpl {
override fun onImpl(collector: StepCollector) {
//步骤1逻辑
collector.next(1) {//1为该步骤的标识
//步骤1逻辑
...
//执行步骤2,this::class.java为当前StepImpl实现类的步骤逻辑,如果传其他的StepImpl就会执行指定的StepImpl逻辑
StepManager.execute(this::class.java, 2)
}.next(2) {
//步骤2逻辑
...
//下一步
StepManager.execute(this::class.java, 3)
}.next(2) {
//步骤3逻辑
...
//下一步
StepManager.execute(this::class.java, 4)
}
其他步骤
...
}
}
执行前请确保无障碍服务已开启
//从OpenWechat的步骤1开始执行,isBegin需要为true,默认false
StepManager.execute(OpenWechat::class.java, 1, isBegin = true)
具体的使用可以下载查看demo源码,都有注释