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-09-09 15:33:04 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fb61c83ced93533ee698608b1f708e9d3d81d51b
fb61c83c
1 parent
85b2b4f7
new keys
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
59 additions
and
30 deletions
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponShareActivity.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/WarplyEventBusManager.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
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
fb61c83
...
...
@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public
void
onWarplyReady
()
{
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"
7000001018
"
),
//6012049321, 6012049322, 6012049323
.
setGuid
(
"
6012049322
"
),
//6012049321, 6012049322, 6012049323
mLoginReceiver
);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/build.gradle
View file @
fb61c83
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta59
i
'
PUBLISH_VERSION
=
'4.5.4-cosbeta59'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponShareActivity.java
View file @
fb61c83
...
...
@@ -21,6 +21,7 @@ import com.bumptech.glide.Glide;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
com.google.android.material.bottomsheet.BottomSheetDialog
;
import
org.greenrobot.eventbus.EventBus
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
...
...
@@ -31,9 +32,11 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver;
import
ly.warp.sdk.io.models.Consumer
;
import
ly.warp.sdk.io.models.Coupon
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.WarplyCouponsChangedEventModel
;
import
ly.warp.sdk.io.request.CosmoteCouponSharingRequest
;
import
ly.warp.sdk.io.request.WarplyConsumerRequest
;
import
ly.warp.sdk.io.request.WarplyUserCouponsRequest
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
...
...
@@ -291,7 +294,9 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
private
final
CallbackReceiver
<
CouponList
>
mUserCouponsReceiver
=
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
WarplyCouponsChangedEventModel
couponsChanged
=
new
WarplyCouponsChangedEventModel
();
couponsChanged
.
setChanged
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
couponsChanged
));
}
@Override
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
View file @
fb61c83
...
...
@@ -18,6 +18,7 @@ import androidx.work.WorkManager;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
org.greenrobot.eventbus.EventBus
;
import
org.json.JSONObject
;
import
io.github.inflationx.viewpump.ViewPumpContextWrapper
;
...
...
@@ -29,12 +30,14 @@ 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.LoyaltyContextualOfferModel
;
import
ly.warp.sdk.io.models.WarplyCouponsChangedEventModel
;
import
ly.warp.sdk.io.request.WarplyGetCampaignsRequest
;
import
ly.warp.sdk.io.request.WarplyRedeemCouponRequest
;
import
ly.warp.sdk.io.request.WarplyUserCouponsRequest
;
import
ly.warp.sdk.services.EventCampaignService
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
...
...
@@ -274,6 +277,9 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
@Override
public
void
onSuccess
(
CouponList
result
)
{
// Thread.currentThread().interrupt();
WarplyCouponsChangedEventModel
couponsChanged
=
new
WarplyCouponsChangedEventModel
();
couponsChanged
.
setChanged
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
couponsChanged
));
}
@Override
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
fb61c83
...
...
@@ -34,6 +34,7 @@ import androidx.appcompat.app.AlertDialog;
import
androidx.work.OneTimeWorkRequest
;
import
androidx.work.WorkManager
;
import
org.greenrobot.eventbus.EventBus
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
...
...
@@ -64,11 +65,13 @@ import ly.warp.sdk.io.models.LoyaltyBadgeModel;
import
ly.warp.sdk.io.models.LoyaltyContextualOfferModel
;
import
ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage
;
import
ly.warp.sdk.io.models.MerchantList
;
import
ly.warp.sdk.io.models.WarplyCouponsChangedEventModel
;
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.io.request.WarplyUserCouponsRequest
;
import
ly.warp.sdk.services.EventService
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
/**
...
...
@@ -207,7 +210,9 @@ public class WarplyManagerHelper {
WarplyManager
.
getUserCouponsWithCouponsets
(
new
WarplyUserCouponsRequest
(),
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
WarplyCouponsChangedEventModel
couponsChanged
=
new
WarplyCouponsChangedEventModel
();
couponsChanged
.
setChanged
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
couponsChanged
));
}
@Override
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyEventBusManager.java
View file @
fb61c83
...
...
@@ -41,6 +41,7 @@ public class WarplyEventBusManager {
private
LoyaltyEventModel
campaignsAdded
;
private
HealthEventModel
healthAdded
;
private
WarplyCouponsChangedEventModel
couponsChanged
;
private
WarplyPacingCardEventModel
widgetChanged
;
public
WarplyEventBusManager
()
{
...
...
@@ -62,6 +63,10 @@ public class WarplyEventBusManager {
this
.
couponsAdded
=
couponsAdded
;
}
public
WarplyEventBusManager
(
WarplyPacingCardEventModel
widgetChanged
)
{
this
.
widgetChanged
=
widgetChanged
;
}
public
WarplyEventBusManager
(
HealthEventModel
healthAdded
)
{
this
.
healthAdded
=
healthAdded
;
}
...
...
@@ -207,4 +212,8 @@ public class WarplyEventBusManager {
public
WarplyCouponsChangedEventModel
getCouponsChanged
()
{
return
couponsChanged
;
}
public
WarplyPacingCardEventModel
getWidgetChanged
()
{
return
widgetChanged
;
}
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
fb61c83
...
...
@@ -84,7 +84,6 @@ import ly.warp.sdk.io.models.SharingList;
import
ly.warp.sdk.io.models.TagsCategoriesList
;
import
ly.warp.sdk.io.models.TagsList
;
import
ly.warp.sdk.io.models.TransactionsList
;
import
ly.warp.sdk.io.models.WarplyCouponsChangedEventModel
;
import
ly.warp.sdk.io.request.CosmoteCouponSharingRequest
;
import
ly.warp.sdk.io.request.CosmotePostEventRequest
;
import
ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest
;
...
...
@@ -2286,9 +2285,6 @@ public class WarplyManager {
mActiveCouponList
.
add
(
coupon
);
}
WarplyCouponsChangedEventModel
couponsChanged
=
new
WarplyCouponsChangedEventModel
();
couponsChanged
.
setChanged
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
couponsChanged
));
receiver
.
onSuccess
(
mActiveCouponList
);
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
fb61c83
...
...
@@ -26,6 +26,7 @@
package
ly
.
warp
.
sdk
.
views
;
import
android.annotation.SuppressLint
;
import
android.app.ActivityManager
;
import
android.app.AlertDialog
;
import
android.content.ActivityNotFoundException
;
import
android.content.Context
;
...
...
@@ -67,6 +68,7 @@ import ly.warp.sdk.Warply;
import
ly.warp.sdk.activities.WarpViewActivity
;
import
ly.warp.sdk.io.models.CouponEventModel
;
import
ly.warp.sdk.io.models.QuestionnaireEventModel
;
import
ly.warp.sdk.io.models.WarplyPacingCardEventModel
;
import
ly.warp.sdk.io.models.WarplyPacingEventModel
;
import
ly.warp.sdk.services.WarplyHealthService
;
import
ly.warp.sdk.utils.WarpUtils
;
...
...
@@ -149,6 +151,16 @@ public class WarpView extends WebView {
initCustomActionHandler
();
}
private
boolean
isMyServiceRunning
(
Class
<?>
serviceClass
)
{
ActivityManager
manager
=
(
ActivityManager
)
getContext
().
getSystemService
(
Context
.
ACTIVITY_SERVICE
);
for
(
ActivityManager
.
RunningServiceInfo
service
:
manager
.
getRunningServices
(
Integer
.
MAX_VALUE
))
{
if
(
serviceClass
.
getName
().
equals
(
service
.
service
.
getClassName
()))
{
return
true
;
}
}
return
false
;
}
private
void
initCustomActionHandler
()
{
String
actionHandlerName
=
WarplyProperty
.
getWebActionListenerClassName
(
getContext
());
...
...
@@ -409,28 +421,24 @@ public class WarpView extends WebView {
// EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
}
else
if
(
parts
[
1
].
equals
(
"couponShared"
))
{
// EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
}
/*else if (parts[2].equals("serviceDisabled")) {
// WorkManager.getInstance(Warply.getWarplyContext()).cancelAllWorkByTag(UpdateUserLocationService.TAG);
WarplyPacingEventModel pacingService = new WarplyPacingEventModel();
pacingService.setEnabled(false);
pacingService.setVisible(false);
EventBus.getDefault().post(new WarplyEventBusManager(pacingService));
} else if (parts[2].equals("serviceEnabled")) {
WarplyPacingEventModel pacingService = new WarplyPacingEventModel();
pacingService.setEnabled(true);
EventBus.getDefault().post(new WarplyEventBusManager(pacingService));
}*/
else
if
(
parts
[
1
].
equals
(
"steps"
)
&&
parts
[
2
].
equals
(
"shortcutEnabled"
))
{
// PeriodicWorkRequest stepsWorker = new PeriodicWorkRequest.Builder(WarplyHealthService.class, 15, TimeUnit.MINUTES)
// .build();
// WorkManager.getInstance(Warply.getWarplyContext()).enqueue(stepsWorker);
Intent
stepsServiceIntent
=
new
Intent
(
Warply
.
getWarplyContext
(),
WarplyHealthService
.
class
);
Warply
.
getWarplyContext
().
startService
(
stepsServiceIntent
);
WarplyPacingEventModel
pacingVisible
=
new
WarplyPacingEventModel
();
pacingVisible
.
setVisible
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
pacingVisible
));
}
else
if
(
parts
[
1
].
equals
(
"steps"
)
&&
parts
[
2
].
equals
(
"shortcutDisabled"
))
{
// WorkManager.getInstance(Warply.getWarplyContext()).cancelAllWork();
}
else
if
(
parts
[
1
].
equals
(
"steps"
)
&&
parts
[
2
].
equals
(
"widgetDisabled"
))
{
// This is for the pacing widget
WarplyPacingCardEventModel
pacingWidgetVisible
=
new
WarplyPacingCardEventModel
();
pacingWidgetVisible
.
setVisible
(
false
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
pacingWidgetVisible
));
}
else
if
(
parts
[
1
].
equals
(
"steps"
)
&&
parts
[
2
].
equals
(
"widgetEnabled"
))
{
// This is for the pacing widget
WarplyPacingCardEventModel
pacingWidgetVisible
=
new
WarplyPacingCardEventModel
();
pacingWidgetVisible
.
setVisible
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
pacingWidgetVisible
));
}
else
if
(
parts
[
1
].
equals
(
"steps"
)
&&
parts
[
2
].
equals
(
"shortcutEnabled"
))
{
// This is for the pacing service
if
(!
isMyServiceRunning
(
WarplyHealthService
.
class
))
{
Intent
stepsServiceIntent
=
new
Intent
(
Warply
.
getWarplyContext
(),
WarplyHealthService
.
class
);
Warply
.
getWarplyContext
().
startService
(
stepsServiceIntent
);
WarplyPacingEventModel
pacingVisible
=
new
WarplyPacingEventModel
();
pacingVisible
.
setVisible
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
pacingVisible
));
}
}
else
if
(
parts
[
1
].
equals
(
"steps"
)
&&
parts
[
2
].
equals
(
"shortcutDisabled"
))
{
// This is for the pacing service
Intent
stepsServiceIntent
=
new
Intent
(
Warply
.
getWarplyContext
(),
WarplyHealthService
.
class
);
Warply
.
getWarplyContext
().
stopService
(
stepsServiceIntent
);
...
...
Please
register
or
login
to post a comment