Skip to content

Commit b84df99

Browse files
author
queue-it
committed
Preparing release 2.1.4
1 parent 1c10e46 commit b84df99

File tree

7 files changed

+13
-127
lines changed

7 files changed

+13
-127
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,4 @@ If your application is using an API that's protected by a Queue-it connector (Kn
157157

158158
```xml
159159
<activity android:name="com.queue_it.androidsdk.QueueActivity" />
160-
```
160+
```

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ allprojects {
3636
groupId = 'com.queue-it.androidsdk'
3737
libraryName = 'com.queue_it.androidsdk'
3838
libraryDescription = 'Android SDK to integrate with Queue-it'
39-
libraryVersion = "2.1.3"
39+
libraryVersion = "2.1.4"
4040
organization = "Queue-it"
4141
organizationUrl = "https://queue-it.com"
4242

demoapp/src/library/java/com/queue_it/shopdemo/MainActivity.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.queue_it.androidsdk.Error;
2121

2222
public class MainActivity extends AppCompatActivity {
23-
RadioButton enableCacheRadioButton;
2423
FloatingActionButton queue_button;
2524
EditText customerIdEditText;
2625
EditText eventIdEditText;
@@ -34,11 +33,11 @@ private void runQueue(QueueITEngine queueITEngine) throws QueueITException {
3433
String enqueueToken = enqueueTokenEditText.getText().toString();
3534
String enqueueKey = enqueueKeyEditText.getText().toString();
3635
if (enqueueToken.length() > 0) {
37-
queueITEngine.runWithEnqueueToken(MainActivity.this, enqueueToken, !enableCacheRadioButton.isChecked());
36+
queueITEngine.runWithEnqueueToken(MainActivity.this, enqueueToken);
3837
} else if (enqueueKey.length() > 0) {
39-
queueITEngine.runWithEnqueueKey(MainActivity.this, enqueueKey, !enableCacheRadioButton.isChecked());
38+
queueITEngine.runWithEnqueueKey(MainActivity.this, enqueueKey);
4039
} else {
41-
queueITEngine.run(MainActivity.this, !enableCacheRadioButton.isChecked());
40+
queueITEngine.run(MainActivity.this);
4241
}
4342
}
4443

@@ -53,7 +52,6 @@ protected void onCreate(Bundle savedInstanceState) {
5352
layoutNameEditText = findViewById(R.id.layoutname_edittext);
5453
languageEditText = findViewById(R.id.language_edittext);
5554
testRadioButton = findViewById(R.id.radio_environment_test);
56-
enableCacheRadioButton = findViewById(R.id.radio_cache_enabled);
5755
customerIdEditText.addTextChangedListener(getRequiredTextValidator(customerIdEditText));
5856
eventIdEditText.addTextChangedListener(getRequiredTextValidator(eventIdEditText));
5957
enqueueTokenEditText = findViewById(R.id.enqueuetoken_edittext);

demoapp/src/library/res/layout/activity_main.xml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -145,36 +145,7 @@
145145
</RadioGroup>
146146

147147
</TableRow>
148-
<TableRow>
149-
150-
<TextView
151-
android:layout_width="wrap_content"
152-
android:layout_height="wrap_content"
153-
android:gravity="right"
154-
android:padding="10dip"
155-
android:text="Cache:" />
156148

157-
<RadioGroup
158-
android:orientation="horizontal"
159-
android:checkedButton="@+id/radio_cache_enabled"
160-
>
161-
<RadioButton
162-
android:layout_width="wrap_content"
163-
android:layout_height="wrap_content"
164-
android:text="Enabled"
165-
android:id="@+id/radio_cache_enabled"
166-
android:layout_column="1" />
167-
168-
<RadioButton
169-
android:layout_width="wrap_content"
170-
android:layout_height="wrap_content"
171-
android:text="Disabled"
172-
android:id="@+id/radio_cache_disabled"
173-
android:layout_column="1" />
174-
175-
</RadioGroup>
176-
177-
</TableRow>
178149
</TableLayout>
179150

180151
<com.google.android.material.floatingactionbutton.FloatingActionButton

demoapp/src/library_androidx/java/com/queue_it/shopdemo/MainActivity.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.queue_it.androidsdk.Error;
2424

2525
public class MainActivity extends AppCompatActivity {
26-
RadioButton enableCacheRadioButton;
2726
FloatingActionButton queue_button;
2827
FloatingActionButton queueSession_button;
2928
FloatingActionButton show_queue_button;
@@ -95,11 +94,11 @@ private void runQueue(QueueITEngine queueITEngine) throws QueueITException {
9594
String enqueueToken = enqueueTokenEditText.getText().toString();
9695
String enqueueKey = enqueueKeyEditText.getText().toString();
9796
if (enqueueToken.length() > 0) {
98-
queueITEngine.runWithEnqueueToken(this, enqueueToken, !enableCacheRadioButton.isChecked());
97+
queueITEngine.runWithEnqueueToken(this, enqueueToken);
9998
} else if (enqueueKey.length() > 0) {
100-
queueITEngine.runWithEnqueueKey(this, enqueueKey, !enableCacheRadioButton.isChecked());
99+
queueITEngine.runWithEnqueueKey(this, enqueueKey);
101100
} else {
102-
queueITEngine.run(this, !enableCacheRadioButton.isChecked());
101+
queueITEngine.run(this);
103102
}
104103
}
105104

@@ -128,7 +127,6 @@ protected void onCreate(Bundle savedInstanceState) {
128127
layoutNameEditText = findViewById(R.id.layoutname_edittext);
129128
languageEditText = findViewById(R.id.language_edittext);
130129
testRadioButton = findViewById(R.id.radio_environment_test);
131-
enableCacheRadioButton = findViewById(R.id.radio_cache_enabled);
132130
customerIdEditText.addTextChangedListener(getRequiredTextValidator(customerIdEditText));
133131
eventIdEditText.addTextChangedListener(getRequiredTextValidator(eventIdEditText));
134132
enqueueTokenEditText = findViewById(R.id.enqueuetoken_edittext);

demoapp/src/library_androidx/res/layout/activity_main.xml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -145,36 +145,6 @@
145145
</RadioGroup>
146146

147147
</TableRow>
148-
<TableRow>
149-
150-
<TextView
151-
android:layout_width="wrap_content"
152-
android:layout_height="wrap_content"
153-
android:gravity="right"
154-
android:padding="10dip"
155-
android:text="Cache:" />
156-
157-
<RadioGroup
158-
android:orientation="horizontal"
159-
android:checkedButton="@+id/radio_cache_enabled"
160-
>
161-
<RadioButton
162-
android:layout_width="wrap_content"
163-
android:layout_height="wrap_content"
164-
android:text="Enabled"
165-
android:id="@+id/radio_cache_enabled"
166-
android:layout_column="1" />
167-
168-
<RadioButton
169-
android:layout_width="wrap_content"
170-
android:layout_height="wrap_content"
171-
android:text="Disabled"
172-
android:id="@+id/radio_cache_disabled"
173-
android:layout_column="1" />
174-
175-
</RadioGroup>
176-
177-
</TableRow>
178148
</TableLayout>
179149

180150
<TableLayout

library/src/main/java/com/queue_it/androidsdk/QueueITEngine.java

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ public class QueueITEngine {
99
private QueueITWaitingRoomProvider _queueITWaitingRoomProvider;
1010
private QueueITWaitingRoomView _queueITWaitingRoomView;
1111

12-
private final QueueCache _queueCache;
13-
1412
private QueueListener _queueITEngineListener;
1513
private QueueTryPassResult _queueTryPassResult;
1614

@@ -53,13 +51,11 @@ public QueueITEngine(Context activityContext,
5351
options = QueueItEngineOptions.getDefault();
5452
}
5553
UserAgentManager.initialize(activityContext);
56-
_queueCache = new QueueCache(activityContext, customerId, eventOrAliasId);
5754
_queueITEngineListener = queueListener;
5855

5956
QueueListener queueITQueueListener = new QueueListener() {
6057
@Override
6158
protected void onQueuePassed(QueuePassedInfo queuePassedInfo) {
62-
_queueCache.clear();
6359
_queueITEngineListener.onQueuePassed(queuePassedInfo);
6460
}
6561

@@ -85,7 +81,6 @@ protected void onError(Error error, String errorMessage) {
8581

8682
@Override
8783
public void onSessionRestart(QueueITEngine queueITEngine) {
88-
_queueCache.clear();
8984
_queueITEngineListener.onSessionRestart(QueueITEngine.this);
9085
}
9186

@@ -102,7 +97,6 @@ public void onWebViewClosed() {
10297
@Override
10398
protected void onQueueUrlChanged(String url) {
10499
_queueITEngineListener.onQueueUrlChanged(url);
105-
updateQueuePageUrl(url);
106100
}
107101
};
108102

@@ -120,7 +114,6 @@ public void onSuccess(QueueTryPassResult queueTryPassResult) {
120114

121115
_queueTryPassResult = queueTryPassResult;
122116
_queueITWaitingRoomView.showQueue(_queueTryPassResult);
123-
_queueCache.update(queueTryPassResult.getQueueUrl(), queueTryPassResult.getUrlTTLInMinutes(), queueTryPassResult.getTargetUrl());
124117
}
125118

126119
@Override
@@ -145,76 +138,32 @@ public boolean IsRequestInProgress() {
145138
return _queueITWaitingRoomProvider.IsRequestInProgress();
146139
}
147140

148-
public void run(Context activityContext, boolean clearCache) throws QueueITException {
149-
if (clearCache) {
150-
_queueCache.clear();
151-
}
152-
run(activityContext);
153-
}
141+
154142

155143
public void run(Context activityContext) throws QueueITException {
156-
if(!tryToShowQueueFromCache()){
157144
_queueITWaitingRoomProvider.tryPass();
158-
}
159-
}
160145

161-
public void runWithEnqueueToken(Context activityContext, String enqueueToken) throws QueueITException {
162-
runWithEnqueueToken(activityContext, enqueueToken, false);
163146
}
164147

165-
public void runWithEnqueueToken(Context activityContext, String enqueueToken, boolean clearCache)
148+
149+
public void runWithEnqueueToken(Context activityContext, String enqueueToken)
166150
throws QueueITException {
167151
if (_queueITWaitingRoomProvider.IsRequestInProgress()){
168152
throw new QueueITException("Request is already in progress");
169153
}
170-
if (clearCache) {
171-
_queueCache.clear();
172-
}
173154

174-
if(!tryToShowQueueFromCache()){
175155
_queueITWaitingRoomProvider.tryPassWithEnqueueToken(enqueueToken);
176-
}
177156

178157
}
179158

180-
public void runWithEnqueueKey(Context activityContext, String enqueueKey) throws QueueITException {
181-
runWithEnqueueKey(activityContext, enqueueKey, false);
182-
}
183159

184-
public void runWithEnqueueKey(Context activityContext, String enqueueKey, boolean clearCache)
160+
public void runWithEnqueueKey(Context activityContext, String enqueueKey)
185161
throws QueueITException {
186162
if (_queueITWaitingRoomProvider.IsRequestInProgress()){
187163
throw new QueueITException("Request is already in progress");
188164
}
189-
if (clearCache) {
190-
_queueCache.clear();
191-
}
192-
if(!tryToShowQueueFromCache()){
193-
_queueITWaitingRoomProvider.tryPassWithEnqueueKey(enqueueKey);
194-
}
195-
}
196-
197-
private boolean tryToShowQueueFromCache() {
198-
if (_queueCache.isEmpty()) {
199-
return false;
200-
}
201165

202-
Calendar cachedTime = _queueCache.getUrlTtl();
203-
Calendar currentTime = Calendar.getInstance();
204-
205-
if (currentTime.compareTo(cachedTime) < 0) {
206-
String queueUrl = _queueCache.getQueueUrl();
207-
Log.v("QueueITEngine", String.format("Using queueUrl from cache: %s", queueUrl));
208-
_queueITWaitingRoomView.showQueue(_queueTryPassResult);
209-
return true;
210-
}
211-
return false;
212-
}
213-
214-
private void updateQueuePageUrl(String queueUrl) {
215-
if (!_queueCache.isEmpty()) {
216-
_queueCache.update(queueUrl, _queueCache.getUrlTtl(), _queueCache.getTargetUrl());
217-
}
166+
_queueITWaitingRoomProvider.tryPassWithEnqueueKey(enqueueKey);
218167
}
219168

220169
public String getSdkVersion() {

0 commit comments

Comments
 (0)