MCPcopy Index your code
hub / github.com/TGX-Android/Publisher / getBuildCaption

Function getBuildCaption

main.js:885–960  ·  view source on GitHub ↗
(build, sdkVariant, abiVariant, isPrivate, shortenChecksums)

Source from the content-addressed store, hash-verified

883}
884
885function getBuildCaption (build, sdkVariant, abiVariant, isPrivate, shortenChecksums) {
886 const fromToCommit = getFromToCommit(build,
887 build.googlePlayTrack && build.previousGooglePlayProductionBuild && build.previousGooglePlayBuild &&
888 build.previousGooglePlayBuild.version.code < build.previousGooglePlayProductionBuild.version.code
889 );
890
891 let caption = '<b>Version</b>: <code>' +
892 build.version.name +
893 (sdkVariant !== 'latest' ? '-' + sdkVariant : '') +
894 '-' + getDisplayVariant(abiVariant) +
895 '</code>';
896 if (fromToCommit) {
897 caption += '\n<b>Changes from ' + fromToCommit.from_version.code + '</b>: <a href="' + build.git.remoteUrl + '/compare/' + fromToCommit.commit_range + '">' + fromToCommit.commit_range + '</a>';
898 } else {
899 caption += '\n<b>Commit</b>: <a href="' + build.git.remoteUrl + '/tree/' + build.git.commit.long + '">' + build.git.commit.short + '</a>';
900 if (build.git.date) {
901 caption += ', ' + toDisplayDate(build.git.date);
902 }
903 }
904 if (build.pullRequestsMetadata || !empty(build.pullRequests)) {
905 caption += '\n<b>Pull requests</b>: ' + toDisplayPullRequestList(build);
906 }
907
908 switch (sdkVariant) {
909 case 'latest': {
910 // caption += '\n\n<b>For Android 6 (Marshmallow) devices.'
911 break;
912 }
913 case 'marshmallow': {
914 caption += '\n<b>Supports</b>: Android Marshmallow only (<b>23</b>)'
915 break;
916 }
917 case 'lollipop': {
918 caption += '\n<b>Supports</b>: Android Lollipop only (<b>21–22</b>)'
919 break;
920 }
921 case 'legacy': {
922 caption += '\n<b>Supports</b>: Android Jelly Bean & KitKat only (<b>16–20</b>)'
923 break;
924 }
925 }
926
927 const checksumAlgorithms = ['md5', 'sha1', 'sha256'];
928 if (!shortenChecksums) {
929 caption += '\n';
930 checksumAlgorithms.forEach((algorithm) => {
931 const hash = build.files[sdkVariant][abiVariant].apkFile.checksum[algorithm];
932 const url = 'https://t.me/tgx_bot?start=' + hash;
933 caption += '\n<b>' + toDisplayAlgorithm(algorithm) + '</b>: <a href="' + url + '">' + hash + '</a>';
934 });
935 }
936
937 caption += '\n\n';
938 caption += '#' + abiVariant + (sdkVariant !== 'latest' ? ucfirst(sdkVariant) : '');
939 switch (build.googlePlayTrack) {
940 case 'production': caption += ' #stable'; break;
941 case 'beta': caption += ' #beta'; break;
942 case 'alpha': caption += ' #alpha'; break;

Callers 2

publishToTelegramFunction · 0.85
uploadToTelegramFunction · 0.85

Calls 7

getFromToCommitFunction · 0.85
getDisplayVariantFunction · 0.85
toDisplayDateFunction · 0.85
emptyFunction · 0.85
toDisplayPullRequestListFunction · 0.85
toDisplayAlgorithmFunction · 0.85
ucfirstFunction · 0.85

Tested by

no test coverage detected