-
-
Notifications
You must be signed in to change notification settings - Fork 474
feat(feedback): Add screenshot attachment button to user feedback widget #5828
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
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b1ceb7f
feat(feedback): Add screenshot attachment button to user feedback widget
markushi ff9326d
changelog
markushi bcfe6d6
changelog
markushi ca30932
build(android): Clean up androidx.activity dependency declarations
markushi f9edb84
fix(feedback): Address review feedback for screenshot attachment
markushi 06702a3
Merge branch 'main' into feat/feedback-screenshot-attachment
markushi a4e341a
fix(feedback): Bound image attachment reads by maxAttachmentSize
markushi c8af66a
Merge branch 'feat/feedback-screenshot-attachment' of github.com:getsβ¦
markushi dabb043
Address PR feedback
markushi c8c08c1
Merge branch 'main' into feat/feedback-screenshot-attachment
markushi 0a3d51d
Merge branch 'main' into feat/feedback-screenshot-attachment
markushi eb9d1ed
Merge remote-tracking branch 'origin/main' into feat/feedback-screensβ¦
markushi 9411cc4
ref(feedback): Don't swallow fatal throwables in the screenshot attacβ¦
markushi e54c598
fix(feedback): Make the user feedback form scrollable and compact itsβ¦
markushi 416d6ca
test(feedback): Drop an inaccurate comment about duplicate picker regβ¦
markushi 6794390
Merge remote-tracking branch 'origin/main' into feat/feedback-screensβ¦
markushi 5edad4a
ref(feedback): Narrow the screenshot attachment catches to the expectβ¦
markushi 1bdd114
ref(feedback): Guard the androidx.activity calls against LinkageErrors
markushi 82e8007
Merge branch 'main' into feat/feedback-screenshot-attachment
markushi 58f0ede
docs(agents): Remove duplicated build commands and rules (#5971)
runningcode 2df6b56
perf(android): Use generated manifest metadata (#5976)
markushi e6eff53
Address PR feedback
markushi dbe756c
Merge branch 'main' into feat/feedback-screenshot-attachment
markushi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
sentry-android-core/src/main/java/io/sentry/android/core/SentryFeedbackScreenshotPicker.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| package io.sentry.android.core; | ||
|
|
||
| import android.app.Activity; | ||
| import android.net.Uri; | ||
| import androidx.activity.ComponentActivity; | ||
| import androidx.activity.result.ActivityResultLauncher; | ||
| import androidx.activity.result.PickVisualMediaRequest; | ||
| import androidx.activity.result.contract.ActivityResultContracts; | ||
| import org.jetbrains.annotations.NotNull; | ||
| import org.jetbrains.annotations.Nullable; | ||
|
|
||
| /** | ||
| * Launches the androidx photo picker to attach an screenshot to user feedback. All | ||
| * androidx.activity references are isolated in this class, so it must only be loaded once {@link | ||
| * SentryUserFeedbackForm#isScreenshotPickerAvailable} has returned true. That check deliberately | ||
| * lives outside of this class, so that it can run without linking any androidx.activity type. | ||
| */ | ||
| final class SentryFeedbackScreenshotPicker { | ||
|
|
||
| interface OnScreenshotPicked { | ||
| void onScreenshotPicked(@NotNull Uri uri); | ||
| } | ||
|
|
||
| private final @NotNull ActivityResultLauncher<PickVisualMediaRequest> launcher; | ||
|
|
||
| private SentryFeedbackScreenshotPicker( | ||
| final @NotNull ActivityResultLauncher<PickVisualMediaRequest> launcher) { | ||
| this.launcher = launcher; | ||
| } | ||
|
|
||
| static @Nullable SentryFeedbackScreenshotPicker register( | ||
| final @NotNull Activity activity, | ||
| final @NotNull SentryFeedbackScreenshotPicker.OnScreenshotPicked callback) { | ||
| if (!(activity instanceof ComponentActivity)) { | ||
| return null; | ||
| } | ||
| final @NotNull ActivityResultLauncher<PickVisualMediaRequest> launcher = | ||
| ((ComponentActivity) activity) | ||
| .getActivityResultRegistry() | ||
| .register( | ||
| "sentry_user_feedback_screenshot_picker", | ||
| new ActivityResultContracts.PickVisualMedia(), | ||
| (@Nullable Uri uri) -> { | ||
| if (uri != null) { | ||
| callback.onScreenshotPicked(uri); | ||
| } | ||
| }); | ||
| return new SentryFeedbackScreenshotPicker(launcher); | ||
|
markushi marked this conversation as resolved.
|
||
| } | ||
|
|
||
| void launch() { | ||
| launcher.launch( | ||
| new PickVisualMediaRequest.Builder() | ||
| .setMediaType(ActivityResultContracts.PickVisualMedia.ImageOnly.INSTANCE) | ||
| .build()); | ||
| } | ||
|
|
||
| void unregister() { | ||
| launcher.unregister(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.