From 72b82ef6edc53259e8b358107160864621701983 Mon Sep 17 00:00:00 2001 From: Rokkubro Date: Wed, 24 May 2023 02:06:14 +1000 Subject: [PATCH] Enable web services on Android in Github build (#6555) * Enable web services in android * Fix web services build on android * clang-format * Remove unnecessary line * Set telemetry to be disabled by default on all platforms --- src/android/app/build.gradle | 1 - src/android/app/src/main/jni/config.cpp | 2 +- src/android/app/src/main/jni/default_ini.h | 2 +- src/citra/config.cpp | 2 +- src/citra/default_ini.h | 2 +- src/citra_qt/configuration/config.cpp | 2 +- src/citra_qt/main.cpp | 4 ++-- src/web_service/nus_download.cpp | 2 ++ 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/android/app/build.gradle b/src/android/app/build.gradle index feb0dfa44..803f8562c 100644 --- a/src/android/app/build.gradle +++ b/src/android/app/build.gradle @@ -106,7 +106,6 @@ android { cmake { arguments "-DENABLE_QT=0", // Don't use QT "-DENABLE_SDL2=0", // Don't use SDL - "-DENABLE_WEB_SERVICE=0", // Don't use telemetry "-DANDROID_ARM_NEON=true", // cryptopp requires Neon to work "-DBUNDLE_SPEEX=ON" diff --git a/src/android/app/src/main/jni/config.cpp b/src/android/app/src/main/jni/config.cpp index bb0a89989..8c3273279 100644 --- a/src/android/app/src/main/jni/config.cpp +++ b/src/android/app/src/main/jni/config.cpp @@ -274,7 +274,7 @@ void Config::ReadValues() { // Web Service NetSettings::values.enable_telemetry = - sdl2_config->GetBoolean("WebService", "enable_telemetry", true); + sdl2_config->GetBoolean("WebService", "enable_telemetry", false); NetSettings::values.web_api_url = sdl2_config->GetString("WebService", "web_api_url", "https://api.citra-emu.org"); NetSettings::values.citra_username = sdl2_config->GetString("WebService", "citra_username", ""); diff --git a/src/android/app/src/main/jni/default_ini.h b/src/android/app/src/main/jni/default_ini.h index c75ee63c8..68e356b6f 100644 --- a/src/android/app/src/main/jni/default_ini.h +++ b/src/android/app/src/main/jni/default_ini.h @@ -334,7 +334,7 @@ gdbstub_port=24689 [WebService] # Whether or not to enable telemetry -# 0: No, 1 (default): Yes +# 0 (default): No, 1: Yes enable_telemetry = # URL for Web API web_api_url = https://api.citra-emu.org diff --git a/src/citra/config.cpp b/src/citra/config.cpp index d8d93a9a8..09fda6ca5 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -313,7 +313,7 @@ void Config::ReadValues() { // Web Service NetSettings::values.enable_telemetry = - sdl2_config->GetBoolean("WebService", "enable_telemetry", true); + sdl2_config->GetBoolean("WebService", "enable_telemetry", false); NetSettings::values.web_api_url = sdl2_config->GetString("WebService", "web_api_url", "https://api.citra-emu.org"); NetSettings::values.citra_username = sdl2_config->GetString("WebService", "citra_username", ""); diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index c958a8a96..1a1aa1758 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h @@ -349,7 +349,7 @@ renderer_debug = [WebService] # Whether or not to enable telemetry -# 0: No, 1 (default): Yes +# 0 (default): No, 1: Yes enable_telemetry = # URL for Web API web_api_url = https://api.citra-emu.org diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index fcb268d32..e89556aee 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -803,7 +803,7 @@ void Config::ReadWebServiceValues() { qt_config->beginGroup(QStringLiteral("WebService")); NetSettings::values.enable_telemetry = - ReadSetting(QStringLiteral("enable_telemetry"), true).toBool(); + ReadSetting(QStringLiteral("enable_telemetry"), false).toBool(); NetSettings::values.web_api_url = ReadSetting(QStringLiteral("web_api_url"), QStringLiteral("https://api.citra-emu.org")) .toString() diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 6a99129c6..a39932f3d 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -145,8 +145,8 @@ void GMainWindow::ShowTelemetryCallout() { tr("Anonymous " "data is collected to help improve Citra. " "

Would you like to share your usage data with us?"); - if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) { - NetSettings::values.enable_telemetry = false; + if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) == QMessageBox::Yes) { + NetSettings::values.enable_telemetry = true; Settings::Apply(); } } diff --git a/src/web_service/nus_download.cpp b/src/web_service/nus_download.cpp index 6811f5c23..af7a068a6 100644 --- a/src/web_service/nus_download.cpp +++ b/src/web_service/nus_download.cpp @@ -21,6 +21,8 @@ std::optional> Download(const std::string& path) { httplib::Request request{ .method = "GET", .path = path, + // Needed when httplib is included on android + .matches = httplib::Match(), }; client->set_follow_location(true);