Showing
7 changed files
with
126 additions
and
71 deletions
... | @@ -3,6 +3,7 @@ package ly.warp.sdk.activities; | ... | @@ -3,6 +3,7 @@ package ly.warp.sdk.activities; |
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.content.Intent; | 4 | import android.content.Intent; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | +import android.text.TextUtils; | ||
6 | import android.view.View; | 7 | import android.view.View; |
7 | import android.widget.ImageView; | 8 | import android.widget.ImageView; |
8 | import android.widget.LinearLayout; | 9 | import android.widget.LinearLayout; |
... | @@ -11,8 +12,6 @@ import android.widget.TextView; | ... | @@ -11,8 +12,6 @@ import android.widget.TextView; |
11 | import androidx.constraintlayout.widget.ConstraintLayout; | 12 | import androidx.constraintlayout.widget.ConstraintLayout; |
12 | 13 | ||
13 | import ly.warp.sdk.R; | 14 | import ly.warp.sdk.R; |
14 | -import ly.warp.sdk.io.models.Campaign; | ||
15 | -import ly.warp.sdk.io.models.CampaignList; | ||
16 | import ly.warp.sdk.io.models.Coupon; | 15 | import ly.warp.sdk.io.models.Coupon; |
17 | import ly.warp.sdk.io.models.CouponList; | 16 | import ly.warp.sdk.io.models.CouponList; |
18 | import ly.warp.sdk.utils.WarplyManagerHelper; | 17 | import ly.warp.sdk.utils.WarplyManagerHelper; |
... | @@ -49,13 +48,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -49,13 +48,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
49 | mTvUsername = findViewById(R.id.tv_name); | 48 | mTvUsername = findViewById(R.id.tv_name); |
50 | mLlQuestionnaire = findViewById(R.id.ll_user_questionnaire); | 49 | mLlQuestionnaire = findViewById(R.id.ll_user_questionnaire); |
51 | mLlUserBadge = findViewById(R.id.ll_user_badge); | 50 | mLlUserBadge = findViewById(R.id.ll_user_badge); |
52 | - /**** Old functionality ****/ | ||
53 | -// mClActiveCoupons = findViewById(R.id.cl_loyalty_coupon); | ||
54 | -// mTvActiveCoupons = findViewById(R.id.tv_active_coupons); | ||
55 | -// mClActiveRewards = findViewById(R.id.cl_loyalty_rewards); | ||
56 | -// mLlAnalysisButton = findViewById(R.id.ll_analysis); | ||
57 | -// mLlPastCoupons = findViewById(R.id.ll_old_coupons); | ||
58 | - /**** Old functionality ****/ | ||
59 | mTvActiveRewards = findViewById(R.id.tv_active_deals_text); | 51 | mTvActiveRewards = findViewById(R.id.tv_active_deals_text); |
60 | mTvUserBadge = findViewById(R.id.tv_type); | 52 | mTvUserBadge = findViewById(R.id.tv_type); |
61 | mClActiveGifts = findViewById(R.id.cl_mygifts); | 53 | mClActiveGifts = findViewById(R.id.cl_mygifts); |
... | @@ -74,50 +66,10 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -74,50 +66,10 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
74 | onBackPressed(); | 66 | onBackPressed(); |
75 | return; | 67 | return; |
76 | } | 68 | } |
77 | - /**** Old functionality ****/ | 69 | + if (view.getId() == R.id.ll_user_questionnaire || view.getId() == R.id.ll_user_badge) { |
78 | -// if (view.getId() == R.id.ll_analysis) { | 70 | + startActivity(WarpViewActivity.createIntentFromURL(LoyaltyWallet.this, WarplyManagerHelper.openQuestionnaire())); |
79 | -// Intent intent = new Intent(this, LoyaltyActivity.class); | ||
80 | -// startActivity(intent); | ||
81 | -// return; | ||
82 | -// } | ||
83 | - /**** Old functionality ****/ | ||
84 | - if (view.getId() == R.id.ll_user_questionnaire) { | ||
85 | - CampaignList cl = WarplyManagerHelper.getUniqueCampaignList().get("more_for_you"); | ||
86 | - Campaign camp = null; | ||
87 | - if (cl != null) { | ||
88 | - for (Campaign cn : cl) { | ||
89 | - if (cn.getSessionUUID().equals("4fc2865e32bd4d5495a3dfdf1472da7f")) { | ||
90 | - camp = cn; | ||
91 | - break; | ||
92 | - } | ||
93 | - } | ||
94 | - } | ||
95 | - | ||
96 | - if (camp == null) | ||
97 | - return; | ||
98 | - | ||
99 | - startActivity(WarpViewActivity.createIntentFromURL(LoyaltyWallet.this, WarplyManagerHelper.constructCampaignUrl(camp))); | ||
100 | return; | 71 | return; |
101 | } | 72 | } |
102 | - /**** Old functionality ****/ | ||
103 | -// if (view.getId() == R.id.cl_loyalty_coupon) { | ||
104 | -// Intent intent = new Intent(LoyaltyWallet.this, ActiveCouponsActivity.class); | ||
105 | -// intent.putExtra("couponlist", WarplyManagerHelper.getCouponList()); | ||
106 | -// startActivity(intent); | ||
107 | -// return; | ||
108 | -// } | ||
109 | -// if (view.getId() == R.id.cl_loyalty_rewards) { | ||
110 | -// Intent intent = new Intent(LoyaltyWallet.this, ActiveRewardsActivity.class); | ||
111 | -// intent.putExtra("couponlist", WarplyManagerHelper.getCouponList()); | ||
112 | -// startActivity(intent); | ||
113 | -// return; | ||
114 | -// } | ||
115 | -// if (view.getId() == R.id.ll_old_coupons) { | ||
116 | -// Intent intent = new Intent(LoyaltyWallet.this, PastCouponsActivity.class); | ||
117 | -// intent.putExtra("couponlist", WarplyManagerHelper.getCouponList()); | ||
118 | -// startActivity(intent); | ||
119 | -// } | ||
120 | - /**** Old functionality ****/ | ||
121 | if (view.getId() == R.id.cl_mygifts) { | 73 | if (view.getId() == R.id.cl_mygifts) { |
122 | Intent intent = new Intent(LoyaltyWallet.this, ActiveGiftsActivity.class); | 74 | Intent intent = new Intent(LoyaltyWallet.this, ActiveGiftsActivity.class); |
123 | startActivity(intent); | 75 | startActivity(intent); |
... | @@ -139,14 +91,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -139,14 +91,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
139 | mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_loyalty_name), | 91 | mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_loyalty_name), |
140 | WarplyManagerHelper.getConsumer().getFirstName(), WarplyManagerHelper.getConsumer().getLastName())); | 92 | WarplyManagerHelper.getConsumer().getFirstName(), WarplyManagerHelper.getConsumer().getLastName())); |
141 | 93 | ||
142 | - if (WarplyManagerHelper.getConsumer().getProfileMetadata() != null) { | 94 | + if (!TextUtils.isEmpty(WarplyManagerHelper.getUserTag())) { |
143 | - boolean answered = WarplyManagerHelper.getConsumer().getProfileMetadata().optBoolean("answered", false); | 95 | + mTvUserBadge.setText(WarplyManagerHelper.getUserTag()); |
144 | - if (answered) { | 96 | + mLlQuestionnaire.setVisibility(View.GONE); |
145 | - //TODO: put badge also | ||
146 | mLlUserBadge.setVisibility(View.VISIBLE); | 97 | mLlUserBadge.setVisibility(View.VISIBLE); |
147 | - } else | ||
148 | - mLlQuestionnaire.setVisibility(View.VISIBLE); | ||
149 | } else { | 98 | } else { |
99 | + mLlUserBadge.setVisibility(View.GONE); | ||
150 | mLlQuestionnaire.setVisibility(View.VISIBLE); | 100 | mLlQuestionnaire.setVisibility(View.VISIBLE); |
151 | } | 101 | } |
152 | } | 102 | } |
... | @@ -154,16 +104,10 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -154,16 +104,10 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
154 | mIvBack.setOnClickListener(this); | 104 | mIvBack.setOnClickListener(this); |
155 | // mTvAnalysisButton.setOnClickListener(this); | 105 | // mTvAnalysisButton.setOnClickListener(this); |
156 | mLlQuestionnaire.setOnClickListener(this); | 106 | mLlQuestionnaire.setOnClickListener(this); |
157 | - /**** Old functionality ****/ | ||
158 | -// mTvActiveCoupons.setText(String.format(getResources().getString(R.string.cos_active_coupons), String.valueOf(cpnlist.size()))); | ||
159 | -// mClActiveCoupons.setOnClickListener(this); | ||
160 | -// mClActiveRewards.setOnClickListener(this); | ||
161 | -// mLlAnalysisButton.setOnClickListener(this); | ||
162 | -// mLlPastCoupons.setOnClickListener(this); | ||
163 | - /**** Old functionality ****/ | ||
164 | //TODO: change the parameter, for testing purposes only | 107 | //TODO: change the parameter, for testing purposes only |
165 | mTvActiveRewards.setText(String.format(getResources().getString(R.string.cos_active_rewards), String.valueOf(cpnlist.size()))); | 108 | mTvActiveRewards.setText(String.format(getResources().getString(R.string.cos_active_rewards), String.valueOf(cpnlist.size()))); |
166 | mClActiveGifts.setOnClickListener(this); | 109 | mClActiveGifts.setOnClickListener(this); |
110 | + mLlUserBadge.setOnClickListener(this); | ||
167 | } | 111 | } |
168 | 112 | ||
169 | // =========================================================== | 113 | // =========================================================== | ... | ... |
... | @@ -30,8 +30,11 @@ import android.content.Intent; | ... | @@ -30,8 +30,11 @@ import android.content.Intent; |
30 | import android.graphics.Color; | 30 | import android.graphics.Color; |
31 | import android.os.Build; | 31 | import android.os.Build; |
32 | import android.os.Bundle; | 32 | import android.os.Bundle; |
33 | + | ||
33 | import androidx.annotation.NonNull; | 34 | import androidx.annotation.NonNull; |
35 | + | ||
34 | import android.text.TextUtils; | 36 | import android.text.TextUtils; |
37 | +import android.util.Log; | ||
35 | import android.view.KeyEvent; | 38 | import android.view.KeyEvent; |
36 | import android.view.View; | 39 | import android.view.View; |
37 | import android.webkit.WebView; | 40 | import android.webkit.WebView; |
... | @@ -47,6 +50,7 @@ import androidx.work.Constraints; | ... | @@ -47,6 +50,7 @@ import androidx.work.Constraints; |
47 | import androidx.work.NetworkType; | 50 | import androidx.work.NetworkType; |
48 | import androidx.work.OneTimeWorkRequest; | 51 | import androidx.work.OneTimeWorkRequest; |
49 | import androidx.work.WorkManager; | 52 | import androidx.work.WorkManager; |
53 | + | ||
50 | import ly.warp.sdk.Warply; | 54 | import ly.warp.sdk.Warply; |
51 | import ly.warp.sdk.services.PushEventsClickedWorkerService; | 55 | import ly.warp.sdk.services.PushEventsClickedWorkerService; |
52 | import ly.warp.sdk.utils.WarpJSONParser; | 56 | import ly.warp.sdk.utils.WarpJSONParser; |
... | @@ -54,12 +58,16 @@ import ly.warp.sdk.utils.WarpUtils; | ... | @@ -54,12 +58,16 @@ import ly.warp.sdk.utils.WarpUtils; |
54 | import ly.warp.sdk.utils.WarplyPreferences; | 58 | import ly.warp.sdk.utils.WarplyPreferences; |
55 | import ly.warp.sdk.utils.WarplyProperty; | 59 | import ly.warp.sdk.utils.WarplyProperty; |
56 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; | 60 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; |
61 | +import ly.warp.sdk.utils.managers.WarplyEventBusManager; | ||
57 | import ly.warp.sdk.utils.managers.WarplySessionManager; | 62 | import ly.warp.sdk.utils.managers.WarplySessionManager; |
58 | import ly.warp.sdk.views.WarpView; | 63 | import ly.warp.sdk.views.WarpView; |
59 | 64 | ||
60 | import static ly.warp.sdk.utils.constants.WarpConstants.RANDOM_MAX; | 65 | import static ly.warp.sdk.utils.constants.WarpConstants.RANDOM_MAX; |
61 | import static ly.warp.sdk.utils.constants.WarpConstants.RANDOM_MIN; | 66 | import static ly.warp.sdk.utils.constants.WarpConstants.RANDOM_MIN; |
62 | 67 | ||
68 | +import org.greenrobot.eventbus.EventBus; | ||
69 | +import org.greenrobot.eventbus.Subscribe; | ||
70 | + | ||
63 | public class WarpViewActivity extends WarpBaseActivity { | 71 | public class WarpViewActivity extends WarpBaseActivity { |
64 | 72 | ||
65 | // =========================================================== | 73 | // =========================================================== |
... | @@ -92,12 +100,14 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -92,12 +100,14 @@ public class WarpViewActivity extends WarpBaseActivity { |
92 | protected void onStart() { | 100 | protected void onStart() { |
93 | super.onStart(); | 101 | super.onStart(); |
94 | WarplySessionManager.onStartActivity(this); | 102 | WarplySessionManager.onStartActivity(this); |
103 | + EventBus.getDefault().register(this); | ||
95 | } | 104 | } |
96 | 105 | ||
97 | @Override | 106 | @Override |
98 | protected void onStop() { | 107 | protected void onStop() { |
99 | super.onStop(); | 108 | super.onStop(); |
100 | WarplySessionManager.onStopActivity(this); | 109 | WarplySessionManager.onStopActivity(this); |
110 | + EventBus.getDefault().unregister(this); | ||
101 | } | 111 | } |
102 | 112 | ||
103 | @Override | 113 | @Override |
... | @@ -112,6 +122,14 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -112,6 +122,14 @@ public class WarpViewActivity extends WarpBaseActivity { |
112 | return super.onKeyDown(keyCode, event); | 122 | return super.onKeyDown(keyCode, event); |
113 | } | 123 | } |
114 | 124 | ||
125 | + @Subscribe() | ||
126 | + public void onMessageEvent(WarplyEventBusManager event) { | ||
127 | + EventBus.getDefault().unregister(this); | ||
128 | + if (event.getQuestionnaire() != null) | ||
129 | + EventBus.getDefault().post(new WarplyEventBusManager(event.getQuestionnaire())); | ||
130 | + finish(); | ||
131 | + } | ||
132 | + | ||
115 | // =========================================================== | 133 | // =========================================================== |
116 | // Methods | 134 | // Methods |
117 | // =========================================================== | 135 | // =========================================================== | ... | ... |
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 20-June-22. | ||
31 | + */ | ||
32 | + | ||
33 | +public class QuestionnaireEventModel { | ||
34 | + private String name; | ||
35 | + private String parameter; | ||
36 | + | ||
37 | + public QuestionnaireEventModel() { | ||
38 | + this.name = ""; | ||
39 | + this.parameter = ""; | ||
40 | + } | ||
41 | + | ||
42 | + public String getName() { | ||
43 | + return name; | ||
44 | + } | ||
45 | + | ||
46 | + public void setName(String name) { | ||
47 | + this.name = name; | ||
48 | + } | ||
49 | + | ||
50 | + public String getParameter() { | ||
51 | + return parameter; | ||
52 | + } | ||
53 | + | ||
54 | + public void setParameter(String parameter) { | ||
55 | + this.parameter = parameter; | ||
56 | + } | ||
57 | +} |
... | @@ -131,11 +131,23 @@ public class WarpUtils { | ... | @@ -131,11 +131,23 @@ public class WarpUtils { |
131 | + "gifts_popup"; | 131 | + "gifts_popup"; |
132 | private static final String PREFERENCES_KEY_MORE_POPUP = PREFERENCES_PREFIX | 132 | private static final String PREFERENCES_KEY_MORE_POPUP = PREFERENCES_PREFIX |
133 | + "more_popup"; | 133 | + "more_popup"; |
134 | + private static final String PREFERENCES_KEY_USER_TAG = PREFERENCES_PREFIX | ||
135 | + + "user_badge"; | ||
134 | 136 | ||
135 | private static SharedPreferences _prefs; | 137 | private static SharedPreferences _prefs; |
136 | 138 | ||
137 | /* Public methods */ | 139 | /* Public methods */ |
138 | 140 | ||
141 | + public static String getUserTag(Context context) { | ||
142 | + return getPreferences(context).getString(PREFERENCES_KEY_USER_TAG, ""); | ||
143 | + } | ||
144 | + | ||
145 | + public static void setUserTag(Context context, String userTag) { | ||
146 | + SharedPreferences.Editor editor = getPreferences(context).edit(); | ||
147 | + editor.putString(PREFERENCES_KEY_USER_TAG, userTag); | ||
148 | + editor.apply(); | ||
149 | + } | ||
150 | + | ||
139 | /** | 151 | /** |
140 | * Method used to return the token of this device for the GCM service | 152 | * Method used to return the token of this device for the GCM service |
141 | * | 153 | * | ... | ... |
... | @@ -93,7 +93,6 @@ public class WarplyManagerHelper { | ... | @@ -93,7 +93,6 @@ public class WarplyManagerHelper { |
93 | * Open Warply campaign with sharing id | 93 | * Open Warply campaign with sharing id |
94 | */ | 94 | */ |
95 | public static String constructCampaignUrlForShare(Campaign item, String deeplink) { | 95 | public static String constructCampaignUrlForShare(Campaign item, String deeplink) { |
96 | - item.setNew(false); | ||
97 | String url = item.getIndexUrl() | 96 | String url = item.getIndexUrl() |
98 | + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext()) | 97 | + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext()) |
99 | + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext()) | 98 | + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext()) |
... | @@ -132,10 +131,12 @@ public class WarplyManagerHelper { | ... | @@ -132,10 +131,12 @@ public class WarplyManagerHelper { |
132 | /** | 131 | /** |
133 | * Open Questionnaire | 132 | * Open Questionnaire |
134 | */ | 133 | */ |
135 | - public static void openQuestionnaire() { | 134 | + public static String openQuestionnaire() { |
136 | if (mUniqueCampaignList != null && mUniqueCampaignList.get("questionnaire") != null && mUniqueCampaignList.get("questionnaire").size() > 0) { | 135 | if (mUniqueCampaignList != null && mUniqueCampaignList.get("questionnaire") != null && mUniqueCampaignList.get("questionnaire").size() > 0) { |
137 | - constructCampaignUrl(mUniqueCampaignList.get("questionnaire").get(0)); | 136 | + return constructCampaignUrl(mUniqueCampaignList.get("questionnaire").get(0)); |
138 | } | 137 | } |
138 | + | ||
139 | + return ""; | ||
139 | } | 140 | } |
140 | 141 | ||
141 | /** | 142 | /** |
... | @@ -158,7 +159,7 @@ public class WarplyManagerHelper { | ... | @@ -158,7 +159,7 @@ public class WarplyManagerHelper { |
158 | * Get user badge tag | 159 | * Get user badge tag |
159 | */ | 160 | */ |
160 | public static String getUserTag() { | 161 | public static String getUserTag() { |
161 | - return "traveller"; //TODO: change in production with actual code | 162 | + return WarpUtils.getUserTag(Warply.getWarplyContext()); |
162 | } | 163 | } |
163 | 164 | ||
164 | public static void setDFYCouponPurchase(String couponcode, String merchantid) { | 165 | public static void setDFYCouponPurchase(String couponcode, String merchantid) { |
... | @@ -183,7 +184,7 @@ public class WarplyManagerHelper { | ... | @@ -183,7 +184,7 @@ public class WarplyManagerHelper { |
183 | * Set the List with CCMS Campaigns | 184 | * Set the List with CCMS Campaigns |
184 | */ | 185 | */ |
185 | public static void setCCMSLoyaltyCampaigns(ArrayList<LoyaltyContextualOfferModel> list) { | 186 | public static void setCCMSLoyaltyCampaigns(ArrayList<LoyaltyContextualOfferModel> list) { |
186 | - | 187 | +//TODO: create |
187 | } | 188 | } |
188 | 189 | ||
189 | public static Consumer getConsumer() { | 190 | public static Consumer getConsumer() { | ... | ... |
... | @@ -5,6 +5,7 @@ import java.util.HashMap; | ... | @@ -5,6 +5,7 @@ import java.util.HashMap; |
5 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 5 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; |
6 | import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent; | 6 | import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent; |
7 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | 7 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; |
8 | +import ly.warp.sdk.io.models.QuestionnaireEventModel; | ||
8 | import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; | 9 | import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; |
9 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; | 10 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; |
10 | import ly.warp.sdk.io.models.WarplyPacingCardEventModel; | 11 | import ly.warp.sdk.io.models.WarplyPacingCardEventModel; |
... | @@ -23,6 +24,7 @@ public class WarplyEventBusManager { | ... | @@ -23,6 +24,7 @@ public class WarplyEventBusManager { |
23 | private WarplyDealsAnalysisEventModel dealsAnalysis; | 24 | private WarplyDealsAnalysisEventModel dealsAnalysis; |
24 | private WarplyCCMSEnabledModel ccmsActivated; | 25 | private WarplyCCMSEnabledModel ccmsActivated; |
25 | private LoyaltyGiftsForYouOfferClickEvent giftsYou; | 26 | private LoyaltyGiftsForYouOfferClickEvent giftsYou; |
27 | + private QuestionnaireEventModel questionnaire; | ||
26 | 28 | ||
27 | public WarplyEventBusManager() { | 29 | public WarplyEventBusManager() { |
28 | 30 | ||
... | @@ -32,6 +34,10 @@ public class WarplyEventBusManager { | ... | @@ -32,6 +34,10 @@ public class WarplyEventBusManager { |
32 | this.eventName = eventName; | 34 | this.eventName = eventName; |
33 | } | 35 | } |
34 | 36 | ||
37 | + public WarplyEventBusManager(QuestionnaireEventModel questionnaire) { | ||
38 | + this.questionnaire = questionnaire; | ||
39 | + } | ||
40 | + | ||
35 | public WarplyEventBusManager(LoyaltySDKFirebaseEventModel fireEvent) { | 41 | public WarplyEventBusManager(LoyaltySDKFirebaseEventModel fireEvent) { |
36 | this.fireEvent = fireEvent; | 42 | this.fireEvent = fireEvent; |
37 | } | 43 | } |
... | @@ -117,4 +123,8 @@ public class WarplyEventBusManager { | ... | @@ -117,4 +123,8 @@ public class WarplyEventBusManager { |
117 | public LoyaltyGiftsForYouOfferClickEvent getGiftsYou() { | 123 | public LoyaltyGiftsForYouOfferClickEvent getGiftsYou() { |
118 | return giftsYou; | 124 | return giftsYou; |
119 | } | 125 | } |
126 | + | ||
127 | + public QuestionnaireEventModel getQuestionnaire() { | ||
128 | + return questionnaire; | ||
129 | + } | ||
120 | } | 130 | } | ... | ... |
... | @@ -62,6 +62,7 @@ import java.util.LinkedHashMap; | ... | @@ -62,6 +62,7 @@ import java.util.LinkedHashMap; |
62 | import java.util.Map; | 62 | import java.util.Map; |
63 | 63 | ||
64 | import ly.warp.sdk.Warply; | 64 | import ly.warp.sdk.Warply; |
65 | +import ly.warp.sdk.io.models.QuestionnaireEventModel; | ||
65 | import ly.warp.sdk.utils.WarpUtils; | 66 | import ly.warp.sdk.utils.WarpUtils; |
66 | import ly.warp.sdk.utils.WarplyProperty; | 67 | import ly.warp.sdk.utils.WarplyProperty; |
67 | import ly.warp.sdk.utils.WarplyUrlHandler; | 68 | import ly.warp.sdk.utils.WarplyUrlHandler; |
... | @@ -369,8 +370,20 @@ public class WarpView extends WebView { | ... | @@ -369,8 +370,20 @@ public class WarpView extends WebView { |
369 | // intent.putExtra(android.content.Intent.EXTRA_TEXT, message); | 370 | // intent.putExtra(android.content.Intent.EXTRA_TEXT, message); |
370 | // getContext().startActivity(Intent.createChooser(intent, "Άνοιγμα με")); | 371 | // getContext().startActivity(Intent.createChooser(intent, "Άνοιγμα με")); |
371 | 372 | ||
372 | - if (message.contains("event")) | 373 | + if (message.contains("event")) { |
373 | - EventBus.getDefault().post(new WarplyEventBusManager(message)); | 374 | + String[] parts = message.split(":"); |
375 | + if (parts[1].equals("closeArtwork")) { | ||
376 | + QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel(); | ||
377 | + questionnaireEvent.setName(parts[1]); | ||
378 | + EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); | ||
379 | + } else if (parts[1].equals("addUserTag")) { | ||
380 | + QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel(); | ||
381 | + questionnaireEvent.setName(parts[1]); | ||
382 | + questionnaireEvent.setParameter(parts[2]); | ||
383 | + WarpUtils.setUserTag(Warply.getWarplyContext(), parts[2]); | ||
384 | + EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); | ||
385 | + } | ||
386 | + } | ||
374 | } | 387 | } |
375 | } | 388 | } |
376 | 389 | ... | ... |
-
Please register or login to post a comment