Peer invitation refactor, Contact invitationId, Qrcode compression

This commit is contained in:
ycc
2022-11-27 21:08:34 +01:00
parent 2516b41597
commit 8195a22300
10 changed files with 466 additions and 128 deletions

View File

@ -3,7 +3,6 @@ package meowlib
import (
"bytes"
"compress/gzip"
"encoding/json"
"fmt"
"image"
"image/color"
@ -96,13 +95,14 @@ func (contact *ContactCard) WritePng(filename string) {
}
func (Contact *ContactCard) WriteQr(filename string) {
jsonContact, _ := json.Marshal(Contact)
//jsonContact, _ := json.Marshal(Contact)
jsonContact, _ := Contact.Compress()
qwriter := qrcode.NewQRCodeWriter()
code, err := qwriter.Encode(string(jsonContact), gozxing.BarcodeFormat_QR_CODE, 512, 512, nil)
if err != nil {
println(err.Error())
}
file, _ := os.Create("barcode.png")
file, _ := os.Create(filename)
defer file.Close()
// *BitMatrix implements the image.Image interface,