From 51a24c72fd475598324c70727bbed91209d05d22 Mon Sep 17 00:00:00 2001 From: queue-it Date: Wed, 7 Feb 2024 10:12:22 +0000 Subject: [PATCH] Preparing release 2.1.7 --- build.gradle | 2 +- .../com/queue_it/shopdemo/MainActivity.java | 2 +- gradle/wrapper/gradle-wrapper.properties | 5 +++++ .../androidsdk/QueueActivityBase.java | 8 ++++++- .../queue_it/androidsdk/QueueITEngine.java | 4 +++- .../androidsdk/QueueITWaitingRoomView.java | 7 +++--- .../androidsdk/QueueItEngineOptions.java | 22 ++++++++++++++++++- 7 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 gradle/wrapper/gradle-wrapper.properties diff --git a/build.gradle b/build.gradle index 1392db6..323156a 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ allprojects { groupId = 'com.queue-it.androidsdk' libraryName = 'com.queue_it.androidsdk' libraryDescription = 'Android SDK to integrate with Queue-it' - libraryVersion = "2.1.6" + libraryVersion = "2.1.7" organization = "Queue-it" organizationUrl = "https://queue-it.com" diff --git a/demoapp/src/library_androidx/java/com/queue_it/shopdemo/MainActivity.java b/demoapp/src/library_androidx/java/com/queue_it/shopdemo/MainActivity.java index b5ceec7..453b1b3 100644 --- a/demoapp/src/library_androidx/java/com/queue_it/shopdemo/MainActivity.java +++ b/demoapp/src/library_androidx/java/com/queue_it/shopdemo/MainActivity.java @@ -178,7 +178,7 @@ public void onClick(View v) { QueueItEngineOptions queueItEngineOptions = getQueueItEngineOptions(); QueueITWaitingRoomView queueITWaitingRoomView = new QueueITWaitingRoomView(MainActivity.this, queueListener, queueItEngineOptions); - queueITWaitingRoomView.showQueue(_queueTryPassResult); + queueITWaitingRoomView.showQueue(_queueTryPassResult, queueItEngineOptions.getWebViewUserAgent() ); _queueTryPassResult = null; } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ffed3a2 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/library/src/main/java/com/queue_it/androidsdk/QueueActivityBase.java b/library/src/main/java/com/queue_it/androidsdk/QueueActivityBase.java index 925ed6f..c429f7f 100644 --- a/library/src/main/java/com/queue_it/androidsdk/QueueActivityBase.java +++ b/library/src/main/java/com/queue_it/androidsdk/QueueActivityBase.java @@ -24,6 +24,7 @@ public class QueueActivityBase { private String queueUrl; private String targetUrl; private WebView webview; + private String webViewUserAgent; @SuppressLint("StaticFieldLeak") private static WebView previousWebView; private IUriOverrider uriOverrider; @@ -142,13 +143,14 @@ public void onProgressChanged(WebView view, int newProgress) { }); webview.setWebViewClient(webviewClient); Log.v("QueueITEngine", "Loading initial URL: " + queueUrl); - setUserAgent(UserAgentManager.getUserAgent()); + setUserAgent(webViewUserAgent); webview.loadUrl(queueUrl); } public void saveInstanceState(Bundle outState) { outState.putString("queueUrl", queueUrl); outState.putString("targetUrl", targetUrl); + outState.putString("webViewUserAgent", webViewUserAgent); outState.putString("userId", uriOverrider.getUserId()); } @@ -164,15 +166,18 @@ private void readActivityExtras(Bundle savedInstanceState) { if (extras == null) { queueUrl = null; targetUrl = null; + webViewUserAgent = null; } else { queueUrl = extras.getString("queueUrl"); targetUrl = extras.getString("targetUrl"); + webViewUserAgent = extras.getString("webViewUserAgent"); uriOverrider.setUserId(extras.getString("userId")); options = (QueueItEngineOptions)extras.getParcelable("options"); } } else { queueUrl = (String) savedInstanceState.getSerializable("queueUrl"); targetUrl = (String) savedInstanceState.getSerializable("targetUrl"); + webViewUserAgent = (String) savedInstanceState.getSerializable("webViewUserAgent"); uriOverrider.setUserId((String) savedInstanceState.getSerializable("userId")); } @@ -186,6 +191,7 @@ private void disposeWebview(WebView webView) { } private void setUserAgent(String userAgent) { + userAgent = (userAgent != null) ? userAgent : UserAgentManager.getUserAgent(); System.setProperty("http.agent", userAgent); webview.getSettings().setUserAgentString(userAgent); } diff --git a/library/src/main/java/com/queue_it/androidsdk/QueueITEngine.java b/library/src/main/java/com/queue_it/androidsdk/QueueITEngine.java index a68a095..714ef2e 100644 --- a/library/src/main/java/com/queue_it/androidsdk/QueueITEngine.java +++ b/library/src/main/java/com/queue_it/androidsdk/QueueITEngine.java @@ -100,6 +100,8 @@ protected void onQueueUrlChanged(String url) { } }; + final String webViewUserAgent = options.getWebViewUserAgent(); + QueueITWaitingRoomProviderListener queueITWaitingRoomProviderListener = new QueueITWaitingRoomProviderListener() { @Override public void onSuccess(QueueTryPassResult queueTryPassResult) { @@ -113,7 +115,7 @@ public void onSuccess(QueueTryPassResult queueTryPassResult) { } _queueTryPassResult = queueTryPassResult; - _queueITWaitingRoomView.showQueue(_queueTryPassResult); + _queueITWaitingRoomView.showQueue(_queueTryPassResult, webViewUserAgent); } @Override diff --git a/library/src/main/java/com/queue_it/androidsdk/QueueITWaitingRoomView.java b/library/src/main/java/com/queue_it/androidsdk/QueueITWaitingRoomView.java index 1e71189..fd7f249 100644 --- a/library/src/main/java/com/queue_it/androidsdk/QueueITWaitingRoomView.java +++ b/library/src/main/java/com/queue_it/androidsdk/QueueITWaitingRoomView.java @@ -35,7 +35,7 @@ public QueueITWaitingRoomView(Context activityContext, _options = options; } - public void showQueue(final QueueTryPassResult queueTryPassResult) { + public void showQueue(final QueueTryPassResult queueTryPassResult, String webViewUserAgent) { if(queueTryPassResult == null){ Log.e("QueueITWaitingRoomView", "queuePassedInfo parameter is empty"); return; @@ -45,7 +45,7 @@ public void showQueue(final QueueTryPassResult queueTryPassResult) { Handler handler = new Handler(); Runnable r = new Runnable() { public void run() { - showQueuePage(queueTryPassResult.getQueueUrl(), queueTryPassResult.getTargetUrl()); + showQueuePage(queueTryPassResult.getQueueUrl(), queueTryPassResult.getTargetUrl(), webViewUserAgent); } }; handler.postDelayed(r, _delayInterval); @@ -57,7 +57,7 @@ public void setViewDelay(int delayInterval) { } - private void showQueuePage(String queueUrl, final String targetUrl) { + private void showQueuePage(String queueUrl, final String targetUrl, String webViewUserAgent) { _stateBroadcaster.registerReceivers(_queuePassedBroadcastReceiver, _queueUrlChangedBroadcastReceiver, _queueActivityClosedBroadcastReceiver, @@ -69,6 +69,7 @@ private void showQueuePage(String queueUrl, final String targetUrl) { Intent intent = new Intent(_context, QueueActivity.class); intent.putExtra("queueUrl", queueUrl); intent.putExtra("targetUrl", targetUrl); + intent.putExtra("webViewUserAgent", webViewUserAgent); intent.putExtra("userId", getUserId()); intent.putExtra("options", _options); _context.startActivity(intent); diff --git a/library/src/main/java/com/queue_it/androidsdk/QueueItEngineOptions.java b/library/src/main/java/com/queue_it/androidsdk/QueueItEngineOptions.java index 85d39e6..dc2c5ce 100644 --- a/library/src/main/java/com/queue_it/androidsdk/QueueItEngineOptions.java +++ b/library/src/main/java/com/queue_it/androidsdk/QueueItEngineOptions.java @@ -5,16 +5,27 @@ public class QueueItEngineOptions implements Parcelable { private boolean disableBackButtonFromWR; + private String webViewUserAgent; public QueueItEngineOptions() { } public QueueItEngineOptions(boolean disableBackButtonFromWR) { this.disableBackButtonFromWR = disableBackButtonFromWR; + this.webViewUserAgent = ""; + } + public QueueItEngineOptions(String webViewUserAgent) { + this.disableBackButtonFromWR = true; + this.webViewUserAgent = webViewUserAgent; + } + public QueueItEngineOptions(boolean disableBackButtonFromWR, String webViewUserAgent) { + this.disableBackButtonFromWR = disableBackButtonFromWR; + this.webViewUserAgent = webViewUserAgent; } protected QueueItEngineOptions(Parcel in) { disableBackButtonFromWR = in.readInt() != 0; + webViewUserAgent = in.readString(); } public static final Creator CREATOR = new Creator() { @@ -37,8 +48,16 @@ public void setBackButtonDisabledFromWR(boolean disableBackButtonFromWR) { this.disableBackButtonFromWR = disableBackButtonFromWR; } + public String getWebViewUserAgent() { + return webViewUserAgent; + } + + public void setWebViewUserAgent(String webViewUserAgent) { + this.webViewUserAgent = webViewUserAgent; + } + public static QueueItEngineOptions getDefault() { - return new QueueItEngineOptions(true); + return new QueueItEngineOptions(true, ""); } @Override @@ -49,5 +68,6 @@ public int describeContents() { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(this.disableBackButtonFromWR ? 1 : 0); + dest.writeString(this.webViewUserAgent); } }