π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix legacy sheet PDF typography
Neeraj Guptacd69847f2764
diff --git a/mobile/packages/legacy/assets/fonts/Nunito-Black.ttf b/mobile/packages/legacy/assets/fonts/Nunito-Black.ttfnew file mode 100644index 0000000000..99491f840fBinary files /dev/null and b/mobile/packages/legacy/assets/fonts/Nunito-Black.ttf differdiff --git a/mobile/packages/legacy/assets/legacy_kit_sheet_person_icon.svg b/mobile/packages/legacy/assets/legacy_kit_sheet_person_icon.svgnew file mode 100644index 0000000000..5b1e33bbbe--- /dev/null+++ b/mobile/packages/legacy/assets/legacy_kit_sheet_person_icon.svg@@ -0,0 +1,3 @@+<svg preserveAspectRatio="none" width="100%" height="100%" overflow="visible" style="display: block;" viewBox="0 0 9 11" fill="none" xmlns="http://www.w3.org/2000/svg">+<path id="Vector" d="M1.7595 2.67964C1.7595 1.96888 2.04832 1.28722 2.56215 0.784807C3.0765 0.282411 3.77315 0 4.50006 0C5.22696 0 5.92358 0.282397 6.43796 0.784807C6.95178 1.2872 7.24061 1.96889 7.24061 2.67964C7.24061 3.38988 6.95179 4.07152 6.43796 4.57393C5.92361 5.07686 5.22696 5.35874 4.50006 5.35874C3.77315 5.35874 3.07653 5.07687 2.56215 4.57393C2.04833 4.07154 1.7595 3.38985 1.7595 2.67964ZM4.89815 5.64116H4.10199C3.01431 5.64222 1.97204 6.0653 1.20288 6.81731C0.434312 7.56933 0.00162 8.58841 0 9.65198C0.000540831 10.0745 0.295851 10.4421 0.715569 10.5431C1.95307 10.8472 3.22408 11.0005 4.5 11C5.7759 11.0005 7.047 10.8472 8.28443 10.5431C8.70414 10.4421 8.99946 10.0745 9 9.65198C8.99838 8.58847 8.56569 7.56937 7.79712 6.81731C7.028 6.0653 5.9859 5.64222 4.89815 5.64116Z" fill="#FFFFFF"/>+</svg>diff --git a/mobile/packages/legacy/lib/services/legacy_kit_pdf_service.dart b/mobile/packages/legacy/lib/services/legacy_kit_pdf_service.dartindex 002a3bd56e..f1fb495151 100644--- a/mobile/packages/legacy/lib/services/legacy_kit_pdf_service.dart+++ b/mobile/packages/legacy/lib/services/legacy_kit_pdf_service.dart@@ -20,6 +20,9 @@ class LegacyKitPdfService {"$_assetRoot/legacy_kit_sheet_ente_logo_black.svg";static const String _enteComBadgeAsset ="$_assetRoot/legacy_kit_sheet_ente_com_badge.svg";+ static const String _personIconAsset =+ "$_assetRoot/legacy_kit_sheet_person_icon.svg";+ static const String _nunitoBlackAsset = "$_assetRoot/fonts/Nunito-Black.ttf";static const String _interRegularAsset = "assets/fonts/Inter-Regular.ttf";static const String _interMediumAsset = "assets/fonts/Inter-Medium.ttf";static const String _interBoldAsset = "assets/fonts/Inter-Bold.ttf";@@ -28,6 +31,7 @@ class LegacyKitPdfService {static const PdfColor _background = PdfColor.fromInt(0xFFFAFAFA);static const PdfColor _green = PdfColor.fromInt(0xFF08C225);static const PdfColor _blue = PdfColor.fromInt(0xFF1071FF);+ static const PdfColor _heroBadge = PdfColor.fromInt(0xFF0A48A3);static const PdfColor _dark = PdfColor.fromInt(0xFF212121);static const PdfColor _black = PdfColor.fromInt(0xFF000000);static const PdfColor _white = PdfColor.fromInt(0xFFFFFFFF);@@ -69,6 +73,7 @@ class LegacyKitPdfService {final interRegular = await _loadFont(_interRegularAsset);final interMedium = await _loadFont(_interMediumAsset);final interBold = await _loadFont(_interBoldAsset);+ final nunitoBlack = await _loadFont(_nunitoBlackAsset);final baseFont = interMedium ?? interRegular;return _SheetAssets(@@ -78,6 +83,8 @@ class LegacyKitPdfService {logoSvg: await _loadSvg(_logoAsset),enteLogoBlackSvg: await _loadSvg(_enteLogoBlackAsset),enteComBadgeSvg: await _loadSvg(_enteComBadgeAsset),+ personIconSvg: await _loadSvg(_personIconAsset),+ nunitoBlack: nunitoBlack,theme: baseFont == null && interBold == null? null: pw.ThemeData.withFont(@@ -195,6 +202,7 @@ class LegacyKitPdfService {style: pw.TextStyle(color: _black,fontSize: 15.7,+ font: assets.nunitoBlack,fontWeight: pw.FontWeight.bold,),),@@ -212,6 +220,7 @@ class LegacyKitPdfService {style: pw.TextStyle(color: _black,fontSize: 20,+ font: assets.nunitoBlack,fontWeight: pw.FontWeight.bold,),),@@ -311,6 +320,7 @@ class LegacyKitPdfService {style: pw.TextStyle(color: const PdfColor.fromInt(0xFF1C1C1C),fontSize: 20,+ font: assets.nunitoBlack,fontWeight: pw.FontWeight.bold,),),@@ -377,7 +387,7 @@ class LegacyKitPdfService {pw.Positioned(left: 24,top: 24,- child: _heroCopy(accountEmail, share),+ child: _heroCopy(accountEmail, share, assets),),if (assets.duckyImage != null)pw.Positioned(@@ -396,7 +406,11 @@ class LegacyKitPdfService {);}- pw.Widget _heroCopy(String accountEmail, LegacyKitShare share) {+ pw.Widget _heroCopy(+ String accountEmail,+ LegacyKitShare share,+ _SheetAssets assets,+ ) {return pw.SizedBox(width: 344,child: pw.Column(@@ -416,43 +430,20 @@ class LegacyKitPdfService {style: pw.TextStyle(color: _white,fontSize: 32,+ font: assets.nunitoBlack,fontWeight: pw.FontWeight.bold,lineSpacing: 0,),),pw.SizedBox(height: 12),- pw.Container(- width: 278,- height: 32,- padding: const pw.EdgeInsets.symmetric(horizontal: 12),- decoration: const pw.BoxDecoration(- color: PdfColor(0, 0, 0, 0.36),- borderRadius: pw.BorderRadius.all(pw.Radius.circular(12)),- ),- child: pw.Row(- children: [- _personIcon(),- pw.SizedBox(width: 6),- pw.Expanded(- child: pw.Text(- "Legacy Kit for $accountEmail",- maxLines: 1,- overflow: pw.TextOverflow.clip,- style: const pw.TextStyle(- color: _white,- fontSize: 14,- ),- ),- ),- ],- ),- ),+ _legacyKitBadge(accountEmail, assets),pw.SizedBox(height: 12),pw.Text("Store this somewhere safe",style: pw.TextStyle(color: _white,fontSize: 16,+ font: assets.nunitoBlack,fontWeight: pw.FontWeight.bold,lineSpacing: 3,),@@ -471,18 +462,67 @@ class LegacyKitPdfService {);}- pw.Widget _personIcon() {+ pw.Widget _legacyKitBadge(String accountEmail, _SheetAssets assets) {+ return pw.Container(+ width: 278,+ height: 32,+ decoration: const pw.BoxDecoration(+ color: _heroBadge,+ borderRadius: pw.BorderRadius.all(pw.Radius.circular(12)),+ ),+ child: pw.Stack(+ children: [+ pw.Positioned(+ left: 15,+ top: 10,+ child: _legacyKitBadgeIcon(assets),+ ),+ pw.Positioned(+ left: 31,+ top: 8,+ child: pw.SizedBox(+ width: 237,+ height: 16,+ child: pw.Center(+ child: pw.FittedBox(+ fit: pw.BoxFit.scaleDown,+ child: pw.Text(+ "Legacy Kit for $accountEmail",+ maxLines: 1,+ style: const pw.TextStyle(+ color: _white,+ fontSize: 14,+ ),+ ),+ ),+ ),+ ),+ ),+ ],+ ),+ );+ }++ pw.Widget _legacyKitBadgeIcon(_SheetAssets assets) {+ final personIconSvg = assets.personIconSvg;+ if (personIconSvg != null) {+ return pw.SizedBox(+ width: 9,+ height: 11,+ child: pw.SvgImage(svg: personIconSvg),+ );+ }return pw.SizedBox(- width: 12,- height: 12,+ width: 9,+ height: 11,child: pw.Stack(children: [pw.Positioned(- left: 4,- top: 2,+ left: 2.2,+ top: 0,child: pw.Container(- width: 4,- height: 4,+ width: 4.6,+ height: 5.4,decoration: const pw.BoxDecoration(color: _white,shape: pw.BoxShape.circle,@@ -490,14 +530,14 @@ class LegacyKitPdfService {),),pw.Positioned(- left: 2.5,- top: 6.5,+ left: 0,+ top: 5.6,child: pw.Container(- width: 7,- height: 3.5,+ width: 9,+ height: 5.4,decoration: const pw.BoxDecoration(color: _white,- borderRadius: pw.BorderRadius.all(pw.Radius.circular(3)),+ borderRadius: pw.BorderRadius.all(pw.Radius.circular(4)),),),),@@ -759,6 +799,8 @@ class _SheetAssets {final String? logoSvg;final String? enteLogoBlackSvg;final String? enteComBadgeSvg;+ final String? personIconSvg;+ final pw.Font? nunitoBlack;final pw.ThemeData? theme;const _SheetAssets({@@ -768,6 +810,8 @@ class _SheetAssets {required this.logoSvg,required this.enteLogoBlackSvg,required this.enteComBadgeSvg,+ required this.personIconSvg,+ required this.nunitoBlack,required this.theme,});}