levibostian / levibostian/Shutter-Android

Have common builder

Open
#13 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
58
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Shutter.with(this) entry point and compare the builder types returned by takePhoto().usePrivateAppExternalStorage() and getPhotoFromGallery(). Define what a common result should expose for the subsequent snap call, then verify the proposed API against both branches shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.