feat(account): add QR invitation poster and 8-character invitation codes

- Invite opens an appearance-matched poster with the app icon, inviter name,
  QR code, and short code; tap for a full-brightness QR view; save (add-only
  Photos access), share, or copy the link. Mac shows the poster in a popover
  and can save it as PNG.
- Accounts get look-alike-free 8-character codes. "I have a code" accepts a
  code, link, or pasted message during the server-defined binding window.
- Permanently rejected redemptions show a specific message and drop the
  stored code instead of retrying on every sign-in.
This commit is contained in:
2026-10-20 20:06:36 +02:00
parent eaacc35cf7
commit 03bfbbe08b
26 changed files with 2269 additions and 86 deletions
@@ -17,6 +17,13 @@ public enum OSGColor {
public static let fixedLightContent = Color.white
public static let fixedDarkContent = Color.black
// MARK: - Invitation poster
/// Shared artwork must look identical for every recipient, so these do not
/// follow the app appearance. The background matches the app icon.
public static let invitePosterBackground = color(0x252527)
public static let invitePosterHint = color(0xA1A1A6)
// MARK: - iOS app theme
public static let darkBackground = color(0x0A0A0B)
+15
View File
@@ -498,6 +498,16 @@
"mac.account.invite.rewarded" = "Rewarded invites";
"mac.account.invite.pending" = "Pending invites";
"mac.account.invite.footnote" = "Both of you get credits once an invited friend qualifies.";
"mac.account.invite.qr" = "QR Code";
"mac.account.invite.qrHint" = "Scan with a phone, or save the poster and send it to a friend.";
"mac.account.invite.savePoster" = "Save Poster…";
"mac.account.invite.saveFailed" = "Couldn’t save the poster.";
"invite.poster.slogan" = "Your AI voice double";
"invite.poster.hint" = "Scan to try it and earn credits";
"invite.poster.defaultInviter" = "OSG User";
"invite.poster.inviter" = "%@ invites you to try\nOSG AI Keyboard";
"invite.poster.scan" = "Scan to download and enter the code to earn credits";
"invite.poster.code" = "Invitation code: %@";
"mac.account.delete.title" = "Delete Account";
"mac.account.delete.body" = "Deleting removes your account and any remaining credits. This cannot be undone.";
"mac.account.delete.action" = "Delete Account…";
@@ -523,6 +533,11 @@
"account.referral.error.notFound" = "Your invitation link isn’t available yet.";
"account.referral.error.session" = "Sign in again to load your invitation link.";
"account.referral.error.unavailable" = "The invitation service is temporarily unavailable.";
"account.referral.redeem.error.invalid" = "This invitation link is invalid, or the campaign has ended.";
"account.referral.redeem.error.expired" = "The time to add an invitation to this account has passed.";
"account.referral.redeem.error.self" = "You can’t use your own invitation.";
"account.referral.redeem.error.alreadyBound" = "This account has already accepted another invitation.";
"account.referral.redeem.error.ineligible" = "This account can’t accept this invitation.";
/* Rime / typing engine errors */
"error.rime.appGroupUnavailable" = "App Group unavailable.";
@@ -498,6 +498,16 @@
"mac.account.invite.rewarded" = "已奖励邀请";
"mac.account.invite.pending" = "待生效邀请";
"mac.account.invite.footnote" = "受邀好友达成条件后,双方都可获得积分。";
"mac.account.invite.qr" = "二维码";
"mac.account.invite.qrHint" = "用手机扫码,或保存海报发给好友。";
"mac.account.invite.savePoster" = "保存海报…";
"mac.account.invite.saveFailed" = "海报保存失败。";
"invite.poster.slogan" = "你的 AI 嘴替";
"invite.poster.hint" = "扫一扫 · 下载体验领积分";
"invite.poster.defaultInviter" = "OSG 用户";
"invite.poster.inviter" = "%@ 邀你体验\nOSG AI 输入法";
"invite.poster.scan" = "扫码下载,输入邀请码获取积分";
"invite.poster.code" = "邀请码:%@";
"mac.account.delete.title" = "注销账号";
"mac.account.delete.body" = "注销会删除你的账号及剩余积分,且无法撤销。";
"mac.account.delete.action" = "注销账号…";
@@ -523,6 +533,11 @@
"account.referral.error.notFound" = "邀请链接暂不可用。";
"account.referral.error.session" = "请重新登录后加载邀请链接。";
"account.referral.error.unavailable" = "邀请服务暂时不可用。";
"account.referral.redeem.error.invalid" = "邀请链接无效,或活动已结束。";
"account.referral.redeem.error.expired" = "这个账号已超过补填邀请的期限。";
"account.referral.redeem.error.self" = "不能使用自己的邀请。";
"account.referral.redeem.error.alreadyBound" = "这个账号已经接受过其他好友的邀请。";
"account.referral.redeem.error.ineligible" = "这个账号暂时不能接受该邀请。";
/* 输入法引擎错误 */
"error.rime.appGroupUnavailable" = "App Group 不可用。";