Skip to content

finish MockPuppet #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 13, 2020
Merged

finish MockPuppet #36

merged 12 commits into from
Jun 13, 2020

Conversation

redmaple1
Copy link
Contributor

@redmaple1 redmaple1 commented Jun 10, 2020

  1. finish MockPuppet
  2. add test method for say with mention list and fix some bugs in this case.
  3. fix typo. Change ContractGender to ContactGender.
  4. add PuppetManager to support custom puppet implementation.

old:

private fun initPuppet() {
      this.puppet = GrpcPuppet(puppetOptions)
      initPuppetEventBridge(puppet)
}

now:

private fun initPuppet() {
      this.puppet = PuppetManager.resolveInstance(wechatyOptions).get()
      initPuppetEventBridge(puppet)
}

@redmaple1 redmaple1 requested a review from a team as a code owner June 10, 2020 09:13
@redmaple1 redmaple1 requested a review from diaozxin007 June 10, 2020 09:13
fun resolveInstance(wechatyOptions: WechatyOptions): Future<Puppet> {
log.info("PuppetManager resolveInstance(${JsonUtils.write(wechatyOptions)})")

return if ("wechaty-puppet-hostie" == wechatyOptions.puppet) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

尝试使用反射技术来加载,如果有第三个 puppet 还需要修改代码。

Copy link
Collaborator

@diaozxin007 diaozxin007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

尝试使用反射,或者 kotlin 的委托 https://www.kotlincn.net/docs/reference/delegation.html 来解决 puppet 的加载问题

@diaozxin007 diaozxin007 merged commit 5867ad2 into wechaty:master Jun 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants