mattprecious / telescope

A simple tool to allow easy bug report capturing within your app.
Apache License 2.0
1.18k stars 116 forks source link

Add a hook to do operations between trigger and screenshot being taken #58

Closed NightlyNexus closed 7 years ago

NightlyNexus commented 7 years ago

I'd like to be able to clean up the status bar with Demo Mode before taking the screenshot. Something could go in trigger() (maybe only invoked when the screenshot mode is not NONE?), and the implementer would call through to continue the capture. I don't yet have a clear idea of what the mechanism would look like; this might be a fork if it's overly complex.

mattprecious commented 7 years ago

Can you think of other use cases that would be app specific? Is it trivial to make Telescope enable demo mode instead of requiring the app to implement that part?

NightlyNexus commented 7 years ago

Maybe hide sensitive data (infoView.setText(loremIpsum), photoView.setVisible(INVISIBLE))? But, no, I don't really have a concrete use case besides hiding my notifications.

The unfortunate part about Demo Mode is that it requires you either to grant a permission from adb shell pm grant android.permission.DUMP or to be rooted and have the app do the same. I wrote a tiny helper library for this, but it seems very inappropriate here. It would be awkward to explain the permission requirements in Telescope's API.

I can totally fork for myself, though, if there's no good solution.

mattprecious commented 7 years ago

Makes sense.

NightlyNexus commented 7 years ago

1) Add hook for user code between trigger and taking the screenshot.

2) Add a void TelescopeLayout.useDemoMode(boolean useDemoMode) which will have an effect only if context.checkPermission("android.permission.DUMP", Process.myPid(), Process.myUid()) == PERMISSION_GRANTED.

3) (2) but also attempt to grant the permission for rooted users.

4) Close this and fork.

I selfishly want (2), but it would be good for maybe 1% of Telescope users. Close this and do (4)?

NightlyNexus commented 7 years ago

I needed to run code after the screenshot was taken, too. Forked. 😃