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

feat: add Screenshot plugin #343

Open
5 tasks done
robingenz opened this issue Dec 9, 2024 · 1 comment · May be fixed by #344
Open
5 tasks done

feat: add Screenshot plugin #343

robingenz opened this issue Dec 9, 2024 · 1 comment · May be fixed by #344
Assignees
Labels
feature Feature request

Comments

@robingenz
Copy link
Member

Name

Screenshot

Platform(s)

  • Android
  • iOS
  • Web

Description

One of my customers is looking for a Capacitor plugin that allows him to take a screenshot of the WebView (html -> image) in case of errors in the app. This plugin should be available on Android, iOS and on the Web. On the Web, html2canvas can be used and the image should be returned as Data URL. On Android and iOS, the image should be saved on the local filesystem in the cache directory with a unique filename (e.g. uuid).

I think of the following types:

export interface ScreenshotPlugin {
  /**
   * Take a screenshot.
   * 
   * @since 6.0.0
   */
  take(): Promise<TakeResult>;
}

/**
 * @since 6.0.0
 */
export interface TakeResult {
  /**
   * The file path (Android and iOS) or data URI (Web) of the screenshot.
   * 
   * Only available on Android, iOS and Web.
   * 
   * @since 6.0.0
   * @example 'content://com.android.providers.downloads.documents/document/msf%3A1000000073'
   * @example 'data:image/jpeg;base64,SGVsbG8sIFdvc...mxkIQ=='
   */
  uri: string;
}

Additional context

No response

Before submitting

@robingenz robingenz added the feature Feature request label Dec 9, 2024
@robingenz
Copy link
Member Author

@ebarooni Feel free to work on this issue. I've pushed the boilerplate code to feat/issue-343. Please create your own branch based on my branch to be able to create a PR against feat/issue-343. This way we can review just the implementation changes.

@robingenz robingenz linked a pull request Dec 9, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants