Skip to content

Commit 657e37b

Browse files
feat: add the ability to hide the Visitor Code alert
MOB-4818
1 parent 8155cb9 commit 657e37b

File tree

16 files changed

+93
-21
lines changed

16 files changed

+93
-21
lines changed

android/src/main/java/com/glia/widgets/ionic/GliaSdk.java

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,21 @@ public void presentEntryWidget(PluginCall call, Activity activity) {
131131
}
132132

133133
public void showEntryWidget(PluginCall call, Activity activity) {
134-
JSArray queueIds = call.getArray("queueIds", new JSArray());
135-
entryWidget = GliaWidgets.getEntryWidget(jsArrayToArrayList(queueIds));
136-
entryWidget.show(activity);
137-
call.resolve();
134+
try {
135+
JSArray queueIds = call.getArray("queueIds", new JSArray());
136+
entryWidget = GliaWidgets.getEntryWidget(jsArrayToArrayList(queueIds));
137+
entryWidget.show(activity);
138+
call.resolve();
139+
} catch (Exception e) {
140+
call.reject("Could not show entry widget. Error='" + e.getMessage() + "'");
141+
}
138142
}
139143

140144
public void hideEntryWidget(PluginCall call) {
145+
if (entryWidget == null) {
146+
call.reject("Entry widget is not presented.");
147+
return;
148+
}
141149
entryWidget.hide();
142150
call.resolve();
143151
}
@@ -296,8 +304,21 @@ public void getQueues(PluginCall call) {
296304
}
297305

298306
public void showVisitorCode(PluginCall call) {
299-
GliaWidgets.getCallVisualizer().showVisitorCodeDialog();
300-
call.resolve();
307+
try {
308+
GliaWidgets.getCallVisualizer().showVisitorCodeDialog();
309+
call.resolve();
310+
} catch (Exception e) {
311+
call.reject("Could not show visitor code. Error='" + e.getMessage() + "'");
312+
}
313+
}
314+
315+
public void hideVisitorCode(PluginCall call) {
316+
try {
317+
GliaWidgets.getCallVisualizer().hideVisitorCodeDialog();
318+
call.resolve();
319+
} catch (Exception e) {
320+
call.reject("Could not hide visitor code. Error='" + e.getMessage() + "'");
321+
}
301322
}
302323

303324
public void authenticate(PluginCall call) {

android/src/main/java/com/glia/widgets/ionic/GliaSdkPlugin.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ public void showVisitorCode(PluginCall call) {
9494
implementation.showVisitorCode(call);
9595
}
9696

97+
@PluginMethod
98+
public void hideVisitorCode(PluginCall call) {
99+
implementation.hideVisitorCode(call);
100+
}
101+
97102
@PluginMethod
98103
public void authenticate(PluginCall call) {
99104
implementation.authenticate(call);

dist/docs.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
"tags": [
217217
{
218218
"name": "deprecated",
219-
"text": "Use showVisitorCode() instead.\nPresents GliaWidgets UI with a visitor code for sharing with operator to start an engagement."
219+
"text": "Use showVisitorCode() instead.\nPresents a GliaWidgets alert with a visitor code to share with an operator to start an engagement."
220220
}
221221
],
222222
"docs": "",
@@ -229,10 +229,20 @@
229229
"parameters": [],
230230
"returns": "Promise<void>",
231231
"tags": [],
232-
"docs": "Presents GliaWidgets UI with a visitor code for sharing with operator to start an engagement.",
232+
"docs": "Presents a GliaWidgets alert with a visitor code to share with an operator to start an engagement.",
233233
"complexTypes": [],
234234
"slug": "showvisitorcode"
235235
},
236+
{
237+
"name": "hideVisitorCode",
238+
"signature": "() => Promise<void>",
239+
"parameters": [],
240+
"returns": "Promise<void>",
241+
"tags": [],
242+
"docs": "Closes a GliaWidgets alert with a visitor code if it is currently visible.",
243+
"complexTypes": [],
244+
"slug": "hidevisitorcode"
245+
},
236246
{
237247
"name": "authenticate",
238248
"signature": "(options: { behavior: AuthenticationBehavior; idToken: string; accessToken?: string; }) => Promise<void>",

dist/esm/definitions.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,17 @@ export interface GliaSdk {
408408
getQueues(): Promise<Queues>;
409409
/**
410410
* @deprecated Use showVisitorCode() instead.
411-
* Presents GliaWidgets UI with a visitor code for sharing with operator to start an engagement.
411+
* Presents a GliaWidgets alert with a visitor code to share with an operator to start an engagement.
412412
*/
413413
showVisitorCodeViewController(): Promise<void>;
414414
/**
415-
* Presents GliaWidgets UI with a visitor code for sharing with operator to start an engagement.
415+
* Presents a GliaWidgets alert with a visitor code to share with an operator to start an engagement.
416416
*/
417417
showVisitorCode(): Promise<void>;
418+
/**
419+
* Closes a GliaWidgets alert with a visitor code if it is currently visible.
420+
*/
421+
hideVisitorCode(): Promise<void>;
418422
/**
419423
* Authenticates the visitor.
420424
* @param options - Provides options for authentication such as behavior, idToken, and accessToken.

dist/esm/definitions.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugin.cjs.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugin.cjs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugin.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugin.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example-app/ios/App/Podfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ PODS:
1818
- GliaOpenTelemetry (1.0.5)
1919
- GliaWidgets (3.3.0):
2020
- GliaCoreSDK (= 2.3.0)
21-
- GliaWidgetsIonic (3.2.2):
21+
- GliaWidgetsIonic (3.3.1):
2222
- Capacitor
2323
- GliaWidgets (= 3.3.0)
2424
- PhoenixChannelsClient (1.0.1)
@@ -58,16 +58,16 @@ EXTERNAL SOURCES:
5858
:path: "../../.."
5959

6060
SPEC CHECKSUMS:
61-
Capacitor: 1e0d0e7330dea9f983b50da737d8918abcf273f8
62-
CapacitorCamera: 9052bd3f464f135ba983feccd8ac1266272f0549
61+
Capacitor: c95400d761e376be9da6be5a05f226c0e865cebf
62+
CapacitorCamera: 9bc7b005d0e6f1d5f525b8137045b60cffffce79
6363
CapacitorCordova: 8d93e14982f440181be7304aa9559ca631d77fff
64-
CapacitorPushNotifications: 1fc22ae360214a0ac0625c348d3aea217085163d
65-
CapacitorSplashScreen: 68893659d77b5f82d753b3a70475082845e3039c
64+
CapacitorPushNotifications: b3f20973cb167cb8fee622e309ec521134798241
65+
CapacitorSplashScreen: fd8bf1bf9081d9aa8817b7cd37d740d1bdaf2fb2
6666
GliaCoreDependency: bf99fc5a6fe66348b58123caded985506a8cf762
6767
GliaCoreSDK: adda44248cb9e4f8dc43ce07349d9b1f1a71ae68
6868
GliaOpenTelemetry: 68e17e91ffd098b435129d56d1b1f2d263efea0d
6969
GliaWidgets: c394d75d38b199b96db7578116a16f45beef7886
70-
GliaWidgetsIonic: 62d1af273a05bbcbf45b28d07c8dcb04bfeaf53e
70+
GliaWidgetsIonic: 0910af88c33b9e6de93830839757c90b2f29cf8f
7171
PhoenixChannelsClient: 74cf91ecd76471e5fb262745256733dce7ee3cb6
7272
TwilioVoice: 9563c9ad71b9ab7bbad0b59b67cfe4be96c75d23
7373
WebRTC-lib: 4e9a17058f880cd658e88383c1ac8f1119af3700

0 commit comments

Comments
 (0)