Panagiotis Triantafyllou

crash fixes

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.5.4r22'
PUBLISH_VERSION = '4.5.5.4r23'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -155,10 +155,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mGiftPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("ShareCoupon")
.concat(":")
.concat(mCoupon.getName()));
.concat(mCoupon != null ? mCoupon.getName() : ""));
Intent intent = new Intent(CouponInfoActivity.this, CouponShareActivity.class);
intent.putExtra("coupon", mCoupon.getCoupon());
intent.putExtra("coupon", mCoupon != null ? mCoupon.getCoupon() : "");
intent.putExtra("isFromWallet", mIsFromWallet);
if (!mIsFromWallet)
startActivity(intent);
......@@ -174,12 +174,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(CouponInfoActivity.this) == ConnectionResult.SUCCESS) {
Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class);
intent.putExtra("coupon", mCoupon.getCoupon());
intent.putExtra("coupon", mCoupon != null ? mCoupon.getCoupon() : "");
startActivity(intent);
return;
} else {
Intent intent = new Intent(CouponInfoActivity.this, ShopsHuaweiActivity.class);
intent.putExtra("coupon", mCoupon.getCoupon());
intent.putExtra("coupon", mCoupon != null ? mCoupon.getCoupon() : "");
startActivity(intent);
return;
}
......@@ -250,11 +250,13 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mLlBarcodeContainer.setVisibility(View.GONE);
mIvBarcode.setVisibility(View.GONE);
if (mIsUnified) {
mTvCouponTitle.setText(HtmlCompat.fromHtml(mCoupon.getName(), HtmlCompat.FROM_HTML_MODE_COMPACT));
} else {
mTvCouponCode.setText(mCoupon.getCoupon());
mTvCouponTitle.setText(mCoupon.getCouponsetDetails().getName());
if (mCoupon != null) {
if (mIsUnified) {
mTvCouponTitle.setText(HtmlCompat.fromHtml(mCoupon.getName(), HtmlCompat.FROM_HTML_MODE_COMPACT));
} else {
mTvCouponCode.setText(mCoupon.getCoupon());
mTvCouponTitle.setText(mCoupon.getCouponsetDetails().getName());
}
}
if (mCoupon != null) {
......@@ -302,15 +304,21 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
if (mIsUnified) {
mIvCouponPhoto.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
if (!TextUtils.isEmpty(mCoupon.getImage())) {
Glide.with(this)
if (mCoupon != null) {
if (!TextUtils.isEmpty(mCoupon.getImage())) {
Glide.with(this)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(mCoupon.getImage())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(mIvCouponPhoto);
.load(mCoupon.getImage())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(mIvCouponPhoto);
} else {
Glide.with(this)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(mIvCouponPhoto);
}
} else {
Glide.with(this)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
......@@ -319,15 +327,21 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
} else {
mIvCouponPhoto.setScaleType(ImageView.ScaleType.CENTER_CROP);
if (!TextUtils.isEmpty(mCoupon.getCouponsetDetails().getImgPreview())) {
Glide.with(this)
if (mCoupon != null) {
if (!TextUtils.isEmpty(mCoupon.getCouponsetDetails().getImgPreview())) {
Glide.with(this)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(mCoupon.getCouponsetDetails().getImgPreview())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(mIvCouponPhoto);
.load(mCoupon.getCouponsetDetails().getImgPreview())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(mIvCouponPhoto);
} else {
Glide.with(this)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(mIvCouponPhoto);
}
} else {
Glide.with(this)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
......
......@@ -128,14 +128,14 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
mPbLoading.setVisibility(View.VISIBLE);
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("RetrieveCoupon")
.concat(":")
.concat(mCouponset.getUuid()));
.concat(mCouponset != null ? mCouponset.getUuid() : ""));
if (mCcms == null) {
WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest()
.setCouponsetUuid(mCouponset.getUuid())
.setCouponsetUuid(mCouponset != null ? mCouponset.getUuid() : "")
.setCommunicationUuid(mLoyalty.getSessionUUID()), mRedeemCouponCallback);
} else {
WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest()
.setCouponsetUuid(mCouponset.getUuid())
.setCouponsetUuid(mCouponset != null ? mCouponset.getUuid() : "")
.setCommunicationUuid(mLoyalty.getSessionUUID())
.setHasContextualOffer(true)
.setSessionId(mCcms.getSessionId())
......@@ -191,28 +191,34 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
nonTelcoDialog();
}
mTvCouponsetTitle.setText(mCouponset.getName());
mTvCouponsetSubtitle.setText(HtmlCompat.fromHtml(mCouponset.getDescription(), HtmlCompat.FROM_HTML_MODE_COMPACT));
mTvCouponsetSubtitle.setMovementMethod(LinkMovementMethod.getInstance());
mLlTerms.setOnClickListener(this);
mTvTermsValue.setText(HtmlCompat.fromHtml(mCouponset.getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT));
mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance());
if (mCouponset != null) {
mTvCouponsetTitle.setText(mCouponset.getName());
mTvCouponsetSubtitle.setText(HtmlCompat.fromHtml(mCouponset.getDescription(), HtmlCompat.FROM_HTML_MODE_COMPACT));
mTvCouponsetSubtitle.setMovementMethod(LinkMovementMethod.getInstance());
mTvTermsValue.setText(HtmlCompat.fromHtml(mCouponset.getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT));
mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance());
if (!TextUtils.isEmpty(mCouponset.getImgPreview())) {
Glide.with(this)
if (!TextUtils.isEmpty(mCouponset.getImgPreview())) {
Glide.with(this)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(mCouponset.getImgPreview())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(mIvCouponsetPhoto);
.load(mCouponset.getImgPreview())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(mIvCouponsetPhoto);
} else {
Glide.with(this)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(mIvCouponsetPhoto);
}
} else {
Glide.with(this)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(mIvCouponsetPhoto);
}
mLlTerms.setOnClickListener(this);
mIvBack.setOnClickListener(this);
mLlRedeem.setOnClickListener(this);
// mTvTerms.setPaintFlags(mTvTerms.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
......@@ -231,9 +237,11 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
}
mCoupon = new Coupon(result.optJSONObject("result"));
mCoupon.setDescription(mCouponset.getShortDescription());
mCoupon.setImage(mCouponset.getImgPreview());
mCoupon.setName(mCouponset.getName());
if (mCouponset != null) {
mCoupon.setDescription(mCouponset.getShortDescription());
mCoupon.setImage(mCouponset.getImgPreview());
mCoupon.setName(mCouponset.getName());
}
showDialog(true, 1);
WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
WarplyManager.getCampaigns(mCampaignsCallback);
......
......@@ -579,12 +579,14 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener
/** Hide spinner and hide empty view and show vouchers and hide disabled vouchers */
mLlVouchersSpinner.setVisibility(View.GONE);
mLlEmptyWallet.setVisibility(View.GONE);
if (TextUtils.isEmpty(WarpUtils.getLanguage(getContext())) || WarpUtils.getLanguage(getContext()).equals("el")) {
mTvVouchersTitle.setText(getString(R.string.cos_vouchers_title));
mTvVouchersSubtitle.setText(getString(R.string.cos_vouchers_info_title));
} else {
mTvVouchersTitle.setText(getString(R.string.cos_vouchers_title_en));
mTvVouchersSubtitle.setText(getString(R.string.cos_vouchers_info_title_en));
if (getContext() != null || (getActivity() != null && !getActivity().isFinishing())) {
if (TextUtils.isEmpty(WarpUtils.getLanguage(getContext())) || WarpUtils.getLanguage(getContext()).equals("el")) {
mTvVouchersTitle.setText(getContext().getString(R.string.cos_vouchers_title));
mTvVouchersSubtitle.setText(getContext().getString(R.string.cos_vouchers_info_title));
} else {
mTvVouchersTitle.setText(getContext().getString(R.string.cos_vouchers_title_en));
mTvVouchersSubtitle.setText(getContext().getString(R.string.cos_vouchers_info_title_en));
}
}
mLlVouchers.setVisibility(View.VISIBLE);
mLlVouchersDisabled.setVisibility(View.GONE);
......@@ -603,12 +605,14 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener
mLlVouchersSpinner.setVisibility(View.GONE);
mLlEmptyWallet.setVisibility(View.GONE);
mLlVouchers.setVisibility(View.GONE);
if (TextUtils.isEmpty(WarpUtils.getLanguage(getContext())) || WarpUtils.getLanguage(getContext()).equals("el")) {
mTvVouchersDisabledTitle.setText(getString(R.string.cos_vouchers_title));
mTvVouchersDisabledSubtitle.setText(getString(R.string.cos_vouchers_info_title_disabled));
} else {
mTvVouchersDisabledTitle.setText(getString(R.string.cos_vouchers_title_en));
mTvVouchersDisabledSubtitle.setText(getString(R.string.cos_vouchers_info_title_disabled_en));
if (getContext() != null || (getActivity() != null && !getActivity().isFinishing())) {
if (TextUtils.isEmpty(WarpUtils.getLanguage(getContext())) || WarpUtils.getLanguage(getContext()).equals("el")) {
mTvVouchersDisabledTitle.setText(getContext().getString(R.string.cos_vouchers_title));
mTvVouchersDisabledSubtitle.setText(getContext().getString(R.string.cos_vouchers_info_title_disabled));
} else {
mTvVouchersDisabledTitle.setText(getContext().getString(R.string.cos_vouchers_title_en));
mTvVouchersDisabledSubtitle.setText(getContext().getString(R.string.cos_vouchers_info_title_disabled_en));
}
}
mLlVouchersDisabled.setVisibility(View.VISIBLE);
if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() == 0)
......
......@@ -187,7 +187,8 @@ public class WarplyAnalyticsManager {
if (metadata != null) {
jObj.putOpt("action_metadata", metadata);
}
Warply.postMicroappData(context, WarpConstants.MICROAPP_INAPP_ANALYTICS, jObj, force);
if (context != null)
Warply.postMicroappData(context, WarpConstants.MICROAPP_INAPP_ANALYTICS, jObj, force);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
......
......@@ -791,23 +791,25 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
@Override
public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle("Ειδοποίηση");
builder.setMessage("Θα ανακατευθυνθείς σε σελίδα χωρίς έγκυρο πιστοποιητικό");
builder.setPositiveButton("Συμφωνώ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
handler.proceed();
}
});
builder.setNegativeButton("Άκυρο", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
handler.cancel();
}
});
final AlertDialog dialog = builder.create();
dialog.show();
if (WarpActivity != null && !WarpActivity.isFinishing()) {
final AlertDialog.Builder builder = new AlertDialog.Builder(WarpActivity);
builder.setTitle("Ειδοποίηση");
builder.setMessage("Θα ανακατευθυνθείς σε σελίδα χωρίς έγκυρο πιστοποιητικό");
builder.setPositiveButton("Συμφωνώ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
handler.proceed();
}
});
builder.setNegativeButton("Άκυρο", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
handler.cancel();
}
});
final AlertDialog dialog = builder.create();
dialog.show();
}
}
@Override
......