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

Final showstopper issue #1087

Merged
merged 7 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions www/js/components/QrCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export function shareQR(message) {
}

const QrCode = ({ value, ...rest }) => {
let hasLink = value.toString().includes("//");
if(!hasLink) {
value = "emission://login_token?token=" + value;
}

return <QRCode className="qr-code" value={value} style={[{ width: '100%', height: '100%' }, rest.style] as any} {...rest} />;
};

Expand Down
2 changes: 1 addition & 1 deletion www/js/control/ProfileSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const ProfileSettings = () => {
const StartPrefs = getAngularService('StartPrefs');

//functions that come directly from an Angular service
const editCollectionConfig = () => setEditCollection(true);
const editCollectionConfig = () => setEditCollectionVis(true);
const editSyncConfig = () => setEditSync(true);

//states and variables used to control/create the settings
Expand Down
18 changes: 14 additions & 4 deletions www/js/onboarding/WelcomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Button, Dialog, Divider, IconButton, Surface, Text, TextInput, Touchabl
import color from 'color';
import { initByUser } from '../config/dynamicConfig';
import { AppContext } from '../App';
import { displayError } from "../plugin/logger";
import { displayError, logDebug } from "../plugin/logger";
import { onboardingStyles } from './OnboardingStack';
import { Icon } from '../components/Icon';

Expand All @@ -20,12 +20,22 @@ const WelcomePage = () => {
const [infoPopupVis, setInfoPopupVis] = useState(false);
const [existingToken, setExistingToken] = useState('');

const checkURL = function (result) {
let notCancelled = result.cancelled == false;
let isQR = result.format == "QR_CODE";
let hasPrefix = result.text.split(":")[0] == "emission";
let hasToken = result.text.includes("login_token?token");

logDebug("QR code " + result.text + " checks: cancel, format, prefix, params " + notCancelled + isQR + hasPrefix + hasToken);

return notCancelled && isQR && hasPrefix && hasToken;
}

const scanCode = function() {
window.cordova.plugins.barcodeScanner.scan(
window['cordova'].plugins.barcodeScanner.scan(
function (result) {
console.debug("scanned code", result);
if (result.format == "QR_CODE" &&
result.cancelled == false) {
if (checkURL(result)) {
let text = result.text.split("=")[1];
console.log("found code", text);
loginWithToken(text);
Expand Down
Loading