Skip to content

Commit

Permalink
Merge pull request #69 from ZhengLinLei/dev
Browse files Browse the repository at this point in the history
Stash v0.1.7
  • Loading branch information
ZhengLinLei authored Nov 9, 2023
2 parents 8bb5983 + 1c5bb1c commit a014f26
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 33 deletions.
2 changes: 1 addition & 1 deletion css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, maximum-scale=1.0, user-scalable=no">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=contain, maximum-scale=1.0, user-scalable=no">
<!-- OPT -->
<link rel="shortcut icon" href="./img/ico.ico" type="image/x-icon">
<meta name="theme-color" content="#ffffff" />
Expand Down
10 changes: 7 additions & 3 deletions js/lib/png2share.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,21 @@ const DrawCanvasCopy = (canvas, callback, callbackBlob) => {
// Stackblock: https://stackoverflow.com/questions/68362603/share-image-via-social-media-from-pwa
//
// Convert blob to image share
const Blob2Share = async(blob) => {
const Blob2Share = async(blob, emptyText = false) => {
let tries = 0, maxTries = 3;
if (!('share' in navigator) || !('canShare' in navigator)) {
return false;
}
const files = [new File([blob], 'newRecord.png', { type: blob.type })];
const shareData = {
text: 'Play with me. In Stackblock.io',
title: 'Stackblock.io',
files,
};
// Add only if it's not IOS
if(!emptyText) {
shareData.title = 'Stackblock.io';
shareData.text = 'Play with me. In Stackblock.io';
}

if (navigator.canShare(shareData)) {
while(true) {
try {
Expand Down
Loading

0 comments on commit a014f26

Please sign in to comment.