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
2024-10-24 13:56:01 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3aa057bac4beda6185fc200d0d116b0a3543b3bb
3aa057ba
1 parent
1a6a25aa
optimizations part2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
56 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ContextualActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.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/activities/ContextualActivity.java
View file @
3aa057b
...
...
@@ -37,6 +37,7 @@ import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
import
ly.warp.sdk.io.request.CosmoteSubmitOrderRequest
;
import
ly.warp.sdk.services.EventCampaignService
;
import
ly.warp.sdk.utils.WarpUtils
;
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
;
...
...
@@ -62,7 +63,9 @@ public class ContextualActivity extends Activity implements View.OnClickListener
private
Consumer
mConsumer
;
private
boolean
mIsTermsPressed
=
false
;
private
String
mSender
=
""
;
private
AlertDialog
mAlertDialogAskActivate
,
mAlertDialogErrorActivating
,
mAlertDialogSuccessActivating
;
private
AlertDialog
mAlertDialogAskActivate
,
mAlertDialogErrorActivating
,
mAlertDialogSuccessActivating
;
private
Campaign
mLoyalty
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -75,6 +78,15 @@ public class ContextualActivity extends Activity implements View.OnClickListener
mCCMS
=
(
LoyaltyContextualOfferModel
)
getIntent
().
getSerializableExtra
(
"ccms"
);
/* New Addition start */
for
(
Campaign
cmp
:
WarplyManagerHelper
.
getCampaignListAll
())
{
if
(
cmp
.
getSessionUUID
().
equals
(
mCCMS
.
getLoyaltyCampaignId
()))
{
mLoyalty
=
cmp
;
break
;
}
}
/* New Addition end */
mIvBack
=
findViewById
(
R
.
id
.
iv_contextual_back
);
mTvCampaignTitle
=
findViewById
(
R
.
id
.
textView13
);
mIvCampaignPhoto
=
findViewById
(
R
.
id
.
imageView6
);
...
...
@@ -317,22 +329,27 @@ public class ContextualActivity extends Activity implements View.OnClickListener
@Override
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
//
runOnUiThread(() -> {
runOnUiThread
(()
->
{
if
(
status
==
1
)
{
successActivatingDialog
();
/* New Addition start */
WarplyManager
.
getUserCouponsWithCouponsetsInternal
(
mUserCouponsReceiver
);
// WarplyManager.getCampaigns(mCampaignsCallback);
if
(
mLoyalty
!=
null
)
{
WarplyManagerHelper
.
removeCampaignItem
(
mLoyalty
);
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
(
ContextualActivity
.
this
).
enqueue
(
mywork
);
}
/* New Addition end */
WarplyManager
.
getCampaigns
(
mCampaignsCallback
);
}
else
errorActivatingDialog
();
//
});
});
}
@Override
public
void
onFailure
(
int
errorCode
)
{
//
runOnUiThread(() -> errorActivatingDialog());
errorActivatingDialog
();
runOnUiThread
(()
->
errorActivatingDialog
());
//
errorActivatingDialog();
}
};
...
...
@@ -350,16 +367,16 @@ public class ContextualActivity extends Activity implements View.OnClickListener
}
};
private
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
(
ContextualActivity
.
this
).
enqueue
(
mywork
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
}
};
//
private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
//
@Override
//
public void onSuccess(ArrayList<Campaign> result) {
//
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
//
WorkManager.getInstance(ContextualActivity.this).enqueue(mywork);
//
}
//
//
@Override
//
public void onFailure(int errorCode) {
//
//
}
//
};
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
View file @
3aa057b
...
...
@@ -264,14 +264,18 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
showDialog
(
true
,
1
);
/* New Addition start */
// WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
/* New Addition end */
// WarplyManager.getCampaigns(mCampaignsCallback);
WarplyManagerHelper
.
addCouponItem
(
mCoupon
);
WarplyManager
.
getCampaigns
(
mCampaignsCallback
);
WarplyManagerHelper
.
removeCampaignItem
(
mLoyalty
);
/* New Addition end */
/* New Addition start */
WarplyCouponsChangedEventModel
couponsChanged
=
new
WarplyCouponsChangedEventModel
();
couponsChanged
.
setChanged
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
couponsChanged
));
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
(
CouponsetInfoActivity
.
this
).
enqueue
(
mywork
);
/* New Addition end */
}
else
{
showDialog
(
false
,
status
);
...
...
@@ -405,17 +409,17 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
// }
// };
private
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
(
CouponsetInfoActivity
.
this
).
enqueue
(
mywork
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
}
};
//
private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
//
@Override
//
public void onSuccess(ArrayList<Campaign> result) {
//
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
//
WorkManager.getInstance(CouponsetInfoActivity.this).enqueue(mywork);
//
}
//
//
@Override
//
public void onFailure(int errorCode) {
//
//
}
//
};
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
3aa057b
...
...
@@ -1343,6 +1343,12 @@ public class WarplyManagerHelper {
return
mCampaignListAll
;
}
public
static
void
removeCampaignItem
(
Campaign
cmp
)
{
if
(
mCampaignListAll
!=
null
&&
!
mCampaignListAll
.
isEmpty
())
{
mCampaignListAll
.
remove
(
cmp
);
}
}
public
static
void
setCouponList
(
CouponList
couponList
)
{
LoyaltyBadgeModel
badge
=
new
LoyaltyBadgeModel
();
CouponList
cpnlist
=
new
CouponList
();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
3aa057b
...
...
@@ -5304,18 +5304,18 @@ public class WarplyManager {
dynatraceEvent
.
setEventName
(
"custom_success_read_campaign_loyalty"
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
dynatraceEvent
));
getCampaigns
(
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
(
Warply
.
getWarplyContext
()).
enqueue
(
mywork
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
}
});
//
getCampaigns(new CallbackReceiver<ArrayList<Campaign>>() {
//
@Override
//
public void onSuccess(ArrayList<Campaign> result) {
//
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
//
WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
//
}
//
//
@Override
//
public void onFailure(int errorCode) {
//
//
}
//
});
}
@Override
...
...
@@ -5325,18 +5325,18 @@ public class WarplyManager {
dynatraceEvent
.
setEventName
(
"custom_success_read_campaign_loyalty"
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
dynatraceEvent
));
getCampaigns
(
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
(
Warply
.
getWarplyContext
()).
enqueue
(
mywork
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
}
});
//
getCampaigns(new CallbackReceiver<ArrayList<Campaign>>() {
//
@Override
//
public void onSuccess(ArrayList<Campaign> result) {
//
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
//
WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
//
}
//
//
@Override
//
public void onFailure(int errorCode) {
//
//
}
//
});
}
}
},
null
);
...
...
Please
register
or
login
to post a comment