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-03-22 15:28:26 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8f7ba10732df901c2d00a57371f1b1784ae48225
8f7ba107
1 parent
69651087
minor changes
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
95 additions
and
4 deletions
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Campaign.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/NewCampaign.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
warply_android_sdk/build.gradle
View file @
8f7ba10
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.5.4r1
4
'
PUBLISH_VERSION
=
'4.5.5.4r1
5
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
View file @
8f7ba10
...
...
@@ -2,6 +2,7 @@ package ly.warp.sdk.activities;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.text.method.LinkMovementMethod
;
...
...
@@ -274,9 +275,11 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
if
(
success
)
{
// setResult(RESULT_OK, new Intent());
onBackPressed
();
OpenMyRewardsEventModel
openMyRewards
=
new
OpenMyRewardsEventModel
();
openMyRewards
.
setOpen
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
openMyRewards
));
// OpenMyRewardsEventModel openMyRewards = new OpenMyRewardsEventModel();
// openMyRewards.setOpen(true);
// EventBus.getDefault().post(new WarplyEventBusManager(openMyRewards));
Intent
intent
=
new
Intent
(
CouponsetInfoActivity
.
this
,
ActiveCouponsActivity
.
class
);
startActivity
(
intent
);
}
})
.
setNegativeButton
(
R
.
string
.
cos_dlg_negative_button5
,
(
dialogNegative
,
whichNegative
)
->
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Campaign.java
View file @
8f7ba10
...
...
@@ -108,6 +108,7 @@ public class Campaign implements Parcelable, Serializable {
private
String
categoryId
;
private
Integer
couponAvailability
;
private
String
endDate
,
startDate
;
private
boolean
showExpiration
;
/**
* Basic constructor used to create an object from a String, representing a
...
...
@@ -151,6 +152,7 @@ public class Campaign implements Parcelable, Serializable {
this
.
categoryId
=
""
;
this
.
endDate
=
""
;
this
.
startDate
=
""
;
this
.
showExpiration
=
false
;
}
/**
...
...
@@ -678,6 +680,14 @@ public class Campaign implements Parcelable, Serializable {
this
.
startDate
=
startDate
;
}
public
boolean
isShowExpiration
()
{
return
showExpiration
;
}
public
void
setShowExpiration
(
boolean
showExpiration
)
{
this
.
showExpiration
=
showExpiration
;
}
@Override
public
int
describeContents
()
{
return
0
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/NewCampaign.java
View file @
8f7ba10
...
...
@@ -93,6 +93,7 @@ public class NewCampaign implements Parcelable, Serializable {
private
boolean
isNew
=
false
;
private
String
bannerImage
=
""
;
private
String
bannerTitle
=
""
;
private
boolean
showExpiration
=
false
;
/**
* Basic constructor used to create an object from a String, representing a
...
...
@@ -139,6 +140,11 @@ public class NewCampaign implements Parcelable, Serializable {
if
(
this
.
extraFields
.
has
(
BANNER_TITLE
))
{
this
.
bannerTitle
=
this
.
extraFields
.
optString
(
BANNER_TITLE
);
}
if
(
this
.
extraFields
.
has
(
"show_expiration"
))
{
this
.
showExpiration
=
this
.
extraFields
.
optBoolean
(
"show_expiration"
);
}
else
{
this
.
showExpiration
=
false
;
}
}
}
...
...
@@ -378,6 +384,14 @@ public class NewCampaign implements Parcelable, Serializable {
return
bannerTitle
;
}
public
boolean
isShowExpiration
()
{
return
showExpiration
;
}
public
void
setShowExpiration
(
boolean
showExpiration
)
{
this
.
showExpiration
=
showExpiration
;
}
@Override
public
int
describeContents
()
{
return
0
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
8f7ba10
...
...
@@ -1768,6 +1768,7 @@ public class WarplyManager {
camp
.
setType
(
newCamp
.
getCampaignType
());
camp
.
setEndDate
(
newCamp
.
getEndDate
());
camp
.
setStartDate
(
newCamp
.
getStartDate
());
camp
.
setShowExpiration
(
newCamp
.
isShowExpiration
());
try
{
camp
.
setExtraFields
(
newCamp
.
getExtraFields
().
toString
());
if
(!
TextUtils
.
isEmpty
(
newCamp
.
getExtraFields
().
toString
()))
{
...
...
@@ -1786,11 +1787,13 @@ public class WarplyManager {
}
else
{
camp
.
setBannerImage
(
""
);
camp
.
setBannerTitle
(
""
);
camp
.
setCategoryId
(
""
);
}
}
catch
(
NullPointerException
e
)
{
camp
.
setExtraFields
(
""
);
camp
.
setBannerImage
(
""
);
camp
.
setBannerTitle
(
""
);
camp
.
setCategoryId
(
""
);
e
.
printStackTrace
();
}
...
...
@@ -1912,6 +1915,7 @@ public class WarplyManager {
camp
.
setType
(
newCamp
.
getCampaignType
());
camp
.
setEndDate
(
newCamp
.
getEndDate
());
camp
.
setStartDate
(
newCamp
.
getStartDate
());
camp
.
setShowExpiration
(
newCamp
.
isShowExpiration
());
try
{
camp
.
setExtraFields
(
newCamp
.
getExtraFields
().
toString
());
if
(!
TextUtils
.
isEmpty
(
newCamp
.
getExtraFields
().
toString
()))
{
...
...
@@ -1930,11 +1934,13 @@ public class WarplyManager {
}
else
{
camp
.
setBannerImage
(
""
);
camp
.
setBannerTitle
(
""
);
camp
.
setCategoryId
(
""
);
}
}
catch
(
NullPointerException
e
)
{
camp
.
setExtraFields
(
""
);
camp
.
setBannerImage
(
""
);
camp
.
setBannerTitle
(
""
);
camp
.
setCategoryId
(
""
);
e
.
printStackTrace
();
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
8f7ba10
...
...
@@ -41,6 +41,7 @@ import android.location.LocationManager;
import
android.net.Uri
;
import
android.net.http.SslError
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.text.TextUtils
;
import
android.util.AttributeSet
;
import
android.webkit.GeolocationPermissions.Callback
;
...
...
@@ -58,6 +59,8 @@ import androidx.core.content.ContextCompat;
import
androidx.lifecycle.DefaultLifecycleObserver
;
import
androidx.lifecycle.LifecycleOwner
;
import
androidx.lifecycle.ProcessLifecycleOwner
;
import
androidx.work.OneTimeWorkRequest
;
import
androidx.work.WorkManager
;
import
com.google.android.gms.common.api.GoogleApiClient
;
import
com.google.android.gms.common.api.PendingResult
;
...
...
@@ -77,15 +80,21 @@ import org.json.JSONObject;
import
java.io.UnsupportedEncodingException
;
import
java.net.URISyntaxException
;
import
java.net.URLDecoder
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.activities.ActiveCouponsActivity
;
import
ly.warp.sdk.activities.CouponsetInfoActivity
;
import
ly.warp.sdk.activities.WarpViewActivity
;
import
ly.warp.sdk.db.WarplyDBHelper
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CouponEventModel
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel
;
import
ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel
;
import
ly.warp.sdk.io.models.OpenMyRewardsEventModel
;
...
...
@@ -93,9 +102,11 @@ import ly.warp.sdk.io.models.QuestionnaireEventModel;
import
ly.warp.sdk.io.models.RefreshUnifiedCouponsEventModel
;
import
ly.warp.sdk.io.models.RefreshVouchersEventModel
;
import
ly.warp.sdk.io.models.WarplyCCMSEnabledModel
;
import
ly.warp.sdk.io.models.WarplyCouponsChangedEventModel
;
import
ly.warp.sdk.io.models.WarplyPacingCardEventModel
;
import
ly.warp.sdk.io.models.WarplyPacingEventModel
;
import
ly.warp.sdk.io.models.WarplyUnifiedActivatedEventModel
;
import
ly.warp.sdk.services.EventCampaignService
;
import
ly.warp.sdk.services.WarplyHealthService
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
...
...
@@ -104,6 +115,7 @@ import ly.warp.sdk.utils.WarplyUrlHandler;
import
ly.warp.sdk.utils.constants.WarpConstants
;
import
ly.warp.sdk.utils.managers.WarplyAnalyticsManager
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
public
class
WarpView
extends
WebView
implements
DefaultLifecycleObserver
{
...
...
@@ -503,6 +515,23 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
RefreshVouchersEventModel
vouchersRefreshed
=
new
RefreshVouchersEventModel
();
vouchersRefreshed
.
setRefreshed
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
vouchersRefreshed
));
}
else
if
(
parts
[
1
].
equals
(
"activeCoupons"
))
{
new
Thread
(()
->
{
if
(!
Thread
.
currentThread
().
isInterrupted
())
{
WarplyManager
.
getUserCouponsWithCouponsets
(
mUserCouponsReceiver
);
WarplyManager
.
getCampaigns
(
mCampaignsCallback
);
}
}).
start
();
Handler
handlerIntent
=
new
Handler
();
Runnable
runnableIntent
=
new
Runnable
()
{
@Override
public
void
run
()
{
Intent
intent
=
new
Intent
((
WarpActivity
!=
null
&&
!
WarpActivity
.
isFinishing
())
?
WarpActivity
:
getContext
(),
ActiveCouponsActivity
.
class
);
getContext
().
startActivity
(
intent
);
}
};
handlerIntent
.
postDelayed
(
runnableIntent
,
1500
);
}
else
if
(
parts
[
1
].
equals
(
"ccmsRetrieved"
))
{
WarplyCCMSEnabledModel
ccmsEnabled
=
new
WarplyCCMSEnabledModel
();
ccmsEnabled
.
setActivated
(
true
);
...
...
@@ -869,4 +898,33 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
return
false
;
}
}
private
final
CallbackReceiver
<
CouponList
>
mUserCouponsReceiver
=
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
// Thread.currentThread().interrupt();
WarplyCouponsChangedEventModel
couponsChanged
=
new
WarplyCouponsChangedEventModel
();
couponsChanged
.
setChanged
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
couponsChanged
));
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
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
((
WarpActivity
!=
null
&&
!
WarpActivity
.
isFinishing
())
?
WarpActivity
:
getContext
()).
enqueue
(
mywork
);
// Thread.currentThread().interrupt();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment