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-10-10 19:16:43 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
46c74ba4447943ccbd005732437bf79f2904da57
46c74ba4
1 parent
21d0308f
new keys
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
120 additions
and
326 deletions
app/src/main/assets/warply.properties
app/src/main/java/warp/ly/android_sdk/activities/BaseActivity.java
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/Warply.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.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/services/WarplyHealthService.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
app/src/main/assets/warply.properties
View file @
46c74ba
...
...
@@ -3,7 +3,7 @@
# The app uuid the warply sdk need to connect to the engage server
# dev f83dfde1145e4c2da69793abb2f579af
# prod 0086a2088301440792091b9f814c2267
Uuid
=
f83dfde1145e4c2da69793abb2f579af
Uuid
=
0086a2088301440792091b9f814c2267
# If we need to see logs in Logcat
Debug
=
true
...
...
@@ -11,7 +11,7 @@ Debug=true
# Production or Development environment of the engage server
# Production: https://engage.warp.ly
# Development: https://engage-stage.warp.ly
BaseURL
=
https://engage
-stage
.warp.ly
BaseURL
=
https://engage.warp.ly
# For Verify Ticket request
VerifyURL
=
/partners/cosmote/verify
...
...
app/src/main/java/warp/ly/android_sdk/activities/BaseActivity.java
View file @
46c74ba
...
...
@@ -27,19 +27,16 @@ public abstract class BaseActivity extends FragmentActivity {
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
WarplySessionManager
.
onCreateActivity
(
this
);
}
@Override
protected
void
onStart
()
{
super
.
onStart
();
WarplySessionManager
.
onStartActivity
(
this
);
}
@Override
protected
void
onStop
()
{
super
.
onStop
();
WarplySessionManager
.
onStopActivity
(
this
);
}
// ===========================================================
...
...
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
46c74ba
...
...
@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public
void
onWarplyReady
()
{
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"
7000000826
"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990
.
setGuid
(
"
6006552990
"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990
mLoginReceiver
);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/build.gradle
View file @
46c74ba
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta8
7
'
PUBLISH_VERSION
=
'4.5.4-cosbeta8
8
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/Warply.java
View file @
46c74ba
...
...
@@ -156,20 +156,20 @@ public enum Warply {
private
void
isInitializedOrThrow
()
{
if
(
mContext
==
null
)
{
WarpUtils
.
log
(
"Warply has not been initialized, call init(Context) first"
);
return
;
//
return;
}
if
(
mContext
.
get
()
==
null
)
{
WarpUtils
.
log
(
"Warply has not been initialized, call init(Context) first"
);
return
;
//
return;
}
String
apiKey
=
WarplyProperty
.
getAppUuid
(
mContext
.
get
());
if
(
apiKey
==
null
)
{
WarpUtils
.
log
(
"Warply application UUID has not been set in the Manifest"
);
return
;
//
return;
}
if
((
apiKey
.
length
()
!=
32
)
&&
(
apiKey
.
length
()
!=
36
))
{
WarpUtils
.
log
(
"Warply application UUID has not been set correclty in the Manifest, key got: "
+
apiKey
);
return
;
//
return;
}
}
...
...
@@ -985,6 +985,9 @@ public enum Warply {
}
private
void
check
()
{
// if (mContext == null) {
// return;
// }
if
(!
WarpUtils
.
isRegisteredWarply
(
mContext
.
get
()))
{
registerWarply
();
return
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
View file @
46c74ba
...
...
@@ -54,7 +54,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
WarplySessionManager
.
onCreateActivity
(
this
);
setContentView
(
R
.
layout
.
activity_base_fragment
);
mBottomNavigationView
=
findViewById
(
R
.
id
.
bt_tabs
);
...
...
@@ -71,13 +70,11 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
@Override
protected
void
onStart
()
{
super
.
onStart
();
WarplySessionManager
.
onStartActivity
(
this
);
}
@Override
protected
void
onStop
()
{
super
.
onStop
();
WarplySessionManager
.
onStopActivity
(
this
);
}
@Override
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
View file @
46c74ba
...
...
@@ -23,7 +23,6 @@ import org.json.JSONObject;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.LinkedHashSet
;
import
java.util.Set
;
...
...
@@ -31,7 +30,6 @@ import java.util.Set;
import
io.github.inflationx.viewpump.ViewPumpContextWrapper
;
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.Couponset
;
import
ly.warp.sdk.io.models.LoyaltyContextualOfferModel
;
import
ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent
;
...
...
@@ -60,13 +58,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
private
ImageView
mIvBack
,
mIvPopupClose
;
private
TextView
mTvTitle
;
private
HashMap
<
String
,
CampaignList
>
mUniqueGiftsList
=
new
HashMap
<
String
,
CampaignList
>();
private
LinearLayout
mLlGiftsPopup
;
private
ArrayList
<
MergedGifts
>
mData
=
new
ArrayList
();
private
ArrayList
<
MergedGifts
>
mData
=
new
ArrayList
<>
();
private
RecyclerView
mRecyclerMergedGifts
;
private
MergedGiftsAdapter
mAdapterMergedGifts
;
private
ArrayList
<
Campaign
>
mValuesList
=
new
ArrayList
<>();
// private HashSet<Campaign> mHashSetList = new HashSet<>();
private
ArrayList
<
LoyaltyGiftsForYouPackage
>
mSeasonalList
=
new
ArrayList
<>();
private
HashSet
<
LoyaltyGiftsForYouPackage
>
mHashSetSeasonalList
=
new
HashSet
<>();
private
ArrayList
<
LoyaltyContextualOfferModel
>
mContextualList
=
new
ArrayList
<>();
...
...
@@ -82,37 +78,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_gifts_for_you
);
mSecondsHandler
=
new
Handler
();
filterItems
();
if
(
WarplyManagerHelper
.
getSeasonalList
()
!=
null
&&
WarplyManagerHelper
.
getSeasonalList
().
size
()
>
0
)
{
mHashSetSeasonalList
.
clear
();
mHashSetSeasonalList
.
addAll
(
WarplyManagerHelper
.
getSeasonalList
());
mSeasonalList
.
clear
();
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
(
mSeasonalList
,
mContextualList
,
mValuesList
);
mIvBack
=
findViewById
(
R
.
id
.
iv_list_close
);
mTvTitle
=
findViewById
(
R
.
id
.
textView3
);
mIvPopupClose
=
findViewById
(
R
.
id
.
iv_popup_gifts_close
);
mLlGiftsPopup
=
findViewById
(
R
.
id
.
ll_gifts_popup
);
mRecyclerMergedGifts
=
findViewById
(
R
.
id
.
rv_merged_gifts
);
filterItems
();
mergeDatasets
();
initViews
();
}
...
...
@@ -191,29 +167,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
if
(
event
.
getCcmsAdded
()
!=
null
||
event
.
getCampaignsAdded
()
!=
null
)
{
filterItems
();
if
(
WarplyManagerHelper
.
getSeasonalList
()
!=
null
&&
WarplyManagerHelper
.
getSeasonalList
().
size
()
>
0
)
{
mHashSetSeasonalList
.
clear
();
mHashSetSeasonalList
.
addAll
(
WarplyManagerHelper
.
getSeasonalList
());
mSeasonalList
.
clear
();
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
(
mSeasonalList
,
mContextualList
,
mValuesList
);
mergeDatasets
();
runOnUiThread
(
this
::
initViews
);
runOnUiThread
(
this
::
initViews
2
);
}
}
...
...
@@ -229,13 +185,41 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
// mLlGiftsPopup.setVisibility(View.VISIBLE);
if
(
mData
!=
null
&&
mData
.
size
()
>
0
)
{
mRecyclerMergedGifts
.
setNestedScrollingEnabled
(
false
);
mRecyclerMergedGifts
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterMergedGifts
=
new
MergedGiftsAdapter
(
this
,
mData
);
// mAdapterMergedGifts.setHasStableIds(true);
// mRecyclerMergedGifts.setItemAnimator(null);
mRecyclerMergedGifts
.
setAdapter
(
mAdapterMergedGifts
);
mAdapterMergedGifts
.
getPositionClicks
()
.
doOnNext
(
dataItem
->
{
.
doOnNext
(
this
::
handleGiftItemClick
)
.
doOnError
(
error
->
{
})
.
subscribe
();
}
}
private
void
initViews2
()
{
mIvBack
.
setOnClickListener
(
this
);
mIvPopupClose
.
setOnClickListener
(
this
);
// if (WarpUtils.getGiftsPopup(this))
// mLlGiftsPopup.setVisibility(View.VISIBLE);
if
(
mData
!=
null
&&
mData
.
size
()
>
0
)
{
// mRecyclerMergedGifts.setNestedScrollingEnabled(false);
// mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
// mAdapterMergedGifts = new MergedGiftsAdapter(this, mData);
// mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts);
// mAdapterMergedGifts.getPositionClicks()
// .doOnNext(this::handleGiftItemClick)
// .doOnError(error -> {
// })
// .subscribe();
mAdapterMergedGifts
.
updateData
(
mData
);
}
}
private
void
handleGiftItemClick
(
MergedGifts
dataItem
)
{
if
(
dataItem
.
getDataType
()
==
1
)
{
WarpUtils
.
log
(
"GFY_CLICK "
+
dataItem
.
getCampaign
().
toString
());
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
LoyaltyGiftsForYouOfferClickEvent
()));
...
...
@@ -386,153 +370,13 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
intent
.
putExtra
(
"ccms"
,
dataItem
.
getCCMS
());
startActivity
(
intent
);
}
})
.
doOnError
(
error
->
{
})
.
subscribe
();
}
}
private
void
initViews2
()
{
mIvBack
.
setOnClickListener
(
this
);
mIvPopupClose
.
setOnClickListener
(
this
);
if
(
mData
!=
null
&&
mData
.
size
()
>
0
)
{
// mAdapterMergedGifts = new MergedGiftsAdapter(this, mData);
// mAdapterMergedGifts.setHasStableIds(true);
// mRecyclerMergedGifts.setItemAnimator(null);
// mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts);
// mAdapterMergedGifts.getPositionClicks()
// .doOnNext(dataItem -> {
// if (dataItem.getDataType() == 1) {
// WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString());
// 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)) {
// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
// Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
// intent.putExtra("couponset", (Serializable) cpns);
// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
// intent.putExtra("ccms", ccmsItem);
// startActivityForResult(intent, 1004);
// break;
// }
// }
// } else {
// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
// }
// }
// } catch (Exception exception) {
// exception.printStackTrace();
// }
//
// return;
// }
// }
//
// 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)) {
// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
// Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
// intent.putExtra("couponset", (Serializable) cpns);
// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
// startActivityForResult(intent, 1004);
// break;
// }
// }
// } else {
// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
// }
// }
// } catch (Exception exception) {
// exception.printStackTrace();
// }
//
// return;
// }
//
// 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())) {
// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
// Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class);
// intent.putExtra("ccms", ccms);
// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
// startActivityForResult(intent, 1004);
// break;
// }
// }
// return;
// }
// 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());
// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)), 1004);
// break;
// }
// }
// } else {
// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
// }
// }
// } catch (Exception exception) {
// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
// }
// } else if (dataItem.getDataType() == 2) {
// LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent();
// seasonalCLick.setTitle(dataItem.getSeasonalList().getTitle());
// seasonalCLick.setLoyaltyPackageId(dataItem.getSeasonalList().getLoyaltyPackageId());
// seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl());
// seasonalCLick.setContext(GiftsForYouActivity.this);
// EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick));
// } else if (dataItem.getDataType() == 3) {
// Intent intent = new Intent(GiftsForYouActivity.this, ContextualActivity.class);
// intent.putExtra("ccms", dataItem.getCCMS());
// startActivity(intent);
// }
// })
// .doOnError(error -> {
// })
// .subscribe();
// mAdapterMergedGifts.notifyDataSetChanged();
mAdapterMergedGifts
.
updateData
(
mData
);
}
}
private
void
mergeDatasets
(
ArrayList
<
LoyaltyGiftsForYouPackage
>
seasonalList
,
ArrayList
<
LoyaltyContextualOfferModel
>
ccmsList
,
ArrayList
<
Campaign
>
campaignList
)
{
private
void
mergeDatasets
()
{
mData
.
clear
();
if
(
seasonalList
!=
null
&&
s
easonalList
.
size
()
>
0
)
{
Log
.
v
(
"SEASONAL"
,
String
.
valueOf
(
s
easonalList
.
size
()));
for
(
LoyaltyGiftsForYouPackage
seasonal
:
s
easonalList
)
{
if
(
mSeasonalList
!=
null
&&
mS
easonalList
.
size
()
>
0
)
{
Log
.
v
(
"SEASONAL"
,
String
.
valueOf
(
mS
easonalList
.
size
()));
for
(
LoyaltyGiftsForYouPackage
seasonal
:
mS
easonalList
)
{
MergedGifts
data
=
new
MergedGifts
();
data
.
setCampaign
(
null
);
data
.
setSeasonalList
(
seasonal
);
...
...
@@ -542,9 +386,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
}
}
if
(
ccmsList
!=
null
&&
ccms
List
.
size
()
>
0
)
{
Log
.
v
(
"CCMS"
,
String
.
valueOf
(
ccms
List
.
size
()));
for
(
LoyaltyContextualOfferModel
ccmsItem
:
ccms
List
)
{
if
(
mContextualList
!=
null
&&
mContextual
List
.
size
()
>
0
)
{
Log
.
v
(
"CCMS"
,
String
.
valueOf
(
mContextual
List
.
size
()));
for
(
LoyaltyContextualOfferModel
ccmsItem
:
mContextual
List
)
{
MergedGifts
data
=
new
MergedGifts
();
data
.
setCampaign
(
null
);
data
.
setSeasonalList
(
null
);
...
...
@@ -554,16 +398,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
}
}
if
(
campaignList
!=
null
&&
campaignList
.
size
()
>
0
)
{
final
ArrayList
<
Campaign
>
customs3
=
new
ArrayList
<
Campaign
>();
for
(
Campaign
campaignItem
:
campaignList
)
{
if
(!
customs3
.
contains
(
campaignItem
))
{
customs3
.
add
(
campaignItem
);
}
}
Log
.
v
(
"GIFTS_FOR_YOU"
,
String
.
valueOf
(
campaignList
.
size
()));
for
(
Campaign
campaign
:
customs3
)
{
if
(
mValuesList
!=
null
&&
mValuesList
.
size
()
>
0
)
{
Log
.
v
(
"GIFTS_FOR_YOU"
,
String
.
valueOf
(
mValuesList
.
size
()));
for
(
Campaign
campaign
:
mValuesList
)
{
MergedGifts
data
=
new
MergedGifts
();
data
.
setCampaign
(
campaign
);
data
.
setSeasonalList
(
null
);
...
...
@@ -579,6 +416,22 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
}
private
void
filterItems
()
{
if
(
WarplyManagerHelper
.
getSeasonalList
()
!=
null
&&
WarplyManagerHelper
.
getSeasonalList
().
size
()
>
0
)
{
mHashSetSeasonalList
.
clear
();
mHashSetSeasonalList
.
addAll
(
WarplyManagerHelper
.
getSeasonalList
());
mSeasonalList
.
clear
();
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
);
}
}
mValuesList
.
clear
();
ArrayList
<
Campaign
>
gfyList
=
new
ArrayList
<>();
if
(
WarplyManagerHelper
.
getCampaignListAll
()
!=
null
&&
WarplyManagerHelper
.
getCampaignListAll
().
size
()
>
0
)
{
...
...
@@ -623,15 +476,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
WarpUtils
.
log
(
"GFY_FILTER_LIST_COUNT: "
+
String
.
valueOf
(
gfyList
.
size
()));
WarpUtils
.
log
(
"GFY_FILTER_LIST_JSON: "
+
String
.
valueOf
(
gfyList
.
toString
()));
mValuesList
.
addAll
(
gfyList
);
final
ArrayList
<
Campaign
>
customs
=
new
ArrayList
<
Campaign
>();
for
(
Campaign
campaignItem
:
mValuesList
)
{
if
(!
customs
.
contains
(
campaignItem
))
{
customs
.
add
(
campaignItem
);
}
}
mValuesList
.
clear
();
mValuesList
.
addAll
(
customs
);
mValuesList
.
addAll
(
gfyList
);
WarpUtils
.
log
(
"GFY_VAR_LIST_COUNT: "
+
String
.
valueOf
(
mValuesList
.
size
()));
WarpUtils
.
log
(
"GFY_VAR_LIST_JSON: "
+
String
.
valueOf
(
mValuesList
.
toString
()));
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MoreForYouActivity.java
View file @
46c74ba
...
...
@@ -6,7 +6,6 @@ import android.content.Intent;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
...
...
@@ -41,7 +40,6 @@ import ly.warp.sdk.utils.WarplyManagerHelper;
import
ly.warp.sdk.utils.managers.WarplyAnalyticsManager
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
import
ly.warp.sdk.views.adapters.MergedMoreAdapter
;
import
ly.warp.sdk.views.adapters.MoreCampaignAdapter
;
import
ly.warp.sdk.views.adapters.MoreContextualAdapter
;
...
...
@@ -59,8 +57,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
private
ImageView
mIvBack
,
mIvPopupClose
;
private
RecyclerView
mRecyclerMore
;
private
TextView
mTvTitle
;
private
MoreCampaignAdapter
mAdapterMore
;
private
MergedMoreAdapter
mAdapterMergedMore
;
private
LinearLayout
mLlMorePopup
;
private
ArrayList
<
Campaign
>
mValuesList
=
new
ArrayList
<>();
private
ArrayList
<
LoyaltyContextualOfferModel
>
mContextualList
=
new
ArrayList
<>();
...
...
@@ -86,7 +82,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
private
MoreContextualAdapter
mAdapterContextual
;
private
int
mTimer
=
0
;
private
Handler
mSecondsHandler
;
/**
* New Implementation
*/
...
...
@@ -247,8 +242,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mResearchItems
.
setNestedScrollingEnabled
(
false
);
mResearchItems
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterResearch
=
new
MoreCampaignAdapter
(
this
,
mUniqueSectionList
.
get
(
firstKey
));
// mResearchItems.setItemAnimator(null);
// mAdapterResearch.setHasStableIds(true);
mResearchItems
.
setAdapter
(
mAdapterResearch
);
mAdapterResearch
.
getPositionClicks
()
.
doOnNext
(
this
::
handleMoreItemClick
)
...
...
@@ -269,8 +262,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mExclusiveItems
.
setNestedScrollingEnabled
(
false
);
mExclusiveItems
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterExclusive
=
new
MoreCampaignAdapter
(
this
,
mUniqueSectionList
.
get
(
secondKey
));
// mExclusiveItems.setItemAnimator(null);
// mAdapterExclusive.setHasStableIds(true);
mExclusiveItems
.
setAdapter
(
mAdapterExclusive
);
mAdapterExclusive
.
getPositionClicks
()
.
doOnNext
(
this
::
handleMoreItemClick
)
...
...
@@ -291,8 +282,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mContestItems
.
setNestedScrollingEnabled
(
false
);
mContestItems
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterContest
=
new
MoreCampaignAdapter
(
this
,
mUniqueSectionList
.
get
(
thirdKey
));
// mContestItems.setItemAnimator(null);
// mAdapterContest.setHasStableIds(true);
mContestItems
.
setAdapter
(
mAdapterContest
);
mAdapterContest
.
getPositionClicks
()
.
doOnNext
(
this
::
handleMoreItemClick
)
...
...
@@ -311,8 +300,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mContextualItems
.
setNestedScrollingEnabled
(
false
);
mContextualItems
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterContextual
=
new
MoreContextualAdapter
(
this
,
mContextualList
);
// mContextualItems.setItemAnimator(null);
// mAdapterContextual.setHasStableIds(true);
mContextualItems
.
setAdapter
(
mAdapterContextual
);
mAdapterContextual
.
getPositionClicks
()
.
doOnNext
(
this
::
handleMoreContextualItemClick
)
...
...
@@ -424,8 +411,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
}
private
void
handleMoreItemClick
(
Campaign
moreItem
)
{
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
LoyaltySDKFirebaseEventModel
()));
try
{
JSONObject
extraFields
=
WarpJSONParser
.
getJSONFromString
(
moreItem
.
getExtraFields
());
if
(
extraFields
!=
null
)
{
...
...
@@ -483,31 +468,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
startActivity
(
intent
);
}
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
);
}
}
}
/**
* New Implementation
*/
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
View file @
46c74ba
...
...
@@ -89,7 +89,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
mSensorManager
=
(
SensorManager
)
getSystemService
(
Context
.
SENSOR_SERVICE
);
mSensor
=
mSensorManager
.
getDefaultSensor
(
Sensor
.
TYPE_ACCELEROMETER
);
// registerStepSensor();
// Warply.getInitializer(this
).init();
Warply
.
getInitializer
(
getApplicationContext
()
).
init
();
WarplyManager
.
getPacingDetails
(
new
PacingDetailsRequest
(),
mPacingCallback
);
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
46c74ba
...
...
@@ -992,8 +992,8 @@ public class WarplyManagerHelper {
});
}
public
static
void
setTrackersEnabled
(
boolean
isEnabled
)
{
WarpUtils
.
setTrackersEnabled
(
Warply
.
getWarplyContext
()
,
isEnabled
);
public
static
void
setTrackersEnabled
(
Context
context
,
boolean
isEnabled
)
{
WarpUtils
.
setTrackersEnabled
(
context
,
isEnabled
);
// JSONObject obj = new JSONObject();
// try {
...
...
@@ -1137,9 +1137,13 @@ public class WarplyManagerHelper {
public
static
void
setCampaignList
(
ArrayList
<
Campaign
>
campaignList
)
{
// mCampaignList.clear();
// mCampaignList.addAll(campaignList);
Set
<
Campaign
>
set
=
new
LinkedHashSet
<>(
campaignList
);
// Set<Campaign> set = new LinkedHashSet<>(campaignList);
// mCampaignListAll.clear();
// mCampaignListAll.addAll(set);
mCampaignListAll
.
clear
();
mCampaignListAll
.
addAll
(
set
)
;
mCampaignListAll
=
campaignList
;
mCampaignList
.
clear
();
for
(
Campaign
camp
:
campaignList
)
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
46c74ba
...
...
@@ -29,16 +29,11 @@ import android.app.ActivityManager;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.util.Log
;
import
androidx.appcompat.app.AlertDialog
;
import
androidx.work.OneTimeWorkRequest
;
import
androidx.work.WorkManager
;
import
org.greenrobot.eventbus.EventBus
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
...
...
@@ -46,12 +41,10 @@ import java.text.ParseException;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.LinkedHashSet
;
import
java.util.Set
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.db.WarplyDBHelper
;
import
ly.warp.sdk.io.callbacks.AddressHook
;
...
...
@@ -73,7 +66,6 @@ import ly.warp.sdk.io.callbacks.TagsHook;
import
ly.warp.sdk.io.callbacks.TransactionsHook
;
import
ly.warp.sdk.io.models.AddressList
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.io.models.Card
;
import
ly.warp.sdk.io.models.CardList
;
import
ly.warp.sdk.io.models.Consumer
;
...
...
@@ -82,11 +74,8 @@ 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.CouponsetsList
;
import
ly.warp.sdk.io.models.LoyaltyContextualOfferModel
;
import
ly.warp.sdk.io.models.MerchantCategoriesList
;
import
ly.warp.sdk.io.models.MerchantList
;
import
ly.warp.sdk.io.models.NewCampaign
;
import
ly.warp.sdk.io.models.NewCampaignList
;
import
ly.warp.sdk.io.models.PacingDetails
;
import
ly.warp.sdk.io.models.PointsList
;
import
ly.warp.sdk.io.models.ProductList
;
...
...
@@ -154,8 +143,6 @@ import ly.warp.sdk.utils.constants.WarpConstants;
*/
public
class
WarplyManager
{
private
static
ArrayList
<
Campaign
>
mNewCampaignList
=
new
ArrayList
<
Campaign
>();
public
static
void
getProducts
(
WarplyProductsRequest
request
,
final
CallbackReceiver
<
ProductList
>
receiver
)
{
// String productCategory = "";
// int resStringId = getWarplyContext().getResources().getIdentifier("products_category", "string", getWarplyContext().getPackageName());
...
...
@@ -1392,45 +1379,20 @@ public class WarplyManager {
Warply
.
postReceiveMicroappData
(
WarpConstants
.
MICROAPP_NEW_CAMPAIGNS
,
false
,
"campaigns"
,
request
.
toJson
(),
new
NewCampaignsHook
(
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
// receiver.onSuccess(result);
mNewCampaignList
.
clear
();
mNewCampaignList
.
addAll
(
result
);
getCampaignsPersonalized
(
request
,
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
resultPersonalized
)
{
receiver
.
onSuccess
(
resultPersonalized
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
receiver
.
onFailure
(
errorCode
);
}
});
}
@Override
public
void
onFailure
(
int
errorCode
)
{
receiver
.
onFailure
(
errorCode
);
}
},
request
.
getSignature
()));
}
public
static
void
getCampaignsPersonalized
(
WarplyGetCampaignsRequest
request
,
final
CallbackReceiver
<
ArrayList
<
Campaign
>>
receiver
)
{
WarpUtils
.
log
(
"************* WARPLY Get Campaigns Request ********************"
);
WarpUtils
.
log
(
"[WARP Trace] WARPLY Get Campaigns Request is active"
);
WarpUtils
.
log
(
"**************************************************"
);
Warply
.
postReceiveMicroappData
(
WarpConstants
.
MICROAPP_NEW_CAMPAIGNS
,
true
,
"campaignsPersonalized"
,
request
.
toJson
(),
new
NewCampaignsHook
(
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
mNewCampaignList
.
addAll
(
result
);
Collections
.
sort
(
mNewCampaignList
,
(
obj1
,
obj2
)
->
Integer
.
compare
(
obj1
.
getSorting
(),
obj2
.
getSorting
()));
ArrayList
<
Campaign
>
newCampaignList
=
new
ArrayList
<
Campaign
>();
newCampaignList
.
clear
();
newCampaignList
.
addAll
(
result
);
newCampaignList
.
addAll
(
resultPersonalized
);
Collections
.
sort
(
newCampaignList
,
(
obj1
,
obj2
)
->
Integer
.
compare
(
obj1
.
getSorting
(),
obj2
.
getSorting
()));
WarplyManagerHelper
.
setCampaignList
(
newCampaignList
);
ArrayList
<
Campaign
>
campaignLoyaltyList
=
new
ArrayList
<>();
campaignLoyaltyList
.
clear
();
ArrayList
<
Campaign
>
campaignCarouselList
=
new
ArrayList
<>();
campaignCarouselList
.
clear
();
for
(
Campaign
camp
:
mN
ewCampaignList
)
{
for
(
Campaign
camp
:
n
ewCampaignList
)
{
JSONObject
campMetadata
=
WarpJSONParser
.
getJSONFromString
(
camp
.
getExtraFields
());
if
(
campMetadata
!=
null
)
{
if
(
campMetadata
.
has
(
"carousel"
))
{
...
...
@@ -1491,10 +1453,9 @@ public class WarplyManager {
}
}
}
WarplyManagerHelper
.
setCampaignList
(
mNewCampaignList
);
WarplyManagerHelper
.
setCarouselList
(
campaignCarouselList
);
// ArrayList<LoyaltyContextualOfferModel> list = new ArrayList<>();
// ArrayList<LoyaltyContextualOfferModel> list = new ArrayList<>();
// JSONArray jArray = null;
// try {
// jArray = new JSONArray("[\n" +
...
...
@@ -2048,7 +2009,33 @@ public class WarplyManager {
Set
<
Campaign
>
set
=
new
LinkedHashSet
<>(
campaignLoyaltyList
);
campaignLoyaltyList
.
clear
();
campaignLoyaltyList
.
addAll
(
set
);
receiver
.
onSuccess
(
campaignLoyaltyList
);
//result
receiver
.
onSuccess
(
campaignLoyaltyList
);
//resultPersonalized
}
@Override
public
void
onFailure
(
int
errorCode
)
{
receiver
.
onFailure
(
errorCode
);
}
});
}
@Override
public
void
onFailure
(
int
errorCode
)
{
receiver
.
onFailure
(
errorCode
);
}
},
request
.
getSignature
()));
}
public
static
void
getCampaignsPersonalized
(
WarplyGetCampaignsRequest
request
,
final
CallbackReceiver
<
ArrayList
<
Campaign
>>
receiver
)
{
WarpUtils
.
log
(
"************* WARPLY Get Campaigns Request ********************"
);
WarpUtils
.
log
(
"[WARP Trace] WARPLY Get Campaigns Request is active"
);
WarpUtils
.
log
(
"**************************************************"
);
Warply
.
postReceiveMicroappData
(
WarpConstants
.
MICROAPP_NEW_CAMPAIGNS
,
true
,
"campaignsPersonalized"
,
request
.
toJson
(),
new
NewCampaignsHook
(
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
receiver
.
onSuccess
(
result
);
}
@Override
...
...
Please
register
or
login
to post a comment