mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 09:48:58 +02:00
[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>
This commit is contained in:
parent
b7417f68ce
commit
ae501e256e
35 changed files with 2978 additions and 315 deletions
50
src/common/android/applets/web_browser.cpp
Normal file
50
src/common/android/applets/web_browser.cpp
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "common/android/android_common.h"
|
||||
#include "common/android/id_cache.h"
|
||||
#include "common/android/applets/web_browser.h"
|
||||
#include "common/logging/log.h"
|
||||
|
||||
static jclass s_native_library_class = nullptr;
|
||||
static jmethodID s_open_external_url = nullptr;
|
||||
|
||||
namespace Common::Android::WebBrowser {
|
||||
|
||||
void InitJNI(JNIEnv* env) {
|
||||
const jclass local = env->FindClass("org/yuzu/yuzu_emu/NativeLibrary");
|
||||
s_native_library_class = static_cast<jclass>(env->NewGlobalRef(local));
|
||||
env->DeleteLocalRef(local);
|
||||
s_open_external_url = env->GetStaticMethodID(s_native_library_class, "openExternalUrl", "(Ljava/lang/String;)V");
|
||||
}
|
||||
|
||||
void CleanupJNI(JNIEnv* env) {
|
||||
if (s_native_library_class != nullptr) {
|
||||
env->DeleteGlobalRef(s_native_library_class);
|
||||
s_native_library_class = nullptr;
|
||||
}
|
||||
s_open_external_url = nullptr;
|
||||
}
|
||||
|
||||
void AndroidWebBrowser::OpenLocalWebPage(const std::string& local_url, ExtractROMFSCallback extract_romfs_callback, OpenWebPageCallback callback) const {
|
||||
LOG_WARNING(Frontend, "(STUBBED)");
|
||||
callback(Service::AM::Frontend::WebExitReason::WindowClosed, "");
|
||||
}
|
||||
|
||||
void AndroidWebBrowser::OpenExternalWebPage(const std::string& external_url, OpenWebPageCallback callback) const {
|
||||
// do a dedicated thread, calling from the this thread crashed CPU fiber.
|
||||
Common::Android::RunJNIOnFiber<void>([&](JNIEnv* env) {
|
||||
if (env != nullptr && s_native_library_class != nullptr && s_open_external_url != nullptr) {
|
||||
const jstring j_url = Common::Android::ToJString(env, external_url);
|
||||
env->CallStaticVoidMethod(s_native_library_class, s_open_external_url, j_url);
|
||||
env->DeleteLocalRef(j_url);
|
||||
} else {
|
||||
LOG_ERROR(Frontend, "JNI not initialized, cannot open {}", external_url);
|
||||
}
|
||||
return;
|
||||
});
|
||||
|
||||
callback(Service::AM::Frontend::WebExitReason::WindowClosed, external_url);
|
||||
}
|
||||
|
||||
} // namespace Common::Android::WebBrowser
|
||||
30
src/common/android/applets/web_browser.h
Normal file
30
src/common/android/applets/web_browser.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <jni.h>
|
||||
#include <string>
|
||||
|
||||
#include "core/frontend/applets/web_browser.h"
|
||||
|
||||
namespace Common::Android::WebBrowser {
|
||||
|
||||
class AndroidWebBrowser final : public Core::Frontend::WebBrowserApplet {
|
||||
public:
|
||||
~AndroidWebBrowser() override = default;
|
||||
|
||||
void Close() const override {}
|
||||
|
||||
void OpenLocalWebPage(const std::string& local_url,
|
||||
ExtractROMFSCallback extract_romfs_callback,
|
||||
OpenWebPageCallback callback) const override;
|
||||
|
||||
void OpenExternalWebPage(const std::string& external_url,
|
||||
OpenWebPageCallback callback) const override;
|
||||
};
|
||||
|
||||
void InitJNI(JNIEnv* env);
|
||||
void CleanupJNI(JNIEnv* env);
|
||||
|
||||
} // namespace Common::Android::WebBrowser
|
||||
Loading…
Add table
Add a link
Reference in a new issue