Browse Source

Add AndroidClient backend to lua/main.cpp

Miku AuahDark 4 years ago
parent
commit
3817bac7db
3 changed files with 10 additions and 7 deletions
  1. 0 6
      src/android/AndroidClient.cpp
  2. 1 1
      src/android/AndroidClient.h
  3. 9 0
      src/lua/main.cpp

+ 0 - 6
src/android/AndroidClient.cpp

@@ -29,12 +29,6 @@ std::string replace(const std::string &str, const std::string &from, const std::
 	return ss.str();
 }
 
-std::string fromJavaMUTF(const std::string &str)
-{
-	static std::string null("", 1);
-	return replace(str, "\xC0\x80", null);
-}
-
 jstring newStringUTF(JNIEnv *env, const std::string &str)
 {
 	static std::string null("", 1);

+ 1 - 1
src/android/AndroidClient.h

@@ -12,7 +12,7 @@ class AndroidClient: public HTTPSClient
 {
 public:
 	AndroidClient();
-	
+
 	bool valid() const override;
 	HTTPSClient::Reply request(const HTTPSClient::Request &req) override;
 

+ 9 - 0
src/lua/main.cpp

@@ -16,6 +16,9 @@
 #ifdef USE_NSURL_BACKEND
 #	include "macos/NSURLClient.h"
 #endif
+#ifdef USE_ANDROID_BACKEND
+#	include "android/AndroidClient.h"
+#endif
 
 #ifdef USE_CURL_BACKEND
 	static CurlClient curlclient;
@@ -29,6 +32,9 @@
 #ifdef USE_NSURL_BACKEND
 	static NSURLClient nsurlclient;
 #endif
+#ifdef USE_ANDROID_BACKEND
+	static AndroidClient androidclient;
+#endif
 
 static HTTPSClient *clients[] = {
 #ifdef USE_CURL_BACKEND
@@ -42,6 +48,9 @@ static HTTPSClient *clients[] = {
 #endif
 #ifdef USE_NSURL_BACKEND
 	&nsurlclient,
+#endif
+#ifdef USE_ANDROID_BACKEND
+	&androidclient,
 #endif
 	nullptr,
 };