diff --git a/include/APK.php b/include/APK.php index 7c118cf..e9f45ee 100644 --- a/include/APK.php +++ b/include/APK.php @@ -1,108 +1,120 @@ name = $name; $this->url = $url; $this->sha256 = $sha256; $this->ABI = $ABI; } /** * @return array */ public function getPhorgeCommentLines() { return [ // In Phorge the download link is inline // $this->getPhorgeDownloadLink(), $this->getPhorgeAPKSignatureLine(), ]; } /** * Get the ABI architecture. */ public function getABI(): string { // TODO: calculate this. return $this->ABI; } /** * Get the final URL. */ public function getURL(): string { return $this->url; } /** * Get the sha256 of the APK file. */ public function getHash(): string { return $this->sha256; } /** * @return array */ public function getTelegramCommentLines() { return [ $this->getTelegramDownloadLink(), - $this->getPhorgeAPKSignatureLine() + $this->getTelegramAPKSignatureLine() ]; } /** * Get a very generic download link for Phorge. * @return string */ public function getPhorgeDownloadLink(): string { return sprintf( "[%s](%s)", $this->name, $this->url ); } /** * Get a very generic download link for Phorge. * @return string */ public function getTelegramDownloadLink(): string { // In Telegram it seems we must escape the link text from special characters. // The link, instead, can be returned as-is. // For some reasons, an emoji cannot be inside the link lol. // So the Text from: "Download asd.apk" // to: "Download asd\\.apk" return sprintf( "⬇️ [%s](%s)", TelegramStupidSDK::escapeMarkdownV2("$this->name}"), $this->url ); } /** * Get a very generic line about the sha256sum of this APK. * @return string */ private function getPhorgeAPKSignatureLine() { return sprintf( "sha256 for %s: `%s`", $this->getABI(), $this->sha256 ); } + + /** + * Get a very generic line about the sha256sum of this APK. + * @return string + */ + private function getTelegramAPKSignatureLine() { + return sprintf( + "sha256 for %s: `%s`", + TelegramStupidSDK::escapeMarkdownV2($this->getABI()), + $this->sha256 + ); + } }