diff options
| author | Maufeat <sahyno1996@gmail.com> | 2026-01-17 01:48:15 +0100 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-01-17 01:48:15 +0100 |
| commit | ae501e256ea462268dbae8109ad07ef457c4fd8e (patch) | |
| tree | b36691663a10be26462d68f562ad51b8c697ee7b /src/android/app | |
| parent | b7417f68ce10145e5eb282110e7d50f46ec8047b (diff) | |
[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 <crueter@eden-emu.dev>
Co-authored-by: DraVee <dravee@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3308
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: DraVee <dravee@eden-emu.dev>
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Co-authored-by: Maufeat <sahyno1996@gmail.com>
Co-committed-by: Maufeat <sahyno1996@gmail.com>
Diffstat (limited to 'src/android/app')
3 files changed, 50 insertions, 1 deletions
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 @@ -458,6 +459,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. * * @param cabinetMode One of the modes that corresponds to the enum in Service::NFP::CabinetMode 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<Common::Android::SoftwareKeyboard::AndroidKeyboard>(); + jauto android_webapplet = std::make_unique<Common::Android::WebBrowser::AndroidWebBrowser>(); 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 }); |
