Panagiotis Triantafyllou

remove code for magenta

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