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-07-13 13:10:54 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
18021a1727f7ae3de5a6e24eeb58546791e0342f
18021a17
1 parent
a65646c5
fixes
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
122 additions
and
9 deletions
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
warply_android_sdk/build.gradle
warply_android_sdk/src/main/AndroidManifest.xml
warply_android_sdk/src/main/java/ly/warp/sdk/Warply.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/activities/WarpViewActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/LoyaltyFragment.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventService.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
18021a1
...
...
@@ -42,7 +42,7 @@ public class SplashActivity extends BaseActivity {
// );
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"601204932
2"
),
.
setGuid
(
"601204932
1"
),
//6012049321, 6012049322
mLoginReceiver
);
// WarplyManager.verifyTicket(new WarplyVerifyTicketRequest()
...
...
warply_android_sdk/build.gradle
View file @
18021a1
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta3
0
i'
PUBLISH_VERSION
=
'4.5.4-cosbeta3
1
i'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/AndroidManifest.xml
View file @
18021a1
...
...
@@ -137,6 +137,11 @@
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<service
android:name=
"ly.warp.sdk.services.EventService"
android:exported=
"false"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<service
android:name=
"ly.warp.sdk.services.WarplyBeaconsRangingService"
android:exported=
"false"
/>
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/Warply.java
View file @
18021a1
This diff is collapsed. Click to expand it.
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
View file @
18021a1
...
...
@@ -148,6 +148,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
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"
))
{
...
...
@@ -227,6 +228,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
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"
))
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MoreForYouActivity.java
View file @
18021a1
...
...
@@ -116,6 +116,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mRecyclerMore
.
setAdapter
(
mAdapterMore
);
mAdapterMore
.
getPositionClicks
()
.
doOnNext
(
gift
->
{
WarpUtils
.
log
(
"MFY_CLICK "
+
gift
.
toString
());
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
LoyaltySDKFirebaseEventModel
()));
try
{
...
...
@@ -124,6 +125,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
if
(
extraFields
.
has
(
"ccms_offer"
)
&&
extraFields
.
optString
(
"ccms_offer"
).
equals
(
"true"
))
{
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
gift
.
getSessionUUID
()))
{
WarpUtils
.
log
(
"CCMS_CLICK "
+
ccms
.
toString
());
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCcmsUrl
(
gift
,
ccms
)));
break
;
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/WarpViewActivity.java
View file @
18021a1
...
...
@@ -33,6 +33,8 @@ import android.content.Intent;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.text.TextUtils
;
import
android.view.KeyEvent
;
import
android.view.View
;
...
...
@@ -56,6 +58,9 @@ import java.util.concurrent.TimeUnit;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.request.WarplyUserCouponsRequest
;
import
ly.warp.sdk.services.PushEventsClickedWorkerService
;
import
ly.warp.sdk.utils.WarpJSONParser
;
import
ly.warp.sdk.utils.WarpUtils
;
...
...
@@ -63,6 +68,7 @@ import ly.warp.sdk.utils.WarplyPreferences;
import
ly.warp.sdk.utils.WarplyProperty
;
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.utils.managers.WarplySessionManager
;
import
ly.warp.sdk.views.WarpView
;
...
...
@@ -127,8 +133,9 @@ public class WarpViewActivity extends WarpBaseActivity {
setResult
(
RESULT_OK
,
new
Intent
());
finish
();
}
// if (event.getCoupon() != null)
// finish();
if
(
event
.
getCoupon
()
!=
null
)
{
WarplyManager
.
getUserCouponsWithCouponsets
(
new
WarplyUserCouponsRequest
(),
mUserCouponsReceiver
);
}
// if (event.getPacingCard() != null)
// finish();
// if (event.getPacingService() != null)
...
...
@@ -252,4 +259,16 @@ public class WarpViewActivity extends WarpBaseActivity {
public
static
Intent
createIntentFromURL
(
Context
context
,
String
url
)
{
return
new
Intent
(
context
,
WarpViewActivity
.
class
).
putExtra
(
"sessionUrl"
,
url
);
}
private
final
CallbackReceiver
<
CouponList
>
mUserCouponsReceiver
=
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
}
@Override
public
void
onFailure
(
int
errorCode
)
{
}
};
}
\ No newline at end of file
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/LoyaltyFragment.java
View file @
18021a1
...
...
@@ -103,7 +103,10 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mRecyclerGifts
.
setAdapter
(
mAdapterGifts
);
mAdapterGifts
.
getPositionClicks
()
.
doOnNext
(
gift
->
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
getContext
(),
WarplyManagerHelper
.
constructCampaignUrl
(
gift
)));
if
(
gift
.
getType
().
equals
(
"coupon"
))
{
WarplyManagerHelper
.
openCouponset
(
getContext
(),
gift
);
}
else
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
getContext
(),
WarplyManagerHelper
.
constructCampaignUrl
(
gift
)));
})
.
doOnError
(
error
->
{
})
...
...
@@ -127,7 +130,10 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mRecyclerMore
.
setAdapter
(
mAdapterMore
);
mAdapterMore
.
getPositionClicks
()
.
doOnNext
(
more
->
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
getContext
(),
WarplyManagerHelper
.
constructCampaignUrl
(
more
)));
if
(
more
.
getType
().
equals
(
"coupon"
))
{
WarplyManagerHelper
.
openCouponset
(
getContext
(),
more
);
}
else
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
getContext
(),
WarplyManagerHelper
.
constructCampaignUrl
(
more
)));
})
.
doOnError
(
error
->
{
})
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventService.java
0 → 100644
View file @
18021a1
package
ly
.
warp
.
sdk
.
services
;
import
android.content.Context
;
import
androidx.annotation.NonNull
;
import
androidx.work.Worker
;
import
androidx.work.WorkerParameters
;
import
org.greenrobot.eventbus.EventBus
;
import
ly.warp.sdk.io.models.ContexualEventModel
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
/**
* Created by Panagiotis Triantafyllou on 13/Ιουλ/2022.
*/
public
class
EventService
extends
Worker
{
public
EventService
(
@NonNull
Context
context
,
@NonNull
WorkerParameters
workerParams
)
{
super
(
context
,
workerParams
);
}
@NonNull
@Override
public
Result
doWork
()
{
ContexualEventModel
ccmsAdded
=
new
ContexualEventModel
();
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
ccmsAdded
));
return
Result
.
success
();
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
18021a1
...
...
@@ -26,19 +26,25 @@
package
ly
.
warp
.
sdk
.
utils
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.text.TextUtils
;
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.JSONObject
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.activities.CouponsetInfoActivity
;
import
ly.warp.sdk.activities.GiftsForYouActivity
;
import
ly.warp.sdk.activities.WarpViewActivity
;
import
ly.warp.sdk.db.WarplyDBHelper
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
...
...
@@ -49,6 +55,7 @@ import ly.warp.sdk.io.models.Consumer;
import
ly.warp.sdk.io.models.ContexualEventModel
;
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.CustomerStateModel
;
import
ly.warp.sdk.io.models.LoyaltyBadgeModel
;
...
...
@@ -57,6 +64,7 @@ import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
import
ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest
;
import
ly.warp.sdk.io.request.CosmoteSharingRequest
;
import
ly.warp.sdk.io.request.WarplyIntegrationRequest
;
import
ly.warp.sdk.services.EventService
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
...
...
@@ -413,8 +421,11 @@ public class WarplyManagerHelper {
mCCMSList
.
clear
();
mCCMSList
.
addAll
(
list
);
ContexualEventModel
ccmsAdded
=
new
ContexualEventModel
();
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
ccmsAdded
));
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventService
.
class
).
build
();
WorkManager
.
getInstance
(
Warply
.
getWarplyContext
()).
enqueue
(
mywork
);
// ContexualEventModel ccmsAdded = new ContexualEventModel();
// EventBus.getDefault().post(new WarplyEventBusManager(ccmsAdded));
// if (list == null || list.size() == 0) {
// CampaignList tempGifts = new CampaignList();
...
...
@@ -537,6 +548,30 @@ public class WarplyManagerHelper {
}
/**
* Open Couponset
*/
public
static
void
openCouponset
(
Context
context
,
Campaign
item
)
{
try
{
JSONObject
campaignSettings
=
WarpJSONParser
.
getJSONFromString
(
item
.
getCampaignTypeSettings
());
if
(
campaignSettings
!=
null
)
{
if
(
campaignSettings
.
has
(
"couponset"
))
{
String
cpnUuid
=
campaignSettings
.
optString
(
"couponset"
);
for
(
Couponset
cpns
:
mCouponsetsList
)
{
if
(
cpns
.
getUuid
().
equals
(
cpnUuid
))
{
Intent
intent
=
new
Intent
(
context
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
cpns
);
context
.
startActivity
(
intent
);
break
;
}
}
}
}
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
}
/**
* Save if customer is nonTelco and if he/she has accepted the consents,
* And his msisdn list
*/
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
18021a1
...
...
@@ -382,7 +382,7 @@ public class WarpView extends WebView {
QuestionnaireEventModel
questionnaireEvent
=
new
QuestionnaireEventModel
();
questionnaireEvent
.
setName
(
parts
[
1
]);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
questionnaireEvent
));
}
else
if
(
parts
[
1
].
equals
(
"
addUserTag
"
))
{
}
else
if
(
parts
[
1
].
equals
(
"
userAnswered
"
))
{
QuestionnaireEventModel
questionnaireEvent
=
new
QuestionnaireEventModel
();
try
{
questionnaireEvent
.
setName
(
parts
[
1
]);
...
...
@@ -395,6 +395,19 @@ public class WarpView extends WebView {
WarpUtils
.
setUserTag
(
Warply
.
getWarplyContext
(),
""
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
questionnaireEvent
));
}
}
else
if
(
parts
[
1
].
equals
(
"addUserTag"
))
{
// QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
try
{
// questionnaireEvent.setName(parts[1]);
// questionnaireEvent.setParameter(parts[2]);
WarpUtils
.
setUserTag
(
Warply
.
getWarplyContext
(),
parts
[
2
]);
// EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
}
catch
(
IndexOutOfBoundsException
e
)
{
// questionnaireEvent.setName(parts[1]);
// questionnaireEvent.setParameter("");
WarpUtils
.
setUserTag
(
Warply
.
getWarplyContext
(),
""
);
// EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
}
}
else
if
(
parts
[
1
].
equals
(
"couponRetrieved"
))
{
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
CouponEventModel
()));
}
else
if
(
parts
[
1
].
equals
(
"couponShared"
))
{
...
...
Please
register
or
login
to post a comment