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-05-27 15:49:59 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4f70843d70831d63bfd1d3451f1226ec50e69b82
4f70843d
1 parent
1b732ef8
new model, new event bus, new version
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
4 deletions
warply_android_sdk/build.gradle
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/LoyaltyGiftsForYouOfferClickEvent.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyEventBusManager.java
warply_android_sdk/build.gradle
View file @
4f70843
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta
8
'
PUBLISH_VERSION
=
'4.5.4-cosbeta
9
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
View file @
4f70843
...
...
@@ -8,10 +8,10 @@ import android.widget.ImageView;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
org.greenrobot.eventbus.EventBus
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
...
...
@@ -24,12 +24,14 @@ 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.CouponsetsList
;
import
ly.warp.sdk.io.models.LoyaltyContextualOfferModel
;
import
ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent
;
import
ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel
;
import
ly.warp.sdk.io.models.MergedGifts
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.
views.adapters.CouponsetsAdapt
er
;
import
ly.warp.sdk.
utils.managers.WarplyEventBusManag
er
;
import
ly.warp.sdk.views.adapters.MergedGiftsAdapter
;
import
ly.warp.sdk.views.adapters.ProfileCampaignAdapter
;
public
class
GiftsForYouActivity
extends
Activity
implements
View
.
OnClickListener
{
...
...
@@ -178,8 +180,12 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
mAdapterMergedGifts
.
getPositionClicks
()
.
doOnNext
(
dataItem
->
{
if
(
dataItem
.
getDataType
()
==
1
)
{
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
().
postWarplyEventBus
(
"gifts"
,
new
LoyaltyGiftsForYouOfferClickEvent
()));
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())));
}
else
if
(
dataItem
.
getDataType
()
==
2
)
{
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
().
postWarplyEventBus
(
"ccms"
,
new
LoyaltyContextualOfferModel
()));
Intent
intent
=
new
Intent
(
GiftsForYouActivity
.
this
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
dataItem
.
getCouponset
());
startActivity
(
intent
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MoreForYouActivity.java
View file @
4f70843
...
...
@@ -10,9 +10,13 @@ import android.widget.TextView;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
org.greenrobot.eventbus.EventBus
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel
;
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.ProfileCampaignAdapter
;
...
...
@@ -86,6 +90,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mRecyclerMore
.
setAdapter
(
mAdapterMore
);
mAdapterMore
.
getPositionClicks
()
.
doOnNext
(
gift
->
{
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
().
postWarplyEventBus
(
"firebase"
,
new
LoyaltySDKFirebaseEventModel
()));
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
gift
)));
})
.
doOnError
(
error
->
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/LoyaltyGiftsForYouOfferClickEvent.java
0 → 100644
View file @
4f70843
/*
* 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
;
import
java.util.HashMap
;
/**
* Created by Panagiotis Triantafyllou on 27-May-22.
*/
public
class
LoyaltyGiftsForYouOfferClickEvent
{
private
String
title
;
private
String
imageUrl
;
private
String
loyaltyPackageId
;
public
LoyaltyGiftsForYouOfferClickEvent
()
{
this
.
title
=
""
;
this
.
imageUrl
=
""
;
this
.
loyaltyPackageId
=
""
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getImageUrl
()
{
return
imageUrl
;
}
public
void
setImageUrl
(
String
imageUrl
)
{
this
.
imageUrl
=
imageUrl
;
}
public
String
getLoyaltyPackageId
()
{
return
loyaltyPackageId
;
}
public
void
setLoyaltyPackageId
(
String
loyaltyPackageId
)
{
this
.
loyaltyPackageId
=
loyaltyPackageId
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyEventBusManager.java
View file @
4f70843
package
ly
.
warp
.
sdk
.
utils
.
managers
;
import
java.util.HashMap
;
import
ly.warp.sdk.io.models.LoyaltyContextualOfferModel
;
import
ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent
;
import
ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel
;
import
ly.warp.sdk.io.request.WarplyEditAddressRequest
;
/**
* Created by Panagiotis Triantafyllou on 26/Απρ/2022.
...
...
@@ -10,6 +14,11 @@ public class WarplyEventBusManager {
private
String
eventName
;
private
LoyaltySDKFirebaseEventModel
fireEvent
;
private
LoyaltyContextualOfferModel
ccms
;
protected
HashMap
<
String
,
Object
>
mWarplyEventBusManager
=
new
HashMap
();
public
WarplyEventBusManager
()
{
}
public
WarplyEventBusManager
(
String
eventName
)
{
this
.
eventName
=
eventName
;
...
...
@@ -22,4 +31,26 @@ public class WarplyEventBusManager {
public
WarplyEventBusManager
(
LoyaltyContextualOfferModel
ccms
)
{
this
.
ccms
=
ccms
;
}
public
WarplyEventBusManager
postWarplyEventBus
(
String
eventName
,
LoyaltySDKFirebaseEventModel
fireEvent
)
{
mWarplyEventBusManager
.
clear
();
mWarplyEventBusManager
.
put
(
eventName
,
fireEvent
);
return
this
;
}
public
WarplyEventBusManager
postWarplyEventBus
(
String
eventName
,
LoyaltyContextualOfferModel
ccms
)
{
mWarplyEventBusManager
.
clear
();
mWarplyEventBusManager
.
put
(
eventName
,
ccms
);
return
this
;
}
public
WarplyEventBusManager
postWarplyEventBus
(
String
eventName
,
LoyaltyGiftsForYouOfferClickEvent
gifts
)
{
mWarplyEventBusManager
.
clear
();
mWarplyEventBusManager
.
put
(
eventName
,
gifts
);
return
this
;
}
public
HashMap
<
String
,
Object
>
subscribeWarplyEventBus
()
{
return
mWarplyEventBusManager
;
}
}
...
...
Please
register
or
login
to post a comment