chat4app-client-angular 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2287,8 +2287,7 @@
2287
2287
  };
2288
2288
  Chat4appClientAngularService.prototype.disconnectInternal = function (ignoreOffLine) {
2289
2289
  return __awaiter(this, void 0, void 0, function () {
2290
- var e_1;
2291
- var _this = this;
2290
+ var e_1, e_2;
2292
2291
  return __generator(this, function (_b) {
2293
2292
  switch (_b.label) {
2294
2293
  case 0:
@@ -2300,31 +2299,40 @@
2300
2299
  catch (e) {
2301
2300
  }
2302
2301
  }
2303
- if (!ignoreOffLine && this.nc && this.chatUserExternalId && this.chatUserExternalId.length > 0 && this.getBearerToken() && this.getBearerToken().length > 0) {
2304
- this.setOffLine(this.chatUserExternalId).subscribe(function () {
2305
- if (_this.debug) {
2306
- console.log("had set offline");
2307
- }
2308
- });
2309
- }
2310
- if (!this.nc) return [3 /*break*/, 5];
2302
+ if (!(!ignoreOffLine && this.nc && this.chatUserExternalId && this.chatUserExternalId.length > 0 && this.getBearerToken() && this.getBearerToken().length > 0)) return [3 /*break*/, 4];
2311
2303
  _b.label = 1;
2312
2304
  case 1:
2313
2305
  _b.trys.push([1, 3, , 4]);
2314
- return [4 /*yield*/, this.nc.close()];
2306
+ return [4 /*yield*/, this.setOffLine(this.chatUserExternalId).toPromise()];
2315
2307
  case 2:
2316
2308
  _b.sent();
2309
+ if (this.debug)
2310
+ console.log("had set offline");
2317
2311
  return [3 /*break*/, 4];
2318
2312
  case 3:
2319
2313
  e_1 = _b.sent();
2320
- if (this.debug) {
2321
- console.error(e_1);
2322
- }
2314
+ if (this.debug)
2315
+ console.error("Erro ao setar offline", e_1);
2323
2316
  return [3 /*break*/, 4];
2324
2317
  case 4:
2325
- this.nc = undefined;
2318
+ if (!this.nc) return [3 /*break*/, 9];
2326
2319
  _b.label = 5;
2327
2320
  case 5:
2321
+ _b.trys.push([5, 7, , 8]);
2322
+ return [4 /*yield*/, this.nc.close()];
2323
+ case 6:
2324
+ _b.sent();
2325
+ return [3 /*break*/, 8];
2326
+ case 7:
2327
+ e_2 = _b.sent();
2328
+ if (this.debug) {
2329
+ console.error(e_2);
2330
+ }
2331
+ return [3 /*break*/, 8];
2332
+ case 8:
2333
+ this.nc = undefined;
2334
+ _b.label = 9;
2335
+ case 9:
2328
2336
  if (this.debug) {
2329
2337
  console.log("disconect");
2330
2338
  }