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-04 19:14:07 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7be5e5f226798be3f22deeeb6ee95e2f90c6d9bf
7be5e5f2
1 parent
92e0d0cf
new version
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
514 additions
and
52 deletions
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/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/Consumer.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/CosmoteCouponSharingRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
warply_android_sdk/src/main/res/drawable-xhdpi/ic_arrow_down_dark.png
warply_android_sdk/src/main/res/drawable/banner_border_white_rounded_top.xml
warply_android_sdk/src/main/res/drawable/shape_cos_white_rounded_top.xml
warply_android_sdk/src/main/res/layout/activity_active_coupons.xml
warply_android_sdk/src/main/res/layout/activity_coupon_info.xml
warply_android_sdk/src/main/res/layout/activity_coupon_share.xml
warply_android_sdk/src/main/res/layout/dl_share.xml
warply_android_sdk/src/main/res/layout/item_share.xml
warply_android_sdk/src/main/res/values/strings.xml
warply_android_sdk/build.gradle
View file @
7be5e5f
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta2
3
'
PUBLISH_VERSION
=
'4.5.4-cosbeta2
4
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponShareActivity.java
View file @
7be5e5f
package
ly
.
warp
.
sdk
.
activities
;
import
android.app.Activity
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.EditText
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
androidx.appcompat.app.AlertDialog
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
com.google.android.material.bottomsheet.BottomSheetDialog
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
ly.warp.sdk.R
;
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.request.CosmoteCouponSharingRequest
;
import
ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest
;
import
ly.warp.sdk.io.request.WarplyConsumerRequest
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
...
...
@@ -28,16 +43,21 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
// Constants
// ===========================================================
private
final
String
MSISDN_LIST
=
"msisdnList"
;
// ===========================================================
// Fields
// ===========================================================
private
ImageView
mIvBack
,
mIvCouponPhoto
;
private
TextView
mTvCouponTitle
;
private
TextView
mTvCouponTitle
,
mTvPhoneHeader
;
private
Coupon
mCoupon
;
private
Consumer
mConsumer
;
private
RelativeLayout
mRlSenderView
;
private
LinearLayout
mLlShareButton
;
private
String
mSender
=
""
;
private
EditText
mEdtReceiver
;
private
AlertDialog
mAlertDialogSuccessSharing
,
mAlertDialogErrorSharing
,
mAlertDialogCouponAskSharing
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -55,6 +75,8 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
mIvCouponPhoto
=
findViewById
(
R
.
id
.
imageView6
);
mRlSenderView
=
findViewById
(
R
.
id
.
ll_share_view
);
mLlShareButton
=
findViewById
(
R
.
id
.
ll_share_button
);
mTvPhoneHeader
=
findViewById
(
R
.
id
.
tv_phone
);
mEdtReceiver
=
findViewById
(
R
.
id
.
et_phone
);
initViews
();
}
...
...
@@ -83,7 +105,11 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
return
;
}
if
(
view
.
getId
()
==
R
.
id
.
ll_share_button
)
{
if
(!
TextUtils
.
isEmpty
(
mSender
)
&&
!
mTvPhoneHeader
.
getText
().
toString
().
equals
(
R
.
string
.
cos_coupon_share_sender
))
{
askSharingDialog
();
}
else
{
errorSharingDialog2
();
}
}
}
...
...
@@ -114,24 +140,95 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
}
private
void
showSharingDialog
()
{
Dialog
dialog
=
new
Dialog
(
this
,
R
.
style
.
PopUpDialog
);
dialog
.
setContentView
(
R
.
layout
.
dl_dialog
);
dialog
.
getWindow
().
setBackgroundDrawableResource
(
R
.
drawable
.
banner_border_white
);
dialog
.
show
();
// TextView mTvDlTitle = dialog.findViewById(R.id.tv_dl_subtitle);
// LinearLayout mLlRedeem = dialog.findViewById(R.id.ll_dl_redeem);
//
// mTvDlTitle.setText(String.format(getResources().getString(R.string.cos_dl_title), parameter));
// mLlRedeem.setOnClickListener(view -> {
// if (mUniqueCampaignList != null && !mUniqueCampaignList.isEmpty()) {
// if (mUniqueCampaignList.containsKey("lucky_draw") && mUniqueCampaignList.get("lucky_draw").size() > 0) {
// startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(mUniqueCampaignList.get("lucky_draw").get(0))));
// dialog.dismiss();
// }
// }
// });
final
BottomSheetDialog
bottomSheetDialog
=
new
BottomSheetDialog
(
this
);
bottomSheetDialog
.
setContentView
(
R
.
layout
.
dl_share
);
LinearLayout
parent
=
bottomSheetDialog
.
findViewById
(
R
.
id
.
ll_share_dialog_view_inner
);
ImageView
dialogClose
=
(
ImageView
)
bottomSheetDialog
.
findViewById
(
R
.
id
.
iv_sender_list_close
);
dialogClose
.
setOnClickListener
(
view
->
bottomSheetDialog
.
dismiss
());
if
(
mConsumer
!=
null
)
{
try
{
JSONObject
profMeta
=
new
JSONObject
(
mConsumer
.
getProfileMetadata
());
if
(
profMeta
!=
null
)
{
JSONArray
msisdnList
=
new
JSONArray
();
msisdnList
=
profMeta
.
optJSONArray
(
MSISDN_LIST
);
if
(
msisdnList
!=
null
&&
msisdnList
.
length
()
>
0
)
{
for
(
int
i
=
0
;
i
<
msisdnList
.
length
();
i
++)
{
LayoutInflater
vi
=
(
LayoutInflater
)
getApplicationContext
().
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
LinearLayout
v
=
(
LinearLayout
)
vi
.
inflate
(
R
.
layout
.
item_share
,
null
);
TextView
textView
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
tv_phone_share
);
textView
.
setText
(
msisdnList
.
optString
(
i
));
textView
.
setOnClickListener
(
view
->
{
TextView
tv
=
(
TextView
)
view
;
mTvPhoneHeader
.
setText
(
tv
.
getText
().
toString
());
mSender
=
tv
.
getText
().
toString
();
bottomSheetDialog
.
dismiss
();
});
parent
.
addView
(
v
,
0
,
new
ViewGroup
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
));
}
}
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
bottomSheetDialog
.
show
();
}
private
void
acceptSharingDialog
()
{
mAlertDialogSuccessSharing
=
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
R
.
string
.
cos_dlg_success_title
)
.
setMessage
(
R
.
string
.
cos_dlg_positive_coupon_text
)
.
setPositiveButton
(
R
.
string
.
cos_dlg_positive_button2
,
(
dialogPositive
,
whichPositive
)
->
{
dialogPositive
.
dismiss
();
})
.
show
();
}
private
void
errorSharingDialog
()
{
mAlertDialogErrorSharing
=
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
R
.
string
.
cos_dlg_error_title
)
.
setMessage
(
R
.
string
.
cos_dlg_error_subtitle
)
.
setPositiveButton
(
R
.
string
.
cos_dlg_positive_button2
,
(
dialogPositive
,
whichPositive
)
->
{
dialogPositive
.
dismiss
();
})
.
show
();
}
private
void
errorSharingDialog2
()
{
mAlertDialogErrorSharing
=
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
R
.
string
.
cos_dlg_error_title
)
.
setMessage
(
R
.
string
.
cos_dlg_error_subtitle2
)
.
setPositiveButton
(
R
.
string
.
cos_dlg_positive_button2
,
(
dialogPositive
,
whichPositive
)
->
{
dialogPositive
.
dismiss
();
})
.
show
();
}
private
void
askSharingDialog
()
{
mAlertDialogCouponAskSharing
=
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
R
.
string
.
cos_dlg_positive_coupon_title
)
.
setMessage
(
R
.
string
.
cos_dlg_positive_coupon_subtitle
)
.
setPositiveButton
(
R
.
string
.
cos_dlg_negative_button3
,
(
dialogPositive
,
whichPositive
)
->
{
new
Thread
(()
->
{
if
(!
Thread
.
currentThread
().
isInterrupted
())
{
WarplyManager
.
cosmoteCouponSharing
(
new
CosmoteCouponSharingRequest
()
.
setCoupon
(
mCoupon
.
getCoupon
())
.
setSender
(
mSender
)
.
setReceiver
(
mEdtReceiver
.
getText
().
toString
())
,
mCouponSharingCallback
);
}
Thread
.
currentThread
().
interrupt
();
}).
start
();
})
.
setNegativeButton
(
R
.
string
.
cos_dlg_negative_button2
,
(
dialogNegative
,
whichNegative
)
->
{
dialogNegative
.
dismiss
();
})
.
show
();
}
private
final
CallbackReceiver
<
Consumer
>
mConsumerCallback
=
new
CallbackReceiver
<
Consumer
>()
{
...
...
@@ -146,6 +243,25 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
}
};
private
final
CallbackReceiver
<
JSONObject
>
mCouponSharingCallback
=
new
CallbackReceiver
<
JSONObject
>()
{
@Override
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
runOnUiThread
(()
->
{
if
(
status
==
1
)
acceptSharingDialog
();
else
errorSharingDialog
();
});
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Log
.
v
(
"COUPON_SHARE"
,
String
.
valueOf
(
errorCode
));
runOnUiThread
(()
->
errorSharingDialog
());
}
};
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
View file @
7be5e5f
...
...
@@ -3,6 +3,7 @@ package ly.warp.sdk.activities;
import
android.app.Activity
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
...
...
@@ -143,6 +144,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
private
ArrayList
<
MergedGifts
>
mergeDatasets
(
CampaignList
campaignList
,
ArrayList
<
LoyaltyGiftsForYouPackage
>
seasonalList
)
{
if
(
campaignList
!=
null
&&
campaignList
.
size
()
>
0
)
{
Log
.
v
(
"GIFTS_FOR_YOU"
,
String
.
valueOf
(
campaignList
.
size
()));
for
(
Campaign
campaign
:
campaignList
)
{
MergedGifts
data
=
new
MergedGifts
();
data
.
setCampaign
(
campaign
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MoreForYouActivity.java
View file @
7be5e5f
...
...
@@ -2,6 +2,7 @@ package ly.warp.sdk.activities;
import
android.app.Activity
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
...
...
@@ -85,6 +86,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
// mLlMorePopup.setVisibility(View.VISIBLE);
if
(
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"more_for_you"
)
!=
null
&&
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"more_for_you"
).
size
()
>
0
)
{
Log
.
v
(
"MORE_FOR_YOU"
,
String
.
valueOf
(
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"more_for_you"
).
size
()));
mRecyclerMore
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterMore
=
new
ProfileCampaignAdapter
(
this
,
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"more_for_you"
),
true
);
mRecyclerMore
.
setAdapter
(
mAdapterMore
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Consumer.java
View file @
7be5e5f
...
...
@@ -102,7 +102,7 @@ public class Consumer implements Parcelable, Serializable {
private
String
nickname
=
""
;
private
JSONObject
optin
=
new
JSONObject
();
private
boolean
passwordSet
=
false
;
private
JSONObject
profileMetadata
=
new
JSONObject
()
;
private
String
profileMetadata
=
""
;
private
double
redeemedPoints
=
0.0d
;
private
double
retrievedPoints
=
0.0d
;
private
String
salutation
=
""
;
...
...
@@ -160,7 +160,7 @@ public class Consumer implements Parcelable, Serializable {
this
.
sms_segmentation
=
this
.
optin
.
optBoolean
(
KEY_PERSON_SMS
);
}
this
.
passwordSet
=
json
.
optBoolean
(
PASSWORD_SET
);
this
.
profileMetadata
=
json
.
opt
JSONObject
(
PROFILE_METADATA
);
this
.
profileMetadata
=
json
.
opt
String
(
PROFILE_METADATA
);
this
.
redeemedPoints
=
json
.
optDouble
(
REDEEMED_POINTS
);
this
.
retrievedPoints
=
json
.
optDouble
(
RETRIEVED_POINTS
);
this
.
salutation
=
json
.
optString
(
SALUTATION
);
...
...
@@ -389,7 +389,7 @@ public class Consumer implements Parcelable, Serializable {
return
passwordSet
;
}
public
JSONObject
getProfileMetadata
()
{
public
String
getProfileMetadata
()
{
return
profileMetadata
;
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/CosmoteCouponSharingRequest.java
0 → 100644
View file @
7be5e5f
package
ly
.
warp
.
sdk
.
io
.
request
;
import
android.util.Base64
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.UnsupportedEncodingException
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.HashMap
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
/**
* Created by Panagiotis Triantafyllou on 04-July-22.
*/
public
class
CosmoteCouponSharingRequest
{
// ===========================================================
// Constants
// ===========================================================
private
final
String
KEY_MAPP
=
"coupon"
;
private
final
String
KEY_ACTION
=
"action"
;
private
final
String
KEY_ACTION_VALUE
=
"share"
;
private
final
String
KEY_COUPON
=
"coupon"
;
private
final
String
KEY_SENDER
=
"sender_msisdn"
;
private
final
String
KEY_RECEIVER
=
"receiver_msisdn"
;
// ===========================================================
// Fields
// ===========================================================
private
HashMap
<
String
,
String
>
mFilters
;
private
long
mCacheUpdateInterval
=
0
;
private
String
mCoupon
=
""
;
private
String
mSender
=
""
;
private
String
mReceiver
=
""
;
// ===========================================================
// Constructor
// ===========================================================
/**
* Default constructor of CosmoteCouponSharingRequest, initializes an empty filters HashMap
*/
public
CosmoteCouponSharingRequest
()
{
mFilters
=
new
HashMap
<>();
}
public
CosmoteCouponSharingRequest
(
CosmoteCouponSharingRequest
copy
)
{
if
(
copy
!=
null
)
{
this
.
mFilters
=
copy
.
mFilters
;
this
.
mCacheUpdateInterval
=
copy
.
mCacheUpdateInterval
;
}
}
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public
boolean
equals
(
Object
object
)
{
if
(
object
instanceof
CosmoteCouponSharingRequest
)
{
CosmoteCouponSharingRequest
other
=
(
CosmoteCouponSharingRequest
)
object
;
return
other
==
this
||
(
this
.
mFilters
==
other
.
mFilters
||
(
this
.
mFilters
!=
null
&&
this
.
mFilters
.
equals
(
other
.
mFilters
)));
}
return
false
;
}
@Override
public
int
hashCode
()
{
return
mFilters
.
hashCode
();
}
// ===========================================================
// Methods
// ===========================================================
// ===========================================================
// Getter & Setter
// ===========================================================
public
CosmoteCouponSharingRequest
setCoupon
(
String
coupon
)
{
mCoupon
=
coupon
;
return
this
;
}
public
CosmoteCouponSharingRequest
setSender
(
String
sender
)
{
mSender
=
sender
;
return
this
;
}
public
CosmoteCouponSharingRequest
setReceiver
(
String
receiver
)
{
mReceiver
=
receiver
;
return
this
;
}
/**
* Call this to get how often the cached data will be updated.
*
* @return mCacheUpdateInterval
*/
public
long
getCacheUpdateInterval
()
{
return
mCacheUpdateInterval
;
}
/**
* Call this to set how often the cached data will be updated.
*
* @param updateInterval The time that data will be cached
* @return CosmoteCouponSharingRequest
*/
public
CosmoteCouponSharingRequest
setCacheUpdateInterval
(
long
updateInterval
)
{
this
.
mCacheUpdateInterval
=
updateInterval
;
if
(
mCacheUpdateInterval
<
0
)
{
mCacheUpdateInterval
=
0
;
}
return
this
;
}
/**
* Call this to check if the Application uses Cache
*
* @return <p>true - the Application is using Cache</p>
* <p>false - the Application is not using Cache</p>
*/
public
boolean
isUseCache
()
{
return
mCacheUpdateInterval
>
0
;
}
/**
* Call this to check whether the cached data need to be updated
*
* @param useCache <p>true - the Application is using Cache</p>
* <p>false - the Application is not using Cache</p>
* @return CosmoteCouponSharingRequest
*/
public
CosmoteCouponSharingRequest
setUseCache
(
boolean
useCache
)
{
if
(
useCache
)
{
mCacheUpdateInterval
=
mCacheUpdateInterval
>
0
?
mCacheUpdateInterval
:
WarpConstants
.
INBOX_UPDATE_INTERVAL
;
}
else
{
mCacheUpdateInterval
=
0
;
}
return
this
;
}
/**
* Call this to build the offers Json object
*
* @return bodyJsonObject
*/
public
JSONObject
toJson
()
{
JSONObject
bodyJsonObject
=
new
JSONObject
();
try
{
JSONObject
extraJson
=
new
JSONObject
();
extraJson
.
putOpt
(
KEY_ACTION
,
KEY_ACTION_VALUE
);
extraJson
.
putOpt
(
KEY_COUPON
,
mCoupon
);
extraJson
.
putOpt
(
KEY_SENDER
,
mSender
);
extraJson
.
putOpt
(
KEY_RECEIVER
,
mReceiver
);
bodyJsonObject
.
putOpt
(
KEY_MAPP
,
extraJson
);
}
catch
(
JSONException
e
)
{
if
(
WarpConstants
.
DEBUG
)
e
.
printStackTrace
();
}
return
bodyJsonObject
;
}
public
String
getSignature
()
{
String
signature
=
mFilters
!=
null
&&
mFilters
.
size
()
>
0
?
String
.
valueOf
(
mFilters
.
hashCode
())
:
"default_cosmote_coupon_sharing_request"
;
try
{
byte
[]
hash
=
MessageDigest
.
getInstance
(
"SHA-256"
).
digest
(
signature
.
getBytes
(
"UTF-8"
));
signature
=
Base64
.
encodeToString
(
hash
,
Base64
.
NO_WRAP
);
}
catch
(
NullPointerException
|
NoSuchAlgorithmException
|
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
return
signature
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
7be5e5f
...
...
@@ -273,6 +273,16 @@ public class WarplyManagerHelper {
Log
.
v
(
"CCMS_PRESSED"
,
ccmsItem
.
getId
()
+
" "
+
ccmsItem
.
getOfferName
());
item
.
setNew
(
false
);
String
tempAudienceLevel
=
ccmsItem
.
getEligibleAssets
()
!=
null
&&
ccmsItem
.
getEligibleAssets
().
size
()
>
0
?
"MSISDN"
:
"GUID"
;
String
assets
=
""
;
if
(
ccmsItem
.
getEligibleAssets
()
!=
null
&&
ccmsItem
.
getEligibleAssets
().
size
()
>
0
)
{
for
(
String
singleAsset
:
ccmsItem
.
getEligibleAssets
())
{
assets
=
assets
+
singleAsset
+
","
;
}
if
(!
TextUtils
.
isEmpty
(
assets
))
{
assets
=
assets
.
substring
(
0
,
assets
.
length
()
-
1
);
}
}
String
url
=
item
.
getIndexUrl
()
+
"?web_id="
+
WarpUtils
.
getWebId
(
Warply
.
getWarplyContext
())
+
"&app_uuid="
+
WarplyProperty
.
getAppUuid
(
Warply
.
getWarplyContext
())
...
...
@@ -301,7 +311,8 @@ public class WarplyManagerHelper {
+
"&WAVE="
+
ccmsItem
.
getWave
()
+
"&VALIDITY="
+
ccmsItem
.
getValidity
()
+
"&TREATMENT_CODE="
+
ccmsItem
.
getTreatmentCode
()
+
"&OfferAudienceLevel="
+
tempAudienceLevel
;
+
"&OfferAudienceLevel="
+
tempAudienceLevel
+
"&ASSETS="
+
assets
;
// if (mConsumer != null)
...
...
@@ -328,6 +339,16 @@ public class WarplyManagerHelper {
if
(
camp
.
getSessionUUID
().
equals
(
item
.
getLoyaltyCampaignId
()))
{
Log
.
v
(
"CCMS_PRESSED"
,
item
.
getId
()
+
" "
+
item
.
getOfferName
());
String
tempAudienceLevel
=
item
.
getEligibleAssets
()
!=
null
&&
item
.
getEligibleAssets
().
size
()
>
0
?
"MSISDN"
:
"GUID"
;
String
assets
=
""
;
if
(
item
.
getEligibleAssets
()
!=
null
&&
item
.
getEligibleAssets
().
size
()
>
0
)
{
for
(
String
singleAsset
:
item
.
getEligibleAssets
())
{
assets
=
assets
+
singleAsset
+
","
;
}
if
(!
TextUtils
.
isEmpty
(
assets
))
{
assets
=
assets
.
substring
(
0
,
assets
.
length
()
-
1
);
}
}
url
=
camp
.
getIndexUrl
()
+
"?web_id="
+
WarpUtils
.
getWebId
(
Warply
.
getWarplyContext
())
+
"&app_uuid="
+
WarplyProperty
.
getAppUuid
(
Warply
.
getWarplyContext
())
...
...
@@ -356,7 +377,8 @@ public class WarplyManagerHelper {
+
"&WAVE="
+
item
.
getWave
()
+
"&VALIDITY="
+
item
.
getValidity
()
+
"&TREATMENT_CODE="
+
item
.
getTreatmentCode
()
+
"&OfferAudienceLevel="
+
tempAudienceLevel
;
+
"&OfferAudienceLevel="
+
tempAudienceLevel
+
"&ASSETS="
+
assets
;
break
;
}
}
...
...
@@ -515,10 +537,6 @@ public class WarplyManagerHelper {
return
WarpUtils
.
getUserTag
(
Warply
.
getWarplyContext
());
}
public
static
void
setDFYCouponPurchase
(
String
couponcode
,
String
merchantid
)
{
}
/**
* Set the List with active D4Y coupons
*/
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
7be5e5f
...
...
@@ -64,6 +64,7 @@ import ly.warp.sdk.io.models.ProductList;
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.request.CosmoteCouponSharingRequest
;
import
ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest
;
import
ly.warp.sdk.io.request.CosmoteSharingRequest
;
import
ly.warp.sdk.io.request.PacingDetailsRequest
;
...
...
@@ -1484,4 +1485,43 @@ public class WarplyManager {
},
request
.
getSignature
()));
}
public
static
void
cosmoteCouponSharing
(
CosmoteCouponSharingRequest
request
,
final
CallbackReceiver
<
JSONObject
>
receiver
)
{
WarpUtils
.
log
(
"************* WARPLY Cosmote Coupon Sharing Request ********************"
);
WarpUtils
.
log
(
"[WARP Trace] WARPLY Cosmote Coupon Sharing Request is active"
);
WarpUtils
.
log
(
"**************************************************"
);
Warply
.
postReceiveMicroappData
(
true
,
"context"
,
request
.
toJson
(),
new
CallbackReceiver
<
JSONObject
>()
{
@Override
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
receiver
.
onSuccess
(
result
);
else
receiver
.
onFailure
(
status
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
if
(
errorCode
==
401
)
{
refreshToken
(
new
WarplyRefreshTokenRequest
(),
new
CallbackReceiver
<
JSONObject
>()
{
@Override
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
cosmoteCouponSharing
(
request
,
receiver
);
else
receiver
.
onFailure
(
status
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
receiver
.
onFailure
(
errorCode
);
}
});
}
else
receiver
.
onFailure
(
errorCode
);
}
});
}
}
...
...
warply_android_sdk/src/main/res/drawable-xhdpi/ic_arrow_down_dark.png
0 → 100644
View file @
7be5e5f
1.28 KB
warply_android_sdk/src/main/res/drawable/banner_border_white_rounded_top.xml
0 → 100644
View file @
7be5e5f
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#FFFFFF"
/>
<corners
android:topLeftRadius=
"12dp"
android:topRightRadius=
"12dp"
/>
</shape>
\ No newline at end of file
warply_android_sdk/src/main/res/drawable/shape_cos_white_rounded_top.xml
0 → 100644
View file @
7be5e5f
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:topLeftRadius=
"12dp"
android:topRightRadius=
"12dp"
/>
<solid
android:color=
"@android:color/white"
/>
</shape>
\ No newline at end of file
warply_android_sdk/src/main/res/layout/activity_active_coupons.xml
View file @
7be5e5f
...
...
@@ -9,8 +9,8 @@
android:id=
"@+id/cl_bill_header"
android:layout_width=
"match_parent"
android:layout_height=
"80dp"
a
pp:layout_constraintTop_toTopOf=
"parent
"
a
ndroid:background=
"@android:color/white
"
>
a
ndroid:background=
"@android:color/white
"
a
pp:layout_constraintTop_toTopOf=
"parent
"
>
<ImageView
android:id=
"@+id/iv_coupons_close"
...
...
@@ -19,9 +19,9 @@
android:layout_marginStart=
"24dp"
android:layout_marginTop=
"4dp"
android:src=
"@drawable/ic_back"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/textView3"
...
...
@@ -43,14 +43,13 @@
android:layout_height=
"match_parent"
android:layout_below=
"@+id/cl_bill_header"
android:layout_marginTop=
"1dp"
android:background=
"@drawable/shape_cos_loyalty"
android:orientation=
"vertical"
>
android:background=
"@drawable/shape_cos_loyalty"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_active_coupons"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:paddingTop=
"4
8
dp"
android:paddingTop=
"4
4
dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
...
@@ -65,6 +64,6 @@
android:text=
"@string/cos_no_active_coupons"
android:textColor=
"@color/grey"
android:textSize=
"18sp"
android:
visibility=
"gone
"
android:
textStyle=
"bold
"
/>
android:
textStyle=
"bold
"
android:
visibility=
"gone
"
/>
</RelativeLayout>
\ No newline at end of file
...
...
warply_android_sdk/src/main/res/layout/activity_coupon_info.xml
View file @
7be5e5f
...
...
@@ -165,7 +165,6 @@
android:layout_marginTop=
"64dp"
android:background=
"@drawable/selector_button_green"
android:gravity=
"center"
android:visibility=
"invisible"
android:orientation=
"horizontal"
android:paddingVertical=
"8dp"
app:layout_constraintEnd_toEndOf=
"parent"
...
...
warply_android_sdk/src/main/res/layout/activity_coupon_share.xml
View file @
7be5e5f
...
...
@@ -117,13 +117,11 @@
<ImageView
android:id=
"@+id/iv_arrow_down"
android:layout_width=
"
wrap_content
"
android:layout_height=
"
wrap_content
"
android:layout_width=
"
16dp
"
android:layout_height=
"
16dp
"
android:layout_alignParentEnd=
"true"
android:layout_centerVertical=
"true"
android:rotation=
"90"
android:src=
"@drawable/ic_arrow_right_white"
android:tint=
"@color/blue_dark"
/>
android:src=
"@drawable/ic_arrow_down_dark"
/>
</RelativeLayout>
<View
...
...
@@ -154,8 +152,8 @@
android:layout_centerVertical=
"true"
android:background=
"@android:color/transparent"
android:hint=
"@string/cos_coupon_share_hint"
android:textColor=
"@color/grey"
android:inputType=
"phone"
android:textColor=
"@color/grey"
android:textColorHint=
"@color/cos_grey8"
android:textSize=
"16sp"
/>
</RelativeLayout>
...
...
@@ -176,11 +174,11 @@
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"32dp"
android:layout_marginTop=
"64dp"
android:paddingVertical=
"8dp"
android:paddingHorizontal=
"16dp"
android:background=
"@drawable/selector_button_green"
android:gravity=
"center"
android:orientation=
"horizontal"
android:paddingHorizontal=
"16dp"
android:paddingVertical=
"8dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/v_separator2"
>
...
...
@@ -191,8 +189,8 @@
android:gravity=
"center"
android:text=
"@string/cos_coupon_share_button"
android:textColor=
"@color/white"
android:text
Size=
"17dp
"
android:text
FontWeight=
"600
"
/>
android:text
FontWeight=
"600
"
android:text
Size=
"17dp
"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
warply_android_sdk/src/main/res/layout/dl_share.xml
0 → 100644
View file @
7be5e5f
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/rl_share_dialog_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<RelativeLayout
android:id=
"@+id/rl_sender_list"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"24dp"
android:background=
"@drawable/shape_cos_white_rounded_top"
android:paddingTop=
"16dp"
>
<TextView
android:id=
"@+id/tv_sender_value"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentStart=
"true"
android:layout_marginStart=
"24dp"
android:text=
"@string/cos_coupon_share_sender"
android:textColor=
"@color/grey"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
<ImageView
android:id=
"@+id/iv_sender_list_close"
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:layout_alignParentEnd=
"true"
android:layout_marginEnd=
"24dp"
android:src=
"@drawable/ic_close"
/>
</RelativeLayout>
<LinearLayout
android:id=
"@+id/ll_share_dialog_view_inner"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"12dp"
android:orientation=
"vertical"
>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
warply_android_sdk/src/main/res/layout/item_share.xml
0 → 100644
View file @
7be5e5f
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<RelativeLayout
android:id=
"@+id/ll_share_view2"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"24dp"
android:layout_marginTop=
"16dp"
>
<TextView
android:id=
"@+id/tv_phone_share"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentStart=
"true"
android:layout_centerVertical=
"true"
android:background=
"@android:color/transparent"
android:textColor=
"@color/grey"
android:textFontWeight=
"600"
android:textSize=
"16sp"
tools:text=
"6987654322"
/>
</RelativeLayout>
<View
android:id=
"@+id/v_separator2"
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:layout_marginTop=
"20dp"
android:background=
"@color/cos_grey7"
app:layout_constraintEnd_toEndOf=
"@+id/ll_share_view2"
app:layout_constraintStart_toStartOf=
"@+id/ll_share_view2"
app:layout_constraintTop_toBottomOf=
"@+id/ll_share_view2"
/>
</LinearLayout>
\ No newline at end of file
warply_android_sdk/src/main/res/values/strings.xml
View file @
7be5e5f
...
...
@@ -96,7 +96,12 @@
<string
name=
"cos_coupon_share_hint"
>
Καταχώρηση τηλεφώνου
</string>
<string
name=
"cos_coupon_share_button"
>
Αποστολή με SMS
</string>
<string
name=
"cod_dlg_reject_title"
>
Απόρριψη δώρου
</string>
<string
name=
"cod_dlg_reject_subtitle"
>
To δώρο αππορίφθηκε
</string>
<string
name=
"cod_dlg_reject_subtitle"
>
To δώρο απορρίφθηκε
</string>
<string
name=
"cos_dlg_positive_coupon_text"
>
Μόλις έκανες δώρο ένα κουπόνι!
</string>
<string
name=
"cos_dlg_positive_coupon_title"
>
Στείλε δώρο
</string>
<string
name=
"cos_dlg_positive_coupon_subtitle"
>
Είσαι σίγουρος ότι θέλεις να κάνεις δώρο το κουπόνι σου;
</string>
<string
name=
"cos_dlg_negative_button3"
>
Αποστολή
</string>
<string
name=
"cos_dlg_error_subtitle2"
>
Τα πεδία δεν είναι σωστά
</string>
<string-array
name=
"coupons_array"
>
<item>
Κουπόνια
</item>
...
...
Please
register
or
login
to post a comment