Skip to content

Commit be1fbd7

Browse files
author
queue-it
committed
Preparing release 1.2.1
1 parent d121be9 commit be1fbd7

32 files changed

Lines changed: 11265 additions & 3058 deletions

README.md

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ React Native Module for integrating Queue-it's virtual waiting room into React N
66

77
## Sample app
88

9-
A sample app project to try out functionality in the library can be found in the [exampleApp](https://github.com/queueit/react-native-queue-it/tree/master/exampleApp) directory.
9+
Two sample apps are available to try out the library:
10+
11+
- [`exampleApp`](https://github.com/queueit/react-native-queue-it/tree/master/exampleApp) — bare React Native
12+
- [`example-expo-app`](https://github.com/queueit/react-native-queue-it/tree/master/example-expo-app) — Expo (managed)
1013

1114
## Installation
1215

@@ -20,12 +23,54 @@ npm install --save react-native-queue-it
2023
cd ios && pod install
2124
```
2225

23-
When Android is used, the following activity also needs to be included in the application's manifest file.
26+
On Android, the library automatically registers the required `QueueActivity` — no manual `AndroidManifest.xml` changes are needed.
27+
28+
### Expo
29+
30+
The library works in a managed Expo project with no extra setup. The only exception is `android:allowBackup`: the Queue-it android SDK uses `allowBackup="true"`, so if your app sets `android.allowBackup` to `false` in `app.json` the Android manifest merge fails. To keep `false`, add a config plugin so your app's value wins the merge.
31+
32+
Create `plugins/withQueueItAllowBackup.js`:
2433

25-
```xml
26-
<activity android:name="com.queue_it.androidsdk.QueueActivity"/>
34+
```js
35+
const {
36+
withAndroidManifest,
37+
createRunOncePlugin,
38+
} = require('expo/config-plugins');
39+
40+
// Makes the app's android:allowBackup value win the manifest merge.
41+
const withQueueItAllowBackup = (config) =>
42+
withAndroidManifest(config, (config) => {
43+
const app = config.modResults?.manifest?.application?.[0];
44+
if (!app) return config;
45+
app.$ = app.$ || {};
46+
const existing = app.$['tools:replace'];
47+
app.$['tools:replace'] = existing
48+
? `${existing},android:allowBackup`
49+
: 'android:allowBackup';
50+
return config;
51+
});
52+
53+
const pkg = require('react-native-queue-it/package.json');
54+
55+
module.exports = createRunOncePlugin(
56+
withQueueItAllowBackup,
57+
pkg.name,
58+
pkg.version
59+
);
2760
```
2861
62+
Register it and regenerate the native project:
63+
64+
```json
65+
{ "expo": { "plugins": ["./plugins/withQueueItAllowBackup"] } }
66+
```
67+
68+
```sh
69+
npx expo prebuild --clean
70+
```
71+
72+
> Bare React Native apps can instead add `tools:replace="android:allowBackup"` to the `<application>` element in `android/app/src/main/AndroidManifest.xml`.
73+
2974
## Usage
3075
3176
To protect parts of your application you'll need to make a `QueueIt.run` call and await it's result.
@@ -73,7 +118,6 @@ enqueue = async () => {
73118
this.state.clientId,
74119
this.state.eventOrAlias,
75120
this.getEnqueueKey()
76-
77121
);
78122
} else if (this.state.enqueueToken) {
79123
enqueueResult = await QueueIt.runWithEnqueueToken(
@@ -89,7 +133,9 @@ enqueue = async () => {
89133
}
90134
switch (enqueueResult.State) {
91135
case EnqueueResultState.Disabled:
92-
console.log(`queue is disabled and QueueITToken is: ${enqueueResult.QueueITToken}`);
136+
console.log(
137+
`queue is disabled and QueueITToken is: ${enqueueResult.QueueITToken}`
138+
);
93139
break;
94140
case EnqueueResultState.Passed:
95141
console.log(

android/build.gradle

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,17 @@ android {
102102
def kotlin_version = getExtOrDefault('kotlinVersion')
103103
dependencies {
104104
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
105-
implementation(libs.react.android)
106-
implementation(libs.fbjni)
105+
// The 'com.facebook.react' Gradle plugin (applied above) substitutes react-native ->
106+
// react-android and supplies the version from the host app's installed React Native,
107+
// so no version is pinned here. fbjni is provided transitively by react-android (its
108+
// prefab is configured by React Native's CMake helper), so it needs no explicit entry.
109+
implementation 'com.facebook.react:react-native:+'
107110

108111
//App dependencies
109-
implementation('com.queue-it.androidsdk:library:2.0.36')
110-
implementation('com.android.support:appcompat-v7:28.0.0')
111-
implementation('com.android.support:design:28.0.0')
112+
// Queue-it Android SDK 2.3.0+ is AndroidX-native, so it needs no com.android.support
113+
// exclude and works with Jetifier disabled.
114+
implementation('com.queue-it.androidsdk:library:2.3.0')
115+
implementation('androidx.appcompat:appcompat:1.7.1')
116+
implementation('com.google.android.material:material:1.14.0')
117+
implementation('androidx.localbroadcastmanager:localbroadcastmanager:1.1.0')
112118
}

android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ QueueIt_kotlinVersion=1.9.24
22
QueueIt_compileSdkVersion=34
33
QueueIt_targetSdkVersion=34
44
android.useAndroidX=true
5-
android.enableJetifier=true
5+
android.enableJetifier=false
66
newArchEnabled=true
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22

3+
<!--
4+
Declare QueueActivity. This merges into the host app via
5+
autolinking for both bare React Native and managed Expo projects.
6+
-->
7+
<application>
8+
<activity android:name="com.queue_it.androidsdk.QueueActivity" />
9+
</application>
10+
311
</manifest>

android/src/main/java/com/reactnativequeueit/QueueItModule.kt

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,50 +23,58 @@ class QueueItModule(reactContext: ReactApplicationContext) {
2323
}
2424

2525
fun enableTesting(value: Boolean) {
26-
QueueService.IsTest = value
26+
// No-op: the Queue-it Android SDK no longer has a global test flag. Test environments
27+
// are now targeted by passing a test `waitingRoomDomain` to QueueITEngine. Kept for
28+
// cross-platform API compatibility.
2729
}
2830

29-
fun runAsync(customerId: String, eventAlias: String, layoutName: String?, language: String?, queueListener: QueueListener?, promise: Promise) {
31+
fun runAsync(customerId: String, eventAlias: String, layoutName: String?, language: String?, queueListener: QueueListener, promise: Promise) {
3032
handler.post {
31-
if (context.currentActivity == null) {
33+
val activity = context.currentActivity
34+
if (activity == null) {
3235
promise.reject("error", "Calling QueueItRun with a null activity/context")
3336
return@post
3437
}
3538
try {
36-
val queueEngine = QueueITEngine(context.currentActivity, customerId, eventAlias, layoutName, language, queueListener)
37-
queueEngine.run(context.currentActivity)
39+
// QueueITEngine args: (context, customerId, eventOrAliasId, layoutName, language,
40+
// waitingRoomDomain, queuePathPrefix, queueListener, options). The domain/prefix are
41+
// optional (null = default/production); options uses the SDK defaults.
42+
val queueEngine = QueueITEngine(activity, customerId, eventAlias, layoutName, language, null, null, queueListener, QueueItEngineOptions.getDefault())
43+
queueEngine.run(activity)
3844
} catch (e: Exception) {
3945
promise.reject("error", e.message)
4046
return@post
4147
}
4248
}
4349
}
4450

45-
fun runWithEnqueueTokenAsync(customerId: String, eventAlias: String, enqueueToken: String, layoutName: String?, language: String?, queueListener: QueueListener?, promise: Promise) {
51+
fun runWithEnqueueTokenAsync(customerId: String, eventAlias: String, enqueueToken: String, layoutName: String?, language: String?, queueListener: QueueListener, promise: Promise) {
4652
handler.post {
47-
if (context.currentActivity == null) {
53+
val activity = context.currentActivity
54+
if (activity == null) {
4855
promise.reject("error", "Calling QueueItRun with a null activity/context")
4956
return@post
5057
}
5158
try {
52-
val queueEngine = QueueITEngine(context.currentActivity, customerId, eventAlias, layoutName, language, queueListener)
53-
queueEngine.runWithEnqueueToken(context.currentActivity, enqueueToken)
59+
val queueEngine = QueueITEngine(activity, customerId, eventAlias, layoutName, language, null, null, queueListener, QueueItEngineOptions.getDefault())
60+
queueEngine.runWithEnqueueToken(activity, enqueueToken)
5461
} catch (e: Exception) {
5562
promise.reject("error", e.message)
5663
return@post
5764
}
5865
}
5966
}
6067

61-
fun runWithEnqueueKeyAsync(customerId: String, eventAlias: String, enqueueKey: String, layoutName: String?, language: String?, queueListener: QueueListener?, promise: Promise) {
68+
fun runWithEnqueueKeyAsync(customerId: String, eventAlias: String, enqueueKey: String, layoutName: String?, language: String?, queueListener: QueueListener, promise: Promise) {
6269
handler.post {
63-
if (context.currentActivity == null) {
70+
val activity = context.currentActivity
71+
if (activity == null) {
6472
promise.reject("error", "Calling QueueItRun with a null activity/context")
6573
return@post
6674
}
6775
try {
68-
val queueEngine = QueueITEngine(context.currentActivity, customerId, eventAlias, layoutName, language, queueListener)
69-
queueEngine.runWithEnqueueKey(context.currentActivity, enqueueKey)
76+
val queueEngine = QueueITEngine(activity, customerId, eventAlias, layoutName, language, null, null, queueListener, QueueItEngineOptions.getDefault())
77+
queueEngine.runWithEnqueueKey(activity, enqueueKey)
7078
} catch (e: Exception) {
7179
promise.reject("error", e.message)
7280
return@post

android/src/main/jni/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,14 @@ file(TO_CMAKE_PATH "${CODEGEN_DIR}" CODEGEN_DIR)
2424

2525
include("${REACT_ANDROID_DIR}/cmake-utils/ReactNative-application.cmake")
2626

27-
set(SOURCE_FILES
28-
"${CODEGEN_DIR}/ReactNativeQueueIt-generated.cpp"
29-
"${CODEGEN_DIR}/react/renderer/components/ReactNativeQueueIt/ReactNativeQueueItJSI-generated.cpp"
27+
# React Native's codegen emits a different set of .cpp files per RN version, so glob the
28+
# generated sources instead of hardcoding filenames to stay resilient across versions.
29+
# CONFIGURE_DEPENDS re-runs the glob when the generated files change.
30+
file(
31+
GLOB SOURCE_FILES
32+
CONFIGURE_DEPENDS
33+
"${CODEGEN_DIR}/*.cpp"
34+
"${CODEGEN_DIR}/react/renderer/components/ReactNativeQueueIt/*.cpp"
3035
)
3136

3237
include_directories(

documentation/ReactNative16kbComplianceInstructions.md

Lines changed: 8 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,24 @@
1-
# React Native (v0.80.1) 16kb Page Size Update - Configuration
1+
# React Native 16kb Page Size Update - Configuration
22
This document describes the required changes in the react-native application to accommodate the new update of react-native-queue-it connector.
33

4+
> **Note:** react-native-queue-it now resolves React Native itself through the `com.facebook.react` Gradle plugin, so the app **no longer needs to create a `gradle/libs.versions.toml` version catalog** or register it in `settings.gradle`. It automatically uses the React Native version already installed in your app, so these steps work across React Native versions (verified on 0.83 and 0.86). The instructions below have been simplified accordingly.
5+
46
## iOS
57
iOS applications should not be impacted by this update.
68

79
## Android
810
Android apps will need to include the following changes to support the new update.
911

10-
### gradle/libs.versions.toml
11-
This file contains all the necessary information for the needed dependencies and versions. If this file does not exist, it needs to be created.
12-
```toml
13-
[versions]
14-
# Android versions
15-
minSdk = "24"
16-
targetSdk = "35"
17-
compileSdk = "35"
18-
buildTools = "35.0.0"
19-
ndkVersion = "27.1.12297006"
20-
# Dependencies versions
21-
agp = "8.7.2"
22-
androidx-annotation = "1.6.0"
23-
androidx-appcompat = "1.6.1"
24-
androidx-autofill = "1.1.0"
25-
androidx-swiperefreshlayout = "1.1.0"
26-
androidx-test = "1.5.0"
27-
androidx-tracing = "1.1.0"
28-
assertj = "3.21.0"
29-
binary-compatibility-validator = "0.13.2"
30-
download = "5.4.0"
31-
fbjni = "0.7.0"
32-
fresco = "3.4.0"
33-
infer-annotation = "0.18.0"
34-
javax-annotation-api = "1.3.2"
35-
javax-inject = "1"
36-
jsr305 = "3.0.2"
37-
junit = "4.13.2"
38-
kotlin = "2.0.21"
39-
mockito = "3.12.4"
40-
nexus-publish = "1.3.0"
41-
okhttp = "4.9.2"
42-
okio = "2.9.0"
43-
robolectric = "4.9.2"
44-
soloader = "0.12.1"
45-
xstream = "1.4.20"
46-
yoga-proguard-annotations = "1.19.0"
47-
# Native Dependencies
48-
boost="1_83_0"
49-
doubleconversion="1.1.6"
50-
fastFloat="6.1.4"
51-
fmt="11.0.2"
52-
folly="2024.11.18.00"
53-
glog="0.3.5"
54-
gtest="1.12.1"
55-
react-android="0.80.1"
56-
57-
[libraries]
58-
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
59-
androidx-appcompat-resources = { module = "androidx.appcompat:appcompat-resources", version.ref = "androidx-appcompat" }
60-
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" }
61-
androidx-autofill = { module = "androidx.autofill:autofill", version.ref = "androidx-autofill" }
62-
androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "androidx-swiperefreshlayout" }
63-
androidx-tracing = { module = "androidx.tracing:tracing", version.ref = "androidx-tracing" }
64-
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test" }
65-
androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test" }
66-
67-
fbjni = { module = "com.facebook.fbjni:fbjni", version.ref = "fbjni" }
68-
folly = { module = "com.facebook.folly:folly", version.ref = "folly" }
69-
fresco = { module = "com.facebook.fresco:fresco", version.ref = "fresco" }
70-
fresco-middleware = { module = "com.facebook.fresco:middleware", version.ref = "fresco" }
71-
fresco-imagepipeline-okhttp3 = { module = "com.facebook.fresco:imagepipeline-okhttp3", version.ref = "fresco" }
72-
fresco-ui-common = { module = "com.facebook.fresco:ui-common", version.ref = "fresco" }
73-
infer-annotation = { module = "com.facebook.infer.annotation:infer-annotation", version.ref = "infer-annotation" }
74-
soloader = { module = "com.facebook.soloader:soloader", version.ref = "soloader" }
75-
yoga-proguard-annotations = { module = "com.facebook.yoga:proguard-annotations", version.ref = "yoga-proguard-annotations" }
76-
77-
jsr305 = { module = "com.google.code.findbugs:jsr305", version.ref = "jsr305" }
78-
okhttp3-urlconnection = { module = "com.squareup.okhttp3:okhttp-urlconnection", version.ref = "okhttp" }
79-
okhttp3 = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
80-
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
81-
javax-inject = { module = "javax.inject:javax.inject", version.ref = "javax-inject" }
82-
javax-annotation-api = { module = "javax.annotation:javax.annotation-api", version.ref = "javax-annotation-api" }
83-
84-
react-android = { module = "com.facebook.react:react-android", version.ref = "react-android" }
85-
hermes-android = { module = "com.facebook.react:hermes-android", version.ref = "react-android" }
86-
87-
junit = {module = "junit:junit", version.ref = "junit" }
88-
assertj = {module = "org.assertj:assertj-core", version.ref = "assertj" }
89-
mockito = {module = "org.mockito:mockito-inline", version.ref = "mockito" }
90-
robolectric = {module = "org.robolectric:robolectric", version.ref = "robolectric" }
91-
thoughtworks = {module = "com.thoughtworks.xstream:xstream", version.ref = "xstream" }
92-
93-
[plugins]
94-
react = { id = "com.facebook.react", version.ref = "react-android" }
95-
android-application = { id = "com.android.application", version.ref = "agp" }
96-
android-library = { id = "com.android.library" }
97-
download = { id = "de.undercouch.download", version.ref = "download" }
98-
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus-publish" }
99-
kotlin-android = { id = "org.jetbrains.kotlin.android" }
100-
binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator" }
101-
```
102-
10312
### settings.gradle
104-
1. Add the ```dependencyResolutionManagement``` block to reference .toml file;
105-
2. Include ```react-native-queue-it``` directives;
106-
3. Include ```react-native-community_checkbox``` directives (if used by the app);
13+
1. Include ```react-native-queue-it``` directives;
14+
2. Include ```react-native-community_checkbox``` directives (if used by the app);
10715

10816
```gradle
10917
// Example settings.gradle file
11018
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
11119
plugins { id("com.facebook.react.settings") }
11220
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
11321
114-
// .toml file reference
115-
dependencyResolutionManagement {
116-
versionCatalogs {
117-
create("libs") {
118-
from(files("$rootDir/../gradle/libs.versions.toml"))
119-
}
120-
}
121-
}
122-
// .toml file reference
123-
12422
rootProject.name = 'RNTestSample'
12523
includeBuild('../node_modules/@react-native/gradle-plugin')
12624
@@ -138,8 +36,7 @@ include ':app'
13836
```
13937

14038
### gradle.properties
141-
1. Add ```android.enableJetifier=true```;
142-
2. Add ```QueueIt_kotlinVersion=1.9.24```;
39+
1. Add ```QueueIt_kotlinVersion=1.9.24```;
14340
```properties
14441
# Example gradle.properties file
14542
# JVM
@@ -152,7 +49,6 @@ hermesEnabled=true
15249

15350
# Android
15451
android.useAndroidX=true
155-
android.enableJetifier=true
15652

15753
# QueueIt
15854
QueueIt_kotlinVersion=1.9.24
@@ -292,7 +188,7 @@ android {
292188
dependencies {
293189
implementation fileTree(dir: "libs", include: ["*.jar"])
294190
295-
implementation(libs.react.android)
191+
implementation("com.facebook.react:react-android")
296192
297193
if (enableHermes) {
298194
implementation("com.facebook.react:hermes-engine:+") {
@@ -342,4 +238,4 @@ dependencies {
342238
</application>
343239

344240
</manifest>
345-
```
241+
```

0 commit comments

Comments
 (0)