榴莲视频 v8.0.2版本的 MD5 值为:0db3bc9ae2f0505c4bdfea37acaf972e

以下内容为反编译后的 ToastLL.java 源代码,内容仅作参考


package com.ll354tsdasds.ll354tsdasds;

import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.google.gson.Gson;
import com.kiwi.sdk.Kiwi;
import com.umeng.analytics.pro.b;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
public class ToastLL extends ReactContextBaseJavaModule {
    private static String KIWIHOST = "";
    private static final String LONG_TIME = "LONG";
    private static String MESSAGE = "MESSAGE";
    private static final String SHORT_TIME = "SHORT";
    private static String[] hostArray = {"https://oqwudhy.com", "https://cewoicjief.com", "https://sfrgwhgre.com"};

    @Override
    public boolean canOverrideExistingModule() {
        return true;
    }

    @Override
    public String getName() {
        return "KiwiForAndroid";
    }

    public ToastLL(ReactApplicationContext reactApplicationContext) {
        super(reactApplicationContext);
        for (int i = 0; i < 3; i++) {
            try {
                URL url = new URL(hostArray[i] + "/api/get-config?key=sdk-key");
                Log.d("kiwidemo", "kiwi host parse url:" + hostArray[i]);
                HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
                httpURLConnection.setUseCaches(false);
                httpURLConnection.setInstanceFollowRedirects(true);
                httpURLConnection.setRequestProperty("Content-Type", "application/json");
                httpURLConnection.setRequestProperty("Accept", "application/json");
                httpURLConnection.setRequestMethod("GET");
                httpURLConnection.setConnectTimeout(5000);
                httpURLConnection.setReadTimeout(5000);
                try {
                    httpURLConnection.connect();
                    int responseCode = httpURLConnection.getResponseCode();
                    StringBuilder sb = new StringBuilder();
                    if (responseCode >= 100 && responseCode < 400) {
                        if (responseCode >= 300) {
                            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getErrorStream()));
                            while (true) {
                                String readLine = bufferedReader.readLine();
                                if (readLine == null) {
                                    break;
                                }
                                sb.append(readLine);
                            }
                            bufferedReader.close();
                        } else {
                            BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
                            while (true) {
                                String readLine2 = bufferedReader2.readLine();
                                if (readLine2 == null) {
                                    break;
                                }
                                sb.append(readLine2);
                            }
                            bufferedReader2.close();
                        }
                        if (parse(sb.toString()) == 200) {
                            break;
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
        Log.d("kiwidemo", "kiwi host Toast Init" + KIWIHOST);
    }

    public int parse(String str) {
        SdkKeyResponse sdkKeyResponse = (SdkKeyResponse) new Gson().fromJson(str, (Class<Object>) SdkKeyResponse.class);
        if (sdkKeyResponse.code == 200) {
            Log.d("kiwidemo", "kiwi host parse name:" + sdkKeyResponse.rescont.name);
            if (sdkKeyResponse.rescont.value.length() > 0) {
                Log.d("kiwidemo", "kiwi host parse value:" + sdkKeyResponse.rescont.value);
                KIWIHOST = initKiwi(sdkKeyResponse.rescont.name, sdkKeyResponse.rescont.value);
            }
        }
        return sdkKeyResponse.code;
    }

    private String initKiwi(String str, String str2) {
        StringBuffer stringBuffer;
        StringBuffer stringBuffer2;
        Kiwi.Init(str2);
        int ServerToLocal = Kiwi.ServerToLocal(str, new StringBuffer(), new StringBuffer());
        if (ServerToLocal < 0) {
            Log.d("kiwidemo", "call ServerToLocal failed " + ServerToLocal);
            return "";
        }
        String str3 = "http://" + stringBuffer.toString() + ":" + stringBuffer2.toString() + "/api";
        Log.d("kiwidemo", "kiwi host " + str3);
        return str3;
    }

    @ReactMethod
    public void getHostName(Callback callback) {
        Log.d("kiwidemo", "kiwi Reative Module getHostName Callback" + KIWIHOST);
        try {
            if (TextUtils.isEmpty(KIWIHOST)) {
                callback.invoke("");
            } else {
                callback.invoke(KIWIHOST);
            }
        } catch (Exception unused) {
            callback.invoke("");
        }
    }

    @ReactMethod
    public void getDataFromIntent(Callback callback) {
        try {
            String stringExtra = getCurrentActivity().getIntent().getStringExtra("data");
            if (TextUtils.isEmpty(stringExtra)) {
                callback.invoke("no_data");
            } else {
                callback.invoke(stringExtra);
            }
        } catch (Exception unused) {
            callback.invoke(b.N);
        }
    }

    @Override
    public Map<String, Object> getConstants() {
        HashMap hashMap = new HashMap();
        hashMap.put(LONG_TIME, 1);
        hashMap.put(SHORT_TIME, 0);
        hashMap.put(MESSAGE, "getConstants");
        return hashMap;
    }

    @ReactMethod
    public void show(int i) {
        ReactApplicationContext reactApplicationContext = getReactApplicationContext();
        Toast.makeText(reactApplicationContext, "message:" + i, i).show();
    }

    @ReactMethod
    public void passStringBackToRN(Callback callback) {
        callback.invoke("This is a string from Native");
    }

    @ReactMethod
    public void sendEvent() {
        onScanningResult();
    }

    @ReactMethod
    public void testAndroidCallbackMethod(String str, Callback callback) {
        Toast.makeText(getReactApplicationContext(), str, 1).show();
        callback.invoke(str);
    }

    @ReactMethod
    public void textAndroidPromiseMethod(String str, Promise promise) {
        Toast.makeText(getReactApplicationContext(), str, 0).show();
        promise.resolve("谢汉杰");
    }

    public void onScanningResult() {
        WritableMap createMap = Arguments.createMap();
        createMap.putString("key", "myData");
        sendEvent(getReactApplicationContext(), "EventName", createMap);
    }

    public static void sendEvent(ReactContext reactContext, String str, @Nullable WritableMap writableMap) {
        ((DeviceEventManagerModule.RCTDeviceEventEmitter) reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)).emit(str, writableMap);
    }

    public void nativeCallRn() {
        onScanningResult();
    }
}