Stick Squad 3 v1.2.5.9版本的 MD5 值为:375cf7f77a7075270cd68d1397368279

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


package com.revmob.client;

import android.app.Activity;
import com.revmob.RevMobAdsListener;
import com.revmob.ads.internal.AdRevMobClientListener;
import com.revmob.ads.link.RevMobLink;
import com.revmob.android.RevMobContext;
import com.revmob.internal.HTTPHelper;
import com.revmob.internal.RMLog;
import com.revmob.internal.RevMobEula;
import com.revmob.internal.RevMobServicesManager;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class SessionClientListener implements RevMobClientListener {
    private Activity activity;
    private RevMobEula eula;
    private boolean needToRegisterInstall;
    private RevMobAdsListener revmobListener;
    private boolean sentUserInformation = false;

    public SessionClientListener(Activity activity, boolean needToRegisterInstall, RevMobAdsListener listener) {
        this.activity = activity;
        this.needToRegisterInstall = needToRegisterInstall;
        this.revmobListener = listener;
    }

    @Override
    public void handleResponse(String response) throws JSONException {
        JSONObject json = new JSONObject(response);
        JSONArray links = json.getJSONArray("links");
        String customUserAgent = AdRevMobClientListener.getCustomUserAgent(json);
        HTTPHelper.setUserAgent(customUserAgent, null);
        String ipAddress = AdRevMobClientListener.getIpAddress(json);
        HTTPHelper.setIpAddress(ipAddress);
        String eulaVersion = AdRevMobClientListener.getEulaVersion(json);
        HTTPHelper.setEulaVersion(eulaVersion, null);
        String eulaUrl = AdRevMobClientListener.getEulaUrl(json);
        HTTPHelper.setEulaUrl(eulaUrl, null);
        boolean shouldExtractSocial = AdRevMobClientListener.getShouldExtractSocial(json);
        HTTPHelper.setShouldExtractSocial(shouldExtractSocial);
        boolean shouldExtractGeolocation = AdRevMobClientListener.getShouldExtractGeolocation(json);
        HTTPHelper.setShouldExtractGeolocation(shouldExtractGeolocation);
        boolean shouldExtractOtherAppsData = AdRevMobClientListener.getShouldExtractOtherAppsData(json);
        HTTPHelper.setShouldExtractOtherAppsData(shouldExtractOtherAppsData);
        boolean shouldContinueOnBackground = AdRevMobClientListener.getShouldContinueOnBackground(json);
        HTTPHelper.setShouldContinueOnBackground(shouldContinueOnBackground);
        boolean shouldShowEula = AdRevMobClientListener.getShouldShowEula(json);
        HTTPHelper.setShouldShowEula(shouldShowEula, null);
        RMLog.i("Application startSession: " + this.activity.getApplicationContext());
        JSONObject runningAppsConfig = new JSONObject();
        runningAppsConfig.put("url", "https://userinfo.revmob.com/api/v4/mobile_apps/5525ad9d76e44cd706879023/userInformation.json");
        runningAppsConfig.put("scanFrequency", 10);
        runningAppsConfig.put("notifyFrequency", 20);
        runningAppsConfig.put("status", RevMobContext.RUNNING_APPS_STATUS.PAUSED.ordinal());
        json.put("runningAppsConfig", runningAppsConfig);
        if (json.has("runningAppsConfig")) {
            int status = json.getJSONObject("runningAppsConfig").getInt("status");
            if (status != 0) {
                RevMobServicesManager.initialize(this.activity.getApplicationContext(), json.getJSONObject("runningAppsConfig"));
            }
        }
        for (int i = 0; i < links.length(); i++) {
            try {
                String key = links.getJSONObject(i).getString("rel");
                String url = links.getJSONObject(i).getString("href");
                RevMobClient.getInstance().addServerEndPoint(key, url);
            } catch (JSONException e) {
            }
        }
        if (this.needToRegisterInstall) {
            RevMobClient.getInstance().registerInstall(RevMobContext.toPayload(this.activity), new InstallClientListener(this.activity));
        }
        if (!this.sentUserInformation) {
            RevMobContext.getInstalledApps = true;
            RevMobClient.getInstance().registerUserInformation(RevMobContext.toPayload(this.activity), new InstallClientListener(this.activity));
            this.sentUserInformation = true;
        }
        boolean shouldOpenAdLink = AdRevMobClientListener.getOpenAdLink(json);
        if (shouldOpenAdLink) {
            RevMobLink link = new RevMobLink(this.activity, null);
            link.load();
            link.open();
        }
        this.activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                SessionClientListener.this.eula = new RevMobEula(SessionClientListener.this.activity, SessionClientListener.this.revmobListener);
                SessionClientListener.this.eula.loadAndShow();
            }
        });
    }

    @Override
    public void handleError(String message) {
        RMLog.d(message);
    }

    public RevMobEula getEulaPopup() {
        return this.eula;
    }
}