mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
generate qr code svg (#2815)
* generate qr code svg prototype * qr code for groups fix formatting * - letter avatar in qrcode - escape xml in userinput (display/groupname) - fix "Me" display name - merge import declarations * remove dot at the end of VerifyContactQRDescription * if addr == displayname, show only one of them Especially useful for yggmail accounts without usernames, because the text would overflow otherwise. * use real clipPath for rounded avatar * - center avatar text better (dominant-baseline) - add "sans-serif" to font fallback for text if arial is missing * make corner always blue * add [logo + "get.delta.chat"] footer to qrcode * Update deltachat-ffi/deltachat.h Co-authored-by: bjoern <r10s@b44t.com> * Apply suggestions from code review Co-authored-by: bjoern <r10s@b44t.com> * new card design - add stockstrings - update changelog * make qrcode pixels also #f2f2f2 instead of full white * rename VERIFY_CONTACT_QR_DESC to SETUP_CONTACT make footer text a tiny bit darker upon r10s's request * avoid using which is a doxygen command * point out that one will join a group (this is still shorted and was also suggested in recent chats) * add option to generate qr-code-svg to repl tool * use same font-family in text and footer * thinner card border * remove superfluous <tspan> from footer to make color tweaking easier * move font-weight to style, ios renderer does not pick it up from attribute; remove default font attributes not used consequently * make get.delta.chat more visible * align properly using dominant-baseline=central and alignment-baseline=middle, this makes things nice on all systems but android (before, ios was wrong and all others not 100% aligned as font metrics are ignored) (android needs a subsequent improvement) Co-authored-by: bjoern <r10s@b44t.com>
This commit is contained in:
@@ -25,6 +25,7 @@ use std::time::{Duration, SystemTime};
|
||||
use anyhow::Context as _;
|
||||
use async_std::sync::RwLock;
|
||||
use async_std::task::{block_on, spawn};
|
||||
use deltachat::qr_code_generator::get_securejoin_qr_svg;
|
||||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
|
||||
use deltachat::chat::{ChatId, ChatVisibility, MuteDuration, ProtectionStatus};
|
||||
@@ -2075,6 +2076,27 @@ pub unsafe extern "C" fn dc_get_securejoin_qr(
|
||||
.strdup()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_get_securejoin_qr_svg(
|
||||
context: *mut dc_context_t,
|
||||
chat_id: u32,
|
||||
) -> *mut libc::c_char {
|
||||
if context.is_null() {
|
||||
eprintln!("ignoring careless call to generate_verification_qr()");
|
||||
return "".strdup();
|
||||
}
|
||||
let ctx = &*context;
|
||||
let chat_id = if chat_id == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(ChatId::new(chat_id))
|
||||
};
|
||||
|
||||
block_on(get_securejoin_qr_svg(ctx, chat_id))
|
||||
.unwrap_or_else(|_| "".to_string())
|
||||
.strdup()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_join_securejoin(
|
||||
context: *mut dc_context_t,
|
||||
|
||||
Reference in New Issue
Block a user