Panagiotis Triantafyllou

sm deals fixes

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc78'
PUBLISH_VERSION = '4.5.4.6rc79'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -46,7 +46,6 @@ import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan;
import io.github.inflationx.calligraphy3.TypefaceUtils;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.ActiveDFYCouponEventModel;
import ly.warp.sdk.io.models.ActiveDFYCouponModel;
import ly.warp.sdk.io.models.Coupon;
......@@ -59,7 +58,6 @@ import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.views.adapters.ActiveCouponAdapter;
import ly.warp.sdk.views.adapters.MarketCouponAdapter;
......@@ -170,25 +168,25 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
initViews();
// WarplyManager.getUnifiedCoupons(mUnifiedCallback);
}
@Override
protected void onStart() {
super.onStart();
if (!EventBus.getDefault().isRegistered(this))
EventBus.getDefault().register(this);
}
@Override
protected void onStop() {
super.onStop();
EventBus.getDefault().unregister(this);
// EventBus.getDefault().unregister(this);
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
@Override
......@@ -816,19 +814,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
}
private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
@Override
public void onSuccess(ArrayList<UnifiedCoupon> result) {
mUnifiedCoupons = result;
initViews();
}
@Override
public void onFailure(int errorCode) {
initViews();
}
};
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
......
......@@ -297,72 +297,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
}
}
// if (mUniqueSectionList.size() == 1) {
// try {
// String firstKey = (String) mUniqueSectionList.keySet().toArray()[0];
// if (mUniqueSectionList.get(firstKey) != null && mUniqueSectionList.get(firstKey).size() > 0) {
// mTvResearchSection.setText(firstKey.substring(1));
// mResearchItems.setNestedScrollingEnabled(false);
// mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
// mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey));
// mResearchItems.setAdapter(mAdapterResearch);
// mAdapterResearch.getPositionClicks()
// .doOnNext(this::handleMoreItemClick)
// .doOnError(error -> {
// })
// .subscribe();
//
// mLlResearchItems.setVisibility(View.VISIBLE);
// }
// } catch (IndexOutOfBoundsException ex) {
// ex.printStackTrace();
// }
// }
//
// if (mUniqueSectionList.size() == 2) {
// try {
// String secondKey = (String) mUniqueSectionList.keySet().toArray()[1];
// if (mUniqueSectionList.get(secondKey) != null && mUniqueSectionList.get(secondKey).size() > 0) {
// mTvExclusiveSection.setText(secondKey.substring(1));
// mExclusiveItems.setNestedScrollingEnabled(false);
// mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
// mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey));
// mExclusiveItems.setAdapter(mAdapterExclusive);
// mAdapterExclusive.getPositionClicks()
// .doOnNext(this::handleMoreItemClick)
// .doOnError(error -> {
// })
// .subscribe();
//
// mLlExclusiveItems.setVisibility(View.VISIBLE);
// }
// } catch (IndexOutOfBoundsException ex) {
// ex.printStackTrace();
// }
// }
//
// if (mUniqueSectionList.size() == 3) {
// try {
// String thirdKey = (String) mUniqueSectionList.keySet().toArray()[2];
// if (mUniqueSectionList.get(thirdKey) != null && mUniqueSectionList.get(thirdKey).size() > 0) {
// mTvContestSection.setText(thirdKey.substring(1));
// mContestItems.setNestedScrollingEnabled(false);
// mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
// mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey));
// mContestItems.setAdapter(mAdapterContest);
// mAdapterContest.getPositionClicks()
// .doOnNext(this::handleMoreItemClick)
// .doOnError(error -> {
// })
// .subscribe();
//
// mLlContestItems.setVisibility(View.VISIBLE);
// }
// } catch (IndexOutOfBoundsException ex) {
// ex.printStackTrace();
// }
// }
if (mContextualList != null && mContextualList.size() > 0) {
mTvContextualSection.setText(getString(R.string.cos_mfy_other));
mContextualItems.setNestedScrollingEnabled(false);
......@@ -384,104 +318,88 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mIvBack.setOnClickListener(this);
mIvPopupClose.setOnClickListener(this);
if (mUniqueSectionList != null) {
if (mUniqueSectionList.size() == 1) {
try {
String firstKey = (String) mUniqueSectionList.keySet().toArray()[0];
if (mUniqueSectionList.get(firstKey) != null && mUniqueSectionList.get(firstKey).size() > 0) {
mTvResearchSection.setText(firstKey.substring(1));
// mResearchItems.setNestedScrollingEnabled(false);
// mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey));
// mResearchItems.setItemAnimator(null);
// mAdapterResearch.setHasStableIds(true);
// mResearchItems.setAdapter(mAdapterResearch);
// mAdapterResearch.getPositionClicks()
// .doOnNext(this::handleMoreItemClick)
// .doOnError(error -> {
// })
// .subscribe();
// mAdapterResearch.notifyDataSetChanged();
mAdapterResearch.updateData(mUniqueSectionList.get(firstKey));
runOnUiThread(() -> {
if (mUniqueSectionList != null && mUniqueSectionList.size() > 0) {
for (Map.Entry<String, ArrayList<Campaign>> set : mUniqueSectionList.entrySet()) {
String itemKey = set.getKey();
ArrayList<Campaign> itemValue = set.getValue();
if (itemKey.contains("1")) {
mTvResearchSection.setText(itemKey.substring(1));
mResearchItems.setNestedScrollingEnabled(false);
mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterResearch = new MoreCampaignAdapter(this, itemValue);
mResearchItems.setAdapter(mAdapterResearch);
mAdapterResearch.getPositionClicks()
.doOnNext(this::handleMoreItemClick)
.doOnError(error -> {
})
.subscribe();
mAdapterResearch.notifyDataSetChanged();
mLlResearchItems.setVisibility(View.VISIBLE);
}
} catch (IndexOutOfBoundsException ex) {
ex.printStackTrace();
}
}
if (mUniqueSectionList.size() == 2) {
try {
String secondKey = (String) mUniqueSectionList.keySet().toArray()[1];
if (mUniqueSectionList.get(secondKey) != null && mUniqueSectionList.get(secondKey).size() > 0) {
mTvExclusiveSection.setText(secondKey.substring(1));
// mExclusiveItems.setNestedScrollingEnabled(false);
// mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey));
// mExclusiveItems.setItemAnimator(null);
// mAdapterExclusive.setHasStableIds(true);
// mExclusiveItems.setAdapter(mAdapterExclusive);
// mAdapterExclusive.getPositionClicks()
// .doOnNext(this::handleMoreItemClick)
// .doOnError(error -> {
// })
// .subscribe();
// mAdapterExclusive.notifyDataSetChanged();
mAdapterExclusive.updateData(mUniqueSectionList.get(secondKey));
for (Map.Entry<String, ArrayList<Campaign>> set : mUniqueSectionList.entrySet()) {
String itemKey = set.getKey();
ArrayList<Campaign> itemValue = set.getValue();
if (itemKey.contains("2")) {
mTvExclusiveSection.setText(itemKey.substring(1));
mExclusiveItems.setNestedScrollingEnabled(false);
mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterExclusive = new MoreCampaignAdapter(this, itemValue);
mExclusiveItems.setAdapter(mAdapterExclusive);
mAdapterExclusive.getPositionClicks()
.doOnNext(this::handleMoreItemClick)
.doOnError(error -> {
})
.subscribe();
mAdapterExclusive.notifyDataSetChanged();
mLlExclusiveItems.setVisibility(View.VISIBLE);
}
} catch (IndexOutOfBoundsException ex) {
ex.printStackTrace();
}
}
if (mUniqueSectionList.size() == 3) {
try {
String thirdKey = (String) mUniqueSectionList.keySet().toArray()[2];
if (mUniqueSectionList.get(thirdKey) != null && mUniqueSectionList.get(thirdKey).size() > 0) {
mTvContestSection.setText(thirdKey.substring(1));
// mContestItems.setNestedScrollingEnabled(false);
// mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey));
// mContestItems.setItemAnimator(null);
// mAdapterContest.setHasStableIds(true);
// mContestItems.setAdapter(mAdapterContest);
// mAdapterContest.getPositionClicks()
// .doOnNext(this::handleMoreItemClick)
// .doOnError(error -> {
// })
// .subscribe();
// mAdapterContest.notifyDataSetChanged();
mAdapterContest.updateData(mUniqueSectionList.get(thirdKey));
for (Map.Entry<String, ArrayList<Campaign>> set : mUniqueSectionList.entrySet()) {
String itemKey = set.getKey();
ArrayList<Campaign> itemValue = set.getValue();
if (itemKey.contains("3")) {
mTvContestSection.setText(itemKey.substring(1));
mContestItems.setNestedScrollingEnabled(false);
mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterContest = new MoreCampaignAdapter(this, itemValue);
mContestItems.setAdapter(mAdapterContest);
mAdapterContest.getPositionClicks()
.doOnNext(this::handleMoreItemClick)
.doOnError(error -> {
})
.subscribe();
mAdapterContest.notifyDataSetChanged();
mLlContestItems.setVisibility(View.VISIBLE);
}
} catch (IndexOutOfBoundsException ex) {
ex.printStackTrace();
}
}
if (mContextualList != null && mContextualList.size() > 0) {
mTvContextualSection.setText(getString(R.string.cos_mfy_other));
// mContextualItems.setNestedScrollingEnabled(false);
// mAdapterContextual = new MoreContextualAdapter(this, mContextualList);
// mContextualItems.setItemAnimator(null);
// mAdapterContextual.setHasStableIds(true);
// mContextualItems.setAdapter(mAdapterContextual);
// mAdapterContextual.getPositionClicks()
// .doOnNext(this::handleMoreContextualItemClick)
// .doOnError(error -> {
// })
// .subscribe();
// mAdapterContextual.notifyDataSetChanged();
mAdapterContextual.updateData(mContextualList);
mContextualItems.setNestedScrollingEnabled(false);
mContextualItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterContextual = new MoreContextualAdapter(this, mContextualList);
mContextualItems.setAdapter(mAdapterContextual);
mAdapterContextual.getPositionClicks()
.doOnNext(this::handleMoreContextualItemClick)
.doOnError(error -> {
})
.subscribe();
mAdapterContextual.notifyDataSetChanged();
mLlContextualItems.setVisibility(View.VISIBLE);
}
}
});
}
private void handleMoreItemClick(Campaign moreItem) {
......
......@@ -341,9 +341,9 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
.setTitle(R.string.cos_dlg_cancel_unified_coupon_success_title)
.setMessage(R.string.cos_dlg_cancel_unified_coupon_success_subtitle)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
RefreshUnifiedCouponsEventModel couponsRefreshed = new RefreshUnifiedCouponsEventModel();
EventBus.getDefault().post(new WarplyEventBusManager(couponsRefreshed));
dialogPositive.dismiss();
onBackPressed();
})
.setCancelable(false)
......
......@@ -2148,11 +2148,10 @@ public class WarplyManager {
if (tempUni.getStatus().trim().equals("active"))
couponList.add(tempUni);
}
}
WarplyManagerHelper.setMarketCoupons(allCouponList);
WarplyManagerHelper.setMarketCouponsList(couponList);
}
}
} catch (Exception e) {
e.printStackTrace();
}
......