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'
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
25 25
26 package ly.warp.sdk; 26 package ly.warp.sdk;
27 27
28 -import static ly.warp.sdk.utils.constants.WarpConstants.IN_APP_FILTER_ALL;
29 -
30 import android.content.ActivityNotFoundException; 28 import android.content.ActivityNotFoundException;
31 import android.content.Context; 29 import android.content.Context;
32 import android.content.DialogInterface; 30 import android.content.DialogInterface;
...@@ -36,7 +34,6 @@ import android.content.pm.PackageManager.NameNotFoundException; ...@@ -36,7 +34,6 @@ import android.content.pm.PackageManager.NameNotFoundException;
36 import android.database.Cursor; 34 import android.database.Cursor;
37 import android.net.Uri; 35 import android.net.Uri;
38 import android.text.TextUtils; 36 import android.text.TextUtils;
39 -import android.util.Log;
40 37
41 import androidx.appcompat.app.AlertDialog; 38 import androidx.appcompat.app.AlertDialog;
42 39
...@@ -44,34 +41,23 @@ import org.json.JSONArray; ...@@ -44,34 +41,23 @@ import org.json.JSONArray;
44 import org.json.JSONException; 41 import org.json.JSONException;
45 import org.json.JSONObject; 42 import org.json.JSONObject;
46 43
47 -import java.io.File;
48 import java.util.ArrayList; 44 import java.util.ArrayList;
49 -import java.util.Collections;
50 -import java.util.Comparator;
51 import java.util.Iterator; 45 import java.util.Iterator;
52 import java.util.Map; 46 import java.util.Map;
53 import java.util.concurrent.atomic.AtomicBoolean; 47 import java.util.concurrent.atomic.AtomicBoolean;
54 48
55 import ly.warp.sdk.db.WarplyDBHelper; 49 import ly.warp.sdk.db.WarplyDBHelper;
56 import ly.warp.sdk.io.callbacks.CallbackReceiver; 50 import ly.warp.sdk.io.callbacks.CallbackReceiver;
57 -import ly.warp.sdk.io.callbacks.CampaignsHook;
58 -import ly.warp.sdk.io.callbacks.InboxStatsHook;
59 import ly.warp.sdk.io.callbacks.PostHook; 51 import ly.warp.sdk.io.callbacks.PostHook;
60 import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver; 52 import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver;
61 import ly.warp.sdk.io.callbacks.VolleyTransformer; 53 import ly.warp.sdk.io.callbacks.VolleyTransformer;
62 import ly.warp.sdk.io.callbacks.WarplyReadyCallback; 54 import ly.warp.sdk.io.callbacks.WarplyReadyCallback;
63 -import ly.warp.sdk.io.models.Campaign;
64 import ly.warp.sdk.io.models.CampaignList; 55 import ly.warp.sdk.io.models.CampaignList;
65 -import ly.warp.sdk.io.models.InboxStats;
66 -import ly.warp.sdk.io.request.WarplyInboxRequest;
67 import ly.warp.sdk.io.request.WarplyJsonArrayRequest; 56 import ly.warp.sdk.io.request.WarplyJsonArrayRequest;
68 import ly.warp.sdk.io.request.WarplyJsonObjectRequest; 57 import ly.warp.sdk.io.request.WarplyJsonObjectRequest;
69 import ly.warp.sdk.io.volley.Request.Method; 58 import ly.warp.sdk.io.volley.Request.Method;
70 import ly.warp.sdk.io.volley.RequestQueue; 59 import ly.warp.sdk.io.volley.RequestQueue;
71 import ly.warp.sdk.io.volley.toolbox.Volley; 60 import ly.warp.sdk.io.volley.toolbox.Volley;
72 -import ly.warp.sdk.receivers.WarplyBeaconsApplication;
73 -import ly.warp.sdk.utils.ObjectSerializer;
74 -import ly.warp.sdk.utils.WarpJSONParser;
75 import ly.warp.sdk.utils.WarpUtils; 61 import ly.warp.sdk.utils.WarpUtils;
76 import ly.warp.sdk.utils.WarplyDeviceInfoCollector; 62 import ly.warp.sdk.utils.WarplyDeviceInfoCollector;
77 import ly.warp.sdk.utils.WarplyInitializer; 63 import ly.warp.sdk.utils.WarplyInitializer;
...@@ -140,7 +126,7 @@ public enum Warply { ...@@ -140,7 +126,7 @@ public enum Warply {
140 if (context != null) { 126 if (context != null) {
141 INSTANCE.mContext = context.getApplicationContext(); 127 INSTANCE.mContext = context.getApplicationContext();
142 } 128 }
143 - initInternal(context); 129 + initInternal(context, true);
144 } 130 }
145 }); 131 });
146 } 132 }
...@@ -162,6 +148,22 @@ public enum Warply { ...@@ -162,6 +148,22 @@ public enum Warply {
162 WarplyServerPreferencesManager.initiateMicroAppStatusesMap(context); 148 WarplyServerPreferencesManager.initiateMicroAppStatusesMap(context);
163 } 149 }
164 150
151 + private static void initInternal(Context context, boolean isNew) {
152 + if (context != null) {
153 + INSTANCE.check(context);
154 + if (INSTANCE.mRequestQueue == null)
155 + INSTANCE.mRequestQueue = Volley.newRequestQueue(context);
156 + INSTANCE.mContext = context.getApplicationContext();
157 + WarpConstants.DEBUG = WarplyProperty.isDebugMode(INSTANCE.mContext);
158 + INSTANCE.isInitializedOrThrow();
159 + WarpConstants.GCM_SENDER_ID = WarpUtils.getLastGCMSenderId(INSTANCE.mContext);
160 + if (!WarpUtils.getLastApplicationUUID(context).equals(WarplyProperty.getAppUuid(context))) {
161 + resetWarplyWebId();
162 + }
163 + WarplyServerPreferencesManager.initiateMicroAppStatusesMap(context);
164 + }
165 + }
166 +
165 /** 167 /**
166 * Method used to check if the Warply.INSTANCE is correctly initialized. If 168 * Method used to check if the Warply.INSTANCE is correctly initialized. If
167 * not, it throws a runtime exception with a message describing the reason 169 * not, it throws a runtime exception with a message describing the reason
...@@ -328,12 +330,6 @@ public enum Warply { ...@@ -328,12 +330,6 @@ public enum Warply {
328 INSTANCE.postReceiveMicroappDataInternal(hasAuthHeaders, path, jObj, receiver); 330 INSTANCE.postReceiveMicroappDataInternal(hasAuthHeaders, path, jObj, receiver);
329 } 331 }
330 332
331 - public static void postReceiveMicroappData(String microappName, boolean hasAuthHeaders, String path,
332 - JSONObject jObj, CallbackReceiver<JSONObject> receiver) {
333 - INSTANCE.isInitializedOrThrow();
334 - INSTANCE.postReceiveMicroappDataInternal(microappName, hasAuthHeaders, path, jObj, receiver);
335 - }
336 -
337 private void postReceiveMicroappDataInternal(String microappName, 333 private void postReceiveMicroappDataInternal(String microappName,
338 JSONObject jObj, CallbackReceiver<JSONObject> receiver) { 334 JSONObject jObj, CallbackReceiver<JSONObject> receiver) {
339 if (!WarpUtils.isRegisteredWarply(mContext)) { 335 if (!WarpUtils.isRegisteredWarply(mContext)) {
...@@ -368,25 +364,6 @@ public enum Warply { ...@@ -368,25 +364,6 @@ public enum Warply {
368 postToServerInternal(hasAuthHeaders, path, jObj, receiver, tag); 364 postToServerInternal(hasAuthHeaders, path, jObj, receiver, tag);
369 } 365 }
370 366
371 - private void postReceiveMicroappDataInternal(String microappName, boolean hasAuthHeaders, String path,
372 - JSONObject jObj, CallbackReceiver<JSONObject> receiver) {
373 - if (!WarpUtils.isRegisteredWarply(mContext)) {
374 - if (receiver != null)
375 - receiver.onFailure(WarpConstants.RESULT_CODE_NOT_REGISTERED);
376 - return;
377 - }
378 - JSONObject jObject = new JSONObject();
379 - try {
380 - jObject.putOpt(microappName, jObj);
381 - } catch (JSONException e) {
382 - if (WarpConstants.DEBUG) {
383 - e.printStackTrace();
384 - }
385 - }
386 -
387 - postToServerInternal(hasAuthHeaders, path, jObject, receiver, null);
388 - }
389 -
390 /** 367 /**
391 * Default method used to post data to context. Same as 368 * Default method used to post data to context. Same as
392 * postMicroappData(String,JSONObject,false) 369 * postMicroappData(String,JSONObject,false)
...@@ -418,11 +395,6 @@ public enum Warply { ...@@ -418,11 +395,6 @@ public enum Warply {
418 INSTANCE.postMicroappDataInternal(microappName, jObj, force); 395 INSTANCE.postMicroappDataInternal(microappName, jObj, force);
419 } 396 }
420 397
421 - public static void postMicroappData(Context context, String microappName, JSONObject jObj, boolean force) {
422 - INSTANCE.isInitializedOrThrow();
423 - INSTANCE.postMicroappDataInternal(context, microappName, jObj, force);
424 - }
425 -
426 private void postMicroappDataInternal(String microappName, JSONObject jObj, boolean force) { 398 private void postMicroappDataInternal(String microappName, JSONObject jObj, boolean force) {
427 isInitializedOrThrow(); 399 isInitializedOrThrow();
428 long requestsInQueueCount = 0; 400 long requestsInQueueCount = 0;
...@@ -433,16 +405,6 @@ public enum Warply { ...@@ -433,16 +405,6 @@ public enum Warply {
433 tryWakingSendingTaskInternal(requestsInQueueCount); 405 tryWakingSendingTaskInternal(requestsInQueueCount);
434 } 406 }
435 407
436 - private void postMicroappDataInternal(Context context, String microappName, JSONObject jObj, boolean force) {
437 - isInitializedOrThrow();
438 - long requestsInQueueCount = 0;
439 - if (jObj != null && context != null) {
440 - requestsInQueueCount = WarplyDBHelper.getInstance(context).addRequest(
441 - microappName, jObj.toString(), force);
442 - }
443 - tryWakingSendingTaskInternal(context, requestsInQueueCount);
444 - }
445 -
446 public static void postMicroappPush(String microappName, JSONObject jObj, boolean force) { 408 public static void postMicroappPush(String microappName, JSONObject jObj, boolean force) {
447 INSTANCE.isInitializedOrThrow(); 409 INSTANCE.isInitializedOrThrow();
448 INSTANCE.postMicroappPushInternal(microappName, jObj, force); 410 INSTANCE.postMicroappPushInternal(microappName, jObj, force);
...@@ -473,217 +435,10 @@ public enum Warply { ...@@ -473,217 +435,10 @@ public enum Warply {
473 tryWakingSendingPushAckTaskInternal(requestsInQueueCount, false); 435 tryWakingSendingPushAckTaskInternal(requestsInQueueCount, false);
474 } 436 }
475 437
476 - /* Campaigns specific methods */
477 -
478 - /**
479 - * Method used to get the campaigns associated with this device
480 - *
481 - * @param receiver The receiver to get the Campaigns when the task returns
482 - */
483 - public static void getInbox(CallbackReceiver<CampaignList> receiver) {
484 - getInbox(null, receiver);
485 - }
486 -
487 - public static void getInbox(WarplyInboxRequest request, final CallbackReceiver<CampaignList> receiver) {
488 -
489 - if (request == null) {
490 - request = new WarplyInboxRequest();
491 - }
492 -
493 - final String requestSignature = request.getSignature();
494 - final WarplyPreferences warplyPreferences = new WarplyPreferences(INSTANCE.mContext);
495 - long elapsedTimeAfterLastUpdate = System.currentTimeMillis() - warplyPreferences.getInboxLastCachedTimeStamp(requestSignature);
496 - long updateInterval = request.getCacheUpdateInterval();
497 - boolean isNeedUpdateCampaignsByTimeStamp = elapsedTimeAfterLastUpdate > updateInterval;
498 -
499 - if (isNeedUpdateCampaignsByTimeStamp
500 - || INSTANCE.mLastReceivedCampaigns == null
501 - || INSTANCE.mLastReceivedCampaigns.size() == 0
502 - || !INSTANCE.mLastReceivedCampaigns.getRequestSignature().equals(requestSignature)) {
503 -
504 - final ObjectSerializer objectSerializer = new ObjectSerializer(INSTANCE.mContext);
505 - CampaignList campaignsCache = (CampaignList) objectSerializer.deserialize(File.separator + requestSignature);
506 - if (isNeedUpdateCampaignsByTimeStamp
507 - || campaignsCache == null
508 - || campaignsCache.size() == 0
509 - || !campaignsCache.getRequestSignature().equals(requestSignature)) {
510 -
511 - INSTANCE.isInitializedOrThrow();
512 - INSTANCE.getInboxInternal(new CallbackReceiver<CampaignList>() {
513 - @Override
514 - public void onSuccess(CampaignList result) {
515 -// WarplyManagerHelper.setCampaignList(result);
516 -
517 -
518 - if (result.size() >= 0) {
519 - objectSerializer.serialize(result, File.separator + requestSignature);
520 - warplyPreferences.saveInboxLastCachedTimeStamp(requestSignature, System.currentTimeMillis());
521 -
522 - CampaignList campaignLoyaltyList = new CampaignList();
523 - campaignLoyaltyList.clear();
524 - for (Campaign camp : result) {
525 - try {
526 - JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
527 - if (extraFields != null) {
528 - if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
529 - campaignLoyaltyList.add(camp);
530 - }
531 - }
532 - } catch (Exception exception) {
533 - campaignLoyaltyList.add(camp);
534 - }
535 - }
536 -
537 - INSTANCE.mLastReceivedCampaigns = result;
538 - if (receiver != null) {
539 - receiver.onSuccess(result/*campaignLoyaltyList*/);
540 - }
541 - }
542 - }
543 -
544 - @Override
545 - public void onFailure(int errorCode) {
546 - if (receiver != null) {
547 - receiver.onFailure(errorCode);
548 - }
549 - }
550 - }, request);
551 -
552 - } else {
553 -
554 - INSTANCE.mLastReceivedCampaigns = campaignsCache;
555 - if (receiver != null) {
556 - receiver.onSuccess(INSTANCE.mLastReceivedCampaigns);
557 - }
558 - }
559 -
560 - } else {
561 -
562 - if (receiver != null) {
563 - receiver.onSuccess(INSTANCE.mLastReceivedCampaigns);
564 - }
565 - }
566 - }
567 -
568 - public static void getInboxInApp(WarplyInboxRequest request, final CallbackReceiver<CampaignList> receiver) {
569 - INSTANCE.isInitializedOrThrow();
570 - INSTANCE.getInboxInAppInternal(new CallbackReceiver<CampaignList>() {
571 - @Override
572 - public void onSuccess(CampaignList result) {
573 - receiver.onSuccess(result);
574 - }
575 -
576 - @Override
577 - public void onFailure(int errorCode) {
578 - receiver.onFailure(errorCode);
579 - }
580 - }, request);
581 - }
582 -
583 public CampaignList getLastReceivedCampaigns() { 438 public CampaignList getLastReceivedCampaigns() {
584 return mLastReceivedCampaigns; 439 return mLastReceivedCampaigns;
585 } 440 }
586 441
587 - public CampaignList getInAppCampaigns() {
588 - return mInAppCampaigns;
589 - }
590 -
591 - public void getInboxUnreadCount(final CallbackReceiver<Integer> receiver, WarplyInboxRequest request) {
592 -
593 - getInbox(request, new CallbackReceiver<CampaignList>() {
594 - @Override
595 - public void onSuccess(CampaignList result) {
596 - receiver.onSuccess(result != null ?
597 - result.getUnreadCampaignsCount() : 0);
598 - }
599 -
600 - @Override
601 - public void onFailure(int errorCode) {
602 - receiver.onSuccess(0);
603 - }
604 - });
605 - }
606 -
607 - /**
608 - * @deprecated Use {@link #getInbox(CallbackReceiver) getInbox} method
609 - * instead
610 - */
611 - @Deprecated
612 - public static void getCampaigns(CallbackReceiver<CampaignList> receiver) {
613 - getInbox(receiver);
614 - }
615 -
616 - /**
617 - * Method used to get the campaign stats associated with this device
618 - *
619 - * @param receiver The receiver to get the InboxStats when the task returns
620 - */
621 - public static void getInboxStats(CallbackReceiver<InboxStats> receiver) {
622 - INSTANCE.isInitializedOrThrow();
623 - INSTANCE.getInboxStatsInternal(receiver);
624 - }
625 -
626 - private void getInboxInternal(CallbackReceiver<CampaignList> receiver, WarplyInboxRequest request) {
627 -
628 - WarpUtils.log("************* WARPLY Microapp ********************");
629 - if (!WarplyServerPreferencesManager
630 - .isMicroAppActive(WarpConstants.MicroApp.OFFERS)) {
631 - WarpUtils.log("[WARP Trace] Offers Microapp is not active");
632 - WarpUtils.log("**************************************************");
633 - receiver.onFailure(2);
634 - return;
635 - }
636 - WarpUtils.log("[WARP Trace] Offers Microapp is active");
637 - WarpUtils.log("**************************************************");
638 -
639 - request = request != null ? request : new WarplyInboxRequest();
640 - postReceiveMicroappDataInternal(WarpConstants.MICROAPP_CAMPAIGNS, request.toJson(),
641 - new CampaignsHook(receiver, request.getSignature()));
642 - }
643 -
644 - private void getInboxInAppInternal(CallbackReceiver<CampaignList> receiver, WarplyInboxRequest request) {
645 -
646 - WarpUtils.log("************* WARPLY Microapp ********************");
647 - if (!WarplyServerPreferencesManager.isMicroAppActive(WarpConstants.MicroApp.OFFERS)) {
648 - WarpUtils.log("[WARP Trace] Offers Microapp is not active");
649 - WarpUtils.log("**************************************************");
650 - receiver.onFailure(2);
651 - return;
652 - }
653 - WarpUtils.log("[WARP Trace] Offers Microapp is active");
654 - WarpUtils.log("**************************************************");
655 -
656 - request = request != null ? request : new WarplyInboxRequest();
657 - postReceiveMicroappDataInternal(WarpConstants.MICROAPP_CAMPAIGNS, request.toJsonInApp(),
658 - new CampaignsHook(receiver, request.getSignature()));
659 - }
660 -
661 -
662 - private void getInboxStatsInternal(CallbackReceiver<InboxStats> receiver) {
663 -
664 - WarpUtils.log("************* WARPLY Microapp ********************");
665 - if (!WarplyServerPreferencesManager
666 - .isMicroAppActive(WarpConstants.MicroApp.OFFERS)) {
667 - WarpUtils.log("[WARP Trace] Offers Microapp is not active");
668 - WarpUtils.log("**************************************************");
669 - receiver.onFailure(2);
670 - return;
671 - }
672 - WarpUtils.log("[WARP Trace] Offers Microapp is active");
673 - WarpUtils.log("**************************************************");
674 -
675 - JSONObject jObj = new JSONObject();
676 - try {
677 - jObj.put("action", "offer_status");
678 - } catch (JSONException e) {
679 - if (WarpConstants.DEBUG) {
680 - e.printStackTrace();
681 - }
682 - }
683 - postReceiveMicroappDataInternal(WarpConstants.MICROAPP_CAMPAIGNS, jObj,
684 - new InboxStatsHook(receiver));
685 - }
686 -
687 /** 442 /**
688 * Method used to check if an update of app is available and show alert dialog 443 * Method used to check if an update of app is available and show alert dialog
689 * 444 *
...@@ -738,35 +493,6 @@ public enum Warply { ...@@ -738,35 +493,6 @@ public enum Warply {
738 } 493 }
739 } 494 }
740 495
741 -
742 - /**
743 - * Add a listener to listen to registration updates
744 - *
745 - * @param receiver
746 - */
747 - public static void setRegistrationListener(
748 - CallbackReceiver<ServiceRegistrationCallback> receiver) {
749 - INSTANCE.isInitializedOrThrow();
750 - INSTANCE.listenGCMInternal(receiver);
751 - }
752 -
753 - private void listenGCMInternal(
754 - CallbackReceiver<ServiceRegistrationCallback> receiver) {
755 - mRegistrationListener = receiver;
756 - }
757 -
758 - /**
759 - * Stop listening to registration updates
760 - */
761 - public static void stopRegistrationListening() {
762 - INSTANCE.isInitializedOrThrow();
763 - INSTANCE.stopGCMListeningInternal();
764 - }
765 -
766 - private void stopGCMListeningInternal() {
767 - mRegistrationListener = null;
768 - }
769 -
770 /** 496 /**
771 * Method used to register with the Warply service. In order to receive push 497 * Method used to register with the Warply service. In order to receive push
772 * notifications, you also need to register with GCM using registerGCm or 498 * notifications, you also need to register with GCM using registerGCm or
...@@ -804,19 +530,6 @@ public enum Warply { ...@@ -804,19 +530,6 @@ public enum Warply {
804 } 530 }
805 531
806 /** 532 /**
807 - * Method used to enable or disable GCM push notifications. By default, this
808 - * is enabled
809 - */
810 - public void setGCMEnabled(boolean enabled) {
811 - INSTANCE.isInitializedOrThrow();
812 - INSTANCE.setGCMEnabledInternal(enabled);
813 - }
814 -
815 - private void setGCMEnabledInternal(boolean enabled) {
816 - WarpUtils.setGCMEnabled(mContext, enabled);
817 - }
818 -
819 - /**
820 * Returns the Warply INSTANCE - identical to using Warply.INSTANCE 533 * Returns the Warply INSTANCE - identical to using Warply.INSTANCE
821 */ 534 */
822 public static Warply getWarplyInstance() { 535 public static Warply getWarplyInstance() {
...@@ -840,7 +553,6 @@ public enum Warply { ...@@ -840,7 +553,6 @@ public enum Warply {
840 * changed, nothing happens 553 * changed, nothing happens
841 */ 554 */
842 public void postDeviceInfoData() { 555 public void postDeviceInfoData() {
843 -
844 isInitializedOrThrow(); 556 isInitializedOrThrow();
845 557
846 WarpUtils.log("************* WARPLY Microapp ********************"); 558 WarpUtils.log("************* WARPLY Microapp ********************");
...@@ -903,7 +615,6 @@ public enum Warply { ...@@ -903,7 +615,6 @@ public enum Warply {
903 * changed, nothing happens 615 * changed, nothing happens
904 */ 616 */
905 private void postApplicationData(boolean force) { 617 private void postApplicationData(boolean force) {
906 -
907 isInitializedOrThrow(); 618 isInitializedOrThrow();
908 WarpUtils.log("************* WARPLY Microapp ********************"); 619 WarpUtils.log("************* WARPLY Microapp ********************");
909 if (!WarplyServerPreferencesManager 620 if (!WarplyServerPreferencesManager
...@@ -1000,24 +711,6 @@ public enum Warply { ...@@ -1000,24 +711,6 @@ public enum Warply {
1000 return; 711 return;
1001 } 712 }
1002 713
1003 - public void onGCMRegistrationSuccess() {
1004 - if (mRegistrationListener != null)
1005 - mRegistrationListener
1006 - .onSuccess(ServiceRegistrationCallback.REGISTERED_GCM);
1007 - resetDeviceInfoInternal();
1008 - }
1009 -
1010 - public void onGCMUnregistrationSuccess() {
1011 - if (mRegistrationListener != null)
1012 - mRegistrationListener
1013 - .onSuccess(ServiceRegistrationCallback.UNREGISTERED_GCM);
1014 - }
1015 -
1016 - public void onGCMRegistrationFail(int errorCode) {
1017 - if (mRegistrationListener != null)
1018 - mRegistrationListener.onFailure(errorCode);
1019 - }
1020 -
1021 private void check() { 714 private void check() {
1022 if (mContext == null) { 715 if (mContext == null) {
1023 return; 716 return;
...@@ -1030,12 +723,27 @@ public enum Warply { ...@@ -1030,12 +723,27 @@ public enum Warply {
1030 postDeviceInfoData(); 723 postDeviceInfoData();
1031 if (WarpUtils.getIsAPPDATAENABLED(mContext)) 724 if (WarpUtils.getIsAPPDATAENABLED(mContext))
1032 postApplicationData(true); 725 postApplicationData(true);
1033 - tryWakingSendingTaskInternal(WarplyDBHelper.getInstance(mContext) 726 +
1034 - .getRequestsInQueueCount()); 727 + tryWakingSendingTaskInternal(WarplyDBHelper.getInstance(mContext).getRequestsInQueueCount());
1035 } 728 }
1036 729
1037 - private void wakeSendingTask() { 730 + private void check(Context context) {
731 + if (context == null) {
732 + return;
733 + }
734 + if (!WarpUtils.isRegisteredWarply(context)) {
735 + registerWarply();
736 + return;
737 + }
738 + if (WarpUtils.getIsDEVICEINFOENABLED(context))
739 + postDeviceInfoData();
740 + if (WarpUtils.getIsAPPDATAENABLED(context))
741 + postApplicationData(true);
742 +
743 + tryWakingSendingTaskInternal(WarplyDBHelper.getInstance(context).getRequestsInQueueCount());
744 + }
1038 745
746 + private void wakeSendingTask() {
1039 if (!acquirePostLockInternal()) 747 if (!acquirePostLockInternal())
1040 return; 748 return;
1041 749
...@@ -1070,7 +778,6 @@ public enum Warply { ...@@ -1070,7 +778,6 @@ public enum Warply {
1070 } 778 }
1071 779
1072 private void wakeSendingPushTask() { 780 private void wakeSendingPushTask() {
1073 -
1074 if (!acquirePostLockInternal()) 781 if (!acquirePostLockInternal())
1075 return; 782 return;
1076 783
...@@ -1101,7 +808,6 @@ public enum Warply { ...@@ -1101,7 +808,6 @@ public enum Warply {
1101 } 808 }
1102 809
1103 private void wakeSendingPushAckTask() { 810 private void wakeSendingPushAckTask() {
1104 -
1105 if (!acquirePostLockInternal()) 811 if (!acquirePostLockInternal())
1106 return; 812 return;
1107 813
...@@ -1152,9 +858,6 @@ public enum Warply { ...@@ -1152,9 +858,6 @@ public enum Warply {
1152 return; 858 return;
1153 } 859 }
1154 860
1155 -// if (WarplyDBHelper.getInstance(mContext.get()).isForceRequestsExist()
1156 -// || (requestsInQueue >= MINIMUM_REQUESTS_FOR_SENDING)) {
1157 -
1158 if (WarplyDBHelper.getInstance(mContext).isForceRequestsExist() 861 if (WarplyDBHelper.getInstance(mContext).isForceRequestsExist()
1159 || (requestsInQueue > 0)) { 862 || (requestsInQueue > 0)) {
1160 863
...@@ -1165,109 +868,6 @@ public enum Warply { ...@@ -1165,109 +868,6 @@ public enum Warply {
1165 } 868 }
1166 } 869 }
1167 870
1168 - private void tryWakingSendingTaskInternal(Context context, long requestsInQueue) {
1169 - if (!WarpUtils.isRegisteredWarply(mContext)) {
1170 - WarpUtils
1171 - .log("************* WARPLY Registration ********************");
1172 - WarpUtils
1173 - .log("[WARP TRace] Not registered yet, not waking post task!");
1174 - WarpUtils
1175 - .log("******************************************************");
1176 - return;
1177 - }
1178 -
1179 -// if (WarplyDBHelper.getInstance(mContext.get()).isForceRequestsExist()
1180 -// || (requestsInQueue >= MINIMUM_REQUESTS_FOR_SENDING)) {
1181 -
1182 - if (WarplyDBHelper.getInstance(mContext).isForceRequestsExist()
1183 - || (requestsInQueue > 0)) {
1184 -
1185 - WarpUtils.log("Waking post task!");
1186 - wakeSendingTask(context);
1187 - } else {
1188 - WarpUtils.log("Criteria not matched, not waking post task!");
1189 - }
1190 - }
1191 -
1192 - private void wakeSendingTask(Context context) {
1193 -
1194 - if (!acquirePostLockInternal())
1195 - return;
1196 -
1197 - ArrayList<Long> ids = new ArrayList<>();
1198 - JSONArray jArray = new JSONArray();
1199 - Cursor c = WarplyDBHelper.getInstance(mContext).getAllRequests();
1200 - while (c.moveToNext()) {
1201 - JSONObject jObj = new JSONObject();
1202 - try {
1203 - jObj.putOpt(
1204 - c.getString(c
1205 - .getColumnIndex(WarplyDBHelper.KEY_REQUESTS_MICROAPP)),
1206 - new JSONObject(c.getString(c
1207 - .getColumnIndex(WarplyDBHelper.KEY_REQUESTS_ENTITY))));
1208 - jArray.put(jObj);
1209 - } catch (JSONException e) {
1210 - if (WarpConstants.DEBUG) {
1211 - WarpUtils
1212 - .warn("[WARP Trace] Exception thrown when creating the JSON from DB with id: "
1213 - + c.getLong(c
1214 - .getColumnIndex(WarplyDBHelper.KEY_REQUESTS_ID)),
1215 - e);
1216 - }
1217 - } finally {
1218 - ids.add(c.getLong(c.getColumnIndex(WarplyDBHelper.KEY_REQUESTS_ID)));
1219 - }
1220 - }
1221 - c.close();
1222 - PostHook ph = new PostHook(getWarplyContext(), ids);
1223 - postToServerInternal(context, null, jArray, ph, null);
1224 - getFromServerInternal(null, null, null, null);/** get context **/
1225 - }
1226 -
1227 - private void postToServerInternal(Context context, String warplyPath, JSONArray data,
1228 - CallbackReceiver<JSONObject> listener, Object tag) {
1229 - String url = buildWarplyRequestUrl(context, warplyPath);
1230 -
1231 - JSONArray tempAnalytics = new JSONArray();
1232 - JSONArray tempDeviceInfo = new JSONArray();
1233 - JSONArray tempOther = new JSONArray();
1234 - if (data.length() > 0) {
1235 - for (int i = 0; i < data.length(); i++) {
1236 - JSONObject microappItem = data.optJSONObject(i);
1237 - if (microappItem != null) {
1238 - if (microappItem.has("inapp_analytics")) {
1239 - tempAnalytics.put(microappItem);
1240 - } else if (microappItem.has("device_info") || microappItem.has("application_data")) {
1241 - tempDeviceInfo.put(microappItem);
1242 - } else {
1243 - tempOther.put(microappItem);
1244 - }
1245 - }
1246 - }
1247 - }
1248 -
1249 - if (tempAnalytics != null && tempAnalytics.length() > 0) {
1250 - url = WarplyProperty.getBaseUrl(mContext) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_ANALYTICS + WarplyProperty.getAppUuid(mContext) + "/";
1251 - }
1252 - if (tempDeviceInfo != null && tempDeviceInfo.length() > 0) {
1253 - url = WarplyProperty.getBaseUrl(mContext) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_DEVICE_INFO + WarplyProperty.getAppUuid(mContext) + "/";
1254 - }
1255 - if (tempOther != null && tempOther.length() > 0) {
1256 - url = buildWarplyRequestUrl(warplyPath);
1257 - }
1258 -
1259 - requestToServerInternal(context, Method.POST, url, data, listener, tag);
1260 - }
1261 -
1262 - private String buildWarplyRequestUrl(Context context, String warplyPath) {
1263 - StringBuilder sb = new StringBuilder(WarplyProperty.getBaseUrl(context) + WarpConstants.BASE_URL_MOBILE);
1264 - sb.append(WarplyProperty.getAppUuid(mContext)).append("/")
1265 - .append(WarpConstants.PATH_CONTEXT).append("/");
1266 - if (warplyPath != null)
1267 - sb.append("?path=").append(warplyPath);
1268 - return sb.toString();
1269 - }
1270 -
1271 public static void tryWakingSendingPushTask(boolean force) { 871 public static void tryWakingSendingPushTask(boolean force) {
1272 INSTANCE.isInitializedOrThrow(); 872 INSTANCE.isInitializedOrThrow();
1273 INSTANCE.tryWakingSendingPushTaskInternal(WarplyDBHelper.getInstance( 873 INSTANCE.tryWakingSendingPushTaskInternal(WarplyDBHelper.getInstance(
...@@ -1387,26 +987,6 @@ public enum Warply { ...@@ -1387,26 +987,6 @@ public enum Warply {
1387 } 987 }
1388 } 988 }
1389 989
1390 - public static void initBeaconsApplicationIfNeed() {
1391 -
1392 - try {
1393 - WarplyBeaconsApplication beaconsApplication = WarplyBeaconsApplication.getInstance();
1394 - if (beaconsApplication != null) {
1395 -
1396 - if (WarplyBeaconsApplication.isMicroAppEnabled()) {
1397 - beaconsApplication.enable();
1398 - beaconsApplication.addBeaconLayouts(WarplyBeaconsApplication.getBeaconLayouts());
1399 - } else {
1400 - beaconsApplication.disable();
1401 - }
1402 - }
1403 - } catch (NoClassDefFoundError e) {
1404 - if (WarpConstants.DEBUG) {
1405 - e.printStackTrace();
1406 - }
1407 - }
1408 - }
1409 -
1410 /** 990 /**
1411 * Fundamental method, for doing requests to server, using JSON Object. This 991 * Fundamental method, for doing requests to server, using JSON Object. This
1412 * should be kept private and used by every other method in the SDK. 992 * should be kept private and used by every other method in the SDK.
...@@ -1419,7 +999,6 @@ public enum Warply { ...@@ -1419,7 +999,6 @@ public enum Warply {
1419 */ 999 */
1420 private void requestToServerInternal(int method, String url, JSONObject data, 1000 private void requestToServerInternal(int method, String url, JSONObject data,
1421 CallbackReceiver<JSONObject> listener, Object tag) { 1001 CallbackReceiver<JSONObject> listener, Object tag) {
1422 -
1423 VolleyTransformer vt = new VolleyTransformer(listener); 1002 VolleyTransformer vt = new VolleyTransformer(listener);
1424 String methodName = null; 1003 String methodName = null;
1425 switch (method) { 1004 switch (method) {
...@@ -1457,7 +1036,6 @@ public enum Warply { ...@@ -1457,7 +1036,6 @@ public enum Warply {
1457 1036
1458 public void requestToServerInternalNew(int method, String url, JSONObject data, 1037 public void requestToServerInternalNew(int method, String url, JSONObject data,
1459 CallbackReceiver<JSONObject> listener, Object tag) { 1038 CallbackReceiver<JSONObject> listener, Object tag) {
1460 -
1461 VolleyTransformer vt = new VolleyTransformer(listener); 1039 VolleyTransformer vt = new VolleyTransformer(listener);
1462 String methodName = null; 1040 String methodName = null;
1463 switch (method) { 1041 switch (method) {
...@@ -1496,7 +1074,6 @@ public enum Warply { ...@@ -1496,7 +1074,6 @@ public enum Warply {
1496 private void requestToServerInternal(int method, String url, JSONObject data, 1074 private void requestToServerInternal(int method, String url, JSONObject data,
1497 CallbackReceiver<JSONObject> listener, 1075 CallbackReceiver<JSONObject> listener,
1498 Object tag, boolean hasAuthHeaders) { 1076 Object tag, boolean hasAuthHeaders) {
1499 -
1500 VolleyTransformer vt = new VolleyTransformer(listener); 1077 VolleyTransformer vt = new VolleyTransformer(listener);
1501 String methodName = null; 1078 String methodName = null;
1502 switch (method) { 1079 switch (method) {
...@@ -1543,7 +1120,6 @@ public enum Warply { ...@@ -1543,7 +1120,6 @@ public enum Warply {
1543 */ 1120 */
1544 private void requestToServerInternal(int method, String url, JSONArray data, 1121 private void requestToServerInternal(int method, String url, JSONArray data,
1545 CallbackReceiver<JSONObject> listener, Object tag) { 1122 CallbackReceiver<JSONObject> listener, Object tag) {
1546 -
1547 VolleyTransformer vt = new VolleyTransformer(listener); 1123 VolleyTransformer vt = new VolleyTransformer(listener);
1548 String methodName = null; 1124 String methodName = null;
1549 switch (method) { 1125 switch (method) {
...@@ -1633,137 +1209,6 @@ public enum Warply { ...@@ -1633,137 +1209,6 @@ public enum Warply {
1633 /*========================== OLD, REVERT IF NEED ==========================*/ 1209 /*========================== OLD, REVERT IF NEED ==========================*/
1634 } 1210 }
1635 1211
1636 - private void requestToServerInternal(Context context, int method, String url, JSONArray data,
1637 - CallbackReceiver<JSONObject> listener, Object tag) {
1638 -
1639 - VolleyTransformer vt = new VolleyTransformer(listener);
1640 - String methodName = null;
1641 - switch (method) {
1642 - case 0:
1643 - methodName = "GET";
1644 - break;
1645 - case 1:
1646 - methodName = "POST";
1647 - break;
1648 - case 2:
1649 - methodName = "PUT";
1650 - break;
1651 - case 3:
1652 - methodName = "DELETE";
1653 - break;
1654 - }
1655 -
1656 - if (mContext != null) {
1657 - WarpUtils.log("************* WARPLY " + methodName + " Context ********************");
1658 - WarpUtils.log("[WARP Trace] HTTP Web Id: " + WarpUtils.getWebId(mContext));
1659 - WarpUtils.log("[WARP Trace] HTTP API Key: " + WarplyProperty.getAppUuid(mContext));
1660 - WarpUtils.verbose("[WARP Trace] HTTP " + methodName + " Request URL: " + url);
1661 - if (data != null) {
1662 - try {
1663 - WarpUtils.verbose("[WARP Trace] Request: " + data.toString(2));
1664 - } catch (JSONException e) {
1665 - WarpUtils.warn(
1666 - "[WARP Trace] Failed conversting JSON to string", e);
1667 - }
1668 - }
1669 - } else if (context != null) {
1670 - WarpUtils.log("************* WARPLY " + methodName + " Context ********************");
1671 - WarpUtils.log("[WARP Trace] HTTP Web Id: " + WarpUtils.getWebId(context));
1672 - WarpUtils.log("[WARP Trace] HTTP API Key: " + WarplyProperty.getAppUuid(context));
1673 - WarpUtils.verbose("[WARP Trace] HTTP " + methodName + " Request URL: " + url);
1674 - if (data != null) {
1675 - try {
1676 - WarpUtils.verbose("[WARP Trace] Request: " + data.toString(2));
1677 - } catch (JSONException e) {
1678 - WarpUtils.warn(
1679 - "[WARP Trace] Failed conversting JSON to string", e);
1680 - }
1681 - }
1682 - }
1683 -
1684 - /*========================== NEW, REPLACE WITH OLD IF NEED ==========================*/
1685 - if (data != null) {
1686 - JSONArray tempAnalytics = new JSONArray();
1687 - JSONArray tempDeviceInfo = new JSONArray();
1688 - JSONArray tempOther = new JSONArray();
1689 - if (data.length() > 0) {
1690 - for (int i = 0; i < data.length(); i++) {
1691 - JSONObject microappItem = data.optJSONObject(i);
1692 - if (microappItem != null) {
1693 - if (microappItem.has("inapp_analytics")) {
1694 - tempAnalytics.put(microappItem);
1695 - } else if (microappItem.has("device_info") || microappItem.has("application_data")) {
1696 - tempDeviceInfo.put(microappItem);
1697 - } else {
1698 - tempOther.put(microappItem);
1699 - }
1700 - }
1701 - }
1702 - }
1703 -
1704 - if (INSTANCE.mRequestQueue == null) {
1705 - if (INSTANCE.mContext != null)
1706 - INSTANCE.mRequestQueue = Volley.newRequestQueue(INSTANCE.mContext);
1707 - else
1708 - INSTANCE.mRequestQueue = Volley.newRequestQueue(context);
1709 - }
1710 -
1711 - if (tempAnalytics != null && tempAnalytics.length() > 0) {
1712 - String urlAnalytics = "";
1713 - if (mContext != null)
1714 - urlAnalytics = WarplyProperty.getBaseUrl(mContext) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_ANALYTICS + WarplyProperty.getAppUuid(mContext) + "/";
1715 - else
1716 - urlAnalytics = WarplyProperty.getBaseUrl(context) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_ANALYTICS + WarplyProperty.getAppUuid(context) + "/";
1717 - WarplyJsonArrayRequest requestAnalytics = new WarplyJsonArrayRequest(method, urlAnalytics, tempAnalytics, vt, vt);
1718 - requestAnalytics.setTag(tag);
1719 - if (mRequestQueue == null) {
1720 - if (mContext != null)
1721 - mRequestQueue = Volley.newRequestQueue(mContext);
1722 - else
1723 - mRequestQueue = Volley.newRequestQueue(context);
1724 - }
1725 -
1726 - mRequestQueue.add(requestAnalytics);
1727 - }
1728 - if (tempDeviceInfo != null && tempDeviceInfo.length() > 0) {
1729 - String urlDeviceInfo = "";
1730 - if (mContext != null)
1731 - urlDeviceInfo = WarplyProperty.getBaseUrl(mContext) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_DEVICE_INFO + WarplyProperty.getAppUuid(mContext) + "/";
1732 - else
1733 - urlDeviceInfo = WarplyProperty.getBaseUrl(context) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_DEVICE_INFO + WarplyProperty.getAppUuid(context) + "/";
1734 - WarplyJsonArrayRequest requestDeviceInfo = new WarplyJsonArrayRequest(method, urlDeviceInfo, tempDeviceInfo, vt, vt);
1735 - requestDeviceInfo.setTag(tag);
1736 - if (mRequestQueue == null) {
1737 - if (mContext != null)
1738 - mRequestQueue = Volley.newRequestQueue(mContext);
1739 - else
1740 - mRequestQueue = Volley.newRequestQueue(context);
1741 - }
1742 -
1743 - mRequestQueue.add(requestDeviceInfo);
1744 - }
1745 - if (tempOther != null && tempOther.length() > 0) {
1746 - WarplyJsonArrayRequest request = new WarplyJsonArrayRequest(method, url, tempOther, vt, vt);
1747 - request.setTag(tag);
1748 - if (mRequestQueue == null) {
1749 - if (mContext != null)
1750 - mRequestQueue = Volley.newRequestQueue(mContext);
1751 - else
1752 - mRequestQueue = Volley.newRequestQueue(context);
1753 - }
1754 -
1755 - mRequestQueue.add(request);
1756 - }
1757 - }
1758 - /*========================== NEW, REPLACE WITH OLD IF NEED ==========================*/
1759 -
1760 - /*========================== OLD, REVERT IF NEED ==========================*/
1761 -// WarplyJsonArrayRequest request = new WarplyJsonArrayRequest(method, url, data, vt, vt);
1762 -// request.setTag(tag);
1763 -// mRequestQueue.add(request);
1764 - /*========================== OLD, REVERT IF NEED ==========================*/
1765 - }
1766 -
1767 private void postToServerInternal(JSONObject data, 1212 private void postToServerInternal(JSONObject data,
1768 CallbackReceiver<JSONObject> listener, Object tag) { 1213 CallbackReceiver<JSONObject> listener, Object tag) {
1769 String url = buildWarplyRequestUrl(null); 1214 String url = buildWarplyRequestUrl(null);
...@@ -1922,7 +1367,7 @@ public enum Warply { ...@@ -1922,7 +1367,7 @@ public enum Warply {
1922 WarpUtils.log("******************************************************"); 1367 WarpUtils.log("******************************************************");
1923 if (mRegistrationListener != null) 1368 if (mRegistrationListener != null)
1924 mRegistrationListener.onSuccess(ServiceRegistrationCallback.REGISTERED_WARPLY); 1369 mRegistrationListener.onSuccess(ServiceRegistrationCallback.REGISTERED_WARPLY);
1925 -// postDeviceInfoData(); 1370 + postDeviceInfoData();
1926 postApplicationData(true); 1371 postApplicationData(true);
1927 } 1372 }
1928 releaseRegisterLock(); 1373 releaseRegisterLock();
......
...@@ -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 }
......
...@@ -237,6 +237,19 @@ public class WarplyManager { ...@@ -237,6 +237,19 @@ public class WarplyManager {
237 WarpUtils.log("[WARP Trace] WARPLY Cosmote User Request is active"); 237 WarpUtils.log("[WARP Trace] WARPLY Cosmote User Request is active");
238 WarpUtils.log("**************************************************"); 238 WarpUtils.log("**************************************************");
239 239
240 + if (WarplyDBHelper.getInstance(Warply.getWarplyContext()).isTableNotEmpty("auth")) {
241 + JSONObject newResult = new JSONObject();
242 + try {
243 + newResult.putOpt("status", 1);
244 + newResult.putOpt("message", "Success");
245 + receiver.onSuccess(newResult);
246 + } catch (JSONException e) {
247 + e.printStackTrace();
248 + receiver.onFailure(2);
249 + }
250 + return;
251 + }
252 +
240 ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class); 253 ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
241 254
242 String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); 255 String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
...@@ -315,6 +328,26 @@ public class WarplyManager { ...@@ -315,6 +328,26 @@ public class WarplyManager {
315 WarpUtils.log("[WARP Trace] WARPLY Verify Ticket Request is active"); 328 WarpUtils.log("[WARP Trace] WARPLY Verify Ticket Request is active");
316 WarpUtils.log("**************************************************"); 329 WarpUtils.log("**************************************************");
317 330
331 + if (WarplyDBHelper.getInstance(Warply.getWarplyContext()).isTableNotEmpty("auth")) {
332 + JSONObject newResult = new JSONObject();
333 + try {
334 + newResult.putOpt("status", 1);
335 + newResult.putOpt("message", "Success");
336 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
337 + dynatraceEvent.setEventName("custom_success_login_loyalty");
338 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
339 + receiver.onSuccess(newResult);
340 + } catch (JSONException e) {
341 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
342 + dynatraceEvent.setEventName("custom_error_login_loyalty");
343 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
344 +
345 + e.printStackTrace();
346 + receiver.onFailure(2);
347 + }
348 + return;
349 + }
350 +
318 WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false); 351 WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false);
319 WarpUtils.setUserTag(Warply.getWarplyContext(), ""); 352 WarpUtils.setUserTag(Warply.getWarplyContext(), "");
320 353
...@@ -1246,4 +1279,200 @@ public class WarplyManager { ...@@ -1246,4 +1279,200 @@ public class WarplyManager {
1246 } 1279 }
1247 }, executorService); 1280 }, executorService);
1248 } 1281 }
1282 +
1283 + private static /*void*/ ListenableFuture<ArrayList<Campaign>> getSupermarketCampaignRetro(ApiService service/*, final CallbackReceiver<ArrayList<Campaign>> receiver*/) {
1284 + SettableFuture<ArrayList<Campaign>> future = SettableFuture.create();
1285 +
1286 + String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
1287 + String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
1288 + String webId = WarpUtils.getWebId(Warply.getWarplyContext());
1289 +
1290 + Map<String, Object> jsonParamsCampaigns = new ArrayMap<>();
1291 + Map<String, Object> jsonParams = new ArrayMap<>();
1292 + JSONObject jFilters = new JSONObject();
1293 + JSONObject jExtra = new JSONObject();
1294 + try {
1295 + jFilters.putOpt("communication_category", "more_for_you");
1296 + jExtra.putOpt("filter", "supermarket");
1297 + jExtra.putOpt("version", "magenta");
1298 + jFilters.putOpt("extra_fields", jExtra);
1299 + } catch (JSONException e) {
1300 + throw new RuntimeException(e);
1301 + }
1302 + jsonParams.put("action", "retrieve");
1303 + jsonParams.put("filters", jFilters);
1304 + jsonParams.put("language", WarplyProperty.getLanguage(Warply.getWarplyContext()));
1305 +
1306 + jsonParamsCampaigns.put("campaigns", jsonParams);
1307 + RequestBody campaignsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsCampaigns)).toString());
1308 +
1309 + Call<ResponseBody> campaignsCall = service.getCampaigns(
1310 + WarplyProperty.getAppUuid(Warply.getWarplyContext()),
1311 + campaignsRequest,
1312 + timeStamp,
1313 + "android:" + Warply.getWarplyContext().getPackageName(),
1314 + new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
1315 + "mobile",
1316 + webId,
1317 + WarpUtils.produceSignature(apiKey + timeStamp)
1318 + );
1319 +
1320 + campaignsCall.enqueue(new Callback<ResponseBody>() {
1321 + @Override
1322 + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
1323 + if (response.code() == 200 && response.body() != null) {
1324 + JSONObject jobjCampaignsResponse = null;
1325 + try {
1326 + jobjCampaignsResponse = new JSONObject(response.body().string());
1327 + } catch (Exception e) {
1328 + e.printStackTrace();
1329 + }
1330 +
1331 + if (jobjCampaignsResponse != null && jobjCampaignsResponse.has("status") && jobjCampaignsResponse.optString("status", "2").equals("1")) {
1332 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1333 + dynatraceEvent.setEventName("custom_success_supermarket_campaign_loyalty");
1334 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
1335 +
1336 + JSONArray jCampaignsBody = null;
1337 + try {
1338 + jCampaignsBody = jobjCampaignsResponse.optJSONObject("context").optJSONObject("MAPP_CAMPAIGNING").optJSONArray("campaigns");
1339 + } catch (Exception e) {
1340 + e.printStackTrace();
1341 + }
1342 +
1343 + if (jCampaignsBody != null) {
1344 + ArrayList<NewCampaign> tempCampaigns = new ArrayList<>();
1345 + ArrayList<Campaign> mCampaignsList = new ArrayList<>();
1346 +
1347 + final ExecutorService executorCampaigns = Executors.newFixedThreadPool(1);
1348 + JSONArray finalCampaignsJBody = jCampaignsBody;
1349 + executorCampaigns.submit(() -> {
1350 + for (int i = 0; i < finalCampaignsJBody.length(); ++i) {
1351 + tempCampaigns.add(new NewCampaign(finalCampaignsJBody.optJSONObject(i)));
1352 + }
1353 + for (NewCampaign newCamp : tempCampaigns) {
1354 + Campaign camp = new Campaign();
1355 + camp.setIndexUrl(newCamp.getIndexUrl());
1356 + camp.setLogoUrl(newCamp.getLogoUrl());
1357 + camp.setMessage(newCamp.getMessage());
1358 + camp.setOfferCategory(newCamp.getCommunicationCategory());
1359 + camp.setSessionUUID(newCamp.getCommunicationUUID());
1360 + camp.setTitle(newCamp.getTitle());
1361 + camp.setSubtitle(newCamp.getSubtitle());
1362 + camp.setSorting(newCamp.getSorting());
1363 + camp.setNew(newCamp.getIsNew());
1364 + camp.setType(newCamp.getCampaignType());
1365 + camp.setEndDate(newCamp.getEndDate());
1366 + camp.setStartDate(newCamp.getStartDate());
1367 + camp.setShowExpiration(newCamp.isShowExpiration());
1368 + camp.setCouponImg(newCamp.getCouponImg());
1369 + camp.setFilter(newCamp.getFilter());
1370 + try {
1371 + camp.setExtraFields(newCamp.getExtraFields().toString());
1372 + if (!TextUtils.isEmpty(newCamp.getExtraFields().toString())) {
1373 + JSONObject extraFieldsResp = WarpJSONParser.getJSONFromString(newCamp.getExtraFields().toString());
1374 + if (extraFieldsResp != null) {
1375 + if (extraFieldsResp.has("Banner_title")) {
1376 + camp.setBannerTitle(extraFieldsResp.optString("Banner_title", ""));
1377 + }
1378 + if (extraFieldsResp.has("Banner_img")) {
1379 + camp.setBannerImage(extraFieldsResp.optString("Banner_img", ""));
1380 + }
1381 + if (extraFieldsResp.has("category_id")) {
1382 + camp.setCategoryId(extraFieldsResp.optString("category_id", ""));
1383 + }
1384 + }
1385 + } else {
1386 + camp.setBannerImage("");
1387 + camp.setBannerTitle("");
1388 + camp.setCategoryId("");
1389 + }
1390 + } catch (NullPointerException e) {
1391 + camp.setExtraFields("");
1392 + camp.setBannerImage("");
1393 + camp.setBannerTitle("");
1394 + camp.setCategoryId("");
1395 + e.printStackTrace();
1396 + }
1397 +
1398 + try {
1399 + camp.setCampaignTypeSettings(newCamp.getSettings().toString());
1400 + } catch (NullPointerException e) {
1401 + camp.setCampaignTypeSettings("");
1402 + e.printStackTrace();
1403 + }
1404 + mCampaignsList.add(camp);
1405 + }
1406 +
1407 + executorCampaigns.shutdownNow();
1408 +// receiver.onSuccess(mCampaignsList);
1409 + future.set(mCampaignsList);
1410 + });
1411 + }
1412 + } else {
1413 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1414 + dynatraceEvent.setEventName("custom_error_supermarket_campaign_loyalty");
1415 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
1416 +// receiver.onFailure(2);
1417 + future.set(new ArrayList<Campaign>());
1418 + }
1419 + } else {
1420 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1421 + dynatraceEvent.setEventName("custom_error_supermarket_campaign_loyalty");
1422 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
1423 +// receiver.onFailure(response.code());
1424 +// future.set(new ArrayList<Campaign>());
1425 + future.setException(new Throwable());
1426 + }
1427 + }
1428 +
1429 + @Override
1430 + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
1431 + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1432 + dynatraceEvent.setEventName("custom_error_supermarket_campaign_loyalty");
1433 + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
1434 +// receiver.onFailure(2);
1435 +// future.set(new ArrayList<Campaign>());
1436 + future.setException(new Throwable());
1437 + }
1438 + });
1439 +
1440 + return future;
1441 + }
1442 +
1443 + public static void getSupermarketCampaign(final CallbackReceiver<ArrayList<Campaign>> receiver) {
1444 + WarpUtils.log("************* WARPLY Get Supermarket Campaigns Request ********************");
1445 + WarpUtils.log("[WARP Trace] WARPLY Get Supermarket Campaigns Request is active");
1446 + WarpUtils.log("**************************************************");
1447 +
1448 + ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
1449 + ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(1));
1450 +
1451 + ListenableFuture<ArrayList<Campaign>> futureCampaigns = getSupermarketCampaignRetro(service);
1452 +
1453 + ListenableFuture<List<Object>> allResultsFuture = Futures.allAsList(futureCampaigns);
1454 + ListenableFuture<ArrayList<Campaign>> mergedResultFuture = Futures.transformAsync(
1455 + allResultsFuture,
1456 + results -> {
1457 + ArrayList<Campaign> resultCampaigns = (ArrayList<Campaign>) results.get(0);
1458 + return executorService.submit(() -> resultCampaigns);
1459 + },
1460 + executorService
1461 + );
1462 +
1463 + Futures.addCallback(mergedResultFuture, new FutureCallback<ArrayList<Campaign>>() {
1464 + @Override
1465 + public void onSuccess(ArrayList<Campaign> mergedResult) {
1466 + WarplyManagerHelper.setSupermarketCampaigns(mergedResult);
1467 + executorService.shutdownNow();
1468 + new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(mergedResult));
1469 + }
1470 +
1471 + @Override
1472 + public void onFailure(Throwable throwable) {
1473 + executorService.shutdownNow();
1474 + new Handler(Looper.getMainLooper()).post(() -> receiver.onFailure(2));
1475 + }
1476 + }, executorService);
1477 + }
1249 } 1478 }
......
...@@ -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>
......