Panagiotis Triantafyllou

sm deals changes

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
<bytecodeTargetLevel target="17" />
</component>
</project>
\ No newline at end of file
......
......@@ -8,7 +8,7 @@
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$PROJECT_DIR$/../../../../../../gradle-6.6.1" />
<option name="gradleJvm" value="11" />
<option name="gradleJvm" value="jbr-17" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
......@@ -183,7 +184,7 @@
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
......
......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("7000000831"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910
.setGuid("7000000833"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910
mLoginReceiver);
} else {
startNextActivity();
......
#Wed Oct 30 10:10:22 EET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
......
This diff is collapsed. Click to expand it.
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc74'
PUBLISH_VERSION = '4.5.4.6rc75'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -66,23 +66,23 @@
android:theme="@style/SDKAppTheme" />
<!-- android:screenOrientation="portrait"-->
<activity
android:name="ly.warp.sdk.activities.TelematicsActivity"
android:exported="false"
android:configChanges="orientation|screenSize"
android:theme="@style/SDKAppTheme" />
<activity
android:name="ly.warp.sdk.activities.TelematicsHistoryActivity"
android:exported="false"
android:configChanges="orientation|screenSize"
android:theme="@style/SDKAppTheme" />
<activity
android:name="ly.warp.sdk.activities.TelematicsMetricsActivity"
android:exported="false"
android:configChanges="orientation|screenSize"
android:theme="@style/SDKAppTheme" />
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsHistoryActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsMetricsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<activity
android:name="ly.warp.sdk.activities.GiftsForYouActivity"
......@@ -189,6 +189,11 @@
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name="ly.warp.sdk.services.EventUnifiedCouponsService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name="ly.warp.sdk.services.EventCampaignCouponService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
......
......@@ -22,6 +22,7 @@ import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.UnifiedCoupon;
import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -52,6 +53,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
// WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback);
WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
}
@Override
......@@ -130,4 +132,15 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
}
};
private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
@Override
public void onSuccess(ArrayList<UnifiedCoupon> result) {
Toast.makeText(BaseFragmentActivity.this, "Unified Coupons Success " + String.valueOf(result.size()), Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int errorCode) {
Toast.makeText(BaseFragmentActivity.this, "Unified Coupons Error", Toast.LENGTH_SHORT).show();
}
};
}
......
......@@ -169,9 +169,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mRecyclerCoupons.setNestedScrollingEnabled(false);
mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
// initViews();
initViews();
WarplyManager.getUnifiedCoupons(mUnifiedCallback);
// WarplyManager.getUnifiedCoupons(mUnifiedCallback);
}
@Override
......@@ -356,6 +356,102 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
@Subscribe()
public void onMessageEvent(WarplyEventBusManager event) {
if (event.getUnifiedCouponsAdded() != null) {
mUnifiedPressed = false;
if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0) {
ArrayList<UnifiedCoupon> tempCouponList = new ArrayList<UnifiedCoupon>();
tempCouponList.addAll(WarplyManagerHelper.getMarketCouponsList());
ArrayList<UnifiedCoupon> unilist = new ArrayList<UnifiedCoupon>();
for (UnifiedCoupon unicpn : tempCouponList) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(unicpn.getCreated());
} catch (ParseException e) {
e.printStackTrace();
}
unicpn.setExpirationDate(newDate);
unilist.add(unicpn);
}
Collections.sort(unilist, (coupon1, coupon2) -> coupon2.getExpirationDate().compareTo(coupon1.getExpirationDate()));
runOnUiThread(() -> {
mAdapterMarketCoupons = new MarketCouponAdapter(this, unilist);
mRvMarketCoupons.setAdapter(mAdapterMarketCoupons);
mAdapterMarketCoupons.getPositionClicks()
.doOnNext(coupon -> {
if (!mUnifiedPressed) {
mUnifiedPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("UnifiedCoupon").concat(":").concat(coupon.getBarcode()));
Intent intent = new Intent(LoyaltyWallet.this, UnifiedCouponInfoActivity.class);
intent.putExtra("coupon", (Serializable) coupon);
intent.putExtra("isFromWallet", true);
startActivity(intent);
}
// startActivityForResult(intent, 1002);
})
.doOnError(error -> {
})
.subscribe();
mAdapterMarketCoupons.notifyDataSetChanged();
mLlMarketView.setVisibility(View.VISIBLE);
// Third Expandable Banner
if (tempCouponList != null && tempCouponList.size() > 0) {
countValue = 0.0f;
if (WarplyManagerHelper.getCouponRedeemedList().size() > 0) {
if (WarplyManagerHelper.getCouponsetsDeals().size() > 0) {
for (Couponset couset : WarplyManagerHelper.getCouponsetsDeals()) {
for (Coupon cou : WarplyManagerHelper.getCouponRedeemedList()) {
if (cou.getCouponsetUuid().equals(couset.getUuid())) {
countValue += Float.valueOf(cou.getDiscount());
cou.setDescription(couset.getShortDescription());
cou.setImage(couset.getImgPreview());
cou.setName(couset.getName());
cou.setMerchantUuid(couset.getMerchantUuid());
cou.setInnerText(couset.getInnerText());
cou.setDiscount_type(couset.getDiscount_type());
cou.setFinal_price(couset.getFinal_price());
break;
}
}
}
}
}
mFavValue += countValue;
String badgeValue = String.format("%.02f", countValue);
mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
if (String.valueOf(countValue).length() >= 3) {
mTvMarketValue.setTextSize(12);
} else {
mTvMarketValue.setTextSize(14);
}
SpannableStringBuilder sBuilderThird = new SpannableStringBuilder();
sBuilderThird.append(String.format(getString(R.string.cos_supermarket_win), badgeValue));
CalligraphyTypefaceSpan typefaceBoldSpanThird = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilderThird.setSpan(typefaceBoldSpanThird, 15, 16 + badgeValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvMarketAll.setText(sBuilderThird, TextView.BufferType.SPANNABLE);
} else {
String badgeValue = String.format("%.02f", 0.0f);
mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
SpannableStringBuilder sBuilderThird = new SpannableStringBuilder();
sBuilderThird.append(String.format(getString(R.string.cos_supermarket_win), badgeValue));
CalligraphyTypefaceSpan typefaceBoldSpanThird = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilderThird.setSpan(typefaceBoldSpanThird, 15, 16 + badgeValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvMarketAll.setText(sBuilderThird, TextView.BufferType.SPANNABLE);
}
});
} else {
runOnUiThread(() -> {
mLlMarketView.setVisibility(View.GONE);
});
}
return;
}
if (event.getCouponsAdded() != null) {
mCouponPressed = false;
CouponList tempCouponList = new CouponList();
......@@ -398,6 +494,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
})
.subscribe();
mAdapterCoupons.notifyDataSetChanged();
// mLlGifts.setVisibility(View.VISIBLE);
} else {
mLlGifts.setVisibility(View.GONE);
}
......@@ -419,9 +516,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
nonTelcoDialog();
}
if (mUnifiedCoupons != null && mUnifiedCoupons.size() > 0) {
if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0) {
ArrayList<UnifiedCoupon> unilist = new ArrayList<UnifiedCoupon>();
for (UnifiedCoupon unicpn : mUnifiedCoupons) {
for (UnifiedCoupon unicpn : WarplyManagerHelper.getMarketCouponsList()) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date newDate = new Date();
try {
......
......@@ -12,6 +12,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
......@@ -49,7 +50,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
private ImageView mIvBack, mIvBarcode, mIvMarketExpand;
private TextView mTvTerms, mTvCouponCode, mTvCouponDate, mTvMarketExpand,
mTvTermsValue, mTvFullBarcode;
mTvTermsValue, mTvFullBarcode, mTvActiveValue;
private LinearLayout mLlShops, mLlBarcodeContainer, mLlTerms, mLlMarketCoupons, mLlMarketExpand;
private UnifiedCoupon mCoupon;
private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false,
......@@ -92,6 +93,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
mTvMarketExpand = findViewById(R.id.tv_market_expand);
mIvMarketExpand = findViewById(R.id.iv_market_expand);
mRecyclerCoupons = findViewById(R.id.rv_active_market_coupons);
mTvActiveValue = findViewById(R.id.textView14);
mRecyclerCoupons.setNestedScrollingEnabled(false);
mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
......@@ -174,8 +176,12 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
mIsMarketExpand = false;
if (mCoupon.getCoupons() != null && mCoupon.getCoupons().size() > 0) {
float activeValue = 0.0f;
CouponList cpnlist = new CouponList();
for (Coupon cpn : mCoupon.getCoupons()) {
if (cpn.getStatus() == 1) {
activeValue += Float.parseFloat(cpn.getDiscount());
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
......@@ -187,6 +193,8 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
cpnlist.add(cpn);
}
mTvActiveValue.setText(HtmlCompat.fromHtml(String.format(getString(R.string.cos_unified_subtitle), String.valueOf(activeValue)), HtmlCompat.FROM_HTML_MODE_COMPACT));
Collections.sort(cpnlist, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate()));
for (Coupon tempItem : cpnlist) {
if (tempItem.getStatus() == 1) {
......
/*
* 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 18-Sept-23.
*/
public class UnifiedCouponsEventModel {
private boolean success;
public UnifiedCouponsEventModel() {
this.success = true;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
}
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.UnifiedCouponsEventModel;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
/**
* Created by Panagiotis Triantafyllou on 18/Sept/2023.
*/
public class EventUnifiedCouponsService extends Worker {
public EventUnifiedCouponsService(@NonNull Context context, @NonNull WorkerParameters workerParams) {
super(context, workerParams);
}
@NonNull
@Override
public Result doWork() {
UnifiedCouponsEventModel couponsAdded = new UnifiedCouponsEventModel();
EventBus.getDefault().post(new WarplyEventBusManager(couponsAdded));
return Result.success();
}
}
......@@ -127,12 +127,13 @@ public class WarplyManagerHelper {
mAlertDialogRejectSharing, mAlertDialogReturnSharing, mAlertDialogErrorSharing,
mAlertDialogErrorUsedSharing, mAlertDialogErrorExpiredSharing, mAlertDialogNoInternet;
private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel();
private static float mDealsSum = 0.0f;
private static float mDealsSum = 0.0f, mUnifiedDiscount = 0.0f;
private static MerchantList mMerchantList = new MerchantList();
public static double mMetersWebview = 0.0d;
public static int mStepsWebview = 0;
public static int mSteps = 0;
private static ArrayList<UnifiedCoupon> mMarketCoupons = new ArrayList<>();
private static ArrayList<UnifiedCoupon> mMarketCoupons = new ArrayList<>(),
mMarketCouponsList = new ArrayList<>();
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -1336,6 +1337,22 @@ public class WarplyManagerHelper {
mMarketCoupons = marketCoupons;
}
public static ArrayList<UnifiedCoupon> getMarketCouponsList() {
return mMarketCouponsList;
}
public static void setMarketCouponsList(ArrayList<UnifiedCoupon> marketCoupons) {
mMarketCouponsList = marketCoupons;
}
public static void setUnifiedCouponsDiscount(float unifiedDiscount) {
mUnifiedDiscount = unifiedDiscount;
}
public static float getUnifiedCouponsDiscount() {
return mUnifiedDiscount;
}
public static boolean checkForLoyaltySDKNotification(Context context, Map<String, String> pushPayload) {
Bundle data = convertToBundle(pushPayload);
if (data == null || !data.containsKey("loyalty-action"))
......
......@@ -14,6 +14,7 @@ import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.LoyaltySDKSessionExpiredEventModel;
import ly.warp.sdk.io.models.QuestionnaireEventModel;
import ly.warp.sdk.io.models.UnifiedCouponsEventModel;
import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
......@@ -43,6 +44,8 @@ public class WarplyEventBusManager {
private ActiveDFYCouponEventModel activeCoupon;
private ContexualEventModel ccmsAdded;
private CouponsEventModel couponsAdded;
private UnifiedCouponsEventModel unifiedCouponsAdded;
private LoyaltyEventModel campaignsAdded;
private HealthEventModel healthAdded;
private WarplyCouponsChangedEventModel couponsChanged;
......@@ -89,6 +92,10 @@ public class WarplyEventBusManager {
this.couponsAdded = couponsAdded;
}
public WarplyEventBusManager(UnifiedCouponsEventModel unifiedCouponsAdded) {
this.unifiedCouponsAdded = unifiedCouponsAdded;
}
public WarplyEventBusManager(WarplyPacingCardEventModel widgetChanged) {
this.widgetChanged = widgetChanged;
}
......@@ -227,6 +234,10 @@ public class WarplyEventBusManager {
return couponsAdded;
}
public UnifiedCouponsEventModel getUnifiedCouponsAdded() {
return unifiedCouponsAdded;
}
public LoyaltyEventModel getCampaignsAdded() {
return campaignsAdded;
}
......
......@@ -90,11 +90,13 @@ public class MarketCouponAdapter extends RecyclerView.Adapter<MarketCouponAdapte
if (couponItem != null) {
int count = 0;
float activeValue = 0.0f;
if (couponItem.getCoupons() != null && couponItem.getCoupons().size() > 0) {
ArrayList<Coupon> couponList = new ArrayList<Coupon>();
for (Coupon item : couponItem.getCoupons()) {
if (item.getStatus() == 1) {
count++;
activeValue += Float.parseFloat(item.getDiscount());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date newDate = new Date();
try {
......@@ -123,9 +125,9 @@ public class MarketCouponAdapter extends RecyclerView.Adapter<MarketCouponAdapte
}
if (count > 1) {
holder.tvCouponCount.setText(String.format(mContext.getString(R.string.cos_market_active_coupons), String.valueOf(count)));
holder.tvCouponCount.setText(String.format(mContext.getString(R.string.cos_market_active_coupons), String.valueOf(count), String.valueOf(activeValue)));
} else if (count == 1) {
holder.tvCouponCount.setText(String.format(mContext.getString(R.string.cos_market_active_coupons_single), String.valueOf(count)));
holder.tvCouponCount.setText(String.format(mContext.getString(R.string.cos_market_active_coupons_single), String.valueOf(count), String.valueOf(activeValue)));
}
......
......@@ -90,7 +90,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="16dp"
android:maxLines="3"
android:maxLines="4"
android:ellipsize="end"
android:textColor="@color/cos_light_black"
android:textSize="12sp"
......
......@@ -153,14 +153,14 @@
<string name="cos_profile_preferences_placeholder">Οι προτιμήσεις μου</string>
<string name="cos_market_title">SUPERMARKET DEALS</string>
<string name="cos_rewards_title2">COSMOTE Επιβράβευση</string>
<string name="cos_market_item_title">COSMOTE\nSuperMarket\nDeals</string>
<string name="cos_market_active_coupons">έχεις %1$s ενεργά κουπόνια</string>
<string name="cos_market_active_coupons_single">έχεις %1$s ενεργό κουπόνι</string>
<string name="cos_market_item_title">COSMOTE\nSUPERMARKET\nDEALS</string>
<string name="cos_market_active_coupons">έχεις %1$s ενεργά κουπόνια αξίας %2$s€</string>
<string name="cos_market_active_coupons_single">έχεις %1$s ενεργό κουπόνι αξίας %2$s€</string>
<string name="cos_unified_title">Εκπτωτικό κουπόνι COSMOTE SuperMarket Deals!</string>
<string name="cos_unified_subtitle">Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών.</string>
<string name="cos_unified_subtitle">Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών αξίας <![CDATA[<b>%1$s€</b>]]>.</string>
<string name="cos_markets">Δες τα supermarket</string>
<string name="cos_show_market_coupons">Εμφάνιση κουπονιών</string>
<string name="cos_hide_market_coupons">Απόκρυψη κουπονιών</string>
<string name="cos_show_market_coupons">Εμφάνιση προσφορών</string>
<string name="cos_hide_market_coupons">Απόκρυψη προσφορών</string>
<string name="cos_market_terms">1. Το εκπτωτικό κουπόνι ισχύει έως την ημερομηνία που αναφέρεται παραπάνω.\n
2. To εκπτωτικό κουπόνι αφορά στα ενεργά κουπόνια προσφορών όπως αναφέρονται παραπάνω.\n
3. Το εκπτωτικό κουπόνι μπορεί να χρησιμοποιηθεί σε μια μόνο συναλλαγή.\n
......