Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/sync-telegram-sdk-emojis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ jobs:
node-version: 24
cache: npm

- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
cache: pip

- name: Install SVG to TGS converter
run: python -m pip install "lottie==0.7.2"

- name: Install dependencies
run: npm ci

Expand Down
12 changes: 0 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,5 @@
},
"devDependencies": {
"sharp": "^0.35.0"
},
"dependencies": {
"svgpath": "^2.6.0"
}
}
10 changes: 1 addition & 9 deletions packages/apk-webui/src/app/sdk-icon-cache.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { sanitizeImageSrc } from "./format.js";
import { COMPONENT_SECTIONS } from "./report-model.js";
import { BUILD_FEATURE_ICON_NAMES, BUILD_FEATURE_ICON_SVGS } from "@shared/build-feature-icons.js";
import libcheckerRulesCoreUrl from "@shared/generated/libchecker-rules-core.js?url";
import libcheckerRulesDetailUrl from "@shared/generated/libchecker-rules-detail.js?url";
import libcheckerSdkIconsUrl from "@shared/generated/libchecker-sdk-icons.js?url";
Expand All @@ -18,15 +19,6 @@ let sdkSingleColorIconNamesPromise = null;
let sdkRuleDetailMap = null;
let sdkRuleDetailMapPromise = null;
const sdkIconDataUriCache = new Map();
const GRADLE_FEATURE_ICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 1024 1024\" fill=\"none\"><path d=\"M868.5 255.6c-23.2-23.3-54.6-36.6-87.5-37.2-32.9-.5-64.7 11.7-88.7 34.1-1.2 1.2-2.2 2.6-2.9 4.1-.6 1.5-.9 3.2-.9 4.8 0 1.7.3 3.3.9 4.9.7 1.5 1.7 2.9 2.9 4l15.3 15.7c2 2 4.8 3.3 7.7 3.4 2.9.2 5.8-.6 8.1-2.4 14.6-11.7 33.3-17.3 51.9-15.6 18.7 1.7 36 10.6 48.3 24.7 12.4 14.2 18.7 32.6 17.8 51.3-.9 18.8-9.1 36.4-22.7 49.3C718 497.3 583.6 215.2 278.5 360.6c-5.2 2.5-9.7 6-13.5 10.3-3.7 4.4-6.5 9.4-8.1 14.9-1.7 5.5-2.2 11.2-1.6 16.9.7 5.7 2.5 11.1 5.4 16.1l52.4 90.4c5.4 9.4 14.3 16.3 24.8 19.2 10.5 2.9 21.7 1.5 31.2-3.9l1.2-.7-1 .7 23-12.8c25.8-16 50.3-34.3 73-54.5 2.3-2 5.2-3.2 8.2-3.3 3.1-.1 6.1.9 8.5 2.8 1.2 1.1 2.3 2.4 3 3.9.8 1.6 1.2 3.2 1.2 4.9.1 1.7-.2 3.3-.9 4.9-.6 1.5-1.6 2.9-2.8 4.1-24 21.6-49.8 41-77.2 58h-.8l-23.2 13c-9.8 5.5-20.8 8.4-32.1 8.4-11.6 0-23-3-33.1-8.8-10.1-5.8-18.5-14.1-24.4-24.2l-49.5-85.4c-94.6 67.3-152.8 196.8-121.3 360.7.5 2.7 2 5.2 4.1 7 2.2 1.8 4.9 2.8 7.7 2.8h55.8c3.1.1 6.1-1 8.4-3 2.3-2.1 3.7-4.9 4-8 2.6-19.8 12.4-38.1 27.4-51.3 15.1-13.2 34.4-20.4 54.5-20.4 20 0 39.3 7.2 54.4 20.4 15.1 13.2 24.8 31.5 27.4 51.3.4 2.9 1.8 5.6 4 7.6 2.2 1.9 5 3 7.9 3h54.6c2.9 0 5.8-1.1 8-3 2.1-2 3.6-4.7 3.9-7.6 2.6-19.8 12.4-38.1 27.5-51.3 15-13.2 34.4-20.4 54.4-20.4s39.4 7.2 54.4 20.4c15.1 13.2 24.8 31.5 27.5 51.3.3 2.9 1.7 5.6 3.9 7.6 2.2 1.9 5 3 8 3h54.2c3.2 0 6.2-1.2 8.5-3.5 2.2-2.2 3.5-5.2 3.6-8.4 1.2-76.5 21.8-164.3 80.6-208.3C969.2 433.2 915.6 302.7 868.5 255.6ZM661 485.5 622.1 466c0-4.1 1.1-8.2 3.1-11.8 2-3.7 5-6.7 8.5-8.9 3.5-2.2 7.6-3.4 11.7-3.6 4.2-.2 8.3.7 12 2.6 3.8 1.8 6.9 4.6 9.3 8.1 2.3 3.4 3.7 7.4 4.1 11.5.3 4.2-.4 8.4-2.1 12.1-1.7 3.8-4.4 7.1-7.7 9.6v-.1Z\" fill=\"#02303A\" /></svg>";
const BUILD_FEATURE_ICON_NAMES = {
compose: "ic_lib_jetpack_compose",
kotlin: "ic_lib_jetbrain_kmp",
};
const BUILD_FEATURE_ICON_SVGS = {
agp: GRADLE_FEATURE_ICON_SVG,
gradle: GRADLE_FEATURE_ICON_SVG,
};

/**
* @param {ApkReport} report
Expand Down
9 changes: 9 additions & 0 deletions packages/shared/src/build-feature-icons.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions scripts/svg-to-tgs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python3
import argparse
import sys

from lottie.exporters.core import export_tgs
from lottie.parsers.svg import parse_svg_file
from lottie.utils.stripper import float_strip


def main() -> int:
parser = argparse.ArgumentParser(description="Convert an SVG icon to Telegram TGS.")
parser.add_argument("input_svg")
parser.add_argument("output_tgs")
args = parser.parse_args()

try:
with open(args.input_svg, "r", encoding="utf-8") as input_file:
animation = parse_svg_file(input_file, n_frames=60, framerate=60)
float_strip(animation)
export_tgs(animation, args.output_tgs, sanitize=True, validate=True)
except Exception as error:
sys.stderr.write(f"SVG to TGS conversion failed: {error}\n")
return 1

return 0


if __name__ == "__main__":
raise SystemExit(main())
Loading