From ae501e256ea462268dbae8109ad07ef457c4fd8e Mon Sep 17 00:00:00 2001 From: Maufeat Date: Sat, 17 Jan 2026 01:48:15 +0100 Subject: [bcat/news/web/am] Implement news applet, proper TLV return, external web browser URL and qlaunch app sorting (#3308) This pulls eden releases changelog & text from our github releases. We don't store the msgpack file but rather generate them in-memory for the News Applet. Uses cache folder. Files generated are: - cache/news/github_releases.json - cache/news/eden_logo.jpg - cache/news/news_read Additional changes: - Proper TLV returning for online web applet, to open external URL - Add applet type `LHub` to properly close, as it also uses TLV return - qlaunch app sorting, adds another cached .json to track last launched app timestamps and sort them accordingly Co-authored-by: crueter Co-authored-by: DraVee Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3308 Reviewed-by: MaranBr Reviewed-by: DraVee Reviewed-by: Lizzie Co-authored-by: Maufeat Co-committed-by: Maufeat --- .../main/java/org/yuzu/yuzu_emu/NativeLibrary.kt | 12 ++++++++ .../org/yuzu/yuzu_emu/applets/web/WebBrowser.kt | 35 ++++++++++++++++++++++ src/android/app/src/main/jni/native.cpp | 4 ++- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/web/WebBrowser.kt (limited to 'src/android') diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt index 65d13ba2ba..8919f25fd6 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt @@ -26,6 +26,7 @@ import org.yuzu.yuzu_emu.model.InstallResult import org.yuzu.yuzu_emu.model.Patch import org.yuzu.yuzu_emu.model.GameVerificationResult import org.yuzu.yuzu_emu.network.NetPlayManager +import org.yuzu.yuzu_emu.applets.web.WebBrowser /** * Class which contains methods that interact @@ -457,6 +458,17 @@ object NativeLibrary { */ external fun setCurrentAppletId(appletId: Int) + /** + * Launch external URL when Web applet and opens browser + * + * @param String URL + */ + @Keep + @JvmStatic + fun openExternalUrl(url: String) { + WebBrowser.openExternal(url) + } + /** * Sets the cabinet mode for launching the cabinet applet. * diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/web/WebBrowser.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/web/WebBrowser.kt new file mode 100644 index 0000000000..898c88f4ac --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/web/WebBrowser.kt @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +package org.yuzu.yuzu_emu.applets.web + +import android.content.Intent +import android.net.Uri +import androidx.annotation.Keep +import org.yuzu.yuzu_emu.NativeLibrary +import org.yuzu.yuzu_emu.utils.Log + +/** + Should run WebBrowser as a new intent. +*/ + +@Keep +object WebBrowser { + @JvmStatic + fun openExternal(url: String) { + val activity = NativeLibrary.sEmulationActivity.get() ?: run { + return + } + + activity.runOnUiThread { + try { + val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply { + addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + } + activity.startActivity(intent) + } catch (e: Exception) { + Log.error("WebBrowser failed to launch $url: ${e.message}") + } + } + } +} diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index e656c2edad..5746659b68 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -66,6 +66,7 @@ #include "core/frontend/applets/profile_select.h" #include "core/frontend/applets/software_keyboard.h" #include "core/frontend/applets/web_browser.h" +#include "common/android/applets/web_browser.h" #include "core/hle/service/am/applet_manager.h" #include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/filesystem/filesystem.h" @@ -275,6 +276,7 @@ Core::SystemResultStatus EmulationSession::InitializeEmulation(const std::string // Initialize system. jauto android_keyboard = std::make_unique(); + jauto android_webapplet = std::make_unique(); m_software_keyboard = android_keyboard.get(); m_system.SetShuttingDown(false); m_system.ApplySettings(); @@ -289,7 +291,7 @@ Core::SystemResultStatus EmulationSession::InitializeEmulation(const std::string nullptr, // Photo Viewer nullptr, // Profile Selector std::move(android_keyboard), // Software Keyboard - nullptr, // Web Browser + std::move(android_webapplet),// Web Browser nullptr, // Net Connect }); -- cgit v1.2.3