Skip to content

Commit

Permalink
Preparing release 2.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
queue-it committed Feb 7, 2024
1 parent 3fc2521 commit 51a24c7
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

Expand All @@ -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"));
}

Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ protected void onQueueUrlChanged(String url) {
}
};

final String webViewUserAgent = options.getWebViewUserAgent();

QueueITWaitingRoomProviderListener queueITWaitingRoomProviderListener = new QueueITWaitingRoomProviderListener() {
@Override
public void onSuccess(QueueTryPassResult queueTryPassResult) {
Expand All @@ -113,7 +115,7 @@ public void onSuccess(QueueTryPassResult queueTryPassResult) {
}

_queueTryPassResult = queueTryPassResult;
_queueITWaitingRoomView.showQueue(_queueTryPassResult);
_queueITWaitingRoomView.showQueue(_queueTryPassResult, webViewUserAgent);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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,
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<QueueItEngineOptions> CREATOR = new Creator<QueueItEngineOptions>() {
Expand All @@ -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
Expand All @@ -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);
}
}

0 comments on commit 51a24c7

Please sign in to comment.