Skip to content
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

Have common builder #13

Open
levibostian opened this issue May 7, 2019 · 0 comments
Open

Have common builder #13

levibostian opened this issue May 7, 2019 · 0 comments

Comments

@levibostian
Copy link
Owner

Here is a code sample of what I am trying to do:

var shutterBuilder = Shutter.with(this)

if (useCamera) shutterBuilder = shutterBuilder.takePhoto().usePrivateAppExternalStorage()
else shutterBuilder = shutterBuilder.getPhotoFromGallery()

shutterResult = shutterBuilder
.snap(object : ShutterResultCallback {

I am trying to dynamically choose what builder I use. Depending on boolean variable useCamera.

Problem is I cannot do this because the builder objects being returned from each are not common.

What I could do:

  1. add a function build() that builds to a common object that you can then call snap() on.
  2. Will a kotlin DSL allow me to solve this problem from a different angle?
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

No branches or pull requests

1 participant