Showing
8 changed files
with
186 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.4.6rc79' | 5 | + PUBLISH_VERSION = '4.5.4.6rc80' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -184,6 +184,11 @@ | ... | @@ -184,6 +184,11 @@ |
184 | android:permission="android.permission.BIND_JOB_SERVICE" /> | 184 | android:permission="android.permission.BIND_JOB_SERVICE" /> |
185 | 185 | ||
186 | <service | 186 | <service |
187 | + android:name="ly.warp.sdk.services.VouchersFetchedService" | ||
188 | + android:exported="false" | ||
189 | + android:permission="android.permission.BIND_JOB_SERVICE" /> | ||
190 | + | ||
191 | + <service | ||
187 | android:name="ly.warp.sdk.services.EventCouponsService" | 192 | android:name="ly.warp.sdk.services.EventCouponsService" |
188 | android:exported="false" | 193 | android:exported="false" |
189 | android:permission="android.permission.BIND_JOB_SERVICE" /> | 194 | android:permission="android.permission.BIND_JOB_SERVICE" /> | ... | ... |
... | @@ -186,6 +186,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -186,6 +186,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
186 | @Override | 186 | @Override |
187 | public void onDestroy() { | 187 | public void onDestroy() { |
188 | super.onDestroy(); | 188 | super.onDestroy(); |
189 | + WarplyManagerHelper.clearShowVouchersBanner(); | ||
189 | EventBus.getDefault().unregister(this); | 190 | EventBus.getDefault().unregister(this); |
190 | } | 191 | } |
191 | 192 | ||
... | @@ -354,6 +355,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -354,6 +355,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
354 | 355 | ||
355 | @Subscribe() | 356 | @Subscribe() |
356 | public void onMessageEvent(WarplyEventBusManager event) { | 357 | public void onMessageEvent(WarplyEventBusManager event) { |
358 | + if (event.getVouchersFetched() != null) { | ||
359 | + WarpUtils.log(String.valueOf(event.getVouchersFetched().isFetched())); | ||
360 | + WarpUtils.log(WarplyManagerHelper.getShowVouchersBanner()); | ||
361 | + | ||
362 | + if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) { | ||
363 | + //TODO: hide spinner and enable button | ||
364 | + } else { | ||
365 | + //.equals("false) | ||
366 | + //TODO: hide it completely or leave it disabled?? | ||
367 | + } | ||
368 | + return; | ||
369 | + } | ||
357 | if (event.getUnifiedCouponsAdded() != null) { | 370 | if (event.getUnifiedCouponsAdded() != null) { |
358 | mUnifiedPressed = false; | 371 | mUnifiedPressed = false; |
359 | if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0) { | 372 | if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0) { |
... | @@ -510,6 +523,15 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -510,6 +523,15 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
510 | // =========================================================== | 523 | // =========================================================== |
511 | 524 | ||
512 | private void initViews() { | 525 | private void initViews() { |
526 | + if (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner())) { | ||
527 | + //TODO: show spinner | ||
528 | + } else if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) { | ||
529 | + //TODO: hide spinner and enable button | ||
530 | + } else { | ||
531 | + //.equals("false) | ||
532 | + //TODO: hide it completely or leave it disabled?? | ||
533 | + } | ||
534 | + | ||
513 | if (WarpUtils.getUserNonTelco(this)) { | 535 | if (WarpUtils.getUserNonTelco(this)) { |
514 | nonTelcoDialog(); | 536 | nonTelcoDialog(); |
515 | } | 537 | } | ... | ... |
1 | +/* | ||
2 | + * Copyright 2010-2013 Warply Ltd. All rights reserved. | ||
3 | + * | ||
4 | + * Redistribution and use in source and binary forms, without modification, are | ||
5 | + * permitted provided that the following conditions are met: | ||
6 | + * | ||
7 | + * 1. Redistributions of source code must retain the above copyright notice, | ||
8 | + * this list of conditions and the following disclaimer. | ||
9 | + * | ||
10 | + * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
11 | + * this list of conditions and the following disclaimer in the documentation | ||
12 | + * and/or other materials provided with the distribution. | ||
13 | + * | ||
14 | + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR | ||
15 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
17 | + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
19 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
20 | + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
21 | + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
22 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
23 | + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | + */ | ||
25 | + | ||
26 | +package ly.warp.sdk.io.models; | ||
27 | + | ||
28 | + | ||
29 | +/** | ||
30 | + * Created by Panagiotis Triantafyllou on 19-Oct-23. | ||
31 | + */ | ||
32 | + | ||
33 | +public class VouchersActivityEventModel { | ||
34 | + private boolean openActivity; | ||
35 | + | ||
36 | + public VouchersActivityEventModel() { | ||
37 | + this.openActivity = true; | ||
38 | + } | ||
39 | + | ||
40 | + public boolean isOpened() { | ||
41 | + return openActivity; | ||
42 | + } | ||
43 | + | ||
44 | + public void setOpened(boolean openActivity) { | ||
45 | + this.openActivity = openActivity; | ||
46 | + } | ||
47 | +} |
1 | +/* | ||
2 | + * Copyright 2010-2013 Warply Ltd. All rights reserved. | ||
3 | + * | ||
4 | + * Redistribution and use in source and binary forms, without modification, are | ||
5 | + * permitted provided that the following conditions are met: | ||
6 | + * | ||
7 | + * 1. Redistributions of source code must retain the above copyright notice, | ||
8 | + * this list of conditions and the following disclaimer. | ||
9 | + * | ||
10 | + * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
11 | + * this list of conditions and the following disclaimer in the documentation | ||
12 | + * and/or other materials provided with the distribution. | ||
13 | + * | ||
14 | + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR | ||
15 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
17 | + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
19 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
20 | + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
21 | + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
22 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
23 | + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | + */ | ||
25 | + | ||
26 | +package ly.warp.sdk.io.models; | ||
27 | + | ||
28 | + | ||
29 | +/** | ||
30 | + * Created by Panagiotis Triantafyllou on 19-Oct-23. | ||
31 | + */ | ||
32 | + | ||
33 | +public class VouchersFetchedEventModel { | ||
34 | + private boolean fetched; | ||
35 | + | ||
36 | + public VouchersFetchedEventModel() { | ||
37 | + this.fetched = true; | ||
38 | + } | ||
39 | + | ||
40 | + public boolean isFetched() { | ||
41 | + return fetched; | ||
42 | + } | ||
43 | + | ||
44 | + public void setFetched(boolean fetched) { | ||
45 | + this.fetched = fetched; | ||
46 | + } | ||
47 | +} |
1 | +package ly.warp.sdk.services; | ||
2 | + | ||
3 | +import android.content.Context; | ||
4 | + | ||
5 | +import androidx.annotation.NonNull; | ||
6 | +import androidx.work.Worker; | ||
7 | +import androidx.work.WorkerParameters; | ||
8 | + | ||
9 | +import org.greenrobot.eventbus.EventBus; | ||
10 | + | ||
11 | +import ly.warp.sdk.io.models.CouponsEventModel; | ||
12 | +import ly.warp.sdk.io.models.VouchersFetchedEventModel; | ||
13 | +import ly.warp.sdk.utils.managers.WarplyEventBusManager; | ||
14 | + | ||
15 | +/** | ||
16 | + * Created by Panagiotis Triantafyllou on 19/Oct/2023. | ||
17 | + */ | ||
18 | +public class VouchersFetchedService extends Worker { | ||
19 | + | ||
20 | + public VouchersFetchedService(@NonNull Context context, @NonNull WorkerParameters workerParams) { | ||
21 | + super(context, workerParams); | ||
22 | + } | ||
23 | + | ||
24 | + @NonNull | ||
25 | + @Override | ||
26 | + public Result doWork() { | ||
27 | + VouchersFetchedEventModel vouchersFetched = new VouchersFetchedEventModel(); | ||
28 | + EventBus.getDefault().post(new WarplyEventBusManager(vouchersFetched)); | ||
29 | + | ||
30 | + return Result.success(); | ||
31 | + } | ||
32 | +} |
... | @@ -88,7 +88,9 @@ import ly.warp.sdk.io.request.WarplyEditConsumerRequest; | ... | @@ -88,7 +88,9 @@ import ly.warp.sdk.io.request.WarplyEditConsumerRequest; |
88 | import ly.warp.sdk.io.request.WarplyIntegrationRequest; | 88 | import ly.warp.sdk.io.request.WarplyIntegrationRequest; |
89 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | 89 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; |
90 | import ly.warp.sdk.services.EventService; | 90 | import ly.warp.sdk.services.EventService; |
91 | +import ly.warp.sdk.services.EventUnifiedCouponsService; | ||
91 | import ly.warp.sdk.services.FCMBaseMessagingService; | 92 | import ly.warp.sdk.services.FCMBaseMessagingService; |
93 | +import ly.warp.sdk.services.VouchersFetchedService; | ||
92 | import ly.warp.sdk.services.WarplyHealthService; | 94 | import ly.warp.sdk.services.WarplyHealthService; |
93 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; | 95 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; |
94 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; | 96 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; |
... | @@ -134,6 +136,7 @@ public class WarplyManagerHelper { | ... | @@ -134,6 +136,7 @@ public class WarplyManagerHelper { |
134 | public static int mSteps = 0; | 136 | public static int mSteps = 0; |
135 | private static ArrayList<UnifiedCoupon> mMarketCoupons = new ArrayList<>(), | 137 | private static ArrayList<UnifiedCoupon> mMarketCoupons = new ArrayList<>(), |
136 | mMarketCouponsList = new ArrayList<>(); | 138 | mMarketCouponsList = new ArrayList<>(); |
139 | + private static String showVouchersBanner = ""; | ||
137 | 140 | ||
138 | // =========================================================== | 141 | // =========================================================== |
139 | // Methods for/from SuperClass/Interfaces | 142 | // Methods for/from SuperClass/Interfaces |
... | @@ -1406,6 +1409,25 @@ public class WarplyManagerHelper { | ... | @@ -1406,6 +1409,25 @@ public class WarplyManagerHelper { |
1406 | return false; | 1409 | return false; |
1407 | } | 1410 | } |
1408 | 1411 | ||
1412 | + public static void clearShowVouchersBanner() { | ||
1413 | + showVouchersBanner = ""; | ||
1414 | + } | ||
1415 | + | ||
1416 | + public static void setShowVouchersBanner(boolean show) { | ||
1417 | + showVouchersBanner = String.valueOf(show); | ||
1418 | + } | ||
1419 | + | ||
1420 | + public static String getShowVouchersBanner() { | ||
1421 | + return showVouchersBanner; | ||
1422 | + } | ||
1423 | + | ||
1424 | + public static void setVouchersFetched(boolean success) { | ||
1425 | + setShowVouchersBanner(success); | ||
1426 | + | ||
1427 | + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(VouchersFetchedService.class).build(); | ||
1428 | + WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); | ||
1429 | + } | ||
1430 | + | ||
1409 | // =========================================================== | 1431 | // =========================================================== |
1410 | // Inner and Anonymous Classes | 1432 | // Inner and Anonymous Classes |
1411 | // =========================================================== | 1433 | // =========================================================== | ... | ... |
... | @@ -16,6 +16,7 @@ import ly.warp.sdk.io.models.LoyaltySDKSessionExpiredEventModel; | ... | @@ -16,6 +16,7 @@ import ly.warp.sdk.io.models.LoyaltySDKSessionExpiredEventModel; |
16 | import ly.warp.sdk.io.models.QuestionnaireEventModel; | 16 | import ly.warp.sdk.io.models.QuestionnaireEventModel; |
17 | import ly.warp.sdk.io.models.RefreshUnifiedCouponsEventModel; | 17 | import ly.warp.sdk.io.models.RefreshUnifiedCouponsEventModel; |
18 | import ly.warp.sdk.io.models.UnifiedCouponsEventModel; | 18 | import ly.warp.sdk.io.models.UnifiedCouponsEventModel; |
19 | +import ly.warp.sdk.io.models.VouchersFetchedEventModel; | ||
19 | import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; | 20 | import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; |
20 | import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; | 21 | import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; |
21 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; | 22 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; |
... | @@ -41,6 +42,7 @@ public class WarplyEventBusManager { | ... | @@ -41,6 +42,7 @@ public class WarplyEventBusManager { |
41 | private WarplyCCMSEnabledModel ccmsActivated; | 42 | private WarplyCCMSEnabledModel ccmsActivated; |
42 | private LoyaltyGiftsForYouOfferClickEvent giftsYou; | 43 | private LoyaltyGiftsForYouOfferClickEvent giftsYou; |
43 | private QuestionnaireEventModel questionnaire; | 44 | private QuestionnaireEventModel questionnaire; |
45 | + private VouchersFetchedEventModel vouchersFetched; | ||
44 | private CouponEventModel coupon; | 46 | private CouponEventModel coupon; |
45 | private ActiveDFYCouponEventModel activeCoupon; | 47 | private ActiveDFYCouponEventModel activeCoupon; |
46 | private ContexualEventModel ccmsAdded; | 48 | private ContexualEventModel ccmsAdded; |
... | @@ -74,6 +76,10 @@ public class WarplyEventBusManager { | ... | @@ -74,6 +76,10 @@ public class WarplyEventBusManager { |
74 | this.questionnaire = questionnaire; | 76 | this.questionnaire = questionnaire; |
75 | } | 77 | } |
76 | 78 | ||
79 | + public WarplyEventBusManager(VouchersFetchedEventModel vouchersFetched) { | ||
80 | + this.vouchersFetched = vouchersFetched; | ||
81 | + } | ||
82 | + | ||
77 | public WarplyEventBusManager(WarplyWebviewCallbackEventModel webviewCallback) { | 83 | public WarplyEventBusManager(WarplyWebviewCallbackEventModel webviewCallback) { |
78 | this.webviewCallback = webviewCallback; | 84 | this.webviewCallback = webviewCallback; |
79 | } | 85 | } |
... | @@ -220,6 +226,10 @@ public class WarplyEventBusManager { | ... | @@ -220,6 +226,10 @@ public class WarplyEventBusManager { |
220 | return questionnaire; | 226 | return questionnaire; |
221 | } | 227 | } |
222 | 228 | ||
229 | + public VouchersFetchedEventModel getVouchersFetched() { | ||
230 | + return vouchersFetched; | ||
231 | + } | ||
232 | + | ||
223 | public CouponEventModel getCoupon() { | 233 | public CouponEventModel getCoupon() { |
224 | return coupon; | 234 | return coupon; |
225 | } | 235 | } | ... | ... |
-
Please register or login to post a comment