From b5d5256c61001777bced32a5d22094f244a0297d Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Fri, 22 Nov 2024 14:38:58 -0600 Subject: [PATCH] UI: Add a show changelog button in the Updater, for new updates & when you're on the latest version. --- Directory.Packages.props | 4 +-- src/Ryujinx.Common/ReleaseInformation.cs | 9 +++++ src/Ryujinx/Assets/Locales/ar_SA.json | 1 + src/Ryujinx/Assets/Locales/de_DE.json | 1 + src/Ryujinx/Assets/Locales/el_GR.json | 1 + src/Ryujinx/Assets/Locales/en_US.json | 1 + src/Ryujinx/Assets/Locales/es_ES.json | 1 + src/Ryujinx/Assets/Locales/fr_FR.json | 1 + src/Ryujinx/Assets/Locales/he_IL.json | 1 + src/Ryujinx/Assets/Locales/it_IT.json | 1 + src/Ryujinx/Assets/Locales/ja_JP.json | 1 + src/Ryujinx/Assets/Locales/ko_KR.json | 1 + src/Ryujinx/Assets/Locales/pl_PL.json | 1 + src/Ryujinx/Assets/Locales/pt_BR.json | 1 + src/Ryujinx/Assets/Locales/ru_RU.json | 1 + src/Ryujinx/Assets/Locales/th_TH.json | 1 + src/Ryujinx/Assets/Locales/tr_TR.json | 1 + src/Ryujinx/Assets/Locales/uk_UA.json | 1 + src/Ryujinx/Assets/Locales/zh_CN.json | 1 + src/Ryujinx/Assets/Locales/zh_TW.json | 1 + src/Ryujinx/UI/Helpers/ContentDialogHelper.cs | 34 +++++++++++++++++++ src/Ryujinx/Updater.cs | 33 +++++++++++++----- 22 files changed, 87 insertions(+), 11 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index c0ace079d..ffb5f2ead 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -38,7 +38,7 @@ - + @@ -52,4 +52,4 @@ - \ No newline at end of file + diff --git a/src/Ryujinx.Common/ReleaseInformation.cs b/src/Ryujinx.Common/ReleaseInformation.cs index f4c62155a..011d9848a 100644 --- a/src/Ryujinx.Common/ReleaseInformation.cs +++ b/src/Ryujinx.Common/ReleaseInformation.cs @@ -1,3 +1,4 @@ +using System; using System.Reflection; namespace Ryujinx.Common @@ -35,5 +36,13 @@ namespace Ryujinx.Common public static bool IsReleaseBuild => IsValid && ReleaseChannelName.Equals(ReleaseChannel); public static string Version => IsValid ? BuildVersion : Assembly.GetEntryAssembly()!.GetCustomAttribute()?.InformationalVersion; + + public static string GetChangelogUrl(Version currentVersion, Version newVersion) => + IsCanaryBuild + ? $"https://github.com/{ReleaseChannelOwner}/{ReleaseChannelSourceRepo}/compare/Canary-{currentVersion}...Canary-{newVersion}" + : $"https://github.com/{ReleaseChannelOwner}/{ReleaseChannelSourceRepo}/releases/tag/{newVersion}"; + + public static string GetChangelogForVersion(Version version) => + $"https://github.com/{ReleaseChannelOwner}/{ReleaseChannelRepo}/releases/tag/{version}"; } } diff --git a/src/Ryujinx/Assets/Locales/ar_SA.json b/src/Ryujinx/Assets/Locales/ar_SA.json index 6dbc96135..c937a2eed 100644 --- a/src/Ryujinx/Assets/Locales/ar_SA.json +++ b/src/Ryujinx/Assets/Locales/ar_SA.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "جاري استخراج التحديث...", "DialogUpdaterRenamingMessage": "إعادة تسمية التحديث...", "DialogUpdaterAddingFilesMessage": "إضافة تحديث جديد...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "اكتمل التحديث", "DialogUpdaterRestartMessage": "هل تريد إعادة تشغيل ريوجينكس الآن؟", "DialogUpdaterNoInternetMessage": "أنت غير متصل بالإنترنت.", diff --git a/src/Ryujinx/Assets/Locales/de_DE.json b/src/Ryujinx/Assets/Locales/de_DE.json index be95f3bc0..c27de5608 100644 --- a/src/Ryujinx/Assets/Locales/de_DE.json +++ b/src/Ryujinx/Assets/Locales/de_DE.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "Update wird entpackt...", "DialogUpdaterRenamingMessage": "Update wird umbenannt...", "DialogUpdaterAddingFilesMessage": "Update wird hinzugefügt...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "Update abgeschlossen!", "DialogUpdaterRestartMessage": "Ryujinx jetzt neu starten?", "DialogUpdaterNoInternetMessage": "Es besteht keine Verbindung mit dem Internet!", diff --git a/src/Ryujinx/Assets/Locales/el_GR.json b/src/Ryujinx/Assets/Locales/el_GR.json index c6cfb9d62..d47c8b9fe 100644 --- a/src/Ryujinx/Assets/Locales/el_GR.json +++ b/src/Ryujinx/Assets/Locales/el_GR.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "Εξαγωγή Ενημέρωσης...", "DialogUpdaterRenamingMessage": "Μετονομασία Ενημέρωσης...", "DialogUpdaterAddingFilesMessage": "Προσθήκη Νέας Ενημέρωσης...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "Η Ενημέρωση Ολοκληρώθηκε!", "DialogUpdaterRestartMessage": "Θέλετε να επανεκκινήσετε το Ryujinx τώρα;", "DialogUpdaterNoInternetMessage": "Δεν είστε συνδεδεμένοι στο Διαδίκτυο!", diff --git a/src/Ryujinx/Assets/Locales/en_US.json b/src/Ryujinx/Assets/Locales/en_US.json index 9354c8a41..23135866d 100644 --- a/src/Ryujinx/Assets/Locales/en_US.json +++ b/src/Ryujinx/Assets/Locales/en_US.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "Extracting Update...", "DialogUpdaterRenamingMessage": "Renaming Update...", "DialogUpdaterAddingFilesMessage": "Adding New Update...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "Update Complete!", "DialogUpdaterRestartMessage": "Do you want to restart Ryujinx now?", "DialogUpdaterNoInternetMessage": "You are not connected to the Internet!", diff --git a/src/Ryujinx/Assets/Locales/es_ES.json b/src/Ryujinx/Assets/Locales/es_ES.json index 6a194960b..8456040ce 100644 --- a/src/Ryujinx/Assets/Locales/es_ES.json +++ b/src/Ryujinx/Assets/Locales/es_ES.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "Extrayendo actualización...", "DialogUpdaterRenamingMessage": "Renombrando actualización...", "DialogUpdaterAddingFilesMessage": "Aplicando actualización...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "¡Actualización completa!", "DialogUpdaterRestartMessage": "¿Quieres reiniciar Ryujinx?", "DialogUpdaterNoInternetMessage": "¡No estás conectado a internet!", diff --git a/src/Ryujinx/Assets/Locales/fr_FR.json b/src/Ryujinx/Assets/Locales/fr_FR.json index dd23bef76..f17a7ba95 100644 --- a/src/Ryujinx/Assets/Locales/fr_FR.json +++ b/src/Ryujinx/Assets/Locales/fr_FR.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "Extraction de la mise à jour…", "DialogUpdaterRenamingMessage": "Renommage de la mise à jour...", "DialogUpdaterAddingFilesMessage": "Ajout d'une nouvelle mise à jour...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "Mise à jour terminée !", "DialogUpdaterRestartMessage": "Voulez-vous redémarrer Ryujinx maintenant ?", "DialogUpdaterNoInternetMessage": "Vous n'êtes pas connecté à Internet !", diff --git a/src/Ryujinx/Assets/Locales/he_IL.json b/src/Ryujinx/Assets/Locales/he_IL.json index b9f89eb37..f0cf4eb68 100644 --- a/src/Ryujinx/Assets/Locales/he_IL.json +++ b/src/Ryujinx/Assets/Locales/he_IL.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "מחלץ עדכון...", "DialogUpdaterRenamingMessage": "משנה את שם העדכון...", "DialogUpdaterAddingFilesMessage": "מוסיף עדכון חדש...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "העדכון הושלם!", "DialogUpdaterRestartMessage": "האם אתם רוצים להפעיל מחדש את ריוג'ינקס עכשיו?", "DialogUpdaterNoInternetMessage": "אתם לא מחוברים לאינטרנט!", diff --git a/src/Ryujinx/Assets/Locales/it_IT.json b/src/Ryujinx/Assets/Locales/it_IT.json index f10dd9d35..dd408bf5b 100644 --- a/src/Ryujinx/Assets/Locales/it_IT.json +++ b/src/Ryujinx/Assets/Locales/it_IT.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "Estrazione dell'aggiornamento...", "DialogUpdaterRenamingMessage": "Rinominazione dell'aggiornamento...", "DialogUpdaterAddingFilesMessage": "Aggiunta del nuovo aggiornamento...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "Aggiornamento completato!", "DialogUpdaterRestartMessage": "Vuoi riavviare Ryujinx adesso?", "DialogUpdaterNoInternetMessage": "Non sei connesso ad Internet!", diff --git a/src/Ryujinx/Assets/Locales/ja_JP.json b/src/Ryujinx/Assets/Locales/ja_JP.json index 34253acbf..244730494 100644 --- a/src/Ryujinx/Assets/Locales/ja_JP.json +++ b/src/Ryujinx/Assets/Locales/ja_JP.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "アップデートを展開中...", "DialogUpdaterRenamingMessage": "アップデートをリネーム中...", "DialogUpdaterAddingFilesMessage": "新規アップデートを追加中...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "アップデート完了!", "DialogUpdaterRestartMessage": "すぐに Ryujinx を再起動しますか?", "DialogUpdaterNoInternetMessage": "インターネットに接続されていません!", diff --git a/src/Ryujinx/Assets/Locales/ko_KR.json b/src/Ryujinx/Assets/Locales/ko_KR.json index 5bda1565b..47a619054 100644 --- a/src/Ryujinx/Assets/Locales/ko_KR.json +++ b/src/Ryujinx/Assets/Locales/ko_KR.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "업데이트 추출 중...", "DialogUpdaterRenamingMessage": "이름 변경 업데이트...", "DialogUpdaterAddingFilesMessage": "새 업데이트 추가 중...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "업데이트가 완료되었습니다!", "DialogUpdaterRestartMessage": "지금 Ryujinx를 다시 시작하시겠습니까?", "DialogUpdaterNoInternetMessage": "인터넷에 연결되어 있지 않습니다!", diff --git a/src/Ryujinx/Assets/Locales/pl_PL.json b/src/Ryujinx/Assets/Locales/pl_PL.json index 015530833..cfa9d7a76 100644 --- a/src/Ryujinx/Assets/Locales/pl_PL.json +++ b/src/Ryujinx/Assets/Locales/pl_PL.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "Wypakowywanie Aktualizacji...", "DialogUpdaterRenamingMessage": "Zmiana Nazwy Aktualizacji...", "DialogUpdaterAddingFilesMessage": "Dodawanie Nowej Aktualizacji...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "Aktualizacja Zakończona!", "DialogUpdaterRestartMessage": "Czy chcesz teraz zrestartować Ryujinx?", "DialogUpdaterNoInternetMessage": "Nie masz połączenia z Internetem!", diff --git a/src/Ryujinx/Assets/Locales/pt_BR.json b/src/Ryujinx/Assets/Locales/pt_BR.json index 512581c0e..352fae46b 100644 --- a/src/Ryujinx/Assets/Locales/pt_BR.json +++ b/src/Ryujinx/Assets/Locales/pt_BR.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "Extraindo atualização...", "DialogUpdaterRenamingMessage": "Renomeando atualização...", "DialogUpdaterAddingFilesMessage": "Adicionando nova atualização...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "Atualização concluída!", "DialogUpdaterRestartMessage": "Deseja reiniciar o Ryujinx agora?", "DialogUpdaterNoInternetMessage": "Você não está conectado à Internet!", diff --git a/src/Ryujinx/Assets/Locales/ru_RU.json b/src/Ryujinx/Assets/Locales/ru_RU.json index 9d81116ef..112735e2d 100644 --- a/src/Ryujinx/Assets/Locales/ru_RU.json +++ b/src/Ryujinx/Assets/Locales/ru_RU.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "Извлечение обновления...", "DialogUpdaterRenamingMessage": "Переименование обновления...", "DialogUpdaterAddingFilesMessage": "Добавление нового обновления...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "Обновление завершено", "DialogUpdaterRestartMessage": "Перезапустить Ryujinx?", "DialogUpdaterNoInternetMessage": "Вы не подключены к интернету", diff --git a/src/Ryujinx/Assets/Locales/th_TH.json b/src/Ryujinx/Assets/Locales/th_TH.json index fa59ba682..35959ddbd 100644 --- a/src/Ryujinx/Assets/Locales/th_TH.json +++ b/src/Ryujinx/Assets/Locales/th_TH.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "กำลังแตกไฟล์อัปเดต...", "DialogUpdaterRenamingMessage": "กำลังลบไฟล์เก่า...", "DialogUpdaterAddingFilesMessage": "กำลังเพิ่มไฟล์อัปเดตใหม่...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "อัปเดตเสร็จสมบูรณ์แล้ว!", "DialogUpdaterRestartMessage": "คุณต้องการรีสตาร์ท Ryujinx ตอนนี้หรือไม่?", "DialogUpdaterNoInternetMessage": "คุณไม่ได้เชื่อมต่อกับอินเทอร์เน็ต!", diff --git a/src/Ryujinx/Assets/Locales/tr_TR.json b/src/Ryujinx/Assets/Locales/tr_TR.json index 9b321c423..5d50b67db 100644 --- a/src/Ryujinx/Assets/Locales/tr_TR.json +++ b/src/Ryujinx/Assets/Locales/tr_TR.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "Güncelleme Ayıklanıyor...", "DialogUpdaterRenamingMessage": "Güncelleme Yeniden Adlandırılıyor...", "DialogUpdaterAddingFilesMessage": "Yeni Güncelleme Ekleniyor...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "Güncelleme Tamamlandı!", "DialogUpdaterRestartMessage": "Ryujinx'i şimdi yeniden başlatmak istiyor musunuz?", "DialogUpdaterNoInternetMessage": "İnternete bağlı değilsiniz!", diff --git a/src/Ryujinx/Assets/Locales/uk_UA.json b/src/Ryujinx/Assets/Locales/uk_UA.json index 09a7e8cb4..a45208486 100644 --- a/src/Ryujinx/Assets/Locales/uk_UA.json +++ b/src/Ryujinx/Assets/Locales/uk_UA.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "Видобування оновлення...", "DialogUpdaterRenamingMessage": "Перейменування оновлення...", "DialogUpdaterAddingFilesMessage": "Додавання нового оновлення...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "Оновлення завершено!", "DialogUpdaterRestartMessage": "Перезапустити Ryujinx зараз?", "DialogUpdaterNoInternetMessage": "Ви не підключені до Інтернету!", diff --git a/src/Ryujinx/Assets/Locales/zh_CN.json b/src/Ryujinx/Assets/Locales/zh_CN.json index 11840e864..8a4995ea7 100644 --- a/src/Ryujinx/Assets/Locales/zh_CN.json +++ b/src/Ryujinx/Assets/Locales/zh_CN.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "正在提取更新...", "DialogUpdaterRenamingMessage": "正在重命名更新...", "DialogUpdaterAddingFilesMessage": "安装更新中...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "更新成功!", "DialogUpdaterRestartMessage": "是否立即重启 Ryujinx 模拟器?", "DialogUpdaterNoInternetMessage": "没有连接到网络", diff --git a/src/Ryujinx/Assets/Locales/zh_TW.json b/src/Ryujinx/Assets/Locales/zh_TW.json index d59df0e5b..5649ba00a 100644 --- a/src/Ryujinx/Assets/Locales/zh_TW.json +++ b/src/Ryujinx/Assets/Locales/zh_TW.json @@ -457,6 +457,7 @@ "DialogUpdaterExtractionMessage": "正在提取更新...", "DialogUpdaterRenamingMessage": "重新命名更新...", "DialogUpdaterAddingFilesMessage": "加入新更新...", + "DialogUpdaterShowChangelogMessage": "Show Changelog", "DialogUpdaterCompleteMessage": "更新成功!", "DialogUpdaterRestartMessage": "您現在要重新啟動 Ryujinx 嗎?", "DialogUpdaterNoInternetMessage": "您沒有連線到網際網路!", diff --git a/src/Ryujinx/UI/Helpers/ContentDialogHelper.cs b/src/Ryujinx/UI/Helpers/ContentDialogHelper.cs index a7fe3f0ce..3f0f0f033 100644 --- a/src/Ryujinx/UI/Helpers/ContentDialogHelper.cs +++ b/src/Ryujinx/UI/Helpers/ContentDialogHelper.cs @@ -261,6 +261,16 @@ namespace Ryujinx.Ava.UI.Helpers string.Empty, LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Important); + + internal static async Task CreateUpdaterUpToDateInfoDialog(string primary, string secondaryText) + => await ShowTextDialog( + LocaleManager.Instance[LocaleKeys.DialogUpdaterTitle], + primary, + secondaryText, + LocaleManager.Instance[LocaleKeys.DialogUpdaterShowChangelogMessage], + string.Empty, + LocaleManager.Instance[LocaleKeys.InputDialogOk], + (int)Symbol.Important); internal static async Task CreateWarningDialog(string primary, string secondaryText) => await ShowTextDialog( @@ -309,6 +319,30 @@ namespace Ryujinx.Ava.UI.Helpers return response == UserResult.Yes; } + + internal static async Task CreateUpdaterChoiceDialog(string title, string primary, string secondaryText) + { + if (_isChoiceDialogOpen) + { + return UserResult.Cancel; + } + + _isChoiceDialogOpen = true; + + UserResult response = await ShowTextDialog( + title, + primary, + secondaryText, + LocaleManager.Instance[LocaleKeys.InputDialogYes], + LocaleManager.Instance[LocaleKeys.DialogUpdaterShowChangelogMessage], + LocaleManager.Instance[LocaleKeys.InputDialogNo], + (int)Symbol.Help, + UserResult.Yes); + + _isChoiceDialogOpen = false; + + return response; + } internal static async Task CreateExitDialog() { diff --git a/src/Ryujinx/Updater.cs b/src/Ryujinx/Updater.cs index 9deff5e86..5f3ddb119 100644 --- a/src/Ryujinx/Updater.cs +++ b/src/Ryujinx/Updater.cs @@ -176,9 +176,14 @@ namespace Ryujinx.Ava { if (showVersionUpToDate) { - await ContentDialogHelper.CreateUpdaterInfoDialog( + UserResult userResult = await ContentDialogHelper.CreateUpdaterUpToDateInfoDialog( LocaleManager.Instance[LocaleKeys.DialogUpdaterAlreadyOnLatestVersionMessage], string.Empty); + + if (userResult is UserResult.Yes) + { + OpenHelper.OpenUrl(ReleaseInformation.GetChangelogForVersion(currentVersion)); + } } _running = false; @@ -206,19 +211,29 @@ namespace Ryujinx.Ava await Dispatcher.UIThread.InvokeAsync(async () => { + string newVersionString = ReleaseInformation.IsCanaryBuild + ? $"Canary {currentVersion} -> Canary {newVersion}" + : $"{currentVersion} -> {newVersion}"; + + RequestUserToUpdate: // Show a message asking the user if they want to update - var shouldUpdate = await ContentDialogHelper.CreateChoiceDialog( + UserResult shouldUpdate = await ContentDialogHelper.CreateUpdaterChoiceDialog( LocaleManager.Instance[LocaleKeys.RyujinxUpdater], LocaleManager.Instance[LocaleKeys.RyujinxUpdaterMessage], - $"{Program.Version} -> {newVersion}"); + newVersionString); - if (shouldUpdate) + switch (shouldUpdate) { - await UpdateRyujinx(mainWindow, _buildUrl); - } - else - { - _running = false; + case UserResult.Yes: + await UpdateRyujinx(mainWindow, _buildUrl); + break; + // Secondary button maps to no, which in this case is the show changelog button. + case UserResult.No: + OpenHelper.OpenUrl(ReleaseInformation.GetChangelogUrl(currentVersion, newVersion)); + goto RequestUserToUpdate; + default: + _running = false; + break; } }); }