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

Add Screenshot feature #39

Closed
ZhengLinLei opened this issue Oct 13, 2023 · 1 comment · Fixed by #45 or #41
Closed

Add Screenshot feature #39

ZhengLinLei opened this issue Oct 13, 2023 · 1 comment · Fixed by #45 or #41
Assignees
Labels
enhancement New feature or request merged Branch merge into dev. Waiting for version

Comments

@ZhengLinLei
Copy link
Owner

Render the body html to image when the user reach new record and show it, then the user can share it friends and social media to flex their score.

Render image when the user get new record, not in every game over.

Can use this library: https://github.com/tsayen/dom-to-image

var node = document.getElementById('my-node');

domtoimage.toPng(node)
    .then(function (dataUrl) {
        var img = new Image();
        img.src = dataUrl;
        document.body.appendChild(img);
    })
    .catch(function (error) {
        console.error('oops, something went wrong!', error);
    });

And share it with native API

async function shareImage() {
  const response = await fetch('nacho.jpg');
  const blob = await response.blob();
  const filesArray = [
    new File(
      [blob],
      'meme.jpg',
      {
        type: "image/jpeg",
        lastModified: new Date().getTime()
      }
   )
  ];
  const shareData = {
    files: filesArray,
  };
  navigator.share(shareData);
}
@ZhengLinLei ZhengLinLei added enhancement New feature or request pending Waiting to be solved labels Oct 13, 2023
@ZhengLinLei
Copy link
Owner Author

We need this enhancement.

Branch: feature_task_share_record

Leave message if you are developing this branch 😋

@ZhengLinLei ZhengLinLei changed the title Add Screeshot feature Add Screenshot feature Oct 13, 2023
@ZhengLinLei ZhengLinLei self-assigned this Oct 13, 2023
ZhengLinLei added a commit that referenced this issue Oct 14, 2023
Sankeyr3 added a commit that referenced this issue Oct 14, 2023
@ZhengLinLei ZhengLinLei added merged Branch merge into dev. Waiting for version and removed pending Waiting to be solved labels Oct 14, 2023
This was linked to pull requests Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request merged Branch merge into dev. Waiting for version
Projects
None yet
1 participant