Panagiotis Triantafyllou

webview fix for sm deals campaign

...@@ -38,7 +38,7 @@ public class SplashActivity extends BaseActivity { ...@@ -38,7 +38,7 @@ public class SplashActivity extends BaseActivity {
38 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { 38 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
39 //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons 39 //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
40 //prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282, live 3000136179 40 //prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282, live 3000136179
41 - WarplyManager.getCosmoteUser("7000000833", mLoginReceiver); 41 + WarplyManager.getCosmoteUser("7000023687", mLoginReceiver);
42 // WarplyManager.verifyTicket("", "7000023699", mLoginReceiver); 42 // WarplyManager.verifyTicket("", "7000023699", mLoginReceiver);
43 } else { 43 } else {
44 startNextActivity(); 44 startNextActivity();
......
...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library' ...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
2 2
3 ext { 3 ext {
4 PUBLISH_GROUP_ID = 'ly.warp' 4 PUBLISH_GROUP_ID = 'ly.warp'
5 - PUBLISH_VERSION = '4.5.5.4r20' 5 + PUBLISH_VERSION = '4.5.5.4r21'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -91,6 +91,7 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -91,6 +91,7 @@ public class WarpViewActivity extends WarpBaseActivity {
91 91
92 private WarpView mWarpView; 92 private WarpView mWarpView;
93 private static Handler metersHandler; 93 private static Handler metersHandler;
94 + private static boolean mWebviewSupermarket = false;
94 95
95 // =========================================================== 96 // ===========================================================
96 // Methods for/from SuperClass/Interfaces 97 // Methods for/from SuperClass/Interfaces
...@@ -100,6 +101,7 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -100,6 +101,7 @@ public class WarpViewActivity extends WarpBaseActivity {
100 public void onCreate(Bundle savedInstanceState) { 101 public void onCreate(Bundle savedInstanceState) {
101 super.onCreate(savedInstanceState); 102 super.onCreate(savedInstanceState);
102 metersHandler = new Handler(); 103 metersHandler = new Handler();
104 + mWebviewSupermarket = false;
103 WarplySessionManager.onCreateActivity(this); 105 WarplySessionManager.onCreateActivity(this);
104 initViews(); 106 initViews();
105 Warply.getInitializer(this).init(); 107 Warply.getInitializer(this).init();
...@@ -118,6 +120,16 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -118,6 +120,16 @@ public class WarpViewActivity extends WarpBaseActivity {
118 super.onStart(); 120 super.onStart();
119 WarplySessionManager.onStartActivity(this); 121 WarplySessionManager.onStartActivity(this);
120 EventBus.getDefault().register(this); 122 EventBus.getDefault().register(this);
123 +
124 + if (mWarpView != null) {
125 + if (getWebviewSupermarket()) {
126 + String scriptSourceInit = "webviewDidFocusRefresh(" + String.valueOf(getWebviewSupermarket()) + ");";
127 + mWarpView.evaluateJavascript(scriptSourceInit, s -> {
128 +
129 + });
130 + setWebviewSupermarket(false);
131 + }
132 + }
121 } 133 }
122 134
123 @Override 135 @Override
...@@ -133,6 +145,7 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -133,6 +145,7 @@ public class WarpViewActivity extends WarpBaseActivity {
133 if (metersHandler != null) metersHandler.removeCallbacksAndMessages(null); 145 if (metersHandler != null) metersHandler.removeCallbacksAndMessages(null);
134 sendSteps(); 146 sendSteps();
135 WarpUtils.setWebviewParams(this, new JSONObject()); 147 WarpUtils.setWebviewParams(this, new JSONObject());
148 + setWebviewSupermarket(false);
136 } 149 }
137 150
138 @Override 151 @Override
...@@ -326,6 +339,14 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -326,6 +339,14 @@ public class WarpViewActivity extends WarpBaseActivity {
326 return metersHandler; 339 return metersHandler;
327 } 340 }
328 341
342 + public static boolean getWebviewSupermarket() {
343 + return mWebviewSupermarket;
344 + }
345 +
346 + public static void setWebviewSupermarket(boolean isLoaded) {
347 + mWebviewSupermarket = isLoaded;
348 + }
349 +
329 private void sendSteps() { 350 private void sendSteps() {
330 String date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.getDefault()).format(new Date()); 351 String date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.getDefault()).format(new Date());
331 WarpUtils.log("SEND_STEPS: " + String.valueOf(WarpUtils.getStepsCounter(this))); 352 WarpUtils.log("SEND_STEPS: " + String.valueOf(WarpUtils.getStepsCounter(this)));
......
...@@ -139,7 +139,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { ...@@ -139,7 +139,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
139 private Activity WarpActivity; 139 private Activity WarpActivity;
140 private String geolocationOrigin = ""; 140 private String geolocationOrigin = "";
141 private Callback geolocationCallback; 141 private Callback geolocationCallback;
142 - private static boolean mWebviewLoaded = false, mWebviewSupermarket = false; 142 + private static boolean mWebviewLoaded = false;
143 143
144 // =========================================================== 144 // ===========================================================
145 // Constructors 145 // Constructors
...@@ -159,7 +159,6 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { ...@@ -159,7 +159,6 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
159 ProcessLifecycleOwner.get().getLifecycle().addObserver(this); 159 ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
160 WarpActivity = activity; 160 WarpActivity = activity;
161 mWebviewLoaded = false; 161 mWebviewLoaded = false;
162 - mWebviewSupermarket = false;
163 init(); 162 init();
164 } 163 }
165 164
...@@ -437,13 +436,6 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { ...@@ -437,13 +436,6 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
437 436
438 }); 437 });
439 } 438 }
440 - if (mWebviewSupermarket) {
441 - String scriptSourceInit = "webviewDidFocusRefresh(" + String.valueOf(mWebviewSupermarket) + ");";
442 - WarpView.this.evaluateJavascript(scriptSourceInit, s -> {
443 -
444 - });
445 - mWebviewSupermarket = false;
446 - }
447 } 439 }
448 440
449 @Override 441 @Override
...@@ -481,9 +473,9 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { ...@@ -481,9 +473,9 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
481 if (message.contains("event")) { 473 if (message.contains("event")) {
482 String[] parts = message.split(":"); 474 String[] parts = message.split(":");
483 if (parts[1].equals("webviewRefresh")) { 475 if (parts[1].equals("webviewRefresh")) {
484 - mWebviewSupermarket = true; 476 + WarpViewActivity.setWebviewSupermarket(true);
485 } else if (parts[1].equals("closeArtwork")) { 477 } else if (parts[1].equals("closeArtwork")) {
486 - mWebviewSupermarket = false; 478 + WarpViewActivity.setWebviewSupermarket(false);
487 QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel(); 479 QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
488 questionnaireEvent.setName(parts[1]); 480 questionnaireEvent.setName(parts[1]);
489 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); 481 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
......