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

Allowed extension to use clipboard content to generate QR code when permission given #337

Merged
merged 20 commits into from
Oct 31, 2024

Conversation

BrandonTuTwo2
Copy link
Contributor

PR for this issue #282. Allows the user to create QR codes from copied text from the clipboard granted they give permission to allow the extension to read from the clipboard and turn the setting on. If the clipboard is empty defaults the current tabs URL

@BrandonTuTwo2
Copy link
Contributor Author

Hi @rugk I'm ready for a review whenever your free!

@@ -17,6 +18,13 @@
const REMEBER_SIZE_INTERVAL = 500; // sec
const CONTRAST_MESSAGE_ID = "contrast";

const CLIPBOARD_READ_PERMISSION = {

Check notice

Code scanning / Jshint (reported by Codacy)

Prohibits the use of __iterator__ property due to compatibility issues Note

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
permissions: ["clipboardRead"]
};

const MESSAGE_CLIPBOARD_READ_PERMISSION = "getClipboardContentPermissionInfo";

Check notice

Code scanning / Jshint (reported by Codacy)

Prohibits the use of __iterator__ property due to compatibility issues Note

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
src/options/modules/CustomOptionTriggers.js Fixed Show fixed Hide fixed
@@ -30,6 +30,10 @@
console.info("UserInterface module loaded.");
});

const CLIPBOARD_READ_PERMISSION = {

Check notice

Code scanning / Jshint (reported by Codacy)

Prohibits the use of __iterator__ property due to compatibility issues Note

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
return selection;
});
});

// check for clipboard text if option is enabled and if extension has permission to read from clipboard
// if the clipboard is empty it rejects the promise
const gettingClipboard = AddonSettings.get("autoGetClipboardContent").then((autoGetClipboardContent) => {

Check notice

Code scanning / Jshint (reported by Codacy)

Prohibits the use of __iterator__ property due to compatibility issues Note

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
src/popup/modules/InitQrCode.js Fixed Show fixed Hide fixed
Copy link
Owner

@rugk rugk left a comment

Choose a reason for hiding this comment

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

First review just showed some superfluous lines.

Thanks a lot!

src/options/modules/CustomOptionTriggers.js Outdated Show resolved Hide resolved
src/options/modules/CustomOptionTriggers.js Outdated Show resolved Hide resolved
src/options/options.html Outdated Show resolved Hide resolved
@BrandonTuTwo2
Copy link
Contributor Author

Hi @rugk I fixed the spacing issues and added the missing semicolons let me know if there is anything else!

@rugk
Copy link
Owner

rugk commented Oct 31, 2024

Tested it and it works, except the permission prompt. When you remove the permission (and toggle the setting), you are not prompted for a new permission hmm:
grafik

Ah okay, that was just me missing the submodule, i see.

Anyway, there is a translation missing here 🙃 :
grafik

@rugk
Copy link
Owner

rugk commented Oct 31, 2024

Okay that was also partially my bad, sorry, because the lib was not really documented in a good way. Added that now/did that now: https://github.com/TinyWebEx/PermissionRequest/tree/master?tab=readme-ov-file#required-translation

And fixed the issue here.

@rugk
Copy link
Owner

rugk commented Oct 31, 2024

BTW: Next time, try to avoid doing a pull request from the main/master branch, because you can run into problems when you have a "non-clean" main that does not follow this repo here (i.e. "upstream"). See this article for details. Anyway, this is only a tip for the next time. 😃

…ght) being taken than needed

Even when all child elements were hidden.
@rugk
Copy link
Owner

rugk commented Oct 31, 2024

Okay, fixed a small style issue, where the height would be too much when no permission request was shown below the option. See 71f0932

@rugk rugk merged commit 520ef02 into rugk:master Oct 31, 2024
2 checks passed
@rugk
Copy link
Owner

rugk commented Nov 9, 2024

Next time, FYI you can (automatically) let issues close when a PR is merged by adding some "magic" text to your PR body. (Manually did it now.)

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.

Use system clipboard content than tab url to gen code.
2 participants