@@ -13,7 +13,8 @@ const ACTION_TYPES = {
13
13
CONNECTION_ERROR : 7 ,
14
14
RECEIVED_FIELD : 8 ,
15
15
SEND_FIELD : 9 ,
16
- CLOSE : 10
16
+ CLOSE : 10 ,
17
+ CONNECTION_DENIED :11
17
18
} ;
18
19
19
20
const MobileState = {
@@ -33,6 +34,7 @@ export const initialState = {
33
34
isError : false ,
34
35
isDisconnected : false ,
35
36
isConnected : false ,
37
+ isConnectionDenied :false ,
36
38
initData : null ,
37
39
connected : [ ]
38
40
} ;
@@ -214,6 +216,7 @@ const buildMobileConfig = (initData, options, notify) => {
214
216
else {
215
217
if ( mobileData . sender && mobileData . sender . client !== permissionMessage . client ) {
216
218
deny ( " only one sender (mobile app instance) is allowed for each session. You need to restart the session to allow for a new client to connect. If you are the application developer, you can override this behaviour." ) ;
219
+ notify ( { type : ACTION_TYPES . CONNECTION_DENIED } ) ;
217
220
}
218
221
else {
219
222
allow ( ) ;
@@ -272,22 +275,27 @@ export const reducer = (state, action) => {
272
275
switch ( action . type ) {
273
276
case ACTION_TYPES . START_CONNECT :
274
277
case ACTION_TYPES . SEND_INIT_DATA :
275
- state = { ...state , errorMessage : '' , field : null } ;
278
+ state = { ...state , errorMessage : '' , field : null , isConnectionDenied : false } ;
276
279
break ;
277
280
case ACTION_TYPES . REGISTERED :
278
- state = { ...state , errorMessage : '' , field : null , connectionCode : action . connectionCode } ;
281
+ state = { ...state , errorMessage : '' , field : null , connectionCode : action . connectionCode , isConnectionDenied : false } ;
279
282
break ;
280
283
case ACTION_TYPES . RECEIVED_FIELD :
281
- state = { ...state , field : action . field } ;
284
+ state = { ...state , field : action . field , isConnectionDenied : false } ;
282
285
break ;
283
286
case ACTION_TYPES . CONNECTION_ERROR :
284
287
case ACTION_TYPES . REGISTER_FAILED :
285
- state = { ...state , errorMessage : action . errorMessage } ;
288
+ state = { ...state , errorMessage : action . errorMessage , isConnectionDenied : false } ;
289
+ break ;
290
+ case ACTION_TYPES . CONNECTION_DENIED :
291
+ state = { ...state , isConnectionDenied : true } ;
286
292
break ;
287
293
case ACTION_TYPES . SENDER_CONNECTED :
288
294
case ACTION_TYPES . SENDER_DISCONNECTED :
289
295
case ACTION_TYPES . SEND_FIELD :
290
296
case ACTION_TYPES . CLOSE :
297
+ state = { ...state , isConnectionDenied : false } ;
298
+ break ;
291
299
default :
292
300
} ;
293
301
return {
0 commit comments