From c8cac5e62f79073208175d319075395df3c44f22 Mon Sep 17 00:00:00 2001 From: Osei Fortune Date: Tue, 18 Sep 2018 15:13:41 -0400 Subject: [PATCH] Fix boolean value return [Android] #68 Fixes enable/disable debug mode --- src/package.json | 2 +- src/socketio.android.ts | 4 ++-- src/socketio.ios.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/package.json b/src/package.json index db7688a..256f252 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-socketio", - "version": "3.1.4", + "version": "3.1.5", "description": "Socket.IO for nativescript", "main": "socketio", "typings": "index.d.ts", diff --git a/src/socketio.android.ts b/src/socketio.android.ts index 04b86b6..789ba64 100644 --- a/src/socketio.android.ts +++ b/src/socketio.android.ts @@ -30,7 +30,7 @@ export class SocketIO extends Common { } else if (typeof query === 'string') { opts.query = query; } - } else if (key === 'debug') { + } else if (key === 'debug' && options[key]) { co.fitcom.fancylogger.FancyLogger.reset(new co.fitcom.fancylogger.FancyLogger()); java.util.logging.Logger.getLogger(io.socket.client.Socket.class.getName()).setLevel(java.util.logging.Level.FINEST); @@ -217,7 +217,7 @@ export function deserialize(data): any { } case 'java.lang.Boolean': { - return Boolean(data); + return String(data) === 'true'; } case 'java.lang.Integer': diff --git a/src/socketio.ios.ts b/src/socketio.ios.ts index 1fb1828..0f4a5f4 100644 --- a/src/socketio.ios.ts +++ b/src/socketio.ios.ts @@ -60,7 +60,7 @@ export class SocketIO extends Common { Object.assign(connectParams, optionsQuery); } - } else if (key === 'debug') { + } else if (key === 'debug' && obj[key]) { opts['log'] = true; } else { opts[key] = serialize(obj[key]);