Skip to content

Commit 5c77870

Browse files
authored
Merge pull request #15 from sp0x/master
Allows the handling of the user exiting the line.
2 parents 1b9c5f2 + b4731fb commit 5c77870

12 files changed

Lines changed: 112 additions & 12 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish to bintray on closed PR
2+
on:
3+
# Trigger the workflow on push to master branch
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
gradle:
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest]
12+
runs-on: ${{ matrix.os }}
13+
steps:
14+
- name: Check Commit Type
15+
uses: gsactions/commit-message-checker@v1
16+
#Commit should be like "^Merge pull request #"
17+
with:
18+
pattern: '^Merge pull request #\d'
19+
flags: 'gm'
20+
error: 'This action runs only on PR merges. Check your commit message.'
21+
- uses: actions/checkout@v2
22+
# Export properties
23+
- name: Setup bintray credentials
24+
env:
25+
BINTRAY_APIKEY: ${{ secrets.BINTRAY_APIKEY }}
26+
run: |
27+
echo "bintray.user=queueitdevs" > ./local.properties
28+
echo "bintray.apiKey=${BINTRAY_APIKEY}" >> ./local.properties
29+
- uses: actions/setup-java@v1
30+
with:
31+
java-version: 11
32+
- uses: eskatos/gradle-command-action@v1
33+
with:
34+
arguments: bintrayUpload

.github/workflows/gradle-build.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Run Gradle Build on Push
2+
on: push
3+
jobs:
4+
gradle:
5+
strategy:
6+
matrix:
7+
os: [ubuntu-latest]
8+
runs-on: ${{ matrix.os }}
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Create local.properties
12+
run: echo "" >> ./local.properties
13+
- uses: actions/setup-java@v1
14+
with:
15+
java-version: 11
16+
- uses: eskatos/gradle-command-action@v1
17+
with:
18+
arguments: build

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"files.exclude": {
3+
"**/.classpath": true,
4+
"**/.project": true,
5+
"**/.settings": true,
6+
"**/.factorypath": true
7+
}
8+
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.0.0'
9+
classpath 'com.android.tools.build:gradle:4.0.1'
1010

1111
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
1212
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

demoapp/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 23
4+
compileSdkVersion 26
55
buildToolsVersion "28.0.3"
66

77
defaultConfig {
88
applicationId "com.queue_it.shopdemo"
99
minSdkVersion 15
10-
targetSdkVersion 23
10+
targetSdkVersion 26
1111
versionCode 1
1212
versionName "1.0"
1313
}
@@ -20,9 +20,9 @@ android {
2020
}
2121

2222
dependencies {
23-
compile fileTree(dir: 'libs', include: ['*.jar'])
24-
testCompile 'junit:junit:4.12'
25-
compile 'com.android.support:appcompat-v7:23.4.0'
26-
compile 'com.android.support:design:23.4.0'
27-
compile project(':library')
23+
implementation fileTree(dir: 'libs', include: ['*.jar'])
24+
testImplementation 'junit:junit:4.12'
25+
implementation 'com.android.support:appcompat-v7:26.1.0'
26+
implementation 'com.android.support:design:26.1.0'
27+
implementation project(':library')
2828
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ public void onQueueViewWillOpen() {
8989
queue_button.setEnabled(true);
9090
}
9191

92+
@Override
93+
public void onUserExited() {
94+
Toast.makeText(getApplicationContext(), "onUserExited", Toast.LENGTH_SHORT).show();
95+
}
96+
9297
@Override
9398
public void onQueueDisabled() {
9499
showResultActivity("The queue is disabled.", false);
@@ -106,6 +111,7 @@ public void onError(Error error, String errorMessage) {
106111
showResultActivity("Critical error: " + errorMessage, false);
107112
queue_button.setEnabled(true);
108113
}
114+
109115
});
110116
try {
111117
queueITEngine.run(MainActivity.this, !enableCacheRadioButton.isChecked());

gradlew

100644100755
File mode changed.

library/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.library'
22
def org = "queueit"
33
android {
4-
compileSdkVersion 23
4+
compileSdkVersion 26
55
buildToolsVersion "28.0.3"
66

77
defaultConfig {
88
minSdkVersion 15
9-
targetSdkVersion 23
9+
targetSdkVersion 26
1010
versionCode 1
1111
versionName "2.0.22"
1212
}
@@ -22,7 +22,7 @@ android {
2222
dependencies {
2323
compile fileTree(dir: 'libs', include: ['*.jar'])
2424
testCompile 'junit:junit:4.12'
25-
compile 'com.android.support:appcompat-v7:23.4.0'
25+
compile 'com.android.support:appcompat-v7:26.1.0'
2626
compile 'com.squareup.okhttp3:okhttp:3.3.1'
2727
}
2828

@@ -108,7 +108,7 @@ properties.load(project.rootProject.file('local.properties').newDataInputStream(
108108

109109
bintray {
110110
user = properties.getProperty("bintray.user")
111-
key = properties.getProperty("bintray.apikey")
111+
key = properties.getProperty("bintray.apiKey")
112112

113113
configurations = ['archives']
114114
pkg {

library/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.queue_it.androidsdk">
33

4+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
45
<application
56
android:allowBackup="true"
67
android:label="@string/app_name"

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ public boolean shouldOverrideUrlLoading(WebView view, String urlString) {
8888
urlString = QueueUrlHelper.updateUrl(urlString, userId);
8989
Log.v("QueueITEngine", "URL intercepting: " + urlString);
9090
}
91+
if(isExitLineUrl(urlString)){
92+
broadcastUserExited();
93+
}
9194
broadcastChangedQueueUrl(urlString);
9295
if(needsRewrite){
9396
webview.loadUrl(urlString);
@@ -111,6 +114,17 @@ public boolean shouldOverrideUrlLoading(WebView view, String urlString) {
111114
}
112115
};
113116

117+
private boolean isExitLineUrl(String urlString) {
118+
URL url = null;
119+
try {
120+
url = new URL(urlString);
121+
} catch (MalformedURLException e) {
122+
e.printStackTrace();
123+
return false;
124+
}
125+
return url.getPath().equals("/exitline.aspx");
126+
}
127+
114128
private static void cleanupWebView(){
115129
if(previousWebView==null) return;
116130
previousWebView.destroy();
@@ -206,6 +220,11 @@ private void broadcastQueueActivityClosed() {
206220
LocalBroadcastManager.getInstance(QueueActivity.this).sendBroadcast(intent);
207221
}
208222

223+
public void broadcastUserExited(){
224+
Intent intent = new Intent("queue-user-exited");
225+
LocalBroadcastManager.getInstance(QueueActivity.this).sendBroadcast(intent);
226+
}
227+
209228
private void broadcastQueueError(String errorMessage) {
210229
Intent intent = new Intent("on-queue-error");
211230
intent.putExtra("error-message", errorMessage);

0 commit comments

Comments
 (0)