Showing
6 changed files
with
47 additions
and
18 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.4r22' | 5 | + PUBLISH_VERSION = '4.5.5.4r23' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -155,10 +155,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -155,10 +155,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
155 | mGiftPressed = true; | 155 | mGiftPressed = true; |
156 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("ShareCoupon") | 156 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("ShareCoupon") |
157 | .concat(":") | 157 | .concat(":") |
158 | - .concat(mCoupon.getName())); | 158 | + .concat(mCoupon != null ? mCoupon.getName() : "")); |
159 | 159 | ||
160 | Intent intent = new Intent(CouponInfoActivity.this, CouponShareActivity.class); | 160 | Intent intent = new Intent(CouponInfoActivity.this, CouponShareActivity.class); |
161 | - intent.putExtra("coupon", mCoupon.getCoupon()); | 161 | + intent.putExtra("coupon", mCoupon != null ? mCoupon.getCoupon() : ""); |
162 | intent.putExtra("isFromWallet", mIsFromWallet); | 162 | intent.putExtra("isFromWallet", mIsFromWallet); |
163 | if (!mIsFromWallet) | 163 | if (!mIsFromWallet) |
164 | startActivity(intent); | 164 | startActivity(intent); |
... | @@ -174,12 +174,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -174,12 +174,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
174 | 174 | ||
175 | if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(CouponInfoActivity.this) == ConnectionResult.SUCCESS) { | 175 | if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(CouponInfoActivity.this) == ConnectionResult.SUCCESS) { |
176 | Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class); | 176 | Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class); |
177 | - intent.putExtra("coupon", mCoupon.getCoupon()); | 177 | + intent.putExtra("coupon", mCoupon != null ? mCoupon.getCoupon() : ""); |
178 | startActivity(intent); | 178 | startActivity(intent); |
179 | return; | 179 | return; |
180 | } else { | 180 | } else { |
181 | Intent intent = new Intent(CouponInfoActivity.this, ShopsHuaweiActivity.class); | 181 | Intent intent = new Intent(CouponInfoActivity.this, ShopsHuaweiActivity.class); |
182 | - intent.putExtra("coupon", mCoupon.getCoupon()); | 182 | + intent.putExtra("coupon", mCoupon != null ? mCoupon.getCoupon() : ""); |
183 | startActivity(intent); | 183 | startActivity(intent); |
184 | return; | 184 | return; |
185 | } | 185 | } |
... | @@ -250,12 +250,14 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -250,12 +250,14 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
250 | mLlBarcodeContainer.setVisibility(View.GONE); | 250 | mLlBarcodeContainer.setVisibility(View.GONE); |
251 | mIvBarcode.setVisibility(View.GONE); | 251 | mIvBarcode.setVisibility(View.GONE); |
252 | 252 | ||
253 | + if (mCoupon != null) { | ||
253 | if (mIsUnified) { | 254 | if (mIsUnified) { |
254 | mTvCouponTitle.setText(HtmlCompat.fromHtml(mCoupon.getName(), HtmlCompat.FROM_HTML_MODE_COMPACT)); | 255 | mTvCouponTitle.setText(HtmlCompat.fromHtml(mCoupon.getName(), HtmlCompat.FROM_HTML_MODE_COMPACT)); |
255 | } else { | 256 | } else { |
256 | mTvCouponCode.setText(mCoupon.getCoupon()); | 257 | mTvCouponCode.setText(mCoupon.getCoupon()); |
257 | mTvCouponTitle.setText(mCoupon.getCouponsetDetails().getName()); | 258 | mTvCouponTitle.setText(mCoupon.getCouponsetDetails().getName()); |
258 | } | 259 | } |
260 | + } | ||
259 | 261 | ||
260 | if (mCoupon != null) { | 262 | if (mCoupon != null) { |
261 | if (mIsFromWallet) { | 263 | if (mIsFromWallet) { |
... | @@ -302,6 +304,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -302,6 +304,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
302 | if (mIsUnified) { | 304 | if (mIsUnified) { |
303 | mIvCouponPhoto.setScaleType(ImageView.ScaleType.CENTER_INSIDE); | 305 | mIvCouponPhoto.setScaleType(ImageView.ScaleType.CENTER_INSIDE); |
304 | 306 | ||
307 | + if (mCoupon != null) { | ||
305 | if (!TextUtils.isEmpty(mCoupon.getImage())) { | 308 | if (!TextUtils.isEmpty(mCoupon.getImage())) { |
306 | Glide.with(this) | 309 | Glide.with(this) |
307 | // .setDefaultRequestOptions( | 310 | // .setDefaultRequestOptions( |
... | @@ -317,8 +320,14 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -317,8 +320,14 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
317 | .into(mIvCouponPhoto); | 320 | .into(mIvCouponPhoto); |
318 | } | 321 | } |
319 | } else { | 322 | } else { |
323 | + Glide.with(this) | ||
324 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
325 | + .into(mIvCouponPhoto); | ||
326 | + } | ||
327 | + } else { | ||
320 | mIvCouponPhoto.setScaleType(ImageView.ScaleType.CENTER_CROP); | 328 | mIvCouponPhoto.setScaleType(ImageView.ScaleType.CENTER_CROP); |
321 | 329 | ||
330 | + if (mCoupon != null) { | ||
322 | if (!TextUtils.isEmpty(mCoupon.getCouponsetDetails().getImgPreview())) { | 331 | if (!TextUtils.isEmpty(mCoupon.getCouponsetDetails().getImgPreview())) { |
323 | Glide.with(this) | 332 | Glide.with(this) |
324 | // .setDefaultRequestOptions( | 333 | // .setDefaultRequestOptions( |
... | @@ -333,6 +342,11 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -333,6 +342,11 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
333 | .load(R.drawable.ic_cosmote_logo_horizontal_grey) | 342 | .load(R.drawable.ic_cosmote_logo_horizontal_grey) |
334 | .into(mIvCouponPhoto); | 343 | .into(mIvCouponPhoto); |
335 | } | 344 | } |
345 | + } else { | ||
346 | + Glide.with(this) | ||
347 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
348 | + .into(mIvCouponPhoto); | ||
349 | + } | ||
336 | } | 350 | } |
337 | 351 | ||
338 | mIvBack.setOnClickListener(this); | 352 | mIvBack.setOnClickListener(this); | ... | ... |
... | @@ -128,14 +128,14 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -128,14 +128,14 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
128 | mPbLoading.setVisibility(View.VISIBLE); | 128 | mPbLoading.setVisibility(View.VISIBLE); |
129 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("RetrieveCoupon") | 129 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("RetrieveCoupon") |
130 | .concat(":") | 130 | .concat(":") |
131 | - .concat(mCouponset.getUuid())); | 131 | + .concat(mCouponset != null ? mCouponset.getUuid() : "")); |
132 | if (mCcms == null) { | 132 | if (mCcms == null) { |
133 | WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest() | 133 | WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest() |
134 | - .setCouponsetUuid(mCouponset.getUuid()) | 134 | + .setCouponsetUuid(mCouponset != null ? mCouponset.getUuid() : "") |
135 | .setCommunicationUuid(mLoyalty.getSessionUUID()), mRedeemCouponCallback); | 135 | .setCommunicationUuid(mLoyalty.getSessionUUID()), mRedeemCouponCallback); |
136 | } else { | 136 | } else { |
137 | WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest() | 137 | WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest() |
138 | - .setCouponsetUuid(mCouponset.getUuid()) | 138 | + .setCouponsetUuid(mCouponset != null ? mCouponset.getUuid() : "") |
139 | .setCommunicationUuid(mLoyalty.getSessionUUID()) | 139 | .setCommunicationUuid(mLoyalty.getSessionUUID()) |
140 | .setHasContextualOffer(true) | 140 | .setHasContextualOffer(true) |
141 | .setSessionId(mCcms.getSessionId()) | 141 | .setSessionId(mCcms.getSessionId()) |
... | @@ -191,10 +191,10 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -191,10 +191,10 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
191 | nonTelcoDialog(); | 191 | nonTelcoDialog(); |
192 | } | 192 | } |
193 | 193 | ||
194 | + if (mCouponset != null) { | ||
194 | mTvCouponsetTitle.setText(mCouponset.getName()); | 195 | mTvCouponsetTitle.setText(mCouponset.getName()); |
195 | mTvCouponsetSubtitle.setText(HtmlCompat.fromHtml(mCouponset.getDescription(), HtmlCompat.FROM_HTML_MODE_COMPACT)); | 196 | mTvCouponsetSubtitle.setText(HtmlCompat.fromHtml(mCouponset.getDescription(), HtmlCompat.FROM_HTML_MODE_COMPACT)); |
196 | mTvCouponsetSubtitle.setMovementMethod(LinkMovementMethod.getInstance()); | 197 | mTvCouponsetSubtitle.setMovementMethod(LinkMovementMethod.getInstance()); |
197 | - mLlTerms.setOnClickListener(this); | ||
198 | mTvTermsValue.setText(HtmlCompat.fromHtml(mCouponset.getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT)); | 198 | mTvTermsValue.setText(HtmlCompat.fromHtml(mCouponset.getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT)); |
199 | mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance()); | 199 | mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance()); |
200 | 200 | ||
... | @@ -212,7 +212,13 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -212,7 +212,13 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
212 | .load(R.drawable.ic_cosmote_logo_horizontal_grey) | 212 | .load(R.drawable.ic_cosmote_logo_horizontal_grey) |
213 | .into(mIvCouponsetPhoto); | 213 | .into(mIvCouponsetPhoto); |
214 | } | 214 | } |
215 | + } else { | ||
216 | + Glide.with(this) | ||
217 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
218 | + .into(mIvCouponsetPhoto); | ||
219 | + } | ||
215 | 220 | ||
221 | + mLlTerms.setOnClickListener(this); | ||
216 | mIvBack.setOnClickListener(this); | 222 | mIvBack.setOnClickListener(this); |
217 | mLlRedeem.setOnClickListener(this); | 223 | mLlRedeem.setOnClickListener(this); |
218 | // mTvTerms.setPaintFlags(mTvTerms.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); | 224 | // mTvTerms.setPaintFlags(mTvTerms.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); |
... | @@ -231,9 +237,11 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -231,9 +237,11 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
231 | } | 237 | } |
232 | 238 | ||
233 | mCoupon = new Coupon(result.optJSONObject("result")); | 239 | mCoupon = new Coupon(result.optJSONObject("result")); |
240 | + if (mCouponset != null) { | ||
234 | mCoupon.setDescription(mCouponset.getShortDescription()); | 241 | mCoupon.setDescription(mCouponset.getShortDescription()); |
235 | mCoupon.setImage(mCouponset.getImgPreview()); | 242 | mCoupon.setImage(mCouponset.getImgPreview()); |
236 | mCoupon.setName(mCouponset.getName()); | 243 | mCoupon.setName(mCouponset.getName()); |
244 | + } | ||
237 | showDialog(true, 1); | 245 | showDialog(true, 1); |
238 | WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver); | 246 | WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver); |
239 | WarplyManager.getCampaigns(mCampaignsCallback); | 247 | WarplyManager.getCampaigns(mCampaignsCallback); | ... | ... |
... | @@ -579,12 +579,14 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener | ... | @@ -579,12 +579,14 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener |
579 | /** Hide spinner and hide empty view and show vouchers and hide disabled vouchers */ | 579 | /** Hide spinner and hide empty view and show vouchers and hide disabled vouchers */ |
580 | mLlVouchersSpinner.setVisibility(View.GONE); | 580 | mLlVouchersSpinner.setVisibility(View.GONE); |
581 | mLlEmptyWallet.setVisibility(View.GONE); | 581 | mLlEmptyWallet.setVisibility(View.GONE); |
582 | + if (getContext() != null || (getActivity() != null && !getActivity().isFinishing())) { | ||
582 | if (TextUtils.isEmpty(WarpUtils.getLanguage(getContext())) || WarpUtils.getLanguage(getContext()).equals("el")) { | 583 | if (TextUtils.isEmpty(WarpUtils.getLanguage(getContext())) || WarpUtils.getLanguage(getContext()).equals("el")) { |
583 | - mTvVouchersTitle.setText(getString(R.string.cos_vouchers_title)); | 584 | + mTvVouchersTitle.setText(getContext().getString(R.string.cos_vouchers_title)); |
584 | - mTvVouchersSubtitle.setText(getString(R.string.cos_vouchers_info_title)); | 585 | + mTvVouchersSubtitle.setText(getContext().getString(R.string.cos_vouchers_info_title)); |
585 | } else { | 586 | } else { |
586 | - mTvVouchersTitle.setText(getString(R.string.cos_vouchers_title_en)); | 587 | + mTvVouchersTitle.setText(getContext().getString(R.string.cos_vouchers_title_en)); |
587 | - mTvVouchersSubtitle.setText(getString(R.string.cos_vouchers_info_title_en)); | 588 | + mTvVouchersSubtitle.setText(getContext().getString(R.string.cos_vouchers_info_title_en)); |
589 | + } | ||
588 | } | 590 | } |
589 | mLlVouchers.setVisibility(View.VISIBLE); | 591 | mLlVouchers.setVisibility(View.VISIBLE); |
590 | mLlVouchersDisabled.setVisibility(View.GONE); | 592 | mLlVouchersDisabled.setVisibility(View.GONE); |
... | @@ -603,12 +605,14 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener | ... | @@ -603,12 +605,14 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener |
603 | mLlVouchersSpinner.setVisibility(View.GONE); | 605 | mLlVouchersSpinner.setVisibility(View.GONE); |
604 | mLlEmptyWallet.setVisibility(View.GONE); | 606 | mLlEmptyWallet.setVisibility(View.GONE); |
605 | mLlVouchers.setVisibility(View.GONE); | 607 | mLlVouchers.setVisibility(View.GONE); |
608 | + if (getContext() != null || (getActivity() != null && !getActivity().isFinishing())) { | ||
606 | if (TextUtils.isEmpty(WarpUtils.getLanguage(getContext())) || WarpUtils.getLanguage(getContext()).equals("el")) { | 609 | if (TextUtils.isEmpty(WarpUtils.getLanguage(getContext())) || WarpUtils.getLanguage(getContext()).equals("el")) { |
607 | - mTvVouchersDisabledTitle.setText(getString(R.string.cos_vouchers_title)); | 610 | + mTvVouchersDisabledTitle.setText(getContext().getString(R.string.cos_vouchers_title)); |
608 | - mTvVouchersDisabledSubtitle.setText(getString(R.string.cos_vouchers_info_title_disabled)); | 611 | + mTvVouchersDisabledSubtitle.setText(getContext().getString(R.string.cos_vouchers_info_title_disabled)); |
609 | } else { | 612 | } else { |
610 | - mTvVouchersDisabledTitle.setText(getString(R.string.cos_vouchers_title_en)); | 613 | + mTvVouchersDisabledTitle.setText(getContext().getString(R.string.cos_vouchers_title_en)); |
611 | - mTvVouchersDisabledSubtitle.setText(getString(R.string.cos_vouchers_info_title_disabled_en)); | 614 | + mTvVouchersDisabledSubtitle.setText(getContext().getString(R.string.cos_vouchers_info_title_disabled_en)); |
615 | + } | ||
612 | } | 616 | } |
613 | mLlVouchersDisabled.setVisibility(View.VISIBLE); | 617 | mLlVouchersDisabled.setVisibility(View.VISIBLE); |
614 | if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() == 0) | 618 | if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() == 0) | ... | ... |
... | @@ -187,6 +187,7 @@ public class WarplyAnalyticsManager { | ... | @@ -187,6 +187,7 @@ public class WarplyAnalyticsManager { |
187 | if (metadata != null) { | 187 | if (metadata != null) { |
188 | jObj.putOpt("action_metadata", metadata); | 188 | jObj.putOpt("action_metadata", metadata); |
189 | } | 189 | } |
190 | + if (context != null) | ||
190 | Warply.postMicroappData(context, WarpConstants.MICROAPP_INAPP_ANALYTICS, jObj, force); | 191 | Warply.postMicroappData(context, WarpConstants.MICROAPP_INAPP_ANALYTICS, jObj, force); |
191 | } catch (JSONException e) { | 192 | } catch (JSONException e) { |
192 | if (WarpConstants.DEBUG) { | 193 | if (WarpConstants.DEBUG) { | ... | ... |
... | @@ -791,7 +791,8 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { | ... | @@ -791,7 +791,8 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { |
791 | 791 | ||
792 | @Override | 792 | @Override |
793 | public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) { | 793 | public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) { |
794 | - final AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); | 794 | + if (WarpActivity != null && !WarpActivity.isFinishing()) { |
795 | + final AlertDialog.Builder builder = new AlertDialog.Builder(WarpActivity); | ||
795 | builder.setTitle("Ειδοποίηση"); | 796 | builder.setTitle("Ειδοποίηση"); |
796 | builder.setMessage("Θα ανακατευθυνθείς σε σελίδα χωρίς έγκυρο πιστοποιητικό"); | 797 | builder.setMessage("Θα ανακατευθυνθείς σε σελίδα χωρίς έγκυρο πιστοποιητικό"); |
797 | builder.setPositiveButton("Συμφωνώ", new DialogInterface.OnClickListener() { | 798 | builder.setPositiveButton("Συμφωνώ", new DialogInterface.OnClickListener() { |
... | @@ -809,6 +810,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { | ... | @@ -809,6 +810,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { |
809 | final AlertDialog dialog = builder.create(); | 810 | final AlertDialog dialog = builder.create(); |
810 | dialog.show(); | 811 | dialog.show(); |
811 | } | 812 | } |
813 | + } | ||
812 | 814 | ||
813 | @Override | 815 | @Override |
814 | public void onPageFinished(WebView view, String url) { | 816 | public void onPageFinished(WebView view, String url) { | ... | ... |
-
Please register or login to post a comment