Panagiotis Triantafyllou

magenta fixes and additions

...@@ -4,6 +4,14 @@ ...@@ -4,6 +4,14 @@
4 <selectionStates> 4 <selectionStates>
5 <SelectionState runConfigName="app"> 5 <SelectionState runConfigName="app">
6 <option name="selectionMode" value="DROPDOWN" /> 6 <option name="selectionMode" value="DROPDOWN" />
7 + <DropdownSelection timestamp="2025-02-13T08:44:19.612560Z">
8 + <Target type="DEFAULT_BOOT">
9 + <handle>
10 + <DeviceId pluginId="PhysicalDevice" identifier="serial=R58M42EM7YT" />
11 + </handle>
12 + </Target>
13 + </DropdownSelection>
14 + <DialogSelection />
7 </SelectionState> 15 </SelectionState>
8 </selectionStates> 16 </selectionStates>
9 </component> 17 </component>
......
...@@ -55,6 +55,7 @@ dependencies { ...@@ -55,6 +55,7 @@ dependencies {
55 api "androidx.security:security-crypto:1.1.0-alpha03" 55 api "androidx.security:security-crypto:1.1.0-alpha03"
56 // For minSDK 23 use 1.0.0, for minSDK 21 use 1.1.0 that is currently in alpha 56 // For minSDK 23 use 1.0.0, for minSDK 21 use 1.1.0 that is currently in alpha
57 api 'org.altbeacon:android-beacon-library:2.19.3' 57 api 'org.altbeacon:android-beacon-library:2.19.3'
58 + api 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
58 api 'io.reactivex.rxjava3:rxjava:3.1.8' 59 api 'io.reactivex.rxjava3:rxjava:3.1.8'
59 api 'io.reactivex.rxjava3:rxandroid:3.0.2' 60 api 'io.reactivex.rxjava3:rxandroid:3.0.2'
60 implementation 'com.google.android.material:material:1.5.0' 61 implementation 'com.google.android.material:material:1.5.0'
......
...@@ -51,7 +51,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -51,7 +51,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
51 mBottomNavigationView = findViewById(R.id.bt_tabs); 51 mBottomNavigationView = findViewById(R.id.bt_tabs);
52 52
53 if (WarplyDBHelper.getInstance(this).isTableNotEmpty("auth")) { 53 if (WarplyDBHelper.getInstance(this).isTableNotEmpty("auth")) {
54 - WarplyManager.getCampaigns(mCampaignsCallback); 54 + WarplyManager.getSupermarketCampaign(mCampaignsCallback);
55 } 55 }
56 56
57 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { 57 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
......
...@@ -176,7 +176,10 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -176,7 +176,10 @@ public class WarpViewActivity extends WarpBaseActivity {
176 176
177 @Subscribe() 177 @Subscribe()
178 public void onMessageEvent(WarplyEventBusManager event) { 178 public void onMessageEvent(WarplyEventBusManager event) {
179 - 179 + if (event.getQuestionnaire() != null) {
180 + setResult(RESULT_OK, new Intent());
181 + finish();
182 + }
180 } 183 }
181 184
182 // =========================================================== 185 // ===========================================================
......
...@@ -23,6 +23,7 @@ import ly.warp.sdk.R; ...@@ -23,6 +23,7 @@ import ly.warp.sdk.R;
23 import ly.warp.sdk.db.WarplyDBHelper; 23 import ly.warp.sdk.db.WarplyDBHelper;
24 import ly.warp.sdk.io.callbacks.CallbackReceiver; 24 import ly.warp.sdk.io.callbacks.CallbackReceiver;
25 import ly.warp.sdk.io.models.Campaign; 25 import ly.warp.sdk.io.models.Campaign;
26 +import ly.warp.sdk.utils.WarplyManagerHelper;
26 import ly.warp.sdk.utils.managers.WarplyManager; 27 import ly.warp.sdk.utils.managers.WarplyManager;
27 28
28 public class HomeFragment extends Fragment implements View.OnClickListener, SwipeRefreshLayout.OnRefreshListener { 29 public class HomeFragment extends Fragment implements View.OnClickListener, SwipeRefreshLayout.OnRefreshListener {
...@@ -31,7 +32,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip ...@@ -31,7 +32,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
31 private TextView mTvUsername, mTvUser; 32 private TextView mTvUsername, mTvUser;
32 private SwipeRefreshLayout mSwipeRefresh; 33 private SwipeRefreshLayout mSwipeRefresh;
33 private EditText mEtGuid; 34 private EditText mEtGuid;
34 - private LinearLayout mLlAuthLogin, mLlAuthLogout; 35 + private LinearLayout mLlAuthLogin, mLlAuthLogout, mRlSmFlow, mRlSmMap;
35 36
36 @Override 37 @Override
37 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 38 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
...@@ -72,6 +73,10 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip ...@@ -72,6 +73,10 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
72 mLlAuthLogout = view.findViewById(R.id.ll_auth_logout); 73 mLlAuthLogout = view.findViewById(R.id.ll_auth_logout);
73 mLlAuthLogout.setOnClickListener(this); 74 mLlAuthLogout.setOnClickListener(this);
74 mTvUser = view.findViewById(R.id.tv_login); 75 mTvUser = view.findViewById(R.id.tv_login);
76 + mRlSmFlow = view.findViewById(R.id.ll_sm_flow);
77 + mRlSmFlow.setOnClickListener(this);
78 + mRlSmMap = view.findViewById(R.id.ll_sm_map);
79 + mRlSmMap.setOnClickListener(this);
75 80
76 if (!WarplyDBHelper.getInstance(getActivity()).isTableNotEmpty("auth")) { 81 if (!WarplyDBHelper.getInstance(getActivity()).isTableNotEmpty("auth")) {
77 mTvUser.setVisibility(View.GONE); 82 mTvUser.setVisibility(View.GONE);
...@@ -94,7 +99,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip ...@@ -94,7 +99,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
94 @Override 99 @Override
95 public void onRefresh() { 100 public void onRefresh() {
96 if (WarplyDBHelper.getInstance(getActivity()).isTableNotEmpty("auth")) { 101 if (WarplyDBHelper.getInstance(getActivity()).isTableNotEmpty("auth")) {
97 - WarplyManager.getCampaigns(mCampaignsCallback); 102 + WarplyManager.getSupermarketCampaign(mCampaignsCallback);
98 mSwipeRefresh.setRefreshing(false); 103 mSwipeRefresh.setRefreshing(false);
99 } else { 104 } else {
100 mSwipeRefresh.setRefreshing(false); 105 mSwipeRefresh.setRefreshing(false);
...@@ -113,6 +118,14 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip ...@@ -113,6 +118,14 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
113 if (view.getId() == R.id.ll_auth_logout) { 118 if (view.getId() == R.id.ll_auth_logout) {
114 mPbLoading.setVisibility(View.VISIBLE); 119 mPbLoading.setVisibility(View.VISIBLE);
115 WarplyManager.logout(mLogoutReceiver); 120 WarplyManager.logout(mLogoutReceiver);
121 + return;
122 + }
123 + if (view.getId() == R.id.ll_sm_flow) {
124 + WarplyManagerHelper.openSuperMarketsFlow(getContext());
125 + return;
126 + }
127 + if (view.getId() == R.id.ll_sm_map) {
128 + WarplyManagerHelper.openSupermarketsMap(getContext());
116 } 129 }
117 } 130 }
118 131
...@@ -168,7 +181,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip ...@@ -168,7 +181,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
168 // } 181 // }
169 // } 182 // }
170 183
171 - WarplyManager.getCampaigns(mCampaignsCallback); 184 + WarplyManager.getSupermarketCampaign(mCampaignsCallback);
172 } 185 }
173 186
174 @Override 187 @Override
......
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.InboxStats;
31 -
32 -public class InboxStatsHook implements CallbackReceiver<JSONObject> {
33 -
34 - public InboxStatsHook(CallbackReceiver<InboxStats> receiver) {
35 - mReceiver = receiver;
36 - }
37 -
38 - private final CallbackReceiver<InboxStats> mReceiver;
39 -
40 - @Override
41 - public void onSuccess(JSONObject result) {
42 - mReceiver.onSuccess(new InboxStats(result));
43 - }
44 -
45 - @Override
46 - public void onFailure(int errorCode) {
47 - mReceiver.onFailure(errorCode);
48 - }
49 -}
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 ly.warp.sdk.utils.WarpUtils;
29 -import ly.warp.sdk.Warply;
30 -
31 -import org.json.JSONException;
32 -import org.json.JSONObject;
33 -
34 -public class InboxStats {
35 -
36 - /* Constants used to export the campaign in JSON formal and vice versa */
37 -
38 - private static final String TOTAL_COUNT = "count";
39 - private static final String NEW_COUNT = "new";
40 - private static final String UNREAD_COUNT = "unread";
41 -
42 - /* Member variables of the Campaign object */
43 -
44 - private int totalCount;
45 - private int newCount;
46 - private int unreadCount;
47 -
48 - /**
49 - * Basic constructor using a String, representing a JSON Object
50 - *
51 - * @param json
52 - * The String, representing the JSON Object
53 - * @throws JSONException
54 - * Thrown if the String cannot be converted to JSON
55 - */
56 - public InboxStats(String json) throws JSONException {
57 - this(new JSONObject(json));
58 - }
59 -
60 - /**
61 - * Constructor used to create an IboxStats object from a given JSON object
62 - *
63 - * @param jObj
64 - * JSON Object used to create the Campaign
65 - */
66 - public InboxStats(JSONObject jObj) {
67 - JSONObject inboxStatus = null;
68 - try {
69 - inboxStatus = jObj.getJSONObject("context").getJSONObject("MAPP_OFFER");
70 - } catch (JSONException e) {
71 - WarpUtils.warn("Exception on parsing Inbox Status JSON", e);
72 - }
73 - totalCount = 0;
74 - newCount = 0;
75 - unreadCount = 0;
76 - if (inboxStatus != null) {
77 - if (inboxStatus.has(TOTAL_COUNT))
78 - totalCount = inboxStatus.optInt(TOTAL_COUNT);
79 - if (inboxStatus.has(NEW_COUNT))
80 - newCount = inboxStatus.optInt(NEW_COUNT);
81 - if (inboxStatus.has(UNREAD_COUNT))
82 - unreadCount = inboxStatus.optInt(UNREAD_COUNT);
83 - }
84 - }
85 -
86 - /**
87 - * Converts IboxStats into a JSON Object
88 - *
89 - * @return The JSON Object created
90 - */
91 - public JSONObject toJSONObject() {
92 - JSONObject jObj = new JSONObject();
93 - try {
94 - jObj.putOpt(TOTAL_COUNT, totalCount);
95 - jObj.putOpt(NEW_COUNT, newCount);
96 - jObj.putOpt(UNREAD_COUNT, unreadCount);
97 - } catch (JSONException e) {
98 - }
99 - return jObj;
100 - }
101 -
102 - /**
103 - * String representation of the IbnoxStats, as a JSON object
104 - */
105 - @Override
106 - public String toString() {
107 - return toJSONObject().toString();
108 - }
109 -
110 - /**
111 - * String representation of the IboxStats, as a human readable JSON object
112 - *
113 - * @return A human readable String representation
114 - */
115 - public String toHumanReadableString() {
116 - String s = null;
117 - try {
118 - s = toJSONObject().toString(2);
119 - } catch (JSONException e) {
120 - }
121 - return s;
122 - }
123 -
124 - /**
125 - * The total number of active campaigns - This is the number of campaigns
126 - * that the {@link Warply#getInbox(ly.warp.sdk.io.callbacks.CallbackReceiver)
127 - * Warply.getInbox} call with return
128 - */
129 - public int getTotalCount() {
130 - return totalCount;
131 - }
132 -
133 - /**
134 - * The number of campaigns that have never been returned with a call to
135 - * {@link Warply#getInbox(ly.warp.sdk.io.callbacks.CallbackReceiver) Warply.getInbox}
136 - */
137 - public int getNewCount() {
138 - return newCount;
139 - }
140 -
141 - /**
142 - * The number of campaigns that have never been opened
143 - */
144 - public int getUnreadCount() {
145 - return unreadCount;
146 - }
147 -
148 -}
1 +package ly.warp.sdk.io.models;
2 +
3 +/**
4 + * Created by Panagiotis Triantafyllou on 20-June-22.
5 + */
6 +
7 +public class QuestionnaireEventModel {
8 + private String name;
9 + private String parameter;
10 +
11 + public QuestionnaireEventModel() {
12 + this.name = "";
13 + this.parameter = "";
14 + }
15 +
16 + public String getName() {
17 + return name;
18 + }
19 +
20 + public void setName(String name) {
21 + this.name = name;
22 + }
23 +
24 + public String getParameter() {
25 + return parameter;
26 + }
27 +
28 + public void setParameter(String parameter) {
29 + this.parameter = parameter;
30 + }
31 +}
...@@ -55,7 +55,8 @@ public class WarplyManagerHelper { ...@@ -55,7 +55,8 @@ public class WarplyManagerHelper {
55 // =========================================================== 55 // ===========================================================
56 56
57 private static CouponList mCouponRedeemedList = new CouponList(); 57 private static CouponList mCouponRedeemedList = new CouponList();
58 - private static ArrayList<Campaign> mCampaignListAll = new ArrayList<Campaign>(); 58 + private static ArrayList<Campaign> mCampaignListAll = new ArrayList<Campaign>(),
59 + mSupermarketCampaigns = new ArrayList<Campaign>();
59 60
60 // =========================================================== 61 // ===========================================================
61 // Methods for/from SuperClass/Interfaces 62 // Methods for/from SuperClass/Interfaces
...@@ -74,6 +75,11 @@ public class WarplyManagerHelper { ...@@ -74,6 +75,11 @@ public class WarplyManagerHelper {
74 mCampaignListAll.addAll(campaignList); 75 mCampaignListAll.addAll(campaignList);
75 } 76 }
76 77
78 + public static void setSupermarketCampaigns(ArrayList<Campaign> campaignList) {
79 + mSupermarketCampaigns.clear();
80 + mSupermarketCampaigns.addAll(campaignList);
81 + }
82 +
77 public static void setCouponRedeemedList(CouponList couponRedeemedList) { 83 public static void setCouponRedeemedList(CouponList couponRedeemedList) {
78 mCouponRedeemedList.clear(); 84 mCouponRedeemedList.clear();
79 mCouponRedeemedList.addAll(couponRedeemedList); 85 mCouponRedeemedList.addAll(couponRedeemedList);
...@@ -111,7 +117,7 @@ public class WarplyManagerHelper { ...@@ -111,7 +117,7 @@ public class WarplyManagerHelper {
111 } 117 }
112 118
113 public static void openSuperMarketsFlow(Context context) { 119 public static void openSuperMarketsFlow(Context context) {
114 - if (mCampaignListAll == null || mCampaignListAll.isEmpty()) { 120 + if (mSupermarketCampaigns == null || mSupermarketCampaigns.isEmpty()) {
115 return; 121 return;
116 } 122 }
117 123
...@@ -131,7 +137,7 @@ public class WarplyManagerHelper { ...@@ -131,7 +137,7 @@ public class WarplyManagerHelper {
131 137
132 WarpUtils.setWebviewParams(context, params); 138 WarpUtils.setWebviewParams(context, params);
133 139
134 - context.startActivity(WarpViewActivity.createIntentFromURL(context, WarplyManagerHelper.constructCampaignUrl(mCampaignListAll.get(0)))); 140 + context.startActivity(WarpViewActivity.createIntentFromURL(context, WarplyManagerHelper.constructCampaignUrl(mSupermarketCampaigns.get(0))));
135 } 141 }
136 142
137 public static void openSupermarketsMap(Context context) { 143 public static void openSupermarketsMap(Context context) {
......
...@@ -25,23 +25,16 @@ ...@@ -25,23 +25,16 @@
25 25
26 package ly.warp.sdk.utils.managers; 26 package ly.warp.sdk.utils.managers;
27 27
28 -import android.content.Context;
29 -
30 -import androidx.annotation.NonNull;
31 import androidx.annotation.Nullable; 28 import androidx.annotation.Nullable;
32 29
33 import org.json.JSONException; 30 import org.json.JSONException;
34 import org.json.JSONObject; 31 import org.json.JSONObject;
35 32
36 import ly.warp.sdk.Warply; 33 import ly.warp.sdk.Warply;
37 -import ly.warp.sdk.io.callbacks.CallbackReceiver;
38 -import ly.warp.sdk.io.models.CampaignList;
39 import ly.warp.sdk.io.models.PushCampaign; 34 import ly.warp.sdk.io.models.PushCampaign;
40 -import ly.warp.sdk.io.request.WarplyInboxRequest;
41 import ly.warp.sdk.utils.WarpUtils; 35 import ly.warp.sdk.utils.WarpUtils;
42 import ly.warp.sdk.utils.constants.WarpConstants; 36 import ly.warp.sdk.utils.constants.WarpConstants;
43 37
44 -import static ly.warp.sdk.Warply.INSTANCE;
45 import static ly.warp.sdk.Warply.getWarplyContext; 38 import static ly.warp.sdk.Warply.getWarplyContext;
46 39
47 public class WarplyAnalyticsManager { 40 public class WarplyAnalyticsManager {
...@@ -57,30 +50,6 @@ public class WarplyAnalyticsManager { ...@@ -57,30 +50,6 @@ public class WarplyAnalyticsManager {
57 sendEvent(eventPage, eventId, metadata, false); 50 sendEvent(eventPage, eventId, metadata, false);
58 } 51 }
59 52
60 - public static void logTrackersEvent(Context context, String eventType, String eventName) {
61 - if (WarpUtils.getTrackersEnabled(context)) {
62 -// Warply.getInitializer(context).init();
63 - sendEvent(context, null, eventType.concat(":").concat(eventName), null, false);
64 - }
65 - }
66 -
67 - /**
68 - * Log screen events so after we can check if there are in app campaigns to show
69 - * (per screen or all screens). After we send the event with priority we make
70 - * a get_inbox request with extra parameters.
71 - *
72 - * @param eventPage
73 - * @param eventId
74 - * @param metadata
75 - * @param force
76 - * @param context
77 - */
78 - public static void logEventInApp(Context context, @Nullable String eventPage,
79 - @NonNull String eventId, @Nullable JSONObject metadata,
80 - boolean force) {
81 - sendEventInApp(context, eventPage, eventId, metadata, force);
82 - }
83 -
84 /** 53 /**
85 * Default method for logging events with high priority happening in a page 54 * Default method for logging events with high priority happening in a page
86 * 55 *
...@@ -102,19 +71,6 @@ public class WarplyAnalyticsManager { ...@@ -102,19 +71,6 @@ public class WarplyAnalyticsManager {
102 /*foreground ? "NB_WillEnterForeground" : "NB_DidEnterBackground"*/); 71 /*foreground ? "NB_WillEnterForeground" : "NB_DidEnterBackground"*/);
103 } 72 }
104 73
105 - public static void logUserReceivedPush(String sessionUUID) {
106 - JSONObject metadata = new JSONObject();
107 - try {
108 - metadata.putOpt("session_uuid", sessionUUID);
109 - } catch (JSONException e) {
110 - if (WarpConstants.DEBUG) {
111 - e.printStackTrace();
112 - }
113 - }
114 - sendEvent(WarpConstants.MICROAPP_APPLICATION_PAGE_ID,
115 - "NB_PushReceived", metadata, true);
116 - }
117 -
118 public static void logUserReceivedPush(PushCampaign pc) { 74 public static void logUserReceivedPush(PushCampaign pc) {
119 JSONObject metadata = new JSONObject(); 75 JSONObject metadata = new JSONObject();
120 try { 76 try {
...@@ -128,21 +84,11 @@ public class WarplyAnalyticsManager { ...@@ -128,21 +84,11 @@ public class WarplyAnalyticsManager {
128 "NB_PushReceived", metadata, false); 84 "NB_PushReceived", metadata, false);
129 } 85 }
130 86
131 -// public static void logUserEngagedPush(JSONObject pushSessionUUID) {
132 -// sendEvent(WarpConstants.MICROAPP_APPLICATION_PAGE_ID, "NB_PushAck",
133 -// pushSessionUUID, true);
134 -// }
135 -
136 public static void logUserEngagedPush(JSONObject pushSessionUUID) { 87 public static void logUserEngagedPush(JSONObject pushSessionUUID) {
137 sendPushAckEvent(WarpConstants.MICROAPP_APPLICATION_PAGE_ID, "NB_PushAck", 88 sendPushAckEvent(WarpConstants.MICROAPP_APPLICATION_PAGE_ID, "NB_PushAck",
138 pushSessionUUID, false); 89 pushSessionUUID, false);
139 } 90 }
140 91
141 - public static void logUserReceivedPush(JSONObject pushSessionUUID) {
142 - sendEvent(WarpConstants.MICROAPP_APPLICATION_PAGE_ID,
143 - "NB_PushReceived", pushSessionUUID, true);
144 - }
145 -
146 /** 92 /**
147 * Send an event to the Warply server 93 * Send an event to the Warply server
148 * 94 *
...@@ -174,81 +120,6 @@ public class WarplyAnalyticsManager { ...@@ -174,81 +120,6 @@ public class WarplyAnalyticsManager {
174 WarpUtils.log("analytics micro-app is not active"); 120 WarpUtils.log("analytics micro-app is not active");
175 } 121 }
176 122
177 - private static void sendEvent(Context context, @Nullable String eventPage, String eventId, @Nullable JSONObject metadata, boolean force) {
178 - boolean isInAppAnalyticsMicroAppActive = WarplyServerPreferencesManager.isMicroAppActive(context, WarpConstants.MicroApp.CUSTOM_ANALYTICS);
179 - if (isInAppAnalyticsMicroAppActive)
180 - try {
181 - JSONObject jObj = new JSONObject();
182 - if (eventPage != null) {
183 - jObj.putOpt("page_id", eventPage);
184 - }
185 - jObj.putOpt("event_id", eventId);
186 - jObj.putOpt("time_submitted", System.currentTimeMillis() / 1000);
187 - if (metadata != null) {
188 - jObj.putOpt("action_metadata", metadata);
189 - }
190 - if (context != null)
191 - Warply.postMicroappData(context, WarpConstants.MICROAPP_INAPP_ANALYTICS, jObj, force);
192 - } catch (JSONException e) {
193 - if (WarpConstants.DEBUG) {
194 - e.printStackTrace();
195 - }
196 - }
197 - else
198 - WarpUtils.log("analytics micro-app is not active");
199 - }
200 -
201 - /**
202 - * Send an in app event to the Warply server and show a campaign per screen
203 - *
204 - * @param eventPage Event page ID
205 - * @param eventId Event ID
206 - * @param metadata Event metadata
207 - * @param force If this event should be forced or not
208 - */
209 - private static void sendEventInApp(final Context context, @Nullable String eventPage,
210 - @NonNull final String eventId, @Nullable JSONObject metadata, boolean force) {
211 - boolean isInAppAnalyticsMicroAppActive = WarplyServerPreferencesManager.isMicroAppActive(WarpConstants.MicroApp.CUSTOM_ANALYTICS);
212 - if (isInAppAnalyticsMicroAppActive) {
213 - try {
214 - JSONObject jObj = new JSONObject();
215 - if (eventPage != null) {
216 - jObj.putOpt("page_id", eventPage);
217 - }
218 - jObj.putOpt("event_id", eventId);
219 - jObj.putOpt("time_submitted", System.currentTimeMillis() / 1000);
220 - if (metadata != null) {
221 - jObj.putOpt("action_metadata", metadata);
222 - }
223 - Warply.postMicroappData(WarpConstants.MICROAPP_INAPP_ANALYTICS, jObj, force);
224 - } catch (JSONException e) {
225 - if (WarpConstants.DEBUG) {
226 - e.printStackTrace();
227 - }
228 - }
229 - } else
230 - WarpUtils.log("analytics micro-app is not active");
231 -
232 -
233 - // TODO: check for the interval else INSTANCE.getInAppCampaigns()
234 -// if() {
235 - WarplyInboxRequest inboxFilterRequest = new WarplyInboxRequest().setUseCache(false);
236 -
237 - Warply.getInboxInApp(inboxFilterRequest, new CallbackReceiver<CampaignList>() {
238 - @Override
239 - public void onSuccess(CampaignList result) {
240 - INSTANCE.mInAppCampaigns = result;
241 - }
242 -
243 - @Override
244 - public void onFailure(int errorCode) {
245 - }
246 - });
247 -// } else {
248 -//Warply.showInAppCampaign(context, eventId);
249 -// }
250 - }
251 -
252 private static void sendPushReceivedEvent(@Nullable String eventPage, String eventId, @Nullable JSONObject metadata, boolean force) { 123 private static void sendPushReceivedEvent(@Nullable String eventPage, String eventId, @Nullable JSONObject metadata, boolean force) {
253 boolean isInAppAnalyticsMicroAppActive = WarplyServerPreferencesManager 124 boolean isInAppAnalyticsMicroAppActive = WarplyServerPreferencesManager
254 .isMicroAppActive(WarpConstants.MicroApp.CUSTOM_ANALYTICS); 125 .isMicroAppActive(WarpConstants.MicroApp.CUSTOM_ANALYTICS);
......
...@@ -2,6 +2,7 @@ package ly.warp.sdk.utils.managers; ...@@ -2,6 +2,7 @@ package ly.warp.sdk.utils.managers;
2 2
3 import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel; 3 import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel;
4 import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; 4 import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
5 +import ly.warp.sdk.io.models.QuestionnaireEventModel;
5 import ly.warp.sdk.io.models.WarplyWebviewActivityCallbackEventModel; 6 import ly.warp.sdk.io.models.WarplyWebviewActivityCallbackEventModel;
6 import ly.warp.sdk.io.models.WarplyWebviewCallbackEventModel; 7 import ly.warp.sdk.io.models.WarplyWebviewCallbackEventModel;
7 8
...@@ -13,6 +14,7 @@ public class WarplyEventBusManager { ...@@ -13,6 +14,7 @@ public class WarplyEventBusManager {
13 private LoyaltySDKDynatraceEventModel dynatraceEvent; 14 private LoyaltySDKDynatraceEventModel dynatraceEvent;
14 private WarplyWebviewCallbackEventModel webviewCallback; 15 private WarplyWebviewCallbackEventModel webviewCallback;
15 private WarplyWebviewActivityCallbackEventModel webviewActivityCallback; 16 private WarplyWebviewActivityCallbackEventModel webviewActivityCallback;
17 + private QuestionnaireEventModel questionnaire;
16 18
17 public WarplyEventBusManager() { 19 public WarplyEventBusManager() {
18 20
...@@ -41,4 +43,12 @@ public class WarplyEventBusManager { ...@@ -41,4 +43,12 @@ public class WarplyEventBusManager {
41 public WarplyWebviewActivityCallbackEventModel getWarplyWebviewActivityCallbackEventModel() { 43 public WarplyWebviewActivityCallbackEventModel getWarplyWebviewActivityCallbackEventModel() {
42 return webviewActivityCallback; 44 return webviewActivityCallback;
43 } 45 }
46 +
47 + public WarplyEventBusManager(QuestionnaireEventModel questionnaire) {
48 + this.questionnaire = questionnaire;
49 + }
50 +
51 + public QuestionnaireEventModel getQuestionnaire() {
52 + return questionnaire;
53 + }
44 } 54 }
......
...@@ -85,6 +85,7 @@ import ly.warp.sdk.activities.WarpViewActivity; ...@@ -85,6 +85,7 @@ import ly.warp.sdk.activities.WarpViewActivity;
85 import ly.warp.sdk.db.WarplyDBHelper; 85 import ly.warp.sdk.db.WarplyDBHelper;
86 import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel; 86 import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel;
87 import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; 87 import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
88 +import ly.warp.sdk.io.models.QuestionnaireEventModel;
88 import ly.warp.sdk.utils.WarpUtils; 89 import ly.warp.sdk.utils.WarpUtils;
89 import ly.warp.sdk.utils.WarplyProperty; 90 import ly.warp.sdk.utils.WarplyProperty;
90 import ly.warp.sdk.utils.WarplyUrlHandler; 91 import ly.warp.sdk.utils.WarplyUrlHandler;
...@@ -457,6 +458,10 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { ...@@ -457,6 +458,10 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
457 WarpViewActivity.setWebviewSupermarket(true); 458 WarpViewActivity.setWebviewSupermarket(true);
458 } else if (parts[1].equals("closeArtwork")) { 459 } else if (parts[1].equals("closeArtwork")) {
459 WarpViewActivity.setWebviewSupermarket(false); 460 WarpViewActivity.setWebviewSupermarket(false);
461 +
462 + QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
463 + questionnaireEvent.setName(parts[1]);
464 + EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
460 } else if (parts[1].equals("request") || parts[1].equals("response")) { 465 } else if (parts[1].equals("request") || parts[1].equals("response")) {
461 WarpUtils.log("**************** WARPLY Webview Log START *****************"); 466 WarpUtils.log("**************** WARPLY Webview Log START *****************");
462 WarpUtils.log(message); 467 WarpUtils.log(message);
......
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
98 </androidx.constraintlayout.widget.ConstraintLayout> 98 </androidx.constraintlayout.widget.ConstraintLayout>
99 99
100 <RelativeLayout 100 <RelativeLayout
101 + android:id="@+id/rl_auth"
101 android:layout_width="wrap_content" 102 android:layout_width="wrap_content"
102 android:layout_height="wrap_content" 103 android:layout_height="wrap_content"
103 android:layout_below="@+id/rl_header" 104 android:layout_below="@+id/rl_header"
...@@ -126,7 +127,7 @@ ...@@ -126,7 +127,7 @@
126 android:textSize="20sp" 127 android:textSize="20sp"
127 android:textStyle="bold" 128 android:textStyle="bold"
128 android:visibility="gone" 129 android:visibility="gone"
129 - tools:visibility="visible"/> 130 + tools:visibility="visible" />
130 131
131 <TextView 132 <TextView
132 android:id="@+id/tv_login" 133 android:id="@+id/tv_login"
...@@ -137,7 +138,7 @@ ...@@ -137,7 +138,7 @@
137 android:layout_marginStart="16dp" 138 android:layout_marginStart="16dp"
138 android:textColor="@color/blue_dark" 139 android:textColor="@color/blue_dark"
139 android:textSize="20sp" 140 android:textSize="20sp"
140 - android:visibility="gone"/> 141 + android:visibility="gone" />
141 142
142 <LinearLayout 143 <LinearLayout
143 android:id="@+id/ll_auth_login" 144 android:id="@+id/ll_auth_login"
...@@ -192,9 +193,9 @@ ...@@ -192,9 +193,9 @@
192 android:layout_height="match_parent" 193 android:layout_height="match_parent"
193 android:layout_centerInParent="true" 194 android:layout_centerInParent="true"
194 android:background="@android:color/transparent" 195 android:background="@android:color/transparent"
196 + android:translationZ="100dp"
195 android:visibility="gone" 197 android:visibility="gone"
196 - tools:visibility="visible" 198 + tools:visibility="visible">
197 - android:translationZ="100dp">
198 199
199 <ProgressBar 200 <ProgressBar
200 android:layout_width="48dp" 201 android:layout_width="48dp"
...@@ -205,6 +206,60 @@ ...@@ -205,6 +206,60 @@
205 android:indeterminateTintMode="src_atop" /> 206 android:indeterminateTintMode="src_atop" />
206 </RelativeLayout> 207 </RelativeLayout>
207 </RelativeLayout> 208 </RelativeLayout>
209 +
210 + <RelativeLayout
211 + android:id="@+id/rl_sm_view"
212 + android:layout_width="match_parent"
213 + android:layout_height="70dp"
214 + android:layout_below="@+id/rl_auth"
215 + android:layout_marginHorizontal="8dp"
216 + android:layout_marginTop="24dp"
217 + android:layout_marginBottom="16dp"
218 + android:background="@drawable/shape_cos_white">
219 +
220 + <LinearLayout
221 + android:id="@+id/ll_sm_flow"
222 + android:layout_width="140dp"
223 + android:layout_height="45dp"
224 + android:layout_alignParentStart="true"
225 + android:layout_centerVertical="true"
226 + android:layout_marginStart="16dp"
227 + android:background="@drawable/selector_button_green"
228 + android:gravity="center"
229 + android:orientation="horizontal">
230 +
231 + <TextView
232 + android:layout_width="wrap_content"
233 + android:layout_height="wrap_content"
234 + android:gravity="center"
235 + android:includeFontPadding="false"
236 + android:text="@string/demo_sm_flow"
237 + android:textColor="@color/white"
238 + android:textSize="16sp" />
239 + </LinearLayout>
240 +
241 + <LinearLayout
242 + android:id="@+id/ll_sm_map"
243 + android:layout_width="140dp"
244 + android:layout_height="45dp"
245 + android:layout_alignParentEnd="true"
246 + android:layout_centerVertical="true"
247 + android:layout_marginEnd="16dp"
248 + android:background="@drawable/selector_button_green"
249 + android:gravity="center"
250 + android:orientation="horizontal">
251 +
252 + <TextView
253 + android:layout_width="wrap_content"
254 + android:layout_height="wrap_content"
255 + android:gravity="center"
256 + android:includeFontPadding="false"
257 + android:text="@string/demo_sm_map"
258 + android:textColor="@color/white"
259 + android:textSize="16sp" />
260 + </LinearLayout>
261 + </RelativeLayout>
262 +
208 </RelativeLayout> 263 </RelativeLayout>
209 </ScrollView> 264 </ScrollView>
210 </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> 265 </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
......
...@@ -8,4 +8,6 @@ ...@@ -8,4 +8,6 @@
8 <string name="cos_login_text">Σύνδεση</string> 8 <string name="cos_login_text">Σύνδεση</string>
9 <string name="cos_logout_text">Αποσύνδεση</string> 9 <string name="cos_logout_text">Αποσύνδεση</string>
10 <string name="menu_home">Αρχική</string> 10 <string name="menu_home">Αρχική</string>
11 + <string name="demo_sm_flow">Open SM Flow</string>
12 + <string name="demo_sm_map">Open SM Map</string>
11 </resources> 13 </resources>
......