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-06 14:18:13 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dd9919dff38bb434b86b4c94acbbf90987652e71
dd9919df
1 parent
ee78222e
fixes
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
394 additions
and
27 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/activities/ContextualActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponInfoActivity.java
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/activities/GiftsForYouActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/LoyaltyWallet.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/TelcoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/WarpViewActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/CouponsEventModel.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/HealthEventModel.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/WarplyCouponsChangedEventModel.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/CosmoteSubmitOrderRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyRedeemCouponRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventCouponsService.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventQuestionnaireService.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarpUtils.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
warply_android_sdk/src/main/res/layout/item_profile_recycler_vertical.xml
warply_android_sdk/src/main/res/values/strings.xml
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
dd9919d
...
...
@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public
void
onWarplyReady
()
{
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"6012049
321
"
),
//6012049321, 6012049322, 6012049323
.
setGuid
(
"6012049
139
"
),
//6012049321, 6012049322, 6012049323
mLoginReceiver
);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/build.gradle
View file @
dd9919d
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta5
6
'
PUBLISH_VERSION
=
'4.5.4-cosbeta5
7
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/AndroidManifest.xml
View file @
dd9919d
...
...
@@ -128,6 +128,11 @@
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<service
android:name=
"ly.warp.sdk.services.EventCouponsService"
android:exported=
"false"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<service
android:name=
"ly.warp.sdk.services.EventCampaignService"
android:exported=
"false"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ContextualActivity.java
View file @
dd9919d
...
...
@@ -167,6 +167,7 @@ public class ContextualActivity extends Activity implements View.OnClickListener
WarplyManager
.
submitOrder
(
new
CosmoteSubmitOrderRequest
()
.
setCommunicationUuid
(
""
)
.
setUserMsisdn
(
mSender
)
.
setSessionId
(
mCCMS
.
getSessionId
())
.
setBusinessService
(
mCCMS
.
getBusinessService
())
.
setOfferName
(
mCCMS
.
getOfferName
())
.
setProductType
(
mCCMS
.
getProductType
())
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponInfoActivity.java
View file @
dd9919d
...
...
@@ -15,6 +15,8 @@ import android.widget.LinearLayout;
import
android.widget.TextView
;
import
androidx.core.content.ContextCompat
;
import
androidx.work.OneTimeWorkRequest
;
import
androidx.work.WorkManager
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
...
...
@@ -31,6 +33,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.Coupon
;
import
ly.warp.sdk.io.models.Couponset
;
import
ly.warp.sdk.services.EventCouponsService
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
...
...
@@ -50,7 +53,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
private
LinearLayout
mLlGiftIt
,
mLlShops
,
mLlBarcodeShown
,
mLlBarcodeContainer
,
mLlTerms
;
private
Coupon
mCoupon
;
private
Couponset
mCouponset
;
private
boolean
mIsBarcodeShown
=
false
,
mIsTermsShown
=
false
;
private
boolean
mIsBarcodeShown
=
false
,
mIsTermsShown
=
false
,
mIsFromWallet
=
false
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -62,6 +65,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
setContentView
(
R
.
layout
.
activity_coupon_info
);
mCoupon
=
(
Coupon
)
getIntent
().
getSerializableExtra
(
"coupon"
);
mIsFromWallet
=
getIntent
().
getBooleanExtra
(
"isFromWallet"
,
false
);
mIvBack
=
findViewById
(
R
.
id
.
iv_coupon_info_back
);
mTvTerms
=
findViewById
(
R
.
id
.
tv_terms
);
...
...
@@ -88,6 +92,17 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
if
(
requestCode
==
1001
)
{
if
(
resultCode
==
RESULT_OK
)
{
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCouponsService
.
class
).
build
();
WorkManager
.
getInstance
(
this
).
enqueue
(
mywork
);
onBackPressed
();
}
}
}
@Override
public
void
onClick
(
View
view
)
{
if
(
view
.
getId
()
==
R
.
id
.
iv_coupon_info_back
)
{
onBackPressed
();
...
...
@@ -96,7 +111,11 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
if
(
view
.
getId
()
==
R
.
id
.
ll_gift_it
)
{
Intent
intent
=
new
Intent
(
CouponInfoActivity
.
this
,
CouponShareActivity
.
class
);
intent
.
putExtra
(
"coupon"
,
(
Serializable
)
mCoupon
);
startActivity
(
intent
);
intent
.
putExtra
(
"isFromWallet"
,
mIsFromWallet
);
if
(!
mIsFromWallet
)
startActivity
(
intent
);
else
startActivityForResult
(
intent
,
1001
);
return
;
}
if
(
view
.
getId
()
==
R
.
id
.
ll_shops
)
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponShareActivity.java
View file @
dd9919d
...
...
@@ -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.util.Log
;
...
...
@@ -58,6 +59,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
private
EditText
mEdtReceiver
;
private
AlertDialog
mAlertDialogSuccessSharing
,
mAlertDialogErrorSharing
,
mAlertDialogCouponAskSharing
,
mAlertDialogWrongNumberSharing
;
private
boolean
mIsFromWallet
=
false
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -69,6 +71,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
setContentView
(
R
.
layout
.
activity_coupon_share
);
mCoupon
=
(
Coupon
)
getIntent
().
getSerializableExtra
(
"coupon"
);
mIsFromWallet
=
getIntent
().
getBooleanExtra
(
"isFromWallet"
,
false
);
mIvBack
=
findViewById
(
R
.
id
.
iv_coupon_share_back
);
mTvCouponTitle
=
findViewById
(
R
.
id
.
textView13
);
...
...
@@ -190,6 +193,10 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
.
setMessage
(
R
.
string
.
cos_dlg_positive_coupon_text
)
.
setPositiveButton
(
R
.
string
.
cos_dlg_positive_button2
,
(
dialogPositive
,
whichPositive
)
->
{
dialogPositive
.
dismiss
();
if
(
mIsFromWallet
)
{
setResult
(
RESULT_OK
,
new
Intent
());
onBackPressed
();
}
})
.
show
();
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
View file @
dd9919d
...
...
@@ -109,6 +109,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
.
setCouponsetUuid
(
mCouponset
.
getUuid
())
.
setCommunicationUuid
(
mLoyalty
.
getSessionUUID
())
.
setHasContextualOffer
(
true
)
.
setSessionId
(
mCcms
.
getSessionId
())
.
setUserMsisdn
(
WarplyManagerHelper
.
getConsumer
().
getMsisdn
())
//TODO: where to find the msisdn??
.
setBusinessService
(
mCcms
.
getBusinessService
())
.
setOfferName
(
mCcms
.
getOfferName
())
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
View file @
dd9919d
...
...
@@ -80,6 +80,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
filterItems
();
if
(
WarplyManagerHelper
.
getSeasonalList
()
!=
null
&&
WarplyManagerHelper
.
getSeasonalList
().
size
()
>
0
)
{
mHashSetSeasonalList
.
clear
();
mHashSetSeasonalList
.
addAll
(
WarplyManagerHelper
.
getSeasonalList
());
mSeasonalList
.
clear
();
mSeasonalList
.
addAll
(
mHashSetSeasonalList
);
...
...
@@ -150,6 +151,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
filterItems
();
if
(
WarplyManagerHelper
.
getSeasonalList
()
!=
null
&&
WarplyManagerHelper
.
getSeasonalList
().
size
()
>
0
)
{
mHashSetSeasonalList
.
clear
();
mHashSetSeasonalList
.
addAll
(
WarplyManagerHelper
.
getSeasonalList
());
mSeasonalList
.
clear
();
mSeasonalList
.
addAll
(
mHashSetSeasonalList
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/LoyaltyWallet.java
View file @
dd9919d
...
...
@@ -21,6 +21,7 @@ import com.bumptech.glide.Glide;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.Subscribe
;
import
java.io.Serializable
;
import
java.text.ParseException
;
...
...
@@ -36,6 +37,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.ActiveDFYCouponEventModel
;
import
ly.warp.sdk.io.models.ActiveDFYCouponModel
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
...
...
@@ -118,6 +120,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
}
@Override
protected
void
onStart
()
{
super
.
onStart
();
EventBus
.
getDefault
().
register
(
this
);
}
@Override
protected
void
onStop
()
{
super
.
onStop
();
EventBus
.
getDefault
().
unregister
(
this
);
}
@Override
public
void
onResume
()
{
super
.
onResume
();
}
...
...
@@ -167,6 +181,35 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
}
}
@Subscribe
()
public
void
onMessageEvent
(
WarplyEventBusManager
event
)
{
if
(
event
.
getCouponsAdded
()
!=
null
)
{
CouponList
tempCouponList
=
new
CouponList
();
tempCouponList
.
clear
();
tempCouponList
.
addAll
(
WarplyManagerHelper
.
getCouponList
());
runOnUiThread
(()
->
{
if
(
tempCouponList
!=
null
&&
tempCouponList
.
size
()
>
0
)
{
mAdapterCoupons
=
new
ActiveCouponAdapter
(
this
,
tempCouponList
);
mRecyclerCoupons
.
setAdapter
(
mAdapterCoupons
);
mAdapterCoupons
.
getPositionClicks
()
.
doOnNext
(
coupon
->
{
Intent
intent
=
new
Intent
(
LoyaltyWallet
.
this
,
CouponInfoActivity
.
class
);
intent
.
putExtra
(
"coupon"
,
(
Serializable
)
coupon
);
intent
.
putExtra
(
"isFromWallet"
,
true
);
startActivityForResult
(
intent
,
1002
);
})
.
doOnError
(
error
->
{
})
.
subscribe
();
mAdapterCoupons
.
notifyDataSetChanged
();
}
else
{
mRecyclerCoupons
.
setVisibility
(
View
.
GONE
);
mTvActiveCouponsHeader
.
setVisibility
(
View
.
GONE
);
}
});
}
}
@Override
protected
void
attachBaseContext
(
Context
newBase
)
{
super
.
attachBaseContext
(
ViewPumpContextWrapper
.
wrap
(
newBase
));
...
...
@@ -188,7 +231,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
.
doOnNext
(
coupon
->
{
Intent
intent
=
new
Intent
(
LoyaltyWallet
.
this
,
CouponInfoActivity
.
class
);
intent
.
putExtra
(
"coupon"
,
(
Serializable
)
coupon
);
startActivity
(
intent
);
intent
.
putExtra
(
"isFromWallet"
,
true
);
startActivityForResult
(
intent
,
1002
);
})
.
doOnError
(
error
->
{
})
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/TelcoActivity.java
View file @
dd9919d
...
...
@@ -204,6 +204,7 @@ public class TelcoActivity extends Activity implements View.OnClickListener {
WarplyManager
.
submitOrder
(
new
CosmoteSubmitOrderRequest
()
.
setCommunicationUuid
(
mLoyalty
.
getSessionUUID
())
.
setUserMsisdn
(
mSender
)
.
setSessionId
(
mCCMS
.
getSessionId
())
.
setBusinessService
(
mCCMS
.
getBusinessService
())
.
setOfferName
(
mCCMS
.
getOfferName
())
.
setProductType
(
mCCMS
.
getProductType
())
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/WarpViewActivity.java
View file @
dd9919d
...
...
@@ -33,6 +33,7 @@ import android.content.Intent;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.text.TextUtils
;
import
android.view.KeyEvent
;
import
android.view.View
;
...
...
@@ -78,6 +79,7 @@ public class WarpViewActivity extends WarpBaseActivity {
// ===========================================================
private
WarpView
mWarpView
;
private
static
Handler
metersHandler
=
new
Handler
();
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -116,6 +118,8 @@ public class WarpViewActivity extends WarpBaseActivity {
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
if
(
metersHandler
!=
null
)
metersHandler
.
removeCallbacksAndMessages
(
null
);
WarpUtils
.
setWebviewParams
(
this
,
new
JSONObject
());
}
...
...
@@ -278,4 +282,8 @@ public class WarpViewActivity extends WarpBaseActivity {
}
};
public
static
Handler
getMetersHandler
()
{
return
metersHandler
;
}
}
\ No newline at end of file
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/CouponsEventModel.java
0 → 100644
View file @
dd9919d
/*
* 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
;
/**
* Created by Panagiotis Triantafyllou on 05-Sept-22.
*/
public
class
CouponsEventModel
{
private
boolean
success
;
public
CouponsEventModel
()
{
this
.
success
=
true
;
}
public
boolean
isSuccess
()
{
return
success
;
}
public
void
setSuccess
(
boolean
success
)
{
this
.
success
=
success
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/HealthEventModel.java
0 → 100644
View file @
dd9919d
/*
* 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
;
/**
* Created by Panagiotis Triantafyllou on 05-Sept-22.
*/
public
class
HealthEventModel
{
private
double
steps
;
public
HealthEventModel
()
{
this
.
steps
=
0.0d
;
}
public
double
getSteps
()
{
return
steps
;
}
public
void
setSteps
(
double
steps
)
{
this
.
steps
=
steps
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/WarplyCouponsChangedEventModel.java
0 → 100644
View file @
dd9919d
/*
* 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
;
/**
* Created by Panagiotis Triantafyllou on 06-Sept-22.
*/
public
class
WarplyCouponsChangedEventModel
{
private
boolean
changed
;
public
WarplyCouponsChangedEventModel
()
{
this
.
changed
=
true
;
}
public
boolean
isChanged
()
{
return
changed
;
}
public
void
setChanged
(
boolean
changed
)
{
this
.
changed
=
changed
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/CosmoteSubmitOrderRequest.java
View file @
dd9919d
...
...
@@ -73,6 +73,7 @@ public class CosmoteSubmitOrderRequest {
private
String
mWave
=
""
;
private
String
mValidity
=
""
;
private
String
mTreatmentCode
=
""
;
private
String
mSessionId
=
""
;
// ===========================================================
// Constructor
...
...
@@ -228,6 +229,11 @@ public class CosmoteSubmitOrderRequest {
return
this
;
}
public
CosmoteSubmitOrderRequest
setSessionId
(
String
sessionId
)
{
this
.
mSessionId
=
sessionId
;
return
this
;
}
/**
* Call this to get how often the cached data will be updated.
*
...
...
@@ -309,7 +315,7 @@ public class CosmoteSubmitOrderRequest {
extraData
.
putOpt
(
KEY_PROV_STEP_VALUE_MINS
,
mProvStepValueMins
);
extraData
.
putOpt
(
"InteractiveChannel"
,
"COSMOTE_OMNI"
);
extraData
.
putOpt
(
"InteractionPoint"
,
mZone
);
extraData
.
putOpt
(
"Session_ID"
,
m
CommunicationUui
d
);
extraData
.
putOpt
(
"Session_ID"
,
m
SessionI
d
);
extraData
.
putOpt
(
"OfferAudienceLevel"
,
mOfferAudienceLevel
);
extraData
.
putOpt
(
"MSISDN"
,
mOfferAudienceLevel
.
equals
(
"msisdn"
)
?
mUserMsisdn
:
""
);
extraData
.
putOpt
(
"GUID"
,
""
);
...
...
@@ -365,7 +371,7 @@ public class CosmoteSubmitOrderRequest {
JSONObject
param9
=
new
JSONObject
();
param9
.
putOpt
(
"Name"
,
"Session_ID"
);
param9
.
putOpt
(
"Value"
,
m
CommunicationUui
d
);
param9
.
putOpt
(
"Value"
,
m
SessionI
d
);
param9
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param9
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyRedeemCouponRequest.java
View file @
dd9919d
...
...
@@ -73,6 +73,7 @@ public class WarplyRedeemCouponRequest {
private
String
mWave
=
""
;
private
String
mValidity
=
""
;
private
String
mTreatmentCode
=
""
;
private
String
mSessionId
=
""
;
// ===========================================================
// Constructor
...
...
@@ -238,6 +239,11 @@ public class WarplyRedeemCouponRequest {
return
this
;
}
public
WarplyRedeemCouponRequest
setSessionId
(
String
sessionId
)
{
this
.
mSessionId
=
sessionId
;
return
this
;
}
/**
* Call this to get how often the cached data will be updated.
*
...
...
@@ -318,7 +324,7 @@ public class WarplyRedeemCouponRequest {
extraJson
.
putOpt
(
KEY_PROV_STEP_VALUE_MINS
,
mProvStepValueMins
);
extraJson
.
putOpt
(
"InteractiveChannel"
,
"COSMOTE_OMNI"
);
extraJson
.
putOpt
(
"InteractionPoint"
,
mZone
);
extraJson
.
putOpt
(
"Session_ID"
,
m
CommunicationUui
d
);
extraJson
.
putOpt
(
"Session_ID"
,
m
SessionI
d
);
extraJson
.
putOpt
(
"OfferAudienceLevel"
,
mOfferAudienceLevel
);
extraJson
.
putOpt
(
"MSISDN"
,
mOfferAudienceLevel
.
equals
(
"msisdn"
)
?
mUserMsisdn
:
""
);
extraJson
.
putOpt
(
"GUID"
,
""
);
...
...
@@ -374,7 +380,7 @@ public class WarplyRedeemCouponRequest {
JSONObject
param9
=
new
JSONObject
();
param9
.
putOpt
(
"Name"
,
"Session_ID"
);
param9
.
putOpt
(
"Value"
,
m
CommunicationUui
d
);
param9
.
putOpt
(
"Value"
,
m
SessionI
d
);
param9
.
putOpt
(
"Type"
,
"string"
);
parameters
.
put
(
param9
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventCouponsService.java
0 → 100644
View file @
dd9919d
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.CouponsEventModel
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
/**
* Created by Panagiotis Triantafyllou on 05/Sept/2022.
*/
public
class
EventCouponsService
extends
Worker
{
public
EventCouponsService
(
@NonNull
Context
context
,
@NonNull
WorkerParameters
workerParams
)
{
super
(
context
,
workerParams
);
}
@NonNull
@Override
public
Result
doWork
()
{
CouponsEventModel
couponsAdded
=
new
CouponsEventModel
();
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
couponsAdded
));
return
Result
.
success
();
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventQuestionnaireService.java
View file @
dd9919d
...
...
@@ -38,10 +38,10 @@ public class EventQuestionnaireService extends Worker {
if
(
result
!=
null
)
{
JSONObject
profMetadata
=
WarpJSONParser
.
getJSONFromString
(
result
.
getProfileMetadata
());
if
(
profMetadata
!=
null
)
{
if
(
profMetadata
.
has
(
"nonTelco"
)
&&
profMetadata
.
optBoolean
(
"nonTelco"
))
{
WarpUtils
.
setUserNonTelco
(
Warply
.
getWarplyContext
(),
profMetadata
.
optBoolean
(
"nonTelco"
));
}
if
(
profMetadata
!=
null
&&
profMetadata
.
has
(
"nonTelco"
)
)
{
WarpUtils
.
setUserNonTelco
(
Warply
.
getWarplyContext
(),
profMetadata
.
optBoolean
(
"nonTelco"
));
}
else
{
WarpUtils
.
setUserNonTelco
(
Warply
.
getWarplyContext
(),
false
);
}
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
View file @
dd9919d
...
...
@@ -19,6 +19,7 @@ import androidx.annotation.Nullable;
import
androidx.annotation.RequiresApi
;
import
androidx.core.app.NotificationCompat
;
import
org.greenrobot.eventbus.EventBus
;
import
org.json.JSONObject
;
import
java.text.SimpleDateFormat
;
...
...
@@ -28,8 +29,12 @@ import java.util.Locale;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.activities.BaseFragmentActivity
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.callbacks.WarplyHealthCallback
;
import
ly.warp.sdk.io.models.CouponsEventModel
;
import
ly.warp.sdk.io.models.HealthEventModel
;
import
ly.warp.sdk.io.request.PacingCalculateRequest
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
/**
...
...
@@ -50,6 +55,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
private
SensorManager
mSensorManager
;
private
Sensor
mSensor
;
private
int
mSteps
=
0
;
private
double
mStepsAll
=
0.0d
;
private
final
int
ACCEL_RING_SIZE
=
50
;
private
final
int
VEL_RING_SIZE
=
10
;
// change this threshold according to your sensitivity preferences
...
...
@@ -114,7 +120,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
while
(
true
)
{
sendSteps
();
try
{
Thread
.
sleep
(
10000
);
//900000
Thread
.
sleep
(
900000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -131,6 +137,8 @@ public class WarplyHealthService extends Service implements SensorEventListener
super
.
onDestroy
();
unregisterStepSensor
();
mStepsAll
=
0.0d
;
WarpUtils
.
setStepsMetersCounter
(
this
,
0.0d
);
sendSteps
();
}
...
...
@@ -201,6 +209,11 @@ public class WarplyHealthService extends Service implements SensorEventListener
&&
oldVelocityEstimate
<=
STEP_THRESHOLD
&&
(
timeNs
-
lastStepTimeNs
>
STEP_DELAY_NS
))
{
mSteps
++;
mStepsAll
++;
HealthEventModel
healthSteps
=
new
HealthEventModel
();
healthSteps
.
setSteps
((
mStepsAll
*
0.762
));
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
healthSteps
));
WarpUtils
.
setStepsMetersCounter
(
this
,
(
mStepsAll
*
0.762
));
WarpUtils
.
setStepsCounter
(
this
,
mSteps
);
lastStepTimeNs
=
timeNs
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarpUtils.java
View file @
dd9919d
...
...
@@ -139,6 +139,8 @@ public class WarpUtils {
+
"steps_counter"
;
private
static
final
String
PREFERENCES_KEY_USER_NON_TELCO
=
PREFERENCES_PREFIX
+
"user_non_telco"
;
private
static
final
String
PREFERENCES_STEPS_METERS_COUNTER
=
PREFERENCES_PREFIX
+
"steps_meters_counter"
;
private
static
SharedPreferences
_prefs
;
...
...
@@ -624,6 +626,17 @@ public class WarpUtils {
return
prefs
.
getInt
(
PREFERENCES_STEPS_COUNTER
,
0
);
}
public
static
void
setStepsMetersCounter
(
Context
context
,
double
counter
)
{
SharedPreferences
.
Editor
editor
=
getPreferences
(
context
).
edit
();
editor
.
putLong
(
PREFERENCES_STEPS_METERS_COUNTER
,
Double
.
doubleToRawLongBits
(
counter
));
editor
.
apply
();
}
public
static
double
getStepsMetersCounter
(
Context
context
)
{
SharedPreferences
prefs
=
getPreferences
(
context
);
return
Double
.
longBitsToDouble
(
prefs
.
getLong
(
PREFERENCES_STEPS_METERS_COUNTER
,
0
));
}
public
static
JSONObject
getDeviceInfoObject
(
Context
context
)
{
SharedPreferences
prefs
=
getPreferences
(
context
);
try
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
dd9919d
...
...
@@ -67,6 +67,7 @@ import ly.warp.sdk.io.models.MerchantList;
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.WarplyManager
;
...
...
@@ -198,9 +199,20 @@ public class WarplyManagerHelper {
@Override
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
if
(
status
==
1
)
{
WarplyManager
.
getUserCouponsWithCouponsets
(
new
WarplyUserCouponsRequest
(),
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
}
@Override
public
void
onFailure
(
int
errorCode
)
{
}
});
acceptSharingDialog
(
context
);
else
}
else
errorSharingDialog
(
context
);
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyEventBusManager.java
View file @
dd9919d
...
...
@@ -5,12 +5,15 @@ import java.util.HashMap;
import
ly.warp.sdk.io.models.ActiveDFYCouponEventModel
;
import
ly.warp.sdk.io.models.ContexualEventModel
;
import
ly.warp.sdk.io.models.CouponEventModel
;
import
ly.warp.sdk.io.models.CouponsEventModel
;
import
ly.warp.sdk.io.models.HealthEventModel
;
import
ly.warp.sdk.io.models.LoyaltyContextualOfferModel
;
import
ly.warp.sdk.io.models.LoyaltyEventModel
;
import
ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent
;
import
ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel
;
import
ly.warp.sdk.io.models.QuestionnaireEventModel
;
import
ly.warp.sdk.io.models.WarplyCCMSEnabledModel
;
import
ly.warp.sdk.io.models.WarplyCouponsChangedEventModel
;
import
ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel
;
import
ly.warp.sdk.io.models.WarplyPacingCardEventModel
;
import
ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel
;
...
...
@@ -34,7 +37,10 @@ public class WarplyEventBusManager {
private
CouponEventModel
coupon
;
private
ActiveDFYCouponEventModel
activeCoupon
;
private
ContexualEventModel
ccmsAdded
;
private
CouponsEventModel
couponsAdded
;
private
LoyaltyEventModel
campaignsAdded
;
private
HealthEventModel
healthAdded
;
private
WarplyCouponsChangedEventModel
couponsChanged
;
public
WarplyEventBusManager
()
{
...
...
@@ -52,6 +58,14 @@ public class WarplyEventBusManager {
this
.
ccmsAdded
=
ccmsAdded
;
}
public
WarplyEventBusManager
(
CouponsEventModel
couponsAdded
)
{
this
.
couponsAdded
=
couponsAdded
;
}
public
WarplyEventBusManager
(
HealthEventModel
healthAdded
)
{
this
.
healthAdded
=
healthAdded
;
}
public
WarplyEventBusManager
(
LoyaltyEventModel
campaignsAdded
)
{
this
.
campaignsAdded
=
campaignsAdded
;
}
...
...
@@ -60,6 +74,10 @@ public class WarplyEventBusManager {
this
.
coupon
=
coupon
;
}
public
WarplyEventBusManager
(
WarplyCouponsChangedEventModel
couponsChanged
)
{
this
.
couponsChanged
=
couponsChanged
;
}
public
WarplyEventBusManager
(
ActiveDFYCouponEventModel
activeCoupon
)
{
this
.
activeCoupon
=
activeCoupon
;
}
...
...
@@ -174,7 +192,19 @@ public class WarplyEventBusManager {
return
ccmsAdded
;
}
public
CouponsEventModel
getCouponsAdded
()
{
return
couponsAdded
;
}
public
LoyaltyEventModel
getCampaignsAdded
()
{
return
campaignsAdded
;
}
public
HealthEventModel
getHealthAdded
()
{
return
healthAdded
;
}
public
WarplyCouponsChangedEventModel
getCouponsChanged
()
{
return
couponsChanged
;
}
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
dd9919d
...
...
@@ -32,6 +32,7 @@ import android.util.Log;
import
androidx.appcompat.app.AlertDialog
;
import
org.greenrobot.eventbus.EventBus
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
...
...
@@ -83,6 +84,7 @@ 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
;
...
...
@@ -812,10 +814,10 @@ public class WarplyManager {
if
(
result
!=
null
)
{
JSONObject
profMetadata
=
WarpJSONParser
.
getJSONFromString
(
result
.
getProfileMetadata
());
if
(
profMetadata
!=
null
)
{
if
(
profMetadata
.
has
(
"nonTelco"
)
&&
profMetadata
.
optBoolean
(
"nonTelco"
))
{
WarpUtils
.
setUserNonTelco
(
Warply
.
getWarplyContext
(),
profMetadata
.
optBoolean
(
"nonTelco"
));
}
if
(
profMetadata
!=
null
&&
profMetadata
.
has
(
"nonTelco"
)
)
{
WarpUtils
.
setUserNonTelco
(
Warply
.
getWarplyContext
(),
profMetadata
.
optBoolean
(
"nonTelco"
));
}
else
{
WarpUtils
.
setUserNonTelco
(
Warply
.
getWarplyContext
(),
false
);
}
}
...
...
@@ -2235,6 +2237,9 @@ public class WarplyManager {
mActiveCouponList
.
add
(
coupon
);
}
WarplyCouponsChangedEventModel
couponsChanged
=
new
WarplyCouponsChangedEventModel
();
couponsChanged
.
setChanged
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
couponsChanged
));
receiver
.
onSuccess
(
mActiveCouponList
);
}
...
...
@@ -2316,10 +2321,10 @@ public class WarplyManager {
if
(
result
!=
null
)
{
JSONObject
profMetadata
=
WarpJSONParser
.
getJSONFromString
(
result
.
getProfileMetadata
());
if
(
profMetadata
!=
null
)
{
if
(
profMetadata
.
has
(
"nonTelco"
)
&&
profMetadata
.
optBoolean
(
"nonTelco"
))
{
WarpUtils
.
setUserNonTelco
(
Warply
.
getWarplyContext
(),
profMetadata
.
optBoolean
(
"nonTelco"
));
}
if
(
profMetadata
!=
null
&&
profMetadata
.
has
(
"nonTelco"
)
)
{
WarpUtils
.
setUserNonTelco
(
Warply
.
getWarplyContext
(),
profMetadata
.
optBoolean
(
"nonTelco"
));
}
else
{
WarpUtils
.
setUserNonTelco
(
Warply
.
getWarplyContext
(),
false
);
}
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
dd9919d
...
...
@@ -35,6 +35,7 @@ import android.content.pm.ApplicationInfo;
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
;
...
...
@@ -63,6 +64,7 @@ import java.util.Map;
import
java.util.concurrent.TimeUnit
;
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.WarplyPacingEventModel
;
...
...
@@ -508,6 +510,19 @@ public class WarpView extends WebView {
view
.
evaluateJavascript
(
scriptSource
,
s
->
{
});
WarpViewActivity
.
getMetersHandler
().
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
String
tempMeters
=
String
.
valueOf
(
WarpUtils
.
getStepsMetersCounter
(
getContext
()));
String
scriptSourceMeters
=
"passMeters("
+
tempMeters
+
");"
;
WarpView
.
this
.
evaluateJavascript
(
scriptSourceMeters
,
s
->
{
});
WarpViewActivity
.
getMetersHandler
().
postDelayed
(
this
,
1000
);
}
},
1000
);
if
(
url
.
contains
(
"about:blank"
))
{
WarpView
.
this
.
clearHistory
();
}
...
...
warply_android_sdk/src/main/res/layout/item_profile_recycler_vertical.xml
View file @
dd9919d
...
...
@@ -20,6 +20,13 @@
android:background=
"@drawable/selector_cos_campaign"
>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/gl_vertical_54_percent"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintGuide_percent=
"0.54"
/>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/gl_vertical_80_percent"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
@@ -30,10 +37,10 @@
android:id=
"@+id/iv_campaign_logo"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:scaleType=
"center
Crop
"
android:scaleType=
"center
Inside
"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_to
StartOf=
"par
ent"
app:layout_constraintStart_to
EndOf=
"@+id/gl_vertical_54_perc
ent"
app:layout_constraintTop_toTopOf=
"parent"
tools:src=
"@drawable/ic_cosmote_logo_horizontal_grey"
/>
...
...
warply_android_sdk/src/main/res/values/strings.xml
View file @
dd9919d
...
...
@@ -13,7 +13,7 @@
<string
name=
"cos_profile_type"
>
Traveller
</string>
<string
name=
"header_add"
>
Προσθήκη
</string>
<string
name=
"cos_profile_reward"
>
My Loyalty\nWallet
</string>
<string
name=
"cos_profile_title"
>
For You
</string>
<string
name=
"cos_profile_title"
>
Tα προνόμιά μου
</string>
<string
name=
"cos_deals_title"
>
Deals for You
</string>
<string
name=
"cos_profile_more"
>
Δες περισσότερα
</string>
<string
name=
"cos_gifts_title"
>
GIFTS for YOU
</string>
...
...
Please
register
or
login
to post a comment