Panagiotis Triantafyllou

crash fixes

...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
102 <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" /> 102 <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" />
103 <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" /> 103 <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" />
104 <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" /> 104 <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" />
105 - <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" /> 105 + <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" />
106 <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" /> 106 <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" />
107 <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" /> 107 <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" />
108 <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" /> 108 <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" />
......
1 package warp.ly.android_sdk.activities; 1 package warp.ly.android_sdk.activities;
2 2
3 import android.os.Bundle; 3 import android.os.Bundle;
4 -
5 -import androidx.fragment.app.FragmentActivity;
6 -
7 import android.widget.Toast; 4 import android.widget.Toast;
8 5
9 -import ly.warp.sdk.utils.managers.WarplySessionManager; 6 +import androidx.fragment.app.FragmentActivity;
10 7
11 public abstract class BaseActivity extends FragmentActivity { 8 public abstract class BaseActivity extends FragmentActivity {
12 9
......
...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library' ...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
2 2
3 ext { 3 ext {
4 PUBLISH_GROUP_ID = 'ly.warp' 4 PUBLISH_GROUP_ID = 'ly.warp'
5 - PUBLISH_VERSION = '4.5.4.6rc31' 5 + PUBLISH_VERSION = '4.5.4.6rc33'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
1 package ly.warp.sdk.activities; 1 package ly.warp.sdk.activities;
2 2
3 -import android.app.Dialog;
4 import android.os.Bundle; 3 import android.os.Bundle;
5 -import android.os.Handler;
6 -import android.os.Looper;
7 import android.view.MenuItem; 4 import android.view.MenuItem;
8 -import android.widget.LinearLayout;
9 -import android.widget.TextView;
10 import android.widget.Toast; 5 import android.widget.Toast;
11 6
12 import androidx.annotation.NonNull; 7 import androidx.annotation.NonNull;
...@@ -28,10 +23,7 @@ import ly.warp.sdk.io.models.CampaignList; ...@@ -28,10 +23,7 @@ import ly.warp.sdk.io.models.CampaignList;
28 import ly.warp.sdk.io.models.Consumer; 23 import ly.warp.sdk.io.models.Consumer;
29 import ly.warp.sdk.io.models.CouponList; 24 import ly.warp.sdk.io.models.CouponList;
30 import ly.warp.sdk.io.request.WarplyGetCampaignsRequest; 25 import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
31 -import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
32 -import ly.warp.sdk.utils.WarplyManagerHelper;
33 import ly.warp.sdk.utils.managers.WarplyManager; 26 import ly.warp.sdk.utils.managers.WarplyManager;
34 -import ly.warp.sdk.utils.managers.WarplySessionManager;
35 27
36 public class BaseFragmentActivity extends FragmentActivity implements NavigationBarView.OnItemSelectedListener { 28 public class BaseFragmentActivity extends FragmentActivity implements NavigationBarView.OnItemSelectedListener {
37 29
...@@ -45,8 +37,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -45,8 +37,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
45 37
46 private BottomNavigationView mBottomNavigationView; 38 private BottomNavigationView mBottomNavigationView;
47 private Fragment mFragmentToSet = null; 39 private Fragment mFragmentToSet = null;
48 - private static Consumer mConsumer;
49 - private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
50 40
51 // =========================================================== 41 // ===========================================================
52 // Methods for/from SuperClass/Interfaces 42 // Methods for/from SuperClass/Interfaces
...@@ -105,27 +95,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -105,27 +95,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
105 // Methods 95 // Methods
106 // =========================================================== 96 // ===========================================================
107 97
108 - private void showDialog(String parameter) {
109 - Dialog dialog = new Dialog(this, R.style.PopUpDialog);
110 - dialog.setContentView(R.layout.dl_dialog);
111 - dialog.getWindow().setBackgroundDrawableResource(R.drawable.banner_border_white);
112 - dialog.show();
113 -
114 - TextView mTvDlTitle = dialog.findViewById(R.id.tv_dl_subtitle);
115 - LinearLayout mLlRedeem = dialog.findViewById(R.id.ll_dl_redeem);
116 -
117 - mTvDlTitle.setText(String.format(getResources().getString(R.string.cos_dl_title), parameter));
118 -
119 - mLlRedeem.setOnClickListener(view -> {
120 - if (mUniqueCampaignList != null && !mUniqueCampaignList.isEmpty()) {
121 - if (mUniqueCampaignList.containsKey("lucky_draw") && mUniqueCampaignList.get("lucky_draw").size() > 0) {
122 - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(mUniqueCampaignList.get("lucky_draw").get(0))));
123 - dialog.dismiss();
124 - }
125 - }
126 - });
127 - }
128 -
129 private void initViews() { 98 private void initViews() {
130 mBottomNavigationView.setOnItemSelectedListener(this); 99 mBottomNavigationView.setOnItemSelectedListener(this);
131 mFragmentToSet = HomeFragment.newInstance(); 100 mFragmentToSet = HomeFragment.newInstance();
......
...@@ -129,6 +129,7 @@ public class RequestQueue { ...@@ -129,6 +129,7 @@ public class RequestQueue {
129 * Starts the dispatchers in this queue. 129 * Starts the dispatchers in this queue.
130 */ 130 */
131 public void start() { 131 public void start() {
132 + try {
132 stop(); // Make sure any currently running dispatchers are stopped. 133 stop(); // Make sure any currently running dispatchers are stopped.
133 // Create the cache dispatcher and start it. 134 // Create the cache dispatcher and start it.
134 mCacheDispatcher = new CacheDispatcher(mCacheQueue, mNetworkQueue, mCache, mDelivery); 135 mCacheDispatcher = new CacheDispatcher(mCacheQueue, mNetworkQueue, mCache, mDelivery);
...@@ -141,6 +142,9 @@ public class RequestQueue { ...@@ -141,6 +142,9 @@ public class RequestQueue {
141 mDispatchers[i] = networkDispatcher; 142 mDispatchers[i] = networkDispatcher;
142 networkDispatcher.start(); 143 networkDispatcher.start();
143 } 144 }
145 + } catch (OutOfMemoryError e) {
146 + stop();
147 + }
144 } 148 }
145 149
146 /** 150 /**
......
...@@ -37,7 +37,7 @@ public class BluetoothStateChangeReceiver extends BroadcastReceiver { ...@@ -37,7 +37,7 @@ public class BluetoothStateChangeReceiver extends BroadcastReceiver {
37 if (!Warply.isInitialized()) { 37 if (!Warply.isInitialized()) {
38 Warply.getInitializer(context).init(); 38 Warply.getInitializer(context).init();
39 } 39 }
40 - Warply.INSTANCE.initBeaconsApplicationIfNeed(); 40 + Warply.initBeaconsApplicationIfNeed();
41 41
42 break; 42 break;
43 default: 43 default:
......
...@@ -20,8 +20,6 @@ import ly.warp.sdk.R; ...@@ -20,8 +20,6 @@ import ly.warp.sdk.R;
20 */ 20 */
21 public class WarplyProvider extends ContentProvider { 21 public class WarplyProvider extends ContentProvider {
22 22
23 - private static Typeface PF_BOLD;
24 -
25 @Override 23 @Override
26 public boolean onCreate() { 24 public boolean onCreate() {
27 ViewPump.init(ViewPump.builder() 25 ViewPump.init(ViewPump.builder()
......
...@@ -304,6 +304,8 @@ public class WarplyAnalyticsManager { ...@@ -304,6 +304,8 @@ public class WarplyAnalyticsManager {
304 * @param eventId Event ID 304 * @param eventId Event ID
305 */ 305 */
306 private static void sendLifecycleEvent(String eventPage, String eventId) { 306 private static void sendLifecycleEvent(String eventPage, String eventId) {
307 + if (getWarplyContext() == null)
308 + return;
307 boolean isLifecycleAnalyticsMicroAppActive = WarpUtils.getIsLIFECYCLEANALYTICSENABLED(getWarplyContext()); 309 boolean isLifecycleAnalyticsMicroAppActive = WarpUtils.getIsLIFECYCLEANALYTICSENABLED(getWarplyContext());
308 if (!isLifecycleAnalyticsMicroAppActive) { 310 if (!isLifecycleAnalyticsMicroAppActive) {
309 WarpUtils.log("session analytics micro-app is not active"); 311 WarpUtils.log("session analytics micro-app is not active");
......
...@@ -42,8 +42,8 @@ import android.net.ConnectivityManager; ...@@ -42,8 +42,8 @@ import android.net.ConnectivityManager;
42 import android.net.NetworkInfo; 42 import android.net.NetworkInfo;
43 43
44 public class WarplySessionManager { 44 public class WarplySessionManager {
45 - private final static HashSet<Activity> _activities = new HashSet<Activity>(); 45 +// private final static HashSet<Activity> _activities = new HashSet<Activity>();
46 - private static ConnectivityReceiver _receiver; 46 +// private static ConnectivityReceiver _receiver;
47 47
48 /** 48 /**
49 * Must be called in <b>every</b> Activity's onCreate method, in order to 49 * Must be called in <b>every</b> Activity's onCreate method, in order to
...@@ -53,12 +53,12 @@ public class WarplySessionManager { ...@@ -53,12 +53,12 @@ public class WarplySessionManager {
53 * @param activity The Activity that was started 53 * @param activity The Activity that was started
54 */ 54 */
55 public static void onCreateActivity(Activity activity) { 55 public static void onCreateActivity(Activity activity) {
56 - synchronized (_activities) { 56 +// synchronized (_activities) {
57 Warply.getInitializer(activity).init(); 57 Warply.getInitializer(activity).init();
58 - _activities.add(activity); 58 +// _activities.add(activity);
59 - if (_activities.size() == 1) 59 +// if (_activities.size() == 1)
60 onApplicationStart(); 60 onApplicationStart();
61 - } 61 +// }
62 } 62 }
63 63
64 /** 64 /**
...@@ -73,12 +73,12 @@ public class WarplySessionManager { ...@@ -73,12 +73,12 @@ public class WarplySessionManager {
73 * @param activity The Activity that was started 73 * @param activity The Activity that was started
74 */ 74 */
75 public static void onStartActivity(Activity activity) { 75 public static void onStartActivity(Activity activity) {
76 - synchronized (_activities) { 76 +// synchronized (_activities) {
77 -// Warply.getInitializer(activity).init(); 77 + Warply.getInitializer(activity).init();
78 - _activities.add(activity); 78 +// _activities.add(activity);
79 - if (_activities.size() == 1) 79 +// if (_activities.size() == 1)
80 onApplicationEnterForeground(); 80 onApplicationEnterForeground();
81 - } 81 +// }
82 } 82 }
83 83
84 /** 84 /**
...@@ -93,11 +93,12 @@ public class WarplySessionManager { ...@@ -93,11 +93,12 @@ public class WarplySessionManager {
93 * @param activity The Activity that was stopped 93 * @param activity The Activity that was stopped
94 */ 94 */
95 public static void onStopActivity(Activity activity) { 95 public static void onStopActivity(Activity activity) {
96 - synchronized (_activities) { 96 +// synchronized (_activities) {
97 - _activities.remove(activity); 97 + Warply.getInitializer(activity).init();
98 - if (_activities.size() == 0) 98 +// _activities.remove(activity);
99 +// if (_activities.size() == 0)
99 onApplicationEnterBackground(); 100 onApplicationEnterBackground();
100 - } 101 +// }
101 } 102 }
102 103
103 private static void onApplicationStart() { 104 private static void onApplicationStart() {
......