Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Panagiotis Triantafyllou
2022-08-10 17:59:16 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
94734480b5ac8f70cf73f28e32d549d430c6abe3
94734480
1 parent
f4d4b3e6
uat changes 10_08_2022
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1035 additions
and
86 deletions
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponShareActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MoreForYouActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Consumer.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/MergedGifts.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/MergedMore.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyRedeemCouponRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventQuestionnaireService.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedGiftsAdapter.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedMoreAdapter.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/SharedCouponAdapter.java
warply_android_sdk/src/main/res/layout/activity_loyalty_wallet.xml
warply_android_sdk/src/main/res/values/strings.xml
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
9473448
...
...
@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public
void
onWarplyReady
()
{
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"6012049
139
"
),
//6012049321, 6012049322, 6012049323
.
setGuid
(
"6012049
321
"
),
//6012049321, 6012049322, 6012049323
mLoginReceiver
);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/build.gradle
View file @
9473448
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta4
4
'
PUBLISH_VERSION
=
'4.5.4-cosbeta4
5
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponShareActivity.java
View file @
9473448
...
...
@@ -58,7 +58,8 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
private
LinearLayout
mLlShareButton
;
private
String
mSender
=
""
;
private
EditText
mEdtReceiver
;
private
AlertDialog
mAlertDialogSuccessSharing
,
mAlertDialogErrorSharing
,
mAlertDialogCouponAskSharing
;
private
AlertDialog
mAlertDialogSuccessSharing
,
mAlertDialogErrorSharing
,
mAlertDialogCouponAskSharing
,
mAlertDialogWrongNumberSharing
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -205,6 +206,16 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
.
show
();
}
private
void
wrongNumberDialog
(
String
message
)
{
mAlertDialogWrongNumberSharing
=
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
R
.
string
.
cos_dlg_error_title
)
.
setMessage
(
message
)
.
setPositiveButton
(
R
.
string
.
cos_dlg_positive_button2
,
(
dialogPositive
,
whichPositive
)
->
{
dialogPositive
.
dismiss
();
})
.
show
();
}
private
void
errorSharingDialog2
()
{
mAlertDialogErrorSharing
=
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
R
.
string
.
cos_dlg_error_title
)
...
...
@@ -253,9 +264,12 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
@Override
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
String
message
=
result
.
optString
(
"msg"
,
""
);
runOnUiThread
(()
->
{
if
(
status
==
1
)
acceptSharingDialog
();
else
if
(
status
==
4
)
wrongNumberDialog
(
message
);
else
errorSharingDialog
();
});
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
View file @
9473448
...
...
@@ -29,11 +29,13 @@ import ly.warp.sdk.io.models.CampaignList;
import
ly.warp.sdk.io.models.Coupon
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.Couponset
;
import
ly.warp.sdk.io.models.LoyaltyContextualOfferModel
;
import
ly.warp.sdk.io.request.WarplyGetCampaignsRequest
;
import
ly.warp.sdk.io.request.WarplyRedeemCouponRequest
;
import
ly.warp.sdk.io.request.WarplyUserCouponsRequest
;
import
ly.warp.sdk.services.EventCampaignService
;
import
ly.warp.sdk.services.EventService
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
...
...
@@ -56,6 +58,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
private
boolean
mIsTermsPressed
=
false
;
private
AlertDialog
mAlertDialogCouponset
;
private
Campaign
mLoyalty
;
private
LoyaltyContextualOfferModel
mCcms
=
null
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -68,6 +71,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
mCouponset
=
(
Couponset
)
getIntent
().
getSerializableExtra
(
"couponset"
);
mLoyalty
=
(
Campaign
)
getIntent
().
getSerializableExtra
(
"loyalty"
);
mCcms
=
(
LoyaltyContextualOfferModel
)
getIntent
().
getSerializableExtra
(
"ccms"
);
mIvBack
=
findViewById
(
R
.
id
.
iv_couponset_info_back
);
mTvTerms
=
findViewById
(
R
.
id
.
tv_terms
);
...
...
@@ -96,9 +100,37 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
}
if
(
view
.
getId
()
==
R
.
id
.
ll_get_gift
)
{
mPbLoading
.
setVisibility
(
View
.
VISIBLE
);
WarplyManager
.
redeemCoupon
(
new
WarplyRedeemCouponRequest
()
.
setCouponsetUuid
(
mCouponset
.
getUuid
())
.
setCommunicationUuid
(
mLoyalty
.
getSessionUUID
()),
mRedeemCouponCallback
);
if
(
mCcms
==
null
)
{
WarplyManager
.
redeemCoupon
(
new
WarplyRedeemCouponRequest
()
.
setCouponsetUuid
(
mCouponset
.
getUuid
())
.
setCommunicationUuid
(
mLoyalty
.
getSessionUUID
()),
mRedeemCouponCallback
);
}
else
{
WarplyManager
.
redeemCoupon
(
new
WarplyRedeemCouponRequest
()
.
setCouponsetUuid
(
mCouponset
.
getUuid
())
.
setCommunicationUuid
(
mLoyalty
.
getSessionUUID
())
.
setHasContextualOffer
(
true
)
.
setUserMsisdn
(
WarplyManagerHelper
.
getConsumer
().
getMsisdn
())
.
setBusinessService
(
mCcms
.
getBusinessService
())
.
setOfferName
(
mCcms
.
getOfferName
())
.
setProductType
(
mCcms
.
getProductType
())
.
setProvDuration
(
mCcms
.
getProvDuration
())
.
setNoOfRecurrance
(
mCcms
.
getNoOfRecurrance
())
.
setPrice
(
mCcms
.
getPrice
())
.
setDiscount
(
mCcms
.
getDiscount
())
.
setVoiceCategory
(
mCcms
.
getVoiceCategory
())
.
setDataCategory
(
mCcms
.
getDataCategory
())
.
setMinsValue
(
mCcms
.
getMinsValue
())
.
setDataValue
(
mCcms
.
getDataValue
())
.
setProvStepValueMins
(
mCcms
.
getProvStepValueMins
())
.
setOfferAudienceLevel
(
mCcms
.
getOfferAudienceLevel
())
.
setUACIOfferTrackingCode
(
mCcms
.
getUACIOfferTrackingCode
())
.
setOfferCode1
(
mCcms
.
getOfferCode1
())
.
setScore
(
mCcms
.
getScore
())
.
setZone
(
mCcms
.
getZone
())
.
setWave
(
mCcms
.
getWave
())
.
setValidity
(
mCcms
.
getValidity
())
.
setTreatmentCode
(
mCcms
.
getTreatmentCode
()),
mRedeemCouponCallback
);
}
return
;
}
if
(
view
.
getId
()
==
R
.
id
.
ll_terms_inner
)
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
View file @
9473448
...
...
@@ -4,6 +4,7 @@ import android.app.Activity;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.ImageView
;
...
...
@@ -59,6 +60,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
// private HashSet<Campaign> mHashSetList = new HashSet<>();
private
ArrayList
<
LoyaltyGiftsForYouPackage
>
mSeasonalList
=
new
ArrayList
<>();
private
HashSet
<
LoyaltyGiftsForYouPackage
>
mHashSetSeasonalList
=
new
HashSet
<>();
private
ArrayList
<
LoyaltyContextualOfferModel
>
mContextualList
=
new
ArrayList
<>();
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -83,9 +85,19 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
mSeasonalList
.
addAll
(
mHashSetSeasonalList
);
}
if
(
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
()
!=
null
&&
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
().
size
()
>
0
)
{
mContextualList
.
clear
();
for
(
LoyaltyContextualOfferModel
ccmsItem
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
((
TextUtils
.
isEmpty
(
ccmsItem
.
getLoyaltyCampaignId
())
||
ccmsItem
.
getLoyaltyCampaignId
().
equals
(
"NA"
))
&&
ccmsItem
.
getZone
().
equals
(
"COSMOTE_APP_GIFTS4U"
))
mContextualList
.
add
(
ccmsItem
);
}
}
mergeDatasets
(
mValuesList
,
mSeasonalList
mSeasonalList
,
mContextualList
);
mIvBack
=
findViewById
(
R
.
id
.
iv_list_close
);
...
...
@@ -143,9 +155,19 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
mSeasonalList
.
addAll
(
mHashSetSeasonalList
);
}
if
(
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
()
!=
null
&&
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
().
size
()
>
0
)
{
mContextualList
.
clear
();
for
(
LoyaltyContextualOfferModel
ccmsItem
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
((
TextUtils
.
isEmpty
(
ccmsItem
.
getLoyaltyCampaignId
())
||
ccmsItem
.
getLoyaltyCampaignId
().
equals
(
"NA"
))
&&
ccmsItem
.
getZone
().
equals
(
"COSMOTE_APP_GIFTS4U"
))
mContextualList
.
add
(
ccmsItem
);
}
}
mergeDatasets
(
mValuesList
,
mSeasonalList
mSeasonalList
,
mContextualList
);
runOnUiThread
(()
->
{
...
...
@@ -159,6 +181,43 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
LoyaltyGiftsForYouOfferClickEvent
()));
if
(
dataItem
.
getCampaign
().
getType
().
equals
(
"coupon"
))
{
if
(
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
()
!=
null
&&
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
().
size
()
>
0
)
{
LoyaltyContextualOfferModel
ccmsItem
=
null
;
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
dataItem
.
getCampaign
().
getSessionUUID
()))
{
ccmsItem
=
ccms
;
break
;
}
}
if
(
ccmsItem
!=
null
)
{
try
{
JSONObject
campaignSettings
=
WarpJSONParser
.
getJSONFromString
(
dataItem
.
getCampaign
().
getCampaignTypeSettings
());
if
(
campaignSettings
!=
null
)
{
if
(
campaignSettings
.
has
(
"couponset"
))
{
String
cpnUuid
=
campaignSettings
.
optString
(
"couponset"
);
for
(
Couponset
cpns
:
WarplyManagerHelper
.
getCouponsets
())
{
if
(
cpns
.
getUuid
().
equals
(
cpnUuid
))
{
Intent
intent
=
new
Intent
(
GiftsForYouActivity
.
this
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
cpns
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
dataItem
.
getCampaign
());
intent
.
putExtra
(
"ccms"
,
ccmsItem
);
startActivity
(
intent
);
break
;
}
}
}
else
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())));
}
}
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
return
;
}
}
try
{
JSONObject
campaignSettings
=
WarpJSONParser
.
getJSONFromString
(
dataItem
.
getCampaign
().
getCampaignTypeSettings
());
if
(
campaignSettings
!=
null
)
{
...
...
@@ -220,6 +279,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
seasonalCLick
.
setLoyaltyPackageId
(
dataItem
.
getSeasonalList
().
getLoyaltyPackageId
());
seasonalCLick
.
setImageUrl
(
dataItem
.
getSeasonalList
().
getImageUrl
());
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
seasonalCLick
));
}
else
if
(
dataItem
.
getDataType
()
==
3
)
{
}
})
.
doOnError
(
error
->
{
...
...
@@ -253,6 +314,43 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
LoyaltyGiftsForYouOfferClickEvent
()));
if
(
dataItem
.
getCampaign
().
getType
().
equals
(
"coupon"
))
{
if
(
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
()
!=
null
&&
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
().
size
()
>
0
)
{
LoyaltyContextualOfferModel
ccmsItem
=
null
;
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
dataItem
.
getCampaign
().
getSessionUUID
()))
{
ccmsItem
=
ccms
;
break
;
}
}
if
(
ccmsItem
!=
null
)
{
try
{
JSONObject
campaignSettings
=
WarpJSONParser
.
getJSONFromString
(
dataItem
.
getCampaign
().
getCampaignTypeSettings
());
if
(
campaignSettings
!=
null
)
{
if
(
campaignSettings
.
has
(
"couponset"
))
{
String
cpnUuid
=
campaignSettings
.
optString
(
"couponset"
);
for
(
Couponset
cpns
:
WarplyManagerHelper
.
getCouponsets
())
{
if
(
cpns
.
getUuid
().
equals
(
cpnUuid
))
{
Intent
intent
=
new
Intent
(
GiftsForYouActivity
.
this
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
cpns
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
dataItem
.
getCampaign
());
intent
.
putExtra
(
"ccms"
,
ccmsItem
);
startActivity
(
intent
);
break
;
}
}
}
else
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())));
}
}
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
return
;
}
}
try
{
JSONObject
campaignSettings
=
WarpJSONParser
.
getJSONFromString
(
dataItem
.
getCampaign
().
getCampaignTypeSettings
());
if
(
campaignSettings
!=
null
)
{
...
...
@@ -313,6 +411,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
seasonalCLick
.
setLoyaltyPackageId
(
dataItem
.
getSeasonalList
().
getLoyaltyPackageId
());
seasonalCLick
.
setImageUrl
(
dataItem
.
getSeasonalList
().
getImageUrl
());
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
seasonalCLick
));
}
else
if
(
dataItem
.
getDataType
()
==
3
)
{
}
})
.
doOnError
(
error
->
{
...
...
@@ -321,7 +421,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
}
}
private
void
mergeDatasets
(
ArrayList
<
Campaign
>
campaignList
,
ArrayList
<
LoyaltyGiftsForYouPackage
>
seasonalList
)
{
private
void
mergeDatasets
(
ArrayList
<
Campaign
>
campaignList
,
ArrayList
<
LoyaltyGiftsForYouPackage
>
seasonalList
,
ArrayList
<
LoyaltyContextualOfferModel
>
ccmsList
)
{
mData
.
clear
();
if
(
campaignList
!=
null
&&
campaignList
.
size
()
>
0
)
{
Log
.
v
(
"GIFTS_FOR_YOU"
,
String
.
valueOf
(
campaignList
.
size
()));
...
...
@@ -344,6 +446,18 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
mData
.
add
(
data
);
}
}
if
(
ccmsList
!=
null
&&
ccmsList
.
size
()
>
0
)
{
Log
.
v
(
"CCMS"
,
String
.
valueOf
(
ccmsList
.
size
()));
for
(
LoyaltyContextualOfferModel
ccmsItem
:
ccmsList
)
{
MergedGifts
data
=
new
MergedGifts
();
data
.
setCampaign
(
null
);
data
.
setSeasonalList
(
null
);
data
.
setCCMS
(
ccmsItem
);
data
.
setDataType
(
3
);
mData
.
add
(
data
);
}
}
}
private
void
filterItems
()
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MoreForYouActivity.java
View file @
9473448
...
...
@@ -5,6 +5,7 @@ import android.content.Context;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Parcelable
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.ImageView
;
...
...
@@ -27,11 +28,16 @@ import ly.warp.sdk.R;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.io.models.LoyaltyContextualOfferModel
;
import
ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage
;
import
ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel
;
import
ly.warp.sdk.io.models.MergedGifts
;
import
ly.warp.sdk.io.models.MergedMore
;
import
ly.warp.sdk.utils.WarpJSONParser
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.views.adapters.MergedGiftsAdapter
;
import
ly.warp.sdk.views.adapters.MergedMoreAdapter
;
import
ly.warp.sdk.views.adapters.MoreCampaignAdapter
;
...
...
@@ -49,9 +55,12 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
private
RecyclerView
mRecyclerMore
;
private
TextView
mTvTitle
;
private
MoreCampaignAdapter
mAdapterMore
;
private
MergedMoreAdapter
mAdapterMergedMore
;
private
LinearLayout
mLlMorePopup
;
private
ArrayList
<
Campaign
>
mValuesList
=
new
ArrayList
<>();
// private HashSet<Campaign> mHashSetList = new HashSet<>();
// private HashSet<Campaign> mHashSetList = new HashSet<>();
private
ArrayList
<
LoyaltyContextualOfferModel
>
mContextualList
=
new
ArrayList
<>();
private
ArrayList
<
MergedMore
>
mData
=
new
ArrayList
();
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -77,6 +86,20 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
filterItems
();
if
(
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
()
!=
null
&&
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
().
size
()
>
0
)
{
mContextualList
.
clear
();
for
(
LoyaltyContextualOfferModel
ccmsItem
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
((
TextUtils
.
isEmpty
(
ccmsItem
.
getLoyaltyCampaignId
())
||
ccmsItem
.
getLoyaltyCampaignId
().
equals
(
"NA"
))
&&
ccmsItem
.
getZone
().
equals
(
"COSMOTE_APP_MORE4U"
))
mContextualList
.
add
(
ccmsItem
);
}
}
mergeDatasets
(
mValuesList
,
mContextualList
);
initViews
();
}
...
...
@@ -119,51 +142,71 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
if
(
event
.
getCcmsAdded
()
!=
null
||
event
.
getCampaignsAdded
()
!=
null
)
{
filterItems
();
if
(
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
()
!=
null
&&
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
().
size
()
>
0
)
{
mContextualList
.
clear
();
for
(
LoyaltyContextualOfferModel
ccmsItem
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
((
TextUtils
.
isEmpty
(
ccmsItem
.
getLoyaltyCampaignId
())
||
ccmsItem
.
getLoyaltyCampaignId
().
equals
(
"NA"
))
&&
ccmsItem
.
getZone
().
equals
(
"COSMOTE_APP_MORE4U"
))
mContextualList
.
add
(
ccmsItem
);
}
}
mergeDatasets
(
mValuesList
,
mContextualList
);
runOnUiThread
(()
->
{
if
(
mValuesList
!=
null
&&
mValuesList
.
size
()
>
0
)
{
Log
.
v
(
"MORE_FOR_YOU"
,
String
.
valueOf
(
mValuesList
.
size
()));
mAdapterMore
=
new
MoreCampaignAdapter
(
this
,
mValuesList
);
mRecyclerMore
.
setAdapter
(
mAdapterMore
);
mAdapterMore
.
getPositionClicks
()
.
doOnNext
(
gift
->
{
WarpUtils
.
log
(
"MFY_CLICK "
+
gift
.
toString
());
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
LoyaltySDKFirebaseEventModel
()));
try
{
JSONObject
extraFields
=
WarpJSONParser
.
getJSONFromString
(
gift
.
getExtraFields
());
if
(
extraFields
!=
null
)
{
if
(
extraFields
.
has
(
"type"
)
&&
extraFields
.
optString
(
"type"
).
equals
(
"telco"
))
{
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
gift
.
getSessionUUID
()))
{
Intent
intent
=
new
Intent
(
MoreForYouActivity
.
this
,
TelcoActivity
.
class
);
intent
.
putExtra
(
"ccms"
,
ccms
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
gift
);
startActivity
(
intent
);
break
;
// if (mValuesList != null && mValuesList.size() > 0) {
if
(
mData
!=
null
&&
mData
.
size
()
>
0
)
{
// mAdapterMore = new MoreCampaignAdapter(this, mValuesList);
mAdapterMergedMore
=
new
MergedMoreAdapter
(
MoreForYouActivity
.
this
,
mData
);
// mRecyclerMore.setAdapter(mAdapterMore);
mRecyclerMore
.
setAdapter
(
mAdapterMergedMore
);
mAdapterMergedMore
.
getPositionClicks
()
.
doOnNext
(
dataItem
->
{
if
(
dataItem
.
getDataType
()
==
1
)
{
WarpUtils
.
log
(
"MFY_CLICK "
+
dataItem
.
getCampaign
().
toString
());
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
LoyaltySDKFirebaseEventModel
()));
try
{
JSONObject
extraFields
=
WarpJSONParser
.
getJSONFromString
(
dataItem
.
getCampaign
().
getExtraFields
());
if
(
extraFields
!=
null
)
{
if
(
extraFields
.
has
(
"type"
)
&&
extraFields
.
optString
(
"type"
).
equals
(
"telco"
))
{
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
dataItem
.
getCampaign
().
getSessionUUID
()))
{
Intent
intent
=
new
Intent
(
MoreForYouActivity
.
this
,
TelcoActivity
.
class
);
intent
.
putExtra
(
"ccms"
,
ccms
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
dataItem
.
getCampaign
());
startActivity
(
intent
);
break
;
}
}
return
;
}
return
;
}
if
(
extraFields
.
has
(
"ccms_offer"
)
&&
extraFields
.
optString
(
"ccms_offer"
).
equals
(
"true"
))
{
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
gift
.
getSessionUUID
()))
{
WarpUtils
.
log
(
"CCMS_CLICK "
+
ccms
.
toString
());
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCcmsUrl
(
gift
,
ccms
)));
break
;
if
(
extraFields
.
has
(
"ccms_offer"
)
&&
extraFields
.
optString
(
"ccms_offer"
).
equals
(
"true"
))
{
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
dataItem
.
getCampaign
().
getSessionUUID
()))
{
WarpUtils
.
log
(
"CCMS_CLICK "
+
ccms
.
toString
());
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCcmsUrl
(
dataItem
.
getCampaign
(),
ccms
)));
break
;
}
}
}
else
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())));
}
}
else
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
gift
)));
}
}
catch
(
Exception
exception
)
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())));
}
}
catch
(
Exception
exception
)
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
gift
)));
}
else
if
(
dataItem
.
getDataType
()
==
2
)
{
}
})
.
doOnError
(
error
->
{
})
.
subscribe
();
mAdapterMore
.
notifyDataSetChanged
();
mAdapterM
ergedM
ore
.
notifyDataSetChanged
();
}
else
{
mRecyclerMore
.
setVisibility
(
View
.
GONE
);
}
...
...
@@ -182,53 +225,87 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
// if (WarpUtils.getMorePopup(this))
// mLlMorePopup.setVisibility(View.VISIBLE);
if
(
mValuesList
!=
null
&&
mValuesList
.
size
()
>
0
)
{
Log
.
v
(
"MORE_FOR_YOU"
,
String
.
valueOf
(
mValuesList
.
size
()));
//
if (mValuesList != null && mValuesList.size() > 0) {
if
(
mData
!=
null
&&
mData
.
size
()
>
0
)
{
mRecyclerMore
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterMore
=
new
MoreCampaignAdapter
(
this
,
mValuesList
);
mRecyclerMore
.
setAdapter
(
mAdapterMore
);
mAdapterMore
.
getPositionClicks
()
.
doOnNext
(
gift
->
{
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
LoyaltySDKFirebaseEventModel
()));
try
{
JSONObject
extraFields
=
WarpJSONParser
.
getJSONFromString
(
gift
.
getExtraFields
());
if
(
extraFields
!=
null
)
{
if
(
extraFields
.
has
(
"type"
)
&&
extraFields
.
optString
(
"type"
).
equals
(
"telco"
))
{
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
gift
.
getSessionUUID
()))
{
Intent
intent
=
new
Intent
(
MoreForYouActivity
.
this
,
TelcoActivity
.
class
);
intent
.
putExtra
(
"ccms"
,
ccms
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
gift
);
startActivity
(
intent
);
break
;
// mAdapterMore = new MoreCampaignAdapter(this, mValuesList);
mAdapterMergedMore
=
new
MergedMoreAdapter
(
MoreForYouActivity
.
this
,
mData
);
// mRecyclerMore.setAdapter(mAdapterMore);
mRecyclerMore
.
setAdapter
(
mAdapterMergedMore
);
mAdapterMergedMore
.
getPositionClicks
()
.
doOnNext
(
dataItem
->
{
if
(
dataItem
.
getDataType
()
==
1
)
{
WarpUtils
.
log
(
"MFY_CLICK "
+
dataItem
.
getCampaign
().
toString
());
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
LoyaltySDKFirebaseEventModel
()));
try
{
JSONObject
extraFields
=
WarpJSONParser
.
getJSONFromString
(
dataItem
.
getCampaign
().
getExtraFields
());
if
(
extraFields
!=
null
)
{
if
(
extraFields
.
has
(
"type"
)
&&
extraFields
.
optString
(
"type"
).
equals
(
"telco"
))
{
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
dataItem
.
getCampaign
().
getSessionUUID
()))
{
Intent
intent
=
new
Intent
(
MoreForYouActivity
.
this
,
TelcoActivity
.
class
);
intent
.
putExtra
(
"ccms"
,
ccms
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
dataItem
.
getCampaign
());
startActivity
(
intent
);
break
;
}
}
return
;
}
return
;
}
if
(
extraFields
.
has
(
"ccms_offer"
)
&&
extraFields
.
optString
(
"ccms_offer"
).
equals
(
"true"
))
{
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
gift
.
getSessionUUID
()))
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCcmsUrl
(
gift
,
ccms
)))
;
break
;
if
(
extraFields
.
has
(
"ccms_offer"
)
&&
extraFields
.
optString
(
"ccms_offer"
).
equals
(
"true"
))
{
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
dataItem
.
getCampaign
().
getSessionUUID
()
))
{
WarpUtils
.
log
(
"CCMS_CLICK "
+
ccms
.
toString
());
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCcmsUrl
(
dataItem
.
getCampaign
(),
ccms
)));
break
;
}
}
}
else
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())));
}
}
else
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
gift
)));
}
}
catch
(
Exception
exception
)
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())));
}
}
catch
(
Exception
exception
)
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
gift
)));
}
else
if
(
dataItem
.
getDataType
()
==
2
)
{
}
})
.
doOnError
(
error
->
{
})
.
subscribe
();
mAdapterMergedMore
.
notifyDataSetChanged
();
}
else
{
mRecyclerMore
.
setVisibility
(
View
.
GONE
);
}
}
private
void
mergeDatasets
(
ArrayList
<
Campaign
>
campaignList
,
ArrayList
<
LoyaltyContextualOfferModel
>
ccmsList
)
{
mData
.
clear
();
if
(
campaignList
!=
null
&&
campaignList
.
size
()
>
0
)
{
Log
.
v
(
"MORE_FOR_YOU"
,
String
.
valueOf
(
campaignList
.
size
()));
for
(
Campaign
campaign
:
campaignList
)
{
MergedMore
data
=
new
MergedMore
();
data
.
setCampaign
(
campaign
);
data
.
setDataType
(
1
);
mData
.
add
(
data
);
}
}
if
(
ccmsList
!=
null
&&
ccmsList
.
size
()
>
0
)
{
Log
.
v
(
"CCMS"
,
String
.
valueOf
(
ccmsList
.
size
()));
for
(
LoyaltyContextualOfferModel
ccmsItem
:
ccmsList
)
{
MergedMore
data
=
new
MergedMore
();
data
.
setCampaign
(
null
);
data
.
setCCMS
(
ccmsItem
);
data
.
setDataType
(
2
);
mData
.
add
(
data
);
}
}
}
private
void
filterItems
()
{
mValuesList
.
clear
();
ArrayList
<
Campaign
>
gfyList
=
new
ArrayList
<>();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Consumer.java
View file @
9473448
...
...
@@ -483,6 +483,138 @@ public class Consumer implements Parcelable, Serializable {
return
sms_segmentation
;
}
public
void
setAckOptin
(
boolean
ackOptin
)
{
this
.
ackOptin
=
ackOptin
;
}
public
void
setBillingInfo
(
JSONObject
billingInfo
)
{
this
.
billingInfo
=
billingInfo
;
}
public
void
setBirthday
(
String
birthday
)
{
this
.
birthday
=
birthday
;
}
public
void
setBurntPoints
(
double
burntPoints
)
{
this
.
burntPoints
=
burntPoints
;
}
public
void
setCompanyName
(
String
companyName
)
{
this
.
companyName
=
companyName
;
}
public
void
setConsumerMetadata
(
JSONObject
consumerMetadata
)
{
this
.
consumerMetadata
=
consumerMetadata
;
}
public
void
setDisplayName
(
String
displayName
)
{
this
.
displayName
=
displayName
;
}
public
void
setEmail
(
String
email
)
{
this
.
email
=
email
;
}
public
void
setFirstName
(
String
firstName
)
{
this
.
firstName
=
firstName
;
}
public
void
setGender
(
String
gender
)
{
this
.
gender
=
gender
;
}
public
void
setImageUrl
(
String
imageUrl
)
{
this
.
imageUrl
=
imageUrl
;
}
public
void
setLanguage
(
String
language
)
{
this
.
language
=
language
;
}
public
void
setLastName
(
String
lastName
)
{
this
.
lastName
=
lastName
;
}
public
void
setLoyaltyId
(
String
loyaltyId
)
{
this
.
loyaltyId
=
loyaltyId
;
}
public
void
setMsisdn
(
String
msisdn
)
{
this
.
msisdn
=
msisdn
;
}
public
void
setNameday
(
String
nameday
)
{
this
.
nameday
=
nameday
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
public
void
setOptin
(
JSONObject
optin
)
{
this
.
optin
=
optin
;
}
public
void
setPasswordSet
(
boolean
passwordSet
)
{
this
.
passwordSet
=
passwordSet
;
}
public
void
setProfileMetadata
(
String
profileMetadata
)
{
this
.
profileMetadata
=
profileMetadata
;
}
public
void
setRedeemedPoints
(
double
redeemedPoints
)
{
this
.
redeemedPoints
=
redeemedPoints
;
}
public
void
setRetrievedPoints
(
double
retrievedPoints
)
{
this
.
retrievedPoints
=
retrievedPoints
;
}
public
void
setSalutation
(
String
salutation
)
{
this
.
salutation
=
salutation
;
}
public
void
setSubscribe
(
boolean
subscribe
)
{
this
.
subscribe
=
subscribe
;
}
public
void
setTags
(
JSONObject
tags
)
{
this
.
tags
=
tags
;
}
public
void
setTaxId
(
String
taxId
)
{
this
.
taxId
=
taxId
;
}
public
void
setUserPoints
(
double
userPoints
)
{
this
.
userPoints
=
userPoints
;
}
public
void
setUuid
(
String
uuid
)
{
this
.
uuid
=
uuid
;
}
public
void
setVerified
(
boolean
verified
)
{
this
.
verified
=
verified
;
}
public
void
setNewsletter
(
boolean
newsletter
)
{
this
.
newsletter
=
newsletter
;
}
public
void
setSms
(
boolean
sms
)
{
this
.
sms
=
sms
;
}
public
void
setSegmentation
(
boolean
segmentation
)
{
this
.
segmentation
=
segmentation
;
}
public
void
setSms_segmentation
(
boolean
sms_segmentation
)
{
this
.
sms_segmentation
=
sms_segmentation
;
}
@Override
public
int
describeContents
()
{
return
0
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/MergedGifts.java
View file @
9473448
...
...
@@ -33,12 +33,12 @@ public class MergedGifts {
private
int
dataType
=
0
;
private
LoyaltyGiftsForYouPackage
seasonalList
;
private
Campaign
campaign
;
private
LoyaltyContextualOfferModel
ccms
;
public
void
setDataType
(
int
dataType
)
{
this
.
dataType
=
dataType
;
}
public
void
setCampaign
(
Campaign
campaign
)
{
this
.
campaign
=
campaign
;
}
...
...
@@ -58,4 +58,12 @@ public class MergedGifts {
public
Campaign
getCampaign
()
{
return
campaign
;
}
public
void
setCCMS
(
LoyaltyContextualOfferModel
ccmsItem
)
{
this
.
ccms
=
ccmsItem
;
}
public
LoyaltyContextualOfferModel
getCCMS
()
{
return
ccms
;
}
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/MergedMore.java
0 → 100644
View file @
9473448
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package
ly
.
warp
.
sdk
.
io
.
models
;
/**
* Created by Panagiotis Triantafyllou on 10-Aug-22.
*/
public
class
MergedMore
{
private
int
dataType
=
0
;
private
Campaign
campaign
;
private
LoyaltyContextualOfferModel
ccms
;
public
void
setDataType
(
int
dataType
)
{
this
.
dataType
=
dataType
;
}
public
void
setCampaign
(
Campaign
campaign
)
{
this
.
campaign
=
campaign
;
}
public
int
getDataType
()
{
return
dataType
;
}
public
Campaign
getCampaign
()
{
return
campaign
;
}
public
void
setCCMS
(
LoyaltyContextualOfferModel
ccmsItem
)
{
this
.
ccms
=
ccmsItem
;
}
public
LoyaltyContextualOfferModel
getCCMS
()
{
return
ccms
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyRedeemCouponRequest.java
View file @
9473448
...
...
@@ -2,6 +2,7 @@ package ly.warp.sdk.io.request;
import
android.util.Base64
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
...
...
@@ -26,6 +27,21 @@ public class WarplyRedeemCouponRequest {
private
final
String
KEY_ACTION_VALUE
=
"retrieve_coupon"
;
private
final
String
KEY_COUPONSET
=
"coupon_set"
;
private
final
String
KEY_COMMUNICATION_UUID
=
"communication_uuid"
;
private
final
String
KEY_EXTRA_DATA
=
"extra_data"
;
private
final
String
KEY_USER_MSISDN
=
"user_msisdn"
;
private
final
String
KEY_BUSINESS_SERVICE
=
"businessService"
;
private
final
String
KEY_OFFER_NAME
=
"offerName"
;
private
final
String
KEY_PRODUCT_TYPE
=
"productType"
;
private
final
String
KEY_PROV_DURATION
=
"provDuration"
;
private
final
String
KEY_NO_OF_RECURRANCE
=
"noOfRecurrance"
;
private
final
String
KEY_PRICE
=
"price"
;
private
final
String
KEY_DISCOUNT
=
"discount"
;
private
final
String
KEY_VOICE_CATEGORY
=
"voiceCategory"
;
private
final
String
KEY_DATA_CATEGORY
=
"dataCategory"
;
private
final
String
KEY_MINS_VALUE
=
"minsValue"
;
private
final
String
KEY_DATA_VALUE
=
"dataValue"
;
private
final
String
KEY_PROV_STEP_VALUE_MINS
=
"provStepValueMins"
;
private
final
String
KEY_PARAMETERS
=
"parameters"
;
// ===========================================================
// Fields
...
...
@@ -35,6 +51,28 @@ public class WarplyRedeemCouponRequest {
private
long
mCacheUpdateInterval
=
0
;
private
String
mCouponsetUuid
=
""
;
private
String
mCommunicationUuid
=
""
;
private
boolean
mHasContextualOffer
=
false
;
private
String
mUserMsisdn
=
""
;
private
String
mBusinessService
=
""
;
private
String
mOfferName
=
""
;
private
String
mProductType
=
""
;
private
String
mProvDuration
=
""
;
private
String
mNoOfRecurrance
=
""
;
private
String
mPrice
=
""
;
private
String
mDiscount
=
""
;
private
String
mVoiceCategory
=
""
;
private
String
mDataCategory
=
""
;
private
String
mMinsValue
=
""
;
private
String
mDataValue
=
""
;
private
String
mProvStepValueMins
=
""
;
private
String
mOfferAudienceLevel
=
""
;
private
String
mUACIOfferTrackingCode
=
""
;
private
String
mOfferCode1
=
""
;
private
String
mScore
=
""
;
private
String
mZone
=
""
;
private
String
mWave
=
""
;
private
String
mValidity
=
""
;
private
String
mTreatmentCode
=
""
;
// ===========================================================
// Constructor
...
...
@@ -90,6 +128,116 @@ public class WarplyRedeemCouponRequest {
return
this
;
}
public
WarplyRedeemCouponRequest
setHasContextualOffer
(
boolean
hasContextualOffer
)
{
mHasContextualOffer
=
hasContextualOffer
;
return
this
;
}
public
WarplyRedeemCouponRequest
setUserMsisdn
(
String
userMsisdn
)
{
this
.
mUserMsisdn
=
userMsisdn
;
return
this
;
}
public
WarplyRedeemCouponRequest
setBusinessService
(
String
businessService
)
{
this
.
mBusinessService
=
businessService
;
return
this
;
}
public
WarplyRedeemCouponRequest
setOfferName
(
String
offerName
)
{
this
.
mOfferName
=
offerName
;
return
this
;
}
public
WarplyRedeemCouponRequest
setProductType
(
String
productType
)
{
this
.
mProductType
=
productType
;
return
this
;
}
public
WarplyRedeemCouponRequest
setProvDuration
(
String
provDuration
)
{
this
.
mProvDuration
=
provDuration
;
return
this
;
}
public
WarplyRedeemCouponRequest
setNoOfRecurrance
(
String
noOfRecurrance
)
{
this
.
mNoOfRecurrance
=
noOfRecurrance
;
return
this
;
}
public
WarplyRedeemCouponRequest
setPrice
(
String
price
)
{
this
.
mPrice
=
price
;
return
this
;
}
public
WarplyRedeemCouponRequest
setDiscount
(
String
discount
)
{
this
.
mDiscount
=
discount
;
return
this
;
}
public
WarplyRedeemCouponRequest
setVoiceCategory
(
String
voiceCategory
)
{
this
.
mVoiceCategory
=
voiceCategory
;
return
this
;
}
public
WarplyRedeemCouponRequest
setDataCategory
(
String
dataCategory
)
{
this
.
mDataCategory
=
dataCategory
;
return
this
;
}
public
WarplyRedeemCouponRequest
setMinsValue
(
String
minsValue
)
{
this
.
mMinsValue
=
minsValue
;
return
this
;
}
public
WarplyRedeemCouponRequest
setDataValue
(
String
dataValue
)
{
this
.
mDataValue
=
dataValue
;
return
this
;
}
public
WarplyRedeemCouponRequest
setProvStepValueMins
(
String
provStepValueMins
)
{
this
.
mProvStepValueMins
=
provStepValueMins
;
return
this
;
}
public
WarplyRedeemCouponRequest
setOfferAudienceLevel
(
String
offerAudienceLevel
)
{
this
.
mOfferAudienceLevel
=
offerAudienceLevel
;
return
this
;
}
public
WarplyRedeemCouponRequest
setUACIOfferTrackingCode
(
String
uaciOfferTrackingCode
)
{
this
.
mUACIOfferTrackingCode
=
uaciOfferTrackingCode
;
return
this
;
}
public
WarplyRedeemCouponRequest
setOfferCode1
(
String
offerCode1
)
{
this
.
mOfferCode1
=
offerCode1
;
return
this
;
}
public
WarplyRedeemCouponRequest
setScore
(
String
score
)
{
this
.
mScore
=
score
;
return
this
;
}
public
WarplyRedeemCouponRequest
setZone
(
String
zone
)
{
this
.
mZone
=
zone
;
return
this
;
}
public
WarplyRedeemCouponRequest
setWave
(
String
wave
)
{
this
.
mWave
=
wave
;
return
this
;
}
public
WarplyRedeemCouponRequest
setValidity
(
String
validity
)
{
this
.
mValidity
=
validity
;
return
this
;
}
public
WarplyRedeemCouponRequest
setTreatmentCode
(
String
treatmentCode
)
{
this
.
mTreatmentCode
=
treatmentCode
;
return
this
;
}
/**
* Call this to get how often the cached data will be updated.
*
...
...
@@ -153,6 +301,141 @@ public class WarplyRedeemCouponRequest {
bodyJsonObject
.
putOpt
(
KEY_ACTION
,
KEY_ACTION_VALUE
);
bodyJsonObject
.
putOpt
(
KEY_COUPONSET
,
mCouponsetUuid
);
bodyJsonObject
.
putOpt
(
KEY_COMMUNICATION_UUID
,
mCommunicationUuid
);
if
(
mHasContextualOffer
)
{
JSONObject
extraJson
=
new
JSONObject
();
extraJson
.
putOpt
(
KEY_USER_MSISDN
,
mUserMsisdn
);
extraJson
.
putOpt
(
KEY_BUSINESS_SERVICE
,
mBusinessService
);
extraJson
.
putOpt
(
KEY_OFFER_NAME
,
mOfferName
);
extraJson
.
putOpt
(
KEY_PRODUCT_TYPE
,
mProductType
);
extraJson
.
putOpt
(
KEY_PROV_DURATION
,
mProvDuration
);
extraJson
.
putOpt
(
KEY_NO_OF_RECURRANCE
,
mNoOfRecurrance
);
extraJson
.
putOpt
(
KEY_PRICE
,
mPrice
);
extraJson
.
putOpt
(
KEY_DISCOUNT
,
mDiscount
);
extraJson
.
putOpt
(
KEY_VOICE_CATEGORY
,
mVoiceCategory
);
extraJson
.
putOpt
(
KEY_DATA_CATEGORY
,
mDataCategory
);
extraJson
.
putOpt
(
KEY_MINS_VALUE
,
mMinsValue
);
extraJson
.
putOpt
(
KEY_DATA_VALUE
,
mDataValue
);
extraJson
.
putOpt
(
KEY_PROV_STEP_VALUE_MINS
,
mProvStepValueMins
);
extraJson
.
putOpt
(
"InteractiveChannel"
,
"COSMOTE_OMNI"
);
extraJson
.
putOpt
(
"InteractionPoint"
,
mZone
);
extraJson
.
putOpt
(
"Session_ID"
,
mCommunicationUuid
);
extraJson
.
putOpt
(
"OfferAudienceLevel"
,
mOfferAudienceLevel
);
extraJson
.
putOpt
(
"MSISDN"
,
mOfferAudienceLevel
.
equals
(
"msisdn"
)
?
mUserMsisdn
:
""
);
extraJson
.
putOpt
(
"GUID"
,
""
);
JSONArray
parameters
=
new
JSONArray
();
JSONObject
param1
=
new
JSONObject
();
param1
.
putOpt
(
"Name"
,
"UACIOfferTrackingCode"
);
param1
.
putOpt
(
"Value"
,
mUACIOfferTrackingCode
);
param1
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param1
);
JSONObject
param2
=
new
JSONObject
();
param2
.
putOpt
(
"Name"
,
"UACICustomLoggerTableName"
);
param2
.
putOpt
(
"Value"
,
"VW_WHITELIST"
);
param2
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param2
);
JSONObject
param3
=
new
JSONObject
();
param3
.
putOpt
(
"Name"
,
"MSISDN"
);
param3
.
putOpt
(
"Value"
,
mUserMsisdn
);
param3
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param3
);
JSONObject
param4
=
new
JSONObject
();
param4
.
putOpt
(
"Name"
,
"OFFERCODE1"
);
param4
.
putOpt
(
"Value"
,
mOfferCode1
);
param4
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param4
);
JSONObject
param5
=
new
JSONObject
();
param5
.
putOpt
(
"Name"
,
"SCORE"
);
param5
.
putOpt
(
"Value"
,
mScore
);
param5
.
putOpt
(
"Type"
,
"INT"
);
parameters
.
put
(
param5
);
JSONObject
param6
=
new
JSONObject
();
param6
.
putOpt
(
"Name"
,
"PREDICATE"
);
param6
.
putOpt
(
"Value"
,
"0"
);
param6
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param6
);
JSONObject
param7
=
new
JSONObject
();
param7
.
putOpt
(
"Name"
,
"ZONE"
);
param7
.
putOpt
(
"Value"
,
mZone
);
param7
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param7
);
JSONObject
param8
=
new
JSONObject
();
param8
.
putOpt
(
"Name"
,
"APPLICATIONNAME"
);
param8
.
putOpt
(
"Value"
,
mZone
);
param8
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param8
);
JSONObject
param9
=
new
JSONObject
();
param9
.
putOpt
(
"Name"
,
"Session_ID"
);
param9
.
putOpt
(
"Value"
,
mCommunicationUuid
);
param9
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param9
);
JSONObject
param10
=
new
JSONObject
();
param10
.
putOpt
(
"Name"
,
"CAMPAIGN_CODE"
);
param10
.
putOpt
(
"Value"
,
"MCC_00006"
);
param10
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param10
);
JSONObject
param11
=
new
JSONObject
();
param11
.
putOpt
(
"Name"
,
"CAMPAIGN_TYPE"
);
param11
.
putOpt
(
"Value"
,
"Inbound"
);
param11
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param11
);
JSONObject
param12
=
new
JSONObject
();
param12
.
putOpt
(
"Name"
,
"UACIResponseTypeCode"
);
param12
.
putOpt
(
"Value"
,
"CON"
);
param12
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param12
);
JSONObject
param13
=
new
JSONObject
();
param13
.
putOpt
(
"Name"
,
"CHANNEL"
);
param13
.
putOpt
(
"Value"
,
"ONE_APP"
);
param13
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param13
);
JSONObject
param14
=
new
JSONObject
();
param14
.
putOpt
(
"Name"
,
"WAVE"
);
param14
.
putOpt
(
"Value"
,
mWave
);
param14
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param14
);
JSONObject
param15
=
new
JSONObject
();
param15
.
putOpt
(
"Name"
,
"RESPONSECHANNEL"
);
param15
.
putOpt
(
"Value"
,
"ONE_APP"
);
param15
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param15
);
JSONObject
param16
=
new
JSONObject
();
param16
.
putOpt
(
"Name"
,
"VALIDITY"
);
param16
.
putOpt
(
"Value"
,
mValidity
);
param16
.
putOpt
(
"Type"
,
"INT"
);
parameters
.
put
(
param16
);
JSONObject
param17
=
new
JSONObject
();
param17
.
putOpt
(
"Name"
,
"TREATMENT_CODE"
);
param17
.
putOpt
(
"Value"
,
mTreatmentCode
);
param17
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param17
);
JSONObject
param18
=
new
JSONObject
();
param18
.
putOpt
(
"Name"
,
"EventName"
);
param18
.
putOpt
(
"Value"
,
"INTEREST_P"
);
param18
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param18
);
extraJson
.
putOpt
(
KEY_PARAMETERS
,
parameters
);
bodyJsonObject
.
putOpt
(
KEY_EXTRA_DATA
,
extraJson
);
}
}
catch
(
JSONException
e
)
{
if
(
WarpConstants
.
DEBUG
)
e
.
printStackTrace
();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventQuestionnaireService.java
View file @
9473448
...
...
@@ -30,7 +30,7 @@ public class EventQuestionnaireService extends Worker {
WarplyManager
.
getConsumer
(
new
WarplyConsumerRequest
(),
new
CallbackReceiver
<
Consumer
>()
{
@Override
public
void
onSuccess
(
Consumer
result
)
{
WarplyManagerHelper
.
setConsumer
(
result
);
WarplyManagerHelper
.
setConsumer
Internal
(
result
);
WarplyManager
.
getCampaigns
(
new
WarplyGetCampaignsRequest
().
setLanguage
(
"en"
),
new
CallbackReceiver
<
CampaignList
>()
{
@Override
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
9473448
...
...
@@ -45,6 +45,7 @@ import java.util.HashMap;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.activities.CouponsetInfoActivity
;
import
ly.warp.sdk.activities.GiftsForYouActivity
;
import
ly.warp.sdk.activities.TelcoActivity
;
import
ly.warp.sdk.activities.WarpViewActivity
;
import
ly.warp.sdk.db.WarplyDBHelper
;
...
...
@@ -83,6 +84,7 @@ public class WarplyManagerHelper {
// ===========================================================
private
static
Consumer
mConsumer
=
new
Consumer
();
private
static
Consumer
mConsumerInternal
=
new
Consumer
();
private
static
HashMap
<
String
,
CampaignList
>
mUniqueCampaignList
=
new
HashMap
<
String
,
CampaignList
>();
private
static
CouponList
mCouponList
=
new
CouponList
();
private
static
CouponList
mCouponListExpired
=
new
CouponList
();
...
...
@@ -94,7 +96,7 @@ public class WarplyManagerHelper {
private
static
ArrayList
<
LoyaltyGiftsForYouPackage
>
mSeasonalList
=
new
ArrayList
<>();
private
static
ArrayList
<
LoyaltyContextualOfferModel
>
mCCMSList
=
new
ArrayList
<>();
private
static
AlertDialog
mAlertDialogSharing
,
mAlertDialogAcceptSharing
,
mAlertDialogRejectSharing
,
mAlertDialogReturnSharing
,
mAlertDialogErrorSharing
;
mAlertDialogReturnSharing
,
mAlertDialogErrorSharing
,
mAlertDialogErrorUsedSharing
,
mAlertDialogErrorExpiredSharing
;
private
static
LoyaltyBadgeModel
mLoyaltyBadge
=
new
LoyaltyBadgeModel
();
private
static
float
mDealsSum
=
0.0f
;
private
static
MerchantList
mMerchantList
=
new
MerchantList
();
...
...
@@ -165,6 +167,10 @@ public class WarplyManagerHelper {
returnSharingDialog
(
context
,
modalText
);
}
}
}
else
if
(
status
==
4
)
{
errorExpiredDialog
(
context
);
}
else
if
(
status
==
5
)
{
errorUsedDialog
(
context
);
}
else
errorSharingDialog
(
context
);
}
...
...
@@ -295,6 +301,32 @@ public class WarplyManagerHelper {
}
/**
* Expired dialog
*/
private
static
void
errorExpiredDialog
(
Context
context
)
{
mAlertDialogErrorExpiredSharing
=
new
AlertDialog
.
Builder
(
context
)
.
setTitle
(
R
.
string
.
cos_dlg_error_title
)
.
setMessage
(
R
.
string
.
cos_dlg_error_expired
)
.
setPositiveButton
(
R
.
string
.
cos_dlg_positive_button2
,
(
dialogPositive
,
whichPositive
)
->
{
dialogPositive
.
dismiss
();
})
.
show
();
}
/**
* Used dialog
*/
private
static
void
errorUsedDialog
(
Context
context
)
{
mAlertDialogErrorUsedSharing
=
new
AlertDialog
.
Builder
(
context
)
.
setTitle
(
R
.
string
.
cos_dlg_error_title
)
.
setMessage
(
R
.
string
.
cos_dlg_error_used
)
.
setPositiveButton
(
R
.
string
.
cos_dlg_positive_button2
,
(
dialogPositive
,
whichPositive
)
->
{
dialogPositive
.
dismiss
();
})
.
show
();
}
/**
* Open CCMS campaign
*/
public
static
String
constructCcmsUrl
(
Campaign
item
,
LoyaltyContextualOfferModel
ccmsItem
)
{
...
...
@@ -606,6 +638,43 @@ public class WarplyManagerHelper {
public
static
void
handleLoyaltyCampaigns
(
Context
context
,
Campaign
item
)
{
if
(
item
!=
null
)
{
if
(
item
.
getType
().
equals
(
"coupon"
))
{
if
(
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
()
!=
null
&&
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
().
size
()
>
0
)
{
LoyaltyContextualOfferModel
ccmsItem
=
null
;
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
item
.
getSessionUUID
()))
{
ccmsItem
=
ccms
;
break
;
}
}
if
(
ccmsItem
!=
null
)
{
try
{
JSONObject
campaignSettings
=
WarpJSONParser
.
getJSONFromString
(
item
.
getCampaignTypeSettings
());
if
(
campaignSettings
!=
null
)
{
if
(
campaignSettings
.
has
(
"couponset"
))
{
String
cpnUuid
=
campaignSettings
.
optString
(
"couponset"
);
for
(
Couponset
cpns
:
WarplyManagerHelper
.
getCouponsets
())
{
if
(
cpns
.
getUuid
().
equals
(
cpnUuid
))
{
Intent
intent
=
new
Intent
(
context
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
cpns
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
item
);
intent
.
putExtra
(
"ccms"
,
ccmsItem
);
context
.
startActivity
(
intent
);
break
;
}
}
}
else
{
context
.
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
context
,
WarplyManagerHelper
.
constructCampaignUrl
(
item
)));
}
}
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
return
;
}
}
try
{
JSONObject
campaignSettings
=
WarpJSONParser
.
getJSONFromString
(
item
.
getCampaignTypeSettings
());
if
(
campaignSettings
!=
null
)
{
...
...
@@ -790,10 +859,22 @@ public class WarplyManagerHelper {
return
mDfyCoupons
;
}
public
static
Consumer
getConsumerInternal
()
{
return
mConsumerInternal
;
}
public
static
void
setConsumerInternal
(
Consumer
consumer
)
{
mConsumerInternal
=
consumer
;
}
public
static
Consumer
getConsumer
()
{
return
mConsumer
;
}
public
static
void
setConsumer
(
Consumer
consumer
)
{
mConsumer
=
consumer
;
}
public
static
HashMap
<
String
,
CampaignList
>
getUniqueCampaignList
()
{
return
mUniqueCampaignList
;
}
...
...
@@ -816,10 +897,6 @@ public class WarplyManagerHelper {
return
mCouponListExpired
;
}
public
static
void
setConsumer
(
Consumer
consumer
)
{
mConsumer
=
consumer
;
}
public
static
void
setUniqueCampaignList
(
CampaignList
campaignList
)
{
mCampaignList
.
clear
();
mCampaignList
.
addAll
(
campaignList
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
9473448
...
...
@@ -802,7 +802,7 @@ public class WarplyManager {
getConsumer
(
new
WarplyConsumerRequest
(),
new
CallbackReceiver
<
Consumer
>()
{
@Override
public
void
onSuccess
(
Consumer
result
)
{
WarplyManagerHelper
.
setConsumer
(
result
);
WarplyManagerHelper
.
setConsumer
Internal
(
result
);
if
(
result
!=
null
)
{
JSONObject
profMetadata
=
WarpJSONParser
.
getJSONFromString
(
result
.
getProfileMetadata
());
if
(
profMetadata
!=
null
)
{
...
...
@@ -1383,8 +1383,8 @@ public class WarplyManager {
campaignLoyaltyList
.
clear
();
for
(
Campaign
camp
:
mNewCampaignList
)
{
if
(
camp
.
getOfferCategory
().
equals
(
"questionnaire"
))
{
if
(
WarplyManagerHelper
.
getConsumer
()
!=
null
)
{
JSONObject
profMetadata
=
WarpJSONParser
.
getJSONFromString
(
WarplyManagerHelper
.
getConsumer
().
getProfileMetadata
());
if
(
WarplyManagerHelper
.
getConsumer
Internal
()
!=
null
)
{
JSONObject
profMetadata
=
WarpJSONParser
.
getJSONFromString
(
WarplyManagerHelper
.
getConsumer
Internal
().
getProfileMetadata
());
if
(
profMetadata
!=
null
)
{
if
(!
profMetadata
.
has
(
"answered"
))
{
try
{
...
...
@@ -2278,7 +2278,7 @@ public class WarplyManager {
getConsumer
(
new
WarplyConsumerRequest
(),
new
CallbackReceiver
<
Consumer
>()
{
@Override
public
void
onSuccess
(
Consumer
result
)
{
WarplyManagerHelper
.
setConsumer
(
result
);
WarplyManagerHelper
.
setConsumer
Internal
(
result
);
if
(
result
!=
null
)
{
JSONObject
profMetadata
=
WarpJSONParser
.
getJSONFromString
(
result
.
getProfileMetadata
());
if
(
profMetadata
!=
null
)
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedGiftsAdapter.java
View file @
9473448
...
...
@@ -126,6 +126,23 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.
// holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
//
// holder.tvCouponValue.setText(mergedgiftsItem.getDiscount());
}
else
if
(
mergedgiftsItem
!=
null
&&
mergedgiftsItem
.
getDataType
()
==
3
)
{
if
(!
TextUtils
.
isEmpty
(
mergedgiftsItem
.
getCCMS
().
getImageUrl
()))
{
Glide
.
with
(
mContext
)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.
load
(
mergedgiftsItem
.
getCCMS
().
getImageUrl
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivMergedGiftsLogo
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivMergedGiftsLogo
);
}
holder
.
tvMergedGiftsTitle
.
setText
(
mergedgiftsItem
.
getCCMS
().
getTitle
());
}
holder
.
itemView
.
setOnClickListener
(
v
->
onClickSubject
.
onNext
(
mergedgiftsItem
));
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedMoreAdapter.java
0 → 100644
View file @
9473448
package
ly
.
warp
.
sdk
.
views
.
adapters
;
import
android.content.Context
;
import
android.text.TextUtils
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
com.bumptech.glide.load.resource.bitmap.CenterCrop
;
import
com.bumptech.glide.load.resource.bitmap.RoundedCorners
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.concurrent.TimeUnit
;
import
io.reactivex.Observable
;
import
io.reactivex.subjects.PublishSubject
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.MergedMore
;
public
class
MergedMoreAdapter
extends
RecyclerView
.
Adapter
<
MergedMoreAdapter
.
MergedMoreViewHolder
>
{
private
Context
mContext
;
private
ArrayList
<
MergedMore
>
mMergedMore
;
private
final
PublishSubject
<
MergedMore
>
onClickSubject
=
PublishSubject
.
create
();
public
MergedMoreAdapter
(
Context
mContext
,
ArrayList
<
MergedMore
>
mergedmore
)
{
this
.
mContext
=
mContext
;
this
.
mMergedMore
=
mergedmore
;
}
public
class
MergedMoreViewHolder
extends
RecyclerView
.
ViewHolder
{
private
ImageView
ivCampaignTitle
,
ivIsNew
;
private
TextView
tvCampaignTitle
,
tvCampaignSubtitle
,
tvCampaignMessage
;
public
MergedMoreViewHolder
(
View
view
)
{
super
(
view
);
ivCampaignTitle
=
view
.
findViewById
(
R
.
id
.
iv_campaign_logo
);
tvCampaignTitle
=
view
.
findViewById
(
R
.
id
.
tv_campaign_title
);
ivIsNew
=
view
.
findViewById
(
R
.
id
.
iv_campaign_new
);
tvCampaignSubtitle
=
view
.
findViewById
(
R
.
id
.
tv_campaign_subtitle
);
tvCampaignMessage
=
view
.
findViewById
(
R
.
id
.
tv_campaign_message
);
}
}
@Override
public
int
getItemCount
()
{
if
(
mMergedMore
==
null
)
return
0
;
else
return
mMergedMore
.
size
();
}
public
MergedMore
getItem
(
int
id
)
{
return
mMergedMore
.
get
(
id
);
}
public
void
updateData
(
ArrayList
<
MergedMore
>
mergedmore
)
{
mMergedMore
.
clear
();
mMergedMore
.
addAll
(
mergedmore
);
notifyDataSetChanged
();
}
@Override
public
MergedMoreViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
itemView
;
itemView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
item_profile_recycler_vertical
,
parent
,
false
);
return
new
MergedMoreViewHolder
(
itemView
);
}
@Override
public
void
onBindViewHolder
(
final
MergedMoreViewHolder
holder
,
int
position
)
{
MergedMore
mergedmoreItem
=
mMergedMore
.
get
(
position
);
if
(
mergedmoreItem
!=
null
&&
mergedmoreItem
.
getDataType
()
==
1
)
{
if
(!
TextUtils
.
isEmpty
(
mergedmoreItem
.
getCampaign
().
getLogoUrl
()))
{
Glide
.
with
(
mContext
)
.
load
(
mergedmoreItem
.
getCampaign
().
getLogoUrl
())
.
transform
(
new
CenterCrop
(),
new
RoundedCorners
(
4
))
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivCampaignTitle
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivCampaignTitle
);
}
holder
.
tvCampaignTitle
.
setText
(
mergedmoreItem
.
getCampaign
().
getTitle
());
holder
.
tvCampaignSubtitle
.
setText
(
mergedmoreItem
.
getCampaign
().
getSubtitle
());
holder
.
tvCampaignMessage
.
setText
(
mergedmoreItem
.
getCampaign
().
getMessage
());
if
(
mergedmoreItem
.
getCampaign
().
getIsNew
())
holder
.
ivIsNew
.
setVisibility
(
View
.
VISIBLE
);
else
holder
.
ivIsNew
.
setVisibility
(
View
.
GONE
);
}
else
if
(
mergedmoreItem
!=
null
&&
mergedmoreItem
.
getDataType
()
==
2
)
{
if
(!
TextUtils
.
isEmpty
(
mergedmoreItem
.
getCCMS
().
getImageUrl
()))
{
Glide
.
with
(
mContext
)
.
load
(
mergedmoreItem
.
getCCMS
().
getImageUrl
())
.
transform
(
new
CenterCrop
(),
new
RoundedCorners
(
4
))
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivCampaignTitle
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivCampaignTitle
);
}
holder
.
tvCampaignTitle
.
setText
(
mergedmoreItem
.
getCCMS
().
getTitle
());
holder
.
tvCampaignSubtitle
.
setText
(
mergedmoreItem
.
getCCMS
().
getSubtitle
());
holder
.
tvCampaignMessage
.
setText
(
mergedmoreItem
.
getCCMS
().
getMessage
());
holder
.
ivIsNew
.
setVisibility
(
View
.
GONE
);
}
holder
.
itemView
.
setOnClickListener
(
v
->
onClickSubject
.
onNext
(
mergedmoreItem
));
}
public
Observable
<
MergedMore
>
getPositionClicks
()
{
return
onClickSubject
.
cache
();
}
private
long
getDifferenceDays
(
Date
d1
,
Date
d2
)
{
long
diff
=
d2
.
getTime
()
-
d1
.
getTime
();
return
TimeUnit
.
DAYS
.
convert
(
diff
,
TimeUnit
.
MILLISECONDS
);
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/SharedCouponAdapter.java
View file @
9473448
...
...
@@ -95,12 +95,12 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte
if
(
couponItem
.
getSharingType
().
equals
(
"sent"
))
{
holder
.
tvCouponLabel
.
setText
(
R
.
string
.
cos_shared_coupon_receiver
);
if
(
extraFields
!=
null
&&
extraFields
.
has
(
"receiver_msisdn"
))
{
holder
.
tvCoupon
Label
.
setText
(
extraFields
.
optString
(
"receiver_msisdn"
));
holder
.
tvCoupon
Phone
.
setText
(
extraFields
.
optString
(
"receiver_msisdn"
));
}
}
else
if
(
couponItem
.
getSharingType
().
equals
(
"received"
))
{
holder
.
tvCouponLabel
.
setText
(
R
.
string
.
cos_shared_coupon_sender
);
if
(
extraFields
!=
null
&&
extraFields
.
has
(
"sender_msisdn"
))
{
holder
.
tvCoupon
Label
.
setText
(
extraFields
.
optString
(
"sender_msisdn"
));
holder
.
tvCoupon
Phone
.
setText
(
extraFields
.
optString
(
"sender_msisdn"
));
}
}
...
...
warply_android_sdk/src/main/res/layout/activity_loyalty_wallet.xml
View file @
9473448
...
...
@@ -413,6 +413,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"32dp"
android:layout_marginTop=
"24dp"
android:gravity=
"center"
android:orientation=
"vertical"
android:visibility=
"gone"
>
...
...
warply_android_sdk/src/main/res/values/strings.xml
View file @
9473448
...
...
@@ -123,6 +123,9 @@
<string
name=
"cos_value2"
>
%1$s
</string>
<string
name=
"cos_show_barcode"
>
Εμφάνιση barcode
</string>
<string
name=
"cos_hide_barcode"
>
Απόκρυψη barcode
</string>
<string
name=
"cos_wrong_number_dlg"
>
Το κινητό που καταχώρησες δεν είναι COSMOTE. Παρακαλούμε καταχώρησε το COSMOTE τηλέφωνο του φίλου σου.
</string>
<string
name=
"cos_dlg_error_expired"
>
Το δώρο έχει λήξει
</string>
<string
name=
"cos_dlg_error_used"
>
Το δώρο έχει ήδη χρησιμοποιηθεί
</string>
<string-array
name=
"coupons_array"
>
<item>
Κουπόνια
</item>
...
...
Please
register
or
login
to post a comment