Panagiotis Triantafyllou

crash fixes

......@@ -102,7 +102,7 @@
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_active_rewards.xml" value="0.358695652173913" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_base_fragment.xml" value="0.25" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_bill_payment.xml" value="0.358695652173913" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_contextual.xml" value="0.36666666666666664" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_contextual.xml" value="0.22" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_coupon_gift.xml" value="0.36666666666666664" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_coupon_info.xml" value="0.33" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_coupon_share.xml" value="0.36666666666666664" />
......
package warp.ly.android_sdk.activities;
import android.os.Bundle;
import androidx.fragment.app.FragmentActivity;
import android.widget.Toast;
import ly.warp.sdk.utils.managers.WarplySessionManager;
import androidx.fragment.app.FragmentActivity;
public abstract class BaseActivity extends FragmentActivity {
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc31'
PUBLISH_VERSION = '4.5.4.6rc33'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
package ly.warp.sdk.activities;
import android.app.Dialog;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.MenuItem;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
......@@ -28,10 +23,7 @@ import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.utils.managers.WarplySessionManager;
public class BaseFragmentActivity extends FragmentActivity implements NavigationBarView.OnItemSelectedListener {
......@@ -45,8 +37,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
private BottomNavigationView mBottomNavigationView;
private Fragment mFragmentToSet = null;
private static Consumer mConsumer;
private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -105,27 +95,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
// Methods
// ===========================================================
private void showDialog(String parameter) {
Dialog dialog = new Dialog(this, R.style.PopUpDialog);
dialog.setContentView(R.layout.dl_dialog);
dialog.getWindow().setBackgroundDrawableResource(R.drawable.banner_border_white);
dialog.show();
TextView mTvDlTitle = dialog.findViewById(R.id.tv_dl_subtitle);
LinearLayout mLlRedeem = dialog.findViewById(R.id.ll_dl_redeem);
mTvDlTitle.setText(String.format(getResources().getString(R.string.cos_dl_title), parameter));
mLlRedeem.setOnClickListener(view -> {
if (mUniqueCampaignList != null && !mUniqueCampaignList.isEmpty()) {
if (mUniqueCampaignList.containsKey("lucky_draw") && mUniqueCampaignList.get("lucky_draw").size() > 0) {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(mUniqueCampaignList.get("lucky_draw").get(0))));
dialog.dismiss();
}
}
});
}
private void initViews() {
mBottomNavigationView.setOnItemSelectedListener(this);
mFragmentToSet = HomeFragment.newInstance();
......
......@@ -129,17 +129,21 @@ public class RequestQueue {
* Starts the dispatchers in this queue.
*/
public void start() {
stop(); // Make sure any currently running dispatchers are stopped.
// Create the cache dispatcher and start it.
mCacheDispatcher = new CacheDispatcher(mCacheQueue, mNetworkQueue, mCache, mDelivery);
mCacheDispatcher.start();
// Create network dispatchers (and corresponding threads) up to the pool size.
for (int i = 0; i < mDispatchers.length; i++) {
NetworkDispatcher networkDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork,
mCache, mDelivery);
mDispatchers[i] = networkDispatcher;
networkDispatcher.start();
try {
stop(); // Make sure any currently running dispatchers are stopped.
// Create the cache dispatcher and start it.
mCacheDispatcher = new CacheDispatcher(mCacheQueue, mNetworkQueue, mCache, mDelivery);
mCacheDispatcher.start();
// Create network dispatchers (and corresponding threads) up to the pool size.
for (int i = 0; i < mDispatchers.length; i++) {
NetworkDispatcher networkDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork,
mCache, mDelivery);
mDispatchers[i] = networkDispatcher;
networkDispatcher.start();
}
} catch (OutOfMemoryError e) {
stop();
}
}
......
......@@ -37,7 +37,7 @@ public class BluetoothStateChangeReceiver extends BroadcastReceiver {
if (!Warply.isInitialized()) {
Warply.getInitializer(context).init();
}
Warply.INSTANCE.initBeaconsApplicationIfNeed();
Warply.initBeaconsApplicationIfNeed();
break;
default:
......
......@@ -20,8 +20,6 @@ import ly.warp.sdk.R;
*/
public class WarplyProvider extends ContentProvider {
private static Typeface PF_BOLD;
@Override
public boolean onCreate() {
ViewPump.init(ViewPump.builder()
......
......@@ -304,6 +304,8 @@ public class WarplyAnalyticsManager {
* @param eventId Event ID
*/
private static void sendLifecycleEvent(String eventPage, String eventId) {
if (getWarplyContext() == null)
return;
boolean isLifecycleAnalyticsMicroAppActive = WarpUtils.getIsLIFECYCLEANALYTICSENABLED(getWarplyContext());
if (!isLifecycleAnalyticsMicroAppActive) {
WarpUtils.log("session analytics micro-app is not active");
......
......@@ -42,8 +42,8 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public class WarplySessionManager {
private final static HashSet<Activity> _activities = new HashSet<Activity>();
private static ConnectivityReceiver _receiver;
// private final static HashSet<Activity> _activities = new HashSet<Activity>();
// private static ConnectivityReceiver _receiver;
/**
* Must be called in <b>every</b> Activity's onCreate method, in order to
......@@ -53,12 +53,12 @@ public class WarplySessionManager {
* @param activity The Activity that was started
*/
public static void onCreateActivity(Activity activity) {
synchronized (_activities) {
// synchronized (_activities) {
Warply.getInitializer(activity).init();
_activities.add(activity);
if (_activities.size() == 1)
// _activities.add(activity);
// if (_activities.size() == 1)
onApplicationStart();
}
// }
}
/**
......@@ -73,12 +73,12 @@ public class WarplySessionManager {
* @param activity The Activity that was started
*/
public static void onStartActivity(Activity activity) {
synchronized (_activities) {
// Warply.getInitializer(activity).init();
_activities.add(activity);
if (_activities.size() == 1)
// synchronized (_activities) {
Warply.getInitializer(activity).init();
// _activities.add(activity);
// if (_activities.size() == 1)
onApplicationEnterForeground();
}
// }
}
/**
......@@ -93,11 +93,12 @@ public class WarplySessionManager {
* @param activity The Activity that was stopped
*/
public static void onStopActivity(Activity activity) {
synchronized (_activities) {
_activities.remove(activity);
if (_activities.size() == 0)
// synchronized (_activities) {
Warply.getInitializer(activity).init();
// _activities.remove(activity);
// if (_activities.size() == 0)
onApplicationEnterBackground();
}
// }
}
private static void onApplicationStart() {
......