Panagiotis Triantafyllou

refactor code

Showing 58 changed files with 245 additions and 1318 deletions
# {@link ly.warp.sdk.utils.WarplyProperty}
# The app uuid the warply sdk need to connect to the engage server
# dev b13ade8ef743468b89a7aaa8efbfc468
# prod b13ade8ef743468b89a7aaa8efbfc468
Uuid=b13ade8ef743468b89a7aaa8efbfc468
# dev d5f9038f46374666a1f4e1039d89f608
# prod d5f9038f46374666a1f4e1039d89f608
# dev cosmote f83dfde1145e4c2da69793abb2f579af
# prod cosmote 0086a2088301440792091b9f814c2267
Uuid=d5f9038f46374666a1f4e1039d89f608
# If we need to see logs in Logcat
Debug=true
......@@ -11,11 +14,9 @@ Debug=true
# Production or Development environment of the engage server
# Production: https://engage.warp.ly
# Development: https://engage-stage.warp.ly
BaseURL=https://engage-stage.warp.ly
# Production: https://magenta.supermarketdeals.eu/
# Development: https://magenta-dev.supermarketdeals.eu/
SupermarketsURL=https://magenta-dev.supermarketdeals.eu/
# DEH Production: https://engage-prod.dei.gr
# DEH Development: https://engage-uat.dei.gr
BaseURL=https://engage-prod.dei.gr
# For Verify Ticket request
VerifyURL=/partners/cosmote/verify
......
No preview for this file type
......@@ -8,7 +8,6 @@
android:id="@+id/iv_splash"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:scaleType="centerCrop"
android:src="@drawable/ic_cosmote_logo_horizontal_grey" />
android:scaleType="fitCenter"
android:src="@drawable/ic_logo" />
</RelativeLayout>
......
......@@ -630,11 +630,9 @@ public enum Warply {
try {
PackageInfo info = mContext.getPackageManager().getPackageInfo(mContext.getApplicationContext().getPackageName(), 0);
if (WarpUtils.getTrackersEnabled(mContext)) {
object.putOpt("app_version", info.versionName);
object.putOpt("sdk_version", WarpConstants.SDK_VERSION);
object.putOpt("app_build", info.versionCode);
}
object.putOpt("app_version", info.versionName);
object.putOpt("sdk_version", WarpConstants.SDK_VERSION);
object.putOpt("app_build", info.versionCode);
// object.putOpt("bundle_identifier", mContext.get().getApplicationContext().getPackageName());
if (!WarpUtils.getHasApplicationInfo(mContext)) {
WarpUtils.setHasApplicationInfo(mContext, true);
......
......@@ -210,23 +210,23 @@ public class ProfileActivity extends Activity implements View.OnClickListener, O
private void filterCoupons(String status) {
// Reset all filter button styles
mBtnFilterActive.setBackgroundResource(R.drawable.shape_transparent_black_border);
mBtnFilterActive.setTextColor(getResources().getColor(R.color.black2));
mBtnFilterActive.setTextColor(getResources().getColor(R.color.custom_black2));
mBtnFilterFavorites.setBackgroundResource(R.drawable.shape_transparent_black_border);
mBtnFilterFavorites.setTextColor(getResources().getColor(R.color.black2));
mBtnFilterFavorites.setTextColor(getResources().getColor(R.color.custom_black2));
mBtnFilterRedeemed.setBackgroundResource(R.drawable.shape_transparent_black_border);
mBtnFilterRedeemed.setTextColor(getResources().getColor(R.color.black2));
mBtnFilterRedeemed.setTextColor(getResources().getColor(R.color.custom_black2));
// Set selected filter button style
if (CouponItem.STATUS_ACTIVE.equals(status)) {
mBtnFilterActive.setBackgroundResource(R.drawable.shape_cos_black);
mBtnFilterActive.setBackgroundResource(R.drawable.shape_rectangle_rounded_black);
mBtnFilterActive.setTextColor(Color.WHITE);
} else if (CouponItem.STATUS_FAVORITE.equals(status)) {
mBtnFilterFavorites.setBackgroundResource(R.drawable.shape_cos_black);
mBtnFilterFavorites.setBackgroundResource(R.drawable.shape_rectangle_rounded_black);
mBtnFilterFavorites.setTextColor(Color.WHITE);
} else if (CouponItem.STATUS_REDEEMED.equals(status)) {
mBtnFilterRedeemed.setBackgroundResource(R.drawable.shape_cos_black);
mBtnFilterRedeemed.setBackgroundResource(R.drawable.shape_rectangle_rounded_black);
mBtnFilterRedeemed.setTextColor(Color.WHITE);
}
......
......@@ -34,7 +34,6 @@ import android.content.pm.PackageManager;
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;
......@@ -81,8 +80,6 @@ public class WarpViewActivity extends WarpBaseActivity {
// ===========================================================
private WarpView mWarpView;
private static Handler metersHandler;
private static boolean mWebviewSupermarket = false;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -91,8 +88,6 @@ public class WarpViewActivity extends WarpBaseActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
metersHandler = new Handler();
mWebviewSupermarket = false;
WarplySessionManager.onCreateActivity(this);
initViews();
Warply.getInitializer(this).init();
......@@ -112,16 +107,6 @@ public class WarpViewActivity extends WarpBaseActivity {
WarplySessionManager.onStartActivity(this);
if (!EventBus.getDefault().isRegistered(this))
EventBus.getDefault().register(this);
if (mWarpView != null) {
if (getWebviewSupermarket()) {
String scriptSourceInit = "webviewDidFocusRefresh(" + String.valueOf(getWebviewSupermarket()) + ");";
mWarpView.evaluateJavascript(scriptSourceInit, s -> {
});
setWebviewSupermarket(false);
}
}
}
@Override
......@@ -134,10 +119,7 @@ public class WarpViewActivity extends WarpBaseActivity {
@Override
protected void onDestroy() {
super.onDestroy();
if (metersHandler != null) metersHandler.removeCallbacksAndMessages(null);
// WarplyManager.sendSteps(this);
WarpUtils.setWebviewParams(this, new JSONObject());
setWebviewSupermarket(false);
}
@Override
......@@ -166,7 +148,7 @@ public class WarpViewActivity extends WarpBaseActivity {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 3002 || requestCode == 3003) {
if (requestCode == 3002) {
WarplyWebviewActivityCallbackEventModel webviewCallbackEventModel = new WarplyWebviewActivityCallbackEventModel();
webviewCallbackEventModel.setRequestId(requestCode);
webviewCallbackEventModel.setResponseCode(resultCode == RESULT_OK ? "enabled" : "disabled");
......@@ -311,12 +293,4 @@ public class WarpViewActivity extends WarpBaseActivity {
}
};
public static boolean getWebviewSupermarket() {
return mWebviewSupermarket;
}
public static void setWebviewSupermarket(boolean isLoaded) {
mWebviewSupermarket = isLoaded;
}
}
\ No newline at end of file
......
......@@ -5,11 +5,8 @@ import android.os.Bundle;
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 android.widget.Toast;
import androidx.annotation.NonNull;
......@@ -19,16 +16,12 @@ import org.json.JSONObject;
import ly.warp.sdk.R;
import ly.warp.sdk.activities.HomeActivity;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyManager;
public class HomeFragment extends Fragment implements View.OnClickListener {
private RelativeLayout mOptionOne, mOptionTwo, mOptionThree, mPbLoading;
private TextView mTvUsername, mTvUser;
private EditText mEtGuid;
private LinearLayout mLlAuthLogin, mLlAuthLogout, mRlSmFlow, mRlSmMap;
private RelativeLayout mPbLoading;
private LinearLayout mRlSmFlow;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
......@@ -38,51 +31,15 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mOptionOne = view.findViewById(R.id.info_button);
TextView mOptionOneText = mOptionOne.findViewById(R.id.option_text);
ImageView mOptionOneImage = mOptionOne.findViewById(R.id.option_icon);
mOptionOneText.setText("2");
mOptionOneImage.setImageResource(R.drawable.mobile_option);
mOptionTwo = view.findViewById(R.id.info_button2);
TextView mOptionTwoText = mOptionTwo.findViewById(R.id.option_text);
ImageView mOptionTwoImage = mOptionTwo.findViewById(R.id.option_icon);
mOptionTwoText.setText("1");
mOptionTwoImage.setImageResource(R.drawable.phone_option);
mOptionThree = view.findViewById(R.id.info_button3);
TextView mOptionThreeText = mOptionThree.findViewById(R.id.option_text);
ImageView mOptionThreeImage = mOptionThree.findViewById(R.id.option_icon);
mOptionThreeText.setText("1");
mOptionThreeImage.setImageResource(R.drawable.tv_option);
mTvUsername = view.findViewById(R.id.welcome_user_txt);
mPbLoading = view.findViewById(R.id.pb_loading);
mPbLoading.setOnTouchListener((v, event) -> true);
mEtGuid = view.findViewById(R.id.et_login);
mLlAuthLogin = view.findViewById(R.id.ll_auth_login);
mLlAuthLogin.setOnClickListener(this);
mLlAuthLogout = view.findViewById(R.id.ll_auth_logout);
mLlAuthLogout.setOnClickListener(this);
mTvUser = view.findViewById(R.id.tv_login);
mRlSmFlow = view.findViewById(R.id.ll_sm_flow);
mRlSmFlow.setOnClickListener(this);
mRlSmMap = view.findViewById(R.id.ll_sm_map);
mRlSmMap.setOnClickListener(this);
if (!WarplyDBHelper.getInstance(getActivity()).isTableNotEmpty("auth")) {
mTvUser.setVisibility(View.GONE);
mLlAuthLogout.setVisibility(View.GONE);
mLlAuthLogin.setVisibility(View.VISIBLE);
mEtGuid.setVisibility(View.VISIBLE);
} else {
mEtGuid.setVisibility(View.GONE);
mLlAuthLogin.setVisibility(View.GONE);
mLlAuthLogout.setVisibility(View.VISIBLE);
mTvUser.setVisibility(View.VISIBLE);
}
// 6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826
// prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282, live 3000136179
mPbLoading.setVisibility(View.VISIBLE);
WarplyManager.getDehUser("aggeliki@warp.ly", mLoginReceiver);
}
@Override
......@@ -92,27 +49,24 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
@Override
public void onClick(View view) {
if (view.getId() == R.id.ll_auth_login) {
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
//prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282, live 3000136179
// if (view.getId() == R.id.ll_auth_login) {
// //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
// //prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282, live 3000136179
//// mPbLoading.setVisibility(View.VISIBLE);
//// WarplyManager.getDehUser(mEtGuid.getText().toString(), mLoginReceiver);
//
// Intent myIntent = new Intent(getContext(), HomeActivity.class);
// startActivity(myIntent);
// return;
// }
// if (view.getId() == R.id.ll_auth_logout) {
// mPbLoading.setVisibility(View.VISIBLE);
// WarplyManager.getCosmoteUser(mEtGuid.getText().toString(), mLoginReceiver);
// WarplyManager.logout(mLogoutReceiver);
// return;
// }
if (view.getId() == R.id.ll_sm_flow) {
Intent myIntent = new Intent(getContext(), HomeActivity.class);
startActivity(myIntent);
return;
}
if (view.getId() == R.id.ll_auth_logout) {
mPbLoading.setVisibility(View.VISIBLE);
WarplyManager.logout(mLogoutReceiver);
return;
}
if (view.getId() == R.id.ll_sm_flow) {
WarplyManagerHelper.openSupermarketsFlow(getContext());
return;
}
if (view.getId() == R.id.ll_sm_map) {
WarplyManagerHelper.openSupermarketsMap(getContext());
}
}
......@@ -124,11 +78,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
private final CallbackReceiver<JSONObject> mLogoutReceiver = new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
mTvUser.setVisibility(View.GONE);
mPbLoading.setVisibility(View.GONE);
mLlAuthLogout.setVisibility(View.GONE);
mLlAuthLogin.setVisibility(View.VISIBLE);
mEtGuid.setVisibility(View.VISIBLE);
Toast.makeText(getActivity(), "LOGOUT SUCCESS", Toast.LENGTH_SHORT).show();
}
......@@ -143,11 +93,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
@Override
public void onSuccess(JSONObject result) {
mPbLoading.setVisibility(View.GONE);
mLlAuthLogin.setVisibility(View.GONE);
mEtGuid.setVisibility(View.GONE);
mLlAuthLogout.setVisibility(View.VISIBLE);
mTvUser.setVisibility(View.VISIBLE);
mTvUser.setText(mEtGuid.getText().toString());
Toast.makeText(getActivity(), "LOGIN SUCCESS", Toast.LENGTH_SHORT).show();
}
@Override
......
/*
* 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;
import java.util.HashMap;
/**
* Created by Panagiotis Triantafyllou on 21-Oct-22.
*/
public class LoyaltySDKDynatraceEventModel {
private String eventName;
private HashMap<String, String> parameters;
public LoyaltySDKDynatraceEventModel() {
this.eventName = "";
this.parameters = new HashMap();
}
public String getEventName() {
return eventName;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
public HashMap<String, String> getParameters() {
return parameters;
}
public void setParameter(String key, String value) {
this.parameters.put(key, value);
}
}
/*
* 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;
import java.util.HashMap;
/**
* Created by Panagiotis Triantafyllou on 25-May-22.
*/
public class LoyaltySDKFirebaseEventModel {
private String eventName;
private HashMap<String, String> parameters;
public LoyaltySDKFirebaseEventModel() {
this.eventName = "";
this.parameters = new HashMap();
}
public String getEventName() {
return eventName;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
public HashMap<String, String> getParameters() {
return parameters;
}
public void setParameter(String key, String value) {
this.parameters.put(key, value);
}
}
......@@ -31,16 +31,14 @@ public interface ApiService {
// ===========================================================
@Headers("Content-Type: application/json")
@POST("/partners/oauth/{appUuid}/token")
Call<ResponseBody> cosmoteUser(@Path("appUuid") String appUuid,
@Body RequestBody request,
@POST("/partners/dei/app_login")
Call<ResponseBody> dehUser(@Body RequestBody request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
@Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
@Header(WarpConstants.HEADER_CHANNEL) String channel,
@Header(WarpConstants.HEADER_WEB_ID) String webId,
@Header(WarpConstants.HEADER_SIGNATURE) String signature,
@Header(WarpConstants.HEADER_AUTHORIZATION) String basic);
@Header(WarpConstants.HEADER_SIGNATURE) String signature);
@Headers("Content-Type: application/json")
@POST("/partners/cosmote/verify")
......
package ly.warp.sdk.services;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.work.Worker;
import androidx.work.WorkerParameters;
/**
* Created by Panagiotis Triantafyllou on 05/Sept/2022.
*/
public class EventRewardsCouponsService extends Worker {
public EventRewardsCouponsService(@NonNull Context context, @NonNull WorkerParameters workerParams) {
super(context, workerParams);
}
@NonNull
@Override
public Result doWork() {
return Result.success();
}
}
......@@ -25,26 +25,13 @@
package ly.warp.sdk.utils;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.os.Build;
import android.util.Log;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import ly.warp.sdk.utils.constants.GCMConstants;
/**
* Utilities for device registration.
......@@ -55,164 +42,10 @@ import ly.warp.sdk.utils.constants.GCMConstants;
public final class GCMRegistrar {
private static final String TAG = "GCMRegistrar";
private static final String BACKOFF_MS = "backoff_ms";
private static final String GSF_PACKAGE = "com.google.android.gsf";
private static final String PREFERENCES = "com.google.android.gcm";
private static final int DEFAULT_BACKOFF_MS = 3000;
private static final String PROPERTY_REG_ID = "regId";
private static final String PROPERTY_APP_VERSION = "appVersion";
private static final String PROPERTY_ON_SERVER = "onServer";
/**
* Checks if the device has the proper dependencies installed.
* <p/>
* This method should be called when the application starts to verify that
* the device supports GCM.
*
* @param context application context.
* @throws UnsupportedOperationException if the device does not support GCM.
*/
public static void checkDevice(Context context) {
int version = Build.VERSION.SDK_INT;
if (version < 8) {
throw new UnsupportedOperationException("Device must be at least "
+ "API Level 8 (instead of " + version + ")");
}
PackageManager packageManager = context.getPackageManager();
try {
packageManager.getPackageInfo(GSF_PACKAGE, 0);
} catch (NameNotFoundException e) {
throw new UnsupportedOperationException(
"Device does not have package " + GSF_PACKAGE);
}
}
/**
* Checks that the application manifest is properly configured.
* <p/>
* A proper configuration means:
* <ol>
* <li>It creates a custom permission called
* {@code PACKAGE_NAME.permission.C2D_MESSAGE}.
* <li>It defines at least one {@link BroadcastReceiver} with category
* {@code PACKAGE_NAME}.
* <li>The {@link BroadcastReceiver}(s) uses the
* {@value ly.warp.sdk.utils.constants.GCMConstants#PERMISSION_GCM_INTENTS} permission.
* <li>The {@link BroadcastReceiver}(s) handles the 3 GCM intents (
* {@value ly.warp.sdk.utils.constants.GCMConstants#INTENT_FROM_GCM_MESSAGE},
* {@value ly.warp.sdk.utils.constants.GCMConstants#INTENT_FROM_GCM_REGISTRATION_CALLBACK}, and
* {@value ly.warp.sdk.utils.constants.GCMConstants#INTENT_FROM_GCM_LIBRARY_RETRY}).
* </ol>
* ...where {@code PACKAGE_NAME} is the application package.
* <p/>
* This method should be used during development time to verify that the
* manifest is properly set up, but it doesn't need to be called once the
* application is deployed to the users' devices.
*
* @param context application context.
* @throws IllegalStateException if any of the conditions above is not met.
*/
public static void checkManifest(Context context) {
PackageManager packageManager = context.getPackageManager();
String packageName = context.getPackageName();
String permissionName = packageName + ".permission.C2D_MESSAGE";
// check permission
try {
packageManager.getPermissionInfo(permissionName,
PackageManager.GET_PERMISSIONS);
} catch (NameNotFoundException e) {
throw new IllegalStateException(
"Application does not define permission " + permissionName);
}
// check receivers
PackageInfo receiversInfo;
try {
receiversInfo = packageManager.getPackageInfo(packageName,
PackageManager.GET_RECEIVERS);
} catch (NameNotFoundException e) {
throw new IllegalStateException(
"Could not get receivers for package " + packageName);
}
ActivityInfo[] receivers = receiversInfo.receivers;
if (receivers == null || receivers.length == 0) {
throw new IllegalStateException("No receiver for package "
+ packageName);
}
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "number of receivers for " + packageName + ": "
+ receivers.length);
}
Set<String> allowedReceivers = new HashSet<String>();
for (ActivityInfo receiver : receivers) {
if (GCMConstants.PERMISSION_GCM_INTENTS.equals(receiver.permission)) {
allowedReceivers.add(receiver.name);
}
}
if (allowedReceivers.isEmpty()) {
throw new IllegalStateException("No receiver allowed to receive "
+ GCMConstants.PERMISSION_GCM_INTENTS);
}
checkReceiver(context, allowedReceivers,
GCMConstants.INTENT_FROM_GCM_REGISTRATION_CALLBACK);
checkReceiver(context, allowedReceivers,
GCMConstants.INTENT_FROM_GCM_MESSAGE);
}
private static void checkReceiver(Context context,
Set<String> allowedReceivers, String action) {
PackageManager pm = context.getPackageManager();
String packageName = context.getPackageName();
Intent intent = new Intent(action);
intent.setPackage(packageName);
List<ResolveInfo> receivers = pm.queryBroadcastReceivers(intent,
PackageManager.GET_INTENT_FILTERS);
if (receivers.isEmpty()) {
throw new IllegalStateException("No receivers for action " + action);
}
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "Found " + receivers.size() + " receivers for action "
+ action);
}
// make sure receivers match
for (ResolveInfo receiver : receivers) {
String name = receiver.activityInfo.name;
if (!allowedReceivers.contains(name)) {
throw new IllegalStateException("Receiver " + name
+ " is not set with permission "
+ GCMConstants.PERMISSION_GCM_INTENTS);
}
}
}
/**
* Initiate messaging registration for the current application.
* <p/>
* The result will be returned as an
* {@link GCMConstants#INTENT_FROM_GCM_REGISTRATION_CALLBACK} intent with
* either a {@link GCMConstants#EXTRA_REGISTRATION_ID} or
* {@link GCMConstants#EXTRA_ERROR}.
*
* @param context application context.
* @param senderIds Google Project ID of the accounts authorized to send messages
* to this application.
* @throws IllegalStateException if device does not have all GCM dependencies installed.
*/
public static void register(Context context, String... senderIds) {
// setRetryBroadcastReceiver(context);
GCMRegistrar.resetBackoff(context);
// internalRegister(context, senderIds);
}
/**
* Unregister the application.
* <p/>
* The result will be returned as an
* {@link GCMConstants#INTENT_FROM_GCM_REGISTRATION_CALLBACK} intent with an
* {@link GCMConstants#EXTRA_UNREGISTERED} extra.
*/
public static void unregister(Context context) {
GCMRegistrar.resetBackoff(context);
}
/**
* Gets the current registration id for application on GCM service.
......@@ -239,14 +72,6 @@ public final class GCMRegistrar {
}
/**
* Checks whether the application was successfully registered on GCM
* service.
*/
public static boolean isRegistered(Context context) {
return getRegistrationId(context).length() > 0;
}
/**
* Clears the registration id in the persistence store.
*
* @param context application's context.
......@@ -275,27 +100,6 @@ public final class GCMRegistrar {
}
/**
* Sets whether the device was successfully registered in the server side.
*/
public static void setRegisteredOnServer(Context context, boolean flag) {
final SharedPreferences prefs = getGCMPreferences(context);
Log.v(TAG, "Setting registered on server status as: " + flag);
Editor editor = prefs.edit();
editor.putBoolean(PROPERTY_ON_SERVER, flag);
editor.commit();
}
/**
* Checks whether the device was successfully registered in the server side.
*/
public static boolean isRegisteredOnServer(Context context) {
final SharedPreferences prefs = getGCMPreferences(context);
boolean isRegistered = prefs.getBoolean(PROPERTY_ON_SERVER, false);
Log.v(TAG, "Is registered on server: " + isRegistered);
return isRegistered;
}
/**
* Gets the application version.
*/
private static int getAppVersion(Context context) {
......@@ -309,45 +113,6 @@ public final class GCMRegistrar {
}
}
/**
* Resets the backoff counter.
* <p/>
* This method should be called after a GCM call succeeds.
*
* @param context application's context.
*/
public static void resetBackoff(Context context) {
Log.d(TAG, "resetting backoff for " + context.getPackageName());
setBackoff(context, DEFAULT_BACKOFF_MS);
}
/**
* Gets the current backoff counter.
*
* @param context application's context.
* @return current backoff counter, in milliseconds.
*/
public static int getBackoff(Context context) {
final SharedPreferences prefs = getGCMPreferences(context);
return prefs.getInt(BACKOFF_MS, DEFAULT_BACKOFF_MS);
}
/**
* Sets the backoff counter.
* <p/>
* This method should be called after a GCM call fails, passing an
* exponential value.
*
* @param context application's context.
* @param backoff new backoff counter, in milliseconds.
*/
public static void setBackoff(Context context, int backoff) {
final SharedPreferences prefs = getGCMPreferences(context);
Editor editor = prefs.edit();
editor.putInt(BACKOFF_MS, backoff);
editor.commit();
}
private static SharedPreferences getGCMPreferences(Context context) {
return context.getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE);
}
......
......@@ -70,13 +70,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.TimeUnit;
import java.util.zip.GZIPInputStream;
import ly.warp.sdk.R;
import ly.warp.sdk.services.EventRefreshDeviceTokenService;
import ly.warp.sdk.utils.constants.WarpConstants;
......@@ -103,7 +101,7 @@ public class WarpUtils {
private static final String PREFERENCES_KEY_GCM_ENABLED = PREFERENCES_PREFIX
+ "gcm_enabled";
private static final String PREFERENCES_KEY_LAST_APPLICATION_UUID = PREFERENCES_PREFIX
+ "last_appplixation_uuid";
+ "last_application_uuid";
private static final String PREFERENCES_KEY_TIMESTAMP = PREFERENCES_PREFIX
+ "timestamp";
private static final String PREFERENCES_KEY_DEVICE_TOKEN = PREFERENCES_PREFIX
......@@ -138,28 +136,10 @@ public class WarpUtils {
+ "device_info_data";
private static final String PREFERENCES_KEY_LIFECYCLE_ANALYTICS_ENABLED = PREFERENCES_PREFIX
+ "lifecycle_analytics_enabled";
private static final String PREFERENCES_KEY_GIFTS_POPUP = PREFERENCES_PREFIX
+ "gifts_popup";
private static final String PREFERENCES_KEY_MORE_POPUP = PREFERENCES_PREFIX
+ "more_popup";
private static final String PREFERENCES_KEY_USER_TAG = PREFERENCES_PREFIX
+ "user_badge";
private static final String PREFERENCES_KEY_WEBVIEW_PARAMS = PREFERENCES_PREFIX
+ "webview_params";
private static final String PREFERENCES_STEPS_COUNTER = PREFERENCES_PREFIX
+ "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 final String PREFERENCES_TRACKERS_ENABLED = PREFERENCES_PREFIX
+ "trackers_enabled";
private static final String PREFERENCES_KEY_LANGUAGE = PREFERENCES_PREFIX
+ "language";
private static final String PREFERENCES_KEY_STEPS = PREFERENCES_PREFIX
+ "steps";
private static final String PREFERENCES_KEY_STEPS_MANUALLY_STOPPED = PREFERENCES_PREFIX
+ "steps_manually_stopped";
private static final String PREFERENCES_KEY_JWT_ENABLED = PREFERENCES_PREFIX
+ "jwt_enabled";
private static final String PREFERENCES_KEY_APP_LOCALE = PREFERENCES_PREFIX
......@@ -195,36 +175,6 @@ public class WarpUtils {
editor.apply();
}
public static boolean getIsSteps(Context context) {
return getPreferences(context).getBoolean(PREFERENCES_KEY_STEPS, false);
}
public static void setIsSteps(Context context, boolean isSteps) {
SharedPreferences.Editor editor = getPreferences(context).edit();
editor.putBoolean(PREFERENCES_KEY_STEPS, isSteps);
editor.apply();
}
public static boolean getIsStepsManuallyStopped(Context context) {
return getPreferences(context).getBoolean(PREFERENCES_KEY_STEPS_MANUALLY_STOPPED, false);
}
public static void setIsStepsManuallyStopped(Context context, boolean isManuallyStopped) {
SharedPreferences.Editor editor = getPreferences(context).edit();
editor.putBoolean(PREFERENCES_KEY_STEPS_MANUALLY_STOPPED, isManuallyStopped);
editor.apply();
}
public static String getUserTag(Context context) {
return getPreferences(context).getString(PREFERENCES_KEY_USER_TAG, "");
}
public static void setUserTag(Context context, String userTag) {
SharedPreferences.Editor editor = getPreferences(context).edit();
editor.putString(PREFERENCES_KEY_USER_TAG, userTag);
editor.apply();
}
public static String getLanguage(Context context) {
return getPreferences(context).getString(PREFERENCES_KEY_LANGUAGE, "el");
}
......@@ -235,16 +185,6 @@ public class WarpUtils {
editor.apply();
}
public static boolean getUserNonTelco(Context context) {
return getPreferences(context).getBoolean(PREFERENCES_KEY_USER_NON_TELCO, false);
}
public static void setUserNonTelco(Context context, boolean userNonTelco) {
SharedPreferences.Editor editor = getPreferences(context).edit();
editor.putBoolean(PREFERENCES_KEY_USER_NON_TELCO, userNonTelco);
editor.apply();
}
/**
* Method used to return the token of this device for the GCM service
*
......@@ -255,7 +195,6 @@ public class WarpUtils {
}
public static void setRegistrationGCM(Context context, String registrationGCM) {
SharedPreferences.Editor editor = getPreferences(context).edit();
editor.putString(PREFERENCES_KEY_REGISTRATION_GCM, registrationGCM);
editor.apply();
......@@ -283,36 +222,10 @@ public class WarpUtils {
editor.apply();
}
public static boolean getGiftsPopup(Context context) {
SharedPreferences prefs = getPreferences(context);
return prefs.getBoolean(PREFERENCES_KEY_GIFTS_POPUP, true);
}
public static void setGiftsPopup(Context context, boolean visible) {
SharedPreferences.Editor editor = getPreferences(context).edit();
editor.putBoolean(PREFERENCES_KEY_GIFTS_POPUP, visible);
editor.apply();
}
public static boolean getMorePopup(Context context) {
SharedPreferences prefs = getPreferences(context);
return prefs.getBoolean(PREFERENCES_KEY_MORE_POPUP, true);
}
public static void setMorePopup(Context context, boolean visible) {
SharedPreferences.Editor editor = getPreferences(context).edit();
editor.putBoolean(PREFERENCES_KEY_MORE_POPUP, visible);
editor.apply();
}
public static boolean isRegisteredWarply(Context context) {
return !("".equalsIgnoreCase(getWebId(context)));
}
public static void invalidateRegistrationWarply(Context context) {
setWebId(context, "");
}
private static SharedPreferences getPreferences(Context context) {
if (_prefs == null) {
try {
......@@ -708,39 +621,6 @@ public class WarpUtils {
return prefs.getString(PREFERENCES_KEY_WEBVIEW_PARAMS, "");
}
public static synchronized void setStepsCounter(Context context, int counter) {
SharedPreferences.Editor editor = getPreferences(context).edit();
editor.putInt(PREFERENCES_STEPS_COUNTER, counter);
editor.apply();
}
public static synchronized int getStepsCounter(Context context) {
SharedPreferences prefs = getPreferences(context);
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 void setTrackersEnabled(Context context, boolean isEnabled) {
SharedPreferences.Editor editor = getPreferences(context).edit();
editor.putBoolean(PREFERENCES_TRACKERS_ENABLED, isEnabled);
editor.apply();
}
public static boolean getTrackersEnabled(Context context) {
SharedPreferences prefs = getPreferences(context);
return prefs.getBoolean(PREFERENCES_TRACKERS_ENABLED, false);
}
public static JSONObject getDeviceInfoObject(Context context) {
SharedPreferences prefs = getPreferences(context);
try {
......
......@@ -72,14 +72,11 @@ public class WarplyDeviceInfoCollector {
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext) == ConnectionResult.SUCCESS) {
//Google Play Services are available
try {
if (WarpUtils.getTrackersEnabled(mContext)) {
jObj.putOpt("platform", "android");
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("app_version", getAppVersion());
}
jObj.putOpt("platform", "android");
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("app_version", getAppVersion());
jObj.putOpt("registration_gcm", getRegistrationGCM());
jObj.putOpt("vendor", "google");
jObj.putOpt("unique_device_id", getUniqueDeviceId());
......@@ -91,14 +88,11 @@ public class WarplyDeviceInfoCollector {
} else {
//Google Play Services are not available, or not updated
try {
if (WarpUtils.getTrackersEnabled(mContext)) {
jObj.putOpt("platform", "android");
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("app_version", getAppVersion());
}
jObj.putOpt("platform", "android");
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("app_version", getAppVersion());
jObj.putOpt("vendor", "huawei");
jObj.putOpt("registration_gcm", getRegistrationGCM());
jObj.putOpt("unique_device_id", getUniqueDeviceId());
......@@ -122,14 +116,11 @@ public class WarplyDeviceInfoCollector {
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext) == ConnectionResult.SUCCESS) {
//Google Play Services are available
try {
if (WarpUtils.getTrackersEnabled(mContext)) {
jObj.putOpt("platform", "android");
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("app_version", getAppVersion());
}
jObj.putOpt("platform", "android");
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("app_version", getAppVersion());
jObj.putOpt("unique_device_id", getUniqueDeviceId());
jObj.putOpt("vendor", "google");
} catch (JSONException e) {
......@@ -140,14 +131,11 @@ public class WarplyDeviceInfoCollector {
} else {
//Google Play Services are not available, or not updated
try {
if (WarpUtils.getTrackersEnabled(mContext)) {
jObj.putOpt("platform", "android");
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("app_version", getAppVersion());
}
jObj.putOpt("platform", "android");
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("app_version", getAppVersion());
jObj.putOpt("unique_device_id", getUniqueDeviceId());
jObj.putOpt("vendor", "huawei");
} catch (JSONException e) {
......
......@@ -25,19 +25,15 @@
package ly.warp.sdk.utils;
import android.content.Context;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.utils.constants.WarpConstants;
import ly.warp.sdk.utils.managers.WarplyManager;
/**
......@@ -55,8 +51,7 @@ public class WarplyManagerHelper {
// ===========================================================
private static CouponList mCouponRedeemedList = new CouponList();
private static ArrayList<Campaign> mCampaignListAll = new ArrayList<Campaign>(),
mSupermarketCampaigns = new ArrayList<Campaign>();
private static ArrayList<Campaign> mCampaignListAll = new ArrayList<Campaign>();
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -66,20 +61,11 @@ public class WarplyManagerHelper {
// Methods
// ===========================================================
public static void setTrackersEnabled(Context context, boolean isEnabled) {
WarpUtils.setTrackersEnabled(context, isEnabled);
}
public static void setCampaignList(ArrayList<Campaign> campaignList) {
mCampaignListAll.clear();
mCampaignListAll.addAll(campaignList);
}
public static void setSupermarketCampaigns(ArrayList<Campaign> campaignList) {
mSupermarketCampaigns.clear();
mSupermarketCampaigns.addAll(campaignList);
}
public static void setCouponRedeemedList(CouponList couponRedeemedList) {
mCouponRedeemedList.clear();
mCouponRedeemedList.addAll(couponRedeemedList);
......@@ -140,78 +126,6 @@ public class WarplyManagerHelper {
return url;
}
public static void openSupermarketsFlow(Context context) {
if (mSupermarketCampaigns == null || mSupermarketCampaigns.isEmpty()) {
return;
}
JSONObject params = new JSONObject();
try {
params.putOpt("web_id", WarpUtils.getWebId(context));
params.putOpt("app_uuid", WarplyProperty.getAppUuid(context));
params.putOpt("api_key", WarpUtils.getApiKey(context));
params.putOpt("session_uuid", "");
params.putOpt("access_token", WarplyDBHelper.getInstance(context).getAuthValue("access_token"));
params.putOpt("refresh_token", WarplyDBHelper.getInstance(context).getAuthValue("refresh_token"));
params.putOpt("client_id", WarplyDBHelper.getInstance(context).getClientValue("client_id"));
params.putOpt("client_secret", WarplyDBHelper.getInstance(context).getClientValue("client_secret"));
params.putOpt("lan", WarpUtils.getApplicationLocale(context));
params.putOpt("dark", String.valueOf(WarpUtils.getIsDarkModeEnabled(context)));
} catch (JSONException e) {
e.printStackTrace();
}
WarpUtils.setWebviewParams(context, params);
context.startActivity(WarpViewActivity.createIntentFromURL(context, WarplyManagerHelper.constructCampaignUrl(mSupermarketCampaigns.get(0))));
}
public static void openSupermarketsMap(Context context) {
JSONObject params = new JSONObject();
try {
params.putOpt("web_id", WarpUtils.getWebId(context));
params.putOpt("app_uuid", WarplyProperty.getAppUuid(context));
params.putOpt("api_key", WarpUtils.getApiKey(context));
params.putOpt("session_uuid", "");
params.putOpt("access_token", WarplyDBHelper.getInstance(context).getAuthValue("access_token"));
params.putOpt("refresh_token", WarplyDBHelper.getInstance(context).getAuthValue("refresh_token"));
params.putOpt("client_id", WarplyDBHelper.getInstance(context).getClientValue("client_id"));
params.putOpt("client_secret", WarplyDBHelper.getInstance(context).getClientValue("client_secret"));
params.putOpt("map", "true");
params.putOpt("lan", WarpUtils.getApplicationLocale(context));
params.putOpt("dark", String.valueOf(WarpUtils.getIsDarkModeEnabled(context)));
} catch (JSONException e) {
e.printStackTrace();
}
WarpUtils.setWebviewParams(context, params);
context.startActivity(WarpViewActivity.createIntentFromURL(context, (WarplyProperty.getSupermarketsUrl(context) + WarpConstants.SUPERMARKETS_MAP)));
}
public static void openContest(Context context) {
final String mContestUrl = "https://warply.s3.amazonaws.com/dei/campaigns/DehEasterContest_stage/index.html";
JSONObject params = new JSONObject();
try {
params.putOpt("web_id", WarpUtils.getWebId(context));
params.putOpt("app_uuid", WarplyProperty.getAppUuid(context));
params.putOpt("api_key", WarpUtils.getApiKey(context));
params.putOpt("session_uuid", "");
params.putOpt("access_token", WarplyDBHelper.getInstance(context).getAuthValue("access_token"));
params.putOpt("refresh_token", WarplyDBHelper.getInstance(context).getAuthValue("refresh_token"));
params.putOpt("client_id", WarplyDBHelper.getInstance(context).getClientValue("client_id"));
params.putOpt("client_secret", WarplyDBHelper.getInstance(context).getClientValue("client_secret"));
params.putOpt("lan", WarpUtils.getApplicationLocale(context));
params.putOpt("dark", String.valueOf(WarpUtils.getIsDarkModeEnabled(context)));
} catch (JSONException e) {
e.printStackTrace();
}
WarpUtils.setWebviewParams(context, params);
context.startActivity(WarpViewActivity.createIntentFromURL(context, mContestUrl));
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
......
......@@ -49,7 +49,6 @@ public class WarplyProperty {
public static final String KEY_LOGIN_TYPE = "LoginType";
public static final String KEY_DL_URL_SCHEME = "DL_URL_SCHEME";
public static final String KEY_BASE_URL = "BaseURL";
public static final String KEY_SUPERMARKETS_URL = "SupermarketsURL";
public static final String KEY_VERIFY_URL = "VerifyURL";
// ===========================================================
......@@ -205,10 +204,6 @@ public class WarplyProperty {
return getWarplyProperty(context, KEY_BASE_URL);
}
public static String getSupermarketsUrl(Context context) {
return getWarplyProperty(context, KEY_SUPERMARKETS_URL);
}
public static String getVerifyUrl(Context context) {
return getWarplyProperty(context, KEY_VERIFY_URL);
}
......
package ly.warp.sdk.utils.managers;
import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.QuestionnaireEventModel;
import ly.warp.sdk.io.models.WarplyWebviewActivityCallbackEventModel;
import ly.warp.sdk.io.models.WarplyWebviewCallbackEventModel;
......@@ -10,8 +8,6 @@ import ly.warp.sdk.io.models.WarplyWebviewCallbackEventModel;
* Created by Panagiotis Triantafyllou on 26/Απρ/2022.
*/
public class WarplyEventBusManager {
private LoyaltySDKFirebaseEventModel fireEvent;
private LoyaltySDKDynatraceEventModel dynatraceEvent;
private WarplyWebviewCallbackEventModel webviewCallback;
private WarplyWebviewActivityCallbackEventModel webviewActivityCallback;
private QuestionnaireEventModel questionnaire;
......@@ -28,14 +24,6 @@ public class WarplyEventBusManager {
this.webviewActivityCallback = webviewActivityCallback;
}
public WarplyEventBusManager(LoyaltySDKFirebaseEventModel fireEvent) {
this.fireEvent = fireEvent;
}
public WarplyEventBusManager(LoyaltySDKDynatraceEventModel dynatraceEvent) {
this.dynatraceEvent = dynatraceEvent;
}
public WarplyWebviewCallbackEventModel getWarplyWebviewCallbackEventModel() {
return webviewCallback;
}
......
......@@ -32,8 +32,6 @@ import android.text.format.DateFormat;
import android.util.ArrayMap;
import androidx.annotation.NonNull;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
......@@ -42,7 +40,6 @@ import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -62,13 +59,11 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel;
import ly.warp.sdk.io.models.NewCampaign;
import ly.warp.sdk.io.models.RedeemedSMHistoryModel;
import ly.warp.sdk.io.request.WarplyRefreshTokenRequest;
import ly.warp.sdk.io.volley.ApiClient;
import ly.warp.sdk.io.volley.ApiService;
import ly.warp.sdk.services.EventRewardsCouponsService;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyDeviceInfoCollector;
......@@ -104,32 +99,18 @@ public class WarplyManager {
try {
newResult.putOpt("status", 1);
newResult.putOpt("message", "Success");
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_refresh_token_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onSuccess(newResult);
} catch (JSONException e) {
e.printStackTrace();
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_refresh_token_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_refresh_token_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
}
@Override
public void onFailure(int errorCode) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_refresh_token_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
if (errorCode == 401) {
WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteAuth();
WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteClient();
......@@ -143,25 +124,20 @@ public class WarplyManager {
WarpUtils.log("************* WARPLY Logout ********************");
WarpUtils.log("[WARP Trace] WARPLY Logout is active");
WarpUtils.log("**************************************************");
ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
String webId = WarpUtils.getWebId(Warply.getWarplyContext());
Map<String, Object> jsonParams = new ArrayMap<>();
if (WarpUtils.isJWTEnabled(Warply.getWarplyContext())) {
jsonParams.put("access_token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token"));
jsonParams.put("refresh_token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token"));
} else {
jsonParams.put("token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token"));
jsonParams.put("client_id", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id"));
jsonParams.put("client_secret", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret"));
}
// if (WarpUtils.isJWTEnabled(Warply.getWarplyContext())) {
jsonParams.put("access_token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token"));
jsonParams.put("refresh_token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token"));
// } else {
jsonParams.put("token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token"));
jsonParams.put("client_id", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id"));
jsonParams.put("client_secret", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret"));
// }
RequestBody loginRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParams)).toString());
Call<ResponseBody> logoutCall = WarpUtils.isJWTEnabled(Warply.getWarplyContext())
? service.logoutUserJwt(
WarplyProperty.getAppUuid(Warply.getWarplyContext()),
......@@ -182,53 +158,36 @@ public class WarplyManager {
webId,
WarpUtils.produceSignature(apiKey + timeStamp)
);
logoutCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
if (response.code() == 200 && response.body() != null) {
WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false);
WarpUtils.setUserTag(Warply.getWarplyContext(), "");
WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteAuth();
WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteClient();
JSONObject newResult = new JSONObject();
try {
newResult.putOpt("status", 1);
newResult.putOpt("message", "Success");
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_logout_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onSuccess(newResult);
} catch (JSONException e) {
e.printStackTrace();
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_logout_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_logout_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(response.code());
}
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_logout_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
});
}
public static void getDehUser(String guid, final CallbackReceiver<JSONObject> receiver) {
WarpUtils.log("************* WARPLY Cosmote User Request ********************");
WarpUtils.log("[WARP Trace] WARPLY Cosmote User Request is active");
public static void getDehUser(String email, final CallbackReceiver<JSONObject> receiver) {
WarpUtils.log("************* WARPLY Deh User Request ********************");
WarpUtils.log("[WARP Trace] WARPLY Deh User Request is active");
WarpUtils.log("**************************************************");
if (WarplyDBHelper.getInstance(Warply.getWarplyContext()).isTableNotEmpty("auth")) {
......@@ -251,20 +210,18 @@ public class WarplyManager {
String webId = WarpUtils.getWebId(Warply.getWarplyContext());
Map<String, Object> jsonParams = new ArrayMap<>();
jsonParams.put("user_identifier", guid);
jsonParams.put("email", email);
RequestBody loginRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParams)).toString());
Call<ResponseBody> loginCall = service.cosmoteUser(
WarplyProperty.getAppUuid(Warply.getWarplyContext()),
Call<ResponseBody> loginCall = service.dehUser(
loginRequest,
timeStamp,
"android:" + Warply.getWarplyContext().getPackageName(),
new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
"mobile",
webId,
WarpUtils.produceSignature(apiKey + timeStamp),
"Basic MVBQNFhCQzhFYTJBaUdCNkJWZGFGUERlTTNLQ3kzMjU6YzViMzAyZDY5N2FiNGY3NzhiNThhMTg0YzBkZWRmNGU="
WarpUtils.produceSignature(apiKey + timeStamp)
);
loginCall.enqueue(new Callback<ResponseBody>() {
......@@ -320,24 +277,14 @@ public class WarplyManager {
try {
newResult.putOpt("status", 1);
newResult.putOpt("message", "Success");
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_login_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onSuccess(newResult);
} catch (JSONException e) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_login_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
e.printStackTrace();
receiver.onFailure(2);
}
return;
}
WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false);
WarpUtils.setUserTag(Warply.getWarplyContext(), "");
ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
......@@ -383,43 +330,24 @@ public class WarplyManager {
try {
newResult.putOpt("status", 1);
newResult.putOpt("message", "Success");
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_login_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onSuccess(newResult);
} catch (JSONException e) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_login_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
e.printStackTrace();
receiver.onFailure(2);
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_login_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_login_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_login_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(response.code());
}
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_login_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
});
......@@ -571,10 +499,6 @@ public class WarplyManager {
}
if (jobjCampaignsResponse != null && jobjCampaignsResponse.has("status") && jobjCampaignsResponse.optString("status", "2").equals("1")) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_campaigns_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
JSONArray jCampaignsBody = null;
try {
jCampaignsBody = jobjCampaignsResponse.optJSONObject("context").optJSONObject("MAPP_CAMPAIGNING").optJSONArray("campaigns");
......@@ -652,16 +576,10 @@ public class WarplyManager {
});
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_campaigns_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// receiver.onFailure(2);
future.set(new ArrayList<Campaign>());
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_campaigns_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// receiver.onFailure(response.code());
// future.set(new ArrayList<Campaign>());
future.setException(new Throwable());
......@@ -670,9 +588,6 @@ public class WarplyManager {
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_campaigns_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// receiver.onFailure(2);
// future.set(new ArrayList<Campaign>());
future.setException(new Throwable());
......@@ -710,10 +625,6 @@ public class WarplyManager {
}
if (jobjCampaignsResponse != null && jobjCampaignsResponse.has("status") && jobjCampaignsResponse.optString("status", "2").equals("1")) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_campaigns_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
JSONArray jCampaignsBody = null;
try {
jCampaignsBody = jobjCampaignsResponse.optJSONObject("context").optJSONObject("MAPP_CAMPAIGNING").optJSONArray("campaigns");
......@@ -791,9 +702,6 @@ public class WarplyManager {
});
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_campaigns_personalized_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// receiver.onFailure(2);
future.set(new ArrayList<Campaign>());
}
......@@ -827,9 +735,6 @@ public class WarplyManager {
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_campaigns_personalized_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// receiver.onFailure(response.code());
// future.set(new ArrayList<Campaign>());
future.setException(new Throwable());
......@@ -838,9 +743,6 @@ public class WarplyManager {
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_campaigns_personalized_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// receiver.onFailure(2);
// future.set(new ArrayList<Campaign>());
future.setException(new Throwable());
......@@ -882,10 +784,6 @@ public class WarplyManager {
}
if (jobjCampaignsAvailabilityResponse != null && jobjCampaignsAvailabilityResponse.has("status") && jobjCampaignsAvailabilityResponse.optString("status", "2").equals("1")) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_available_coupons");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
final ExecutorService executorCampaignsAvailability = Executors.newFixedThreadPool(1);
final JSONObject finalJobjCampaignsAvailabilityResponse = jobjCampaignsAvailabilityResponse;
executorCampaignsAvailability.submit(() -> {
......@@ -902,15 +800,9 @@ public class WarplyManager {
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_available_coupons");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
future.set(new JSONObject());
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_available_coupons");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// future.set(new JSONObject());
future.setException(new Throwable());
}
......@@ -918,9 +810,6 @@ public class WarplyManager {
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_available_coupons");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// future.set(new JSONObject());
future.setException(new Throwable());
}
......@@ -960,9 +849,6 @@ public class WarplyManager {
e.printStackTrace();
}
if (jobjCouponsResponse != null && jobjCouponsResponse.has("status") && jobjCouponsResponse.optString("status", "2").equals("1")) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_user_sm_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
JSONArray jCouponsBody = null;
try {
jCouponsBody = jobjCouponsResponse.optJSONArray("result");
......@@ -994,15 +880,9 @@ public class WarplyManager {
future.set(redeemedSMHistoryModel);
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEventElse = new LoyaltySDKDynatraceEventModel();
dynatraceEventElse.setEventName("custom_error_user_sm_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEventElse));
future.set(new RedeemedSMHistoryModel());
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_sm_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
future.set(new RedeemedSMHistoryModel());
}
} else if (response.code() == 401) {
......@@ -1035,9 +915,6 @@ public class WarplyManager {
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_sm_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// future.set(new CouponList());
future.setException(new Throwable());
}
......@@ -1045,9 +922,6 @@ public class WarplyManager {
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_sm_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// future.set(new CouponList());
future.setException(new Throwable());
}
......@@ -1094,10 +968,6 @@ public class WarplyManager {
}
if (jobjCouponsResponse != null && jobjCouponsResponse.has("status") && jobjCouponsResponse.optString("status", "2").equals("1")) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_user_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
JSONArray jCouponsBody = null;
try {
jCouponsBody = jobjCouponsResponse.optJSONArray("result");
......@@ -1120,8 +990,6 @@ public class WarplyManager {
}
WarplyManagerHelper.setCouponRedeemedList(mCouponRedeemedList);
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventRewardsCouponsService.class).build();
WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
Collections.sort(mCouponRedeemedList, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate()));
......@@ -1130,15 +998,9 @@ public class WarplyManager {
future.set(mCouponRedeemedList);
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEventElse = new LoyaltySDKDynatraceEventModel();
dynatraceEventElse.setEventName("custom_error_user_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEventElse));
future.set(new CouponList());
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
future.set(new CouponList());
}
} else if (response.code() == 401) {
......@@ -1171,9 +1033,6 @@ public class WarplyManager {
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// future.set(new CouponList());
future.setException(new Throwable());
}
......@@ -1181,9 +1040,6 @@ public class WarplyManager {
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// future.set(new CouponList());
future.setException(new Throwable());
}
......@@ -1202,17 +1058,13 @@ public class WarplyManager {
Warply.INSTANCE.getSingleCampaign(null, url, new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_read_campaign_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
}
@Override
public void onFailure(int errorCode) {
if (errorCode == 301 || errorCode == 302 || errorCode == 307 || errorCode == 308) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_read_campaign_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
}
}
}, null);
......
......@@ -81,10 +81,7 @@ import java.util.Map;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.QuestionnaireEventModel;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyProperty;
......@@ -101,7 +98,6 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
private static final String URL_ACTION_MAIL = "mailto";
private static final String URL_ACTION_MARKET = "market";
private static final String URL_ACTION_INTENT = "intent";
private static final String URL_ACTION_MAPS = "geo";
private static final String URL_FALLBACK_MAPS = "https://www.google.com/maps/search/?api=1&query=";
private static final String URL_ACTION_MARKET_AUTHORITY = "play.google.com";
......@@ -175,7 +171,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
settings.setAllowUniversalAccessFromFileURLs(true);
settings.setSupportMultipleWindows(true);
// settings.setGeolocationDatabasePath(getContext().getFilesDir().getPath());
WarpView.this.addJavascriptInterface(new JSInterface(), "Cosmote");
WarpView.this.addJavascriptInterface(new JSInterface(), "DEH");
setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent));
setWebViewClient(new WarplyWebViewClient());
setWebChromeClient(new WarplyWebChromeClient());
......@@ -454,11 +450,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
public void sendMessage(String message) {
if (message.contains("event")) {
String[] parts = message.split(":");
if (parts[1].equals("webviewRefresh")) {
WarpViewActivity.setWebviewSupermarket(true);
} else if (parts[1].equals("closeArtwork")) {
WarpViewActivity.setWebviewSupermarket(false);
if (parts[1].equals("closeArtwork")) {
QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
questionnaireEvent.setName(parts[1]);
EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
......@@ -466,62 +458,6 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
WarpUtils.log("**************** WARPLY Webview Log START *****************");
WarpUtils.log(message);
WarpUtils.log("**************** WARPLY Webview Log END *****************");
} else if (parts[1].equals("loyalty_questionnaire_selected")) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName(parts[1]);
analyticsEvent.setParameter("completed", "true");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
} else if (parts[1].equals("loyalty_questionnaire_answer_again") || parts[1].equals("loyalty_questionnaire_answers_deleted")) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName(parts[1]);
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
} else if (parts[1].equals("loyalty_questionnaire_later")) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_questionnaire_selected");
analyticsEvent.setParameter("completed", "false");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
} else if (parts[1].equals("loyalty_sdk_offer_selected")) {
try {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_sdk_offer_selected");
analyticsEvent.setParameter("name", parts[2]);
analyticsEvent.setParameter("type", parts[3]);
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
} catch (Exception e) {
e.printStackTrace();
}
} else if (parts[1].equals("loyalty_offer_activated")) {
try {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_sdk_offer_selected");
analyticsEvent.setParameter("name", parts[2]);
analyticsEvent.setParameter("type", parts[3]);
analyticsEvent.setParameter("successful", parts[4]);
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
} catch (Exception e) {
e.printStackTrace();
}
} else if (parts[1].equals("unified_coupon_activated")) {
try {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_sdk_unified_activated");
analyticsEvent.setParameter("name", parts[2]);
analyticsEvent.setParameter("type", parts[3]);
analyticsEvent.setParameter("successful", parts[4]);
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
} catch (Exception e) {
e.printStackTrace();
}
} else if (parts[1].equals("time_spent_on_loyalty_sdk")) {
try {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("time_spent_on_loyalty_sdk");
analyticsEvent.setParameter("name", parts[2]);
analyticsEvent.setParameter("seconds", parts[3]);
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
} catch (Exception e) {
e.printStackTrace();
}
} else if (parts[1].equals("refreshToken")) {
try {
if (Warply.getWarplyContext() != null) {
......@@ -530,30 +466,6 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
} catch (Exception e) {
e.printStackTrace();
}
} else if (parts[1].equals("cancel_unified_success")) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_cancel_unified_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
} else if (parts[1].equals("cancel_unified_failed")) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_cancel_unified_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
} else if (parts[1].equals("create_unified_success")) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_create_unified_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
} else if (parts[1].equals("create_unified_failed")) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_create_unified_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
} else if (parts[1].equals("get_unified_success")) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_unified_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
} else if (parts[1].equals("get_unified_failed")) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_unified_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
}
}
}
......@@ -571,8 +483,8 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
builder.setTitle(getContext().getString(R.string.webview_permission_title));
builder.setMessage(getContext().getString(R.string.webview_permission_message))
.setCancelable(false)
.setPositiveButton(getContext().getString(R.string.lbl_take_photo_accept), (dialog, id) -> checkForPermissions(origin, callback))
.setNegativeButton(getContext().getString(R.string.lbl_take_photo_decline), (dialog, id) -> callback.invoke(origin, false, false));
.setPositiveButton(getContext().getString(R.string.lbl_ok), (dialog, id) -> checkForPermissions(origin, callback))
.setNegativeButton(getContext().getString(R.string.lbl_cancel), (dialog, id) -> callback.invoke(origin, false, false));
AlertDialog alert = builder.create();
alert.show();
}
......@@ -603,7 +515,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
geolocationOrigin = origin;
geolocationCallback = callback;
} else {
//TODO: show infromative popup and go to settings
//TODO: show informative popup and go to settings
}
}
}
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:autoMirrored="true">
<path
android:fillColor="@android:color/black"
android:pathData="M180,840Q156,840 138,822Q120,804 120,780L120,180Q120,156 138,138Q156,120 180,120L479,120L479,180L180,180Q180,180 180,180Q180,180 180,180L180,780Q180,780 180,780Q180,780 180,780L479,780L479,840L180,840ZM666,655L623,612L725,510L360,510L360,450L723,450L621,348L664,305L840,481L666,655Z"/>
</vector>
......@@ -3,5 +3,5 @@
android:shape="oval">
<corners android:radius="1000dp" />
<solid android:color="@color/pink" />
<solid android:color="@color/custom_pink" />
</shape>
\ No newline at end of file
......
......@@ -6,5 +6,5 @@
<solid android:color="@android:color/transparent" />
<stroke
android:width="1dp"
android:color="@color/black2" />
android:color="@color/custom_black2" />
</shape>
\ No newline at end of file
......
......@@ -6,5 +6,5 @@
<solid android:color="@color/white" />
<stroke
android:width="1dp"
android:color="@color/grey" />
android:color="@color/custom_grey" />
</shape>
\ No newline at end of file
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/pink3" />
<solid android:color="@color/custom_pink3" />
<size android:width="8dp" android:height="8dp" />
</shape>
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/grey2" />
<solid android:color="@color/custom_grey2" />
<size android:width="8dp" android:height="8dp" />
</shape>
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_cos_black_tr" android:state_pressed="true" />
<item android:drawable="@drawable/shape_cos_black" android:state_pressed="false" />
<item android:drawable="@drawable/shape_rectangle_rounded_black_tr" android:state_pressed="true" />
<item android:drawable="@drawable/shape_rectangle_rounded_black" android:state_pressed="false" />
</selector>
\ No newline at end of file
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_cos_green_tr" android:state_pressed="true" />
<item android:drawable="@drawable/shape_cos_green" android:state_pressed="false" />
<item android:drawable="@drawable/shape_rectangle_rounded_green_tr" android:state_pressed="true" />
<item android:drawable="@drawable/shape_rectangle_rounded_green" android:state_pressed="false" />
</selector>
\ No newline at end of file
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_rectangle_rounded_light_blue_tr" android:state_pressed="true" />
<item android:drawable="@drawable/shape_rectangle_rounded_light_blue" android:state_pressed="false" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:color="@color/cos_cyan" />
<item android:color="@color/cos_grey_dark" />
<item android:state_checked="true" android:color="@color/custom_cyan" />
<item android:color="@color/custom_grey_dark" />
</selector>
\ No newline at end of file
......
......@@ -5,5 +5,5 @@
<solid
android:width="2dp"
android:color="@color/black2" />
android:color="@color/custom_black2" />
</shape>
\ No newline at end of file
......
......@@ -5,5 +5,5 @@
<solid
android:width="2dp"
android:color="@color/black2_tr" />
android:color="@color/custom_black2_tr" />
</shape>
\ No newline at end of file
......
......@@ -5,5 +5,5 @@
<solid
android:width="2dp"
android:color="@color/cos_green12" />
android:color="@color/custom_green12" />
</shape>
\ No newline at end of file
......
......@@ -5,5 +5,5 @@
<solid
android:width="2dp"
android:color="@color/cos_green6_tr" />
android:color="@color/custom_green6_tr" />
</shape>
\ No newline at end of file
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="16dp" />
<solid
android:width="2dp"
android:color="@color/custom_light_blue" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="16dp" />
<solid
android:width="2dp"
android:color="@color/custom_light_blue" />
</shape>
\ No newline at end of file
......@@ -7,5 +7,5 @@
<stroke
android:width="1dp"
android:color="@color/black2" />
android:color="@color/custom_black2" />
</shape>
\ No newline at end of file
......
......@@ -7,5 +7,5 @@
<stroke
android:width="1dp"
android:color="@color/black2_tr" />
android:color="@color/custom_black2_tr" />
</shape>
\ No newline at end of file
......
......@@ -19,7 +19,7 @@
style="@style/BottomNavigationView"
android:background="@android:color/white"
app:itemTextColor="@drawable/selector_tab_title_color"
app:itemRippleColor="@color/cos_cyan"
app:itemRippleColor="@color/custom_cyan"
app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
......
......@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cos_grey_light">
android:background="@color/custom_grey_light">
<androidx.core.widget.NestedScrollView
android:id="@+id/home_scrollview"
......@@ -22,7 +22,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/cos_grey_light"
android:background="@color/custom_grey_light"
android:orientation="horizontal"
android:padding="16dp">
......@@ -71,7 +71,7 @@
android:id="@+id/dots_container"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/cos_grey_light"
android:background="@color/custom_grey_light"
android:gravity="center"
android:orientation="horizontal"
android:padding="4dp"
......@@ -99,7 +99,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="16sp"
tools:text="Top Offers (10)" />
......@@ -111,7 +111,7 @@
android:paddingHorizontal="16dp"
android:paddingVertical="5dp"
android:text="@string/demo_all"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="14sp" />
</LinearLayout>
......@@ -145,7 +145,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="16sp"
tools:text="Favorites (10)" />
......@@ -157,7 +157,7 @@
android:paddingHorizontal="16dp"
android:paddingVertical="5dp"
android:text="@string/demo_all"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="14sp" />
</LinearLayout>
......@@ -191,7 +191,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="16sp"
tools:text="Viability (10)" />
......@@ -203,7 +203,7 @@
android:paddingHorizontal="16dp"
android:paddingVertical="5dp"
android:text="@string/demo_all"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="14sp" />
</LinearLayout>
......@@ -237,7 +237,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="16sp"
tools:text="Family (10)" />
......@@ -249,7 +249,7 @@
android:paddingHorizontal="16dp"
android:paddingVertical="5dp"
android:text="@string/demo_all"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="14sp" />
</LinearLayout>
......@@ -283,7 +283,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="16sp"
tools:text="Food and Coffee (10)" />
......@@ -295,7 +295,7 @@
android:paddingHorizontal="16dp"
android:paddingVertical="5dp"
android:text="@string/demo_all"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="14sp" />
</LinearLayout>
......@@ -329,7 +329,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="16sp"
tools:text="Travelling (10)" />
......@@ -341,7 +341,7 @@
android:paddingHorizontal="16dp"
android:paddingVertical="5dp"
android:text="@string/demo_all"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="14sp" />
</LinearLayout>
......@@ -375,7 +375,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="16sp"
tools:text="Kids (10)" />
......@@ -387,7 +387,7 @@
android:paddingHorizontal="16dp"
android:paddingVertical="5dp"
android:text="@string/demo_all"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="14sp" />
</LinearLayout>
......@@ -422,7 +422,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="16sp"
tools:text="Purchases (10)" />
......@@ -434,7 +434,7 @@
android:paddingHorizontal="16dp"
android:paddingVertical="5dp"
android:text="@string/demo_all"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="14sp" />
</LinearLayout>
......
......@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cos_grey_light">
android:background="@color/custom_grey_light">
<androidx.core.widget.NestedScrollView
android:id="@+id/profile_scrollview"
......@@ -46,7 +46,7 @@
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:text="@string/demo_profile"
android:textColor="@color/black4"
android:textColor="@color/custom_black4"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
......@@ -57,7 +57,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:background="@color/cos_grey_light"
android:background="@color/custom_grey_light"
android:orientation="horizontal"
android:padding="16dp">
......@@ -117,7 +117,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="16sp"
tools:text="Προτάσεις για εσένα (5)" />
......@@ -129,7 +129,7 @@
android:paddingHorizontal="16dp"
android:paddingVertical="5dp"
android:text="@string/demo_all"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="14sp" />
</LinearLayout>
......@@ -160,7 +160,7 @@
android:layout_marginVertical="8dp"
android:paddingHorizontal="16dp"
android:text="@string/demo_my_coupons"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="16sp" />
<!-- Filter Buttons -->
......@@ -179,7 +179,7 @@
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:background="@drawable/shape_cos_black"
android:background="@drawable/shape_rectangle_rounded_black"
android:gravity="center"
android:paddingVertical="8dp"
android:text="@string/demo_active"
......@@ -196,7 +196,7 @@
android:gravity="center"
android:paddingVertical="8dp"
android:text="@string/demo_favorites"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="14sp" />
<TextView
......@@ -208,7 +208,7 @@
android:gravity="center"
android:paddingVertical="8dp"
android:text="@string/demo_redeemed"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="14sp" />
</LinearLayout>
......
......@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cos_grey_light">
android:background="@color/custom_grey_light">
<ScrollView
android:id="@+id/coupon_scrollview"
......@@ -46,7 +46,7 @@
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:text="@string/demo_offer"
android:textColor="@color/black4"
android:textColor="@color/custom_black4"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
......@@ -90,7 +90,7 @@
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:text="@string/demo_more"
android:textColor="@color/black4"
android:textColor="@color/custom_black4"
android:textSize="11sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
......@@ -126,7 +126,7 @@
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:maxLines="1"
android:textColor="@color/pink2"
android:textColor="@color/custom_pink2"
android:textSize="23sp"
tools:text="@string/demo_more" />
......@@ -139,7 +139,7 @@
android:includeFontPadding="false"
android:maxLines="1"
android:text="@string/demo_purchases"
android:textColor="@color/black5"
android:textColor="@color/custom_black5"
android:textSize="17sp" />
</LinearLayout>
......@@ -171,7 +171,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:includeFontPadding="false"
android:textColor="@color/black5"
android:textColor="@color/custom_black5"
android:textSize="13sp"
tools:text="@string/demo_purchases" />
......@@ -183,7 +183,7 @@
android:ellipsize="end"
android:lineSpacingExtra="2dp"
android:maxLines="4"
android:textColor="@color/black5"
android:textColor="@color/custom_black5"
android:textSize="17sp"
tools:text="Πάρτε τα πακέτα κινητής στη μισή τιμή μόνο αυτό το μήνα. Απεριόριστα λεπτά προς όλα τα δίκτυα, SMS και 50GB δεδομένα υψηλής ταχύτητας. Ισχύει για νέους συνδρομητές και ανανεώσεις συμβολαίων. Δωρεάν ενεργοποίηση και τεχνική υποστήριξη." />
......@@ -194,7 +194,7 @@
android:layout_gravity="end"
android:layout_marginTop="2dp"
android:text="@string/demo_more"
android:textColor="@color/skyblue"
android:textColor="@color/custom_skyblue"
android:textSize="15sp"
android:visibility="gone" />
......@@ -203,7 +203,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:background="@drawable/shape_cos_white"
android:background="@drawable/shape_rectangle_rounded_white"
android:orientation="vertical"
android:padding="16dp">
......@@ -220,7 +220,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/demo_coupon_code"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="15sp" />
<ImageView
......@@ -247,7 +247,7 @@
android:layout_marginEnd="12dp"
android:includeFontPadding="false"
android:text="test_coupon_code"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="23sp" />
<ImageView
......@@ -263,7 +263,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@drawable/shape_cos_white"
android:background="@drawable/shape_rectangle_rounded_white"
android:orientation="vertical"
android:padding="16dp">
......@@ -280,7 +280,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/demo_qr_code"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="15sp" />
<ImageView
......@@ -329,7 +329,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/demo_terms"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="15sp"/>
<ImageView
......@@ -356,7 +356,7 @@
android:layout_marginBottom="8dp"
android:lineSpacingExtra="4dp"
android:text="@string/demo_lorem_ipsum"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
......@@ -392,7 +392,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/demo_website"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/option_icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:src="@drawable/phone_option"/>
<TextView
android:id="@+id/option_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:layout_marginLeft="30dp"
android:layout_marginTop="14dp"/>
</RelativeLayout>
......@@ -52,7 +52,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxLines="1"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="21sp"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_70"
app:layout_constraintStart_toStartOf="parent"
......@@ -65,7 +65,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxLines="2"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="15sp"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_70"
app:layout_constraintStart_toStartOf="parent"
......@@ -81,7 +81,7 @@
android:layout_centerVertical="true"
android:layout_marginTop="24dp"
android:maxLines="1"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -56,7 +56,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxLines="1"
android:textColor="@color/black2"
android:textColor="@color/custom_black2"
android:textSize="16sp"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_70"
app:layout_constraintStart_toStartOf="parent"
......@@ -70,7 +70,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:maxLines="2"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="13sp"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_70"
app:layout_constraintStart_toStartOf="parent"
......@@ -86,7 +86,7 @@
android:layout_centerVertical="true"
android:layout_marginTop="12dp"
android:maxLines="1"
android:textColor="@color/black3"
android:textColor="@color/custom_black3"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cos_skyblue2">
android:background="@color/white">
<RelativeLayout
android:layout_width="match_parent"
......@@ -16,13 +16,13 @@
android:layout_height="wrap_content"
android:background="@android:color/white"
android:paddingHorizontal="16dp"
android:paddingTop="8dp">
android:paddingVertical="16dp">
<ImageView
android:id="@+id/user_img"
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/profile_photo"
android:src="@drawable/demo_logo_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......@@ -31,7 +31,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingHorizontal="10dp"
app:layout_constraintEnd_toStartOf="@+id/iv_settings"
app:layout_constraintStart_toEndOf="@+id/user_img"
app:layout_constraintTop_toTopOf="@+id/user_img">
......@@ -43,172 +43,47 @@
android:layout_marginBottom="8dp"
android:maxLines="1"
android:scrollHorizontally="true"
android:textColor="#415564"
tools:text="@string/welcome_user" />
<ImageView
android:id="@+id/cosmote_one"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_below="@+id/welcome_user_txt"
android:layout_marginTop="0dp"
android:src="@drawable/cosmote_one" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cosmote_one">
<include
android:id="@+id/info_button"
layout="@layout/button_with_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<include
android:id="@+id/info_button2"
layout="@layout/button_with_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp" />
<include
android:id="@+id/info_button3"
layout="@layout/button_with_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp" />
</LinearLayout>
android:textColor="@color/custom_black2"
android:text="@string/welcome_user" />
</RelativeLayout>
<ImageView
android:id="@+id/iv_settings"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/filters_icon"
android:src="@drawable/vc_logout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/user_img" />
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:id="@+id/rl_auth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_header"
android:background="@color/cos_skyblue2"
android:paddingVertical="16dp">
<RelativeLayout
android:id="@+id/rl_auth_view"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="24dp"
android:layout_marginBottom="16dp"
android:background="@drawable/shape_cos_white">
<EditText
android:id="@+id/et_login"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:hint="@string/cos_hint"
android:inputType="number"
android:textColor="@color/blue_dark"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone"
tools:visibility="visible" />
<TextView
android:id="@+id/tv_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:textColor="@color/blue_dark"
android:textSize="20sp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/ll_auth_login"
android:layout_width="140dp"
android:layout_height="45dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="@+id/button_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:includeFontPadding="false"
android:text="@string/cos_login_text"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_auth_logout"
android:layout_width="140dp"
android:layout_height="45dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="@+id/button_logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:includeFontPadding="false"
android:text="@string/cos_logout_text"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/pb_loading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/pb_loading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="@android:color/transparent"
android:translationZ="100dp"
android:visibility="gone"
tools:visibility="visible">
<ProgressBar
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerInParent="true"
android:background="@android:color/transparent"
android:translationZ="100dp"
android:visibility="gone"
tools:visibility="visible">
<ProgressBar
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerInParent="true"
android:indeterminate="true"
android:indeterminateTint="@color/cos_green5"
android:indeterminateTintMode="src_atop" />
</RelativeLayout>
android:indeterminate="true"
android:indeterminateTint="@color/custom_light_blue"
android:indeterminateTintMode="src_atop" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_sm_view"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_below="@+id/rl_auth"
android:layout_below="@+id/rl_header"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="24dp"
android:layout_marginBottom="16dp"
android:background="@drawable/shape_cos_white">
android:background="@drawable/shape_rectangle_rounded_white">
<LinearLayout
android:id="@+id/ll_sm_flow"
......@@ -217,28 +92,7 @@
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:includeFontPadding="false"
android:text="@string/demo_sm_flow"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_sm_map"
android:layout_width="140dp"
android:layout_height="45dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:background="@drawable/selector_button_green"
android:background="@drawable/selector_button_light_blue"
android:gravity="center"
android:orientation="horizontal">
......@@ -247,7 +101,7 @@
android:layout_height="wrap_content"
android:gravity="center"
android:includeFontPadding="false"
android:text="@string/demo_sm_map"
android:text="@string/demo_home"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Used in drawables -->
<color name="cos_cyan">#A3F2DA</color>
<color name="cos_grey_dark">#787878</color>
<color name="cos_grey_light">#F2F2F2</color>
<color name="cos_green12">#0EA600</color>
<color name="cos_green6_tr">#660EA600</color>
<color name="cos_orange">#FF9933</color>
<!-- Used in layouts -->
<color name="cos_skyblue2">#22A9B5</color>
<color name="blue_dark">#3A5266</color>
<color name="custom_cyan">#A3F2DA</color>
<color name="custom_grey_dark">#787878</color>
<color name="custom_grey_light">#F2F2F2</color>
<color name="custom_green12">#0EA600</color>
<color name="custom_green6_tr">#660EA600</color>
<color name="custom_orange">#FF9933</color>
<color name="custom_skyblue2">#22A9B5</color>
<color name="custom_blue_dark">#3A5266</color>
<color name="white">#FFFFFF</color>
<color name="white_tr">#66FFFFFF</color>
<color name="cos_green5">#79BF14</color>
<color name="black2">#000F1E</color>
<color name="black2_tr">#66000F1E</color>
<color name="black3">#00111B</color>
<color name="grey">#CCCCCC</color>
<color name="pink">#EE417D</color>
<color name="black4">#0D1B29</color>
<color name="black5">#020E1C</color>
<color name="pink2">#F2709D</color>
<color name="skyblue">#00A3E0</color>
<color name="grey2">#D8D8D8</color>
<color name="pink3">#EE437E</color>
<!-- Used in styles -->
<color name="cos_light_blue">#00A5E3</color>
<color name="custom_green5">#79BF14</color>
<color name="custom_black2">#000F1E</color>
<color name="custom_black2_tr">#66000F1E</color>
<color name="custom_black3">#00111B</color>
<color name="custom_grey">#CCCCCC</color>
<color name="custom_pink">#EE417D</color>
<color name="custom_black4">#0D1B29</color>
<color name="custom_black5">#020E1C</color>
<color name="custom_pink2">#F2709D</color>
<color name="custom_skyblue">#00A3E0</color>
<color name="custom_grey2">#D8D8D8</color>
<color name="custom_pink3">#EE437E</color>
<color name="custom_light_blue">#00A5E3</color>
</resources>
......
<resources>
<string name="webview_permission_title">Demo App</string>
<string name="webview_permission_message">Το Demo App ζητάει πρόσβαση στην τοποθεσία σας.</string>
<string name="lbl_take_photo_accept">Οκ</string>
<string name="lbl_take_photo_decline">Άκυρο</string>
<string name="welcome_user">Γεια σου %1$s !</string>
<string name="cos_hint">GUID</string>
<string name="cos_login_text">Σύνδεση</string>
<string name="cos_logout_text">Αποσύνδεση</string>
<string name="lbl_ok">Οκ</string>
<string name="lbl_cancel">Άκυρο</string>
<string name="welcome_user">User</string>
<string name="menu_home">Αρχική</string>
<string name="demo_sm_flow">Open SM Flow</string>
<string name="demo_sm_map">Open SM Map</string>
<string name="demo_home">Αρχική οθόνη</string>
<string name="demo_all">Όλα</string>
<string name="demo_offer">Προσφορά</string>
<string name="demo_more">Περισσότερα</string>
......
......@@ -5,7 +5,7 @@
</style>
<style name="SDKAppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="android:statusBarColor">@color/cos_grey_light</item>
<item name="android:statusBarColor">@color/custom_grey_light</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
</style>
......@@ -23,10 +23,10 @@
</style>
<style name="progressBarGreen" parent="@style/Theme.AppCompat">
<item name="colorAccent">@color/cos_green12</item>
<item name="colorAccent">@color/custom_green12</item>
</style>
<style name="progressBarBlue" parent="@style/Theme.AppCompat">
<item name="colorAccent">@color/cos_light_blue</item>
<item name="colorAccent">@color/custom_light_blue</item>
</style>
</resources>
......