Showing
11 changed files
with
254 additions
and
37 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.6rc58' | 5 | + PUBLISH_VERSION = '4.5.4.6rc59' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ||
... | @@ -107,6 +107,9 @@ dependencies { | ... | @@ -107,6 +107,9 @@ dependencies { |
107 | 107 | ||
108 | //------------------------------ Expandable Layout -----------------------------// | 108 | //------------------------------ Expandable Layout -----------------------------// |
109 | api 'net.cachapa.expandablelayout:expandablelayout:2.9.2' | 109 | api 'net.cachapa.expandablelayout:expandablelayout:2.9.2' |
110 | + | ||
111 | + //------------------------------ Lifecycle -----------------------------// | ||
112 | + implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" | ||
110 | } | 113 | } |
111 | 114 | ||
112 | // In every export please update the version number | 115 | // In every export please update the version number | ... | ... |
... | @@ -54,7 +54,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -54,7 +54,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
54 | 54 | ||
55 | private ImageView mIvBack, mIvCouponPhoto, mIvBarcode; | 55 | private ImageView mIvBack, mIvCouponPhoto, mIvBarcode; |
56 | private TextView mTvTerms, mTvCouponCode, mTvCouponTitle, mTvCouponSubtitle, mTvCouponDate, | 56 | private TextView mTvTerms, mTvCouponCode, mTvCouponTitle, mTvCouponSubtitle, mTvCouponDate, |
57 | - mTvTermsValue, mTvFullBarcode, mTvDescription; | 57 | + mTvTermsValue, mTvFullBarcode, mTvDescription, mTvCouponCodeTitle; |
58 | private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms, mLlWebsite; | 58 | private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms, mLlWebsite; |
59 | private Coupon mCoupon; | 59 | private Coupon mCoupon; |
60 | private Couponset mCouponset; | 60 | private Couponset mCouponset; |
... | @@ -90,6 +90,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -90,6 +90,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
90 | mTvTermsValue = findViewById(R.id.tv_terms_value); | 90 | mTvTermsValue = findViewById(R.id.tv_terms_value); |
91 | mTvFullBarcode = findViewById(R.id.tv_full_barcode); | 91 | mTvFullBarcode = findViewById(R.id.tv_full_barcode); |
92 | mTvDescription = findViewById(R.id.tv_clickable_link); | 92 | mTvDescription = findViewById(R.id.tv_clickable_link); |
93 | + mTvCouponCodeTitle = findViewById(R.id.textView15); | ||
93 | 94 | ||
94 | initViews(); | 95 | initViews(); |
95 | } | 96 | } |
... | @@ -199,6 +200,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -199,6 +200,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
199 | // =========================================================== | 200 | // =========================================================== |
200 | 201 | ||
201 | private void initViews() { | 202 | private void initViews() { |
203 | + if (mIsFromWallet) { | ||
204 | + mTvCouponCodeTitle.setVisibility(View.GONE); | ||
205 | + mTvCouponCode.setVisibility(View.GONE); | ||
206 | + } | ||
202 | mLlBarcodeShown.setVisibility(View.GONE); | 207 | mLlBarcodeShown.setVisibility(View.GONE); |
203 | mLlBarcodeContainer.setVisibility(View.GONE); | 208 | mLlBarcodeContainer.setVisibility(View.GONE); |
204 | mIvBarcode.setVisibility(View.GONE); | 209 | mIvBarcode.setVisibility(View.GONE); |
... | @@ -245,6 +250,37 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -245,6 +250,37 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
245 | mTvCouponSubtitle.setText(mCouponset.getShortDescription()); | 250 | mTvCouponSubtitle.setText(mCouponset.getShortDescription()); |
246 | mTvTermsValue.setText(HtmlCompat.fromHtml(mCouponset.getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT)); | 251 | mTvTermsValue.setText(HtmlCompat.fromHtml(mCouponset.getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT)); |
247 | mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance()); | 252 | mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance()); |
253 | + } else { | ||
254 | + if (mIsFromWallet) { | ||
255 | + if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) { | ||
256 | + for (Merchant merchant : WarplyManagerHelper.getMerchantList()) { | ||
257 | + if (merchant.getUuid().equals(mCoupon.getMerchantUuid())) { | ||
258 | + mMerchant = merchant; | ||
259 | + break; | ||
260 | + } | ||
261 | + } | ||
262 | + | ||
263 | + if (mMerchant != null && !TextUtils.isEmpty(mMerchant.getBody()) && !mMerchant.getBody().equals("null")) { | ||
264 | + mTvDescription.setText(HtmlCompat.fromHtml(mMerchant.getBody(), HtmlCompat.FROM_HTML_MODE_COMPACT)); | ||
265 | + mTvDescription.setMovementMethod(LinkMovementMethod.getInstance()); | ||
266 | + } else { | ||
267 | + mTvDescription.setVisibility(View.GONE); | ||
268 | + } | ||
269 | + | ||
270 | +// if (mMerchant != null) { | ||
271 | +// if (mMerchant.getExtraFields() != null && mMerchant.getExtraFields().has("show_map") && (mMerchant.getExtraFields().optBoolean("show_map") || mMerchant.getExtraFields().optString("show_map").equals("true"))) { | ||
272 | + mLlShops.setVisibility(View.VISIBLE); | ||
273 | +// } | ||
274 | +// if (mMerchant.getExtraFields() != null && mMerchant.getExtraFields().has("eshop") && (mMerchant.getExtraFields().optBoolean("eshop") || mMerchant.getExtraFields().optString("eshop").equals("true"))) { | ||
275 | +// mLlWebsite.setVisibility(View.VISIBLE); | ||
276 | +// } | ||
277 | +// } | ||
278 | + } | ||
279 | + | ||
280 | + mTvCouponSubtitle.setText(mCoupon.getShort_description()); | ||
281 | + mTvTermsValue.setText(HtmlCompat.fromHtml(mCoupon.getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT)); | ||
282 | + mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance()); | ||
283 | + } | ||
248 | } | 284 | } |
249 | 285 | ||
250 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | 286 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ... | ... |
... | @@ -21,6 +21,7 @@ import com.google.zxing.BarcodeFormat; | ... | @@ -21,6 +21,7 @@ import com.google.zxing.BarcodeFormat; |
21 | import com.google.zxing.common.BitMatrix; | 21 | import com.google.zxing.common.BitMatrix; |
22 | import com.google.zxing.oned.EAN13Writer; | 22 | import com.google.zxing.oned.EAN13Writer; |
23 | 23 | ||
24 | +import java.io.Serializable; | ||
24 | import java.text.ParseException; | 25 | import java.text.ParseException; |
25 | import java.text.SimpleDateFormat; | 26 | import java.text.SimpleDateFormat; |
26 | import java.util.Collections; | 27 | import java.util.Collections; |
... | @@ -202,11 +203,11 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL | ... | @@ -202,11 +203,11 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL |
202 | mRecyclerCoupons.setAdapter(mAdapterCoupons); | 203 | mRecyclerCoupons.setAdapter(mAdapterCoupons); |
203 | mAdapterCoupons.getPositionClicks() | 204 | mAdapterCoupons.getPositionClicks() |
204 | .doOnNext(coupon -> { | 205 | .doOnNext(coupon -> { |
205 | -// WarplyAnalyticsManager.logTrackersEvent(this, "click", ("MarketCoupon").concat(":").concat(coupon.getName())); | 206 | + WarplyAnalyticsManager.logTrackersEvent(this, "click", ("MarketCoupon").concat(":").concat(coupon.getName())); |
206 | -// Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class); | 207 | + Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class); |
207 | -// intent.putExtra("coupon", (Serializable) coupon); | 208 | + intent.putExtra("coupon", (Serializable) coupon); |
208 | -// intent.putExtra("isFromWallet", true); | 209 | + intent.putExtra("isFromWallet", true); |
209 | -// startActivityForResult(intent, 1002); | 210 | + startActivity(intent); |
210 | }) | 211 | }) |
211 | .doOnError(error -> { | 212 | .doOnError(error -> { |
212 | }) | 213 | }) | ... | ... |
... | @@ -30,6 +30,7 @@ import static ly.warp.sdk.utils.constants.WarpConstants.RANDOM_MIN; | ... | @@ -30,6 +30,7 @@ import static ly.warp.sdk.utils.constants.WarpConstants.RANDOM_MIN; |
30 | 30 | ||
31 | import android.content.Context; | 31 | import android.content.Context; |
32 | import android.content.Intent; | 32 | import android.content.Intent; |
33 | +import android.content.pm.PackageManager; | ||
33 | import android.graphics.Color; | 34 | import android.graphics.Color; |
34 | import android.os.Build; | 35 | import android.os.Build; |
35 | import android.os.Bundle; | 36 | import android.os.Bundle; |
... | @@ -43,6 +44,7 @@ import android.widget.ProgressBar; | ... | @@ -43,6 +44,7 @@ import android.widget.ProgressBar; |
43 | import android.widget.RelativeLayout; | 44 | import android.widget.RelativeLayout; |
44 | 45 | ||
45 | import androidx.annotation.NonNull; | 46 | import androidx.annotation.NonNull; |
47 | +import androidx.lifecycle.ProcessLifecycleOwner; | ||
46 | import androidx.work.Constraints; | 48 | import androidx.work.Constraints; |
47 | import androidx.work.NetworkType; | 49 | import androidx.work.NetworkType; |
48 | import androidx.work.OneTimeWorkRequest; | 50 | import androidx.work.OneTimeWorkRequest; |
... | @@ -64,12 +66,12 @@ import ly.warp.sdk.Warply; | ... | @@ -64,12 +66,12 @@ import ly.warp.sdk.Warply; |
64 | import ly.warp.sdk.db.WarplyDBHelper; | 66 | import ly.warp.sdk.db.WarplyDBHelper; |
65 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 67 | import ly.warp.sdk.io.callbacks.CallbackReceiver; |
66 | import ly.warp.sdk.io.models.CouponList; | 68 | import ly.warp.sdk.io.models.CouponList; |
69 | +import ly.warp.sdk.io.models.WarplyWebviewActivityCallbackEventModel; | ||
70 | +import ly.warp.sdk.io.models.WarplyWebviewCallbackEventModel; | ||
67 | import ly.warp.sdk.io.request.PacingCalculateRequest; | 71 | import ly.warp.sdk.io.request.PacingCalculateRequest; |
68 | -import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | ||
69 | import ly.warp.sdk.services.EventCampaignCouponService; | 72 | import ly.warp.sdk.services.EventCampaignCouponService; |
70 | import ly.warp.sdk.services.EventQuestionnaireService; | 73 | import ly.warp.sdk.services.EventQuestionnaireService; |
71 | import ly.warp.sdk.services.PushEventsClickedWorkerService; | 74 | import ly.warp.sdk.services.PushEventsClickedWorkerService; |
72 | -import ly.warp.sdk.services.WarplyHealthService; | ||
73 | import ly.warp.sdk.utils.WarpJSONParser; | 75 | import ly.warp.sdk.utils.WarpJSONParser; |
74 | import ly.warp.sdk.utils.WarpUtils; | 76 | import ly.warp.sdk.utils.WarpUtils; |
75 | import ly.warp.sdk.utils.WarplyManagerHelper; | 77 | import ly.warp.sdk.utils.WarplyManagerHelper; |
... | @@ -128,8 +130,7 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -128,8 +130,7 @@ public class WarpViewActivity extends WarpBaseActivity { |
128 | @Override | 130 | @Override |
129 | protected void onDestroy() { | 131 | protected void onDestroy() { |
130 | super.onDestroy(); | 132 | super.onDestroy(); |
131 | - if (metersHandler != null) | 133 | + if (metersHandler != null) metersHandler.removeCallbacksAndMessages(null); |
132 | - metersHandler.removeCallbacksAndMessages(null); | ||
133 | sendSteps(); | 134 | sendSteps(); |
134 | WarpUtils.setWebviewParams(this, new JSONObject()); | 135 | WarpUtils.setWebviewParams(this, new JSONObject()); |
135 | } | 136 | } |
... | @@ -146,6 +147,28 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -146,6 +147,28 @@ public class WarpViewActivity extends WarpBaseActivity { |
146 | return super.onKeyDown(keyCode, event); | 147 | return super.onKeyDown(keyCode, event); |
147 | } | 148 | } |
148 | 149 | ||
150 | + @Override | ||
151 | + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | ||
152 | + super.onRequestPermissionsResult(requestCode, permissions, grantResults); | ||
153 | + if (requestCode == 3001) { | ||
154 | + WarplyWebviewCallbackEventModel webviewCallbackEventModel = new WarplyWebviewCallbackEventModel(); | ||
155 | + webviewCallbackEventModel.setRequestId(requestCode); | ||
156 | + webviewCallbackEventModel.setResponseCode(grantResults[0] == PackageManager.PERMISSION_GRANTED ? "allow" : "deny"); | ||
157 | + EventBus.getDefault().post(new WarplyEventBusManager(webviewCallbackEventModel)); | ||
158 | + } | ||
159 | + } | ||
160 | + | ||
161 | + @Override | ||
162 | + protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
163 | + super.onActivityResult(requestCode, resultCode, data); | ||
164 | + if (requestCode == 3002 || requestCode == 3003) { | ||
165 | + WarplyWebviewActivityCallbackEventModel webviewCallbackEventModel = new WarplyWebviewActivityCallbackEventModel(); | ||
166 | + webviewCallbackEventModel.setRequestId(requestCode); | ||
167 | + webviewCallbackEventModel.setResponseCode(resultCode == RESULT_OK ? "enabled" : "disabled"); | ||
168 | + EventBus.getDefault().post(new WarplyEventBusManager(webviewCallbackEventModel)); | ||
169 | + } | ||
170 | + } | ||
171 | + | ||
149 | @Subscribe() | 172 | @Subscribe() |
150 | public void onMessageEvent(WarplyEventBusManager event) { | 173 | public void onMessageEvent(WarplyEventBusManager event) { |
151 | // EventBus.getDefault().unregister(this); | 174 | // EventBus.getDefault().unregister(this); |
... | @@ -163,8 +186,7 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -163,8 +186,7 @@ public class WarpViewActivity extends WarpBaseActivity { |
163 | // finish(); | 186 | // finish(); |
164 | // if (event.getPacingService() != null) | 187 | // if (event.getPacingService() != null) |
165 | // finish(); | 188 | // finish(); |
166 | - if (event.getPacing() != null && !event.getPacing().isVisible()) | 189 | + if (event.getPacing() != null && !event.getPacing().isVisible()) finish(); |
167 | - finish(); | ||
168 | } | 190 | } |
169 | 191 | ||
170 | // =========================================================== | 192 | // =========================================================== |
... | @@ -177,19 +199,15 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -177,19 +199,15 @@ public class WarpViewActivity extends WarpBaseActivity { |
177 | root.setBackgroundColor(Color.WHITE); | 199 | root.setBackgroundColor(Color.WHITE); |
178 | 200 | ||
179 | final ImageView ivLogo = new ImageView(this); | 201 | final ImageView ivLogo = new ImageView(this); |
180 | - RelativeLayout.LayoutParams ivLogoParams = new RelativeLayout.LayoutParams( | 202 | + RelativeLayout.LayoutParams ivLogoParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); |
181 | - RelativeLayout.LayoutParams.WRAP_CONTENT, | ||
182 | - RelativeLayout.LayoutParams.WRAP_CONTENT); | ||
183 | ivLogoParams.addRule(RelativeLayout.CENTER_IN_PARENT); | 203 | ivLogoParams.addRule(RelativeLayout.CENTER_IN_PARENT); |
184 | root.addView(ivLogo, ivLogoParams); | 204 | root.addView(ivLogo, ivLogoParams); |
185 | 205 | ||
186 | ivLogo.setImageDrawable(WarplyProperty.getProgressDrawable(this)); | 206 | ivLogo.setImageDrawable(WarplyProperty.getProgressDrawable(this)); |
187 | ivLogo.startAnimation(WarpUtils.getPulseAnimation()); | 207 | ivLogo.startAnimation(WarpUtils.getPulseAnimation()); |
188 | 208 | ||
189 | - mWarpView = new WarpView(this); | 209 | + mWarpView = new WarpView(this, WarpViewActivity.this, true); |
190 | - RelativeLayout.LayoutParams warpViewParams = new RelativeLayout.LayoutParams( | 210 | + RelativeLayout.LayoutParams warpViewParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); |
191 | - RelativeLayout.LayoutParams.MATCH_PARENT, | ||
192 | - RelativeLayout.LayoutParams.MATCH_PARENT); | ||
193 | root.setFitsSystemWindows(true); | 211 | root.setFitsSystemWindows(true); |
194 | root.addView(mWarpView, warpViewParams); | 212 | root.addView(mWarpView, warpViewParams); |
195 | 213 | ||
... | @@ -197,9 +215,7 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -197,9 +215,7 @@ public class WarpViewActivity extends WarpBaseActivity { |
197 | int progressHeightDp = 7; | 215 | int progressHeightDp = 7; |
198 | final ProgressBar progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal); | 216 | final ProgressBar progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal); |
199 | progressBar.setProgressDrawable(WarpUtils.getHorizontalProgressDrawable(WarplyProperty.getProgressColor(this))); | 217 | progressBar.setProgressDrawable(WarpUtils.getHorizontalProgressDrawable(WarplyProperty.getProgressColor(this))); |
200 | - RelativeLayout.LayoutParams progressBarParams = new RelativeLayout.LayoutParams( | 218 | + RelativeLayout.LayoutParams progressBarParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, (int) (progressHeightDp * getResources().getDisplayMetrics().density + 0.5f)); |
201 | - RelativeLayout.LayoutParams.MATCH_PARENT, (int) | ||
202 | - (progressHeightDp * getResources().getDisplayMetrics().density + 0.5f)); | ||
203 | mWarpView.setProgressChangeListener(new WarpView.ProgressChangeListener() { | 219 | mWarpView.setProgressChangeListener(new WarpView.ProgressChangeListener() { |
204 | @Override | 220 | @Override |
205 | public void onProgressChanged(WebView view, int newProgress) { | 221 | public void onProgressChanged(WebView view, int newProgress) { |
... | @@ -224,8 +240,7 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -224,8 +240,7 @@ public class WarpViewActivity extends WarpBaseActivity { |
224 | String sessionUUID = intent.getStringExtra("sessionUUID"); | 240 | String sessionUUID = intent.getStringExtra("sessionUUID"); |
225 | 241 | ||
226 | // user viewed campaign through notification | 242 | // user viewed campaign through notification |
227 | - if (intent.hasExtra("source") && intent.getStringExtra("source"). | 243 | + if (intent.hasExtra("source") && intent.getStringExtra("source").equalsIgnoreCase("from_notification_status")) { |
228 | - equalsIgnoreCase("from_notification_status")) { | ||
229 | JSONObject params = new JSONObject(); | 244 | JSONObject params = new JSONObject(); |
230 | try { | 245 | try { |
231 | params.putOpt("web_id", WarpUtils.getWebId(Warply.getWarplyContext())); | 246 | params.putOpt("web_id", WarpUtils.getWebId(Warply.getWarplyContext())); |
... | @@ -246,8 +261,7 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -246,8 +261,7 @@ public class WarpViewActivity extends WarpBaseActivity { |
246 | } | 261 | } |
247 | 262 | ||
248 | // ensure update campaigns and count if was used cache | 263 | // ensure update campaigns and count if was used cache |
249 | - if (Warply.INSTANCE.getLastReceivedCampaigns() != null && | 264 | + if (Warply.INSTANCE.getLastReceivedCampaigns() != null && Warply.INSTANCE.getLastReceivedCampaigns().containsUuid(sessionUUID)) { |
250 | - Warply.INSTANCE.getLastReceivedCampaigns().containsUuid(sessionUUID)) { | ||
251 | new WarplyPreferences(this).clearInboxLastCachedTimeStamps(); | 265 | new WarplyPreferences(this).clearInboxLastCachedTimeStamps(); |
252 | } | 266 | } |
253 | 267 | ||
... | @@ -263,10 +277,7 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -263,10 +277,7 @@ public class WarpViewActivity extends WarpBaseActivity { |
263 | 277 | ||
264 | // if (WorkManager.getInstance(this).getWorkInfosByTag(PushEventsWorkerService.TAG).isDone() || WorkManager.getInstance(this).getWorkInfosByTag(PushEventsWorkerService.TAG).isCancelled()) { | 278 | // if (WorkManager.getInstance(this).getWorkInfosByTag(PushEventsWorkerService.TAG).isDone() || WorkManager.getInstance(this).getWorkInfosByTag(PushEventsWorkerService.TAG).isCancelled()) { |
265 | Constraints constraints = new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build(); | 279 | Constraints constraints = new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build(); |
266 | - OneTimeWorkRequest sendEvent = new OneTimeWorkRequest.Builder(PushEventsClickedWorkerService.class) | 280 | + OneTimeWorkRequest sendEvent = new OneTimeWorkRequest.Builder(PushEventsClickedWorkerService.class).setConstraints(constraints).setInitialDelay(defineRandomStart(), TimeUnit.MINUTES).build(); |
267 | - .setConstraints(constraints) | ||
268 | - .setInitialDelay(defineRandomStart(), TimeUnit.MINUTES) | ||
269 | - .build(); | ||
270 | 281 | ||
271 | WorkManager.getInstance(this).enqueue(sendEvent); | 282 | WorkManager.getInstance(this).enqueue(sendEvent); |
272 | // } | 283 | // } |
... | @@ -319,10 +330,7 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -319,10 +330,7 @@ public class WarpViewActivity extends WarpBaseActivity { |
319 | String date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.getDefault()).format(new Date()); | 330 | String date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.getDefault()).format(new Date()); |
320 | WarpUtils.log("SEND_STEPS: " + String.valueOf(WarpUtils.getStepsCounter(this))); | 331 | WarpUtils.log("SEND_STEPS: " + String.valueOf(WarpUtils.getStepsCounter(this))); |
321 | if (WarpUtils.getStepsCounter(this) > 0) { | 332 | if (WarpUtils.getStepsCounter(this) > 0) { |
322 | - WarplyManager.setPacingDetails(new PacingCalculateRequest() | 333 | + WarplyManager.setPacingDetails(new PacingCalculateRequest().setCounter(WarpUtils.getStepsCounter(this)).setDate(date), new CallbackReceiver<JSONObject>() { |
323 | - .setCounter(WarpUtils.getStepsCounter(this)) | ||
324 | - .setDate(date), | ||
325 | - new CallbackReceiver<JSONObject>() { | ||
326 | @Override | 334 | @Override |
327 | public void onSuccess(JSONObject result) { | 335 | public void onSuccess(JSONObject result) { |
328 | int status = result.optInt("status", 2); | 336 | int status = result.optInt("status", 2); | ... | ... |
... | @@ -65,6 +65,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -65,6 +65,8 @@ public class Coupon implements Parcelable, Serializable { |
65 | private static final String INNER_TEXT = "inner_text"; | 65 | private static final String INNER_TEXT = "inner_text"; |
66 | private static final String FINAL_PRICE = "final_price"; | 66 | private static final String FINAL_PRICE = "final_price"; |
67 | private static final String DISCOUNT_TYPE = "discount_type"; | 67 | private static final String DISCOUNT_TYPE = "discount_type"; |
68 | + private static final String SHORT_DESCRIPTION = "short_description"; | ||
69 | + private static final String TERMS = "terms"; | ||
68 | 70 | ||
69 | /* Member variables of the Campaign object */ | 71 | /* Member variables of the Campaign object */ |
70 | 72 | ||
... | @@ -87,6 +89,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -87,6 +89,8 @@ public class Coupon implements Parcelable, Serializable { |
87 | private Date expirationDate = new Date(); | 89 | private Date expirationDate = new Date(); |
88 | private String discount_type = ""; | 90 | private String discount_type = ""; |
89 | private double final_price = 0.0d; | 91 | private double final_price = 0.0d; |
92 | + private String short_description = ""; | ||
93 | + private String terms = ""; | ||
90 | 94 | ||
91 | public Coupon() { | 95 | public Coupon() { |
92 | this.barcode = ""; | 96 | this.barcode = ""; |
... | @@ -108,6 +112,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -108,6 +112,8 @@ public class Coupon implements Parcelable, Serializable { |
108 | this.expirationDate = new Date(); | 112 | this.expirationDate = new Date(); |
109 | this.discount_type = ""; | 113 | this.discount_type = ""; |
110 | this.final_price = 0.0d; | 114 | this.final_price = 0.0d; |
115 | + this.short_description = ""; | ||
116 | + this.terms = ""; | ||
111 | } | 117 | } |
112 | 118 | ||
113 | /** | 119 | /** |
... | @@ -146,6 +152,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -146,6 +152,8 @@ public class Coupon implements Parcelable, Serializable { |
146 | this.innerText = json.optString(INNER_TEXT); | 152 | this.innerText = json.optString(INNER_TEXT); |
147 | this.discount_type = json.isNull(DISCOUNT_TYPE) ? "" : json.optString(DISCOUNT_TYPE); | 153 | this.discount_type = json.isNull(DISCOUNT_TYPE) ? "" : json.optString(DISCOUNT_TYPE); |
148 | this.final_price = json.optDouble(FINAL_PRICE); | 154 | this.final_price = json.optDouble(FINAL_PRICE); |
155 | + this.short_description = json.optString(SHORT_DESCRIPTION); | ||
156 | + this.terms = json.optString(TERMS); | ||
149 | } | 157 | } |
150 | } | 158 | } |
151 | 159 | ||
... | @@ -167,6 +175,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -167,6 +175,8 @@ public class Coupon implements Parcelable, Serializable { |
167 | this.innerText = source.readString(); | 175 | this.innerText = source.readString(); |
168 | this.discount_type = source.readString(); | 176 | this.discount_type = source.readString(); |
169 | this.final_price = source.readDouble(); | 177 | this.final_price = source.readDouble(); |
178 | + this.short_description = source.readString(); | ||
179 | + this.terms = source.readString(); | ||
170 | } | 180 | } |
171 | 181 | ||
172 | @Override | 182 | @Override |
... | @@ -188,6 +198,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -188,6 +198,8 @@ public class Coupon implements Parcelable, Serializable { |
188 | dest.writeString(this.innerText); | 198 | dest.writeString(this.innerText); |
189 | dest.writeString(this.discount_type); | 199 | dest.writeString(this.discount_type); |
190 | dest.writeDouble(this.final_price); | 200 | dest.writeDouble(this.final_price); |
201 | + dest.writeString(this.short_description); | ||
202 | + dest.writeString(this.terms); | ||
191 | } | 203 | } |
192 | 204 | ||
193 | /** | 205 | /** |
... | @@ -216,6 +228,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -216,6 +228,8 @@ public class Coupon implements Parcelable, Serializable { |
216 | jObj.putOpt(INNER_TEXT, this.innerText); | 228 | jObj.putOpt(INNER_TEXT, this.innerText); |
217 | jObj.putOpt(DISCOUNT_TYPE, this.discount_type); | 229 | jObj.putOpt(DISCOUNT_TYPE, this.discount_type); |
218 | jObj.putOpt(FINAL_PRICE, this.final_price); | 230 | jObj.putOpt(FINAL_PRICE, this.final_price); |
231 | + jObj.putOpt(SHORT_DESCRIPTION, this.short_description); | ||
232 | + jObj.putOpt(TERMS, this.terms); | ||
219 | } catch (JSONException e) { | 233 | } catch (JSONException e) { |
220 | if (WarpConstants.DEBUG) { | 234 | if (WarpConstants.DEBUG) { |
221 | e.printStackTrace(); | 235 | e.printStackTrace(); |
... | @@ -407,6 +421,22 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -407,6 +421,22 @@ public class Coupon implements Parcelable, Serializable { |
407 | this.final_price = final_price; | 421 | this.final_price = final_price; |
408 | } | 422 | } |
409 | 423 | ||
424 | + public String getShort_description() { | ||
425 | + return short_description; | ||
426 | + } | ||
427 | + | ||
428 | + public void setShort_description(String short_description) { | ||
429 | + this.short_description = short_description; | ||
430 | + } | ||
431 | + | ||
432 | + public String getTerms() { | ||
433 | + return terms; | ||
434 | + } | ||
435 | + | ||
436 | + public void setTerms(String terms) { | ||
437 | + this.terms = terms; | ||
438 | + } | ||
439 | + | ||
410 | @Override | 440 | @Override |
411 | public int describeContents() { | 441 | public int describeContents() { |
412 | return 0; | 442 | return 0; | ... | ... |
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/WarplyWebviewActivityCallbackEventModel.java
0 → 100644
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 14-June-23. | ||
31 | + */ | ||
32 | + | ||
33 | +public class WarplyWebviewActivityCallbackEventModel { | ||
34 | + private String responseCode; | ||
35 | + private int requestId; | ||
36 | + | ||
37 | + public WarplyWebviewActivityCallbackEventModel() { | ||
38 | + this.requestId = -1; | ||
39 | + this.responseCode = ""; | ||
40 | + } | ||
41 | + | ||
42 | + public int getRequestId() { | ||
43 | + return requestId; | ||
44 | + } | ||
45 | + | ||
46 | + public String getResponseCode() { | ||
47 | + return responseCode; | ||
48 | + } | ||
49 | + | ||
50 | + public void setRequestId(int requestId) { | ||
51 | + this.requestId = requestId; | ||
52 | + } | ||
53 | + | ||
54 | + public void setResponseCode(String responseCode) { | ||
55 | + this.responseCode = responseCode; | ||
56 | + } | ||
57 | +} |
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/WarplyWebviewCallbackEventModel.java
0 → 100644
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 13-June-23. | ||
31 | + */ | ||
32 | + | ||
33 | +public class WarplyWebviewCallbackEventModel { | ||
34 | + private String responseCode; | ||
35 | + private int requestId; | ||
36 | + | ||
37 | + public WarplyWebviewCallbackEventModel() { | ||
38 | + this.requestId = -1; | ||
39 | + this.responseCode = ""; | ||
40 | + } | ||
41 | + | ||
42 | + public int getRequestId() { | ||
43 | + return requestId; | ||
44 | + } | ||
45 | + | ||
46 | + public String getResponseCode() { | ||
47 | + return responseCode; | ||
48 | + } | ||
49 | + | ||
50 | + public void setRequestId(int requestId) { | ||
51 | + this.requestId = requestId; | ||
52 | + } | ||
53 | + | ||
54 | + public void setResponseCode(String responseCode) { | ||
55 | + this.responseCode = responseCode; | ||
56 | + } | ||
57 | +} |
... | @@ -20,6 +20,8 @@ import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; | ... | @@ -20,6 +20,8 @@ import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; |
20 | import ly.warp.sdk.io.models.WarplyPacingCardEventModel; | 20 | import ly.warp.sdk.io.models.WarplyPacingCardEventModel; |
21 | import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel; | 21 | import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel; |
22 | import ly.warp.sdk.io.models.WarplyPacingEventModel; | 22 | import ly.warp.sdk.io.models.WarplyPacingEventModel; |
23 | +import ly.warp.sdk.io.models.WarplyWebviewActivityCallbackEventModel; | ||
24 | +import ly.warp.sdk.io.models.WarplyWebviewCallbackEventModel; | ||
23 | 25 | ||
24 | /** | 26 | /** |
25 | * Created by Panagiotis Triantafyllou on 26/Απρ/2022. | 27 | * Created by Panagiotis Triantafyllou on 26/Απρ/2022. |
... | @@ -46,6 +48,9 @@ public class WarplyEventBusManager { | ... | @@ -46,6 +48,9 @@ public class WarplyEventBusManager { |
46 | private WarplyPacingCardEventModel widgetChanged; | 48 | private WarplyPacingCardEventModel widgetChanged; |
47 | private LoyaltySDKSessionExpiredEventModel sessionExpired; | 49 | private LoyaltySDKSessionExpiredEventModel sessionExpired; |
48 | 50 | ||
51 | + private WarplyWebviewCallbackEventModel webviewCallback; | ||
52 | + private WarplyWebviewActivityCallbackEventModel webviewActivityCallback; | ||
53 | + | ||
49 | public WarplyEventBusManager() { | 54 | public WarplyEventBusManager() { |
50 | 55 | ||
51 | } | 56 | } |
... | @@ -58,11 +63,19 @@ public class WarplyEventBusManager { | ... | @@ -58,11 +63,19 @@ public class WarplyEventBusManager { |
58 | this.questionnaire = questionnaire; | 63 | this.questionnaire = questionnaire; |
59 | } | 64 | } |
60 | 65 | ||
66 | + public WarplyEventBusManager(WarplyWebviewCallbackEventModel webviewCallback) { | ||
67 | + this.webviewCallback = webviewCallback; | ||
68 | + } | ||
69 | + | ||
70 | + public WarplyEventBusManager(WarplyWebviewActivityCallbackEventModel webviewActivityCallback) { | ||
71 | + this.webviewActivityCallback = webviewActivityCallback; | ||
72 | + } | ||
73 | + | ||
61 | public WarplyEventBusManager(ContexualEventModel ccmsAdded) { | 74 | public WarplyEventBusManager(ContexualEventModel ccmsAdded) { |
62 | this.ccmsAdded = ccmsAdded; | 75 | this.ccmsAdded = ccmsAdded; |
63 | } | 76 | } |
64 | 77 | ||
65 | - public WarplyEventBusManager (LoyaltySDKSessionExpiredEventModel sessionExpired) { | 78 | + public WarplyEventBusManager(LoyaltySDKSessionExpiredEventModel sessionExpired) { |
66 | this.sessionExpired = sessionExpired; | 79 | this.sessionExpired = sessionExpired; |
67 | } | 80 | } |
68 | 81 | ||
... | @@ -227,4 +240,12 @@ public class WarplyEventBusManager { | ... | @@ -227,4 +240,12 @@ public class WarplyEventBusManager { |
227 | public LoyaltySDKSessionExpiredEventModel isLoyaltySessionExpired() { | 240 | public LoyaltySDKSessionExpiredEventModel isLoyaltySessionExpired() { |
228 | return sessionExpired; | 241 | return sessionExpired; |
229 | } | 242 | } |
243 | + | ||
244 | + public WarplyWebviewCallbackEventModel getWarplyWebviewCallbackEventModel() { | ||
245 | + return webviewCallback; | ||
246 | + } | ||
247 | + | ||
248 | + public WarplyWebviewActivityCallbackEventModel getWarplyWebviewActivityCallbackEventModel() { | ||
249 | + return webviewActivityCallback; | ||
250 | + } | ||
230 | } | 251 | } | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -170,6 +170,11 @@ | ... | @@ -170,6 +170,11 @@ |
170 | <string name="cos_for_you_all">Μέχρι τώρα έχεις κερδίσει %1$s€ στο For You!</string> | 170 | <string name="cos_for_you_all">Μέχρι τώρα έχεις κερδίσει %1$s€ στο For You!</string> |
171 | <string name="cos_supermarket_win">Έχεις κερδίσει %1$s€ με τα\nSuperMarket Deals!</string> | 171 | <string name="cos_supermarket_win">Έχεις κερδίσει %1$s€ με τα\nSuperMarket Deals!</string> |
172 | <string name="cos_supermarket_history">Μέχρι τώρα έχεις κερδίσει %1$s€ σε προσφορές από %2$s κουπόνια!</string> | 172 | <string name="cos_supermarket_history">Μέχρι τώρα έχεις κερδίσει %1$s€ σε προσφορές από %2$s κουπόνια!</string> |
173 | + <string name="lbl_cosmote_webview_permission_title">COSMOTE</string> | ||
174 | + <string name="lbl_cosmote_webview_permission_message">Το COSMOTE ζητάει πρόσβαση στην τοποθεσία σας.</string> | ||
175 | + <string name="lbl_take_photo_accept">Οκ</string> | ||
176 | + <string name="lbl_take_photo_decline">Άκυρο</string> | ||
177 | + <string name="lbl_gps_enabled">Θέλετε να ενεργοποιήσετε το GPS;</string> | ||
173 | 178 | ||
174 | <string-array name="coupons_array"> | 179 | <string-array name="coupons_array"> |
175 | <item>Κουπόνια</item> | 180 | <item>Κουπόνια</item> | ... | ... |
-
Please register or login to post a comment