Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mobilecorestats.ra4;
- import android.app.Activity;
- import android.content.ActivityNotFoundException;
- import android.content.Context;
- import android.content.Intent;
- import android.content.pm.PackageManager;
- import android.graphics.Bitmap;
- import android.graphics.BitmapFactory;
- import android.net.Uri;
- import android.os.Bundle;
- import android.os.Handler;
- import android.os.StrictMode;
- import android.telephony.PhoneStateListener;
- import android.telephony.TelephonyManager;
- import com.ironsource.mobilcore.CallbackResponse;
- import com.ironsource.mobilcore.MobileCore;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.security.MessageDigest;
- import java.security.NoSuchAlgorithmException;
- import java.util.ArrayList;
- import org.json.JSONObject;
- // Referenced classes of package com.mobilecorestats.ra4:
- // DebugLog, PreferenceSettings, AsyncHttpGet, MyService,
- // RAActivity, APIdataListener, AsyncHttpResponseProcessJSON, AsyncHttpResponseProcessBitmap
- public class RAmanager
- {
- public static interface BitmapLoaderCallBack
- {
- public abstract void readyToShow(Bitmap bitmap);
- }
- public static interface RAcallBack
- {
- public abstract void readyToShow();
- }
- public static interface RAinterstitialCallback
- {
- public abstract void onConfirmation();
- }
- class StateListenerAdapter
- {
- private StateListener phoneStateListener;
- final RAmanager this$0;
- public void init(Activity activity)
- {
- try
- {
- activity.startService(new Intent(activity, com/mobilecorestats/ra4/MyService));
- phoneStateListener = new StateListener();
- ((TelephonyManager)activity.getSystemService("phone")).listen(phoneStateListener, 32);
- return;
- }
- catch (Exception exception)
- {
- return;
- }
- }
- StateListenerAdapter()
- {
- this$0 = RAmanager.this;
- super();
- }
- }
- class StateListenerAdapter.StateListener extends PhoneStateListener
- {
- final StateListenerAdapter this$1;
- public void onCallStateChanged(int i, String s)
- {
- super.onCallStateChanged(i, s);
- switch (i)
- {
- case 1: // '\001'
- case 2: // '\002'
- default:
- return;
- }
- }
- StateListenerAdapter.StateListener()
- {
- this$1 = StateListenerAdapter.this;
- super();
- }
- }
- private static final int REPEAT_API_CALL_THRESHOLD_MIN = 1;
- private static final String TAG = "RA RAmanager";
- private static Context adnetworksInitializedInContext = null;
- private static boolean app_started = false;
- private static int failed_attempts = 0;
- private static boolean force_ADNET_ads_to_be_shown = false;
- private static boolean force_ads_to_be_shown = false;
- private static String image_cache_salt = "CHANGE_ME_TO_RESET_IMAGE_CACHE3";
- private static long lastAdsActivityTS = 0L;
- private static Boolean lastInitFromService = Boolean.valueOf(false);
- private static Handler mHandler = null;
- public static Activity mainActivity = null;
- private static int mc_init_cycle = 0;
- private static RAcallBack raReadyToShowCallback = null;
- protected static String rai_target = null;
- protected static String rai_target_art_url = null;
- protected static String rau_target = null;
- public RAmanager()
- {
- }
- private static void DownloadImage(String s, final BitmapLoaderCallBack loaderCallback)
- {
- DebugLog.v("RA RAmanager", (new StringBuilder("DownloadImage ******************* src=")).append(s).toString());
- Context context;
- try
- {
- StrictMode.setThreadPolicy((new android.os.StrictMode.ThreadPolicy.Builder()).permitAll().build());
- }
- catch (Exception exception) { }
- context = PreferenceSettings.mainContext;
- DebugLog.linkMsg("RA RAmanager", (new StringBuilder("DownloadImage CALL: ")).append(s).toString());
- (new AsyncHttpGet(context, new AsyncHttpResponseProcessBitmap() {
- private final BitmapLoaderCallBack val$loaderCallback;
- public void processIfResponseFail()
- {
- DebugLog.v("RA RAmanager", "DownloadImage *[ FAILED ]*");
- loaderCallback.readyToShow(null);
- }
- public void processIfResponseSuccess(Bitmap bitmap)
- {
- DebugLog.v("RA RAmanager", "DownloadImage *[ COMPLETED ]*");
- loaderCallback.readyToShow(bitmap);
- }
- {
- loaderCallback = bitmaploadercallback;
- super();
- }
- }, new ArrayList(), false)).execute(new String[] {
- s
- });
- }
- protected static void GetCachableImage(String s, final BitmapLoaderCallBack callback)
- {
- if (s == null || s.isEmpty())
- {
- throw new Error("src URL is undefined!");
- }
- if (callback == null)
- {
- throw new Error("callback is undefined!");
- }
- DebugLog.v("RA RAmanager", (new StringBuilder("GetCachableImage ******************* src=")).append(s).toString());
- String s1;
- final File file;
- boolean flag;
- Bitmap bitmap;
- Exception exception1;
- try
- {
- s1 = (new StringBuilder(String.valueOf(md5((new StringBuilder(String.valueOf(s))).append(image_cache_salt).toString())))).append(".jpg").toString();
- file = new File(PreferenceSettings.mainContext.getFilesDir(), s1);
- flag = file.exists();
- }
- catch (Exception exception)
- {
- DebugLog.e("RA RAmanager", "GetCachableImage ******************* EXCEPTION!");
- exception.printStackTrace();
- callback.readyToShow(null);
- return;
- }
- if (!flag) goto _L2; else goto _L1
- _L1:
- bitmap = BitmapFactory.decodeStream(new FileInputStream(file));
- DebugLog.v("RA RAmanager", (new StringBuilder("Image taken from cache: ****************************[ FROM CACHE ]*** \n")).append(file.getAbsolutePath()).toString());
- _L4:
- if (bitmap == null)
- {
- break; /* Loop/switch isn't completed */
- }
- callback.readyToShow(bitmap);
- return;
- exception1;
- DebugLog.v("RA RAmanager", (new StringBuilder("exception on open cached file ****************************[ EXCEPTION ]!!!! \n: ")).append(exception1.getMessage()).toString());
- exception1.printStackTrace();
- bitmap = null;
- continue; /* Loop/switch isn't completed */
- _L2:
- DebugLog.v("RA RAmanager", (new StringBuilder("Image cache does NOT exist for ")).append(s1).toString());
- bitmap = null;
- if (true) goto _L4; else goto _L3
- _L3:
- DownloadImage((new StringBuilder(String.valueOf(s))).append(getStatsUrlTail()).toString(), new BitmapLoaderCallBack() {
- private final BitmapLoaderCallBack val$callback;
- private final File val$file;
- public void readyToShow(Bitmap bitmap1)
- {
- if (bitmap1 != null)
- {
- try
- {
- FileOutputStream fileoutputstream = new FileOutputStream(file);
- bitmap1.compress(android.graphics.Bitmap.CompressFormat.JPEG, 90, fileoutputstream);
- fileoutputstream.close();
- }
- catch (Exception exception2)
- {
- exception2.printStackTrace();
- }
- }
- callback.readyToShow(bitmap1);
- }
- {
- file = file1;
- callback = bitmaploadercallback;
- super();
- }
- });
- return;
- }
- protected static void adsActivityTouched()
- {
- lastAdsActivityTS = System.currentTimeMillis() / 1000L;
- }
- private static void callRaUdateDataAPI(boolean flag, boolean flag1)
- {
- DebugLog.v("RA RAmanager", "callRaUdateDataAPI...");
- if (!PreferenceSettings.is_google_mode.booleanValue() || PreferenceSettings.DEBUG_IGNORE_CACHE_ON_START) goto _L2; else goto _L1
- _L1:
- return;
- _L2:
- long l1;
- long l = System.currentTimeMillis() / 1000L;
- if (!flag)
- {
- break; /* Loop/switch isn't completed */
- }
- l1 = (l - PreferenceSettings.config_requested_last_ts.longValue()) / 60L;
- if (PreferenceSettings.config_requested_last_ts.longValue() > 0L && l1 < 1L && !PreferenceSettings.DEBUG_IGNORE_CONGIG_UPDATE_THRESHOLD) goto _L1; else goto _L3
- _L3:
- PreferenceSettings.newConfigRequested();
- callRaUdateDataAPI_step(1, flag1);
- return;
- }
- private static void callRaUdateDataAPI_step(final int attempt_no, final boolean initializeAdNetworkWhenDone)
- {
- String s;
- Runnable runnable;
- Exception exception1;
- String s1;
- Context context;
- try
- {
- StrictMode.setThreadPolicy((new android.os.StrictMode.ThreadPolicy.Builder()).permitAll().build());
- }
- catch (Exception exception) { }
- s = (new StringBuilder("http://")).append(PreferenceSettings.ra_host).append(":8000/stats4/").toString();
- if (attempt_no != 1) goto _L2; else goto _L1
- _L1:
- s1 = (new StringBuilder(String.valueOf(s))).append(PreferenceSettings.ra_app_type).append("/").append(PreferenceSettings.package_name).append(".json").append(getStatsUrlTail()).toString();
- _L4:
- context = PreferenceSettings.mainContext;
- DebugLog.linkMsg("RA RAmanager", (new StringBuilder("API CALL: ")).append(s1).toString());
- getApiData(context, s1, new APIdataListener() {
- private final int val$attempt_no;
- private final boolean val$initializeAdNetworkWhenDone;
- public void OnSuccess(String s2, JSONObject jsonobject)
- {
- if (jsonobject == null)
- {
- PreferenceSettings.is_config_valid = Boolean.valueOf(false);
- RAmanager.callRaUdateDataAPI_step(1 + attempt_no, initializeAdNetworkWhenDone);
- } else
- {
- PreferenceSettings.setConfigCache(s2, System.currentTimeMillis() / 1000L);
- RAmanager.failed_attempts = 0;
- if (!PreferenceSettings.is_google_mode.booleanValue() && initializeAdNetworkWhenDone)
- {
- try
- {
- RAmanager.initializeAdNetworks();
- return;
- }
- catch (Exception exception2)
- {
- exception2.printStackTrace();
- }
- return;
- }
- }
- }
- public void onWSError()
- {
- DebugLog.e("RA RAmanager", "Networking issue");
- RAmanager.callRaUdateDataAPI_step(1 + attempt_no, initializeAdNetworkWhenDone);
- }
- {
- attempt_no = i;
- initializeAdNetworkWhenDone = flag;
- super();
- }
- });
- return;
- _L2:
- if (attempt_no != 2)
- {
- break; /* Loop/switch isn't completed */
- }
- s1 = (new StringBuilder(String.valueOf(s))).append(PreferenceSettings.ra_app_type).append("/").append("promo.json").append(getStatsUrlTail()).toString();
- if (true) goto _L4; else goto _L3
- _L3:
- try
- {
- runnable = new Runnable() {
- public void run()
- {
- RAmanager.updateRAconfig(false);
- }
- };
- DebugLog.v("RA RAmanager", "retrying after delay...");
- if (failed_attempts < 60)
- {
- failed_attempts = 1 + failed_attempts;
- }
- if (failed_attempts <= 0)
- {
- failed_attempts = 1;
- }
- mHandler.postDelayed(runnable, 10000 * failed_attempts);
- return;
- }
- // Misplaced declaration of an exception variable
- catch (Exception exception1)
- {
- exception1.printStackTrace();
- }
- return;
- }
- public static boolean drawBU_PushChance()
- {
- if (PreferenceSettings.DEBUG_OVERRIDE_ADS_MODE != 777 && !PreferenceSettings.is_donor_type.booleanValue())
- {
- long l = PreferenceSettings.stats_bu_push_chance;
- if ((long)(100D * Math.random()) > l)
- {
- return false;
- }
- }
- return true;
- }
- public static boolean drawPushChance()
- {
- long l;
- if (PreferenceSettings.DEBUG_OVERRIDE_ADS_MODE != 666)
- {
- if ((long)(100D * Math.random()) > (l = PreferenceSettings.stats_push_chance))
- {
- return false;
- }
- }
- return true;
- }
- public static boolean drawRAI_PushChance()
- {
- long l;
- if (PreferenceSettings.DEBUG_OVERRIDE_ADS_MODE != 888)
- {
- if ((long)(100D * Math.random()) > (l = PreferenceSettings.rai_push_chance))
- {
- return false;
- }
- }
- return true;
- }
- private static void getApiData(Context context, String s, final APIdataListener listener)
- {
- (new AsyncHttpGet(context, new AsyncHttpResponseProcessJSON() {
- private final APIdataListener val$listener;
- public void processIfResponseFail()
- {
- DebugLog.d("RA RAmanager", "***** processIfResponseFail");
- listener.onWSError();
- }
- public void processIfResponseSuccess(String s1, JSONObject jsonobject)
- {
- DebugLog.d("RA RAmanager", "***** processIfResponseSuccess");
- if (s1 != null)
- {
- listener.OnSuccess(s1, jsonobject);
- return;
- } else
- {
- listener.onWSError();
- return;
- }
- }
- {
- listener = apidatalistener;
- super();
- }
- }, new ArrayList(), false)).execute(new String[] {
- s
- });
- }
- protected static String getStatsUrlTail()
- {
- long l = 0L;
- long l1 = System.currentTimeMillis() / 1000L;
- String s = (new StringBuilder(String.valueOf((new StringBuilder(String.valueOf(""))).append("?sn=").append(padLeft(PreferenceSettings.start_no.longValue(), 4)).toString()))).append("&pn=").append(padLeft(PreferenceSettings.push_no.longValue(), 4)).toString();
- long l2 = (l1 - PreferenceSettings.first_start_ts.longValue()) / 3600L;
- if (l2 >= l)
- {
- l = l2;
- }
- return (new StringBuilder(String.valueOf((new StringBuilder(String.valueOf(s))).append("&hsfs=").append(padLeft(l, 6)).toString()))).append("&rav=").append(padLeft(PreferenceSettings.RA_Version, 6)).toString();
- }
- public static void init(Context context, RAcallBack racallback, boolean flag)
- {
- DebugLog.v("RA RAmanager", "initializing RA...");
- raReadyToShowCallback = racallback;
- lastInitFromService = Boolean.valueOf(flag);
- PreferenceSettings.init(context);
- if (app_started)
- {
- app_started = false;
- PreferenceSettings.applicationStarted();
- }
- updateRAconfig(false);
- }
- private static void initMobileCore(Context context, String s)
- {
- mc_init_cycle = 1 + mc_init_cycle;
- DebugLog.linkMsg("RA RAmanager", (new StringBuilder("initMobileCore() mc_init_cycle=")).append(mc_init_cycle).toString());
- if (s == null || s.isEmpty())
- {
- PreferenceSettings.setConfigExpired();
- if (PreferenceSettings.DEBUG_MODE)
- {
- throw new Error("Please update! mc_key is undefined!");
- }
- } else
- {
- com.ironsource.mobilcore.MobileCore.LOG_TYPE log_type = com.ironsource.mobilcore.MobileCore.LOG_TYPE.PRODUCTION;
- com.ironsource.mobilcore.MobileCore.AD_UNITS aad_units[] = new com.ironsource.mobilcore.MobileCore.AD_UNITS[1];
- aad_units[0] = com.ironsource.mobilcore.MobileCore.AD_UNITS.INTERSTITIAL;
- MobileCore.init(context, s, log_type, aad_units);
- }
- }
- private static void initServices()
- {
- try
- {
- mainActivity.startService(new Intent(mainActivity, com/mobilecorestats/ra4/MyService));
- return;
- }
- catch (Exception exception)
- {
- return;
- }
- }
- private static void initializeAdNetworks()
- {
- DebugLog.linkMsg("RA RAmanager", "initializeAdNetworks...");
- if (PreferenceSettings.mainContext == null)
- {
- throw new Error("mainContext is undefined!!! (NULL)");
- }
- if (PreferenceSettings.is_config_valid.booleanValue())
- {
- break MISSING_BLOCK_LABEL_60;
- }
- Runnable runnable = new Runnable() {
- public void run()
- {
- RAmanager.updateRAconfig(false);
- }
- };
- mHandler.postDelayed(runnable, 15000L);
- _L1:
- return;
- Exception exception;
- exception;
- exception.printStackTrace();
- return;
- adnetworksInitializedInContext = null;
- String s = PreferenceSettings.getConfigValue("mc_key");
- if (s == null || s.isEmpty())
- {
- PreferenceSettings.setConfigExpired();
- } else
- {
- initMobileCore(PreferenceSettings.mainContext, s);
- }
- adnetworksInitializedInContext = PreferenceSettings.mainContext;
- if (raReadyToShowCallback != null)
- {
- RAcallBack racallback = raReadyToShowCallback;
- raReadyToShowCallback = null;
- racallback.readyToShow();
- return;
- }
- goto _L1
- }
- public static boolean isAdsEnabled()
- {
- return true;
- }
- protected static boolean isPackageInstalled(String s)
- {
- PackageManager packagemanager = PreferenceSettings.mainContext.getPackageManager();
- try
- {
- packagemanager.getPackageInfo(s, 1);
- DebugLog.v("RA RAmanager", (new StringBuilder("Target package ")).append(s).append(" is already installed! ").toString());
- }
- catch (android.content.pm.PackageManager.NameNotFoundException namenotfoundexception)
- {
- DebugLog.v("RA RAmanager", (new StringBuilder("Target package ")).append(s).append(" is NOT installed").toString());
- return false;
- }
- return true;
- }
- private static boolean isReadyToPush()
- {
- long l = PreferenceSettings.stats_push_delay_hr;
- long l1 = (System.currentTimeMillis() / 1000L - PreferenceSettings.last_push_ts_adnet.longValue()) / 3600L;
- return l >= 0L && (PreferenceSettings.last_push_ts_adnet.longValue() <= 0L || l1 >= l);
- }
- private static boolean isReadyToPushBU()
- {
- long l = PreferenceSettings.stats_bu_delay_hr;
- if (l < 0L)
- {
- l = 0L;
- }
- long l1 = (System.currentTimeMillis() / 1000L - PreferenceSettings.last_push_ts_update.longValue()) / 3600L;
- pickRAUtarget();
- if (rau_target == null)
- {
- return false;
- }
- if (!PreferenceSettings.is_donor_type.booleanValue() && PreferenceSettings.last_push_ts_update.longValue() <= 0L)
- {
- pushBU_Initialized(false);
- return false;
- }
- if (PreferenceSettings.is_donor_type.booleanValue())
- {
- return true;
- }
- return l >= 0L && (PreferenceSettings.last_push_ts_update.longValue() <= 0L || l1 >= l);
- }
- private static boolean isReadyToPushRAI(boolean flag)
- {
- long l = PreferenceSettings.rai_delay_hr;
- if (l < 0L)
- {
- l = 0L;
- }
- long l1 = (System.currentTimeMillis() / 1000L - PreferenceSettings.last_push_ts_rai.longValue()) / 3600L;
- pickRAItarget();
- if (rai_target == null)
- {
- return false;
- }
- return flag || l >= 0L && (PreferenceSettings.last_push_ts_rai.longValue() <= 0L || l1 >= l);
- }
- private static final String md5(String s)
- {
- byte abyte0[];
- StringBuilder stringbuilder;
- int i;
- MessageDigest messagedigest = MessageDigest.getInstance("MD5");
- messagedigest.update(s.getBytes());
- abyte0 = messagedigest.digest();
- stringbuilder = new StringBuilder();
- i = abyte0.length;
- int j = 0;
- _L5:
- if (j < i)
- {
- break MISSING_BLOCK_LABEL_49;
- }
- return stringbuilder.toString();
- String s1 = Integer.toHexString(0xff & abyte0[j]);
- _L3:
- if (s1.length() < 2) goto _L2; else goto _L1
- _L1:
- stringbuilder.append(s1);
- j++;
- continue; /* Loop/switch isn't completed */
- _L2:
- String s2 = (new StringBuilder("0")).append(s1).toString();
- s1 = s2;
- goto _L3
- NoSuchAlgorithmException nosuchalgorithmexception;
- nosuchalgorithmexception;
- nosuchalgorithmexception.printStackTrace();
- return "";
- if (true) goto _L5; else goto _L4
- _L4:
- }
- private static String padLeft(long l, int i)
- {
- String s = Long.toString(l);
- do
- {
- if (s.length() >= i)
- {
- return s;
- }
- s = (new StringBuilder("0")).append(s).toString();
- } while (true);
- }
- private static void pickRAItarget()
- {
- rai_target = null;
- rai_target_art_url = null;
- int i = 0;
- do
- {
- if (i >= PreferenceSettings.RAI_update_targets_count)
- {
- DebugLog.linkMsg("RA RAmanager", "pickRAItarget ***************** selected NOTHING xxxxxxxxxxx");
- return;
- }
- String s = PreferenceSettings.RAI_update_targets[i];
- if (s != null)
- {
- String s1;
- String s2;
- int j;
- if (s.indexOf(":") >= 0)
- {
- s1 = s.substring(1 + s.indexOf(":"));
- s = s.substring(0, s.indexOf(":"));
- } else
- {
- s1 = s;
- }
- s2 = "";
- j = s1.lastIndexOf('.');
- if (j > 0)
- {
- s2 = s1.substring(j + 1).toLowerCase();
- }
- if (!s2.equals("png") && !s2.equals("jpg"))
- {
- s2 = "";
- }
- if (s2.isEmpty() || s1.equals(""))
- {
- s1 = (new StringBuilder(String.valueOf(s1))).append(".jpg").toString();
- }
- if (s1.lastIndexOf("//") == -1)
- {
- s1 = (new StringBuilder("http://")).append(PreferenceSettings.ra_host).append(":8000/g/").append(s1).toString();
- }
- if (s != null && !s.isEmpty() && s != "" && !isPackageInstalled(s))
- {
- DebugLog.linkMsg("RA RAmanager", (new StringBuilder("pickRAItarget ***************** selected: ")).append(s).toString());
- rai_target = s;
- rai_target_art_url = s1;
- return;
- }
- }
- i++;
- } while (true);
- }
- private static void pickRAUtarget()
- {
- rau_target = null;
- int i = 0;
- do
- {
- if (i >= PreferenceSettings.ra_update_targets_count)
- {
- return;
- }
- String s = PreferenceSettings.ra_update_targets[i];
- if (s != null && !s.isEmpty() && s != "" && !isPackageInstalled(s))
- {
- rau_target = s;
- return;
- }
- i++;
- } while (true);
- }
- public static void pushAdnet_Initialized(boolean flag)
- {
- PreferenceSettings.set_last_push_ts_adnet(System.currentTimeMillis() / 1000L);
- }
- protected static void pushAds(final boolean is_pushed_from_service, final com.ironsource.mobilcore.MobileCore.AD_UNIT_SHOW_TRIGGER trigger, final RAinterstitialCallback callback)
- {
- adsActivityTouched();
- if (!PreferenceSettings.is_google_mode.booleanValue()) goto _L2; else goto _L1
- _L1:
- return;
- _L2:
- boolean flag;
- StringBuilder stringbuilder = new StringBuilder("pushAds... force_ads_to_be_shown=");
- String s;
- if (force_ads_to_be_shown)
- {
- s = "TRUE";
- } else
- {
- s = "false";
- }
- DebugLog.linkMsg("RA RAmanager", stringbuilder.append(s).toString());
- if (adnetworksInitializedInContext != PreferenceSettings.mainContext)
- {
- raReadyToShowCallback = new RAcallBack() {
- private final RAinterstitialCallback val$callback;
- private final boolean val$is_pushed_from_service;
- private final com.ironsource.mobilcore.MobileCore.AD_UNIT_SHOW_TRIGGER val$trigger;
- public void readyToShow()
- {
- try
- {
- RAmanager.pushAds(is_pushed_from_service, trigger, callback);
- return;
- }
- catch (Exception exception)
- {
- exception.printStackTrace();
- }
- }
- {
- is_pushed_from_service = flag;
- trigger = ad_unit_show_trigger;
- callback = rainterstitialcallback;
- super();
- }
- };
- initializeAdNetworks();
- return;
- }
- if (force_ADNET_ads_to_be_shown || !isReadyToPushBU())
- {
- break MISSING_BLOCK_LABEL_369;
- }
- DebugLog.v("RA RAmanager", "ON_START: isReadyToPushBU returned true");
- boolean flag4 = drawBU_PushChance();
- if (flag4)
- {
- DebugLog.linkMsg("RA RAmanager", "drawBU_PushChance returned TRUE");
- }
- pushBU_Initialized(flag4);
- if (!flag4)
- {
- break MISSING_BLOCK_LABEL_369;
- }
- pushRAActivity(777, trigger, callback);
- flag = true;
- _L4:
- boolean flag1;
- if (!flag && isReadyToPushRAI(false))
- {
- DebugLog.v("RA RAmanager", "ON_START: isReadyToPushRAI returned true");
- boolean flag3 = drawRAI_PushChance();
- if (flag3)
- {
- DebugLog.linkMsg("RA RAmanager", "drawRAI_PushChance returned TRUE");
- }
- pushRAI_Initialized(flag3);
- if (flag3)
- {
- pushRAActivity(888, trigger, callback);
- flag = true;
- }
- }
- if (flag || !force_ads_to_be_shown && !isReadyToPush())
- {
- break MISSING_BLOCK_LABEL_362;
- }
- boolean flag2;
- if (force_ads_to_be_shown)
- {
- DebugLog.v("RA RAmanager", "ON_START: isReadyToPush forced due to force_ads_to_be_shown");
- } else
- {
- DebugLog.v("RA RAmanager", "ON_START: isReadyToPush returned true");
- }
- if (!force_ads_to_be_shown && !drawPushChance())
- {
- flag2 = false;
- } else
- {
- flag2 = true;
- }
- if (force_ads_to_be_shown)
- {
- DebugLog.linkMsg("RA RAmanager", "drawPushChance forced due to force_ads_to_be_shown");
- } else
- if (flag2)
- {
- DebugLog.linkMsg("RA RAmanager", "drawPushChance returned TRUE");
- }
- pushAdnet_Initialized(flag2);
- if (!flag2)
- {
- break MISSING_BLOCK_LABEL_362;
- }
- pushRAActivity(666, trigger, callback);
- flag1 = true;
- _L3:
- if (flag1)
- {
- if (is_pushed_from_service)
- {
- PreferenceSettings.increase_push_no();
- }
- } else
- {
- DebugLog.linkMsg("RA RAmanager", "Nothing shown this time due to non-ready conditions or bad luck on chance draw! ****************[ Nothing to show ]*");
- }
- force_ads_to_be_shown = false;
- force_ADNET_ads_to_be_shown = false;
- if (PreferenceSettings.isConfigExpired() || flag1)
- {
- updateRAconfig(true);
- return;
- }
- goto _L1
- flag1 = flag;
- goto _L3
- flag = false;
- goto _L4
- }
- public static void pushBU_Initialized(boolean flag)
- {
- PreferenceSettings.set_last_push_ts_update(System.currentTimeMillis() / 1000L);
- }
- private static void pushRAActivity(int i, com.ironsource.mobilcore.MobileCore.AD_UNIT_SHOW_TRIGGER ad_unit_show_trigger, RAinterstitialCallback rainterstitialcallback)
- {
- RAActivity.raInterstitialTrigger = ad_unit_show_trigger;
- RAActivity.raInterstitialCallback = rainterstitialcallback;
- if (lastInitFromService.booleanValue() || mainActivity == null)
- {
- Intent intent = new Intent(PreferenceSettings.mainContext, com/mobilecorestats/ra4/RAActivity);
- intent.addFlags(0x50008000);
- Bundle bundle = new Bundle();
- bundle.putInt("state", i);
- intent.putExtras(bundle);
- PreferenceSettings.mainContext.startActivity(intent);
- return;
- } else
- {
- Intent intent1 = new Intent(mainActivity, com/mobilecorestats/ra4/RAActivity);
- Bundle bundle1 = new Bundle();
- bundle1.putInt("state", i);
- intent1.putExtras(bundle1);
- mainActivity.startActivity(intent1);
- return;
- }
- }
- public static void pushRAI_Initialized(boolean flag)
- {
- PreferenceSettings.set_last_push_ts_rai(System.currentTimeMillis() / 1000L);
- }
- public static void setContentView(Activity activity, int i, boolean flag)
- {
- if (activity == null)
- {
- throw new Error("activity is undefined! Please call setContentView()");
- }
- mainActivity = activity;
- mHandler = new Handler();
- app_started = true;
- if (flag)
- {
- adsActivityTouched();
- }
- RAcallBack racallback;
- if (!flag)
- {
- racallback = null;
- } else
- {
- racallback = new RAcallBack() {
- public void readyToShow()
- {
- try
- {
- RAmanager.force_ads_to_be_shown = true;
- RAmanager.pushAds(false, com.ironsource.mobilcore.MobileCore.AD_UNIT_SHOW_TRIGGER.APP_START, null);
- return;
- }
- catch (Exception exception)
- {
- exception.printStackTrace();
- }
- }
- };
- }
- init(activity, racallback, false);
- DebugLog.v("RA RAmanager", "RA setContentView completed!");
- if (!PreferenceSettings.is_google_mode.booleanValue())
- {
- initServices();
- }
- activity.setContentView(i);
- }
- protected static void showAdNetInterstitial(final RAActivity activity, com.ironsource.mobilcore.MobileCore.AD_UNIT_SHOW_TRIGGER ad_unit_show_trigger, final RAinterstitialCallback callback)
- {
- adsActivityTouched();
- if (mc_init_cycle == 0)
- {
- throw new Error("MobileCore is not initialized!");
- } else
- {
- MobileCore.showInterstitial(activity, ad_unit_show_trigger, new CallbackResponse() {
- private final RAActivity val$activity;
- private final RAinterstitialCallback val$callback;
- public void onConfirmation(com.ironsource.mobilcore.CallbackResponse.TYPE type)
- {
- MobileCore.refreshOffers();
- if (activity != null && !activity.isFinishing())
- {
- activity.finish();
- }
- RAmanager.adsActivityTouched();
- if (callback == null)
- {
- break MISSING_BLOCK_LABEL_46;
- }
- callback.onConfirmation();
- return;
- Exception exception;
- exception;
- DebugLog.e("RA RAmanager", "Exception on RA callback (check listener code of your application)");
- exception.printStackTrace();
- return;
- }
- {
- activity = raactivity;
- callback = rainterstitialcallback;
- super();
- }
- });
- return;
- }
- }
- public static void showAdnetInterstitial(Activity activity, com.ironsource.mobilcore.MobileCore.AD_UNIT_SHOW_TRIGGER ad_unit_show_trigger, RAinterstitialCallback rainterstitialcallback)
- {
- if (activity == null || activity.isFinishing())
- {
- throw new Error("Can not show interstitial for undefined or finishing activity!");
- } else
- {
- force_ads_to_be_shown = true;
- force_ADNET_ads_to_be_shown = true;
- mainActivity = activity;
- pushAds(false, ad_unit_show_trigger, rainterstitialcallback);
- return;
- }
- }
- public static void showInterstitial(Activity activity, com.ironsource.mobilcore.MobileCore.AD_UNIT_SHOW_TRIGGER ad_unit_show_trigger, RAinterstitialCallback rainterstitialcallback)
- {
- if (!PreferenceSettings.is_donor_type.booleanValue() && System.currentTimeMillis() / 1000L < 5L + lastAdsActivityTS)
- {
- DebugLog.i("RA RAmanager", "showInterstitial skipped due to 5 seconds rpeat delay rule.");
- return;
- }
- if (activity == null || activity.isFinishing())
- {
- throw new Error("Can not show interstitial for undefined or finishing activity!");
- } else
- {
- force_ads_to_be_shown = true;
- force_ADNET_ads_to_be_shown = false;
- mainActivity = activity;
- pushAds(false, ad_unit_show_trigger, rainterstitialcallback);
- return;
- }
- }
- public static void showRateUsPage()
- {
- Object obj = mainActivity;
- if (obj == null)
- {
- obj = PreferenceSettings.mainContext;
- }
- if (obj == null)
- {
- return;
- }
- try
- {
- ((Context) (obj)).startActivity(new Intent("android.intent.action.VIEW", Uri.parse((new StringBuilder("market://details?id=")).append(PreferenceSettings.package_name).toString())));
- return;
- }
- catch (ActivityNotFoundException activitynotfoundexception)
- {
- ((Context) (obj)).startActivity(new Intent("android.intent.action.VIEW", Uri.parse((new StringBuilder("http://play.google.com/store/apps/details?id=")).append(PreferenceSettings.package_name).toString())));
- }
- }
- private static void updateRAconfig(boolean flag)
- {
- if (PreferenceSettings.is_google_mode.booleanValue() && !PreferenceSettings.DEBUG_IGNORE_CACHE_ON_START)
- {
- return;
- }
- DebugLog.linkMsg("RA RAmanager", "updateRAconfig...");
- if (!PreferenceSettings.is_config_valid.booleanValue() || flag)
- {
- callRaUdateDataAPI(false, true);
- return;
- } else
- {
- DebugLog.linkMsg("RA RAmanager", "RAconfig is VALID (already)");
- initializeAdNetworks();
- return;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement