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
2023-04-28 18:35:33 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c9f2b5a484ac302ba90cc0186b959e91d20939c6
c9f2b5a4
1 parent
17d4ae6b
possible fix in campaigns
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/io/callbacks/NewCampaignsHook.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Campaign.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/callbacks/NewCampaignsHook.java
View file @
c9f2b5a
...
...
@@ -25,6 +25,8 @@
package
ly
.
warp
.
sdk
.
io
.
callbacks
;
import
android.text.TextUtils
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
...
...
@@ -33,6 +35,7 @@ import ly.warp.sdk.io.models.Campaign;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.io.models.NewCampaign
;
import
ly.warp.sdk.io.models.NewCampaignList
;
import
ly.warp.sdk.utils.WarpJSONParser
;
/**
* Created by Panagiotis Triantafyllou on 12-May-22.
...
...
@@ -67,12 +70,26 @@ public class NewCampaignsHook implements CallbackReceiver<JSONObject> {
camp
.
setSorting
(
newCamp
.
getSorting
());
camp
.
setNew
(
newCamp
.
getIsNew
());
camp
.
setType
(
newCamp
.
getCampaignType
());
camp
.
setBannerImage
(
newCamp
.
getBannerImage
());
camp
.
setBannerTitle
(
newCamp
.
getBannerTitle
());
try
{
camp
.
setExtraFields
(
newCamp
.
getExtraFields
().
toString
());
if
(!
TextUtils
.
isEmpty
(
newCamp
.
getExtraFields
().
toString
()))
{
JSONObject
extraFieldsResp
=
WarpJSONParser
.
getJSONFromString
(
newCamp
.
getExtraFields
().
toString
());
if
(
extraFieldsResp
!=
null
)
{
if
(
extraFieldsResp
.
has
(
"Banner_title"
))
{
camp
.
setBannerTitle
(
extraFieldsResp
.
optString
(
"Banner_title"
,
""
));
}
if
(
extraFieldsResp
.
has
(
"Banner_img"
))
{
camp
.
setBannerImage
(
extraFieldsResp
.
optString
(
"Banner_img"
,
""
));
}
}
}
else
{
camp
.
setBannerImage
(
""
);
camp
.
setBannerTitle
(
""
);
}
}
catch
(
NullPointerException
e
)
{
camp
.
setExtraFields
(
""
);
camp
.
setBannerImage
(
""
);
camp
.
setBannerTitle
(
""
);
e
.
printStackTrace
();
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Campaign.java
View file @
c9f2b5a
...
...
@@ -27,6 +27,7 @@ package ly.warp.sdk.io.models;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
android.text.TextUtils
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
...
...
@@ -36,6 +37,7 @@ import java.io.Serializable;
import
java.util.ArrayList
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.utils.WarpJSONParser
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
...
...
@@ -170,6 +172,20 @@ public class Campaign implements Parcelable, Serializable {
this
.
isNew
=
json
.
optBoolean
(
IS_NEW
);
this
.
sorting
=
json
.
optInt
(
SORTING
);
this
.
extraFields
=
json
.
optString
(
EXTRA_FIELDS
);
if
(!
TextUtils
.
isEmpty
(
this
.
extraFields
))
{
JSONObject
extraFieldsResp
=
WarpJSONParser
.
getJSONFromString
(
this
.
extraFields
);
if
(
extraFieldsResp
!=
null
)
{
if
(
extraFieldsResp
.
has
(
"Banner_title"
))
{
this
.
bannerTitle
=
extraFieldsResp
.
optString
(
BANNER_TITLE
,
""
);
}
if
(
extraFieldsResp
.
has
(
"Banner_img"
))
{
this
.
bannerImage
=
extraFieldsResp
.
optString
(
BANNER_IMAGE
,
""
);
}
}
}
else
{
this
.
bannerImage
=
""
;
this
.
bannerTitle
=
""
;
}
this
.
type
=
json
.
optString
(
TYPE
);
this
.
expired
=
json
.
optBoolean
(
EXPIRED
);
this
.
show
=
json
.
optBoolean
(
SHOW
);
...
...
Please
register
or
login
to post a comment