Panagiotis Triantafyllou

remove code for magenta

Showing 307 changed files with 11 additions and 4497 deletions
......@@ -13,6 +13,10 @@ Debug=true
# 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/
# For Verify Ticket request
VerifyURL=/partners/cosmote/verify
......
......@@ -3,9 +3,7 @@ package warp.ly.android_sdk;
import android.app.Application;
import android.content.res.Configuration;
import ly.warp.sdk.receivers.WarplyBeaconsApplication;
public class WarplyAndroidSDKApplication extends /*WarplyBeaconsApplication*/ Application {
public class WarplyAndroidSDKApplication extends Application {
// ===========================================================
// Constants
......
......@@ -2,26 +2,15 @@ package warp.ly.android_sdk.activities;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
import org.json.JSONObject;
import java.util.Timer;
import java.util.TimerTask;
import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.BaseFragmentActivity;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver;
import ly.warp.sdk.io.callbacks.WarplyReadyCallback;
import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.request.WarplyConsumerRequest;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyInitializer;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyManager;
import warp.ly.android_sdk.R;
public class SplashActivity extends BaseActivity {
......@@ -36,11 +25,7 @@ public class SplashActivity extends BaseActivity {
mWarplyInitializer = Warply.getWarplyInitializer(this, new WarplyReadyCallback() {
@Override
public void onWarplyReady() {
if (WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getConsumer(new WarplyConsumerRequest(), mConsumerCallback);
} else {
startNextActivity();
}
startNextActivity();
}
@Override
......@@ -91,34 +76,4 @@ public class SplashActivity extends BaseActivity {
}, MIN_SPLASH_TIME);
}
}
private CallbackReceiver<Consumer> mConsumerCallback = new CallbackReceiver<Consumer>() {
@Override
public void onSuccess(Consumer result) {
WarplyManagerHelper.setConsumerInternal(result);
if (result != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
if (profMetadata != null && profMetadata.has("nonTelco")) {
WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco"));
} else {
WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false);
}
if (profMetadata != null) {
if (profMetadata.has("badge")) {
WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge"));
}
}
}
startNextActivity();
}
@Override
public void onFailure(int errorCode) {
startNextActivity();
Toast.makeText(SplashActivity.this, "GET PROFILE ERROR", Toast.LENGTH_SHORT).show();
}
};
}
......
package warp.ly.android_sdk.fragments;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.json.JSONException;
import org.json.JSONObject;
import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver;
import ly.warp.sdk.utils.WarplyDeviceInfoCollector;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import warp.ly.android_sdk.R;
import static ly.warp.sdk.utils.constants.WarpConstants.EVENT_PAGE_VIEW;
public class InfoFragment extends Fragment implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private TextView tvInfo;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// RateDialog.with(getContext())
// .setInstallDate(0) // default -1, 0 means 1st launch day(install day).
//// .setLaunchTimes(3) // default -1, 1 means 1st launch day(install day).
// .setRemindInterval(1) // default 1
// .setShowNeutralButton(false) // default true
// .setOnClickButtonListener(which -> {
// })
// .setIsDebug(true) // this is for debug (ignore all conditions)
// .launch();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_info, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
tvInfo = (TextView) view.findViewById(R.id.tv_info);
tvInfo.setOnClickListener(this);
new WarplyDeviceInfoCollector(getActivity()).
collectToJson(new SimpleCallbackReceiver<JSONObject>() {
@Override
public void onResult(JSONObject result, int errorCode) {
super.onResult(result, errorCode);
if (result != null) {
new Handler(Looper.getMainLooper()).post(() -> {
try {
tvInfo.setText(result.toString(2));
} catch (JSONException e) {
e.printStackTrace();
}
});
}
}
});
}
@Override
public void onClick(View view) {
// if(view.getId() == R.id.tv_info){
// Intent sendIntent = new Intent();
// sendIntent.setAction(Intent.ACTION_SEND);
// sendIntent.putExtra(Intent.EXTRA_TEXT, tvInfo.getText().toString());
// sendIntent.setType("text/plain");
// startActivity(Intent.createChooser(sendIntent,"Share"));
// }
// RateDialog.showRateDialogIfMeetsConditions(getActivity());
WarplyAnalyticsManager.logEventInApp(
getContext(),
null,
EVENT_PAGE_VIEW + "home",
null,
true);
}
// ===========================================================
// Methods
// ===========================================================
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
package warp.ly.android_sdk.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.altbeacon.beacon.AltBeacon;
import org.altbeacon.beacon.Beacon;
/**
* Created by Matt Tyler on 4/18/14.
*/
public class TimedBeaconSimulator implements org.altbeacon.beacon.simulator.BeaconSimulator {
protected static final String TAG = "TimedBeaconSimulator";
private List<Beacon> beacons;
/*
* You may simulate detection of beacons by creating a class like this in your project.
* This is especially useful for when you are testing in an Emulator or on a device without BluetoothLE capability.
*
* Uncomment lines 36, 37, and 139 - 142 of MonitoringActivity.java and
* set USE_SIMULATED_BEACONS = true to initialize the sample code in this class.
* If using a bluetooth incapable test device (i.e. Emulator), you will want to comment
* out the verifyBluetooth() call on line 32 of MonitoringActivity.java as well.
*
* Any simulated beacons will automatically be ignored when building for production.
*/
public boolean USE_SIMULATED_BEACONS = false;
/**
* Creates empty beacons ArrayList.
*/
public TimedBeaconSimulator(){
beacons = new ArrayList<Beacon>();
}
/**
* Required getter method that is called regularly by the Android Beacon Library.
* Any beacons returned by this method will appear within your test environment immediately.
*/
public List<Beacon> getBeacons(){
return beacons;
}
/**
* Creates simulated beacons all at once.
*/
public void createBasicSimulatedBeacons(){
if (USE_SIMULATED_BEACONS) {
Beacon beacon1 = new AltBeacon.Builder().setId1("DF7E1C79-43E9-44FF-886F-1D1F7DA6997A")
.setId2("1").setId3("1").setRssi(-55).setTxPower(-55).build();
Beacon beacon2 = new AltBeacon.Builder().setId1("DF7E1C79-43E9-44FF-886F-1D1F7DA6997A")
.setId2("1").setId3("2").setRssi(-55).setTxPower(-55).build();
Beacon beacon3 = new AltBeacon.Builder().setId1("DF7E1C79-43E9-44FF-886F-1D1F7DA6997A")
.setId2("1").setId3("3").setRssi(-55).setTxPower(-55).build();
Beacon beacon4 = new AltBeacon.Builder().setId1("DF7E1C79-43E9-44FF-886F-1D1F7DA6997A")
.setId2("1").setId3("4").setRssi(-55).setTxPower(-55).build();
beacons.add(beacon1);
beacons.add(beacon2);
beacons.add(beacon3);
beacons.add(beacon4);
}
}
private ScheduledExecutorService scheduleTaskExecutor;
/**
* Simulates a new beacon every 10 seconds until it runs out of new ones to add.
*/
public void createTimedSimulatedBeacons(){
if (USE_SIMULATED_BEACONS){
beacons = new ArrayList<Beacon>();
Beacon beacon1 = new AltBeacon.Builder().setId1("DF7E1C79-43E9-44FF-886F-1D1F7DA6997A")
.setId2("1").setId3("1").setRssi(-55).setTxPower(-55).build();
Beacon beacon2 = new AltBeacon.Builder().setId1("DF7E1C79-43E9-44FF-886F-1D1F7DA6997A")
.setId2("1").setId3("2").setRssi(-55).setTxPower(-55).build();
Beacon beacon3 = new AltBeacon.Builder().setId1("DF7E1C79-43E9-44FF-886F-1D1F7DA6997A")
.setId2("1").setId3("3").setRssi(-55).setTxPower(-55).build();
Beacon beacon4 = new AltBeacon.Builder().setId1("DF7E1C79-43E9-44FF-886F-1D1F7DA6997A")
.setId2("1").setId3("4").setRssi(-55).setTxPower(-55).build();
beacons.add(beacon1);
beacons.add(beacon2);
beacons.add(beacon3);
beacons.add(beacon4);
final List<Beacon> finalBeacons = new ArrayList<Beacon>(beacons);
//Clearing beacons list to prevent all beacons from appearing immediately.
//These will be added back into the beacons list from finalBeacons later.
beacons.clear();
scheduleTaskExecutor= Executors.newScheduledThreadPool(5);
// This schedules an beacon to appear every 10 seconds:
scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() {
public void run() {
try{
//putting a single beacon back into the beacons list.
if (finalBeacons.size() > beacons.size())
beacons.add(finalBeacons.get(beacons.size()));
else
scheduleTaskExecutor.shutdown();
}catch(Exception e){
e.printStackTrace();
}
}
}, 0, 10, TimeUnit.SECONDS);
}
}
}
\ No newline at end of file
package warp.ly.android_sdk.views;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.views.CampaignItemViewHolder;
import warp.ly.android_sdk.R;
public class CustomCampaignViewsHolder extends CampaignItemViewHolder {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private TextView tvCampaignTitle,
tvCampaignDescription;
private ImageView ivCampaign;
// ===========================================================
// Constructors
// ===========================================================
public CustomCampaignViewsHolder(ViewGroup root) {
super((ViewGroup) LayoutInflater.from(root.getContext()).
inflate(R.layout.campaign_recycler_item, root, false));
this.ivCampaign = (ImageView) itemView.findViewById(R.id.iv_campaign);
this.tvCampaignTitle = (TextView) itemView.findViewById(R.id.tv_campaign_title);
this.tvCampaignDescription = (TextView) itemView.findViewById(R.id.tv_campaign_description);
}
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void setData(Campaign campaign, int position) {
Picasso.with(itemView.getContext()).load(campaign.getImageUrl())
.placeholder(R.drawable.ic_notification_logo).into(ivCampaign);
this.tvCampaignTitle.setText(campaign.getTitle());
this.tvCampaignDescription.setText(campaign.getSubtitle());
}
// ===========================================================
// Methods
// ===========================================================
// ===========================================================
// Getter & Setter
// ===========================================================
}
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape android:shape="rectangle">
<solid android:color="@android:color/darker_gray" />
</shape></item>
</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/next_gray_pressed_icon" android:state_pressed="true"/>
<item android:drawable="@drawable/next_gray_icon"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#363F45">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/lv_inbox"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:cacheColorHint="@android:color/transparent"
android:divider="@android:color/darker_gray"
android:dividerHeight="1dp"
android:fadingEdge="none"
android:fadingEdgeLength="0dp"
android:listSelector="@drawable/selector_gray_light_list_item"
android:overScrollMode="never"
android:persistentDrawingCache="animation|scrolling"
android:scrollbars="none"
android:visibility="visible" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<ProgressBar
android:id="@+id/pb_inbox"
style="?android:attr/progressBarStyleInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:visibility="gone" />
</RelativeLayout>
\ No newline at end of file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
......@@ -11,5 +10,5 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:scaleType="centerCrop"
android:src="@drawable/ic_cosmote_logo_horizontal_white" />
android:src="@drawable/ic_cosmote_logo_horizontal_grey" />
</RelativeLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="150dp"
android:gravity="center"
android:orientation="vertical"
android:padding="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="3">
<ImageView
android:id="@+id/iv_campaign"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scaleType="center"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tv_campaign_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:ellipsize="end"
android:textColor="@android:color/white"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="@+id/tv_campaign_description"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="15dp"
android:ellipsize="end"
android:textColor="@android:color/white" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_campaign"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/iv_campaign"
android:layout_toLeftOf="@+id/iv_next"
android:layout_toRightOf="@id/iv_campaign"
android:layout_toStartOf="@+id/iv_next"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/tv_campaign_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:textColor="@android:color/white"
android:textSize="20sp" />
<TextView
android:id="@+id/tv_campaign_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:ellipsize="end"
android:textColor="@android:color/white" />
</LinearLayout>
<ImageView
android:id="@+id/iv_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/selector_next_gray_btn" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<ImageView
android:id="@+id/iv_campaign"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_notification_logo" />
<TextView
android:id="@+id/tv_campaign_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:ellipsize="end"
android:textColor="@android:color/white"
android:textSize="20sp" />
<TextView
android:id="@+id/tv_campaign_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:ellipsize="end"
android:textColor="@android:color/white" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="15dp">
<TextView
android:id="@+id/tv_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/middle_activity_info"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@android:color/white" />
</ScrollView>
</RelativeLayout>
......@@ -100,10 +100,6 @@ dependencies {
api "androidx.sqlite:sqlite:2.2.0"
api 'com.getkeepsafe.relinker:relinker:1.4.4'
//------------------------------ Calligraphy -----------------------------//
// api 'io.github.inflationx:calligraphy3:3.1.1'
// api 'io.github.inflationx:viewpump:2.0.3'
//------------------------------ Retrofit -----------------------------//
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
......
......@@ -14,17 +14,9 @@
tools:node="remove" />
<uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH" />-->
<!-- <uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />-->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />-->
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />-->
<application android:largeHeap="true">
<!-- <meta-data-->
<!-- android:name="com.google.android.geo.API_KEY"-->
<!-- android:value="@string/google_maps_key" />-->
<!-- For Huawei Push -->
<meta-data
android:name="push_kit_auto_init_enabled"
......@@ -41,127 +33,6 @@
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.LoyaltyAnalysisActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.MarketPassActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.MarketPassInfoActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.LoyaltyHistoryActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.CouponInfoActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.LoyaltyMarketAnalysisActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.UnifiedCouponInfoActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.ActiveCouponsActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.ActiveUnifiedCouponsActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<!-- android:screenOrientation="portrait"-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsHistoryActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsMetricsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<activity
android:name=".activities.GiftsForYouActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/GFYAppTheme" />
<activity
android:name=".activities.MoreForYouActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.CouponsetInfoActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.ShopsActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.ShopsHuaweiActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.CouponShareActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.TelcoActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".activities.ContextualActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<activity
android:name=".dexter.PermissionsActivity"
android:exported="false"
android:launchMode="singleInstance"
......@@ -171,95 +42,10 @@
<activity
android:name=".activities.BaseFragmentActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="cosmoteapp.gr"
android:scheme="demo" />
<data
android:host="cosmoteapp.gr"
android:pathPrefix="/payment"
android:scheme="demo" />
</intent-filter>
</activity>
<!-- android:stopWithTask="false"-->
<!-- android:process=":warplyHealthService"-->
<!-- <service-->
<!-- android:name=".services.WarplyHealthService"-->
<!-- android:exported="false"-->
<!-- android:foregroundServiceType="health"-->
<!-- android:permission="android.permission.FOREGROUND_SERVICE" />-->
<service
android:name=".services.WarplyBeaconsRangingService"
android:exported="false" />
<!-- Service used for in app notification. -->
<service
android:name=".services.WarpInAppNotificationService"
android:exported="false" />
<!-- FCM Service for push notifications -->
<!-- <service-->
<!-- android:name="ly.warp.sdk.services.FCMBaseMessagingService"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="com.google.firebase.MESSAGING_EVENT" />-->
<!-- </intent-filter>-->
<!-- </service>-->
<!-- Service used for handling Huawei Push Notifications, comment if we are in Google build -->
<!-- <service-->
<!-- android:name="ly.warp.sdk.services.HMSBaseMessagingService"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="com.huawei.push.action.MESSAGING_EVENT" />-->
<!-- </intent-filter>-->
<!-- </service>-->
android:screenOrientation="portrait" />
<receiver
android:name=".receivers.LocationChangedReceiver"
android:exported="false" />
<!-- <receiver-->
<!-- android:name="ly.warp.sdk.receivers.ConnectivityChangedReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />-->
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <receiver-->
<!-- android:name=".receivers.BluetoothStateChangeReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<receiver
android:name=".receivers.WarplyInAppNotificationReceiver"
android:exported="false" />
<!-- <receiver-->
<!-- android:name=".receivers.RestartHealthServiceReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!--&lt;!&ndash; <action android:name="android.intent.action.BOOT_COMPLETED" />&ndash;&gt;-->
<!-- <action android:name="android.intent.action.RESTART" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <provider-->
<!-- android:name=".utils.WarplyProvider"-->
<!-- android:authorities="ly.warp.sdk.utils.WarplyProvider" />-->
</application>
</manifest>
\ No newline at end of file
......
......@@ -45,7 +45,6 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
......@@ -64,7 +63,6 @@ import ly.warp.sdk.io.callbacks.WarplyReadyCallback;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.InboxStats;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.request.WarplyInboxRequest;
import ly.warp.sdk.io.request.WarplyJsonArrayRequest;
import ly.warp.sdk.io.request.WarplyJsonObjectRequest;
......@@ -72,13 +70,11 @@ import ly.warp.sdk.io.volley.Request.Method;
import ly.warp.sdk.io.volley.RequestQueue;
import ly.warp.sdk.io.volley.toolbox.Volley;
import ly.warp.sdk.receivers.WarplyBeaconsApplication;
import ly.warp.sdk.utils.GCMRegistrar;
import ly.warp.sdk.utils.ObjectSerializer;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyDeviceInfoCollector;
import ly.warp.sdk.utils.WarplyInitializer;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.WarplyPreferences;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.constants.WarpConstants;
......@@ -88,7 +84,6 @@ import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyLocationManager;
import ly.warp.sdk.utils.managers.WarplyServerPreferencesManager;
import ly.warp.sdk.utils.managers.WarplyUserManager;
import ly.warp.sdk.views.dialogs.InAppDialog;
public enum Warply {
......@@ -1900,44 +1895,6 @@ public enum Warply {
return sb.toString();
}
public static void showInAppCampaign(Context context, String eventId) {
String tempOfferCategoryName = eventId.split(":")[1];
CampaignList tempCampaignList = new CampaignList();
if (INSTANCE.getInAppCampaigns() != null && INSTANCE.getInAppCampaigns().size() > 0) {
for (Campaign campaign : INSTANCE.getInAppCampaigns()) {
if ((campaign.getOfferCategory().equals(IN_APP_FILTER_ALL) || campaign.getOfferCategory().equalsIgnoreCase(tempOfferCategoryName))
&& campaign.isShow()) {
tempCampaignList.add(campaign);
}
}
Collections.sort(tempCampaignList, new Comparator<Campaign>() {
@Override
public int compare(Campaign o1, Campaign o2) {
return Integer.valueOf(o2.getSorting()).compareTo(o1.getSorting());
}
});
Log.v("SORTED ", "SUCCESS");
if (tempCampaignList.size() > 0) {
Campaign campaignToShow = tempCampaignList.get(1);
if (campaignToShow.getActions() == null) {
if (campaignToShow.getAction() == 0) {
InAppDialog.showDefaultInAppDialog(context, campaignToShow, true, 0);
} else if (campaignToShow.getAction() == 1) {
InAppDialog.showDefaultInAppDialog(context, campaignToShow, false, 0);
}
} else {
// TODO: handle custom buttons except Rate and Share
// TODO: remove cardView from gradle
}
}
}
}
// callback receivers
private CallbackReceiver<JSONObject> mRegistrationCallBackReceiver = new CallbackReceiver<JSONObject>() {
@Override
......
package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.views.adapters.ActiveCouponAdapter;
public class ActiveCouponsActivity extends Activity implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private ImageView mIvBack;
private RecyclerView mRecyclerCoupons;
private ActiveCouponAdapter mAdapterCoupons;
private CouponList mCouponList = new CouponList();
private TextView mTvEmptyCoupons, mFontHeader;
private boolean mCouponsPressed = false;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_active_coupons);
mIvBack = findViewById(R.id.iv_coupons_close);
mTvEmptyCoupons = findViewById(R.id.tv_no_coupons);
mRecyclerCoupons = findViewById(R.id.rv_active_coupons);
mFontHeader = findViewById(R.id.textView3);
WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader);
WarpUtils.renderCustomFont(this, R.font.peridot_regular, mTvEmptyCoupons);
initViews();
}
@Override
public void onStart() {
super.onStart();
if (!EventBus.getDefault().isRegistered(this))
EventBus.getDefault().register(this);
}
@Override
public void onStop() {
super.onStop();
EventBus.getDefault().unregister(this);
}
@Subscribe()
public void onMessageEvent(WarplyEventBusManager event) {
if (event.getCouponsChanged() != null) {
Handler mUIHandler = new Handler(Looper.getMainLooper());
mUIHandler.post(this::filterItems);
}
}
@Override
public void onResume() {
super.onResume();
WarplyAnalyticsManager.logTrackersEvent(this, "screen", "ActiveCouponsScreen");
mCouponsPressed = false;
filterItems();
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_coupons_close) {
onBackPressed();
}
}
// ===========================================================
// Methods
// ===========================================================
private void initViews() {
mIvBack.setOnClickListener(this);
}
private void filterItems() {
CouponList cpnlist = new CouponList();
for (Coupon cpn : WarplyManagerHelper.getCouponList()) {
if (cpn.getStatus() == 1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(cpn.getExpiration());
} catch (ParseException e) {
e.printStackTrace();
}
cpn.setExpirationDate(newDate);
cpnlist.add(cpn);
}
}
Collections.sort(cpnlist, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate()));
mCouponList.clear();
mCouponList.addAll(cpnlist);
if (mCouponList != null && mCouponList.size() > 0) {
mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterCoupons = new ActiveCouponAdapter(this, mCouponList);
mRecyclerCoupons.setAdapter(mAdapterCoupons);
mAdapterCoupons.getPositionClicks()
.doOnNext(coupon -> {
if (!mCouponsPressed) {
mCouponsPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName()));
Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class);
intent.putExtra("coupon", coupon.getCoupon());
intent.putExtra("isFromWallet", true);
startActivity(intent);
}
})
.doOnError(error -> {
})
.subscribe();
} else {
mRecyclerCoupons.setVisibility(View.GONE);
mTvEmptyCoupons.setVisibility(View.VISIBLE);
}
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
/*
* Copyright (C) 2012 Apptentive, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
* OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package ly.warp.sdk.activities;
import java.util.List;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ListActivity;
import android.content.ComponentName;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
public abstract class ApplicationSessionListActivity extends ListActivity {
private static final String TAG = "AppSessionActivity";
private static final String KEY_APP_IN_BACKGROUND = "AppInBackground";
private static final String KEY_APP_SESSION_ACTIVE = "AppSessionActive";
private static final String KEY_MAIN_ACTIVITY_NAME = "MainActivityName";
private SharedPreferences prefs;
private static SessionStartedListener sessionStartedListener;
private static SessionStoppedListener sessionStoppedListener;
/**
* Used to listen for Session starts.
*/
public interface SessionStartedListener {
public void onSessionStarted();
}
/**
* Used to listen for Session stops.
*/
public interface SessionStoppedListener {
public void onSessionStopped();
}
/**
* Sets the SessionStartedListener for this Activity.
*/
protected static void setOnSessionStartedListener(SessionStartedListener sessionStartedListener) {
ApplicationSessionListActivity.sessionStartedListener = sessionStartedListener;
}
/**
* Sets the SessionStoppedListener for this Activity.
*/
protected static void setOnSessionStoppedListener(SessionStoppedListener sessionStoppedListener) {
ApplicationSessionListActivity.sessionStoppedListener = sessionStoppedListener;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
prefs = getSharedPreferences(TAG, MODE_PRIVATE);
// Pretend we came from background so a new session will start.
if(isCurrentActivityMainActivity(this)) {
prefs.edit().putBoolean(KEY_APP_IN_BACKGROUND, true).commit();
}
}
@Override
protected void onStart() {
super.onStart();
startSession();
}
@Override
protected void onStop() {
super.onStop();
// Stopping because the Application was backgrounded because the HOME key was pressed, or another application was
// switched to.
if(isApplicationBroughtToBackground(this)) {
prefs.edit().putBoolean(KEY_APP_IN_BACKGROUND, true).commit();
endSession();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
// Stopping because the BACK key was pressed from just the home Activity.
if(isCurrentActivityMainActivity(this)) {
endSession();
sessionStartedListener = null;
sessionStoppedListener = null;
}
}
private void startSession() {
boolean comingFromBackground = prefs.getBoolean(KEY_APP_IN_BACKGROUND, true);
if(comingFromBackground) {
boolean activeSession = prefs.getBoolean(KEY_APP_SESSION_ACTIVE, false);
if(!activeSession) {
if(sessionStartedListener != null) {
sessionStartedListener.onSessionStarted();
}
} else {
Log.e(TAG, "Error: Starting session, but a session is already active.");
}
prefs.edit().putBoolean(KEY_APP_SESSION_ACTIVE, true).putBoolean(KEY_APP_IN_BACKGROUND, false).commit();
}
}
private void endSession() {
boolean activeSession = prefs.getBoolean(KEY_APP_SESSION_ACTIVE, false);
if(activeSession) {
if(sessionStoppedListener != null) {
sessionStoppedListener.onSessionStopped();
}
} else {
Log.e(TAG, "Error: Ending session, but no session is active.");
}
prefs.edit().putBoolean(KEY_APP_SESSION_ACTIVE, false).commit();
}
/**
* Call this in the onStop() method of an Activity. Tells you if the Activity is stopping
* because the Application is going to the background, or because of some other reason. Other reasons include the app
* exiting, or a new Activity in the same Application starting.
* @param activity The Activity from which this method is called.
* @return <p>true - if the Application is stopping to go to the background.</p>
* <p>false - for any other reason the app is stopping.</p>
*/
private static boolean isApplicationBroughtToBackground(final Activity activity) {
ActivityManager activityManager = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> tasks = null;
try {
tasks = activityManager.getRunningTasks(1);
} catch (SecurityException e) {
Log.e(TAG, "Missing required permission: \"android.permission.GET_TASKS\".", e);
return false;
}
if (tasks != null && !tasks.isEmpty()) {
ComponentName topActivity = tasks.get(0).topActivity;
try {
PackageInfo pi = activity.getPackageManager().getPackageInfo(activity.getPackageName(), PackageManager.GET_ACTIVITIES);
for (ActivityInfo activityInfo : pi.activities) {
if(topActivity.getClassName().equals(activityInfo.name)) {
return false;
}
}
} catch( PackageManager.NameNotFoundException e) {
Log.e(TAG, "Package name not found: " + activity.getPackageName());
return false; // Never happens.
}
}
return true;
}
/**
* Tells you whether the currentActivity is the main Activity of the app. In order for this to work, it must be called
* from the main Activity first. One way to enforce this rule is to call it in the main Activity's onCreate().
* @param currentActivity The Activity from which this method is called.
* @return true iff currentActivity is the Application's main Activity.
*/
private boolean isCurrentActivityMainActivity(Activity currentActivity) {
String currentActivityName = currentActivity.getComponentName().getClassName();
String mainActivityName = prefs.getString(KEY_MAIN_ACTIVITY_NAME, null);
// The first time this runs, it will be from the main Activity, guaranteed.
if(mainActivityName == null) {
mainActivityName = currentActivityName;
prefs.edit().putString(KEY_MAIN_ACTIVITY_NAME, mainActivityName).commit();
}
return currentActivityName != null && currentActivityName.equals(mainActivityName);
}
}
......@@ -21,12 +21,8 @@ import java.util.ArrayList;
import ly.warp.sdk.R;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.fragments.HomeFragment;
import ly.warp.sdk.fragments.LoyaltyFragment;
import ly.warp.sdk.fragments.MyRewardsFragment;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.UnifiedCoupon;
import ly.warp.sdk.utils.managers.WarplyManager;
public class BaseFragmentActivity extends FragmentActivity implements NavigationBarView.OnItemSelectedListener {
......@@ -55,9 +51,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
mBottomNavigationView = findViewById(R.id.bt_tabs);
if (WarplyDBHelper.getInstance(this).isTableNotEmpty("auth")) {
WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
WarplyManager.getCampaigns(mCampaignsCallback);
WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
......@@ -86,27 +80,13 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
int itemId = item.getItemId();
if (itemId == R.id.menu_loyalty) {
mFragmentToSet = LoyaltyFragment.newInstance();
getSupportFragmentManager().beginTransaction()
.replace(R.id.fl_fragment, mFragmentToSet)
.addToBackStack(null)
.commit();
return true;
} else if (itemId == R.id.menu_home) {
if (itemId == R.id.menu_home) {
mFragmentToSet = HomeFragment.newInstance();
getSupportFragmentManager().beginTransaction()
.replace(R.id.fl_fragment, mFragmentToSet)
.addToBackStack(null)
.commit();
return true;
} else if (itemId == R.id.menu_profile) {
mFragmentToSet = MyRewardsFragment.newInstance();
getSupportFragmentManager().beginTransaction()
.replace(R.id.fl_fragment, mFragmentToSet)
.addToBackStack(null)
.commit();
return true;
}
return false;
}
......@@ -167,28 +147,4 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
Toast.makeText(BaseFragmentActivity.this, "Campaigns Error", Toast.LENGTH_SHORT).show();
}
};
private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
Toast.makeText(BaseFragmentActivity.this, "Coupons Success " + String.valueOf(result.size()), Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int errorCode) {
Toast.makeText(BaseFragmentActivity.this, "Coupons Error", Toast.LENGTH_SHORT).show();
}
};
private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
@Override
public void onSuccess(ArrayList<UnifiedCoupon> result) {
Toast.makeText(BaseFragmentActivity.this, "Unified Coupons Success " + String.valueOf(result.size()), Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int errorCode) {
Toast.makeText(BaseFragmentActivity.this, "Unified Coupons Error", Toast.LENGTH_SHORT).show();
}
};
}
......
package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.cardview.widget.CardView;
import androidx.core.content.res.ResourcesCompat;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.oned.EAN13Writer;
import org.greenrobot.eventbus.EventBus;
import java.util.Locale;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.CustomTypefaceSpan;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.MarketPassDetailsModel;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
public class MarketPassActivity extends Activity implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private ImageView mIvBack, mIvInfo, mIvBarcode;
private TextView mFontHeader, mPassHeader, mPassSubtitle, mTvBarcode, mTvPassCount, mTvButtonMap;
private LinearLayout mLlMap, mLlParentLogosView;
private boolean mMapPressed = false, mPassInfoPressed = false;
private MarketPassDetailsModel mMarketPassDetails = new MarketPassDetailsModel();
private RelativeLayout mPbLoading;
private AlertDialog mAlertDialog;
private CardView mCvMarketDetails;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_market_pass);
mIvBack = findViewById(R.id.iv_coupons_close);
mFontHeader = findViewById(R.id.textView3);
mIvInfo = findViewById(R.id.iv_coupons_info);
mPassHeader = findViewById(R.id.tv_market_header);
mPassSubtitle = findViewById(R.id.tv_market_subtitle);
mTvBarcode = findViewById(R.id.tv_barcode_value);
mIvBarcode = findViewById(R.id.iv_barcode);
mTvPassCount = findViewById(R.id.tv_total_pass_title);
mTvButtonMap = findViewById(R.id.tv_button_map);
mLlMap = findViewById(R.id.ll_map);
mLlParentLogosView = findViewById(R.id.ll_sm_logos);
mPbLoading = findViewById(R.id.pb_loading);
mPbLoading.setOnTouchListener((v, event) -> true);
mCvMarketDetails = findViewById(R.id.cv_market_details);
WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader, mPassHeader);
WarpUtils.renderCustomFont(this, R.font.peridot_regular, mPassSubtitle, mTvBarcode, mTvPassCount);
WarpUtils.renderCustomFont(this, R.font.peridot_semi_bold, mTvButtonMap);
mPbLoading.setVisibility(View.VISIBLE);
WarplyManager.getMarketPassDetails(mMarketPassDetailsCallback);
}
@Override
public void onResume() {
super.onResume();
WarplyAnalyticsManager.logTrackersEvent(this, "screen", "MarketPassScreen");
mMapPressed = false;
mPassInfoPressed = false;
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_coupons_close) {
onBackPressed();
return;
}
if (view.getId() == R.id.ll_map) {
if (!mMapPressed) {
mMapPressed = true;
if (!WarplyManagerHelper.noInternetDialog(this, true)) {
WarplyManagerHelper.noInternetDialog(this);
return;
}
WarplyAnalyticsManager.logTrackersEvent(this, "click", "MarketPassInfoScreen");
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.openSupermarketCampaign(MarketPassActivity.this)));
}
}
if (view.getId() == R.id.iv_coupons_info) {
if (!mPassInfoPressed) {
mPassInfoPressed = true;
WarplyAnalyticsManager.logTrackersEvent(MarketPassActivity.this, "click", ("MarketPassScreen")
.concat(":")
.concat("MarketPassInfo"));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_market_pass_info");
analyticsEvent.setParameter("screen", "Market Pass Screen");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent intent = new Intent(MarketPassActivity.this, MarketPassInfoActivity.class);
startActivity(intent);
}
}
}
// ===========================================================
// Methods
// ===========================================================
private void initViews() {
mIvBack.setOnClickListener(this);
mIvInfo.setOnClickListener(this);
mLlMap.setOnClickListener(this);
if (mMarketPassDetails != null)
createBarcodeBitmap(mMarketPassDetails.getBarcode());
if (mMarketPassDetails != null) {
String passValue = String.format(Locale.GERMAN, "%.02f", mMarketPassDetails.getTotalDiscount());
SpannableStringBuilder sBuilder = new SpannableStringBuilder();
sBuilder.append(String.format(getString(R.string.cos_market_pass_coupons_title), String.valueOf(mMarketPassDetails.getTotalDiscount())));
Typeface typefaceBold = ResourcesCompat.getFont(this, R.font.peridot_bold);
CustomTypefaceSpan typefaceBoldSpan = new CustomTypefaceSpan(typefaceBold);
sBuilder.setSpan(typefaceBoldSpan, 31, 31 + passValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvPassCount.setText(sBuilder, TextView.BufferType.SPANNABLE);
}
if (mMarketPassDetails != null) {
for (int i = 0; i < mMarketPassDetails.getSupermarkets().size(); i++) {
int tempIndex = i;
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RelativeLayout v = (RelativeLayout) vi.inflate(R.layout.item_sheet_image, null);
ImageView merchantLogo = (ImageView) v.findViewById(R.id.iv_market_logo);
Glide.with(this)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(mMarketPassDetails.getSupermarkets().get(i).getLogo())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(merchantLogo);
mLlParentLogosView.addView(v, tempIndex, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
}
}
mCvMarketDetails.setVisibility(View.VISIBLE);
}
private void createBarcodeBitmap(String barcodeString) {
EAN13Writer writer = new EAN13Writer();
try {
BitMatrix bitMatrix = writer.encode(barcodeString, BarcodeFormat.EAN_13, 1024, 512);
int width = bitMatrix.getWidth();
int height = bitMatrix.getHeight();
Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
bmp.setPixel(x, y, bitMatrix.get(x, y) ? Color.BLACK : Color.WHITE);
}
}
mIvBarcode.setImageBitmap(bmp);
mTvBarcode.setText(barcodeString);
} catch (Exception e) {
e.printStackTrace();
}
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
private final CallbackReceiver<MarketPassDetailsModel> mMarketPassDetailsCallback = new CallbackReceiver<MarketPassDetailsModel>() {
@Override
public void onSuccess(MarketPassDetailsModel result) {
mPbLoading.setVisibility(View.GONE);
mMarketPassDetails = result;
initViews();
}
@Override
public void onFailure(int errorCode) {
mPbLoading.setVisibility(View.GONE);
if (!isFinishing()) {
mAlertDialog = new AlertDialog.Builder(MarketPassActivity.this)
.setTitle(R.string.cos_dlg_error_subtitle)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
})
.show();
}
}
};
}
package ly.warp.sdk.activities;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import ly.warp.sdk.R;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
public class MarketPassInfoActivity extends Activity implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private ImageView mIvBack;
private TextView mFontHeader, mTvPassInfoHeader, mTvBasketTitle, mTvBasketSubtitle,
mTvEshopTitle, mTvEshopSubtitle, mTvAbTitle, mTvAbSubtitle, mTvPassBack;
private LinearLayout mLlPassReturn;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_market_pass_info);
mIvBack = findViewById(R.id.iv_coupons_close);
mFontHeader = findViewById(R.id.textView3);
mTvPassInfoHeader = findViewById(R.id.tv_pass_info_header);
mTvBasketTitle = findViewById(R.id.tv_pass_info_basket_title);
mTvBasketSubtitle = findViewById(R.id.tv_pass_info_basket_subtitle);
mTvEshopTitle = findViewById(R.id.tv_pass_info_eshop_title);
mTvEshopSubtitle = findViewById(R.id.tv_pass_info_eshop_subtitle);
mTvAbTitle = findViewById(R.id.tv_pass_info_ab_title);
mTvAbSubtitle = findViewById(R.id.tv_pass_info_ab_subtitle);
mTvPassBack = findViewById(R.id.tv_button_back);
mLlPassReturn = findViewById(R.id.ll_return_back);
WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader, mTvPassInfoHeader);
WarpUtils.renderCustomFont(this, R.font.peridot_bold, mTvBasketTitle, mTvEshopTitle,
mTvAbTitle, mTvPassBack);
WarpUtils.renderCustomFont(this, R.font.peridot_regular, mTvBasketSubtitle,
mTvEshopSubtitle, mTvAbSubtitle);
initViews();
}
@Override
public void onResume() {
super.onResume();
WarplyAnalyticsManager.logTrackersEvent(this, "screen", "MarketPassInfoScreen");
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_coupons_close) {
onBackPressed();
return;
}
if (view.getId() == R.id.ll_return_back) {
onBackPressed();
}
}
// ===========================================================
// Methods
// ===========================================================
private void initViews() {
mIvBack.setOnClickListener(this);
mLlPassReturn.setOnClickListener(this);
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.ConcatAdapter;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.TelematicsHistory;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.views.adapters.TelematicsHistoryAdapter;
import ly.warp.sdk.views.adapters.TelematicsHistoryHeaderAdapter;
/**
* Created by Panagiotis Triantafyllou on 07/Aug/2023.
*/
public class TelematicsHistoryActivity extends Activity implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private RecyclerView mRvTripHistory;
private LinearLayout mLlTelematicsHistoryMain;
private ArrayList<TelematicsHistory> mTelematicsHistoryData = new ArrayList<>();
private TelematicsHistoryAdapter mAdapterTelematicsHistory;
private TelematicsHistoryHeaderAdapter mAdapterTelematicsHistoryHeader;
private boolean mTelematicsHistoryItemPressed = false;
private ImageView mIvClose;
private TextView mFontHeader;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_telematics_history);
mRvTripHistory = findViewById(R.id.rv_trip_history);
mLlTelematicsHistoryMain = findViewById(R.id.ll_telematics_history_main);
mIvClose = findViewById(R.id.iv_telematics_history_close);
mIvClose.setOnClickListener(this);
mFontHeader = findViewById(R.id.textView3);
WarplyManager.getTelematicsHistory(mTelematicsHistoryCallback);
WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader);
}
@Override
public void onResume() {
super.onResume();
// WarplyAnalyticsManager.logTrackersEvent(this, "screen", "TelematicsActivity");
mTelematicsHistoryItemPressed = false;
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_telematics_history_close) {
onBackPressed();
}
}
// ===========================================================
// Methods
// ===========================================================
private void initViews() {
if (mTelematicsHistoryData != null && mTelematicsHistoryData.size() > 0) {
mRvTripHistory.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterTelematicsHistoryHeader = new TelematicsHistoryHeaderAdapter(this);
mAdapterTelematicsHistory = new TelematicsHistoryAdapter(this, mTelematicsHistoryData);
ConcatAdapter concatAdapter = new ConcatAdapter(mAdapterTelematicsHistoryHeader, mAdapterTelematicsHistory);
mRvTripHistory.setAdapter(concatAdapter);
mAdapterTelematicsHistory.getPositionClicks()
.doOnNext(historyItem -> {
if (!mTelematicsHistoryItemPressed) {
mTelematicsHistoryItemPressed = true;
// WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName()));
Intent intent = new Intent(TelematicsHistoryActivity.this, TelematicsMetricsActivity.class);
intent.putExtra("trip_id", historyItem.getTripId());
startActivity(intent);
}
})
.doOnError(error -> {
})
.subscribe();
} else {
//TODO: empty list view
}
}
private final CallbackReceiver<ArrayList<TelematicsHistory>> mTelematicsHistoryCallback = new CallbackReceiver<ArrayList<TelematicsHistory>>() {
@Override
public void onSuccess(ArrayList<TelematicsHistory> result) {
mTelematicsHistoryData.clear();
mTelematicsHistoryData.addAll(result);
Snackbar.make(mLlTelematicsHistoryMain, "Success getting history", Snackbar.LENGTH_SHORT).show();
initViews();
}
@Override
public void onFailure(int errorCode) {
Snackbar.make(mLlTelematicsHistoryMain, "Error getting history", Snackbar.LENGTH_SHORT).show();
}
};
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
......@@ -28,8 +28,6 @@ package ly.warp.sdk.activities;
import static ly.warp.sdk.utils.constants.WarpConstants.RANDOM_MAX;
import static ly.warp.sdk.utils.constants.WarpConstants.RANDOM_MIN;
import android.Manifest;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
......@@ -37,8 +35,6 @@ import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.PowerManager;
import android.provider.Settings;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
......@@ -48,8 +44,6 @@ import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.work.Constraints;
import androidx.work.NetworkType;
import androidx.work.OneTimeWorkRequest;
......@@ -68,21 +62,15 @@ import ly.warp.sdk.Warply;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.WarplyPacingEventModel;
import ly.warp.sdk.io.models.WarplyWebviewActivityCallbackEventModel;
import ly.warp.sdk.io.models.WarplyWebviewCallbackEventModel;
import ly.warp.sdk.services.EventCampaignCouponService;
import ly.warp.sdk.services.EventQuestionnaireService;
import ly.warp.sdk.services.PushEventsClickedWorkerService;
import ly.warp.sdk.services.WarplyHealthService;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyPreferences;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.utils.managers.WarplySessionManager;
import ly.warp.sdk.views.WarpView;
......@@ -141,7 +129,6 @@ public class WarpViewActivity extends WarpBaseActivity {
super.onStop();
WarplySessionManager.onStopActivity(this);
EventBus.getDefault().unregister(this);
WarplyManager.sendSteps(this);
}
@Override
......@@ -174,24 +161,6 @@ public class WarpViewActivity extends WarpBaseActivity {
webviewCallbackEventModel.setResponseCode(grantResults[0] == PackageManager.PERMISSION_GRANTED ? "allow" : "deny");
EventBus.getDefault().post(new WarplyEventBusManager(webviewCallbackEventModel));
}
if (requestCode == 5001 && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (!isMyServiceRunning(WarplyHealthService.class)) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_steps_activation");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent stepsServiceIntent = new Intent(this, WarplyHealthService.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(stepsServiceIntent);
} else {
startService(stepsServiceIntent);
}
WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
pacingVisible.setVisible(true);
EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
}
}
}
@Override
......@@ -207,76 +176,7 @@ public class WarpViewActivity extends WarpBaseActivity {
@Subscribe()
public void onMessageEvent(WarplyEventBusManager event) {
// EventBus.getDefault().unregister(this);
if (event.getQuestionnaire() != null) {
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventQuestionnaireService.class).build();
WorkManager.getInstance(WarpViewActivity.this).enqueue(mywork);
setResult(RESULT_OK, new Intent());
finish();
}
if (event.getCoupon() != null) {
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignCouponService.class).build();
WorkManager.getInstance(WarpViewActivity.this).enqueue(mywork);
}
// if (event.getPacingCard() != null)
// finish();
// if (event.getPacingService() != null)
// finish();
if (event.getPacing() != null && !event.getPacing().isVisible()) finish();
if (event.getHealth() != null) {
if (event.getHealth().isActivated()) {
WarpUtils.setIsStepsManuallyStopped(this, false);
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACTIVITY_RECOGNITION) != PackageManager.PERMISSION_GRANTED) {
// ActivityCompat.requestPermissions(this, new String[]{
// Manifest.permission.ACTIVITY_RECOGNITION
// }, 5001);
// } else {
// if (!isMyServiceRunning(WarplyHealthService.class)) {
// LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
// analyticsEvent.setEventName("loyalty_steps_activation");
// EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
//
// Intent stepsServiceIntent = new Intent(this, WarplyHealthService.class);
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// startForegroundService(stepsServiceIntent);
// } else {
// startService(stepsServiceIntent);
// }
//
// WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
// pacingVisible.setVisible(true);
// EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
// }
// }
// } else {
if (!isMyServiceRunning(WarplyHealthService.class)) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_steps_activation");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent stepsServiceIntent = new Intent(this, WarplyHealthService.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(stepsServiceIntent);
} else {
startService(stepsServiceIntent);
}
WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
pacingVisible.setVisible(true);
EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
}
// }
} else {
WarpUtils.setIsStepsManuallyStopped(this, true);
Intent stepsServiceIntent = new Intent(this, WarplyHealthService.class);
stopService(stepsServiceIntent);
WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
pacingVisible.setVisible(false);
EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
}
}
}
// ===========================================================
......@@ -284,7 +184,6 @@ public class WarpViewActivity extends WarpBaseActivity {
// ===========================================================
private void initViews() {
RelativeLayout root = new RelativeLayout(this);
root.setBackgroundColor(Color.WHITE);
......@@ -325,7 +224,6 @@ public class WarpViewActivity extends WarpBaseActivity {
}
private void setPageAccordingToIntent() {
Intent intent = getIntent();
String sessionUUID = intent.getStringExtra("sessionUUID");
......@@ -383,7 +281,6 @@ public class WarpViewActivity extends WarpBaseActivity {
}
public static Intent createIntentFromSessionUUID(Context context, String sessionUUID, String source) {
Intent intent = new Intent(context, WarpViewActivity.class);
intent.putExtra("sessionUUID", sessionUUID);
if (!TextUtils.isEmpty(source)) {
......@@ -412,10 +309,6 @@ public class WarpViewActivity extends WarpBaseActivity {
}
};
public static Handler getMetersHandler() {
return metersHandler;
}
public static boolean getWebviewSupermarket() {
return mWebviewSupermarket;
}
......@@ -423,24 +316,4 @@ public class WarpViewActivity extends WarpBaseActivity {
public static void setWebviewSupermarket(boolean isLoaded) {
mWebviewSupermarket = isLoaded;
}
private boolean isMyServiceRunning(Class<?> serviceClass) {
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceClass.getName().equals(service.service.getClassName())) {
return true;
}
}
return false;
}
private void checkBatteryOptimizationForWarplyHealth() {
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (!pm.isIgnoringBatteryOptimizations(getPackageName())) {
Intent intent = new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);
startActivityForResult(intent, 6001);
}
}
}
}
\ No newline at end of file
......
/*
* 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.activities;
import android.os.Bundle;
import android.util.Log;
import ly.warp.sdk.Warply;
public class WarplyActivity extends ApplicationSessionActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
// Pass a listener in so we can be notified of session starts.
setOnSessionStartedListener(new SessionStartedListener() {
public void onSessionStarted() {
Log.e("SessionExample", "Starting session.");
Warply.onApplicationEnterForeground();
}
});
// Pass a listener in so we can be notified of session stops.
setOnSessionStoppedListener(new SessionStoppedListener() {
public void onSessionStopped() {
Log.e("SessionExample", "Stopping session.");
Warply.onApplicationEnterBackground();
}
});
super.onCreate(savedInstanceState);
}
}
/*
* 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.activities;
import android.os.Bundle;
import android.util.Log;
import ly.warp.sdk.Warply;
public class WarplyListActivity extends ApplicationSessionListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
// Pass a listener in so we can be notified of session starts.
setOnSessionStartedListener(new SessionStartedListener() {
public void onSessionStarted() {
Log.e("SessionExample ", "Starting session.");
Warply.onApplicationEnterForeground();
}
});
// Pass a listener in so we can be notified of session stops.
setOnSessionStoppedListener(new SessionStoppedListener() {
public void onSessionStopped() {
Log.e("SessionExample ", "Stopping session.");
Warply.onApplicationEnterBackground();
}
});
super.onCreate(savedInstanceState);
}
}
package ly.warp.sdk.fragments;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
......@@ -21,21 +20,16 @@ import org.json.JSONObject;
import java.util.ArrayList;
import ly.warp.sdk.R;
import ly.warp.sdk.activities.TelematicsActivity;
import ly.warp.sdk.activities.TelematicsHistoryActivity;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.UnifiedCoupon;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyManager;
public class HomeFragment extends Fragment implements View.OnClickListener, SwipeRefreshLayout.OnRefreshListener {
private RelativeLayout mOptionOne, mOptionTwo, mOptionThree, mRlDriving,
mRlDrivingHistory, mPbLoading;
private RelativeLayout mOptionOne, mOptionTwo, mOptionThree, mPbLoading;
private TextView mTvUsername, mTvUser;
private SwipeRefreshLayout mSwipeRefresh;
private EditText mEtGuid;
......@@ -70,14 +64,6 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
mOptionThreeImage.setImageResource(R.drawable.tv_option);
mTvUsername = view.findViewById(R.id.welcome_user_txt);
if (WarplyManagerHelper.getConsumer() != null)
mTvUsername.setText(String.format(getResources().getString(R.string.welcome_user),
WarplyManagerHelper.getConsumer().getFirstName() + " " + WarplyManagerHelper.getConsumer().getLastName()));
mRlDriving = view.findViewById(R.id.rl_driving);
mRlDriving.setOnClickListener(this);
mRlDrivingHistory = view.findViewById(R.id.rl_driving_history);
mRlDrivingHistory.setOnClickListener(this);
mPbLoading = view.findViewById(R.id.pb_loading);
mPbLoading.setOnTouchListener((v, event) -> true);
......@@ -99,13 +85,6 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
mLlAuthLogin.setVisibility(View.GONE);
mLlAuthLogout.setVisibility(View.VISIBLE);
mTvUser.setVisibility(View.VISIBLE);
if (WarplyManagerHelper.getConsumerInternal() != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata());
if (profMetadata != null && profMetadata.has("guid")) {
String userGuid = profMetadata.optString("guid", "");
mTvUser.setText(userGuid);
}
}
}
}
......@@ -116,18 +95,8 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
@Override
public void onRefresh() {
if (WarplyManagerHelper.getConsumerInternal() != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata());
if (profMetadata != null && profMetadata.has("guid")) {
String userGuid = profMetadata.optString("guid", "");
mTvUser.setText(userGuid);
}
}
if (WarplyDBHelper.getInstance(getActivity()).isTableNotEmpty("auth")) {
WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
WarplyManager.getCampaigns(mCampaignsCallback);
WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
mSwipeRefresh.setRefreshing(false);
} else {
mSwipeRefresh.setRefreshing(false);
......@@ -136,16 +105,6 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
@Override
public void onClick(View view) {
if (view.getId() == R.id.rl_driving) {
Intent intent = new Intent(getContext(), TelematicsActivity.class);
startActivity(intent);
return;
}
if (view.getId() == R.id.rl_driving_history) {
Intent intent = new Intent(getContext(), TelematicsHistoryActivity.class);
startActivity(intent);
return;
}
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
......@@ -176,31 +135,6 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
}
};
private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
Toast.makeText(getActivity(), "Coupons Success " + String.valueOf(result.size()), Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int errorCode) {
Toast.makeText(getActivity(), "Coupons Error", Toast.LENGTH_SHORT).show();
}
};
private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
@Override
public void onSuccess(ArrayList<UnifiedCoupon> result) {
Toast.makeText(getActivity(), "Unified Coupons Success " + String.valueOf(result.size()), Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int errorCode) {
Toast.makeText(getActivity(), "Unified Coupons Error", Toast.LENGTH_SHORT).show();
}
};
private final CallbackReceiver<JSONObject> mLogoutReceiver = new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
......@@ -236,9 +170,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
// }
// }
WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
WarplyManager.getCampaigns(mCampaignsCallback);
WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
}
@Override
......
package ly.warp.sdk.fragments;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.json.JSONObject;
import ly.warp.sdk.R;
import ly.warp.sdk.activities.GiftsForYouActivity;
import ly.warp.sdk.activities.MoreForYouActivity;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.views.adapters.ProfileCampaignAdapter;
public class LoyaltyFragment extends Fragment implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private RecyclerView mRecyclerDeals, mRecyclerGifts, mRecyclerMore;
private ProfileCampaignAdapter mAdapterDeals, mAdapterGifts, mAdapterMore;
private ImageView mIvMoreDeals, mIvMoreGifts, mIvMore;
private ConstraintLayout mClRewardsWallet, mClDealsOuter, mClGiftsOuter, mClMoreOuter;
private TextView mTvUsername;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_loyalty, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mClRewardsWallet = view.findViewById(R.id.cl_rewards_wallet);
mClRewardsWallet.setOnClickListener(this);
mTvUsername = view.findViewById(R.id.tv_name);
if (WarplyManagerHelper.getConsumer() != null)
mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_name),
WarplyManagerHelper.getConsumer().getFirstName() + " " + WarplyManagerHelper.getConsumer().getLastName()));
mIvMoreDeals = view.findViewById(R.id.iv_more);
mIvMoreDeals.setOnClickListener(this);
mIvMoreGifts = view.findViewById(R.id.iv_more2);
mIvMoreGifts.setOnClickListener(this);
mIvMore = view.findViewById(R.id.iv_more3);
mIvMore.setOnClickListener(this);
// mClDealsOuter = view.findViewById(R.id.cl_recycler_inner);
// mRecyclerDeals = view.findViewById(R.id.rv_deals);
// if (WarplyManagerHelper.getUniqueCampaignList().get("deals_for_you") != null && WarplyManagerHelper.getUniqueCampaignList().get("deals_for_you").size() > 0) {
// mRecyclerDeals.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
// mAdapterDeals = new ProfileCampaignAdapter(getContext(), WarplyManagerHelper.getUniqueCampaignList().get("deals_for_you"));
// mRecyclerDeals.setAdapter(mAdapterDeals);
// mAdapterDeals.getPositionClicks()
// .doOnNext(deal -> {
// startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(deal)));
// })
// .doOnError(error -> {
// })
// .subscribe();
// } else {
// mClDealsOuter.setVisibility(View.GONE);
// }
mClGiftsOuter = view.findViewById(R.id.cl_recycler_inner2);
mRecyclerGifts = view.findViewById(R.id.rv_gifts);
if (WarplyManagerHelper.getCampaignList() != null && WarplyManagerHelper.getCampaignList().size() > 0) {
CampaignList gfyList = new CampaignList();
for (Campaign camp : WarplyManagerHelper.getCampaignList()) {
if (camp.getOfferCategory().equals("gifts_for_you")) {
gfyList.add(camp);
}
}
mRecyclerGifts.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
mAdapterGifts = new ProfileCampaignAdapter(getContext(), gfyList);
mRecyclerGifts.setAdapter(mAdapterGifts);
mAdapterGifts.getPositionClicks()
.doOnNext(gift -> {
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields());
if (extraFields != null) {
if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
WarplyManagerHelper.openTelco(getContext(), gift);
return;
}
}
} catch (Exception exception) {
startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(gift)));
return;
}
if (gift.getType().equals("coupon")) {
WarplyManagerHelper.openCouponset(getContext(), gift);
} else
startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(gift)));
})
.doOnError(error -> {
})
.subscribe();
} else {
mClGiftsOuter.setVisibility(View.GONE);
}
mClMoreOuter = view.findViewById(R.id.cl_recycler_inner3);
mRecyclerMore = view.findViewById(R.id.rv_more);
if (WarplyManagerHelper.getCampaignList() != null && WarplyManagerHelper.getCampaignList().size() > 0) {
CampaignList mfyList = new CampaignList();
for (Campaign camp : WarplyManagerHelper.getCampaignList()) {
if (camp.getOfferCategory().equals("more_for_you")) {
mfyList.add(camp);
}
}
mRecyclerMore.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
mAdapterMore = new ProfileCampaignAdapter(getContext(), mfyList);
mRecyclerMore.setAdapter(mAdapterMore);
mAdapterMore.getPositionClicks()
.doOnNext(more -> {
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(more.getExtraFields());
if (extraFields != null) {
if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
WarplyManagerHelper.openTelco(getContext(), more);
return;
}
}
} catch (Exception exception) {
startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(more)));
return;
}
if (more.getType().equals("coupon")) {
WarplyManagerHelper.openCouponset(getContext(), more);
} else
startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(more)));
})
.doOnError(error -> {
})
.subscribe();
} else {
mClMoreOuter.setVisibility(View.GONE);
}
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.cl_rewards_wallet) {
return;
}
if (view.getId() == R.id.iv_more2) {
Intent intent = new Intent(getContext(), GiftsForYouActivity.class);
startActivity(intent);
return;
}
if (view.getId() == R.id.iv_more3) {
Intent intent = new Intent(getContext(), MoreForYouActivity.class);
startActivity(intent);
}
}
// ===========================================================
// Methods
// ===========================================================
public static Fragment newInstance() {
LoyaltyFragment loyaltyFragment = new LoyaltyFragment();
return loyaltyFragment;
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
/*
* 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.callbacks;
import org.json.JSONArray;
import org.json.JSONObject;
import ly.warp.sdk.io.models.AddressList;
/**
* Created by Panagiotis Triantafyllou on 18-Jan-22.
*/
public class AddressHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<AddressList> mListener;
private final String mRequestSignature;
public AddressHook(CallbackReceiver<AddressList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
int status = result.optInt("status", 2);
if (status == 1) {
JSONArray jArrayResult = result.optJSONArray("result");
if (jArrayResult == null) {
mListener.onFailure(2);
return;
}
mListener.onSuccess(new AddressList(result, mRequestSignature));
} else
mListener.onFailure(status);
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONArray;
import org.json.JSONObject;
import ly.warp.sdk.io.models.CardList;
/**
* Created by Panagiotis Triantafyllou on 11-Jan-22.
*/
public class CardsHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<CardList> mListener;
private final String mRequestSignature;
public CardsHook(CallbackReceiver<CardList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
int status = result.optInt("status", 2);
if (status == 1) {
JSONArray jArrayResult = result.optJSONArray("result");
if (jArrayResult == null) {
mListener.onFailure(2);
return;
}
mListener.onSuccess(new CardList(result, mRequestSignature));
} else
mListener.onFailure(status);
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONObject;
/**
* Created by Panagiotis Triantafyllou on 07-Dec-21.
*/
public class ContactHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<JSONObject> mListener;
private final String mRequestSignature;
public ContactHook(CallbackReceiver<JSONObject> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
mListener.onSuccess(result);
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONObject;
import ly.warp.sdk.io.models.ContentList;
/**
* Created by Panagiotis Triantafyllou on 07-Dec-21.
*/
public class ContentHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<ContentList> mListener;
private final String mRequestSignature;
public ContentHook(CallbackReceiver<ContentList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
mListener.onSuccess(new ContentList(result, mRequestSignature));
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONArray;
import org.json.JSONObject;
import ly.warp.sdk.io.models.CardList;
import ly.warp.sdk.io.models.CouponList;
/**
* Created by Panagiotis Triantafyllou on 14-Jan-22.
*/
public class CouponsHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<CouponList> mListener;
private final String mRequestSignature;
public CouponsHook(CallbackReceiver<CouponList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
int status = result.optInt("status", 2);
if (status == 1) {
JSONArray jArrayResult = result.optJSONArray("result");
if (jArrayResult == null) {
mListener.onFailure(2);
return;
}
mListener.onSuccess(new CouponList(result, mRequestSignature));
} else
mListener.onFailure(status);
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONArray;
import org.json.JSONObject;
import ly.warp.sdk.io.models.CouponsetsList;
/**
* Created by Panagiotis Triantafyllou on 04-Feb-22.
*/
public class CouponsetsHook implements CallbackReceiver<JSONObject> {
private final String JSON_KEY_MAPP = "MAPP_COUPON";
private final String JSON_KEY_CONTEXT = "context";
private final CallbackReceiver<CouponsetsList> mListener;
private final String mRequestSignature;
public CouponsetsHook(CallbackReceiver<CouponsetsList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
int status = result.optInt("status", 2);
if (status == 1) {
JSONObject couponsetsJSONObject = result.optJSONObject(JSON_KEY_CONTEXT);
if (couponsetsJSONObject != null) {
JSONArray jArrayResult = couponsetsJSONObject.optJSONArray(JSON_KEY_MAPP);
if (jArrayResult == null) {
mListener.onFailure(2);
return;
}
mListener.onSuccess(new CouponsetsList(couponsetsJSONObject, mRequestSignature));
}
} else
mListener.onFailure(status);
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONObject;
import ly.warp.sdk.io.models.MerchantCategoriesList;
/**
* Created by Panagiotis Triantafyllou on 07-Dec-21.
*/
public class MerchantCategoriesHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<MerchantCategoriesList> mListener;
private final String mRequestSignature;
public MerchantCategoriesHook(CallbackReceiver<MerchantCategoriesList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
mListener.onSuccess(new MerchantCategoriesList(result, mRequestSignature));
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONObject;
import ly.warp.sdk.io.models.MerchantList;
/**
* Created by Panagiotis Triantafyllou on 07-Dec-21.
*/
public class MerchantsHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<MerchantList> mListener;
private final String mRequestSignature;
public MerchantsHook(CallbackReceiver<MerchantList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
mListener.onSuccess(new MerchantList(result, mRequestSignature));
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import android.text.TextUtils;
import org.json.JSONObject;
import java.util.ArrayList;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.NewCampaign;
import ly.warp.sdk.io.models.NewCampaignList;
import ly.warp.sdk.utils.WarpJSONParser;
/**
* Created by Panagiotis Triantafyllou on 12-May-22.
*/
public class NewCampaignsHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<ArrayList<Campaign>> mListener;
private final String mRequestSignature;
public NewCampaignsHook(CallbackReceiver<ArrayList<Campaign>> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
int status = result.optInt("status", 2);
if (status == 1) {
NewCampaignList cmpList = new NewCampaignList(result, mRequestSignature);
ArrayList<Campaign> tempCampaigns = new ArrayList<>();
for (NewCampaign newCamp : cmpList) {
Campaign camp = new Campaign();
camp.setIndexUrl(newCamp.getIndexUrl());
camp.setLogoUrl(newCamp.getLogoUrl());
camp.setMessage(newCamp.getMessage());
camp.setOfferCategory(newCamp.getCommunicationCategory());
camp.setSessionUUID(newCamp.getCommunicationUUID());
camp.setTitle(newCamp.getTitle());
camp.setSubtitle(newCamp.getSubtitle());
camp.setSorting(newCamp.getSorting());
camp.setNew(newCamp.getIsNew());
camp.setType(newCamp.getCampaignType());
try {
camp.setExtraFields(newCamp.getExtraFields().toString());
if (!TextUtils.isEmpty(newCamp.getExtraFields().toString())) {
JSONObject extraFieldsResp = WarpJSONParser.getJSONFromString(newCamp.getExtraFields().toString());
if (extraFieldsResp != null) {
if (extraFieldsResp.has("Banner_title")) {
camp.setBannerTitle(extraFieldsResp.optString("Banner_title", ""));
}
if (extraFieldsResp.has("Banner_img")) {
camp.setBannerImage(extraFieldsResp.optString("Banner_img", ""));
}
}
} else {
camp.setBannerImage("");
camp.setBannerTitle("");
}
} catch (NullPointerException e) {
camp.setExtraFields("");
camp.setBannerImage("");
camp.setBannerTitle("");
e.printStackTrace();
}
try {
camp.setCampaignTypeSettings(newCamp.getSettings().toString());
} catch (NullPointerException e) {
camp.setCampaignTypeSettings("");
e.printStackTrace();
}
tempCampaigns.add(camp);
}
mListener.onSuccess(tempCampaigns);
} else
mListener.onFailure(status);
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONObject;
import ly.warp.sdk.io.models.PacingDetails;
/**
* Created by Panagiotis Triantafyllou on 24-June-22.
*/
public class PacingDetailsHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<PacingDetails> mListener;
private final String mRequestSignature;
public PacingDetailsHook(CallbackReceiver<PacingDetails> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
int status = result.optInt("status", 2);
if (status == 1) {
mListener.onSuccess(new PacingDetails(result));
} else
mListener.onFailure(status);
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONArray;
import org.json.JSONObject;
import ly.warp.sdk.io.models.PointsList;
/**
* Created by Panagiotis Triantafyllou on 17-Jan-22.
*/
public class PointsHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<PointsList> mListener;
private final String mRequestSignature;
public PointsHook(CallbackReceiver<PointsList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
int status = result.optInt("status", 2);
if (status == 1) {
JSONArray jArrayResult = result.optJSONArray("result");
if (jArrayResult == null) {
mListener.onFailure(2);
return;
}
mListener.onSuccess(new PointsList(result, mRequestSignature));
} else
mListener.onFailure(status);
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONObject;
import ly.warp.sdk.io.models.ProductList;
/**
* Created by Panagiotis Triantafyllou on 07-Dec-21.
*/
public class ProductsHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<ProductList> mListener;
private final String mRequestSignature;
public ProductsHook(CallbackReceiver<ProductList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
mListener.onSuccess(new ProductList(result, mRequestSignature));
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONArray;
import org.json.JSONObject;
import ly.warp.sdk.io.models.SharingList;
/**
* Created by Panagiotis Triantafyllou on 19-July-22.
*/
public class SharingHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<SharingList> mListener;
private final String mRequestSignature;
public SharingHook(CallbackReceiver<SharingList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
int status = result.optInt("status", 2);
if (status == 1) {
JSONArray jArrayResult = result.optJSONArray("result");
if (jArrayResult == null) {
mListener.onFailure(2);
return;
}
mListener.onSuccess(new SharingList(result, mRequestSignature));
} else
mListener.onFailure(status);
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONObject;
import ly.warp.sdk.io.models.TagsCategoriesList;
/**
* Created by Panagiotis Triantafyllou on 07-Dec-21.
*/
public class TagsCategoriesHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<TagsCategoriesList> mListener;
private final String mRequestSignature;
public TagsCategoriesHook(CallbackReceiver<TagsCategoriesList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
mListener.onSuccess(new TagsCategoriesList(result, mRequestSignature));
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONObject;
import ly.warp.sdk.io.models.TagsList;
/**
* Created by Panagiotis Triantafyllou on 07-Dec-21.
*/
public class TagsHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<TagsList> mListener;
private final String mRequestSignature;
public TagsHook(CallbackReceiver<TagsList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
mListener.onSuccess(new TagsList(result, mRequestSignature));
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
import org.json.JSONArray;
import org.json.JSONObject;
import ly.warp.sdk.io.models.TransactionsList;
/**
* Created by Panagiotis Triantafyllou on 17-Jan-22.
*/
public class TransactionsHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<TransactionsList> mListener;
private final String mRequestSignature;
public TransactionsHook(CallbackReceiver<TransactionsList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
@Override
public void onSuccess(JSONObject result) {
if (mListener != null) {
int status = result.optInt("status", 2);
if (status == 1) {
JSONArray jArrayResult = result.optJSONArray("result");
if (jArrayResult == null) {
mListener.onFailure(2);
return;
}
mListener.onSuccess(new TransactionsList(result, mRequestSignature));
} else
mListener.onFailure(status);
}
}
@Override
public void onFailure(int errorCode) {
if (mListener != null)
mListener.onFailure(errorCode);
}
}
/*
* 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.callbacks;
public interface WarplyHealthCallback {
void onStepCount(long stepsCount);
}
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 30-April-24.
*/
public class ActiveBoxCouponEventModel {
private boolean pressed;
public ActiveBoxCouponEventModel() {
this.pressed = true;
}
public boolean isPressed() {
return pressed;
}
public void setPressed(boolean pressed) {
this.pressed = pressed;
}
}
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 30-April-24.
*/
public class ActiveBoxCouponModel {
private String value;
private String code;
public ActiveBoxCouponModel() {
this.value = "";
this.code = "";
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 29-June-22.
*/
public class ActiveDFYCouponEventModel {
private boolean pressed;
public ActiveDFYCouponEventModel() {
this.pressed = true;
}
public boolean isPressed() {
return pressed;
}
public void setPressed(boolean pressed) {
this.pressed = pressed;
}
}
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 22-June-22.
*/
public class ActiveDFYCouponModel {
private String value;
private String date;
private String code;
public ActiveDFYCouponModel() {
this.value = "";
this.date = "";
this.code = "";
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
/*
* 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 android.os.Parcel;
import android.os.Parcelable;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.constants.WarpConstants;
/**
* Created by Panagiotis Triantafyllou on 18-Jan-22.
*/
public class Address implements Parcelable, Serializable {
private static final long serialVersionUID = -4754964462459705285L;
/* Constants used to export the campaign in JSON formal and vice versa */
private static final String ADDRESS_NAME = "address_name";
private static final String ADDRESS_NUMBER = "address_number";
private static final String CITY = "city";
private static final String COUNTRY = "country";
private static final String DOORBELL = "doorbel";
private static final String FLOOR_NUMBER = "floor_number";
private static final String FRIENDLY_NAME = "friendly_name";
private static final String LATITUDE = "latitude";
private static final String LONGITUDE = "longitude";
private static final String NOTES = "notes";
private static final String POSTAL_CODE = "postal_code";
private static final String REGION = "region";
private static final String UUID = "uuid";
/* Member variables of the Campaign object */
private String addressName = "";
private int addressNumber = 0;
private String city = "";
private String country = "";
private String doorbell = "";
private String floorNumber = "";
private String friendlyName = "";
private double latitude = 0.0d;
private double longitude = 0.0d;
private String notes = "";
private String postalCode = "";
private String region = "";
private String uuid = "";
/**
* Basic constructor used to create an object from a String, representing a
* JSON Object
*
* @param json The String, representing the JSON Object
* @throws JSONException Thrown if the String cannot be converted to JSON
*/
public Address(String json) throws JSONException {
this(new JSONObject(json));
}
/**
* Constructor used to create an Object from a given JSON Object
*
* @param json JSON Object used to create the Address
*/
public Address(JSONObject json) {
if (json != null) {
this.addressName = json.optString(ADDRESS_NAME);
this.addressNumber = json.optInt(ADDRESS_NUMBER);
this.city = json.optString(CITY);
this.country = json.optString(COUNTRY);
this.doorbell = json.optString(DOORBELL);
this.floorNumber = json.optString(FLOOR_NUMBER);
this.friendlyName = json.optString(FRIENDLY_NAME);
this.latitude = json.optDouble(LATITUDE);
this.longitude = json.optDouble(LONGITUDE);
this.notes = json.optString(NOTES);
this.postalCode = json.optString(POSTAL_CODE);
this.region = json.optString(REGION);
this.uuid = json.optString(UUID);
}
}
public Address(Parcel source) {
this.addressName = source.readString();
this.addressNumber = source.readInt();
this.city = source.readString();
this.country = source.readString();
this.doorbell = source.readString();
this.floorNumber = source.readString();
this.friendlyName = source.readString();
this.latitude = source.readDouble();
this.longitude = source.readDouble();
this.notes = source.readString();
this.postalCode = source.readString();
this.region = source.readString();
this.uuid = source.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.addressName);
dest.writeInt(this.addressNumber);
dest.writeString(this.city);
dest.writeString(this.country);
dest.writeString(this.doorbell);
dest.writeString(this.floorNumber);
dest.writeString(this.friendlyName);
dest.writeDouble(this.latitude);
dest.writeDouble(this.longitude);
dest.writeString(this.notes);
dest.writeString(this.postalCode);
dest.writeString(this.region);
dest.writeString(this.uuid);
}
/**
* Converts the Address into a JSON Object
*
* @return The JSON Object created from this Address
*/
public JSONObject toJSONObject() {
JSONObject jObj = new JSONObject();
try {
jObj.putOpt(ADDRESS_NAME, this.addressName);
jObj.putOpt(ADDRESS_NUMBER, this.addressNumber);
jObj.putOpt(CITY, this.city);
jObj.putOpt(COUNTRY, this.country);
jObj.putOpt(DOORBELL, this.doorbell);
jObj.putOpt(FLOOR_NUMBER, this.floorNumber);
jObj.putOpt(FRIENDLY_NAME, this.friendlyName);
jObj.putOpt(LATITUDE, this.latitude);
jObj.putOpt(LONGITUDE, this.longitude);
jObj.putOpt(NOTES, this.notes);
jObj.putOpt(POSTAL_CODE, this.postalCode);
jObj.putOpt(REGION, this.region);
jObj.putOpt(UUID, this.uuid);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
}
}
return jObj;
}
/**
* String representation of the Address, as a JSON object
*
* @return A String representation of JSON object
*/
public String toString() {
if (toJSONObject() != null)
return toJSONObject().toString();
return null;
}
/**
* String representation of the Address, as a human readable JSON object
*
* @return A human readable String representation of JSON object
*/
public String toHumanReadableString() {
String humanReadableString = null;
try {
humanReadableString = toJSONObject().toString(2);
} catch (JSONException e) {
WarpUtils.warn("Failed converting Address JSON object to String", e);
}
return humanReadableString;
}
// ================================================================================
// Getters
// ================================================================================
public String getAddressName() {
return addressName;
}
public int getAddressNumber() {
return addressNumber;
}
public String getCity() {
return city;
}
public String getCountry() {
return country;
}
public String getDoorbell() {
return doorbell;
}
public String getFloorNumber() {
return floorNumber;
}
public String getFriendlyName() {
return friendlyName;
}
public double getLatitude() {
return latitude;
}
public double getLongitude() {
return longitude;
}
public String getNotes() {
return notes;
}
public String getPostalCode() {
return postalCode;
}
public String getRegion() {
return region;
}
public String getUuid() {
return uuid;
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<Address> CREATOR = new Creator<Address>() {
public Address createFromParcel(Parcel source) {
return new Address(source);
}
public Address[] newArray(int size) {
return new Address[size];
}
};
}
/*
* 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 androidx.annotation.NonNull;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
/**
* Created by Panagiotis Triantafyllou on 18-Jan-22.
*/
public class AddressList extends ArrayList<Address> {
/**
* Generated for serialized class
*/
private static final long serialVersionUID = -188843583823948267L;
private static final String JSON_KEY_RESULT = "result";
private String mRequestSignature = "";
private AddressList(String requestSignature) {
this.mRequestSignature = requestSignature;
}
public AddressList() {
super();
}
/**
* Constructor used to create the CouponList from a JSON Object.
*
* @param addressListJSONObject The JSON Object, used to create the AddressList
*/
public AddressList(JSONObject addressListJSONObject, String requestSignature) {
this(requestSignature);
if (addressListJSONObject == null)
return;
JSONArray jArray = addressListJSONObject.optJSONArray(JSON_KEY_RESULT);
if (jArray != null && jArray.length() > 1) {
JSONArray jar = jArray.optJSONArray(1);
if (jar != null) {
for (int i = 0, lim = jar.length(); i < lim; ++i) {
add(new Address(jar.optJSONObject(i)));
}
}
}
}
@NonNull
public String getRequestSignature() {
return mRequestSignature;
}
}
/*
* 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 android.os.Parcel;
import android.os.Parcelable;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.constants.WarpConstants;
/**
* Created by Panagiotis Triantafyllou on 11-Jan-22.
*/
public class Card implements Parcelable, Serializable {
private static final long serialVersionUID = -4754964462459705285L;
/* Constants used to export the campaign in JSON formal and vice versa */
private static final String ACTIVE = "active";
private static final String CARD_ISSUER = "card_issuer";
private static final String CARD_NUMBER = "card_number";
private static final String CARD_HOLDER = "cardholder_name";
private static final String CARD_EXTRA_FIELDS = "extra_fields";
private static final String CARD_LAST_USED = "last_used";
private static final String CARD_TOKEN = "token";
/* Member variables of the Campaign object */
private boolean active = false;
private String cardIssuer = "";
private String cardNumber = "";
private String cardHolder = "";
private JSONObject cardExtraFields = new JSONObject();
private String cardLastUsed = "";
private String cardToken = "";
/**
* Basic constructor used to create an object from a String, representing a
* JSON Object
*
* @param json The String, representing the JSON Object
* @throws JSONException Thrown if the String cannot be converted to JSON
*/
public Card(String json) throws JSONException {
this(new JSONObject(json));
}
/**
* Constructor used to create an Object from a given JSON Object
*
* @param json JSON Object used to create the Card
*/
public Card(JSONObject json) {
if (json != null) {
this.active = json.optBoolean(ACTIVE);
this.cardIssuer = json.optString(CARD_ISSUER);
this.cardNumber = json.optString(CARD_NUMBER);
this.cardHolder = json.optString(CARD_HOLDER);
this.cardExtraFields = json.optJSONObject(CARD_EXTRA_FIELDS);
this.cardLastUsed = json.optString(CARD_LAST_USED);
this.cardToken = json.optString(CARD_TOKEN);
}
}
public Card(Parcel source) {
this.active = source.readByte() != 0;
this.cardIssuer = source.readString();
this.cardNumber = source.readString();
this.cardHolder = source.readString();
this.cardLastUsed = source.readString();
this.cardToken = source.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeByte((byte) (this.active ? 1 : 0));
dest.writeString(this.cardIssuer);
dest.writeString(this.cardNumber);
dest.writeString(this.cardHolder);
dest.writeString(this.cardLastUsed);
dest.writeString(this.cardToken);
}
/**
* Converts the Card into a JSON Object
*
* @return The JSON Object created from this Card
*/
public JSONObject toJSONObject() {
JSONObject jObj = new JSONObject();
try {
jObj.putOpt(ACTIVE, this.active);
jObj.putOpt(CARD_ISSUER, this.cardIssuer);
jObj.putOpt(CARD_NUMBER, this.cardNumber);
jObj.putOpt(CARD_HOLDER, this.cardHolder);
jObj.putOpt(CARD_EXTRA_FIELDS, this.cardExtraFields);
jObj.putOpt(CARD_LAST_USED, this.cardLastUsed);
jObj.putOpt(CARD_TOKEN, this.cardToken);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
}
}
return jObj;
}
/**
* String representation of the Card, as a JSON object
*
* @return A String representation of JSON object
*/
public String toString() {
if (toJSONObject() != null)
return toJSONObject().toString();
return null;
}
/**
* String representation of the Card, as a human readable JSON object
*
* @return A human readable String representation of JSON object
*/
public String toHumanReadableString() {
String humanReadableString = null;
try {
humanReadableString = toJSONObject().toString(2);
} catch (JSONException e) {
WarpUtils.warn("Failed converting Card JSON object to String", e);
}
return humanReadableString;
}
// ================================================================================
// Getters
// ================================================================================
public boolean isActive() {
return active;
}
public String getCardIssuer() {
return cardIssuer;
}
public String getCardNumber() {
return cardNumber;
}
public String getCardHolder() {
return cardHolder;
}
public JSONObject getCardExtraFields() {
return cardExtraFields;
}
public String getCardLastUsed() {
return cardLastUsed;
}
public String getCardToken() {
return cardToken;
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<Card> CREATOR = new Creator<Card>() {
public Card createFromParcel(Parcel source) {
return new Card(source);
}
public Card[] newArray(int size) {
return new Card[size];
}
};
}
/*
* 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 androidx.annotation.NonNull;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
/**
* Created by Panagiotis Triantafyllou on 11-Jan-22.
*/
public class CardList extends ArrayList<Card> {
/**
* Generated for serialized class
*/
private static final long serialVersionUID = -188843583823948267L;
private static final String JSON_KEY_RESULT = "result";
private String mRequestSignature = "";
private CardList(String requestSignature) {
this.mRequestSignature = requestSignature;
}
public CardList() {
super();
}
/**
* Constructor used to create the CardList from a JSON Object.
*
* @param cardListJSONObject The JSON Object, used to create the CardList
*/
public CardList(JSONObject cardListJSONObject, String requestSignature) {
this(requestSignature);
if (cardListJSONObject == null)
return;
JSONArray jArray = cardListJSONObject.optJSONArray(JSON_KEY_RESULT);
if (jArray != null) {
for (int i = 0, lim = jArray.length(); i < lim; ++i) {
add(new Card(jArray.optJSONObject(i)));
}
}
}
@NonNull
public String getRequestSignature() {
return mRequestSignature;
}
}
/*
* 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 androidx.annotation.NonNull;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
/**
* Created by Panagiotis Triantafyllou on 07-Dec-21.
*/
public class ContentList extends ArrayList<Content> {
/**
* Generated for serialized class
*/
private static final long serialVersionUID = -188843583823948267L;
private static final String JSON_KEY_MAPP = "CONTENT";
private static final String JSON_KEY_CONTEXT = "context";
private String mRequestSignature = "";
private ContentList(String requestSignature) {
this.mRequestSignature = requestSignature;
}
public ContentList() {
super();
}
/**
* Constructor used to create the ContentList from a JSON Object.
*
* @param contentListJSONObject The JSON Object, used to create the ContentList
*/
public ContentList(JSONObject contentListJSONObject, String requestSignature) {
this(requestSignature);
contentListJSONObject = contentListJSONObject.optJSONObject(JSON_KEY_CONTEXT);
if (contentListJSONObject == null)
return;
JSONArray jArray = contentListJSONObject.optJSONArray(JSON_KEY_MAPP);
if (jArray != null) {
for (int i = 0, lim = jArray.length(); i < lim; ++i) {
add(new Content(jArray.optJSONObject(i)));
}
}
}
@NonNull
public String getRequestSignature() {
return mRequestSignature;
}
}
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 12-July-22.
*/
public class ContexualEventModel {
private boolean success;
public ContexualEventModel() {
this.success = true;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
}
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 21-June-22.
*/
public class CouponEventModel {
private boolean success;
public CouponEventModel() {
this.success = true;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
}
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 05-Sept-22.
*/
public class CouponsEventModel {
private boolean success;
public CouponsEventModel() {
this.success = true;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
}
/*
* 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 androidx.annotation.NonNull;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
/**
* Created by Panagiotis Triantafyllou on 04-Feb-22.
*/
public class CouponsetsList extends ArrayList<Couponset> {
/**
* Generated for serialized class
*/
private static final long serialVersionUID = -188843583823948267L;
private static final String JSON_KEY_COUPON = "MAPP_COUPON";
private String mRequestSignature = "";
private CouponsetsList(String requestSignature) {
this.mRequestSignature = requestSignature;
}
public CouponsetsList() {
super();
}
/**
* Constructor used to create the CouponsetsList from a JSON Object.
*
* @param addressListJSONObject The JSON Object, used to create the CouponsetsList
*/
public CouponsetsList(JSONObject addressListJSONObject, String requestSignature) {
this(requestSignature);
if (addressListJSONObject == null)
return;
JSONArray jArray = addressListJSONObject.optJSONArray(JSON_KEY_COUPON);
if (jArray != null && jArray.length() > 0) {
for (int i = 0, lim = jArray.length(); i < lim; ++i) {
add(new Couponset(jArray.optJSONObject(i)));
}
}
}
@NonNull
public String getRequestSignature() {
return mRequestSignature;
}
}
package ly.warp.sdk.io.models;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.text.TextPaint;
import android.text.style.MetricAffectingSpan;
public class CustomTypefaceSpan extends MetricAffectingSpan {
private final Typeface typeface;
public CustomTypefaceSpan(Typeface typeface) {
this.typeface = typeface;
}
@Override
public void updateMeasureState(TextPaint p) {
applyCustomTypeFace(p, typeface);
}
@Override
public void updateDrawState(TextPaint tp) {
applyCustomTypeFace(tp, typeface);
}
private static void applyCustomTypeFace(Paint paint, Typeface tf) {
int oldStyle;
Typeface old = paint.getTypeface();
if (old == null) {
oldStyle = 0;
} else {
oldStyle = old.getStyle();
}
int fake = oldStyle & ~tf.getStyle();
if ((fake & Typeface.BOLD) != 0) {
paint.setFakeBoldText(true);
}
if ((fake & Typeface.ITALIC) != 0) {
paint.setTextSkewX(-0.25f);
}
paint.setTypeface(tf);
}
}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.