Showing
3 changed files
with
36 additions
and
1 deletions
... | @@ -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.5.4r17' | 5 | + PUBLISH_VERSION = '4.5.5.4r18' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -4,6 +4,8 @@ import android.app.Activity; | ... | @@ -4,6 +4,8 @@ import android.app.Activity; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.content.Intent; | 5 | import android.content.Intent; |
6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
7 | +import android.os.Handler; | ||
8 | +import android.os.Looper; | ||
7 | import android.view.View; | 9 | import android.view.View; |
8 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
9 | import android.widget.TextView; | 11 | import android.widget.TextView; |
... | @@ -11,6 +13,9 @@ import android.widget.TextView; | ... | @@ -11,6 +13,9 @@ import android.widget.TextView; |
11 | import androidx.recyclerview.widget.LinearLayoutManager; | 13 | import androidx.recyclerview.widget.LinearLayoutManager; |
12 | import androidx.recyclerview.widget.RecyclerView; | 14 | import androidx.recyclerview.widget.RecyclerView; |
13 | 15 | ||
16 | +import org.greenrobot.eventbus.EventBus; | ||
17 | +import org.greenrobot.eventbus.Subscribe; | ||
18 | + | ||
14 | import java.io.Serializable; | 19 | import java.io.Serializable; |
15 | import java.text.ParseException; | 20 | import java.text.ParseException; |
16 | import java.text.SimpleDateFormat; | 21 | import java.text.SimpleDateFormat; |
... | @@ -23,6 +28,7 @@ import ly.warp.sdk.io.models.Coupon; | ... | @@ -23,6 +28,7 @@ import ly.warp.sdk.io.models.Coupon; |
23 | import ly.warp.sdk.io.models.CouponList; | 28 | import ly.warp.sdk.io.models.CouponList; |
24 | import ly.warp.sdk.utils.WarplyManagerHelper; | 29 | import ly.warp.sdk.utils.WarplyManagerHelper; |
25 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; | 30 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; |
31 | +import ly.warp.sdk.utils.managers.WarplyEventBusManager; | ||
26 | import ly.warp.sdk.views.adapters.ActiveCouponAdapter; | 32 | import ly.warp.sdk.views.adapters.ActiveCouponAdapter; |
27 | 33 | ||
28 | 34 | ||
... | @@ -60,6 +66,27 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe | ... | @@ -60,6 +66,27 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe |
60 | } | 66 | } |
61 | 67 | ||
62 | @Override | 68 | @Override |
69 | + public void onStart() { | ||
70 | + super.onStart(); | ||
71 | + if (!EventBus.getDefault().isRegistered(this)) | ||
72 | + EventBus.getDefault().register(this); | ||
73 | + } | ||
74 | + | ||
75 | + @Override | ||
76 | + public void onStop() { | ||
77 | + super.onStop(); | ||
78 | + EventBus.getDefault().unregister(this); | ||
79 | + } | ||
80 | + | ||
81 | + @Subscribe() | ||
82 | + public void onMessageEvent(WarplyEventBusManager event) { | ||
83 | + if (event.getCouponsChanged() != null) { | ||
84 | + Handler mUIHandler = new Handler(Looper.getMainLooper()); | ||
85 | + mUIHandler.post(this::filterItems); | ||
86 | + } | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
63 | public void onResume() { | 90 | public void onResume() { |
64 | super.onResume(); | 91 | super.onResume(); |
65 | WarplyAnalyticsManager.logTrackersEvent(this, "screen", "ActiveCouponsScreen"); | 92 | WarplyAnalyticsManager.logTrackersEvent(this, "screen", "ActiveCouponsScreen"); | ... | ... |
... | @@ -27,6 +27,8 @@ import com.google.zxing.BarcodeFormat; | ... | @@ -27,6 +27,8 @@ import com.google.zxing.BarcodeFormat; |
27 | import com.google.zxing.common.BitMatrix; | 27 | import com.google.zxing.common.BitMatrix; |
28 | import com.google.zxing.oned.EAN13Writer; | 28 | import com.google.zxing.oned.EAN13Writer; |
29 | 29 | ||
30 | +import org.greenrobot.eventbus.EventBus; | ||
31 | + | ||
30 | import java.io.Serializable; | 32 | import java.io.Serializable; |
31 | import java.text.ParseException; | 33 | import java.text.ParseException; |
32 | import java.text.SimpleDateFormat; | 34 | import java.text.SimpleDateFormat; |
... | @@ -36,9 +38,11 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper; | ... | @@ -36,9 +38,11 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper; |
36 | import ly.warp.sdk.R; | 38 | import ly.warp.sdk.R; |
37 | import ly.warp.sdk.io.models.Coupon; | 39 | import ly.warp.sdk.io.models.Coupon; |
38 | import ly.warp.sdk.io.models.UnifiedCoupon; | 40 | import ly.warp.sdk.io.models.UnifiedCoupon; |
41 | +import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; | ||
39 | import ly.warp.sdk.services.EventCouponsService; | 42 | import ly.warp.sdk.services.EventCouponsService; |
40 | import ly.warp.sdk.utils.WarplyManagerHelper; | 43 | import ly.warp.sdk.utils.WarplyManagerHelper; |
41 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; | 44 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; |
45 | +import ly.warp.sdk.utils.managers.WarplyEventBusManager; | ||
42 | 46 | ||
43 | 47 | ||
44 | public class CouponInfoActivity extends Activity implements View.OnClickListener { | 48 | public class CouponInfoActivity extends Activity implements View.OnClickListener { |
... | @@ -131,6 +135,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -131,6 +135,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
131 | if (resultCode == RESULT_OK) { | 135 | if (resultCode == RESULT_OK) { |
132 | OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCouponsService.class).build(); | 136 | OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCouponsService.class).build(); |
133 | WorkManager.getInstance(this).enqueue(mywork); | 137 | WorkManager.getInstance(this).enqueue(mywork); |
138 | + | ||
139 | +// WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | ||
140 | +// couponsChanged.setChanged(true); | ||
141 | +// EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged)); | ||
134 | onBackPressed(); | 142 | onBackPressed(); |
135 | } | 143 | } |
136 | } | 144 | } | ... | ... |
-
Please register or login to post a comment