tinode / chat

Instant messaging platform. Backend in Go. Clients: Swift iOS, Java Android, JS webapp, scriptable command line; chatbots
GNU General Public License v3.0
11.94k stars 1.87k forks source link

QRсode add ability for groups, channels, users #857

Closed piratov closed 7 months ago

piratov commented 1 year ago

1 Add possibility for groups and channels shares QRCode 2 Share QRCode user contacts (vCard)

Screenshot_6Screenshot_7

thx!

Grabber commented 1 year ago

nayuki

https://github.com/nayuki/QR-Code-generator/releases

html

<script src="/qrcodegen-v1.8.0-es6.min.js"></script>

js/utils

export function drawNayukiQrCanvas(qr, scale, border, lightColor, darkColor, canvas) {
  if (scale <= 0) scale = 1;
  if (border < 0) border = 0;
  const width = (qr.size + border * 2) * scale;
  canvas.width = width;
  canvas.height = width;
  let ctx = canvas.getContext("2d");
  for (let y = -border; y < qr.size + border; y++) {
    for (let x = -border; x < qr.size + border; x++) {
      ctx.fillStyle = qr.getModule(x, y) ? darkColor : lightColor;
      ctx.fillRect((x + border) * scale, (y + border) * scale, scale, scale);
    }
  }
}

js

const text = "Hello, world!";
const errCorLvl = qrcodegen.QrCode.Ecc.MEDIUM;
const qr = qrcodegen.QrCode.encodeText(text, errCorLvl);
drawNayukiQrCanvas(qr, 12, 1, "#ffffff", "#000000", qrcodeRef);
or-else commented 7 months ago

Android: added in https://github.com/tinode/tindroid/commit/d594bcb033937d519345a738b38a7bfa8513e3ba

or-else commented 7 months ago

IOS: https://github.com/tinode/ios/commit/57e96aacb5847f8433b4f77542d92f51773a07a2

or-else commented 7 months ago

WebApp: https://github.com/tinode/webapp/commit/9eaa172030e21ec8b2ec9eff46d5f14bd596e0fc