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

Paste images from your clipboard in android #461

Merged
merged 5 commits into from
Oct 30, 2024

Conversation

krrish-sehgal
Copy link
Contributor

@krrish-sehgal krrish-sehgal commented Oct 29, 2024

Fixes #231

Description

This PR makes use of a method channel to connect the native Android code with Flutter, enabling the retrieval of images from the clipboard. The key changes include:

  • Method Channel Implementation:
    A method channel named clipboard_image_channel is created in the native Android code for communication with Flutter. This channel handles method calls to check the clipboard for images.

  • Base64 Encoding:
    The image retrieved from the clipboard is converted to a Base64 string before being sent to the Flutter code. This allows for easier handling of the image data in Dart.

  • Image Storage:
    The decoded Base64 image string is stored in the same list that is used to display images selected from the gallery, while maintaining the total count of allowed images, which is capped at 5. This ensures a friendly UX of handling images from both the clipboard and the gallery.

  • No image in clipboard handling:
    Shows a snackbar(with a theme used for snackbar before).

    New Dependencies in android folder

The following dependencies are required for this change:

  • androidx.core:core-ktx:1.10.1
  • androidx.appcompat:appcompat:1.6.1
  • androidx.activity:activity-ktx:1.7.2

Key changes in android folder

  • Gradle version in use now - 7.5
  • android.tools.build:gradle - 7.4.2
  • replaced deprecated jcenter() to mavenCentral() under repositories config

Attached video demo of the fix

Screen.Recording.2024-10-29.at.7.04.11.PM.mov

@@ -12,7 +12,6 @@
#include <local_notifier/local_notifier_plugin.h>
#include <pasteboard/pasteboard_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <sentry_flutter/sentry_flutter_plugin.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

how come you are removing this here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this OK to remove here? We'd like to have sentry on windows as well.

Copy link
Contributor Author

@krrish-sehgal krrish-sehgal Oct 30, 2024

Choose a reason for hiding this comment

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

These changes were automatically made during some builds , i'll add these lines back , as i did in my previous commit.

@DonnieBLT
Copy link
Collaborator

@krrish-sehgal I have one question and can you please check the checks.

@krrish-sehgal
Copy link
Contributor Author

krrish-sehgal commented Oct 29, 2024

I'll update the deprecated upload-artifact from .github/workflows/build-flutter.yaml for the checks, and since flutter automatically made changes for the sentry plugin , I'll see to it , if i dont find a plausible cause , i'll revert the changes in the windows folder.

@DonnieBLT DonnieBLT enabled auto-merge (squash) October 30, 2024 17:22
auto-merge was automatically disabled October 30, 2024 19:11

Head branch was pushed to by a user without write access

@DonnieBLT DonnieBLT enabled auto-merge (squash) October 30, 2024 19:16
auto-merge was automatically disabled October 30, 2024 20:24

Head branch was pushed to by a user without write access

@DonnieBLT DonnieBLT enabled auto-merge (squash) October 30, 2024 20:28
@DonnieBLT DonnieBLT merged commit df46f31 into OWASP-BLT:main Oct 30, 2024
6 checks passed
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️⃣6️⃣ allow the user to be able to past an image into the bug report page in the app
2 participants